From 0302f3e5ff15510dc48ea80f8382146c1a546b5b Mon Sep 17 00:00:00 2001 From: scheffle Date: Sun, 26 Nov 2023 17:32:18 +0100 Subject: [PATCH] change CParamDisplay::drawPlatformText to take an UTF8String --- vstgui/doxygen/page_changes.h | 4 ++++ vstgui/lib/controls/coptionmenu.cpp | 2 +- vstgui/lib/controls/cparamdisplay.cpp | 13 ++++++++----- vstgui/lib/controls/cparamdisplay.h | 5 +++-- vstgui/lib/controls/csearchtextedit.cpp | 4 ++-- vstgui/lib/controls/ctextedit.cpp | 6 +++--- vstgui/lib/controls/ctextlabel.cpp | 2 +- vstgui/lib/platform/common/generictextedit.cpp | 2 +- 8 files changed, 23 insertions(+), 15 deletions(-) diff --git a/vstgui/doxygen/page_changes.h b/vstgui/doxygen/page_changes.h index fb35ba5d6..1d0e0d644 100644 --- a/vstgui/doxygen/page_changes.h +++ b/vstgui/doxygen/page_changes.h @@ -136,6 +136,10 @@ Note: All current deprecated methods will be removed in the next version. So mak @section code_changes Changes for existing VSTGUI code +@subsection code_changes_4_13_to_4_14 VSTGUI 4.13 -> VSTGUI 4.14 + +- In CParamDisplay::drawPlatformText(..) the string argument changed from IPlatformString to UTF8Text + @subsection code_changes_4_12_to_4_13 VSTGUI 4.12 -> VSTGUI 4.13 - the context argument of IFontPainter has changed to use the new platform graphics device context diff --git a/vstgui/lib/controls/coptionmenu.cpp b/vstgui/lib/controls/coptionmenu.cpp index 415bd1df1..bc03cc221 100644 --- a/vstgui/lib/controls/coptionmenu.cpp +++ b/vstgui/lib/controls/coptionmenu.cpp @@ -842,7 +842,7 @@ void COptionMenu::draw (CDrawContext *pContext) CMenuItem* item = getEntry (currentIndex); drawBack (pContext, inPopup ? bgWhenClick : nullptr); if (item) - drawPlatformText (pContext, UTF8String (item->getTitle ()).getPlatformString ()); + drawPlatformText (pContext, item->getTitle ()); setDirty (false); } diff --git a/vstgui/lib/controls/cparamdisplay.cpp b/vstgui/lib/controls/cparamdisplay.cpp index dcfe28941..558e9227a 100644 --- a/vstgui/lib/controls/cparamdisplay.cpp +++ b/vstgui/lib/controls/cparamdisplay.cpp @@ -192,7 +192,7 @@ void CParamDisplay::draw (CDrawContext *pContext) } drawBack (pContext); - drawPlatformText (pContext, UTF8String (string).getPlatformString ()); + drawPlatformText (pContext, UTF8String (string)); setDirty (false); } @@ -322,13 +322,14 @@ void CParamDisplay::drawBack (CDrawContext* pContext, CBitmap* newBack) } //------------------------------------------------------------------------ -void CParamDisplay::drawPlatformText (CDrawContext* pContext, IPlatformString* string) +void CParamDisplay::drawPlatformText (CDrawContext* pContext, const UTF8String& string) { drawPlatformText (pContext, string, getViewSize ()); } //------------------------------------------------------------------------ -void CParamDisplay::drawPlatformText (CDrawContext* pContext, IPlatformString* string, const CRect& size) +void CParamDisplay::drawPlatformText (CDrawContext* pContext, const UTF8String& string, + const CRect& size) { if (!hasBit (style, kNoTextStyle)) { @@ -351,10 +352,12 @@ void CParamDisplay::drawPlatformText (CDrawContext* pContext, IPlatformString* s CRect newSize (textRect); newSize.offset (shadowTextOffset); pContext->setFontColor (shadowColor); - pContext->drawString (string, newSize, horiTxtAlign, hasBit (style, kAntialias)); + pContext->drawString (string.getPlatformString (), newSize, horiTxtAlign, + hasBit (style, kAntialias)); } pContext->setFontColor (fontColor); - pContext->drawString (string, textRect, horiTxtAlign, hasBit (style, kAntialias)); + pContext->drawString (string.getPlatformString (), textRect, horiTxtAlign, + hasBit (style, kAntialias)); }); pContext->restoreGlobalState (); } diff --git a/vstgui/lib/controls/cparamdisplay.h b/vstgui/lib/controls/cparamdisplay.h index bc69ceef1..6aadee583 100644 --- a/vstgui/lib/controls/cparamdisplay.h +++ b/vstgui/lib/controls/cparamdisplay.h @@ -122,8 +122,9 @@ class CParamDisplay : public CControl ~CParamDisplay () noexcept override; virtual void drawBack (CDrawContext* pContext, CBitmap* newBack = nullptr); - virtual void drawPlatformText (CDrawContext* pContext, IPlatformString* string); - virtual void drawPlatformText (CDrawContext* pContext, IPlatformString* string, const CRect& size); + virtual void drawPlatformText (CDrawContext* pContext, const UTF8String& string); + virtual void drawPlatformText (CDrawContext* pContext, const UTF8String& string, + const CRect& size); virtual void drawStyleChanged (); diff --git a/vstgui/lib/controls/csearchtextedit.cpp b/vstgui/lib/controls/csearchtextedit.cpp index 329da775d..84bee20a4 100644 --- a/vstgui/lib/controls/csearchtextedit.cpp +++ b/vstgui/lib/controls/csearchtextedit.cpp @@ -117,10 +117,10 @@ void CSearchTextEdit::draw (CDrawContext *pContext) CColor color (fontColor); color.alpha /= 2; setFontColor (color); - drawPlatformText (pContext, getPlaceholderString ().getPlatformString (), getTextRect ()); + drawPlatformText (pContext, getPlaceholderString (), getTextRect ()); } else - drawPlatformText (pContext, getText ().getPlatformString (), getTextRect ()); + drawPlatformText (pContext, getText (), getTextRect ()); setDirty (false); setFontColor (origFontColor); diff --git a/vstgui/lib/controls/ctextedit.cpp b/vstgui/lib/controls/ctextedit.cpp index bf62350c9..9205c8129 100644 --- a/vstgui/lib/controls/ctextedit.cpp +++ b/vstgui/lib/controls/ctextedit.cpp @@ -188,7 +188,7 @@ void CTextEdit::draw (CDrawContext *pContext) { pContext->saveGlobalState (); pContext->setGlobalAlpha (pContext->getGlobalAlpha () * 0.5f); - drawPlatformText (pContext, placeholderString.getPlatformString ()); + drawPlatformText (pContext, placeholderString); pContext->restoreGlobalState (); } setDirty (false); @@ -201,7 +201,7 @@ void CTextEdit::draw (CDrawContext *pContext) { pContext->saveGlobalState (); pContext->setGlobalAlpha (pContext->getGlobalAlpha () * 0.5f); - drawPlatformText (pContext, placeholderString.getPlatformString ()); + drawPlatformText (pContext, placeholderString); pContext->restoreGlobalState (); } } @@ -211,7 +211,7 @@ void CTextEdit::draw (CDrawContext *pContext) UTF8String str; for (auto i = 0u; i < text.length (); ++i) str += bulletCharacter; - drawPlatformText (pContext, str.getPlatformString ()); + drawPlatformText (pContext, str); } else CTextLabel::draw (pContext); diff --git a/vstgui/lib/controls/ctextlabel.cpp b/vstgui/lib/controls/ctextlabel.cpp index 3e3e29fe6..86264350b 100644 --- a/vstgui/lib/controls/ctextlabel.cpp +++ b/vstgui/lib/controls/ctextlabel.cpp @@ -109,7 +109,7 @@ const UTF8String& CTextLabel::getText () const void CTextLabel::draw (CDrawContext *pContext) { drawBack (pContext); - drawPlatformText (pContext, truncatedText.empty () ? text.getPlatformString () : truncatedText.getPlatformString ()); + drawPlatformText (pContext, truncatedText.empty () ? text : truncatedText); setDirty (false); } diff --git a/vstgui/lib/platform/common/generictextedit.cpp b/vstgui/lib/platform/common/generictextedit.cpp index f6725b971..393e76e9d 100644 --- a/vstgui/lib/platform/common/generictextedit.cpp +++ b/vstgui/lib/platform/common/generictextedit.cpp @@ -687,7 +687,7 @@ void STBTextEditView::draw (CDrawContext* context) calcCursorSizes (); drawBack (context, nullptr); - drawPlatformText (context, getText ().getPlatformString ()); + drawPlatformText (context, getText ()); if (!isBlinkToggle () || editState.select_start != editState.select_end) return;