Files
OrcaSlicer/src/slic3r/GUI/SendMultiMachinePage.hpp
T
HanifKoh 1a5f91d727 Add Missing Includes Across src/slic3r/GUI (#16048)
* Add Missing Includes Across src/slic3r/GUI

Every GUI source and header now directly includes the headers declaring what it uses, rather than relying on the precompiled header or transitive includes. Generated with clang-tidy misc-include-cleaner, plus one hand edit making CalibrationPanel.hpp self-contained.

* Drop the OS-Specific Includes Added Outside Their Platform Guards

GLib, GTK, D-Bus and POSIX headers are only used inside platform #if blocks, which already include them. Added unconditionally at the top of the file they broke the Windows build.

* Add the clang-tidy Configuration That Generated These Includes

Only misc-include-cleaner's missing-include check, with the headers it must never suggest: per-platform, internal and OS-specific ones that would break other platforms or are not meant to be included directly.

* Match Windows Paths in the clang-tidy Ignore List

Header paths use backslashes on Windows, so every / in a pattern is now [/\\]. The Windows SDK headers are ignored alongside the other OS-specific ones, and the list is one pattern per line. Suggested by @raistlin7447 from a Windows clang-cl run.
2026-10-02 14:56:56 +08:00

227 lines
8.2 KiB
C++

#ifndef slic3r_SendMultiMachinePage_hpp_
#define slic3r_SendMultiMachinePage_hpp_
#include "GUI_Utils.hpp"
#include "MultiMachine.hpp"
#include "DeviceManager.hpp"
#include "Widgets/Label.hpp"
#include "Widgets/Button.hpp"
#include "Widgets/CheckBox.hpp"
#include "Widgets/ComboBox.hpp"
#include "Widgets/ScrolledWindow.hpp"
#include "Widgets/PopupWindow.hpp"
#include "Widgets/TextInput.hpp"
#include "AmsMappingPopup.hpp"
#include "SelectMachine.hpp"
#include <wx/string.h>
#include <wx/list.h>
#include <wx/dc.h>
#include <wx/event.h>
#include "slic3r/GUI/wxExtensions.hpp"
#include <map>
#include <string>
#include <wx/timer.h>
#include <wx/scrolwin.h>
#include <wx/sizer.h>
#include "libslic3r/AppConfig.hpp"
#include <wx/panel.h>
#include <vector>
#include "libslic3r/ProjectTask.hpp"
#include "slic3r/GUI/Widgets/StateColor.hpp"
#include <wx/simplebook.h>
#include "libslic3r/GCode/ThumbnailData.hpp"
namespace Slic3r {
struct PrintParams;
namespace GUI {
#define SEND_LEFT_PADDING_LEFT 15
#define SEND_LEFT_PRINTABLE 40
#define SEND_LEFT_DEV_NAME 250
#define SEND_LEFT_DEV_STATUS 250
#define SEND_LEFT_TAKS_STATUS 180
#define SEND_DESIGN_SELECTOR_NOMORE_COLOR wxColour(248, 248, 248)
#define SEND_DESIGN_GRAY900_COLOR wxColour(38, 46, 48)
#define SEND_DESIGN_GRAY800_COLOR wxColour(50, 58, 61)
#define SEND_DESIGN_GRAY600_COLOR wxColour(144, 144, 144)
#define SEND_DESIGN_GRAY400_COLOR wxColour(166, 169, 170)
#define SEND_DESIGN_RESOUTION_PREFERENCES wxSize(FromDIP(540), -1)
#define SEND_DESIGN_COMBOBOX_SIZE wxSize(FromDIP(140), -1)
#define SEND_DESIGN_LARGE_COMBOBOX_SIZE wxSize(FromDIP(160), -1)
#define SEND_DESIGN_INPUT_SIZE wxSize(FromDIP(50), -1)
#define THUMBNAIL_SIZE FromDIP(128)
class RadioBox;
class AmsRadioSelector
{
public:
wxString m_param_name;
int m_groupid;
RadioBox* m_radiobox;
bool m_selected = false;
};
WX_DECLARE_LIST(AmsRadioSelector, AmsRadioSelectorList);
class SendDeviceItem : public DeviceItem
{
public:
SendDeviceItem(wxWindow* parent, MachineObject* obj);
~SendDeviceItem() {};
void DrawTextWithEllipsis(wxDC& dc, const wxString& text, int maxWidth, int left, int top = 0);
void OnEnterWindow(wxMouseEvent& evt);
void OnLeaveWindow(wxMouseEvent& evt);
void OnSelectedDevice(wxCommandEvent& evt);
void OnLeftDown(wxMouseEvent& evt);
void OnMove(wxMouseEvent& evt);
void paintEvent(wxPaintEvent& evt);
void render(wxDC& dc);
void doRender(wxDC& dc);
void post_event(wxCommandEvent&& event);
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
public:
bool m_hover{false};
ScalableBitmap m_bitmap_check_disable;
ScalableBitmap m_bitmap_check_off;
ScalableBitmap m_bitmap_check_on;
};
class Plater;
class SendMultiMachinePage : public DPIDialog
{
private:
/* dev_id -> device_item */
std::map<std::string, SendDeviceItem*> m_device_items;
wxTimer* m_refresh_timer = nullptr;
// sort
SortItem m_sort;
bool device_name_big{ true };
bool device_printable_big{ true };
bool device_en_ams_big{ true };
Button* m_button_send{ nullptr };
wxScrolledWindow* scroll_macine_list{ nullptr };
wxBoxSizer* sizer_machine_list{ nullptr };
Plater* m_plater{ nullptr };
int m_print_plate_idx;
bool m_is_canceled{ false };
bool m_export_3mf_cancel{ false };
AppConfig* app_config;
wxPanel* m_main_page{ nullptr };
wxScrolledWindow* m_main_scroll{ nullptr };
wxBoxSizer* m_sizer_body{ nullptr };
wxGridSizer* m_ams_list_sizer{ nullptr };
AmsMapingPopup* m_mapping_popup{ nullptr };
AmsRadioSelectorList m_radio_group;
MaterialHash m_material_list;
std::map<std::string, CheckBox*> m_checkbox_map;
std::map<std::string, TextInput*> m_input_map;
std::vector<FilamentInfo> m_filaments;
std::vector<FilamentInfo> m_ams_mapping_result;
int m_current_filament_id{ 0 };
StateColor btn_bg_enable;
// table head
wxPanel* m_table_head_panel{ nullptr };
wxBoxSizer* m_table_head_sizer{ nullptr };
CheckBox* m_select_checkbox{ nullptr };
Button* m_printer_name{ nullptr };
Button* m_device_status{ nullptr };
//Button* m_task_status{ nullptr };
Button* m_ams{ nullptr };
Button* m_refresh_button{ nullptr };
// rename
wxSimplebook* m_rename_switch_panel{ nullptr };
wxPanel* m_rename_normal_panel{ nullptr };
wxPanel* m_rename_edit_panel{ nullptr };
TextInput* m_rename_input{ nullptr };
ScalableButton* m_rename_button{ nullptr };
wxBoxSizer* rename_sizer_v{ nullptr };
wxBoxSizer* rename_sizer_h{ nullptr };
wxStaticText* m_task_name{ nullptr };
wxString m_current_project_name;
bool m_is_rename_mode{ false };
// title and thumbnail
wxPanel* m_title_panel{ nullptr };
wxBoxSizer* m_title_sizer{ nullptr };
wxBoxSizer* m_text_sizer{ nullptr };
wxStaticText* m_stext_time{ nullptr };
wxStaticText* m_stext_weight{ nullptr };
wxStaticBitmap* timeimg{ nullptr };
ScalableBitmap* print_time{ nullptr };
wxStaticBitmap* weightimg{ nullptr };
ScalableBitmap* print_weight{ nullptr };
ThumbnailPanel* m_thumbnail_panel{nullptr};
wxPanel* m_panel_image{ nullptr };
wxBoxSizer* m_image_sizer{ nullptr };
// tip when no device
wxStaticText* m_tip_text{ nullptr };
Button* m_button_add{ nullptr };
public:
SendMultiMachinePage(Plater* plater = nullptr);
~SendMultiMachinePage();
void prepare(int plate_idx);
void on_dpi_changed(const wxRect& suggested_rect);
void on_sys_color_changed();
void refresh_user_device();
void on_send(wxCommandEvent& event);
bool Show(bool show);
PrintParams request_params(MachineObject* obj);
bool get_ams_mapping_result(std::string &mapping_array_str, std::string &mapping_array_str2, std::string &ams_mapping_info);
wxBoxSizer* create_item_title(wxString title, wxWindow* parent, wxString tooltip);
wxBoxSizer* create_item_checkbox(wxString title, wxWindow* parent, wxString tooltip, int padding_left, std::string param);
wxBoxSizer* create_item_input(wxString str_before, wxString str_after, wxWindow* parent, wxString tooltip, std::string param);
wxBoxSizer* create_item_radiobox(wxString title, wxWindow* parent, wxString tooltip, int groupid, std::string param);
wxPanel* create_page();
void sync_ams_list();
void set_default_normal(const ThumbnailData& data);
void set_default();
void on_rename_enter();
void check_fcous_state(wxWindow* window);
void check_focus(wxWindow* window);
protected:
void OnSelectRadio(wxMouseEvent& event);
void on_select_radio(std::string param);
bool get_value_radio(std::string param);
void on_set_finish_mapping(wxCommandEvent& evt);
void on_rename_click(wxCommandEvent& event);
void on_timer(wxTimerEvent& event);
void init_timer();
private:
};
} // namespace GUI
} // namespace Slic3r
#endif