mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-23 17:02:39 +00:00
* chore: mark every declaration that overrides a base virtual clang-cl reports 42 member functions across 28 files that override a base virtual without being marked `override`, inside classes that already mark their other overrides. That is every occurrence of -Winconsistent-missing-override in the tree, so the category drops to zero and -Werror=inconsistent-missing-override becomes available as a guard against it coming back. Behaviour is unchanged. Each keyword goes only where clang had already resolved the declaration to a base virtual, so it records what the compiler already worked out and cannot affect overload resolution or dispatch. If any of these signatures had not really overridden a base method, the build would have failed rather than warned. Where a declaration already carried `virtual` it is left alone and the keyword appended, matching the surrounding declarations. Plain `override` is used rather than the wxWidgets `wxOVERRIDE` macro, which wx/defs.h defines as `override` beneath a comment marking it obsolete, and which the rest of src/slic3r already avoids by 1742 occurrences to 113. A full clang-cl build takes -Winconsistent-missing-override from 1,146 warning lines to 0. Those 42 declarations produce that many lines because a header is re-diagnosed in every translation unit that includes it. CalibrationWizardStartPage.hpp alone accounts for 336 of them from 4 declarations. * chore: drop unused lambda captures in GUI/Widgets clang-cl reports 10 lambda captures in src/slic3r/GUI/Widgets that are never read. Removing them changes nothing at runtime. Every capture removed is `this` or a raw pointer. clang does not report a capture whose type has a non-trivial destructor, since such a capture can be held purely for its effect on an object's lifetime, so nothing that owns or extends a lifetime is touched. The std::weak_ptr captured beside the removed `this` in MultiNozzleSync.cpp stays. This clears the category in GUI/Widgets only. A full clang-cl build takes -Wunused-lambda-capture from 312 warning lines to 302, leaving 235 sites in other directories for a follow-up.
158 lines
4.3 KiB
C++
158 lines
4.3 KiB
C++
#ifndef slic3r_GUI_TempInput_hpp_
|
|
#define slic3r_GUI_TempInput_hpp_
|
|
|
|
#include "../wxExtensions.hpp"
|
|
#include <wx/textctrl.h>
|
|
#include <wx/stattext.h>
|
|
#include "StaticBox.hpp"
|
|
|
|
#include <unordered_set>
|
|
|
|
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_
|