mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Fixed page updating according to view_mode (after preset changing)
This commit is contained in:
parent
b9ac016d89
commit
3182611ac2
5 changed files with 24 additions and 12 deletions
|
@ -554,6 +554,13 @@ ConfigMenuIDs GUI_App::get_view_mode()
|
||||||
mode == "simple" ? ConfigMenuModeSimple : ConfigMenuModeAdvanced;
|
mode == "simple" ? ConfigMenuModeSimple : ConfigMenuModeAdvanced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfigOptionMode GUI_App::get_opt_mode() {
|
||||||
|
const ConfigMenuIDs mode = wxGetApp().get_view_mode();
|
||||||
|
|
||||||
|
return mode == ConfigMenuModeSimple ? comSimple :
|
||||||
|
mode == ConfigMenuModeExpert ? comExpert : comAdvanced;
|
||||||
|
}
|
||||||
|
|
||||||
// Update view mode according to selected menu
|
// Update view mode according to selected menu
|
||||||
void GUI_App::update_mode()
|
void GUI_App::update_mode()
|
||||||
{
|
{
|
||||||
|
@ -568,10 +575,8 @@ void GUI_App::update_mode()
|
||||||
|
|
||||||
sidebar().Layout();
|
sidebar().Layout();
|
||||||
|
|
||||||
ConfigOptionMode opt_mode = mode == ConfigMenuModeSimple ? comSimple :
|
|
||||||
mode == ConfigMenuModeExpert ? comExpert : comAdvanced;
|
|
||||||
for (auto tab : tabs_list)
|
for (auto tab : tabs_list)
|
||||||
tab->update_visibility(opt_mode);
|
tab->update_visibility();
|
||||||
|
|
||||||
plater()->update_object_menu();
|
plater()->update_object_menu();
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,6 +135,7 @@ public:
|
||||||
|
|
||||||
Tab* get_tab(Preset::Type type);
|
Tab* get_tab(Preset::Type type);
|
||||||
ConfigMenuIDs get_view_mode();
|
ConfigMenuIDs get_view_mode();
|
||||||
|
ConfigOptionMode get_opt_mode();
|
||||||
void update_mode();
|
void update_mode();
|
||||||
|
|
||||||
void add_config_menu(wxMenuBar *menu);
|
void add_config_menu(wxMenuBar *menu);
|
||||||
|
|
|
@ -99,7 +99,7 @@ void KBShortcutsDialog::fill_shortcuts()
|
||||||
main_shortcuts.reserve(25);
|
main_shortcuts.reserve(25);
|
||||||
|
|
||||||
main_shortcuts.push_back(Shortcut(ctrl+"O" ,L("Open project STL/OBJ/AMF/3MF with config, delete bed")));
|
main_shortcuts.push_back(Shortcut(ctrl+"O" ,L("Open project STL/OBJ/AMF/3MF with config, delete bed")));
|
||||||
main_shortcuts.push_back(Shortcut(ctrl+"I" ,L("Import STL//OBJ/AMF/3MF without config, keep bed")));
|
main_shortcuts.push_back(Shortcut(ctrl+"I" ,L("Import STL/OBJ/AMF/3MF without config, keep bed")));
|
||||||
main_shortcuts.push_back(Shortcut(ctrl+"L" ,L("Load Config from .ini/amf/3mf/gcode")));
|
main_shortcuts.push_back(Shortcut(ctrl+"L" ,L("Load Config from .ini/amf/3mf/gcode")));
|
||||||
main_shortcuts.push_back(Shortcut(ctrl+"G" ,L("Export Gcode")));
|
main_shortcuts.push_back(Shortcut(ctrl+"G" ,L("Export Gcode")));
|
||||||
main_shortcuts.push_back(Shortcut(ctrl+"S" ,L("Save project (3MF)")));
|
main_shortcuts.push_back(Shortcut(ctrl+"S" ,L("Save project (3MF)")));
|
||||||
|
|
|
@ -667,8 +667,9 @@ void Tab::reload_config()
|
||||||
Thaw();
|
Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::update_visibility(ConfigOptionMode mode)
|
void Tab::update_visibility()
|
||||||
{
|
{
|
||||||
|
const ConfigOptionMode mode = wxGetApp().get_opt_mode();
|
||||||
Freeze();
|
Freeze();
|
||||||
|
|
||||||
for (auto page : m_pages)
|
for (auto page : m_pages)
|
||||||
|
@ -1988,6 +1989,7 @@ PageShp TabPrinter::build_kinematics_page()
|
||||||
def.type = coString;
|
def.type = coString;
|
||||||
def.width = 150;
|
def.width = 150;
|
||||||
def.gui_type = "legend";
|
def.gui_type = "legend";
|
||||||
|
def.mode = comAdvanced;
|
||||||
def.tooltip = L("Values in this column are for Full Power mode");
|
def.tooltip = L("Values in this column are for Full Power mode");
|
||||||
def.default_value = new ConfigOptionString{ L("Full Power") };
|
def.default_value = new ConfigOptionString{ L("Full Power") };
|
||||||
|
|
||||||
|
@ -2345,12 +2347,15 @@ void Tab::load_current_preset()
|
||||||
init_options_list();
|
init_options_list();
|
||||||
update_changed_ui();
|
update_changed_ui();
|
||||||
});
|
});
|
||||||
|
update_page_tree_visibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Regerenerate content of the page tree.
|
//Regerenerate content of the page tree.
|
||||||
void Tab::rebuild_page_tree(bool tree_sel_change_event /*= false*/)
|
void Tab::rebuild_page_tree(bool tree_sel_change_event /*= false*/)
|
||||||
{
|
{
|
||||||
Freeze();
|
Freeze();
|
||||||
|
update_visibility();
|
||||||
|
|
||||||
// get label of the currently selected item
|
// get label of the currently selected item
|
||||||
const auto sel_item = m_treectrl->GetSelection();
|
const auto sel_item = m_treectrl->GetSelection();
|
||||||
const auto selected = sel_item ? m_treectrl->GetItemText(sel_item) : "";
|
const auto selected = sel_item ? m_treectrl->GetItemText(sel_item) : "";
|
||||||
|
@ -2363,8 +2368,8 @@ void Tab::rebuild_page_tree(bool tree_sel_change_event /*= false*/)
|
||||||
auto itemId = m_treectrl->AppendItem(rootItem, p->title(), p->iconID());
|
auto itemId = m_treectrl->AppendItem(rootItem, p->title(), p->iconID());
|
||||||
m_treectrl->SetItemTextColour(itemId, p->get_item_colour());
|
m_treectrl->SetItemTextColour(itemId, p->get_item_colour());
|
||||||
if (p->title() == selected) {
|
if (p->title() == selected) {
|
||||||
if (!(p->title() == _(L("Machine limits")) || p->title() == _(L("Single extruder MM setup")))) // These Pages have to be updated inside OnTreeSelChange
|
// if (!(p->title() == _(L("Machine limits")) || p->title() == _(L("Single extruder MM setup")))) // These Pages have to be updated inside OnTreeSelChange
|
||||||
m_disable_tree_sel_changed_event = !tree_sel_change_event;
|
// m_disable_tree_sel_changed_event = !tree_sel_change_event;
|
||||||
m_treectrl->SelectItem(itemId);
|
m_treectrl->SelectItem(itemId);
|
||||||
m_disable_tree_sel_changed_event = false;
|
m_disable_tree_sel_changed_event = false;
|
||||||
have_selection = 1;
|
have_selection = 1;
|
||||||
|
@ -2924,14 +2929,15 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la
|
||||||
auto extra_column = [](wxWindow* parent, const Line& line)
|
auto extra_column = [](wxWindow* parent, const Line& line)
|
||||||
{
|
{
|
||||||
std::string bmp_name;
|
std::string bmp_name;
|
||||||
if (line.get_options().size() == 0)
|
const std::vector<Option>& options = line.get_options();
|
||||||
bmp_name = "error.png";
|
if (options.size() == 0 || options[0].opt.gui_type == "legend")
|
||||||
|
bmp_name = "";// "error.png";
|
||||||
else {
|
else {
|
||||||
auto mode = line.get_options()[0].opt.mode; //we assume that we have one option per line
|
auto mode = options[0].opt.mode; //we assume that we have one option per line
|
||||||
bmp_name = mode == comExpert ? "mode_expert_.png" :
|
bmp_name = mode == comExpert ? "mode_expert_.png" :
|
||||||
mode == comAdvanced ? "mode_middle_.png" : "mode_simple_.png";
|
mode == comAdvanced ? "mode_middle_.png" : "mode_simple_.png";
|
||||||
}
|
}
|
||||||
auto bmp = new wxStaticBitmap(parent, wxID_ANY, wxBitmap(from_u8(var(bmp_name)), wxBITMAP_TYPE_PNG));
|
auto bmp = new wxStaticBitmap(parent, wxID_ANY, bmp_name.empty() ? wxNullBitmap : wxBitmap(from_u8(var(bmp_name)), wxBITMAP_TYPE_PNG));
|
||||||
return bmp;
|
return bmp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,7 @@ public:
|
||||||
void update_tab_ui();
|
void update_tab_ui();
|
||||||
void load_config(const DynamicPrintConfig& config);
|
void load_config(const DynamicPrintConfig& config);
|
||||||
virtual void reload_config();
|
virtual void reload_config();
|
||||||
void update_visibility(ConfigOptionMode mode);
|
void update_visibility();
|
||||||
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, int opt_index = -1) const;
|
||||||
bool set_value(const t_config_option_key& opt_key, const boost::any& value);
|
bool set_value(const t_config_option_key& opt_key, const boost::any& value);
|
||||||
wxSizer* description_line_widget(wxWindow* parent, ogStaticText** StaticText);
|
wxSizer* description_line_widget(wxWindow* parent, ogStaticText** StaticText);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue