From 42f3bfb0f6a8df7f84a26c247fd1cd6620017200 Mon Sep 17 00:00:00 2001 From: Slic3rPE Date: Thu, 6 Aug 2020 10:56:14 +0200 Subject: [PATCH] Fixed a build under OSX --- src/slic3r/GUI/ExtraRenderers.cpp | 31 ++++++++++++++----------- src/slic3r/GUI/ExtraRenderers.hpp | 8 +++++-- src/slic3r/GUI/ObjectDataViewModel.cpp | 6 ----- src/slic3r/GUI/PresetComboBoxes.hpp | 1 + src/slic3r/GUI/UnsavedChangesDialog.cpp | 6 ++--- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/slic3r/GUI/ExtraRenderers.cpp b/src/slic3r/GUI/ExtraRenderers.cpp index 494bfee6a..b49a3eb60 100644 --- a/src/slic3r/GUI/ExtraRenderers.cpp +++ b/src/slic3r/GUI/ExtraRenderers.cpp @@ -4,9 +4,11 @@ #include "I18N.hpp" #include +#ifdef wxHAS_GENERIC_DATAVIEWCTRL #include "wx/generic/private/markuptext.h" #include "wx/generic/private/rowheightcache.h" #include "wx/generic/private/widthcalc.h" +#endif #if wxUSE_ACCESSIBILITY #include "wx/private/markupparser.h" #endif // wxUSE_ACCESSIBILITY @@ -40,29 +42,30 @@ wxDataViewRenderer(wxT("PrusaDataViewBitmapText"), mode, align) BitmapTextRenderer::~BitmapTextRenderer() { #ifdef SUPPORTS_MARKUP + #ifdef wxHAS_GENERIC_DATAVIEWCTRL if (m_markupText) delete m_markupText; + #endif //wxHAS_GENERIC_DATAVIEWCTRL #endif // SUPPORTS_MARKUP } #ifdef SUPPORTS_MARKUP void BitmapTextRenderer::EnableMarkup(bool enable) { - if (enable) - { +#ifdef wxHAS_GENERIC_DATAVIEWCTRL + if (enable) { if (!m_markupText) - { m_markupText = new wxItemMarkupText(wxString()); - } } - else - { - if (m_markupText) - { + else { + if (m_markupText) { delete m_markupText; m_markupText = nullptr; } } +#elseif + is_markupText = enable +#endif //wxHAS_GENERIC_DATAVIEWCTRL } #endif // SUPPORTS_MARKUP @@ -70,10 +73,10 @@ bool BitmapTextRenderer::SetValue(const wxVariant &value) { m_value << value; -#ifdef SUPPORTS_MARKUP +#if defined(SUPPORTS_MARKUP) && defined(wxHAS_GENERIC_DATAVIEWCTRL) if (m_markupText) m_markupText->SetMarkup(m_value.GetText()); -#endif // SUPPORTS_MARKUP +#endif // SUPPORTS_MARKUP && wxHAS_GENERIC_DATAVIEWCTRL return true; } @@ -111,7 +114,7 @@ bool BitmapTextRenderer::Render(wxRect rect, wxDC *dc, int state) xoffset = icon_sz.x + 4; } -#ifdef SUPPORTS_MARKUP +#if defined(SUPPORTS_MARKUP) && defined(wxHAS_GENERIC_DATAVIEWCTRL) if (m_markupText) { int flags = 0; @@ -120,7 +123,7 @@ bool BitmapTextRenderer::Render(wxRect rect, wxDC *dc, int state) m_markupText->Render(GetView(), *dc, rect, flags, GetEllipsizeMode()); } else -#endif // SUPPORTS_MARKUP +#endif // SUPPORTS_MARKUP && wxHAS_GENERIC_DATAVIEWCTRL RenderText(m_value.GetText(), xoffset, rect, dc, state); return true; @@ -131,7 +134,7 @@ wxSize BitmapTextRenderer::GetSize() const if (!m_value.GetText().empty()) { wxSize size; -#ifdef SUPPORTS_MARKUP +#if defined(SUPPORTS_MARKUP) && defined(wxHAS_GENERIC_DATAVIEWCTRL) if (m_markupText) { wxDataViewCtrl* const view = GetView(); @@ -142,7 +145,7 @@ wxSize BitmapTextRenderer::GetSize() const size = m_markupText->Measure(dc); } else -#endif // SUPPORTS_MARKUP +#endif // SUPPORTS_MARKUP && wxHAS_GENERIC_DATAVIEWCTRL size = GetTextExtent(m_value.GetText()); int lines = m_value.GetText().Freq('\n') + 1; diff --git a/src/slic3r/GUI/ExtraRenderers.hpp b/src/slic3r/GUI/ExtraRenderers.hpp index 96cf34945..41f0d7d32 100644 --- a/src/slic3r/GUI/ExtraRenderers.hpp +++ b/src/slic3r/GUI/ExtraRenderers.hpp @@ -77,9 +77,9 @@ public: wxDataViewCustomRenderer(wxT("DataViewBitmapText"), mode, align), m_parent(parent) { -#ifdef SUPPORTS_MARKUP +#if defined(SUPPORTS_MARKUP) && defined(wxHAS_GENERIC_DATAVIEWCTRL) m_markupText = nullptr; -#endif // SUPPORTS_MARKUP +#endif // SUPPORTS_MARKUP && wxHAS_GENERIC_DATAVIEWCTRL } #endif //ENABLE_NONCUSTOM_DATA_VIEW_RENDERING @@ -120,7 +120,11 @@ private: std::function can_create_editor_ctrl { nullptr }; #ifdef SUPPORTS_MARKUP + #ifdef wxHAS_GENERIC_DATAVIEWCTRL class wxItemMarkupText* m_markupText; + #elseif + bool is_markupText; + #endif #endif // SUPPORTS_MARKUP }; diff --git a/src/slic3r/GUI/ObjectDataViewModel.cpp b/src/slic3r/GUI/ObjectDataViewModel.cpp index a42073dd0..79fedfa52 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.cpp +++ b/src/slic3r/GUI/ObjectDataViewModel.cpp @@ -9,12 +9,6 @@ #include #include -#include "wx/generic/private/markuptext.h" -#include "wx/generic/private/rowheightcache.h" -#include "wx/generic/private/widthcalc.h" -#if wxUSE_ACCESSIBILITY -#include "wx/private/markupparser.h" -#endif // wxUSE_ACCESSIBILITY namespace Slic3r { diff --git a/src/slic3r/GUI/PresetComboBoxes.hpp b/src/slic3r/GUI/PresetComboBoxes.hpp index f31b67fbe..7f51f775e 100644 --- a/src/slic3r/GUI/PresetComboBoxes.hpp +++ b/src/slic3r/GUI/PresetComboBoxes.hpp @@ -15,6 +15,7 @@ class ScalableButton; class wxBoxSizer; class wxComboBox; class wxStaticBitmap; +class wxRadioBox; namespace Slic3r { diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 46f086765..4db41ffaa 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -44,14 +44,14 @@ static std::string orange = "#ed6b21"; static void color_string(wxString& str, const std::string& color) { -#ifdef SUPPORTS_MARKUP +#if defined(SUPPORTS_MARKUP) && defined(wxHAS_GENERIC_DATAVIEWCTRL) str = from_u8((boost::format("%2%") % color % into_u8(str)).str()); #endif } static void make_string_bold(wxString& str) { -#ifdef SUPPORTS_MARKUP +#if defined(SUPPORTS_MARKUP) && defined(wxHAS_GENERIC_DATAVIEWCTRL) str = from_u8((boost::format("%1%") % into_u8(str)).str()); #endif } @@ -133,7 +133,7 @@ ModelNode::ModelNode(ModelNode* parent, const wxString& text, const wxString& ol void ModelNode::UpdateEnabling() { -#ifdef SUPPORTS_MARKUP +#if defined(SUPPORTS_MARKUP) && defined(wxHAS_GENERIC_DATAVIEWCTRL) auto change_text_color = [](wxString& str, const std::string& clr_from, const std::string& clr_to) { std::string old_val = into_u8(str);