Skip to content

Commit

Permalink
Merge branch 'develop' into uiscripting
Browse files Browse the repository at this point in the history
  • Loading branch information
scheffle committed Dec 20, 2023
2 parents af568fe + d210d67 commit 4fe8bb3
Show file tree
Hide file tree
Showing 24 changed files with 194 additions and 48 deletions.
9 changes: 9 additions & 0 deletions vstgui/doxygen/page_changes.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ It's recommended to start new projects with version 4 while old projects should
@section new_stuff New Stuff
@subsection version4_14 Version 4.14
- add crosshair mouse cursor (kCursorCrosshair)
- customizable knob range (see CKnob::setKnobRange)
@subsection version4_13 Version 4.13
- support embedding platform views (HWND & NSView) as sub views (see CExternalView and ExternalView::IView) and examples in the contrib folder.
Expand Down Expand Up @@ -136,6 +141,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
Expand Down
2 changes: 1 addition & 1 deletion vstgui/lib/animation/animator.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class FinishedMessage : public CBaseObject
FinishedMessage (CView* view, const std::string& name, IAnimationTarget* target) : view (view), name (name), target (target) {}

CView* getView () const { return view; }
const IdStringPtr getName () const { return name.c_str (); }
IdStringPtr getName () const { return name.c_str (); }
IAnimationTarget* getTarget () const { return target; }

CLASS_METHODS_NOCOPY(FinishedMessage, CBaseObject)
Expand Down
4 changes: 1 addition & 3 deletions vstgui/lib/cbitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ class CMultiFrameBitmap : public CBitmap

/** set the multi frame description
*
* @param frameSize size of one frame
* @param frameCount number of total frames
* @param framesPerRow number of frames per row
* @param desc the multi frame description
* @return true if bitmap is big enough for the description
*/
bool setMultiFrameDesc (CMultiFrameBitmapDescription desc);
Expand Down
4 changes: 2 additions & 2 deletions vstgui/lib/cdrawdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ struct CDrawMode
{
public:
constexpr CDrawMode (uint32_t mode = kAliasing) : mode (mode) {}
constexpr CDrawMode (const CDrawMode& m) : mode (m.mode) {}

constexpr CDrawMode (const CDrawMode& m) = default;
constexpr CDrawMode& operator= (const CDrawMode& m) = default;
constexpr uint32_t modeIgnoringIntegralMode () const { return (mode & ~kNonIntegralMode); }

constexpr bool integralMode () const { return !hasBit (mode, kNonIntegralMode); }
Expand Down
4 changes: 3 additions & 1 deletion vstgui/lib/cframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,15 @@ class CFrame final : public CViewContainer, public IPlatformFrameCallback
void dumpHierarchy () override;
#endif

CLASS_METHODS(CFrame, CViewContainer)
CLASS_METHODS_NOCOPY(CFrame, CViewContainer)

//-------------------------------------------
protected:
struct CollectInvalidRects;

CFrame (const CFrame&) = delete;
~CFrame () noexcept override = default;

void beforeDelete () override;

void checkMouseViews (const MouseEvent& event);
Expand Down
4 changes: 2 additions & 2 deletions vstgui/lib/controls/cbuttons.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ class CTextButton : public CControl
CMouseEventResult onMouseMoved (CPoint& where, const CButtonState& buttons) override;
CMouseEventResult onMouseCancel () override;
void onKeyboardEvent (KeyboardEvent& event) override;
CLASS_METHODS(CTextButton, CControl)

CLASS_METHODS_NOCOPY (CTextButton, CControl)
protected:
~CTextButton () noexcept override = default;

Expand Down
2 changes: 1 addition & 1 deletion vstgui/lib/controls/coptionmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
13 changes: 8 additions & 5 deletions vstgui/lib/controls/cparamdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void CParamDisplay::draw (CDrawContext *pContext)
}

drawBack (pContext);
drawPlatformText (pContext, UTF8String (string).getPlatformString ());
drawPlatformText (pContext, UTF8String (string));
setDirty (false);
}

Expand Down Expand Up @@ -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))
{
Expand All @@ -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 ();
}
Expand Down
5 changes: 3 additions & 2 deletions vstgui/lib/controls/cparamdisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();

Expand Down
4 changes: 2 additions & 2 deletions vstgui/lib/controls/csearchtextedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions vstgui/lib/controls/ctextedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 ();
}
}
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion vstgui/lib/controls/ctextlabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
3 changes: 2 additions & 1 deletion vstgui/lib/cresourcedescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ class CResourceDescription
CResourceDescription () = default;
CResourceDescription (UTF8StringPtr name) : type (kStringType) { u.name = name; }
explicit CResourceDescription (int32_t id) : type (kIntegerType) { u.id = id; }
CResourceDescription (const CResourceDescription&) = default;

CResourceDescription& operator= (int32_t id) { u.id = id; type = kIntegerType; return *this; }
CResourceDescription& operator= (const CResourceDescription& desc) { type = desc.type; u.id = desc.u.id; u.name = desc.u.name; return *this; }
CResourceDescription& operator= (const CResourceDescription& desc) = default;

int32_t type {kUnknownType};
union {
Expand Down
22 changes: 11 additions & 11 deletions vstgui/lib/cstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class UTF8String
void assign (UTF8StringPtr str);
void clear () noexcept;

const UTF8StringPtr data () const noexcept { return string.data (); }
UTF8StringPtr data () const noexcept { return string.data (); }
operator const UTF8StringPtr () const noexcept { return data (); }
const StringType& getString () const noexcept { return string; }
IPlatformString* getPlatformString () const noexcept;
Expand Down Expand Up @@ -233,30 +233,30 @@ class UTF8CharacterIterator
{
public:
UTF8CharacterIterator (const UTF8StringPtr utf8Str)
: startPos ((uint8_t*)utf8Str)
: startPos ((const uint8_t*)utf8Str)
, currentPos (nullptr)
, strLen (std::strlen (utf8Str))
{
begin ();
}

UTF8CharacterIterator (const UTF8StringPtr utf8Str, size_t strLen)
: startPos ((uint8_t*)utf8Str)
: startPos ((const uint8_t*)utf8Str)
, currentPos (nullptr)
, strLen (strLen)
{
begin ();
}

UTF8CharacterIterator (const std::string& stdStr)
: startPos ((uint8_t*)stdStr.c_str ())
: startPos ((const uint8_t*)stdStr.data ())
, currentPos (nullptr)
, strLen (stdStr.size ())
{
begin ();
}

uint8_t* next ()
const uint8_t* next ()
{
if (currentPos)
{
Expand All @@ -276,7 +276,7 @@ class UTF8CharacterIterator
return currentPos;
}

uint8_t* previous ()
const uint8_t* previous ()
{
while (currentPos)
{
Expand Down Expand Up @@ -319,20 +319,20 @@ class UTF8CharacterIterator
return 0;
}

uint8_t* begin () { currentPos = startPos; return currentPos;}
uint8_t* end () { currentPos = startPos + strLen; return currentPos; }
const uint8_t* begin () { currentPos = startPos; return currentPos;}
const uint8_t* end () { currentPos = startPos + strLen; return currentPos; }

const uint8_t* front () const { return startPos; }
const uint8_t* back () const { return startPos + strLen; }

const uint8_t* operator++() { return next (); }
const uint8_t* operator--() { return previous (); }
bool operator==(uint8_t i) { if (currentPos) return *currentPos == i; return false; }
operator uint8_t* () const { return (uint8_t*)currentPos; }
operator const uint8_t* () const { return currentPos; }

protected:
uint8_t* startPos;
uint8_t* currentPos;
const uint8_t* startPos;
const uint8_t* currentPos;
size_t strLen;
};

Expand Down
2 changes: 2 additions & 0 deletions vstgui/lib/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct Modifiers
Modifiers () = default;
Modifiers (const Modifiers&) = default;
explicit Modifiers (ModifierKey modifier) : data (cast (modifier)) {}
Modifiers& operator= (const Modifiers&) = default;

/** test if no modifier key is set */
[[nodiscard]] bool empty () const { return data == 0; }
Expand Down Expand Up @@ -202,6 +203,7 @@ struct MouseEventButtonState
MouseEventButtonState () = default;
MouseEventButtonState (const MouseEventButtonState&) = default;
MouseEventButtonState (MouseButton pos) { set (pos); }
MouseEventButtonState& operator= (const MouseEventButtonState&) = default;

[[nodiscard]] bool operator== (const MouseEventButtonState& other) const
{
Expand Down
2 changes: 1 addition & 1 deletion vstgui/lib/platform/common/generictextedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions vstgui/lib/platform/linux/x11platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ uint32_t RunLoop::getCursorID (CCursorType cursor)
case kCursorNWSESize:
cursorID = makeCursor (impl->cursorContext, CursorNWSESizeNames);
break;
case kCursorCrosshair:
case kCursorSizeAll:
cursorID = makeCursor (impl->cursorContext, CursorSizeAllNames);
break;
Expand Down
2 changes: 2 additions & 0 deletions vstgui/lib/platform/mac/cocoa/nsviewframe.mm
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ static void draggedImageEndedAtOperation (id self, SEL _cmd, NSImage* image, NSP
{
[nsView setWantsLayer:YES];
caLayer = [CALayer new];
caLayer.geometryFlipped = ![nsView.layer contentsAreFlipped];
caLayer.delegate = static_cast<id<CALayerDelegate>> (nsView);
caLayer.frame = nsView.layer.bounds;
[caLayer setContentsScale:nsView.layer.contentsScale];
Expand Down Expand Up @@ -1332,6 +1333,7 @@ static MouseEventButtonState buttonStateFromNSEvent (NSEvent* theEvent)
case kCursorNotAllowed: cur = [NSCursor performSelector:@selector(operationNotAllowedCursor)]; break;
case kCursorHand: cur = [NSCursor openHandCursor]; break;
case kCursorIBeam: cur = [NSCursor IBeamCursor]; break;
case kCursorCrosshair: cur = [NSCursor crosshairCursor]; break;
default: cur = [NSCursor arrowCursor]; break;
}
if (cur)
Expand Down
3 changes: 3 additions & 0 deletions vstgui/lib/platform/win32/win32frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ bool Win32Frame::setMouseCursor (CCursorType type)
case kCursorHand:
cursor = LoadCursor (nullptr, IDC_HAND);
break;
case kCursorCrosshair:
cursor = LoadCursor (nullptr, IDC_CROSS);
break;
default:
cursor = LoadCursor (nullptr, IDC_ARROW);
break;
Expand Down
11 changes: 6 additions & 5 deletions vstgui/lib/vstguibase.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// VSTGUI Version
//-----------------------------------------------------------------------------
#define VSTGUI_VERSION_MAJOR 4
#define VSTGUI_VERSION_MINOR 13
#define VSTGUI_VERSION_MINOR 14
#define VSTGUI_VERSION_PATCHLEVEL 0

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -203,7 +203,7 @@

//----------------------------------------------------
#define CLASS_METHODS(name, parent) CBaseObject* newCopy () const override { return new name (*this); }
#define CLASS_METHODS_NOCOPY(name, parent) CBaseObject* newCopy () const override { return 0; }
#define CLASS_METHODS_NOCOPY(name, parent) CBaseObject* newCopy () const override { return nullptr; }
#define CLASS_METHODS_VIRTUAL(name, parent) CBaseObject* newCopy () const override = 0;

//----------------------------------------------------
Expand Down Expand Up @@ -259,7 +259,7 @@ class ReferenceCounted : virtual public IReference
ReferenceCounted () = default;
virtual ~ReferenceCounted () noexcept = default;

ReferenceCounted (const ReferenceCounted&) {};
ReferenceCounted (const ReferenceCounted&) {}
ReferenceCounted& operator= (const ReferenceCounted&) { return *this; }

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -290,7 +290,7 @@ class CBaseObject : public NonAtomicReferenceCounted
CBaseObject () = default;
~CBaseObject () noexcept override = default;

CBaseObject (const CBaseObject&) {};
CBaseObject (const CBaseObject&) {}
CBaseObject& operator= (const CBaseObject&) { return *this; }

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -401,7 +401,7 @@ inline SharedPointer<I>::SharedPointer (const SharedPointer<I>& other) noexcept
//------------------------------------------------------------------------
template <class I>
inline SharedPointer<I>::SharedPointer () noexcept
: ptr (0)
: ptr (nullptr)
{}

//------------------------------------------------------------------------
Expand Down Expand Up @@ -545,6 +545,7 @@ struct BitScopeToggleT
#define VSTGUI_NEWER_THAN_4_10 VSTGUI_NEWER_THAN (4, 10)
#define VSTGUI_NEWER_THAN_4_11 VSTGUI_NEWER_THAN (4, 11)
#define VSTGUI_NEWER_THAN_4_12 VSTGUI_NEWER_THAN (4, 12)
#define VSTGUI_NEWER_THAN_4_13 VSTGUI_NEWER_THAN (4, 13)

} // VSTGUI

Expand Down
Loading

0 comments on commit 4fe8bb3

Please sign in to comment.