| @@ -1,35 +0,0 @@ | |||||
| /* | |||||
| * Carla Bridge | |||||
| * Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com> | |||||
| * | |||||
| * This program is free software; you can redistribute it and/or | |||||
| * modify it under the terms of the GNU General Public License as | |||||
| * published by the Free Software Foundation; either version 2 of | |||||
| * the License, or any later version. | |||||
| * | |||||
| * This program is distributed in the hope that it will be useful, | |||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| * GNU General Public License for more details. | |||||
| * | |||||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||||
| */ | |||||
| #ifndef CARLA_BRIDGE_HPP_INCLUDED | |||||
| #define CARLA_BRIDGE_HPP_INCLUDED | |||||
| #include "CarlaDefines.h" | |||||
| #define CARLA_BRIDGE_START_NAMESPACE namespace CarlaBridge { | |||||
| #define CARLA_BRIDGE_END_NAMESPACE } | |||||
| #define CARLA_BRIDGE_USE_NAMESPACE using namespace CarlaBridge; | |||||
| CARLA_BRIDGE_START_NAMESPACE | |||||
| // forward declarations of commonly used Carla-Bridge classes | |||||
| class CarlaBridgeUI; | |||||
| class CarlaBridgeToolkit; | |||||
| CARLA_BRIDGE_END_NAMESPACE | |||||
| #endif // CARLA_BRIDGE_HPP_INCLUDED | |||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * Carla Bridge UI | * Carla Bridge UI | ||||
| * Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com> | |||||
| * Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -15,11 +15,13 @@ | |||||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | * For a full copy of the GNU General Public License see the doc/GPL.txt file. | ||||
| */ | */ | ||||
| #include "CarlaBridgeUI.hpp" | |||||
| #include "CarlaMIDI.h" | |||||
| #include "CarlaBridgeFormat.hpp" | |||||
| #include "CarlaBridgeToolkit.hpp" | |||||
| #include "CarlaBase64Utils.hpp" | #include "CarlaBase64Utils.hpp" | ||||
| #include "CarlaMIDI.h" | |||||
| // FIXME move this into utils | |||||
| #ifdef CARLA_OS_LINUX | #ifdef CARLA_OS_LINUX | ||||
| # include <signal.h> | # include <signal.h> | ||||
| # include <sys/prctl.h> | # include <sys/prctl.h> | ||||
| @@ -33,11 +35,11 @@ | |||||
| #include "lv2/atom-util.h" | #include "lv2/atom-util.h" | ||||
| CARLA_BRIDGE_START_NAMESPACE | |||||
| CARLA_BRIDGE_UI_START_NAMESPACE | |||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| CarlaBridgeUI::CarlaBridgeUI() noexcept | |||||
| CarlaBridgeFormat::CarlaBridgeFormat() noexcept | |||||
| : CarlaPipeClient(), | : CarlaPipeClient(), | ||||
| fQuitReceived(false), | fQuitReceived(false), | ||||
| fGotOptions(false), | fGotOptions(false), | ||||
| @@ -46,16 +48,16 @@ CarlaBridgeUI::CarlaBridgeUI() noexcept | |||||
| fLib(nullptr), | fLib(nullptr), | ||||
| fLibFilename() | fLibFilename() | ||||
| { | { | ||||
| carla_debug("CarlaBridgeUI::CarlaBridgeUI()"); | |||||
| carla_debug("CarlaBridgeFormat::CarlaBridgeFormat()"); | |||||
| try { | try { | ||||
| fToolkit = CarlaBridgeToolkit::createNew(this); | fToolkit = CarlaBridgeToolkit::createNew(this); | ||||
| } CARLA_SAFE_EXCEPTION_RETURN("CarlaBridgeToolkit::createNew",); | } CARLA_SAFE_EXCEPTION_RETURN("CarlaBridgeToolkit::createNew",); | ||||
| } | } | ||||
| CarlaBridgeUI::~CarlaBridgeUI() /*noexcept*/ | |||||
| CarlaBridgeFormat::~CarlaBridgeFormat() /*noexcept*/ | |||||
| { | { | ||||
| carla_debug("CarlaBridgeUI::~CarlaBridgeUI()"); | |||||
| carla_debug("CarlaBridgeFormat::~CarlaBridgeFormat()"); | |||||
| if (isPipeRunning() && ! fQuitReceived) | if (isPipeRunning() && ! fQuitReceived) | ||||
| writeExitingMessageAndWait(); | writeExitingMessageAndWait(); | ||||
| @@ -78,7 +80,7 @@ CarlaBridgeUI::~CarlaBridgeUI() /*noexcept*/ | |||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| bool CarlaBridgeUI::libOpen(const char* const filename) noexcept | |||||
| bool CarlaBridgeFormat::libOpen(const char* const filename) noexcept | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fLib == nullptr, false); | CARLA_SAFE_ASSERT_RETURN(fLib == nullptr, false); | ||||
| @@ -93,14 +95,14 @@ bool CarlaBridgeUI::libOpen(const char* const filename) noexcept | |||||
| return false; | return false; | ||||
| } | } | ||||
| void* CarlaBridgeUI::libSymbol(const char* const symbol) const noexcept | |||||
| void* CarlaBridgeFormat::libSymbol(const char* const symbol) const noexcept | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fLib != nullptr, nullptr); | CARLA_SAFE_ASSERT_RETURN(fLib != nullptr, nullptr); | ||||
| return lib_symbol<void*>(fLib, symbol); | return lib_symbol<void*>(fLib, symbol); | ||||
| } | } | ||||
| const char* CarlaBridgeUI::libError() const noexcept | |||||
| const char* CarlaBridgeFormat::libError() const noexcept | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fLibFilename.isNotEmpty(), nullptr); | CARLA_SAFE_ASSERT_RETURN(fLibFilename.isNotEmpty(), nullptr); | ||||
| @@ -109,13 +111,13 @@ const char* CarlaBridgeUI::libError() const noexcept | |||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| bool CarlaBridgeUI::msgReceived(const char* const msg) noexcept | |||||
| bool CarlaBridgeFormat::msgReceived(const char* const msg) noexcept | |||||
| { | { | ||||
| carla_debug("CarlaBridgeUI::msgReceived(\"%s\")", msg); | |||||
| carla_debug("CarlaBridgeFormat::msgReceived(\"%s\")", msg); | |||||
| if (! fGotOptions && std::strcmp(msg, "urid") != 0 && std::strcmp(msg, "uiOptions") != 0) | if (! fGotOptions && std::strcmp(msg, "urid") != 0 && std::strcmp(msg, "uiOptions") != 0) | ||||
| { | { | ||||
| carla_stderr2("CarlaBridgeUI::msgReceived(\"%s\") - invalid message while waiting for options", msg); | |||||
| carla_stderr2("CarlaBridgeFormat::msgReceived(\"%s\") - invalid message while waiting for options", msg); | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -287,13 +289,13 @@ bool CarlaBridgeUI::msgReceived(const char* const msg) noexcept | |||||
| return true; | return true; | ||||
| } | } | ||||
| carla_stderr("CarlaBridgeUI::msgReceived : %s", msg); | |||||
| carla_stderr("CarlaBridgeFormat::msgReceived : %s", msg); | |||||
| return false; | return false; | ||||
| } | } | ||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| bool CarlaBridgeUI::init(const int argc, const char* argv[]) | |||||
| bool CarlaBridgeFormat::init(const int argc, const char* argv[]) | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fToolkit != nullptr, false); | CARLA_SAFE_ASSERT_RETURN(fToolkit != nullptr, false); | ||||
| @@ -313,7 +315,7 @@ bool CarlaBridgeUI::init(const int argc, const char* argv[]) | |||||
| if (! fGotOptions) | if (! fGotOptions) | ||||
| { | { | ||||
| carla_stderr2("CarlaBridgeUI::init() - did not get options on time, quitting..."); | |||||
| carla_stderr2("CarlaBridgeFormat::init() - did not get options on time, quitting..."); | |||||
| writeExitingMessageAndWait(); | writeExitingMessageAndWait(); | ||||
| closePipeClient(); | closePipeClient(); | ||||
| return false; | return false; | ||||
| @@ -330,7 +332,7 @@ bool CarlaBridgeUI::init(const int argc, const char* argv[]) | |||||
| return true; | return true; | ||||
| } | } | ||||
| void CarlaBridgeUI::exec(const bool showUI) | |||||
| void CarlaBridgeFormat::exec(const bool showUI) | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fToolkit != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fToolkit != nullptr,); | ||||
| @@ -345,7 +347,7 @@ void CarlaBridgeUI::exec(const bool showUI) | |||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| CARLA_BRIDGE_END_NAMESPACE | |||||
| CARLA_BRIDGE_UI_END_NAMESPACE | |||||
| #include "CarlaPipeUtils.cpp" | #include "CarlaPipeUtils.cpp" | ||||
| @@ -0,0 +1,166 @@ | |||||
| /* | |||||
| * Carla Bridge UI | |||||
| * Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com> | |||||
| * | |||||
| * This program is free software; you can redistribute it and/or | |||||
| * modify it under the terms of the GNU General Public License as | |||||
| * published by the Free Software Foundation; either version 2 of | |||||
| * the License, or any later version. | |||||
| * | |||||
| * This program is distributed in the hope that it will be useful, | |||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| * GNU General Public License for more details. | |||||
| * | |||||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||||
| */ | |||||
| #ifndef CARLA_BRIDGE_FORMAT_HPP_INCLUDED | |||||
| #define CARLA_BRIDGE_FORMAT_HPP_INCLUDED | |||||
| #include "CarlaBridgeUI.hpp" | |||||
| #include "CarlaLibUtils.hpp" | |||||
| #include "CarlaPipeUtils.hpp" | |||||
| #include "CarlaString.hpp" | |||||
| #include "lv2/atom.h" | |||||
| #include "lv2/urid.h" | |||||
| CARLA_BRIDGE_UI_START_NAMESPACE | |||||
| /*! | |||||
| * @defgroup CarlaBridgeUIAPI Carla UI Bridge API | |||||
| * | |||||
| * The Carla UI Bridge API. | |||||
| * @{ | |||||
| */ | |||||
| // ----------------------------------------------------------------------- | |||||
| class CarlaBridgeFormat : public CarlaPipeClient | |||||
| { | |||||
| protected: | |||||
| /*! | |||||
| * Constructor. | |||||
| */ | |||||
| CarlaBridgeFormat() noexcept; | |||||
| /*! | |||||
| * Destructor. | |||||
| */ | |||||
| virtual ~CarlaBridgeFormat() /*noexcept*/; | |||||
| // --------------------------------------------------------------------- | |||||
| bool libOpen(const char* const filename) noexcept; | |||||
| void* libSymbol(const char* const symbol) const noexcept; | |||||
| const char* libError() const noexcept; | |||||
| // --------------------------------------------------------------------- | |||||
| // DSP Callbacks | |||||
| virtual void dspParameterChanged(const uint32_t index, const float value) = 0; | |||||
| virtual void dspProgramChanged(const uint32_t index) = 0; | |||||
| virtual void dspMidiProgramChanged(const uint32_t bank, const uint32_t program) = 0; | |||||
| virtual void dspStateChanged(const char* const key, const char* const value) = 0; | |||||
| virtual void dspNoteReceived(const bool onOff, const uint8_t channel, const uint8_t note, const uint8_t velocity) = 0; | |||||
| virtual void dspAtomReceived(const uint32_t index, const LV2_Atom* const atom) = 0; | |||||
| virtual void dspURIDReceived(const LV2_URID urid, const char* const uri) = 0; | |||||
| virtual void uiOptionsChanged(const double sampleRate, const bool useTheme, const bool useThemeColors, const char* const windowTitle, uintptr_t transientWindowId) = 0; | |||||
| public: | |||||
| // --------------------------------------------------------------------- | |||||
| // UI initialization | |||||
| virtual bool init(const int argc, const char* argv[]); | |||||
| virtual void exec(const bool showUI); | |||||
| virtual void idleUI() {} | |||||
| // --------------------------------------------------------------------- | |||||
| // UI management | |||||
| /*! | |||||
| * Get the widget associated with this UI. | |||||
| * This can be a Gtk widget, Qt widget or a native Window handle depending on the compile target. | |||||
| */ | |||||
| virtual void* getWidget() const noexcept = 0; | |||||
| /*! | |||||
| * TESTING | |||||
| */ | |||||
| virtual void uiResized(const uint width, const uint height) = 0; | |||||
| /*! | |||||
| * Options. | |||||
| */ | |||||
| struct Options { | |||||
| /*! | |||||
| * UI is resizable by the user. | |||||
| * The UI can still sometimes resize itself internally if this is false. | |||||
| */ | |||||
| bool isResizable; | |||||
| /*! | |||||
| * Use the Carla PRO theme if possible. | |||||
| */ | |||||
| bool useTheme; | |||||
| /*! | |||||
| * Use the Carla PRO theme colors if possible. | |||||
| * This implies useTheme to be true. | |||||
| */ | |||||
| bool useThemeColors; | |||||
| /*! | |||||
| * Window title. | |||||
| */ | |||||
| CarlaString windowTitle; | |||||
| /*! | |||||
| * Transient window id (parent), zero if unset. | |||||
| */ | |||||
| uintptr_t transientWindowId; | |||||
| /*! | |||||
| * Constructor for default options. | |||||
| */ | |||||
| Options() noexcept | |||||
| : isResizable(true), | |||||
| useTheme(true), | |||||
| useThemeColors(true), | |||||
| windowTitle("TestUI"), | |||||
| transientWindowId(0) {} | |||||
| }; | |||||
| /*! | |||||
| * Get options associated with this UI. | |||||
| */ | |||||
| virtual const Options& getOptions() const noexcept = 0; | |||||
| // --------------------------------------------------------------------- | |||||
| protected: | |||||
| bool fQuitReceived; | |||||
| bool fGotOptions; | |||||
| int fLastMsgTimer; | |||||
| CarlaBridgeToolkit* fToolkit; | |||||
| lib_t fLib; | |||||
| CarlaString fLibFilename; | |||||
| /*! @internal */ | |||||
| bool msgReceived(const char* const msg) noexcept override; | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeFormat) | |||||
| }; | |||||
| /**@}*/ | |||||
| // ----------------------------------------------------------------------- | |||||
| CARLA_BRIDGE_UI_END_NAMESPACE | |||||
| #endif // CARLA_BRIDGE_FORMAT_HPP_INCLUDED | |||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Carla Bridge UI, LV2 version | |||||
| * Carla Bridge UI | |||||
| * Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com> | * Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com> | ||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| @@ -15,7 +15,9 @@ | |||||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | * For a full copy of the GNU General Public License see the doc/GPL.txt file. | ||||
| */ | */ | ||||
| #include "CarlaBridgeUI.hpp" | |||||
| #include "CarlaBridgeFormat.hpp" | |||||
| #include "CarlaBridgeToolkit.hpp" | |||||
| #include "CarlaLibUtils.hpp" | #include "CarlaLibUtils.hpp" | ||||
| #include "CarlaLv2Utils.hpp" | #include "CarlaLv2Utils.hpp" | ||||
| #include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
| @@ -30,7 +32,7 @@ | |||||
| using water::File; | using water::File; | ||||
| CARLA_BRIDGE_START_NAMESPACE | |||||
| CARLA_BRIDGE_UI_START_NAMESPACE | |||||
| // ----------------------------------------------------- | // ----------------------------------------------------- | ||||
| @@ -172,11 +174,11 @@ struct Lv2PluginOptions { | |||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| class CarlaLv2Client : public CarlaBridgeUI | |||||
| class CarlaLv2Client : public CarlaBridgeFormat | |||||
| { | { | ||||
| public: | public: | ||||
| CarlaLv2Client() | CarlaLv2Client() | ||||
| : CarlaBridgeUI(), | |||||
| : CarlaBridgeFormat(), | |||||
| fHandle(nullptr), | fHandle(nullptr), | ||||
| fWidget(nullptr), | fWidget(nullptr), | ||||
| fDescriptor(nullptr), | fDescriptor(nullptr), | ||||
| @@ -410,7 +412,7 @@ public: | |||||
| // ----------------------------------------------------------------- | // ----------------------------------------------------------------- | ||||
| // init UI | // init UI | ||||
| if (! CarlaBridgeUI::init(argc, argv)) | |||||
| if (! CarlaBridgeFormat::init(argc, argv)) | |||||
| return false; | return false; | ||||
| // ----------------------------------------------------------------- | // ----------------------------------------------------------------- | ||||
| @@ -1162,13 +1164,13 @@ private: | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| CARLA_BRIDGE_END_NAMESPACE | |||||
| CARLA_BRIDGE_UI_END_NAMESPACE | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| int main(int argc, const char* argv[]) | int main(int argc, const char* argv[]) | ||||
| { | { | ||||
| CARLA_BRIDGE_USE_NAMESPACE | |||||
| CARLA_BRIDGE_UI_USE_NAMESPACE | |||||
| if (argc < 3) | if (argc < 3) | ||||
| { | { | ||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * Carla Bridge Toolkit | |||||
| * Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com> | |||||
| * Carla Bridge UI | |||||
| * Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -18,10 +18,11 @@ | |||||
| #ifndef CARLA_BRIDGE_TOOLKIT_HPP_INCLUDED | #ifndef CARLA_BRIDGE_TOOLKIT_HPP_INCLUDED | ||||
| #define CARLA_BRIDGE_TOOLKIT_HPP_INCLUDED | #define CARLA_BRIDGE_TOOLKIT_HPP_INCLUDED | ||||
| #include "CarlaBridge.hpp" | |||||
| #include "CarlaString.hpp" | |||||
| #include "CarlaBridgeUI.hpp" | |||||
| CARLA_BRIDGE_START_NAMESPACE | |||||
| #include "CarlaJuceUtils.hpp" | |||||
| CARLA_BRIDGE_UI_START_NAMESPACE | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -43,19 +44,19 @@ public: | |||||
| virtual void* getContainerId() const { return nullptr; } | virtual void* getContainerId() const { return nullptr; } | ||||
| virtual void* getContainerId2() const { return nullptr; } | virtual void* getContainerId2() const { return nullptr; } | ||||
| static CarlaBridgeToolkit* createNew(CarlaBridgeUI* const ui); | |||||
| static CarlaBridgeToolkit* createNew(CarlaBridgeFormat* const format); | |||||
| protected: | protected: | ||||
| CarlaBridgeUI* const fPluginUI; | |||||
| CarlaBridgeFormat* const fPlugin; | |||||
| CarlaBridgeToolkit(CarlaBridgeUI* const u) | |||||
| : fPluginUI(u) {} | |||||
| CarlaBridgeToolkit(CarlaBridgeFormat* const format) | |||||
| : fPlugin(format) {} | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeToolkit) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeToolkit) | ||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| CARLA_BRIDGE_END_NAMESPACE | |||||
| CARLA_BRIDGE_UI_END_NAMESPACE | |||||
| #endif // CARLA_BRIDGE_TOOLKIT_HPP_INCLUDED | #endif // CARLA_BRIDGE_TOOLKIT_HPP_INCLUDED | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Carla Bridge Toolkit, Gtk version | |||||
| * Carla Bridge UI | |||||
| * Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com> | * Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com> | ||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| @@ -15,16 +15,16 @@ | |||||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | * For a full copy of the GNU General Public License see the doc/GPL.txt file. | ||||
| */ | */ | ||||
| #include "CarlaBridgeUI.hpp" | |||||
| #include "CarlaBridgeFormat.hpp" | |||||
| #include "CarlaBridgeToolkit.hpp" | |||||
| #include <gtk/gtk.h> | #include <gtk/gtk.h> | ||||
| #ifdef HAVE_X11 | #ifdef HAVE_X11 | ||||
| # define USE_CUSTOM_X11_METHODS | |||||
| # include <gdk/gdkx.h> | # include <gdk/gdkx.h> | ||||
| #endif | #endif | ||||
| CARLA_BRIDGE_START_NAMESPACE | |||||
| CARLA_BRIDGE_UI_START_NAMESPACE | |||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| @@ -38,8 +38,8 @@ static const bool gHideShowTesting = std::getenv("CARLA_UI_TESTING") != nullptr; | |||||
| class CarlaBridgeToolkitGtk : public CarlaBridgeToolkit | class CarlaBridgeToolkitGtk : public CarlaBridgeToolkit | ||||
| { | { | ||||
| public: | public: | ||||
| CarlaBridgeToolkitGtk(CarlaBridgeUI* const u) | |||||
| : CarlaBridgeToolkit(u), | |||||
| CarlaBridgeToolkitGtk(CarlaBridgeFormat* const format) | |||||
| : CarlaBridgeToolkit(format), | |||||
| fNeedsShow(false), | fNeedsShow(false), | ||||
| fWindow(nullptr), | fWindow(nullptr), | ||||
| fLastX(0), | fLastX(0), | ||||
| @@ -47,7 +47,7 @@ public: | |||||
| fLastWidth(0), | fLastWidth(0), | ||||
| fLastHeight(0) | fLastHeight(0) | ||||
| { | { | ||||
| carla_debug("CarlaBridgeToolkitGtk::CarlaBridgeToolkitGtk(%p)", u); | |||||
| carla_debug("CarlaBridgeToolkitGtk::CarlaBridgeToolkitGtk(%p)", format); | |||||
| } | } | ||||
| ~CarlaBridgeToolkitGtk() override | ~CarlaBridgeToolkitGtk() override | ||||
| @@ -74,16 +74,16 @@ public: | |||||
| void exec(const bool showUI) override | void exec(const bool showUI) override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fPluginUI != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fWindow != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fWindow != nullptr,); | ||||
| carla_debug("CarlaBridgeToolkitGtk::exec(%s)", bool2str(showUI)); | carla_debug("CarlaBridgeToolkitGtk::exec(%s)", bool2str(showUI)); | ||||
| const CarlaBridgeUI::Options& options(fPluginUI->getOptions()); | |||||
| const CarlaBridgeFormat::Options& options(fPlugin->getOptions()); | |||||
| GtkWindow* const gtkWindow(GTK_WINDOW(fWindow)); | GtkWindow* const gtkWindow(GTK_WINDOW(fWindow)); | ||||
| CARLA_SAFE_ASSERT_RETURN(gtkWindow != nullptr,); | CARLA_SAFE_ASSERT_RETURN(gtkWindow != nullptr,); | ||||
| GtkWidget* const widget((GtkWidget*)fPluginUI->getWidget()); | |||||
| GtkWidget* const widget((GtkWidget*)fPlugin->getWidget()); | |||||
| gtk_container_add(GTK_CONTAINER(fWindow), widget); | gtk_container_add(GTK_CONTAINER(fWindow), widget); | ||||
| gtk_window_set_resizable(gtkWindow, options.isResizable); | gtk_window_set_resizable(gtkWindow, options.isResizable); | ||||
| @@ -182,7 +182,7 @@ protected: | |||||
| { | { | ||||
| carla_debug("CarlaBridgeToolkitGtk::handleRealize()"); | carla_debug("CarlaBridgeToolkitGtk::handleRealize()"); | ||||
| const CarlaBridgeUI::Options& options(fPluginUI->getOptions()); | |||||
| const CarlaBridgeFormat::Options& options(fPlugin->getOptions()); | |||||
| if (options.transientWindowId != 0) | if (options.transientWindowId != 0) | ||||
| setTransient(options.transientWindowId); | setTransient(options.transientWindowId); | ||||
| @@ -196,10 +196,10 @@ protected: | |||||
| gtk_window_get_size(GTK_WINDOW(fWindow), &fLastWidth, &fLastHeight); | gtk_window_get_size(GTK_WINDOW(fWindow), &fLastWidth, &fLastHeight); | ||||
| } | } | ||||
| if (fPluginUI->isPipeRunning()) | |||||
| fPluginUI->idlePipe(); | |||||
| if (fPlugin->isPipeRunning()) | |||||
| fPlugin->idlePipe(); | |||||
| fPluginUI->idleUI(); | |||||
| fPlugin->idleUI(); | |||||
| if (gHideShowTesting) | if (gHideShowTesting) | ||||
| { | { | ||||
| @@ -225,7 +225,7 @@ protected: | |||||
| CARLA_SAFE_ASSERT_RETURN(fWindow != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fWindow != nullptr,); | ||||
| carla_debug("CarlaBridgeToolkitGtk::setTransient(0x" P_UINTPTR ")", winId); | carla_debug("CarlaBridgeToolkitGtk::setTransient(0x" P_UINTPTR ")", winId); | ||||
| #ifdef USE_CUSTOM_X11_METHODS | |||||
| #ifdef HAVE_X11 | |||||
| GdkWindow* const gdkWindow(gtk_widget_get_window(fWindow)); | GdkWindow* const gdkWindow(gtk_widget_get_window(fWindow)); | ||||
| CARLA_SAFE_ASSERT_RETURN(gdkWindow != nullptr,); | CARLA_SAFE_ASSERT_RETURN(gdkWindow != nullptr,); | ||||
| @@ -286,11 +286,11 @@ private: | |||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| CarlaBridgeToolkit* CarlaBridgeToolkit::createNew(CarlaBridgeUI* const ui) | |||||
| CarlaBridgeToolkit* CarlaBridgeToolkit::createNew(CarlaBridgeFormat* const format) | |||||
| { | { | ||||
| return new CarlaBridgeToolkitGtk(ui); | |||||
| return new CarlaBridgeToolkitGtk(format); | |||||
| } | } | ||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| CARLA_BRIDGE_END_NAMESPACE | |||||
| CARLA_BRIDGE_UI_END_NAMESPACE | |||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Carla Bridge Toolkit, Plugin version | |||||
| * Carla Bridge UI | |||||
| * Copyright (C) 2014-2017 Filipe Coelho <falktx@falktx.com> | * Copyright (C) 2014-2017 Filipe Coelho <falktx@falktx.com> | ||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| @@ -15,41 +15,42 @@ | |||||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | * For a full copy of the GNU General Public License see the doc/GPL.txt file. | ||||
| */ | */ | ||||
| #include "CarlaBridgeUI.hpp" | |||||
| #include "CarlaBridgeFormat.hpp" | |||||
| #include "CarlaBridgeToolkit.hpp" | #include "CarlaBridgeToolkit.hpp" | ||||
| #include "CarlaMainLoop.hpp" | #include "CarlaMainLoop.hpp" | ||||
| #include "CarlaPluginUI.hpp" | #include "CarlaPluginUI.hpp" | ||||
| CARLA_BRIDGE_START_NAMESPACE | |||||
| CARLA_BRIDGE_UI_START_NAMESPACE | |||||
| using CarlaBackend::runMainLoopOnce; | using CarlaBackend::runMainLoopOnce; | ||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| class CarlaBridgeToolkitPlugin : public CarlaBridgeToolkit, | |||||
| class CarlaBridgeToolkitNative : public CarlaBridgeToolkit, | |||||
| private CarlaPluginUI::Callback | private CarlaPluginUI::Callback | ||||
| { | { | ||||
| public: | public: | ||||
| CarlaBridgeToolkitPlugin(CarlaBridgeUI* const u) | |||||
| : CarlaBridgeToolkit(u), | |||||
| CarlaBridgeToolkitNative(CarlaBridgeFormat* const format) | |||||
| : CarlaBridgeToolkit(format), | |||||
| fHostUI(nullptr), | fHostUI(nullptr), | ||||
| fIdling(false) | fIdling(false) | ||||
| { | { | ||||
| carla_debug("CarlaBridgeToolkitPlugin::CarlaBridgeToolkitPlugin(%p)", u); | |||||
| carla_debug("CarlaBridgeToolkitNative::CarlaBridgeToolkitNative(%p)", format); | |||||
| } | } | ||||
| ~CarlaBridgeToolkitPlugin() override | |||||
| ~CarlaBridgeToolkitNative() override | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fHostUI == nullptr,); | CARLA_SAFE_ASSERT_RETURN(fHostUI == nullptr,); | ||||
| carla_debug("CarlaBridgeToolkitPlugin::~CarlaBridgeToolkitPlugin()"); | |||||
| carla_debug("CarlaBridgeToolkitNative::~CarlaBridgeToolkitNative()"); | |||||
| } | } | ||||
| bool init(const int /*argc*/, const char** /*argv[]*/) override | bool init(const int /*argc*/, const char** /*argv[]*/) override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fHostUI == nullptr, false); | CARLA_SAFE_ASSERT_RETURN(fHostUI == nullptr, false); | ||||
| carla_debug("CarlaBridgeToolkitPlugin::init()"); | |||||
| carla_debug("CarlaBridgeToolkitNative::init()"); | |||||
| const CarlaBridgeUI::Options& options(fPluginUI->getOptions()); | |||||
| const CarlaBridgeFormat::Options& options(fPlugin->getOptions()); | |||||
| #if defined(CARLA_OS_MAC) && defined(BRIDGE_COCOA) | #if defined(CARLA_OS_MAC) && defined(BRIDGE_COCOA) | ||||
| fHostUI = CarlaPluginUI::newCocoa(this, 0, options.isResizable); | fHostUI = CarlaPluginUI::newCocoa(this, 0, options.isResizable); | ||||
| @@ -80,9 +81,9 @@ public: | |||||
| void exec(const bool showUI) override | void exec(const bool showUI) override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fPluginUI != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr,); | ||||
| carla_debug("CarlaBridgeToolkitPlugin::exec(%s)", bool2str(showUI)); | |||||
| carla_debug("CarlaBridgeToolkitNative::exec(%s)", bool2str(showUI)); | |||||
| if (showUI) | if (showUI) | ||||
| fHostUI->show(); | fHostUI->show(); | ||||
| @@ -91,10 +92,10 @@ public: | |||||
| for (; runMainLoopOnce() && fIdling;) | for (; runMainLoopOnce() && fIdling;) | ||||
| { | { | ||||
| if (fPluginUI->isPipeRunning()) | |||||
| fPluginUI->idlePipe(); | |||||
| if (fPlugin->isPipeRunning()) | |||||
| fPlugin->idlePipe(); | |||||
| fPluginUI->idleUI(); | |||||
| fPlugin->idleUI(); | |||||
| fHostUI->idle(); | fHostUI->idle(); | ||||
| #if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | #if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | ||||
| // MacOS and Win32 have event-loops to run, so minimize sleep time | // MacOS and Win32 have event-loops to run, so minimize sleep time | ||||
| @@ -107,7 +108,7 @@ public: | |||||
| void quit() override | void quit() override | ||||
| { | { | ||||
| carla_debug("CarlaBridgeToolkitPlugin::quit()"); | |||||
| carla_debug("CarlaBridgeToolkitNative::quit()"); | |||||
| fIdling = false; | fIdling = false; | ||||
| @@ -122,7 +123,7 @@ public: | |||||
| void show() override | void show() override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr,); | ||||
| carla_debug("CarlaBridgeToolkitPlugin::show()"); | |||||
| carla_debug("CarlaBridgeToolkitNative::show()"); | |||||
| fHostUI->show(); | fHostUI->show(); | ||||
| } | } | ||||
| @@ -130,7 +131,7 @@ public: | |||||
| void focus() override | void focus() override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr,); | ||||
| carla_debug("CarlaBridgeToolkitPlugin::focus()"); | |||||
| carla_debug("CarlaBridgeToolkitNative::focus()"); | |||||
| fHostUI->focus(); | fHostUI->focus(); | ||||
| } | } | ||||
| @@ -138,7 +139,7 @@ public: | |||||
| void hide() override | void hide() override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr,); | ||||
| carla_debug("CarlaBridgeToolkitPlugin::hide()"); | |||||
| carla_debug("CarlaBridgeToolkitNative::hide()"); | |||||
| fHostUI->hide(); | fHostUI->hide(); | ||||
| } | } | ||||
| @@ -148,7 +149,7 @@ public: | |||||
| CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr,); | ||||
| CARLA_SAFE_ASSERT_RETURN(width > 0,); | CARLA_SAFE_ASSERT_RETURN(width > 0,); | ||||
| CARLA_SAFE_ASSERT_RETURN(height > 0,); | CARLA_SAFE_ASSERT_RETURN(height > 0,); | ||||
| carla_debug("CarlaBridgeToolkitPlugin::resize(%i, %i)", width, height); | |||||
| carla_debug("CarlaBridgeToolkitNative::resize(%i, %i)", width, height); | |||||
| fHostUI->setSize(width, height, false); | fHostUI->setSize(width, height, false); | ||||
| } | } | ||||
| @@ -156,7 +157,7 @@ public: | |||||
| void setTitle(const char* const title) override | void setTitle(const char* const title) override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr,); | ||||
| carla_debug("CarlaBridgeToolkitPlugin::setTitle(\"%s\")", title); | |||||
| carla_debug("CarlaBridgeToolkitNative::setTitle(\"%s\")", title); | |||||
| fHostUI->setTitle(title); | fHostUI->setTitle(title); | ||||
| } | } | ||||
| @@ -187,7 +188,7 @@ protected: | |||||
| void handlePluginUIResized(const uint width, const uint height) override | void handlePluginUIResized(const uint width, const uint height) override | ||||
| { | { | ||||
| fPluginUI->uiResized(width, height); | |||||
| fPlugin->uiResized(width, height); | |||||
| } | } | ||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| @@ -196,19 +197,19 @@ private: | |||||
| CarlaPluginUI* fHostUI; | CarlaPluginUI* fHostUI; | ||||
| bool fIdling; | bool fIdling; | ||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeToolkitPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeToolkitNative) | |||||
| }; | }; | ||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| CarlaBridgeToolkit* CarlaBridgeToolkit::createNew(CarlaBridgeUI* const ui) | |||||
| CarlaBridgeToolkit* CarlaBridgeToolkit::createNew(CarlaBridgeFormat* const format) | |||||
| { | { | ||||
| return new CarlaBridgeToolkitPlugin(ui); | |||||
| return new CarlaBridgeToolkitNative(format); | |||||
| } | } | ||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| CARLA_BRIDGE_END_NAMESPACE | |||||
| CARLA_BRIDGE_UI_END_NAMESPACE | |||||
| #include "CarlaPluginUI.cpp" | #include "CarlaPluginUI.cpp" | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Carla Bridge Toolkit, Qt version | |||||
| * Carla Bridge UI | |||||
| * Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com> | * Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com> | ||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| @@ -15,8 +15,9 @@ | |||||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | * For a full copy of the GNU General Public License see the doc/GPL.txt file. | ||||
| */ | */ | ||||
| #include "CarlaBridgeUI.hpp" | |||||
| #include "CarlaBridgeFormat.hpp" | |||||
| #include "CarlaBridgeToolkit.hpp" | #include "CarlaBridgeToolkit.hpp" | ||||
| #include "CarlaStyle.hpp" | #include "CarlaStyle.hpp" | ||||
| #include <QtCore/QTimerEvent> | #include <QtCore/QTimerEvent> | ||||
| @@ -34,7 +35,7 @@ | |||||
| # endif | # endif | ||||
| #endif | #endif | ||||
| CARLA_BRIDGE_START_NAMESPACE | |||||
| CARLA_BRIDGE_UI_START_NAMESPACE | |||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| @@ -56,15 +57,15 @@ class CarlaBridgeToolkitQt: public QObject, | |||||
| #endif | #endif | ||||
| public: | public: | ||||
| CarlaBridgeToolkitQt(CarlaBridgeUI* const u) | |||||
| CarlaBridgeToolkitQt(CarlaBridgeFormat* const format) | |||||
| : QObject(nullptr), | : QObject(nullptr), | ||||
| CarlaBridgeToolkit(u), | |||||
| CarlaBridgeToolkit(format), | |||||
| fApp(nullptr), | fApp(nullptr), | ||||
| fWindow(nullptr), | fWindow(nullptr), | ||||
| fMsgTimer(0), | fMsgTimer(0), | ||||
| fNeedsShow(false) | fNeedsShow(false) | ||||
| { | { | ||||
| carla_debug("CarlaBridgeToolkitQt::CarlaBridgeToolkitQt(%p)", u); | |||||
| carla_debug("CarlaBridgeToolkitQt::CarlaBridgeToolkitQt(%p)", format); | |||||
| } | } | ||||
| ~CarlaBridgeToolkitQt() override | ~CarlaBridgeToolkitQt() override | ||||
| @@ -93,14 +94,14 @@ public: | |||||
| void exec(const bool showUI) override | void exec(const bool showUI) override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fPluginUI != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fApp != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fApp != nullptr,); | ||||
| CARLA_SAFE_ASSERT_RETURN(fWindow != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fWindow != nullptr,); | ||||
| carla_debug("CarlaBridgeToolkitQt::exec(%s)", bool2str(showUI)); | carla_debug("CarlaBridgeToolkitQt::exec(%s)", bool2str(showUI)); | ||||
| const CarlaBridgeUI::Options& options(fPluginUI->getOptions()); | |||||
| const CarlaBridgeFormat::Options& options(fPlugin->getOptions()); | |||||
| QWidget* const widget((QWidget*)fPluginUI->getWidget()); | |||||
| QWidget* const widget((QWidget*)fPlugin->getWidget()); | |||||
| fWindow->setCentralWidget(widget); | fWindow->setCentralWidget(widget); | ||||
| fWindow->adjustSize(); | fWindow->adjustSize(); | ||||
| @@ -119,12 +120,14 @@ public: | |||||
| fWindow->setWindowIcon(QIcon::fromTheme("carla", QIcon(":/scalable/carla.svg"))); | fWindow->setWindowIcon(QIcon::fromTheme("carla", QIcon(":/scalable/carla.svg"))); | ||||
| fWindow->setWindowTitle(options.windowTitle.buffer()); | fWindow->setWindowTitle(options.windowTitle.buffer()); | ||||
| #ifdef USE_CUSTOM_X11_METHODS | |||||
| if (options.transientWindowId != 0) | if (options.transientWindowId != 0) | ||||
| { | { | ||||
| #ifdef USE_CUSTOM_X11_METHODS | |||||
| XSetTransientForHint(QX11Info::display(), static_cast< ::Window>(fWindow->winId()), static_cast< ::Window>(options.transientWindowId)); | |||||
| #endif | |||||
| XSetTransientForHint(QX11Info::display(), | |||||
| static_cast< ::Window>(fWindow->winId()), | |||||
| static_cast< ::Window>(options.transientWindowId)); | |||||
| } | } | ||||
| #endif | |||||
| if (showUI || fNeedsShow) | if (showUI || fNeedsShow) | ||||
| { | { | ||||
| @@ -143,7 +146,7 @@ public: | |||||
| void quit() override | void quit() override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fPluginUI != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fApp != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fApp != nullptr,); | ||||
| CARLA_SAFE_ASSERT_RETURN(fWindow != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fWindow != nullptr,); | ||||
| carla_debug("CarlaBridgeToolkitQt::quit()"); | carla_debug("CarlaBridgeToolkitQt::quit()"); | ||||
| @@ -199,13 +202,13 @@ public: | |||||
| void setSize(const uint width, const uint height) override | void setSize(const uint width, const uint height) override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fPluginUI != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fWindow != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fWindow != nullptr,); | ||||
| CARLA_SAFE_ASSERT_RETURN(width > 0,); | CARLA_SAFE_ASSERT_RETURN(width > 0,); | ||||
| CARLA_SAFE_ASSERT_RETURN(height > 0,); | CARLA_SAFE_ASSERT_RETURN(height > 0,); | ||||
| carla_debug("CarlaBridgeToolkitQt::resize(%i, %i)", width, height); | carla_debug("CarlaBridgeToolkitQt::resize(%i, %i)", width, height); | ||||
| if (fPluginUI->getOptions().isResizable) | |||||
| if (fPlugin->getOptions().isResizable) | |||||
| fWindow->resize(static_cast<int>(width), static_cast<int>(height)); | fWindow->resize(static_cast<int>(width), static_cast<int>(height)); | ||||
| else | else | ||||
| fWindow->setFixedSize(static_cast<int>(width), static_cast<int>(height)); | fWindow->setFixedSize(static_cast<int>(width), static_cast<int>(height)); | ||||
| @@ -229,12 +232,12 @@ protected: | |||||
| void handleTimeout() | void handleTimeout() | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fPluginUI != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | |||||
| if (fPluginUI->isPipeRunning()) | |||||
| fPluginUI->idlePipe(); | |||||
| if (fPlugin->isPipeRunning()) | |||||
| fPlugin->idlePipe(); | |||||
| fPluginUI->idleUI(); | |||||
| fPlugin->idleUI(); | |||||
| } | } | ||||
| private: | private: | ||||
| @@ -259,14 +262,14 @@ private: | |||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| CarlaBridgeToolkit* CarlaBridgeToolkit::createNew(CarlaBridgeUI* const ui) | |||||
| CarlaBridgeToolkit* CarlaBridgeToolkit::createNew(CarlaBridgeFormat* const format) | |||||
| { | { | ||||
| return new CarlaBridgeToolkitQt(ui); | |||||
| return new CarlaBridgeToolkitQt(format); | |||||
| } | } | ||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| CARLA_BRIDGE_END_NAMESPACE | |||||
| CARLA_BRIDGE_UI_END_NAMESPACE | |||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| @@ -18,148 +18,18 @@ | |||||
| #ifndef CARLA_BRIDGE_UI_HPP_INCLUDED | #ifndef CARLA_BRIDGE_UI_HPP_INCLUDED | ||||
| #define CARLA_BRIDGE_UI_HPP_INCLUDED | #define CARLA_BRIDGE_UI_HPP_INCLUDED | ||||
| #include "CarlaBridgeToolkit.hpp" | |||||
| #include "CarlaLibUtils.hpp" | |||||
| #include "CarlaPipeUtils.hpp" | |||||
| #include "CarlaString.hpp" | |||||
| #include "CarlaDefines.h" | |||||
| #include "lv2/atom.h" | |||||
| #include "lv2/urid.h" | |||||
| #define CARLA_BRIDGE_UI_START_NAMESPACE namespace CarlaBridgeUI { | |||||
| #define CARLA_BRIDGE_UI_END_NAMESPACE } | |||||
| #define CARLA_BRIDGE_UI_USE_NAMESPACE using namespace CarlaBridgeUI; | |||||
| CARLA_BRIDGE_START_NAMESPACE | |||||
| CARLA_BRIDGE_UI_START_NAMESPACE | |||||
| /*! | |||||
| * @defgroup CarlaBridgeUIAPI Carla UI Bridge API | |||||
| * | |||||
| * The Carla UI Bridge API. | |||||
| * @{ | |||||
| */ | |||||
| // ----------------------------------------------------------------------- | |||||
| class CarlaBridgeUI : public CarlaPipeClient | |||||
| { | |||||
| protected: | |||||
| /*! | |||||
| * Constructor. | |||||
| */ | |||||
| CarlaBridgeUI() noexcept; | |||||
| /*! | |||||
| * Destructor. | |||||
| */ | |||||
| virtual ~CarlaBridgeUI() /*noexcept*/; | |||||
| // --------------------------------------------------------------------- | |||||
| bool libOpen(const char* const filename) noexcept; | |||||
| void* libSymbol(const char* const symbol) const noexcept; | |||||
| const char* libError() const noexcept; | |||||
| // --------------------------------------------------------------------- | |||||
| // DSP Callbacks | |||||
| virtual void dspParameterChanged(const uint32_t index, const float value) = 0; | |||||
| virtual void dspProgramChanged(const uint32_t index) = 0; | |||||
| virtual void dspMidiProgramChanged(const uint32_t bank, const uint32_t program) = 0; | |||||
| virtual void dspStateChanged(const char* const key, const char* const value) = 0; | |||||
| virtual void dspNoteReceived(const bool onOff, const uint8_t channel, const uint8_t note, const uint8_t velocity) = 0; | |||||
| virtual void dspAtomReceived(const uint32_t index, const LV2_Atom* const atom) = 0; | |||||
| virtual void dspURIDReceived(const LV2_URID urid, const char* const uri) = 0; | |||||
| virtual void uiOptionsChanged(const double sampleRate, const bool useTheme, const bool useThemeColors, const char* const windowTitle, uintptr_t transientWindowId) = 0; | |||||
| public: | |||||
| // --------------------------------------------------------------------- | |||||
| // UI initialization | |||||
| virtual bool init(const int argc, const char* argv[]); | |||||
| virtual void exec(const bool showUI); | |||||
| virtual void idleUI() {} | |||||
| // --------------------------------------------------------------------- | |||||
| // UI management | |||||
| /*! | |||||
| * Get the widget associated with this UI. | |||||
| * This can be a Gtk widget, Qt widget or a native Window handle depending on the compile target. | |||||
| */ | |||||
| virtual void* getWidget() const noexcept = 0; | |||||
| /*! | |||||
| * TESTING | |||||
| */ | |||||
| virtual void uiResized(const uint width, const uint height) = 0; | |||||
| /*! | |||||
| * Options. | |||||
| */ | |||||
| struct Options { | |||||
| /*! | |||||
| * UI is resizable by the user. | |||||
| * The UI can still sometimes resize itself internally if this is false. | |||||
| */ | |||||
| bool isResizable; | |||||
| /*! | |||||
| * Use the Carla PRO theme if possible. | |||||
| */ | |||||
| bool useTheme; | |||||
| /*! | |||||
| * Use the Carla PRO theme colors if possible. | |||||
| * This implies useTheme to be true. | |||||
| */ | |||||
| bool useThemeColors; | |||||
| /*! | |||||
| * Window title. | |||||
| */ | |||||
| CarlaString windowTitle; | |||||
| /*! | |||||
| * Transient window id (parent), null if zero. | |||||
| */ | |||||
| uintptr_t transientWindowId; | |||||
| /*! | |||||
| * Constructor for default options. | |||||
| */ | |||||
| Options() noexcept | |||||
| : isResizable(true), | |||||
| useTheme(true), | |||||
| useThemeColors(true), | |||||
| windowTitle("TestUI"), | |||||
| transientWindowId(0) {} | |||||
| }; | |||||
| /*! | |||||
| * Get options associated with this UI. | |||||
| */ | |||||
| virtual const Options& getOptions() const noexcept = 0; | |||||
| // --------------------------------------------------------------------- | |||||
| protected: | |||||
| bool fQuitReceived; | |||||
| bool fGotOptions; | |||||
| int fLastMsgTimer; | |||||
| CarlaBridgeToolkit* fToolkit; | |||||
| lib_t fLib; | |||||
| CarlaString fLibFilename; | |||||
| /*! @internal */ | |||||
| bool msgReceived(const char* const msg) noexcept override; | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeUI) | |||||
| }; | |||||
| /**@}*/ | |||||
| // ----------------------------------------------------------------------- | |||||
| // forward declarations of common classes | |||||
| class CarlaBridgeFormat; | |||||
| class CarlaBridgeToolkit; | |||||
| CARLA_BRIDGE_END_NAMESPACE | |||||
| CARLA_BRIDGE_UI_END_NAMESPACE | |||||
| #endif // CARLA_BRIDGE_UI_HPP_INCLUDED | #endif // CARLA_BRIDGE_UI_HPP_INCLUDED | ||||
| @@ -8,7 +8,7 @@ CWD=.. | |||||
| MODULENAME=carla-bridge | MODULENAME=carla-bridge | ||||
| include $(CWD)/Makefile.mk | include $(CWD)/Makefile.mk | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| BINDIR := $(CWD)/../bin | BINDIR := $(CWD)/../bin | ||||
| @@ -20,12 +20,12 @@ OBJDIR := $(CWD)/../build/bridges-ui/Release | |||||
| MODULEDIR := $(CWD)/../build/modules/Release | MODULEDIR := $(CWD)/../build/modules/Release | ||||
| endif | endif | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| BUILD_CXX_FLAGS += -DBUILD_BRIDGE -DBUILD_BRIDGE_UI -I. -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/utils -isystem $(CWD)/modules | |||||
| BUILD_CXX_FLAGS += -DBUILD_BRIDGE -DBUILD_BRIDGE_UI -I. -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/utils -I$(CWD)/modules | |||||
| LINK_FLAGS += $(WATER_LIBS) | LINK_FLAGS += $(WATER_LIBS) | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| BUILD_GTK2_FLAGS = $(BUILD_CXX_FLAGS) -DBRIDGE_GTK2 $(shell pkg-config --cflags gtk+-2.0) | BUILD_GTK2_FLAGS = $(BUILD_CXX_FLAGS) -DBRIDGE_GTK2 $(shell pkg-config --cflags gtk+-2.0) | ||||
| LINK_GTK2_FLAGS = $(LINK_FLAGS) $(shell pkg-config --libs gtk+-2.0) $(LIBDL_LIBS) | LINK_GTK2_FLAGS = $(LINK_FLAGS) $(shell pkg-config --libs gtk+-2.0) $(LIBDL_LIBS) | ||||
| @@ -54,7 +54,7 @@ LINK_GTK3_FLAGS += -lX11 | |||||
| LINK_QT4_FLAGS += -lX11 | LINK_QT4_FLAGS += -lX11 | ||||
| endif | endif | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| ifneq ($(MACOS_OR_WIN32),true) | ifneq ($(MACOS_OR_WIN32),true) | ||||
| ifeq ($(HAVE_GTK2),true) | ifeq ($(HAVE_GTK2),true) | ||||
| @@ -86,11 +86,11 @@ ifeq ($(WIN32),true) | |||||
| TARGETS += ui_lv2-windows | TARGETS += ui_lv2-windows | ||||
| endif | endif | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| all: $(TARGETS) | all: $(TARGETS) | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| clean: | clean: | ||||
| rm -f $(OBJDIR)/*.cpp $(OBJDIR)/*.moc $(OBJDIR)/*.o | rm -f $(OBJDIR)/*.cpp $(OBJDIR)/*.moc $(OBJDIR)/*.o | ||||
| @@ -106,7 +106,7 @@ debug: | |||||
| doxygen: carla_bridge.doxygen | doxygen: carla_bridge.doxygen | ||||
| doxygen $< | doxygen $< | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| ui_lv2-gtk2: $(BINDIR)/$(MODULENAME)-lv2-gtk2 | ui_lv2-gtk2: $(BINDIR)/$(MODULENAME)-lv2-gtk2 | ||||
| ui_lv2-gtk3: $(BINDIR)/$(MODULENAME)-lv2-gtk3 | ui_lv2-gtk3: $(BINDIR)/$(MODULENAME)-lv2-gtk3 | ||||
| @@ -116,14 +116,14 @@ ui_lv2-x11: $(BINDIR)/$(MODULENAME)-lv2-x11 | |||||
| ui_lv2-cocoa: $(BINDIR)/$(MODULENAME)-lv2-cocoa | ui_lv2-cocoa: $(BINDIR)/$(MODULENAME)-lv2-cocoa | ||||
| ui_lv2-windows: $(BINDIR)/$(MODULENAME)-lv2-windows.exe | ui_lv2-windows: $(BINDIR)/$(MODULENAME)-lv2-windows.exe | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| # Common libs | # Common libs | ||||
| LIBS = \ | LIBS = \ | ||||
| $(MODULEDIR)/lilv.a \ | $(MODULEDIR)/lilv.a \ | ||||
| $(MODULEDIR)/water.files.a | $(MODULEDIR)/water.files.a | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| # Common objects | # Common objects | ||||
| $(OBJDIR)/%.cpp.o: %.cpp | $(OBJDIR)/%.cpp.o: %.cpp | ||||
| @@ -131,12 +131,12 @@ $(OBJDIR)/%.cpp.o: %.cpp | |||||
| @echo "Compiling $<" | @echo "Compiling $<" | ||||
| @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| # ui_lv2-gtk2 | # ui_lv2-gtk2 | ||||
| OBJS_GTK2 = \ | OBJS_GTK2 = \ | ||||
| $(OBJDIR)/CarlaBridgeUI.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeUI-LV2.cpp-gtk2.o \ | |||||
| $(OBJDIR)/CarlaBridgeFormat.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeFormatLV2.cpp-gtk2.o \ | |||||
| $(OBJDIR)/CarlaBridgeToolkitGtk.cpp-gtk2.o | $(OBJDIR)/CarlaBridgeToolkitGtk.cpp-gtk2.o | ||||
| $(BINDIR)/$(MODULENAME)-lv2-gtk2: $(OBJS_GTK2) $(LIBS) | $(BINDIR)/$(MODULENAME)-lv2-gtk2: $(OBJS_GTK2) $(LIBS) | ||||
| @@ -151,12 +151,12 @@ $(OBJDIR)/%.cpp-gtk2.o: %.cpp | |||||
| -include $(OBJS_GTK2:%.o=%.d) | -include $(OBJS_GTK2:%.o=%.d) | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| # ui_lv2-gtk3 | # ui_lv2-gtk3 | ||||
| OBJS_GTK3 = \ | OBJS_GTK3 = \ | ||||
| $(OBJDIR)/CarlaBridgeUI.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeUI-LV2.cpp-gtk3.o \ | |||||
| $(OBJDIR)/CarlaBridgeFormat.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeFormatLV2.cpp-gtk3.o \ | |||||
| $(OBJDIR)/CarlaBridgeToolkitGtk.cpp-gtk3.o | $(OBJDIR)/CarlaBridgeToolkitGtk.cpp-gtk3.o | ||||
| $(BINDIR)/$(MODULENAME)-lv2-gtk3: $(OBJS_GTK3) $(LIBS) | $(BINDIR)/$(MODULENAME)-lv2-gtk3: $(OBJS_GTK3) $(LIBS) | ||||
| @@ -171,12 +171,12 @@ $(OBJDIR)/%.cpp-gtk3.o: %.cpp | |||||
| -include $(OBJS_GTK3:%.o=%.d) | -include $(OBJS_GTK3:%.o=%.d) | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| # ui_lv2-qt4 | # ui_lv2-qt4 | ||||
| OBJS_QT4 = \ | OBJS_QT4 = \ | ||||
| $(OBJDIR)/CarlaBridgeUI.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeUI-LV2.cpp-qt4.o \ | |||||
| $(OBJDIR)/CarlaBridgeFormat.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeFormatLV2.cpp-qt4.o \ | |||||
| $(OBJDIR)/CarlaBridgeToolkitQt.cpp-qt4.o | $(OBJDIR)/CarlaBridgeToolkitQt.cpp-qt4.o | ||||
| $(BINDIR)/$(MODULENAME)-lv2-qt4: $(OBJS_QT4) $(LIBS) $(MODULEDIR)/theme.qt4.a | $(BINDIR)/$(MODULENAME)-lv2-qt4: $(OBJS_QT4) $(LIBS) $(MODULEDIR)/theme.qt4.a | ||||
| @@ -201,12 +201,12 @@ $(OBJDIR)/resources.qt4.cpp: ../../resources/resources-theme.qrc | |||||
| -include $(OBJS_QT4:%.o=%.d) | -include $(OBJS_QT4:%.o=%.d) | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| # ui_lv2-qt5 | # ui_lv2-qt5 | ||||
| OBJS_QT5 = \ | OBJS_QT5 = \ | ||||
| $(OBJDIR)/CarlaBridgeUI.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeUI-LV2.cpp-qt5.o \ | |||||
| $(OBJDIR)/CarlaBridgeFormat.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeFormatLV2.cpp-qt5.o \ | |||||
| $(OBJDIR)/CarlaBridgeToolkitQt.cpp-qt5.o | $(OBJDIR)/CarlaBridgeToolkitQt.cpp-qt5.o | ||||
| $(BINDIR)/$(MODULENAME)-lv2-qt5: $(OBJS_QT5) $(LIBS) $(MODULEDIR)/theme.qt5.a | $(BINDIR)/$(MODULENAME)-lv2-qt5: $(OBJS_QT5) $(LIBS) $(MODULEDIR)/theme.qt5.a | ||||
| @@ -231,13 +231,13 @@ $(OBJDIR)/resources.qt5.cpp: ../../resources/resources-theme.qrc | |||||
| -include $(OBJS_QT5:%.o=%.d) | -include $(OBJS_QT5:%.o=%.d) | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| # ui_lv2-x11 | # ui_lv2-x11 | ||||
| OBJS_X11 = \ | OBJS_X11 = \ | ||||
| $(OBJDIR)/CarlaBridgeUI.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeUI-LV2.cpp-x11.o \ | |||||
| $(OBJDIR)/CarlaBridgeToolkitPlugin.cpp-x11.o | |||||
| $(OBJDIR)/CarlaBridgeFormat.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeFormatLV2.cpp-x11.o \ | |||||
| $(OBJDIR)/CarlaBridgeToolkitNative.cpp-x11.o | |||||
| $(BINDIR)/$(MODULENAME)-lv2-x11: $(OBJS_X11) $(LIBS) | $(BINDIR)/$(MODULENAME)-lv2-x11: $(OBJS_X11) $(LIBS) | ||||
| -@mkdir -p $(BINDIR) | -@mkdir -p $(BINDIR) | ||||
| @@ -251,13 +251,13 @@ $(OBJDIR)/%.cpp-x11.o: %.cpp | |||||
| -include $(OBJS_X11:%.o=%.d) | -include $(OBJS_X11:%.o=%.d) | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| # ui_lv2-cocoa | # ui_lv2-cocoa | ||||
| OBJS_COCOA = \ | OBJS_COCOA = \ | ||||
| $(OBJDIR)/CarlaBridgeUI.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeUI-LV2.cpp-cocoa.o \ | |||||
| $(OBJDIR)/CarlaBridgeToolkitPlugin.cpp-cocoa.o | |||||
| $(OBJDIR)/CarlaBridgeFormat.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeFormatLV2.cpp-cocoa.o \ | |||||
| $(OBJDIR)/CarlaBridgeToolkitNative.cpp-cocoa.o | |||||
| $(BINDIR)/$(MODULENAME)-lv2-cocoa: $(OBJS_COCOA) $(LIBS) | $(BINDIR)/$(MODULENAME)-lv2-cocoa: $(OBJS_COCOA) $(LIBS) | ||||
| -@mkdir -p $(BINDIR) | -@mkdir -p $(BINDIR) | ||||
| @@ -271,13 +271,13 @@ $(OBJDIR)/%.cpp-cocoa.o: %.cpp | |||||
| -include $(OBJS_COCOA:%.o=%.d) | -include $(OBJS_COCOA:%.o=%.d) | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||
| # ui_lv2-windows | # ui_lv2-windows | ||||
| OBJS_WINDOWS = \ | OBJS_WINDOWS = \ | ||||
| $(OBJDIR)/CarlaBridgeUI.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeUI-LV2.cpp-windows.o \ | |||||
| $(OBJDIR)/CarlaBridgeToolkitPlugin.cpp-windows.o | |||||
| $(OBJDIR)/CarlaBridgeFormat.cpp.o \ | |||||
| $(OBJDIR)/CarlaBridgeFormatLV2.cpp-windows.o \ | |||||
| $(OBJDIR)/CarlaBridgeToolkitNative.cpp-windows.o | |||||
| $(BINDIR)/$(MODULENAME)-lv2-windows.exe: $(OBJS_WINDOWS) $(LIBS) | $(BINDIR)/$(MODULENAME)-lv2-windows.exe: $(OBJS_WINDOWS) $(LIBS) | ||||
| -@mkdir -p $(BINDIR) | -@mkdir -p $(BINDIR) | ||||
| @@ -291,4 +291,4 @@ $(OBJDIR)/%.cpp-windows.o: %.cpp | |||||
| -include $(OBJS_WINDOWS:%.o=%.d) | -include $(OBJS_WINDOWS:%.o=%.d) | ||||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||||
| # --------------------------------------------------------------------------------------------------------------------- | |||||