From 3ecb65d62c5f1509af8889de74fbe84452c26674 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 22 Oct 2018 15:18:05 +0200 Subject: [PATCH] Fixed mode updating under GTK --- src/slic3r/GUI/GUI_ObjectList.hpp | 1 + src/slic3r/GUI/OptionsGroup.cpp | 8 +++++++- src/slic3r/GUI/Tab.cpp | 2 +- src/slic3r/GUI/wxExtensions.hpp | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp index c56e69670..56d01b7f5 100644 --- a/src/slic3r/GUI/GUI_ObjectList.hpp +++ b/src/slic3r/GUI/GUI_ObjectList.hpp @@ -4,6 +4,7 @@ #include #include #include +#include class wxBoxSizer; class PrusaObjectDataViewModel; diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index b2f9cd272..371747bc1 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -395,19 +395,25 @@ bool ConfigOptionsGroup::update_visibility(ConfigOptionMode mode) { return m_options_mode[0] <= mode; sizer->ShowItems(true); +#ifdef __WXGTK__ + m_panel->Show(true); + m_grid_sizer->Show(true); +#endif /* __WXGTK__ */ int coef = 0; + int hidden_row_cnt = 0; const int cols = m_grid_sizer->GetCols(); for (auto opt_mode : m_options_mode) { const bool show = opt_mode <= mode; if (!show) { + hidden_row_cnt++; for (int i = 0; i < cols; ++i) m_grid_sizer->Show(coef + i, show); } coef+= cols; } - if (!sizer->IsShown(m_grid_sizer)) { + if (hidden_row_cnt == m_options_mode.size()) { sizer->ShowItems(false); return false; } diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 698c46d23..d4249ea23 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -476,7 +476,7 @@ void Tab::get_sys_and_mod_flags(const std::string& opt_key, bool& sys_page, bool void Tab::update_changed_tree_ui() { auto cur_item = m_treectrl->GetFirstVisibleItem(); - if (!m_treectrl->IsVisible(cur_item)) + if (!cur_item || !m_treectrl->IsVisible(cur_item)) return; auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection()); while (cur_item){ diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index 4ff73027c..80a564fd0 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -12,6 +12,7 @@ #include #include +#include wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description, std::function cb, const std::string& icon = "", wxEvtHandler* event_handler = nullptr);