Files
OrcaSlicer/src/slic3r/GUI/ExtrusionCalibration.hpp
T
HanifKoh 84657ff11e Add Missing Includes Across the Remaining Sources and Tests (#16071)
* Ignore Clipper, libpng, mcut and Boost.Polygon Internals in clang-tidy

Each only works through a wrapper or umbrella header: libslic3r/clipper.hpp or clipper_z.hpp configure Clipper before including it, png.h pulls in libpng's config headers, and Boost.Polygon's headers only compile through polygon.hpp or voronoi.hpp.

* Ignore minilzo's Config Headers in clang-tidy

lzoconf.h and lzodefs.h are internal to minilzo.h, which is what the code includes.

* Add Missing Includes Across the Remaining Sources and Tests

Covers src/slic3r/Utils, src/slic3r/plugin, src/slic3r/Config, src/libvgcode, src/dev-utils, src/OrcaSlicer.cpp and tests/, the directories left after src/slic3r/GUI and src/libslic3r. Generated with clang-tidy misc-include-cleaner. libvgcode's own headers are included by relative path as in the rest of that library, and Catch2 and pybind11 with angle brackets as elsewhere in the repo.

* Make the GUI and Test Headers Compile on Their Own

Each now includes, or forward-declares, what it uses instead of relying on what its includers happened to include first. Headers that only compile on one platform, or that nothing built includes, are left alone.

* Keep Windows and nanosvg Setup Ahead of the Added Includes

OrcaSlicer.cpp and several tests set _WIN32_WINNT, WIN32_LEAN_AND_MEAN or NOMINMAX before including Windows.h, and the profile validator defines NANOSVG_IMPLEMENTATION before any libslic3r header. The added includes had landed above those blocks, which broke the Windows build.

* Add the GUI Includes the First Pass Missed

Covers headers that only became editable once they compiled on their own, and wx symbols whose suggested header changed as the clang-tidy ignore list grew after the src/slic3r/GUI pass.

* Keep the Added Test Includes Below the NOMINMAX Guard

test_marchingsquares.cpp and test_texture_displacement.cpp had includes inside #ifndef NOMINMAX, which the tests inherit as defined on Windows from libslic3r, so those were skipped there. .clang-tidy also ignores the MSVC STL and UCRT internals, Boost.Multiprecision's fwd.hpp and CPython's Windows include directory, as in #16068.
2026-10-03 13:45:21 +08:00

155 lines
4.9 KiB
C++

#ifndef slic3r_ExtrusionCalibration_hpp_
#define slic3r_ExtrusionCalibration_hpp_
#include "libslic3r/Preset.hpp"
#include "wxExtensions.hpp"
#include "GUI_Utils.hpp"
#include "DeviceManager.hpp"
#include "wx/clrpicker.h"
#include "Widgets/RadioBox.hpp"
#include "Widgets/Button.hpp"
#include "Widgets/RoundedRectangle.hpp"
#include "Widgets/Label.hpp"
#include "Widgets/CheckBox.hpp"
#include "Widgets/ComboBox.hpp"
#include "Widgets/TextInput.hpp"
#include "ParamsDialog.hpp"
#include "GUI_App.hpp"
#include "wx/hyperlink.h"
#include <wx/anybutton.h>
#include <wx/checklst.h>
#include <wx/string.h>
#include <string>
#include <vector>
#include <wx/event.h>
#include "libslic3r/PrintConfig.hpp"
#include <wx/panel.h>
#define EXTRUSION_CALIBRATION_DEF_COLOUR wxColour(255, 255, 255)
#define EXTRUSION_CALIBRATION_GREY900 wxColour(38, 46, 48)
#define EXTRUSION_CALIBRATION_GREY800 wxColour(50, 58, 61)
#define EXTRUSION_CALIBRATION_GREY700 wxColour(107, 107, 107)
#define EXTRUSION_CALIBRATION_GREY300 wxColour(238, 238, 238)
#define EXTRUSION_CALIBRATION_GREY200 wxColour(248, 248, 248)
#define EXTRUSION_CALIBRATION_BODY_WIDTH FromDIP(380)
#define EXTRUSION_CALIBRATION_LABEL_WIDTH FromDIP(80)
#define EXTRUSION_CALIBRATION_WIDGET_GAP FromDIP(18)
#define EXTRUSION_CALIBRATION_DIALOG_SIZE wxSize(FromDIP(400), -1)
//#define EXTRUSION_CALIBRATION_DIALOG_SIZE wxSize(FromDIP(520), -1)
#define EXTRUSION_CALIBRATION_BED_COMBOX wxSize(FromDIP(200), FromDIP(24))
#define EXTRUSION_CALIBRATION_BUTTON_SIZE wxSize(FromDIP(72), FromDIP(24))
#define EXTRUSION_CALIBRATION_INPUT_SIZE wxSize(FromDIP(100), FromDIP(24))
#define EXTRUSION_CALIBRATION_BMP_SIZE wxSize(FromDIP(256), FromDIP(256))
#define EXTRUSION_CALIBRATION_BMP_TIP_BAR wxSize(FromDIP(256), FromDIP(40))
#define EXTRUSION_CALIBRATION_BMP_BTN_SIZE wxSize(FromDIP(16), FromDIP(16))
namespace Slic3r { namespace GUI {
class ExtrusionCalibration : public DPIDialog
{
public:
ExtrusionCalibration(wxWindow *parent, wxWindowID id);
~ExtrusionCalibration();
void create();
void input_value_finish();
void update();
bool Show(bool show) override;
void Popup();
void post_select_event();
void update_machine_obj(MachineObject* obj_) { obj = obj_; };
// input is 1 or 2
void set_step(int step_index);
static bool check_k_n_validation(wxString k_text, wxString n_text);
static bool check_k_validation(wxString k_text);
MachineObject *obj { nullptr };
int ams_id { 0 }; /* 0 ~ 3 */
int tray_id { 0 }; /* 0 ~ 3 | 254 for virtual tray id*/
std::string ams_filament_id;
std::string m_filament_type;
std::vector<Preset*> user_filaments;
protected:
void init_bitmaps();
void on_dpi_changed(const wxRect &suggested_rect) override;
void paint(wxPaintEvent&);
void open_bitmap(wxMouseEvent& event);
void on_select_filament(wxCommandEvent& evt);
void on_select_bed_type(wxCommandEvent& evt);
void on_select_nozzle_dia(wxCommandEvent& evt);
void on_click_cali(wxCommandEvent& evt);
void on_click_cancel(wxCommandEvent& evt);
void on_click_save(wxCommandEvent& evt);
void on_click_last(wxCommandEvent& evt);
void on_click_next(wxCommandEvent& evt);
void update_filament_info();
void update_combobox_filaments();
wxString get_bed_type_incompatible(bool incompatible);
void show_info(bool show, bool is_error, wxString text);
int get_bed_temp(DynamicPrintConfig* config);
protected:
wxPanel* m_step_1_panel;
wxPanel* m_step_2_panel;
// title of select filament preset
Label* m_filament_preset_title;
// select a filament preset
#ifdef __APPLE__
wxComboBox* m_comboBox_filament;
#else
ComboBox* m_comboBox_filament;
#endif
#ifdef __APPLE__
wxComboBox* m_comboBox_bed_type;
#else
ComboBox* m_comboBox_bed_type;
#endif
#ifdef __APPLE__
wxComboBox* m_comboBox_nozzle_dia;
#else
ComboBox* m_comboBox_nozzle_dia;
#endif
TextInput* m_nozzle_temp;
TextInput* m_bed_temp;
TextInput* m_max_flow_ratio;
Button* m_cali_cancel;
Button* m_button_cali;
Button* m_button_next_step;
Label* m_save_cali_result_title;
wxStaticText* m_fill_cali_params_tips;
wxStaticText* m_info_text;
wxStaticText* m_error_text;
wxBitmap m_calibration_tips_open_btn_bmp;
wxBitmap m_calibration_tips_bmp_zh;
wxBitmap m_calibration_tips_bmp_en;
wxStaticBitmap* m_calibration_tips_static_bmp;
// save n and k result
wxStaticText* m_k_param;
TextInput* m_k_val;
wxStaticText* m_n_param;
TextInput* m_n_val;
Button* m_button_last_step;
Button* m_button_save_result;
bool m_is_zh{ false };
};
}} // namespace Slic3r::GUI
#endif