Files
OrcaSlicer/src/slic3r/GUI/Widgets/StepCtrl.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

143 lines
3.2 KiB
C++

#ifndef slic3r_GUI_StepCtrlBase_hpp_
#define slic3r_GUI_StepCtrlBase_hpp_
#include "StaticBox.hpp"
#include <wx/anybutton.h>
#include <wx/event.h>
#include "slic3r/GUI/Widgets/StateColor.hpp"
#include <vector>
#include <wx/string.h>
#include <wx/gdicmn.h>
#include <wx/checklst.h>
#include "slic3r/GUI/wxExtensions.hpp"
#include <wx/dc.h>
class wxDC;
class wxWindow;
wxDECLARE_EVENT( EVT_STEP_CHANGING, wxCommandEvent );
wxDECLARE_EVENT( EVT_STEP_CHANGED, wxCommandEvent );
class StepCtrlBase : public StaticBox
{
protected:
wxFont font_tip;
StateColor clr_bar;
StateColor clr_step;
StateColor clr_text;
StateColor clr_tip;
int radius = 7;
int bar_width = 4;
std::vector<wxString> steps;
std::vector<wxString> tips;
wxString hint;
int step = -1;
wxPoint drag_offset;
wxPoint pos_thumb;
public:
StepCtrlBase(wxWindow * parent,
wxWindowID id,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0);
~StepCtrlBase();
public:
void SetHint(wxString hint);
bool SetTipFont(wxFont const & font);
public:
int AppendItem(const wxString &item, wxString const & tip = {});
void DeleteAllItems();
unsigned int GetCount() const;
int GetSelection() const;
void SelectItem(int item);
void Idle();
wxString GetItemText(unsigned int item) const;
int GetItemUseText(wxString txt) const;
void SetItemText(unsigned int item, wxString const& value);
private:
// some useful events
bool sendStepCtrlEvent(bool changing = false);
};
class StepCtrl : public StepCtrlBase
{
ScalableBitmap bmp_thumb;
public:
StepCtrl(wxWindow * parent,
wxWindowID id,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0);
virtual void Rescale();
private:
void mouseDown(wxMouseEvent &event);
void mouseMove(wxMouseEvent &event);
void mouseUp(wxMouseEvent &event);
void mouseCaptureLost(wxMouseCaptureLostEvent &event);
void doRender(wxDC &dc) override;
DECLARE_EVENT_TABLE()
};
class StepIndicator : public StepCtrlBase
{
ScalableBitmap bmp_ok;
public:
StepIndicator(wxWindow *parent,
wxWindowID id,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0);
virtual void Rescale();
void SelectNext();
private:
void doRender(wxDC &dc) override;
};
class FilamentStepIndicator : public StepCtrlBase
{
ScalableBitmap bmp_ok;
//wxBitmap bmp_extruder;
wxString m_slot_information = "";
public:
FilamentStepIndicator(wxWindow* parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0);
virtual void Rescale();
void SelectNext();
void SetSlotInformation(wxString slot);
private:
void doRender(wxDC& dc) override;
};
#endif // !slic3r_GUI_StepCtrlBase_hpp_