Skip to content

Commit

Permalink
Prepare 4 10 3
Browse files Browse the repository at this point in the history
Merge in vstgui from prepare_4_10_3 to master

* commit '7de1d70cfa9f7ead744916ae38e8f07a85b727c7':
  fix cairo drawing error when another frame closes
  increase version patchlevel
  do not store UIViewSwitchContainer children
  make sure all control listeners will be notified about control changes in the vst3editor
  replace deprecated CTGetCoreTextVersion with @available
  fix warning when macOS deployment target is higher than 10.11
  fix creating sub UTF8 string if it contains any multi byte character
  • Loading branch information
scheffle committed Dec 7, 2021
2 parents 0de3d83 + 7de1d70 commit 6431f63
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 23 deletions.
3 changes: 2 additions & 1 deletion vstgui/lib/controls/ctextlabel.cpp
Expand Up @@ -380,7 +380,8 @@ void CMultiLineTextLabel::calculateWrapLine (CDrawContext* context,
lastSeparator = ++pos;
if (pos == element.first.end ())
break;
UTF8String tmp ({start.base (), ++(pos.base ())});
auto tmpEnd = pos;
UTF8String tmp ({start.base (), (++tmpEnd).base ()});
auto width = fontPainter->getStringWidth (context, tmp.getPlatformString ());
if (width > maxWidth)
{
Expand Down
1 change: 0 additions & 1 deletion vstgui/lib/platform/linux/x11frame.cpp
Expand Up @@ -121,7 +121,6 @@ struct DrawHandler

~DrawHandler ()
{
cairo_device_finish (device);
cairo_device_destroy (device);
}

Expand Down
19 changes: 1 addition & 18 deletions vstgui/lib/platform/mac/cfontmac.mm
Expand Up @@ -103,23 +103,6 @@ void getUrlsForType (CFStringRef fontType, CFMutableArrayRef& array)
CFMutableArrayRef fontUrls;
};

//-----------------------------------------------------------------------------
struct CTVersionCheck
{
CTVersionCheck ()
{
version = CTGetCoreTextVersion ();
}
uint32_t version;
};

//-----------------------------------------------------------------------------
static uint32_t getCTVersion ()
{
static CTVersionCheck gInstance;
return gInstance.version;
}

//-----------------------------------------------------------------------------
bool CoreTextFont::getAllFontFamilies (const FontFamilyCallback& callback) noexcept
{
Expand Down Expand Up @@ -177,7 +160,7 @@ static CTFontRef CoreTextCreateTraitsVariant (CTFontRef fontRef, CTFontSymbolicT
CFStringRef fontNameRef = fromUTF8String<CFStringRef> (name);
if (fontNameRef)
{
if (getCTVersion () >= 0x00060000)
if (@available (macOS 10.10, *))
{
CFMutableDictionaryRef attributes = CFDictionaryCreateMutable (kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFDictionaryAddValue (attributes, kCTFontFamilyNameAttribute, fontNameRef);
Expand Down
2 changes: 1 addition & 1 deletion vstgui/lib/vstguibase.h
Expand Up @@ -13,7 +13,7 @@
//-----------------------------------------------------------------------------
#define VSTGUI_VERSION_MAJOR 4
#define VSTGUI_VERSION_MINOR 10
#define VSTGUI_VERSION_PATCHLEVEL 2
#define VSTGUI_VERSION_PATCHLEVEL 3

//-----------------------------------------------------------------------------
// Platform definitions
Expand Down
3 changes: 3 additions & 0 deletions vstgui/plugin-bindings/vst3editor.cpp
Expand Up @@ -325,6 +325,7 @@ class ParameterChangeListener : public Steinberg::FObject
}
else
c->setValueNormalized ((float)value);
c->valueChanged ();
}
c->invalid ();
}
Expand Down Expand Up @@ -627,6 +628,8 @@ ParameterChangeListener* VST3Editor::getParameterChangeListener (int32_t tag) co
void VST3Editor::valueChanged (CControl* pControl)
{
using namespace Steinberg;
if (!pControl->isEditing ())
return;

ParameterChangeListener* pcl = getParameterChangeListener (pControl->getTag ());
if (pcl)
Expand Down
11 changes: 10 additions & 1 deletion vstgui/tests/unittest/lib/platform_helper_mac.mm
Expand Up @@ -14,7 +14,16 @@

MacParentHandle ()
{
window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100) styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO];
NSWindowStyleMask style;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
style = NSWindowStyleMaskTitled;
#else
style = NSTitledWindowMask;
#endif
window = [[NSWindow alloc] initWithContentRect:NSMakeRect (0, 0, 100, 100)
styleMask:style
backing:NSBackingStoreBuffered
defer:NO];
}

~MacParentHandle () override
Expand Down
3 changes: 2 additions & 1 deletion vstgui/uidescription/uidescription.cpp
Expand Up @@ -10,6 +10,7 @@
#include "cstream.h"
#include "base64codec.h"
#include "uicontentprovider.h"
#include "uiviewswitchcontainer.h"
#include "icontroller.h"
#include "xmlparser.h"
#include "../lib/cfont.h"
Expand Down Expand Up @@ -1591,7 +1592,7 @@ bool UIDescription::updateAttributesForView (UINode* node, CView* view, bool dee
node->getAttributes ()->setAttribute (UIViewCreator::kAttrClass, factory->getViewName (view));
result = true;
}
if (deep && container)
if (deep && container && dynamic_cast<UIViewSwitchContainer*> (container) == nullptr)
{
ViewIterator it (container);
while (*it)
Expand Down

0 comments on commit 6431f63

Please sign in to comment.