Fixed TreeCtrl updating after mode change

+ Added another images for mode visualization
This commit is contained in:
YuSanka 2018-10-22 12:07:40 +02:00
parent f6e6d9dc4a
commit 84de664fb5
5 changed files with 11 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -388,6 +388,8 @@ void ConfigOptionsGroup::reload_config(){
} }
bool ConfigOptionsGroup::update_visibility(ConfigOptionMode mode) { bool ConfigOptionsGroup::update_visibility(ConfigOptionMode mode) {
if (m_options_mode.empty())
return true;
if (m_grid_sizer->GetEffectiveRowsCount() != m_options_mode.size() && if (m_grid_sizer->GetEffectiveRowsCount() != m_options_mode.size() &&
m_options_mode.size() == 1) m_options_mode.size() == 1)
return m_options_mode[0] <= mode; return m_options_mode[0] <= mode;

View File

@ -644,6 +644,11 @@ void Tab::update_visibility(ConfigOptionMode mode)
Refresh(); Refresh();
Thaw(); Thaw();
// to update tree items color
wxTheApp->CallAfter([this]() {
update_changed_tree_ui();
});
} }
Field* Tab::get_field(const t_config_option_key& opt_key, int opt_index/* = -1*/) const Field* Tab::get_field(const t_config_option_key& opt_key, int opt_index/* = -1*/) const
@ -1782,7 +1787,7 @@ void TabPrinter::build_sla()
auto page = add_options_page(_(L("General")), "printer_empty.png"); auto page = add_options_page(_(L("General")), "printer_empty.png");
auto optgroup = page->new_optgroup(_(L("Size and coordinates"))); auto optgroup = page->new_optgroup(_(L("Size and coordinates")));
Line line{ _(L("Bed shape")), "" }; Line line = optgroup->create_single_option_line("bed_shape");//{ _(L("Bed shape")), "" };
line.widget = [this](wxWindow* parent){ line.widget = [this](wxWindow* parent){
auto btn = new wxButton(parent, wxID_ANY, _(L(" Set ")) + dots, wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxBU_EXACTFIT); auto btn = new wxButton(parent, wxID_ANY, _(L(" Set ")) + dots, wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxBU_EXACTFIT);
// btn->SetFont(Slic3r::GUI::small_font); // btn->SetFont(Slic3r::GUI::small_font);
@ -2762,8 +2767,8 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la
bmp_name = "error.png"; 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 = line.get_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 == comMiddle ? "mode_middle.png" : "mode_simple.png"; mode == comMiddle ? "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, wxBitmap(from_u8(var(bmp_name)), wxBITMAP_TYPE_PNG));
return bmp; return bmp;