From affaeef2ab18972374d571260cba9c34d578eee7 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 9 Apr 2018 12:41:25 +0200 Subject: [PATCH] Default presets are visible only if it's selected from Preferences --- xs/src/slic3r/GUI/Tab.cpp | 19 +++++++++++++------ xs/src/slic3r/GUI/wxExtensions.cpp | 4 ++-- xs/src/slic3r/GUI/wxExtensions.hpp | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/xs/src/slic3r/GUI/Tab.cpp b/xs/src/slic3r/GUI/Tab.cpp index ee8d1261c..5f727830f 100644 --- a/xs/src/slic3r/GUI/Tab.cpp +++ b/xs/src/slic3r/GUI/Tab.cpp @@ -45,9 +45,9 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle) { // FIXME If the following line is removed, the combo box popup list will not react to mouse clicks. // On the other side, with this line the combo box popup cannot be closed by clicking on the combo button on Windows 10. - m_cc_presets_choice->UseAltPopupWindow(); +// m_cc_presets_choice->UseAltPopupWindow(); - m_cc_presets_choice->EnablePopupAnimation(false); +// m_cc_presets_choice->EnablePopupAnimation(false); m_cc_presets_choice->SetPopupControl(popup); popup->SetStringValue(from_u8("Text1")); @@ -2150,8 +2150,11 @@ void Tab::update_tab_presets(wxComboCtrl* ui, bool show_incompatible) if (popup != nullptr) { popup->DeleteAllItems(); + auto root_1 = popup->AppendContainer(wxDataViewItem(0), _(L("Root 1"))); auto root_sys = popup->AppendContainer(wxDataViewItem(0), _(L("System presets"))); - auto root_def = popup->AppendContainer(wxDataViewItem(0), _(L("Default presets"))); + auto show_def = get_app_config()->get("no_defaults")[0] != '1'; + wxDataViewItem root_def; + if (show_def) root_def = popup->AppendContainer(wxDataViewItem(0), _(L("Default presets"))); for (size_t i = presets.front().is_visible ? 0 : 1; i < presets.size(); ++i) { const Preset &preset = presets[i]; @@ -2161,11 +2164,15 @@ void Tab::update_tab_presets(wxComboCtrl* ui, bool show_incompatible) auto preset_name = wxString::FromUTF8((preset.name + (preset.is_dirty ? suffix_modified : "")).c_str()); wxDataViewItem item; - if (preset.is_system || preset.is_default) - item = popup->AppendItem(preset.is_system ? root_sys : root_def, preset_name, + if (preset.is_system) + item = popup->AppendItem(root_sys, preset_name, + preset.is_compatible ? icon_compatible : icon_incompatible); + else if (show_def && preset.is_default) + item = popup->AppendItem(root_def, preset_name, preset.is_compatible ? icon_compatible : icon_incompatible); else { - + item = popup->AppendItem(root_1, preset_name, + preset.is_compatible ? icon_compatible : icon_incompatible); } cnt_items++; diff --git a/xs/src/slic3r/GUI/wxExtensions.cpp b/xs/src/slic3r/GUI/wxExtensions.cpp index d9f4e520a..666da7f8a 100644 --- a/xs/src/slic3r/GUI/wxExtensions.cpp +++ b/xs/src/slic3r/GUI/wxExtensions.cpp @@ -121,7 +121,7 @@ bool wxDataViewTreeCtrlComboPopup::Create(wxWindow* parent) { return wxDataViewTreeCtrl::Create(parent, wxID_HIGHEST + 1, wxPoint(0, 0), wxSize(270, -1)); } - +/* wxSize wxDataViewTreeCtrlComboPopup::GetAdjustedSize(int minWidth, int prefHeight, int maxHeight) { // matches owner wxComboCtrl's width @@ -140,7 +140,7 @@ wxSize wxDataViewTreeCtrlComboPopup::GetAdjustedSize(int minWidth, int prefHeigh else return wxSize(DefaultWidth, DefaultHeight); } - +*/ void wxDataViewTreeCtrlComboPopup::OnKeyEvent(wxKeyEvent& evt) { // filters out all the keys which are not working properly diff --git a/xs/src/slic3r/GUI/wxExtensions.hpp b/xs/src/slic3r/GUI/wxExtensions.hpp index 701b12dba..ed8bb9276 100644 --- a/xs/src/slic3r/GUI/wxExtensions.hpp +++ b/xs/src/slic3r/GUI/wxExtensions.hpp @@ -43,7 +43,7 @@ public: virtual wxWindow* GetControl() { return this; } virtual void SetStringValue(const wxString& value) { m_text = value; } virtual wxString GetStringValue() const { return m_text; } - virtual wxSize GetAdjustedSize(int minWidth, int prefHeight, int maxHeight); +// virtual wxSize GetAdjustedSize(int minWidth, int prefHeight, int maxHeight); virtual void OnKeyEvent(wxKeyEvent& evt); void OnDataViewTreeCtrlSelection(wxCommandEvent& evt);