ENH:optimize ams material settings

Change-Id: I1c6c57570fc7ba37d45854297e30182a0ffcaad4
This commit is contained in:
tao wang 2023-03-14 14:59:45 +08:00 committed by Lane.Wei
parent cd4cddfca4
commit 60f524167d
3 changed files with 348 additions and 27 deletions

View file

@ -28,6 +28,48 @@
namespace Slic3r { namespace GUI {
class ColorPicker : public wxWindow
{
public:
wxColour m_colour;
bool m_selected{false};
bool m_show_full{false};
ColorPicker(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
~ColorPicker();
void set_color(wxColour col);
void set_selected(bool sel) {m_selected = sel;Refresh();};
void set_show_full(bool full) {m_show_full = full;Refresh();};
void paintEvent(wxPaintEvent& evt);
void render(wxDC& dc);
void doRender(wxDC& dc);
};
class ColorPickerPopup : public PopupWindow
{
public:
StaticBox* m_def_color_box;
wxFlexGridSizer* m_ams_fg_sizer;
wxColour m_def_col;
std::vector<wxColour> m_def_colors;
std::vector<wxColour> m_ams_colors;
std::vector<ColorPicker*> m_color_pickers;
public:
ColorPickerPopup(wxWindow* parent);
~ColorPickerPopup() {};
void set_ams_colours(std::vector<wxColour> ams);
void set_def_colour(wxColour col);
void paintEvent(wxPaintEvent& evt);
virtual void OnDismiss() wxOVERRIDE;
virtual bool ProcessLeftDown(wxMouseEvent& event) wxOVERRIDE;
public:
};
class AMSMaterialsSetting : public DPIDialog
{
public:
@ -49,7 +91,8 @@ public:
void set_color(wxColour color);
MachineObject *obj{nullptr};
void on_picker_color(wxCommandEvent& color);
MachineObject* obj{ nullptr };
int ams_id { 0 }; /* 0 ~ 3 */
int tray_id { 0 }; /* 0 ~ 3 */
@ -62,6 +105,7 @@ public:
wxString m_brand_tmp;
wxColour m_brand_colour;
std::string m_filament_type;
ColorPickerPopup m_color_picker_popup;
protected:
void create_panel_normal(wxWindow* parent);
@ -70,7 +114,7 @@ protected:
void on_select_filament(wxCommandEvent& evt);
void on_select_ok(wxCommandEvent &event);
void on_select_close(wxCommandEvent &event);
void on_clr_picker(wxCommandEvent &event);
void on_clr_picker(wxMouseEvent &event);
bool is_virtual_tray();
void update_widgets();
@ -90,7 +134,7 @@ protected:
Button * m_button_confirm;
wxStaticText* m_tip_readonly;
Button * m_button_close;
Button * m_clr_picker;
ColorPicker * m_clr_picker;
wxColourData * m_clrData;
wxPanel * m_panel_kn;
@ -108,6 +152,8 @@ protected:
TextInput* m_readonly_filament;
};
wxDECLARE_EVENT(EVT_SELECTED_COLOR, wxCommandEvent);
}} // namespace Slic3r::GUI
#endif