Merge remote-tracking branch 'origin/profile_changes_reset'

This commit is contained in:
bubnikv 2018-04-13 18:31:19 +02:00
commit eb58e29245
19 changed files with 747 additions and 238 deletions

View file

@ -21,6 +21,7 @@
#include <wx/treectrl.h>
#include <wx/imaglist.h>
#include <wx/statbox.h>
#include <wx/dataview.h>
#include <map>
#include <vector>
@ -67,9 +68,9 @@ public:
size_t iconID() const { return m_iconID; }
void set_config(DynamicPrintConfig* config_in) { m_config = config_in; }
void reload_config();
Field* get_field(t_config_option_key opt_key, int opt_index = -1) const;
bool set_value(t_config_option_key opt_key, boost::any value);
ConfigOptionsGroupShp new_optgroup(wxString title, int noncommon_label_width = -1);
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
bool set_value(const t_config_option_key& opt_key, const boost::any& value);
ConfigOptionsGroupShp new_optgroup(const wxString& title, int noncommon_label_width = -1);
};
// Slic3r::GUI::Tab;
@ -95,6 +96,9 @@ protected:
wxButton* m_compatible_printers_btn;
wxButton* m_undo_btn;
wxButton* m_undo_to_sys_btn;
wxComboCtrl* m_cc_presets_choice;
wxDataViewTreeCtrl* m_presetctrl;
wxImageList* m_preset_icons;
int m_icon_count;
std::map<std::string, size_t> m_icon_index; // Map from an icon file name to its index
@ -122,10 +126,11 @@ public:
DynamicPrintConfig* m_config;
std::string m_nonsys_btn_icon;
ogStaticText* m_parent_preset_description_line;
wxStaticText* m_colored_Label = nullptr;
public:
Tab() {}
Tab(wxNotebook* parent, wxString title, const char* name, bool no_controller) :
Tab(wxNotebook* parent, const wxString& title, const char* name, bool no_controller) :
m_parent(parent), m_title(title), m_name(name), m_no_controller(no_controller) {
Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
get_tabs_list().push_back(this);
@ -143,11 +148,12 @@ public:
void create_preset_tab(PresetBundle *preset_bundle);
void load_current_preset();
void rebuild_page_tree();
void select_preset(std::string preset_name = "");
bool may_discard_current_dirty_preset(PresetCollection* presets = nullptr, std::string new_printer_name = "");
void select_preset(const std::string& preset_name = "");
bool may_discard_current_dirty_preset(PresetCollection* presets = nullptr, const std::string& new_printer_name = "");
wxSizer* compatible_printers_widget(wxWindow* parent, wxCheckBox** checkbox, wxButton** btn);
void load_key_value(std::string opt_key, boost::any value);
void update_presetsctrl(wxDataViewTreeCtrl* ui, bool show_incompatible);
void load_key_value(const std::string& opt_key, const boost::any& value);
void reload_compatible_printers_widget();
void OnTreeSelChange(wxTreeEvent& event);
@ -161,13 +167,14 @@ public:
void update_changed_ui();
void update_full_options_list();
void update_sys_ui_after_sel_preset();
void get_sys_and_mod_flags(const std::string& opt_key, bool& sys_page, bool& modified_page);
void update_changed_tree_ui();
void update_undo_buttons();
void on_back_to_initial_value();
void on_back_to_sys_value();
PageShp add_options_page(wxString title, std::string icon, bool is_extruder_pages = false);
PageShp add_options_page(const wxString& title, const std::string& icon, bool is_extruder_pages = false);
virtual void OnActivate(){}
virtual void on_preset_loaded(){}
@ -176,10 +183,10 @@ public:
void load_initial_data();
void update_dirty();
void update_tab_ui();
void load_config(DynamicPrintConfig config);
void load_config(const DynamicPrintConfig& config);
virtual void reload_config();
Field* get_field(t_config_option_key opt_key, int opt_index = -1) const;
bool set_value(t_config_option_key opt_key, boost::any value);
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
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();
DynamicPrintConfig* get_config() { return m_config; }
@ -189,12 +196,13 @@ public:
}
std::vector<std::string> get_dependent_tabs() { return m_reload_dependent_tabs; }
void on_value_change(std::string opt_key, boost::any value);
void on_value_change(const std::string& opt_key, const boost::any& value);
protected:
void on_presets_changed();
void update_frequently_changed_parameters();
void update_wiping_button_visibility();
void update_tab_presets(wxComboCtrl* ui, bool show_incompatible);
};
//Slic3r::GUI::Tab::Print;
@ -265,7 +273,7 @@ public:
std::string m_chosen_name;
wxComboBox* m_combo;
void build(wxString title, std::string default_name, std::vector<std::string> &values);
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; }
};