mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 18:15:53 +08:00
Refactor preset setting update to its own method and call during load()
This commit is contained in:
parent
88b4c54fc4
commit
3812f13cb5
@ -109,6 +109,7 @@ void PresetChooser::load(std::array<Presets, preset_types> presets) {
|
||||
|
||||
++i;
|
||||
}
|
||||
this->_update_preset_settings(group);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,12 +133,16 @@ bool PresetChooser::select_preset_by_name(wxString name, wxBitmapComboBox* choos
|
||||
return false;
|
||||
}
|
||||
|
||||
void PresetChooser::_on_select_preset(preset_t preset) {
|
||||
// update settings store
|
||||
void PresetChooser::_update_preset_settings(preset_t preset) {
|
||||
auto& settings_presets {_settings.default_presets.at(get_preset(preset))};
|
||||
settings_presets.clear(); // make sure previous contents are deconstructed
|
||||
settings_presets = this->_get_selected_presets(preset);
|
||||
|
||||
}
|
||||
|
||||
void PresetChooser::_on_select_preset(preset_t preset) {
|
||||
// update settings store
|
||||
this->_update_preset_settings(preset);
|
||||
// save settings
|
||||
_settings.save_settings();
|
||||
if (preset == preset_t::Printer) {
|
||||
@ -165,7 +170,6 @@ wxString PresetChooser::_get_selected_preset(preset_t group, size_t index) const
|
||||
if (index > selected.size()) { return wxString(""); }
|
||||
return selected.at(index);
|
||||
}
|
||||
|
||||
void PresetChooser::_on_change_combobox(preset_t preset, wxBitmapComboBox* choice) {
|
||||
|
||||
// Prompt for unsaved changes and undo selections if cancelled and return early
|
||||
|
@ -65,6 +65,7 @@ public:
|
||||
bool prompt_unsaved_changes();
|
||||
private:
|
||||
wxFlexGridSizer* _local_sizer {};
|
||||
wxWindow* _parent {};
|
||||
void _on_change_combobox(preset_t preset, wxBitmapComboBox* choice);
|
||||
chooser_name_map __chooser_names;
|
||||
|
||||
@ -85,6 +86,8 @@ private:
|
||||
/// Fetch the preset name corresponding to the chooser index
|
||||
wxString _get_selected_preset(preset_t group, size_t index) const;
|
||||
|
||||
/// Update Settings presets with the state of this system
|
||||
void _update_preset_settings(preset_t preset);
|
||||
};
|
||||
|
||||
}} // Slic3r::GUI
|
||||
|
Loading…
x
Reference in New Issue
Block a user