Files
OrcaSlicer/src/slic3r/GUI/Widgets/TempInput.hpp
T
HanifKoh 4895bc03b4 Remove Unused Project Includes and Forward-Declare Where a Type Is Only Referenced (#16099)
* Remove Unused Project Includes and Forward-Declare Where a Type Is Only Referenced

Generated with include-what-you-use and applied conservatively. Only OrcaSlicer's own headers, the ones under src/ and tests/, are removed or forward-declared; standard-library and third-party includes are left alone. An include is removed only when both the Release and the Debug configuration leave it unused, never from inside a conditional block, and never from a file with platform-specific blocks, which only gain includes. Files whose only use of a header sits behind a feature or debug macro (libvgcode's OpenGL ES and marker code, the ARACHNE/TESTS_EXPORT_SVGS debug output) keep their includes.

clonable_ptr.hpp gains #pragma once; it had no include guard and was only safe while Config.hpp was its sole includer.

* Remove Unused Project Includes From Files With Platform-Specific Code

A Linux include-what-you-use run cannot see the code inside _WIN32, __APPLE__ or __linux__ blocks, so its verdict is only taken where nothing the removed header declares, directly or through what it includes, is named inside those blocks. Removals also have to hold in both the Release and Debug configuration and never touch a line inside a conditional block.

* Restore the libslic3r Precompiled Header and Direct Includes Lost in the Platform Pass

The platform-file pass treated pchheader.hpp as an ordinary header and
emptied it, and left GUI_Preview.hpp and 14 other files relying on
headers they no longer reached directly.

* Restore MainFrame.hpp in ParamsDialog.cpp for the Windows-Only Reparent Call

* Include Headers That Files Reached Through Ones the Cleanup Removed

* Drop Includes Duplicated by the Cleanup or by Main's Own Additions

* Leave PreciseSeam.cpp as Main Has It After the Precise Seam Rework
2026-10-05 16:47:17 +08:00

173 lines
4.7 KiB
C++

#ifndef slic3r_GUI_TempInput_hpp_
#define slic3r_GUI_TempInput_hpp_
#include "../wxExtensions.hpp"
#include <wx/anybutton.h>
#include <wx/event.h>
#include <wx/containr.h>
#include <wx/gdicmn.h>
#include "slic3r/GUI/Widgets/StateColor.hpp"
#include <wx/string.h>
#include <wx/popupwin.h>
#include <string>
#include <wx/checklst.h>
#include <wx/dc.h>
#include <wx/textctrl.h>
#include <wx/stattext.h>
#include "StaticBox.hpp"
#include <unordered_set>
class wxDC;
class wxPopupTransientWindow;
class wxStaticText;
class wxWindow;
wxDECLARE_EVENT(wxCUSTOMEVT_SET_TEMP_FINISH, wxCommandEvent);
enum TempInputType {
TEMP_OF_MAIN_NOZZLE_TYPE,
TEMP_OF_DEPUTY_NOZZLE_TYPE,
TEMP_OF_NORMAL_TYPE
};
class TempInput : public wxNavigationEnabled<StaticBox>
{
bool hover;
bool m_read_only{false};
bool m_on_changing {false};
wxSize labelSize;
ScalableBitmap normal_icon;
ScalableBitmap actice_icon;
ScalableBitmap degree_icon;
ScalableBitmap round_scale_hint_icon;/*the size hint of icon, use to compute size*/
StateColor label_color;
StateColor text_color;
wxTextCtrl * text_ctrl;
wxStaticText *warning_text;
int max_temp = 0;
int min_temp = 0;
std::unordered_set<int> additional_temps;
bool warning_mode = false;
TempInputType m_input_type;
int padding_left = 0;
static const int TempInputWidth = 200;
static const int TempInputHeight = 50;
public:
enum WarningType {
WARNING_TOO_HIGH,
WARNING_TOO_LOW,
WARNING_UNKNOWN,
};
TempInput();
TempInput(wxWindow * parent,
int type,
wxString text,
TempInputType input_type,
wxString label = "",
wxString normal_icon = "",
wxString actice_icon = "",
const wxPoint &pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0);
public:
void Create(wxWindow * parent,
wxString text,
wxString label = "",
wxString normal_icon = "",
wxString actice_icon = "",
const wxPoint &pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0);
wxPopupTransientWindow *wdialog{nullptr};
int temp_type;
bool actice = false;
wxString currentTemp;
wxString erasePending(wxString &str);
void SetTagTemp(int temp);
void SetTagTemp(wxString temp);
void SetCurrTemp(int temp);
void SetCurrTemp(wxString temp);
void SetCurrType(TempInputType type);
TempInputType GetCurrType(){return m_input_type;};
bool AllisNum(std::string str);
void SetFinish();
void Warning(bool warn, WarningType type = WARNING_UNKNOWN);
void SetIconActive();
void SetIconNormal();
void SetReadOnly(bool ro) { m_read_only = ro; }
void SetMaxTemp(int temp);
void SetMinTemp(int temp);
void AddTemp(int temp) { additional_temps.insert(temp); };
int GetType() { return temp_type; }
wxString GetTagTemp() { return text_ctrl->GetValue(); }
wxString GetCurrTemp() { return GetLabel(); }
int get_max_temp() { return max_temp; }
void SetLabel(const wxString &label) override;
void SetTextColor(StateColor const &color);
void SetLabelColor(StateColor const &color);
virtual void Rescale();
virtual bool Enable(bool enable = true) override;
virtual void SetMinSize(const wxSize &size) override;
wxTextCtrl *GetTextCtrl() { return text_ctrl; }
wxTextCtrl const *GetTextCtrl() const { return text_ctrl; }
bool IsOnChanging() const { return m_on_changing; }
void SetOnChanging() { m_on_changing = true; }
void ReSetOnChanging() { m_on_changing = false; }
protected:
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override;
void DoSetToolTipText(wxString const &tip) override;
private:
void ResetWaringDlg();
bool CheckIsValidVal(bool show_warning);
void paintEvent(wxPaintEvent &evt);
void render(wxDC &dc);
void messureMiniSize();
void messureSize();
// some useful events
void mouseMoved(wxMouseEvent &event);
void mouseWheelMoved(wxMouseEvent &event);
void mouseEnterWindow(wxMouseEvent &event);
void mouseLeaveWindow(wxMouseEvent &event);
void keyPressed(wxKeyEvent &event);
void keyReleased(wxKeyEvent &event);
DECLARE_EVENT_TABLE()
};
#endif // !slic3r_GUI_TempInput_hpp_