fix unsavedchangedialog when extruder count is changed

This commit is contained in:
supermerill 2020-11-11 19:45:05 +01:00
parent 027bf9f132
commit 732a441b84
3 changed files with 7 additions and 4 deletions

View File

@ -1469,7 +1469,7 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page)
}
if(logs) std::cout << "create page " << label.c_str() <<" : "<< params[params.size() - 1] << "\n";
current_page = add_options_page(_(label), params[params.size() - 1]);
current_page = add_options_page(L(label), params[params.size() - 1]);
}
else if (boost::starts_with(full_line, "end_page"))
{
@ -4020,7 +4020,7 @@ void TabSLAMaterial::build()
if (create_pages("sla_material.ui")) return;
auto page = add_options_page(_(L("Material")), "resin");
auto page = add_options_page(L("Material"), "resin");
auto optgroup = page->new_optgroup(L("Material"));
optgroup->append_single_option_line("bottle_cost");

View File

@ -325,6 +325,8 @@ public:
void update_visibility();
virtual void msw_rescale();
virtual void sys_color_changed();
size_t get_page_count() { return m_pages.size(); }
PageShp get_page(size_t idx) { return m_pages[idx]; }
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
std::pair<OG_CustomCtrl*, bool*> get_custom_ctrl_with_blinking_ptr(const t_config_option_key& opt_key, int opt_index = -1);

View File

@ -1063,9 +1063,10 @@ void UnsavedChangesDialog::update_tree(Preset::Type type, PresetCollection* pres
wxString new_val = from_u8((boost::format("%1%") % new_config.opt<ConfigOptionStrings>("extruder_colour")->values.size()).str());
ItemData item_data = { "extruders_count", local_label, old_val, new_val, type };
m_items_map.emplace(m_tree_model->AddOption(type, _L("General"), _L("Capabilities"), local_label, old_val, new_val, category_icon_map.at("General")), item_data);
if(wxGetApp().get_tab(type)->get_page_count() > 0)
m_items_map.emplace(m_tree_model->AddOption(type, _L(wxGetApp().get_tab(type)->get_page(0)->title()), _L("Capabilities"), local_label, old_val, new_val, category_icon_map.at(wxGetApp().get_tab(type)->get_page(0)->title())), item_data);
}
//TODO same for milling head?
for (const std::string& opt_key : dirty_options) {
const Search::Option& option = searcher.get_option(opt_key);