Fixed a build under OSX
This commit is contained in:
parent
6ee804f466
commit
42f3bfb0f6
5 changed files with 27 additions and 25 deletions
|
@ -4,9 +4,11 @@
|
|||
#include "I18N.hpp"
|
||||
|
||||
#include <wx/dc.h>
|
||||
#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;
|
||||
|
|
|
@ -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<bool()> can_create_editor_ctrl { nullptr };
|
||||
|
||||
#ifdef SUPPORTS_MARKUP
|
||||
#ifdef wxHAS_GENERIC_DATAVIEWCTRL
|
||||
class wxItemMarkupText* m_markupText;
|
||||
#elseif
|
||||
bool is_markupText;
|
||||
#endif
|
||||
#endif // SUPPORTS_MARKUP
|
||||
};
|
||||
|
||||
|
|
|
@ -9,12 +9,6 @@
|
|||
|
||||
#include <wx/bmpcbox.h>
|
||||
#include <wx/dc.h>
|
||||
#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 {
|
||||
|
|
|
@ -15,6 +15,7 @@ class ScalableButton;
|
|||
class wxBoxSizer;
|
||||
class wxComboBox;
|
||||
class wxStaticBitmap;
|
||||
class wxRadioBox;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
|
|
@ -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("<span color=\"%1%\">%2%</span>") % 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("<b>%1%</b>") % 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);
|
||||
|
|
Loading…
Reference in a new issue