mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Code refactoring of the OptionsGroup class:
Controls are created only for the active page now
This commit is contained in:
parent
aedb3892ba
commit
398ff9053d
11 changed files with 568 additions and 386 deletions
|
@ -60,7 +60,6 @@ public:
|
|||
bool m_is_nonsys_values{ true };
|
||||
|
||||
// Delayed layout after resizing the main window.
|
||||
bool layout_valid = false;
|
||||
const std::vector<ScalableBitmap>& m_mode_bitmap_cache;
|
||||
|
||||
public:
|
||||
|
@ -73,7 +72,9 @@ public:
|
|||
size_t iconID() const { return m_iconID; }
|
||||
void set_config(DynamicPrintConfig* config_in) { m_config = config_in; }
|
||||
void reload_config();
|
||||
void update_visibility(ConfigOptionMode mode);
|
||||
void update_visibility(ConfigOptionMode mode, bool update_contolls_visibility);
|
||||
void activate(ConfigOptionMode mode);
|
||||
void clear();
|
||||
void msw_rescale();
|
||||
void sys_color_changed();
|
||||
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
|
||||
|
@ -195,7 +196,8 @@ protected:
|
|||
int m_icon_count;
|
||||
std::map<std::string, size_t> m_icon_index; // Map from an icon file name to its index
|
||||
std::vector<PageShp> m_pages;
|
||||
bool m_disable_tree_sel_changed_event;
|
||||
Page* m_active_page {nullptr};
|
||||
bool m_disable_tree_sel_changed_event {false};
|
||||
bool m_show_incompatible_presets;
|
||||
|
||||
std::vector<Preset::Type> m_dependent_tabs;
|
||||
|
@ -238,7 +240,7 @@ public:
|
|||
bool m_show_btn_incompatible_presets = false;
|
||||
PresetCollection* m_presets;
|
||||
DynamicPrintConfig* m_config;
|
||||
ogStaticText* m_parent_preset_description_line;
|
||||
ogStaticText* m_parent_preset_description_line = nullptr;
|
||||
ScalableButton* m_detach_preset_btn = nullptr;
|
||||
|
||||
// map of option name -> wxStaticText (colored label, associated with option)
|
||||
|
@ -277,7 +279,6 @@ public:
|
|||
void update_ui_items_related_on_parent_preset(const Preset* selected_preset_parent);
|
||||
void load_current_preset();
|
||||
void rebuild_page_tree();
|
||||
void update_page_tree_visibility();
|
||||
void update_btns_enabling();
|
||||
void update_preset_choice();
|
||||
// Select a new preset, possibly delete the current one.
|
||||
|
@ -285,6 +286,10 @@ public:
|
|||
bool may_discard_current_dirty_preset(PresetCollection* presets = nullptr, const std::string& new_printer_name = "");
|
||||
bool may_switch_to_SLA_preset();
|
||||
|
||||
virtual void clear_pages();
|
||||
virtual void update_description_lines();
|
||||
virtual void active_selected_page();
|
||||
|
||||
void OnTreeSelChange(wxTreeEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
|
||||
|
@ -294,6 +299,7 @@ public:
|
|||
void update_show_hide_incompatible_button();
|
||||
void update_ui_from_settings();
|
||||
void update_labels_colour();
|
||||
void decorate();
|
||||
void update_changed_ui();
|
||||
void get_sys_and_mod_flags(const std::string& opt_key, bool& sys_page, bool& modified_page);
|
||||
void update_changed_tree_ui();
|
||||
|
@ -307,6 +313,7 @@ public:
|
|||
virtual void on_preset_loaded() {}
|
||||
virtual void build() = 0;
|
||||
virtual void update() = 0;
|
||||
virtual void toggle_options() = 0;
|
||||
virtual void init_options_list();
|
||||
void load_initial_data();
|
||||
void update_dirty();
|
||||
|
@ -319,6 +326,7 @@ public:
|
|||
virtual void sys_color_changed();
|
||||
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
|
||||
Field* get_field(const t_config_option_key &opt_key, Page** selected_page, int opt_index = -1);
|
||||
void toggle_option(const std::string& opt_key, bool toggle, int opt_index = -1);
|
||||
bool set_value(const t_config_option_key& opt_key, const boost::any& value);
|
||||
wxSizer* description_line_widget(wxWindow* parent, ogStaticText** StaticText);
|
||||
bool current_preset_is_dirty();
|
||||
|
@ -365,15 +373,18 @@ public:
|
|||
|
||||
void build() override;
|
||||
void reload_config() override;
|
||||
void update_description_lines() override;
|
||||
void toggle_options() override;
|
||||
void update() override;
|
||||
void OnActivate() override;
|
||||
// void OnActivate() override;
|
||||
void clear_pages() override;
|
||||
bool supports_printer_technology(const PrinterTechnology tech) override { return tech == ptFFF; }
|
||||
};
|
||||
|
||||
class TabFilament : public Tab
|
||||
{
|
||||
ogStaticText* m_volumetric_speed_description_line;
|
||||
ogStaticText* m_cooling_description_line;
|
||||
ogStaticText* m_volumetric_speed_description_line {nullptr};
|
||||
ogStaticText* m_cooling_description_line {nullptr};
|
||||
|
||||
void add_filament_overrides_page();
|
||||
void update_filament_overrides_page();
|
||||
|
@ -388,8 +399,11 @@ public:
|
|||
|
||||
void build() override;
|
||||
void reload_config() override;
|
||||
void update_description_lines() override;
|
||||
void toggle_options() override;
|
||||
void update() override;
|
||||
void OnActivate() override;
|
||||
// void OnActivate() override;
|
||||
void clear_pages() override;
|
||||
bool supports_printer_technology(const PrinterTechnology tech) override { return tech == ptFFF; }
|
||||
};
|
||||
|
||||
|
@ -426,6 +440,8 @@ public:
|
|||
void build() override;
|
||||
void build_fff();
|
||||
void build_sla();
|
||||
void active_selected_page() override;
|
||||
void toggle_options() override;
|
||||
void update() override;
|
||||
void update_fff();
|
||||
void update_sla();
|
||||
|
@ -455,6 +471,7 @@ public:
|
|||
|
||||
void build() override;
|
||||
void reload_config() override;
|
||||
void toggle_options() override {};
|
||||
void update() override;
|
||||
void init_options_list() override;
|
||||
bool supports_printer_technology(const PrinterTechnology tech) override { return tech == ptSLA; }
|
||||
|
@ -472,25 +489,13 @@ public:
|
|||
|
||||
void build() override;
|
||||
void reload_config() override;
|
||||
void update_description_lines() override;
|
||||
void toggle_options() override;
|
||||
void update() override;
|
||||
// void init_options_list() override;
|
||||
void clear_pages() override;
|
||||
bool supports_printer_technology(const PrinterTechnology tech) override { return tech == ptSLA; }
|
||||
};
|
||||
|
||||
class SavePresetWindow :public wxDialog
|
||||
{
|
||||
public:
|
||||
SavePresetWindow(wxWindow* parent) :wxDialog(parent, wxID_ANY, _(L("Save preset"))) {}
|
||||
~SavePresetWindow() {}
|
||||
|
||||
std::string m_chosen_name;
|
||||
wxComboBox* m_combo;
|
||||
|
||||
void build(const wxString& title, const std::string& default_name, std::vector<std::string> &values);
|
||||
void accept();
|
||||
std::string get_name() { return m_chosen_name; }
|
||||
};
|
||||
|
||||
} // GUI
|
||||
} // Slic3r
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue