Updated description preset line for each type of presets...
Disabled m_btn_delete_preset for default and system presets. Enabled update of the current preset if it was modified and selected again.
This commit is contained in:
parent
91db0a6e05
commit
b3859c49c1
5 changed files with 53 additions and 13 deletions
xs/src/slic3r/GUI
|
@ -201,8 +201,8 @@ static void init_label_colours()
|
||||||
{
|
{
|
||||||
auto luma = get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
auto luma = get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||||
if (luma >= 128) {
|
if (luma >= 128) {
|
||||||
g_color_label_modified = wxColour(253, 88, 0);
|
g_color_label_modified = wxColour(255, 108, 30);//wxColour(253, 88, 0);
|
||||||
g_color_label_sys = wxColour(26, 132, 57);
|
g_color_label_sys = wxColour(19, 100, 44); //wxColour(26, 132, 57);
|
||||||
} else {
|
} else {
|
||||||
g_color_label_modified = wxColour(253, 111, 40);
|
g_color_label_modified = wxColour(253, 111, 40);
|
||||||
g_color_label_sys = wxColour(115, 220, 103);
|
g_color_label_sys = wxColour(115, 220, 103);
|
||||||
|
|
|
@ -468,10 +468,10 @@ Field* ConfigOptionsGroup::get_fieldc(const t_config_option_key& opt_key, int op
|
||||||
return opt_id.empty() ? nullptr : get_field(opt_id);
|
return opt_id.empty() ? nullptr : get_field(opt_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ogStaticText::SetText(const wxString& value)
|
void ogStaticText::SetText(const wxString& value, bool wrap/* = true*/)
|
||||||
{
|
{
|
||||||
SetLabel(value);
|
SetLabel(value);
|
||||||
Wrap(400);
|
if (wrap) Wrap(400);
|
||||||
GetParent()->Layout();
|
GetParent()->Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ public:
|
||||||
ogStaticText(wxWindow* parent, const char *text) : wxStaticText(parent, wxID_ANY, text, wxDefaultPosition, wxDefaultSize){}
|
ogStaticText(wxWindow* parent, const char *text) : wxStaticText(parent, wxID_ANY, text, wxDefaultPosition, wxDefaultSize){}
|
||||||
~ogStaticText(){}
|
~ogStaticText(){}
|
||||||
|
|
||||||
void SetText(const wxString& value);
|
void SetText(const wxString& value, bool wrap = true);
|
||||||
};
|
};
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -218,7 +218,7 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle)
|
||||||
//! select_preset(m_presets_choice->GetStringSelection().ToStdString());
|
//! select_preset(m_presets_choice->GetStringSelection().ToStdString());
|
||||||
//! we doing next:
|
//! we doing next:
|
||||||
int selected_item = m_presets_choice->GetSelection();
|
int selected_item = m_presets_choice->GetSelection();
|
||||||
if (m_selected_preset_item == selected_item)
|
if (m_selected_preset_item == selected_item && !m_presets->current_is_dirty())
|
||||||
return;
|
return;
|
||||||
if (selected_item >= 0){
|
if (selected_item >= 0){
|
||||||
std::string selected_string = m_presets_choice->GetString(selected_item).ToUTF8().data();
|
std::string selected_string = m_presets_choice->GetString(selected_item).ToUTF8().data();
|
||||||
|
@ -670,13 +670,52 @@ void Tab::on_presets_changed()
|
||||||
event.SetString(m_name);
|
event.SetString(m_name);
|
||||||
g_wxMainFrame->ProcessWindowEvent(event);
|
g_wxMainFrame->ProcessWindowEvent(event);
|
||||||
}
|
}
|
||||||
|
update_preset_description_line();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Tab::update_preset_description_line()
|
||||||
|
{
|
||||||
const Preset* parent = m_presets->get_selected_preset_parent();
|
const Preset* parent = m_presets->get_selected_preset_parent();
|
||||||
const wxString description_line = parent == nullptr ?
|
const Preset& preset = m_presets->get_edited_preset();
|
||||||
_(L("It's default preset")) : parent == &m_presets->get_selected_preset() ?
|
|
||||||
_(L("It's system preset")) :
|
wxString description_line = preset.is_default ?
|
||||||
_(L("Current preset is inherited from")) + ":\n" + parent->name;
|
_(L("It's a default preset.")) : preset.is_system ?
|
||||||
m_parent_preset_description_line->SetText(description_line);
|
_(L("It's a system preset.")) :
|
||||||
|
_(L("Current preset is inherited from ")) + (parent == nullptr ?
|
||||||
|
"default preset." :
|
||||||
|
":\n\t" + parent->name);
|
||||||
|
|
||||||
|
if (preset.is_default || preset.is_system)
|
||||||
|
description_line += "\n\t" + _(L("It can't be deleted or modified. ")) +
|
||||||
|
"\n\t" + _(L("Any modifications should be saved as a new preset inherited from this one. ")) +
|
||||||
|
"\n\t" + _(L("To do that please specify a new name for the preset."));
|
||||||
|
|
||||||
|
if (parent && parent->vendor)
|
||||||
|
{
|
||||||
|
description_line += "\n\n" + _(L("Additional information:")) + "\n";
|
||||||
|
description_line += "\t" + _(L("vendor")) + ": " + (name()=="printer" ? "\n\t\t" : "") + parent->vendor->name +
|
||||||
|
", ver: " + parent->vendor->config_version.to_string();
|
||||||
|
if (name() == "printer"){
|
||||||
|
const std::string &printer_model = preset.config.opt_string("printer_model");
|
||||||
|
const std::string &default_print_profile = preset.config.opt_string("default_print_profile");
|
||||||
|
const std::vector<std::string> &default_filament_profiles = preset.config.option<ConfigOptionStrings>("default_filament_profile")->values;
|
||||||
|
if (!printer_model.empty())
|
||||||
|
description_line += "\n\n\t" + _(L("printer model")) + ": \n\t\t" + printer_model;
|
||||||
|
if (!default_print_profile.empty())
|
||||||
|
description_line += "\n\n\t" + _(L("default print profile")) + ": \n\t\t" + default_print_profile;
|
||||||
|
if (!default_filament_profiles.empty())
|
||||||
|
{
|
||||||
|
description_line += "\n\n\t" + _(L("default filament profile")) + ": \n\t\t";
|
||||||
|
for (auto& profile : default_filament_profiles){
|
||||||
|
if (&profile != &*default_filament_profiles.begin())
|
||||||
|
description_line += ", ";
|
||||||
|
description_line += profile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_parent_preset_description_line->SetText(description_line, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::update_frequently_changed_parameters()
|
void Tab::update_frequently_changed_parameters()
|
||||||
|
@ -1337,7 +1376,7 @@ wxSizer* Tab::description_line_widget(wxWindow* parent, ogStaticText* *StaticTex
|
||||||
(*StaticText)->SetFont(font);
|
(*StaticText)->SetFont(font);
|
||||||
|
|
||||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
sizer->Add(*StaticText);
|
sizer->Add(*StaticText, 1, wxEXPAND|wxALL, 0);
|
||||||
return sizer;
|
return sizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1802,7 +1841,7 @@ void Tab::load_current_preset()
|
||||||
{
|
{
|
||||||
auto preset = m_presets->get_edited_preset();
|
auto preset = m_presets->get_edited_preset();
|
||||||
|
|
||||||
preset.is_default ? m_btn_delete_preset->Disable() : m_btn_delete_preset->Enable(true);
|
(preset.is_default || preset.is_system) ? m_btn_delete_preset->Disable() : m_btn_delete_preset->Enable(true);
|
||||||
update();
|
update();
|
||||||
// For the printer profile, generate the extruder pages.
|
// For the printer profile, generate the extruder pages.
|
||||||
on_preset_loaded();
|
on_preset_loaded();
|
||||||
|
|
|
@ -265,6 +265,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void on_presets_changed();
|
void on_presets_changed();
|
||||||
|
void update_preset_description_line();
|
||||||
void update_frequently_changed_parameters();
|
void update_frequently_changed_parameters();
|
||||||
void update_wiping_button_visibility();
|
void update_wiping_button_visibility();
|
||||||
void update_tab_presets(wxComboCtrl* ui, bool show_incompatible);
|
void update_tab_presets(wxComboCtrl* ui, bool show_incompatible);
|
||||||
|
|
Loading…
Add table
Reference in a new issue