1 #ifndef slic3r_PhysicalPrinterDialog_hpp_
2 #define slic3r_PhysicalPrinterDialog_hpp_
3 
4 #include <vector>
5 
6 #include <wx/gdicmn.h>
7 
8 #include "libslic3r/Preset.hpp"
9 #include "GUI_Utils.hpp"
10 
11 class wxString;
12 class wxTextCtrl;
13 class wxStaticText;
14 class ScalableButton;
15 class wxBoxSizer;
16 
17 namespace Slic3r {
18 
19 namespace GUI {
20 
21 class PresetComboBox;
22 
23 //------------------------------------------
24 //          PresetForPrinter
25 //------------------------------------------
26 //static std::string g_info_string = " (modified)";
27 class PhysicalPrinterDialog;
28 class PresetForPrinter
29 {
30     PhysicalPrinterDialog* m_parent         { nullptr };
31 
32     PresetComboBox*     m_presets_list      { nullptr };
33     ScalableButton*     m_delete_preset_btn { nullptr };
34     wxStaticText*       m_info_line         { nullptr };
35     wxStaticText*       m_full_printer_name { nullptr };
36 
37     wxBoxSizer*         m_sizer             { nullptr };
38 
39     void DeletePreset(wxEvent& event);
40 
41 public:
42     PresetForPrinter(PhysicalPrinterDialog* parent, const std::string& preset_name = "");
43     ~PresetForPrinter();
44 
sizer()45     wxBoxSizer*         sizer() { return m_sizer; }
46     void                update_full_printer_name();
47     std::string         get_preset_name();
48     void                SuppressDelete();
49     void                AllowDelete();
50 
51     void                msw_rescale();
on_sys_color_changed()52     void                on_sys_color_changed() {};
53 };
54 
55 
56 //------------------------------------------
57 //          PhysicalPrinterDialog
58 //------------------------------------------
59 
60 class ConfigOptionsGroup;
61 class PhysicalPrinterDialog : public DPIDialog
62 {
63     PhysicalPrinter     m_printer;
64     wxString            m_default_name;
65     DynamicPrintConfig* m_config            { nullptr };
66 
67     wxTextCtrl*         m_printer_name      { nullptr };
68     std::vector<PresetForPrinter*> m_presets;
69 
70     ConfigOptionsGroup* m_optgroup          { nullptr };
71 
72     ScalableButton*     m_add_preset_btn                {nullptr};
73     ScalableButton*     m_printhost_browse_btn          {nullptr};
74     ScalableButton*     m_printhost_test_btn            {nullptr};
75     ScalableButton*     m_printhost_cafile_browse_btn   {nullptr};
76     ScalableButton*     m_printhost_port_browse_btn     {nullptr};
77 
78     wxBoxSizer*         m_presets_sizer                 {nullptr};
79 
80     void build_printhost_settings(ConfigOptionsGroup* optgroup);
81     void OnOK(wxEvent& event);
82     void AddPreset(wxEvent& event);
83 
84 public:
85     PhysicalPrinterDialog(wxWindow* parent, wxString printer_name);
86     ~PhysicalPrinterDialog();
87 
88     void        update(bool printer_change = false);
89     void        update_host_type(bool printer_change);
90     void        update_printhost_buttons();
91     void        update_printers();
92     wxString    get_printer_name();
93     void        update_full_printer_names();
get_printer()94     PhysicalPrinter*    get_printer() {return &m_printer; }
95     void                set_printer_technology(PrinterTechnology pt);
96     PrinterTechnology   get_printer_technology();
97 
98     void        DeletePreset(PresetForPrinter* preset_for_printer);
99 protected:
100     void on_dpi_changed(const wxRect& suggested_rect) override;
on_sys_color_changed()101     void on_sys_color_changed() override {};
102 
103     bool had_all_mk3;
104 };
105 
106 
107 } // namespace GUI
108 } // namespace Slic3r
109 
110 #endif
111