From 775b86a3d867b94e0203fa60a71475fcd633c858 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 11 Sep 2018 11:39:13 +0200 Subject: [PATCH] Fix to last commit (vertical expanding of the icon to correct rendering on OSX) --- xs/src/slic3r/GUI/GUI_ObjectParts.cpp | 6 ++---- xs/src/slic3r/GUI/wxExtensions.cpp | 5 +++++ xs/src/slic3r/GUI/wxExtensions.hpp | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/xs/src/slic3r/GUI/GUI_ObjectParts.cpp b/xs/src/slic3r/GUI/GUI_ObjectParts.cpp index 5af20564b..c4ed9c0be 100644 --- a/xs/src/slic3r/GUI/GUI_ObjectParts.cpp +++ b/xs/src/slic3r/GUI/GUI_ObjectParts.cpp @@ -249,10 +249,8 @@ void create_objects_ctrl(wxWindow* win, wxBoxSizer*& objects_sz) #endif // wxUSE_DRAG_AND_DROP && wxUSE_UNICODE // column 0(Icon+Text) of the view control: - wxDataViewColumn *ret = new wxDataViewColumn(_(L("Name")), - new PrusaIconTextRenderer(wxT("PrusaDataViewIconText")), - 0, 200, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE); - m_objects_ctrl->AppendColumn(ret); + m_objects_ctrl->AppendColumn(new wxDataViewColumn(_(L("Name")), new PrusaIconTextRenderer(), + 0, 200, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE)); // m_objects_ctrl->AppendIconTextColumn(_(L("Name")), 0, wxDATAVIEW_CELL_INERT, 200, // wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE); diff --git a/xs/src/slic3r/GUI/wxExtensions.cpp b/xs/src/slic3r/GUI/wxExtensions.cpp index f8fe5a582..80da9a148 100644 --- a/xs/src/slic3r/GUI/wxExtensions.cpp +++ b/xs/src/slic3r/GUI/wxExtensions.cpp @@ -385,8 +385,13 @@ bool PrusaObjectDataViewModelNode::update_settings_digest(const std::vectorinsert(m_name.ToStdString(), bmps); } + m_icon.CopyFromBitmap(*bmp); +#ifdef __WXOSX__ + if (m_icon.GetWidth() != m_icon.GetHeight()) + m_icon.SetHeight(m_icon.GetWidth()); +#endif // __WXOSX__ return true; } diff --git a/xs/src/slic3r/GUI/wxExtensions.hpp b/xs/src/slic3r/GUI/wxExtensions.hpp index 5e5afe6dc..e47681d6c 100644 --- a/xs/src/slic3r/GUI/wxExtensions.hpp +++ b/xs/src/slic3r/GUI/wxExtensions.hpp @@ -422,9 +422,9 @@ public: class PrusaIconTextRenderer : public wxDataViewCustomRenderer { public: - PrusaIconTextRenderer( const wxString &varianttype = wxT("PrusaDataViewIconText"), - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, - int align = wxDVR_DEFAULT_ALIGNMENT) {} + PrusaIconTextRenderer( wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT): + wxDataViewCustomRenderer(wxT("wxDataViewIconText"), mode, wxALIGN_CENTER) {} bool SetValue(const wxVariant &value); bool GetValue(wxVariant &value) const;