From e2349bdd2eb99094c561e503bca8a7d3ed7ce70f Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 20 Mar 2019 11:54:48 +0100 Subject: [PATCH] Added workaround for the non-editable wxBitmapComboBoxs under OSXDisableAllSmartSubstitutions + experiments with Linux --- src/slic3r/GUI/Field.cpp | 16 ++++++++++++++-- src/slic3r/GUI/OptionsGroup.cpp | 6 +++--- src/slic3r/GUI/OptionsGroup.hpp | 8 ++++---- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 217b9380a..026b62ab5 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -515,8 +515,20 @@ void Choice::BUILD() { m_is_editable = true; temp = new wxBitmapComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size); } - else - temp = new wxBitmapComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY); + else { +#ifdef __WXOSX__ + /* wxBitmapComboBox with wxCB_READONLY style return NULL for GetTextCtrl(), + * so ToolTip doesn't shown. + * Next workaround helps to solve this problem + */ + temp = new wxBitmapComboBox(); + temp->SetTextCtrlStyle(wxTE_READONLY); + temp->Create(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr); +#else + temp = new wxBitmapComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY); +#endif //__WXOSX__ + } + temp->SetFont(Slic3r::GUI::wxGetApp().normal_font()); temp->SetBackgroundStyle(wxBG_STYLE_PAINT); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 5e9c9ac30..df2f7b582 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -138,7 +138,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n option_set.front().opt.sidetext.size() == 0 && option_set.front().side_widget == nullptr && line.get_extra_widgets().size() == 0) { wxSizer* tmp_sizer; -#ifdef __WXGTK__ +#if 0//#ifdef __WXGTK__ tmp_sizer = new wxBoxSizer(wxVERTICAL); m_panel->SetSizer(tmp_sizer); m_panel->Layout(); @@ -160,7 +160,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n } auto grid_sizer = m_grid_sizer; -#ifdef __WXGTK__ +#if 0//#ifdef __WXGTK__ m_panel->SetSizer(m_grid_sizer); m_panel->Layout(); #endif /* __WXGTK__ */ @@ -443,7 +443,7 @@ void ConfigOptionsGroup::Hide() void ConfigOptionsGroup::Show(const bool show) { sizer->ShowItems(show); -#ifdef __WXGTK__ +#if 0//#ifdef __WXGTK__ m_panel->Show(show); m_grid_sizer->Show(show); #endif /* __WXGTK__ */ diff --git a/src/slic3r/GUI/OptionsGroup.hpp b/src/slic3r/GUI/OptionsGroup.hpp index 661aadbd7..dbe1ea1a2 100644 --- a/src/slic3r/GUI/OptionsGroup.hpp +++ b/src/slic3r/GUI/OptionsGroup.hpp @@ -100,13 +100,13 @@ public: /// Accessor function is because users are not allowed to change the parent /// but defining it as const means a lot of const_casts to deal with wx functions. inline wxWindow* parent() const { -#ifdef __WXGTK__ +#if 0//#ifdef __WXGTK__ return m_panel; #else return m_parent; #endif /* __WXGTK__ */ } -#ifdef __WXGTK__ +#if 0//#ifdef __WXGTK__ wxWindow* get_parent() const { return m_parent; } @@ -176,7 +176,7 @@ public: m_grid_sizer = new wxFlexGridSizer(0, num_columns, 1,0); static_cast(m_grid_sizer)->SetFlexibleDirection(wxBOTH/*wxHORIZONTAL*/); static_cast(m_grid_sizer)->AddGrowableCol(label_width == 0 ? 0 : !extra_column ? 1 : 2 ); -#ifdef __WXGTK__ +#if 0//#ifdef __WXGTK__ m_panel = new wxPanel( _parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); sizer->Fit(m_panel); sizer->Add(m_panel, 0, wxEXPAND | wxALL, wxOSX||!staticbox ? 0: 5); @@ -204,7 +204,7 @@ protected: // This panel is needed for correct showing of the ToolTips for Button, StaticText and CheckBox // Tooltips on GTK doesn't work inside wxStaticBoxSizer unless you insert a panel // inside it before you insert the other controls. -#ifdef __WXGTK__ +#if 0//#ifdef__WXGTK__ wxPanel* m_panel {nullptr}; #endif /* __WXGTK__ */