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

166 lines
4.7 KiB
C++

#ifndef slic3r_AMSSettingDialog_hpp_
#define slic3r_AMSSettingDialog_hpp_
#include "libslic3r/Preset.hpp"
#include "wxExtensions.hpp"
#include "GUI_Utils.hpp"
#include "DeviceManager.hpp"
#include "Widgets/RadioBox.hpp"
#include "Widgets/Button.hpp"
#include "Widgets/RoundedRectangle.hpp"
#include "Widgets/Label.hpp"
#include "Widgets/CheckBox.hpp"
#include "slic3r/GUI/DeviceCore/DevFilaAmsSetting.h"
#include <wx/anybutton.h>
#include <wx/checklst.h>
#include <wx/gdicmn.h>
#include <wx/dialog.h>
#include <string>
#include <wx/event.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <memory>
#include <unordered_map>
#define AMS_SETTING_DEF_COLOUR wxColour(255, 255, 255)
#define AMS_SETTING_GREY800 wxColour(50, 58, 61)
#define AMS_SETTING_GREY700 wxColour(107, 107, 107)
#define AMS_SETTING_GREY200 wxColour(248, 248, 248)
#define AMS_SETTING_BODY_WIDTH FromDIP(380)
#define AMS_SETTING_BUTTON_SIZE wxSize(FromDIP(150), FromDIP(24))
#define AMS_F1_SUPPORT_INSERTION_UPDATE_DEFAULT std::string("00.00.07.89")
class AnimaIcon;
class ComboBox;
namespace Slic3r { namespace GUI {
class AMSSettingTypePanel;
class AMSSetting : public DPIDialog
{
public:
AMSSetting(wxWindow *parent, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
~AMSSetting();
public:
void UpdateByObj(MachineObject* obj);
protected:
void create();
void update_ams_img(MachineObject* obj);
void update_starting_read_mode(bool selected);
void update_remain_mode(bool selected);
void update_switch_filament(bool selected);
void update_insert_material_read_mode(MachineObject* obj);
void update_insert_material_read_mode(bool selected, std::string version);
void update_air_printing_detection(MachineObject* obj);
void update_firmware_switching_status();
// event handlers
void on_insert_material_read(wxCommandEvent& event);
void on_starting_read(wxCommandEvent& event);
void on_remain(wxCommandEvent& event);
void on_switch_filament(wxCommandEvent& event);
void on_air_print_detect(wxCommandEvent& event);
void on_dpi_changed(const wxRect &suggested_rect) override;
protected:
MachineObject *m_obj{nullptr};
wxStaticText* m_static_ams_settings = nullptr;
bool m_switching = false;
AMSSettingTypePanel* m_ams_type;
//AMSSettingArrangeAMSOrder* m_ams_arrange_order;
wxStaticBitmap* m_am_img;
std::string m_ams_img_name;
wxPanel * m_panel_body;
wxPanel* m_panel_Insert_material;
CheckBox * m_checkbox_Insert_material_auto_read;
wxStaticText *m_title_Insert_material_auto_read;
Label* m_tip_Insert_material_line1;
Label* m_tip_Insert_material_line2;
Label* m_tip_Insert_material_line3;
CheckBox * m_checkbox_starting_auto_read;
wxStaticText *m_title_starting_auto_read;
Label* m_tip_starting_line1;
Label* m_tip_starting_line2;
CheckBox * m_checkbox_remain;
wxStaticText *m_title_remain;
Label* m_tip_remain_line1;
CheckBox* m_checkbox_switch_filament;
wxStaticText* m_title_switch_filament;
Label* m_tip_switch_filament_line1;
CheckBox* m_checkbox_air_print;
wxStaticText* m_title_air_print;
Label* m_tip_air_print_line;
wxStaticText *m_tip_ams_img;
Button * m_button_auto_demarcate;
wxBoxSizer *m_sizer_Insert_material_tip_inline;
wxBoxSizer *m_sizer_starting_tip_inline;
wxBoxSizer *m_sizer_remain_inline;
wxBoxSizer *m_sizer_switch_filament_inline;
wxBoxSizer *m_sizer_remain_block;
};
class AMSSettingTypePanel : public wxPanel
{
public:
AMSSettingTypePanel(wxWindow* parent, AMSSetting* setting_dlg);
~AMSSettingTypePanel();
public:
void UpdateInfo(const MachineObject* obj);
private:
void CreateGui();
void OnAmsTypeChanged(wxCommandEvent& event);
private:
std::weak_ptr<DevAmsSystemFirmwareSwitch> m_ams_firmware_switch;
int m_ams_firmware_current_idx{ -1 };
std::unordered_map<int, DevAmsSystemFirmwareSwitch::DevAmsSystemFirmware> m_ams_firmwares;
// widgets
AMSSetting* m_setting_dlg;
ComboBox* m_type_combobox;
Label* m_switching_tips;
AnimaIcon* m_switching_icon;
};
// Orca: the firmware AMS-reorder ("Arrange AMS Order") panel is intentionally not shipped.
#if 0
class AMSSettingArrangeAMSOrder : public wxPanel
{
public:
AMSSettingArrangeAMSOrder(wxWindow* parent);
public:
void Update(const MachineObject* obj);
void Rescale() { m_btn_rearrange->msw_rescale(); Layout(); };
private:
void CreateGui();
void OnBtnRearrangeClicked(wxCommandEvent& event);
private:
std::weak_ptr<DevAmsSystemFirmwareSwitch> m_ams_firmware_switch;
ScalableButton* m_btn_rearrange;
};
#endif
}} // namespace Slic3r::GUI
#endif