Skip to content

Commit

Permalink
Updated to work with SDK version 3.7.10
Browse files Browse the repository at this point in the history
  • Loading branch information
igorski committed Mar 16, 2024
1 parent fab6b8f commit 0cb0904
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -stdlib=libc++")
link_libraries(c++)
# support Yosemite and up
set(CMAKE_OSX_SYSROOT macosx10.10)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10")
set(CMAKE_OSX_SYSROOT macosx10.13)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
else()
set(LINUX true)
add_definitions( -D__cdecl= )
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The project uses [CMake](https://cmake.org) to generate the Makefiles and has be

### Environment setup

Apart from requiring _CMake_ and a C(++) compiler such as _Clang_ or _MSVC_, the only other dependency is the [VST SDK from Steinberg](https://www.steinberg.net/en/company/developers.html) (the projects latest update requires SDK version 3.7.6).
Apart from requiring _CMake_ and a C(++) compiler such as _Clang_ or _MSVC_, the only other dependency is the [VST SDK from Steinberg](https://www.steinberg.net/en/company/developers.html) (the projects latest update requires SDK version 3.7.10+).

Be aware that prior to building the plugin, the Steinberg SDK needs to be built from source as well. Following Steinbergs guidelines, the build target should be a _/build_-subfolder of the _/vst3sdk_-folder.
To generate a release build of the library, execute the following commands from the root of the Steinberg SDK folder:
Expand Down
30 changes: 12 additions & 18 deletions src/ui/uimessagecontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "vstgui/lib/iviewlistener.h"
#include "vstgui/uidescription/icontroller.h"
#include "public.sdk/source/vst/utility/stringconvert.h"

//------------------------------------------------------------------------
namespace Steinberg {
Expand Down Expand Up @@ -57,9 +58,7 @@ class PluginUIMessageController : public VSTGUI::IController, public VSTGUI::Vie
if ( !textEdit )
return;

String str( msgText );
str.toMultiByte( kCP_Utf8 );
textEdit->setText( str.text8() );
textEdit->setText( VST3::StringConvert::convert( msgText ));
}

private:
Expand Down Expand Up @@ -108,37 +107,32 @@ class PluginUIMessageController : public VSTGUI::IController, public VSTGUI::Vie
textEdit = te;

// add this as listener in order to get viewWillDelete and viewLostFocus calls
textEdit->registerViewListener (this);
textEdit->registerViewListener( this );

// initialize it content
String str( pluginController->getDefaultMessageText());
str.toMultiByte (kCP_Utf8);
textEdit->setText (str.text8 ());
// set its contents
textEdit->setText( VST3::StringConvert::convert( pluginController->getDefaultMessageText()));
}
return view;
}
//--- from IViewListenerAdapter ----------------------
//--- is called when a view will be deleted: the editor is closed -----
void viewWillDelete (CView* view) override
void viewWillDelete( CView* view ) override
{
if (dynamic_cast<CTextEdit*> (view) == textEdit)
if ( dynamic_cast<CTextEdit*>( view ) == textEdit )
{
textEdit->unregisterViewListener (this);
textEdit = nullptr;
}
}
//--- is called when the view is unfocused -----------------
void viewLostFocus (CView* view) override
void viewLostFocus( CView* view ) override
{
if (dynamic_cast<CTextEdit*> (view) == textEdit)
if ( dynamic_cast<CTextEdit*>( view ) == textEdit )
{
// save the last content of the text edit view
const UTF8String& text = textEdit->getText ();
String128 messageText;
String str;
str.fromUTF8 (text.data ());
str.copyTo (messageText, 128);
pluginController->setDefaultMessageText (messageText);
const auto& text = textEdit->getText();
auto utf16Text = VST3::StringConvert::convert( text.getString());
pluginController->setDefaultMessageText( utf16Text.data());
}
}
ControllerType* pluginController;
Expand Down

0 comments on commit 0cb0904

Please sign in to comment.