Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/prepare-vstgui-4.13.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
scheffle committed Jan 11, 2024
2 parents 2f68399 + 4d4d74f commit 0cb9df5
Show file tree
Hide file tree
Showing 21 changed files with 85 additions and 40 deletions.
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
2 changes: 1 addition & 1 deletion vstgui/lib/cdrawcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ void CDrawContext::fillRadialGradient (CGraphicsPath* path, const CGradient& gra
CGraphicsPath* CDrawContext::createGraphicsPath ()
{
if (impl->device)
return new CGraphicsPath (impl->device->getGraphicsPathFactory ());
return new CGraphicsPath (impl->device->getGraphicsPathFactory (), nullptr);
return nullptr;
}

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
3 changes: 1 addition & 2 deletions vstgui/lib/cgraphicspath.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ class CGraphicsPath : public AtomicReferenceCounted
CRect getBoundingBox ();
//@}

CGraphicsPath (const PlatformGraphicsPathFactoryPtr& factory,
PlatformGraphicsPathPtr&& path = nullptr);
CGraphicsPath (const PlatformGraphicsPathFactoryPtr& factory, PlatformGraphicsPathPtr&& path);
~CGraphicsPath () noexcept override;

const PlatformGraphicsPathPtr& getPlatformPath (PlatformGraphicsPathFillMode fillMode);
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
8 changes: 8 additions & 0 deletions vstgui/lib/controls/coptionmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,14 @@ void COptionMenu::setValue (float val)
setDirty ();
}

//------------------------------------------------------------------------
float COptionMenu::getMax () const
{
if (menuItems->empty ())
return 0.f;
return static_cast<float> (menuItems->size () - 1);
}

//------------------------------------------------------------------------
void COptionMenu::takeFocus ()
{
Expand Down
2 changes: 1 addition & 1 deletion vstgui/lib/controls/coptionmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class COptionMenu : public CParamDisplay
void setMin (float val) override {}
float getMin () const override { return 0; }
void setMax (float val) override {}
float getMax () const override { return (float)(menuItems->size () - 1); }
float getMax () const override;

void draw (CDrawContext* pContext) override;
CMouseEventResult onMouseDown (CPoint& where, const CButtonState& buttons) override;
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
45 changes: 34 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 @@ -221,6 +221,9 @@ class UTF8StringView
bool operator== (const UTF8StringPtr otherString) const;
bool operator!= (const UTF8StringPtr otherString) const;
bool operator== (UTF8StringView otherString) const;
bool operator!= (UTF8StringView otherString) const;
bool operator== (const UTF8String& otherString) const;
bool operator!= (const UTF8String& otherString) const;
operator const UTF8StringPtr () const;
//-----------------------------------------------------------------------------
private:
Expand All @@ -233,30 +236,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 +279,7 @@ class UTF8CharacterIterator
return currentPos;
}

uint8_t* previous ()
const uint8_t* previous ()
{
while (currentPos)
{
Expand Down Expand Up @@ -319,20 +322,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 Expand Up @@ -463,6 +466,26 @@ inline bool UTF8StringView::operator== (UTF8StringView otherString) const
return operator==(otherString.str);
}

//------------------------------------------------------------------------
inline bool UTF8StringView::operator!= (UTF8StringView otherString) const
{
if (byteCount && otherString.byteCount && *byteCount != *otherString.byteCount)
return true;
return operator!= (otherString.str);
}

//------------------------------------------------------------------------
inline bool UTF8StringView::operator== (const UTF8String& otherString) const
{
return otherString == str;
}

//------------------------------------------------------------------------
inline bool UTF8StringView::operator!= (const UTF8String& otherString) const
{
return otherString != str;
}

//-----------------------------------------------------------------------------
inline UTF8StringView::operator const UTF8StringPtr () const
{
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
6 changes: 4 additions & 2 deletions vstgui/lib/platform/mac/cgbitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ CGImageRef CGBitmap::getCGImage ()
size_t rowBytes = getBytesPerRow ();
size_t bitDepth = 32;

CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Big;
CGBitmapInfo bitmapInfo =
static_cast<CGBitmapInfo> (kCGImageAlphaPremultipliedFirst) | kCGBitmapByteOrder32Big;
image = CGImageCreate (static_cast<size_t> (size.x), static_cast<size_t> (size.y), 8, bitDepth, rowBytes, GetCGColorSpace (), bitmapInfo, bitsDataProvider, nullptr, false, kCGRenderingIntentDefault);
dirty = false;
}
Expand Down Expand Up @@ -300,7 +301,8 @@ CGContextRef CGBitmap::createCGContext ()
}
if (bits)
{
CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Big;
CGBitmapInfo bitmapInfo =
static_cast<CGBitmapInfo> (kCGImageAlphaPremultipliedFirst) | kCGBitmapByteOrder32Big;
context = CGBitmapContextCreate (bits,
static_cast<size_t> (size.x),
static_cast<size_t> (size.y),
Expand Down
1 change: 1 addition & 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
1 change: 1 addition & 0 deletions vstgui/lib/platform/mac/macfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class MacFactory final : public IPlatformFactory
{
public:
MacFactory (CFBundleRef bundle);
~MacFactory () noexcept override;

CFBundleRef getBundle () const noexcept;

Expand Down
2 changes: 2 additions & 0 deletions vstgui/lib/platform/mac/macfactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
mach_timebase_info (&impl->timebaseInfo);
}

MacFactory::~MacFactory () noexcept = default;

//-----------------------------------------------------------------------------
CFBundleRef MacFactory::getBundle () const noexcept
{
Expand Down
10 changes: 5 additions & 5 deletions vstgui/lib/vstguibase.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//-----------------------------------------------------------------------------
#define VSTGUI_VERSION_MAJOR 4
#define VSTGUI_VERSION_MINOR 13
#define VSTGUI_VERSION_PATCHLEVEL 1
#define VSTGUI_VERSION_PATCHLEVEL 2

//-----------------------------------------------------------------------------
// Platform definitions
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ HighScoreViewController::HighScoreViewController (IController* parent)
columnWidths[1] = 0.14;
columnWidths[2] = 0.5;
columnWidths[3] = 0.3;
font = *kSystemFont;
font = kSystemFont;
}

//------------------------------------------------------------------------
Expand Down Expand Up @@ -103,8 +103,8 @@ int32_t HighScoreViewController::dbGetNumColumns (CDataBrowser* browser)
CCoord HighScoreViewController::dbGetRowHeight (CDataBrowser* browser)
{
auto height = browser->getHeight () / (HighScoreListModel::Size + 1) - 1;
if (font.getSize () != height * 0.6)
font.setSize (height * 0.6);
if (font->getSize () != height * 0.6)
font->setSize (height * 0.6);
return height;
}

Expand All @@ -129,7 +129,7 @@ bool HighScoreViewController::dbGetLineWidthAndColor (CCoord& width, CColor& col
void HighScoreViewController::dbDrawHeader (CDrawContext* context, const CRect& size,
int32_t column, int32_t flags, CDataBrowser* browser)
{
context->setFont (&font);
context->setFont (font);
context->setFontColor (fontColor);
UTF8String text;
switch (column)
Expand Down Expand Up @@ -157,7 +157,7 @@ void HighScoreViewController::dbDrawCell (CDrawContext* context, const CRect& si
if (entry == list->get ().end ())
return;
bool valid = entry->valid ();
context->setFont (&font);
context->setFont (font);
context->setFontColor (fontColor);
UTF8String text = "-";
CHoriTxtAlign align = kCenterText;
Expand Down Expand Up @@ -210,7 +210,7 @@ CView* HighScoreViewController::createView (const UIAttributes& attributes,
if (attr && *attr == "DataBrowser")
{
if (auto f = description->getFont ("highscore"))
font = *f;
font = f;
description->getColor ("highscore.font", fontColor);
return new CDataBrowser ({}, this, CDataBrowser::kDrawHeader | CDataBrowser::kDrawRowLines,
0.);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class HighScoreViewController final : public DelegationController,

static constexpr const size_t NumCols = 4;

CFontDesc font;
SharedPointer<CFontDesc> font;
CColor fontColor {kBlackCColor};
CDataBrowser* dataBrowser {nullptr};
std::shared_ptr<HighScoreList> list;
Expand Down
Loading

0 comments on commit 0cb9df5

Please sign in to comment.