diff options
Diffstat (limited to 'src/slic3r/GUI/MainFrame.hpp')
-rw-r--r-- | src/slic3r/GUI/MainFrame.hpp | 77 |
1 files changed, 68 insertions, 9 deletions
diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index 8c8b98090..9504376b4 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -7,12 +7,14 @@ #include <wx/settings.h> #include <wx/string.h> #include <wx/filehistory.h> +#ifdef __APPLE__ +#include <wx/taskbar.h> +#endif // __APPLE__ #include <string> #include <map> #include "GUI_Utils.hpp" -#include "Plater.hpp" #include "Event.hpp" class wxNotebook; @@ -27,6 +29,8 @@ namespace GUI class Tab; class PrintHostQueueDialog; +class Plater; +class MainFrame; enum QuickSlice { @@ -43,6 +47,23 @@ struct PresetTab { PrinterTechnology technology; }; +// ---------------------------------------------------------------------------- +// SettingsDialog +// ---------------------------------------------------------------------------- + +class SettingsDialog : public DPIDialog +{ + wxNotebook* m_tabpanel { nullptr }; + MainFrame* m_main_frame { nullptr }; +public: + SettingsDialog(MainFrame* mainframe); + ~SettingsDialog() = default; + void set_tabpanel(wxNotebook* tabpanel) { m_tabpanel = tabpanel; } + +protected: + void on_dpi_changed(const wxRect& suggested_rect) override; +}; + class MainFrame : public DPIFrame { bool m_loaded {false}; @@ -50,12 +71,17 @@ class MainFrame : public DPIFrame wxString m_qs_last_input_file = wxEmptyString; wxString m_qs_last_output_file = wxEmptyString; wxString m_last_config = wxEmptyString; + wxMenuBar* m_menubar{ nullptr }; + #if 0 wxMenuItem* m_menu_item_repeat { nullptr }; // doesn't used now #endif wxMenuItem* m_menu_item_reslice_now { nullptr }; + wxSizer* m_main_sizer{ nullptr }; + + - PrintHostQueueDialog *m_printhost_queue_dlg; + size_t m_last_selected_tab; std::string get_base_name(const wxString &full_name, const char *extension = nullptr) const; std::string get_dir_name(const wxString &full_name) const; @@ -86,6 +112,7 @@ class MainFrame : public DPIFrame miExport = 0, // Export G-code Export miSend, // Send G-code Send to print miMaterialTab, // Filament Settings Material Settings + miPrinterTab, // Different bitmap for Printer Settings }; // vector of a MenuBar items changeable in respect to printer technology @@ -93,13 +120,27 @@ class MainFrame : public DPIFrame wxFileHistory m_recent_projects; + enum class ESettingsLayout + { + Unknown, + Old, + New, + Dlg, + GCodeViewer + }; + + ESettingsLayout m_layout{ ESettingsLayout::Unknown }; + protected: virtual void on_dpi_changed(const wxRect &suggested_rect); + virtual void on_sys_color_changed() override; public: MainFrame(); ~MainFrame() = default; + void update_layout(); + // Called when closing the application and when switching the application language. void shutdown(); @@ -110,12 +151,18 @@ public: void init_tabpanel(); void create_preset_tabs(); void add_created_tab(Tab* panel); - void init_menubar(); + bool is_active_and_shown_tab(Tab* tab); + // Register Win32 RawInput callbacks (3DConnexion) and removable media insert / remove callbacks. + // Called from wxEVT_ACTIVATE, as wxEVT_CREATE was not reliable (bug in wxWidgets?). + void register_win32_callbacks(); + void init_menubar_as_editor(); + void init_menubar_as_gcodeviewer(); void update_menubar(); - void update_ui_from_settings(); + void update_ui_from_settings(bool apply_free_camera_correction = true); bool is_loaded() const { return m_loaded; } bool is_last_input_file() const { return !m_qs_last_input_file.IsEmpty(); } + bool is_dlg_layout() const { return m_layout == ESettingsLayout::Dlg; } void quick_slice(const int qs = qsUndef); void reslice_now(); @@ -125,10 +172,13 @@ public: void load_config_file(); // Open a config file. Return true if loaded. bool load_config_file(const std::string &path); - void export_configbundle(); + void export_configbundle(bool export_physical_printers = false); void load_configbundle(wxString file = wxEmptyString); void load_config(const DynamicPrintConfig& config); - void select_tab(size_t tab) const; + // Select tab in m_tabpanel + // When tab == -1, will be selected last selected tab + void select_tab(Tab* tab); + void select_tab(size_t tab = size_t(-1)); void select_view(const std::string& direction); // Propagate changed configuration from the Tab to the Plater and save changes to the AppConfig void on_config_changed(DynamicPrintConfig* cfg) const ; @@ -137,13 +187,22 @@ public: PrintHostQueueDialog* printhost_queue_dlg() { return m_printhost_queue_dlg; } - Plater* m_plater { nullptr }; - wxNotebook* m_tabpanel { nullptr }; - wxProgressDialog* m_progress_dialog { nullptr }; + Plater* m_plater { nullptr }; + wxNotebook* m_tabpanel { nullptr }; + SettingsDialog m_settings_dialog; + wxWindow* m_plater_page{ nullptr }; + wxProgressDialog* m_progress_dialog { nullptr }; + PrintHostQueueDialog* m_printhost_queue_dlg; std::shared_ptr<ProgressStatusBar> m_statusbar; +#ifdef __APPLE__ + std::unique_ptr<wxTaskBarIcon> m_taskbar_icon; +#endif // __APPLE__ + #ifdef _WIN32 void* m_hDeviceNotify { nullptr }; + uint32_t m_ulSHChangeNotifyRegister { 0 }; + static constexpr int WM_USER_MEDIACHANGED { 0x7FFF }; // WM_USER from 0x0400 to 0x7FFF, picking the last one to not interfere with wxWidgets allocation #endif // _WIN32 }; |