Fixed mode updating under GTK

This commit is contained in:
YuSanka 2018-10-22 15:18:05 +02:00
parent 2a2d1d85f8
commit 3ecb65d62c
4 changed files with 10 additions and 2 deletions

View File

@ -4,6 +4,7 @@
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/dataview.h> #include <wx/dataview.h>
#include <map> #include <map>
#include <vector>
class wxBoxSizer; class wxBoxSizer;
class PrusaObjectDataViewModel; class PrusaObjectDataViewModel;

View File

@ -395,19 +395,25 @@ bool ConfigOptionsGroup::update_visibility(ConfigOptionMode mode) {
return m_options_mode[0] <= mode; return m_options_mode[0] <= mode;
sizer->ShowItems(true); sizer->ShowItems(true);
#ifdef __WXGTK__
m_panel->Show(true);
m_grid_sizer->Show(true);
#endif /* __WXGTK__ */
int coef = 0; int coef = 0;
int hidden_row_cnt = 0;
const int cols = m_grid_sizer->GetCols(); const int cols = m_grid_sizer->GetCols();
for (auto opt_mode : m_options_mode) { for (auto opt_mode : m_options_mode) {
const bool show = opt_mode <= mode; const bool show = opt_mode <= mode;
if (!show) { if (!show) {
hidden_row_cnt++;
for (int i = 0; i < cols; ++i) for (int i = 0; i < cols; ++i)
m_grid_sizer->Show(coef + i, show); m_grid_sizer->Show(coef + i, show);
} }
coef+= cols; coef+= cols;
} }
if (!sizer->IsShown(m_grid_sizer)) { if (hidden_row_cnt == m_options_mode.size()) {
sizer->ShowItems(false); sizer->ShowItems(false);
return false; return false;
} }

View File

@ -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() void Tab::update_changed_tree_ui()
{ {
auto cur_item = m_treectrl->GetFirstVisibleItem(); auto cur_item = m_treectrl->GetFirstVisibleItem();
if (!m_treectrl->IsVisible(cur_item)) if (!cur_item || !m_treectrl->IsVisible(cur_item))
return; return;
auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection()); auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection());
while (cur_item){ while (cur_item){

View File

@ -12,6 +12,7 @@
#include <vector> #include <vector>
#include <set> #include <set>
#include <functional>
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description, wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
std::function<void(wxCommandEvent& event)> cb, const std::string& icon = "", wxEvtHandler* event_handler = nullptr); std::function<void(wxCommandEvent& event)> cb, const std::string& icon = "", wxEvtHandler* event_handler = nullptr);