Skip to content

Commit

Permalink
Merge pull request #1006 from paulfd/rollback-vstgui4_10_2
Browse files Browse the repository at this point in the history
Change vstgui to 4.10.2 with hotfixes
  • Loading branch information
paulfd authored Nov 7, 2021
2 parents 0787b31 + 8c16aba commit ffd09f7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[submodule "vst/external/VST_SDK/VST3_SDK/vstgui4"]
path = plugins/editor/external/vstgui4
url = https://github.com/sfztools/vstgui.git
shallow = true
branch = vstgui4_10_2-hotfix
[submodule "external/st_audiofile/thirdparty/dr_libs"]
path = external/st_audiofile/thirdparty/dr_libs
url = https://github.com/mackron/dr_libs.git
Expand Down
21 changes: 18 additions & 3 deletions plugins/editor/cmake/Vstgui.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Find vstgui version
FILE(READ ${VSTGUI_BASEDIR}/vstgui/lib/vstguibase.h VSTGUIBASE_HEADER)
string(REGEX MATCH "\#define VSTGUI_VERSION_MAJOR ([0-9]*)" _ ${VSTGUIBASE_HEADER})
set(VSTGUI_VERSION_MAJOR ${CMAKE_MATCH_1})
string(REGEX MATCH "\#define VSTGUI_VERSION_MINOR ([0-9]*)" _ ${VSTGUIBASE_HEADER})
set(VSTGUI_VERSION_MINOR ${CMAKE_MATCH_1})
set(VSTGUI_VERSION "${VSTGUI_VERSION_MAJOR}.${VSTGUI_VERSION_MINOR}")

add_library(sfizz_vstgui STATIC EXCLUDE_FROM_ALL
"${VSTGUI_BASEDIR}/vstgui/lib/animation/animations.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/animation/animator.cpp"
Expand Down Expand Up @@ -39,7 +47,6 @@ add_library(sfizz_vstgui STATIC EXCLUDE_FROM_ALL
"${VSTGUI_BASEDIR}/vstgui/lib/cfileselector.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cfont.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cframe.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cgradient.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cgradientview.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cgraphicspath.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/clayeredviewcontainer.cpp"
Expand All @@ -58,20 +65,24 @@ add_library(sfizz_vstgui STATIC EXCLUDE_FROM_ALL
"${VSTGUI_BASEDIR}/vstgui/lib/cview.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cviewcontainer.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/cvstguitimer.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/events.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/genericstringlistdatabrowsersource.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/pixelbuffer.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/vstguidebug.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/vstguiinit.cpp")

if(${VSTGUI_VERSION} VERSION_GREATER "4.10")
target_sources(sfizz_vstgui PRIVATE
${VSTGUI_BASEDIR}/vstgui/lib/cgradient.cpp
${VSTGUI_BASEDIR}/vstgui/lib/events.cpp)
endif()

add_library(sfizz::vstgui ALIAS sfizz_vstgui)

if(WIN32)
target_sources(sfizz_vstgui PRIVATE
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dbitmap.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2ddrawcontext.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dfont.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dgradient.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dgraphicspath.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32datapackage.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32dragging.cpp"
Expand All @@ -85,6 +96,10 @@ if(WIN32)
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/winfileselector.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/winstring.cpp"
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/wintimer.cpp")
if(${VSTGUI_VERSION} VERSION_GREATER "4.10")
target_sources(sfizz_vstgui PRIVATE
${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dgradient.cpp)
endif()
elseif(APPLE)
target_sources(sfizz_vstgui PRIVATE
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/carbon/hiviewframe.cpp"
Expand Down
2 changes: 1 addition & 1 deletion plugins/editor/external/vstgui4
Submodule vstgui4 updated 355 files
16 changes: 14 additions & 2 deletions plugins/editor/src/editor/GUIHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz

#include "GUIHelpers.h"
#define VSTGUI_MORE_THAN_4_10 ((VSTGUI_VERSION_MAJOR > 4) || (VSTGUI_VERSION_MAJOR == 4 && VSTGUI_VERSION_MINOR > 10))
#if VSTGUI_MORE_THAN_4_10
#include "utility/vstgui_before.h"
#include <vstgui/lib/events.h>
#include "utility/vstgui_after.h"
#endif

class SFrameDisabler::KeyAndMouseHook : public CBaseObject,
public IKeyboardHook,
Expand All @@ -16,10 +19,17 @@ class SFrameDisabler::KeyAndMouseHook : public CBaseObject,
void setEnabled(bool value) { enabled_ = value; }

protected:
void onMouseEntered(CView*, CFrame*) override {}
void onMouseExited(CView*, CFrame*) override {}
#if VSTGUI_MORE_THAN_4_10
void onKeyboardEvent(KeyboardEvent& event, CFrame* frame) override;
void onMouseEntered(CView* view, CFrame* frame) override {}
void onMouseExited(CView* view, CFrame* frame) override {}
void onMouseEvent(MouseEvent& event, CFrame* frame) override;
#else
int32_t onKeyDown(const VstKeyCode&, CFrame*) { return enabled_ ? -1 : 1; }
int32_t onKeyUp(const VstKeyCode&, CFrame*) { return enabled_ ? -1 : 1; }
CMouseEventResult onMouseMoved(CFrame*, const CPoint&, const CButtonState&) { return enabled_ ? kMouseEventNotHandled : kMouseEventHandled; }
CMouseEventResult onMouseDown(CFrame*, const CPoint&, const CButtonState&) { return enabled_ ? kMouseEventNotHandled : kMouseEventHandled; }
#endif

private:
bool enabled_ = true;
Expand Down Expand Up @@ -53,6 +63,7 @@ void SFrameDisabler::disable()
delayedEnabler_->stop();
}

#if VSTGUI_MORE_THAN_4_10
void SFrameDisabler::KeyAndMouseHook::onKeyboardEvent(KeyboardEvent& event, CFrame* frame)
{
if (!enabled_)
Expand All @@ -64,3 +75,4 @@ void SFrameDisabler::KeyAndMouseHook::onMouseEvent(MouseEvent& event, CFrame* fr
if (!enabled_)
event.consumed = true;
}
#endif

0 comments on commit ffd09f7

Please sign in to comment.