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

137 lines
4.0 KiB
C++

#ifndef slic3r_OG_CustomCtrl_hpp_
#define slic3r_OG_CustomCtrl_hpp_
#include <wx/panel.h>
#include <wx/gdicmn.h>
#include <wx/dc.h>
#include <wx/colour.h>
#include <cstddef>
#include <vector>
#include <wx/event.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/settings.h>
#include <map>
#include <functional>
#include <wx/types.h>
#include <wx/string.h>
#include <wx/validate.h>
#include "libslic3r/Config.hpp"
#include "OptionsGroup.hpp"
class wxColour;
class wxDC;
class wxMouseEvent;
class wxPaintEvent;
class wxSizer;
class wxWindow;
namespace Slic3r::GUI { class Field; }
// Translate the ifdef
#ifdef __WXOSX__
#define wxOSX true
#else
#define wxOSX false
#endif
namespace Slic3r { namespace GUI {
// Static text shown among the options.
class OG_CustomCtrl :public wxPanel
{
wxFont m_font;
int m_v_gap;
int m_v_gap2;
int m_h_gap;
int m_em_unit;
wxSize m_bmp_mode_sz;
wxSize m_bmp_blinking_sz;
int m_max_win_width{0};
struct CtrlLine {
wxCoord width{ wxDefaultCoord };
wxCoord height{ wxDefaultCoord };
OG_CustomCtrl* ctrl { nullptr };
const Line& og_line;
bool draw_just_act_buttons { false };
bool draw_mode_bitmap { true };
bool is_visible { true };
bool is_focused { false };
CtrlLine( wxCoord height,
OG_CustomCtrl* ctrl,
const Line& og_line,
bool draw_just_act_buttons = false,
bool draw_mode_bitmap = true);
~CtrlLine() { ctrl = nullptr; }
int get_max_win_width();
void correct_items_positions();
void msw_rescale();
void update_visibility(ConfigOptionMode mode);
void render_separator(wxDC& dc, wxCoord v_pos);
void render(wxDC& dc, wxCoord h_pos, wxCoord v_pos);
wxCoord draw_text (wxDC& dc, wxPoint pos, const wxString& text, const wxColour* color, int width, bool is_url = false, bool is_main = false);
wxPoint draw_blinking_bmp(wxDC& dc, wxPoint pos, bool is_blinking);
wxPoint draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmap& bmp_undo_to_sys, const wxBitmap& bmp_undo, bool is_blinking, size_t rect_id = 0, bool is_main = false);
wxCoord draw_edit_bmp(wxDC& dc, wxPoint pos, const wxBitmap& bmp_edit);
bool launch_browser() const;
bool is_separator() const { return og_line.is_separator(); }
std::vector<wxRect> rects_undo_icon;
std::vector<wxRect> rects_undo_to_sys_icon;
std::vector<wxRect> rects_edit_icon;
wxRect rect_label;
};
std::vector<CtrlLine> ctrl_lines;
public:
OG_CustomCtrl( wxWindow* parent,
OptionsGroup* og,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxEmptyString);
~OG_CustomCtrl() {}
void OnPaint(wxPaintEvent&);
void OnMotion(wxMouseEvent& event);
void OnLeftDown(wxMouseEvent& event);
void OnLeaveWin(wxMouseEvent& event);
void init_ctrl_lines();
bool update_visibility(ConfigOptionMode mode);
void correct_window_position(wxWindow* win, const Line& line, Field* field = nullptr);
void correct_widgets_position(wxSizer* widget, const Line& line, Field* field = nullptr);
void init_max_win_width();
void set_max_win_width(int max_win_width);
int get_max_win_width() { return m_max_win_width; }
//BBS
int get_title_width();
// BBS
void fixup_items_positions();
void msw_rescale();
void sys_color_changed();
wxPoint get_pos(const Line& line, Field* field = nullptr);
int get_height(const Line& line);
OptionsGroup* opt_group;
};
}}
#endif /* slic3r_OG_CustomCtrl_hpp_ */