| @@ -214,7 +214,11 @@ public: | |||||
| if (m_osc.m_server) | if (m_osc.m_server) | ||||
| while (lo_server_recv_noblock(m_osc.m_server, 0) != 0) {} | while (lo_server_recv_noblock(m_osc.m_server, 0) != 0) {} | ||||
| #ifdef BUILD_BRIDGE_UI | |||||
| return ! m_quit; | return ! m_quit; | ||||
| #else | |||||
| return true; | |||||
| #endif | |||||
| } | } | ||||
| void oscClose() | void oscClose() | ||||
| @@ -232,6 +236,24 @@ public: | |||||
| osc_send_update(&m_osc.m_controlData, m_osc.m_serverPath); | osc_send_update(&m_osc.m_controlData, m_osc.m_serverPath); | ||||
| } | } | ||||
| #ifdef BUILD_BRIDGE_PLUGIN | |||||
| void sendOscBridgeError(const char* const error) | |||||
| { | |||||
| qDebug("CarlaClient::sendOscBridgeError(\"%s\")", error); | |||||
| CARLA_ASSERT(m_osc.m_controlData.target); | |||||
| CARLA_ASSERT(error); | |||||
| if (m_osc.m_controlData.target) | |||||
| osc_send_bridge_error(&m_osc.m_controlData, error); | |||||
| } | |||||
| void registerOscEngine(CarlaBackend::CarlaEngine* const engine) | |||||
| { | |||||
| qDebug("CarlaClient::registerOscEngine(%p)", engine); | |||||
| engine->setOscBridgeData(&m_osc.m_controlData); | |||||
| } | |||||
| #endif | |||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| void toolkitShow() | void toolkitShow() | ||||
| @@ -251,21 +273,15 @@ public: | |||||
| void toolkitQuit() | void toolkitQuit() | ||||
| { | { | ||||
| #ifdef BUILD_BRIDGE_UI | |||||
| m_quit = true; | m_quit = true; | ||||
| #endif | |||||
| m_toolkit->quit(); | m_toolkit->quit(); | ||||
| } | } | ||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| protected: | protected: | ||||
| #ifdef BUILD_BRIDGE_PLUGIN | |||||
| void registerOscEngine(CarlaBackend::CarlaEngine* const engine) | |||||
| { | |||||
| qDebug("CarlaClient::registerOscEngine(%p)", engine); | |||||
| engine->setOscBridgeData(m_osc.getControllerData()); | |||||
| } | |||||
| #endif | |||||
| void sendOscConfigure(const char* const key, const char* const value) | void sendOscConfigure(const char* const key, const char* const value) | ||||
| { | { | ||||
| qDebug("CarlaClient::sendOscConfigure(\"%s\", \"%s\")", key, value); | qDebug("CarlaClient::sendOscConfigure(\"%s\", \"%s\")", key, value); | ||||
| @@ -318,21 +334,11 @@ protected: | |||||
| void sendOscBridgeUpdate() | void sendOscBridgeUpdate() | ||||
| { | { | ||||
| qDebug("CarlaClient::sendOscBridgeUpdate()"); | qDebug("CarlaClient::sendOscBridgeUpdate()"); | ||||
| CARLA_ASSERT(m_osc.m_controlData.target && m_serverPath); | |||||
| CARLA_ASSERT(m_osc.m_controlData.target && m_osc.m_serverPath); | |||||
| if (m_osc.m_controlData.target && m_osc.m_serverPath) | if (m_osc.m_controlData.target && m_osc.m_serverPath) | ||||
| osc_send_bridge_update(&m_osc.m_controlData, m_osc.m_serverPath); | osc_send_bridge_update(&m_osc.m_controlData, m_osc.m_serverPath); | ||||
| } | } | ||||
| void sendOscBridgeError(const char* const error) | |||||
| { | |||||
| qDebug("CarlaClient::sendOscBridgeError(\"%s\")", error); | |||||
| CARLA_ASSERT(m_osc.m_controlData.target); | |||||
| CARLA_ASSERT(error); | |||||
| if (m_osc.m_controlData.target) | |||||
| osc_send_bridge_error(&m_osc.m_controlData, error); | |||||
| } | |||||
| #endif | #endif | ||||
| #ifdef BRIDGE_LV2 | #ifdef BRIDGE_LV2 | ||||
| @@ -186,7 +186,7 @@ int CarlaBridgeOsc::handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| if (strcmp(key, CarlaBackend::CARLA_BRIDGE_MSG_SAVE_NOW) == 0) | if (strcmp(key, CarlaBackend::CARLA_BRIDGE_MSG_SAVE_NOW) == 0) | ||||
| { | { | ||||
| client->quequeMessage(MESSAGE_SAVE_NOW, 0, 0, 0.0); | |||||
| client->saveNow(); | |||||
| } | } | ||||
| else if (strcmp(key, CarlaBackend::CARLA_BRIDGE_MSG_SET_CHUNK) == 0) | else if (strcmp(key, CarlaBackend::CARLA_BRIDGE_MSG_SET_CHUNK) == 0) | ||||
| { | { | ||||
| @@ -25,12 +25,11 @@ | |||||
| #include <QtCore/QTextStream> | #include <QtCore/QTextStream> | ||||
| #include <QtCore/QTimerEvent> | #include <QtCore/QTimerEvent> | ||||
| #include <QtGui/QApplication> | #include <QtGui/QApplication> | ||||
| #include <QtGui/QDialog> | |||||
| #include <QtGui/QVBoxLayout> | |||||
| #include <QtGui/QMainWindow> | |||||
| #include <QtGui/QtEvents> | #include <QtGui/QtEvents> | ||||
| #ifdef Q_OS_UNIX | #ifdef Q_OS_UNIX | ||||
| #include <signal.h> | |||||
| # include <signal.h> | |||||
| #endif | #endif | ||||
| static int qargc = 0; | static int qargc = 0; | ||||
| @@ -77,31 +76,11 @@ void initSignalHandler() | |||||
| #endif | #endif | ||||
| } | } | ||||
| #ifdef PTW32_STATIC_LIB | |||||
| #include <pthread.h> | |||||
| class PThreadScopedInitializer | |||||
| { | |||||
| public: | |||||
| PThreadScopedInitializer() | |||||
| { | |||||
| pthread_win32_process_attach_np(); | |||||
| pthread_win32_thread_attach_np(); | |||||
| }; | |||||
| ~PThreadScopedInitializer() | |||||
| { | |||||
| pthread_win32_thread_detach_np(); | |||||
| pthread_win32_process_detach_np(); | |||||
| }; | |||||
| }; | |||||
| #endif | |||||
| CARLA_BRIDGE_START_NAMESPACE | CARLA_BRIDGE_START_NAMESPACE | ||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| class BridgePluginGUI : public QDialog | |||||
| class BridgePluginGUI : public QMainWindow | |||||
| { | { | ||||
| public: | public: | ||||
| class Callback | class Callback | ||||
| @@ -112,7 +91,7 @@ public: | |||||
| }; | }; | ||||
| BridgePluginGUI(QWidget* const parent, Callback* const callback_) | BridgePluginGUI(QWidget* const parent, Callback* const callback_) | ||||
| : QDialog(parent), | |||||
| : QMainWindow(parent), | |||||
| callback(callback_) | callback(callback_) | ||||
| { | { | ||||
| qDebug("BridgePluginGUI::BridgePluginGUI(%p, %p", parent, callback); | qDebug("BridgePluginGUI::BridgePluginGUI(%p, %p", parent, callback); | ||||
| @@ -121,29 +100,18 @@ public: | |||||
| m_firstShow = true; | m_firstShow = true; | ||||
| m_resizable = true; | m_resizable = true; | ||||
| vbLayout = new QVBoxLayout(this); | |||||
| vbLayout->setContentsMargins(0, 0, 0, 0); | |||||
| setLayout(vbLayout); | |||||
| container = new GuiContainer(this); | container = new GuiContainer(this); | ||||
| vbLayout->addWidget(container); | |||||
| setCentralWidget(container); | |||||
| setNewSize(50, 50); | setNewSize(50, 50); | ||||
| #ifdef Q_OS_WIN | |||||
| if (! resizable) | |||||
| setWindowFlags(windowFlags() | Qt::MSWindowsFixedSizeDialogHint); | |||||
| #endif | |||||
| } | } | ||||
| ~BridgePluginGUI() | ~BridgePluginGUI() | ||||
| { | { | ||||
| qDebug("BridgePluginGUI::~BridgePluginGUI()"); | qDebug("BridgePluginGUI::~BridgePluginGUI()"); | ||||
| CARLA_ASSERT(container); | CARLA_ASSERT(container); | ||||
| CARLA_ASSERT(vbLayout); | |||||
| delete container; | delete container; | ||||
| delete vbLayout; | |||||
| } | } | ||||
| GuiContainer* getContainer() | GuiContainer* getContainer() | ||||
| @@ -155,6 +123,11 @@ public: | |||||
| { | { | ||||
| m_resizable = resizable; | m_resizable = resizable; | ||||
| setNewSize(width(), height()); | setNewSize(width(), height()); | ||||
| #ifdef Q_OS_WIN | |||||
| if (! resizable) | |||||
| setWindowFlags(windowFlags() | Qt::MSWindowsFixedSizeDialogHint); | |||||
| #endif | |||||
| } | } | ||||
| void setTitle(const char* title) | void setTitle(const char* title) | ||||
| @@ -200,7 +173,7 @@ public: | |||||
| else | else | ||||
| m_geometry = saveGeometry(); | m_geometry = saveGeometry(); | ||||
| QDialog::setVisible(yesNo); | |||||
| QMainWindow::setVisible(yesNo); | |||||
| } | } | ||||
| protected: | protected: | ||||
| @@ -219,19 +192,12 @@ protected: | |||||
| if (event->spontaneous()) | if (event->spontaneous()) | ||||
| callback->guiClosedCallback(); | callback->guiClosedCallback(); | ||||
| QDialog::closeEvent(event); | |||||
| } | |||||
| void done(int r) | |||||
| { | |||||
| QDialog::done(r); | |||||
| close(); | |||||
| QMainWindow::closeEvent(event); | |||||
| } | } | ||||
| private: | private: | ||||
| Callback* const callback; | Callback* const callback; | ||||
| QVBoxLayout* vbLayout; | |||||
| GuiContainer* container; | GuiContainer* container; | ||||
| bool m_firstShow; | bool m_firstShow; | ||||
| @@ -250,7 +216,7 @@ public: | |||||
| BridgePluginClient() | BridgePluginClient() | ||||
| : CarlaToolkit("carla-bridge-plugin"), | : CarlaToolkit("carla-bridge-plugin"), | ||||
| CarlaClient(this), | CarlaClient(this), | ||||
| QApplication(qargc, qargv) | |||||
| QApplication(qargc, qargv, true) | |||||
| { | { | ||||
| qDebug("BridgePluginClient::BridgePluginClient()"); | qDebug("BridgePluginClient::BridgePluginClient()"); | ||||
| @@ -670,7 +636,7 @@ protected: | |||||
| if (plugin) | if (plugin) | ||||
| plugin->idleGui(); | plugin->idleGui(); | ||||
| if (! CarlaClient::runMessages()) | |||||
| if (! CarlaClient::oscIdle()) | |||||
| { | { | ||||
| CARLA_ASSERT(msgTimer == 0); | CARLA_ASSERT(msgTimer == 0); | ||||
| msgTimer = 0; | msgTimer = 0; | ||||
| @@ -737,10 +703,6 @@ int main(int argc, char* argv[]) | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| #ifdef PTW32_STATIC_LIB | |||||
| PThreadScopedInitializer pthreadScopedInitializer(); | |||||
| #endif | |||||
| // Init bridge client | // Init bridge client | ||||
| CarlaBridge::BridgePluginClient client; | CarlaBridge::BridgePluginClient client; | ||||
| client.init(); | client.init(); | ||||
| @@ -820,7 +782,6 @@ int main(int argc, char* argv[]) | |||||
| if (useOsc) | if (useOsc) | ||||
| { | { | ||||
| // Close OSC | // Close OSC | ||||
| client.sendOscExiting(); | |||||
| client.oscClose(); | client.oscClose(); | ||||
| // bridge client can't be closed manually, only by host | // bridge client can't be closed manually, only by host | ||||
| } | } | ||||
| @@ -34,8 +34,7 @@ LIBS = \ | |||||
| ../../carla-rtmempool/carla_rtmempool.a | ../../carla-rtmempool/carla_rtmempool.a | ||||
| DEFINES = QTCREATOR_TEST | DEFINES = QTCREATOR_TEST | ||||
| DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_GTK2 | |||||
| DEFINES += DEBUG | DEFINES += DEBUG | ||||
| DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_GTK2 | |||||
| QMAKE_CXXFLAGS *= -std=c++0x | QMAKE_CXXFLAGS *= -std=c++0x | ||||
| @@ -34,8 +34,7 @@ LIBS = \ | |||||
| ../../carla-rtmempool/carla_rtmempool.a | ../../carla-rtmempool/carla_rtmempool.a | ||||
| DEFINES = QTCREATOR_TEST | DEFINES = QTCREATOR_TEST | ||||
| DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_GTK3 | |||||
| DEFINES += DEBUG | DEFINES += DEBUG | ||||
| DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_GTK3 | |||||
| QMAKE_CXXFLAGS *= -std=c++0x | QMAKE_CXXFLAGS *= -std=c++0x | ||||
| @@ -33,8 +33,8 @@ LIBS = \ | |||||
| ../../carla-lilv/carla_lilv.a \ | ../../carla-lilv/carla_lilv.a \ | ||||
| ../../carla-rtmempool/carla_rtmempool.a | ../../carla-rtmempool/carla_rtmempool.a | ||||
| DEFINES = DEBUG | |||||
| DEFINES = QTCREATOR_TEST | |||||
| DEFINES += DEBUG | |||||
| DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_QT4 | DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_QT4 | ||||
| DEFINES += QTCREATOR_TEST | |||||
| QMAKE_CXXFLAGS *= -std=c++0x | QMAKE_CXXFLAGS *= -std=c++0x | ||||
| @@ -33,8 +33,8 @@ LIBS = \ | |||||
| ../../carla-lilv/carla_lilv.a \ | ../../carla-lilv/carla_lilv.a \ | ||||
| ../../carla-rtmempool/carla_rtmempool.a | ../../carla-rtmempool/carla_rtmempool.a | ||||
| DEFINES = DEBUG | |||||
| DEFINES = QTCREATOR_TEST | |||||
| DEFINES += DEBUG | |||||
| DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_X11 | DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_X11 | ||||
| DEFINES += QTCREATOR_TEST | |||||
| QMAKE_CXXFLAGS *= -std=c++0x | QMAKE_CXXFLAGS *= -std=c++0x | ||||
| @@ -28,8 +28,8 @@ HEADERS = \ | |||||
| INCLUDEPATH = .. \ | INCLUDEPATH = .. \ | ||||
| ../../carla-includes | ../../carla-includes | ||||
| DEFINES = DEBUG | |||||
| DEFINES = QTCREATOR_TEST | |||||
| DEFINES += DEBUG | |||||
| DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_VST BRIDGE_VST_X11 | DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_VST BRIDGE_VST_X11 | ||||
| DEFINES += QTCREATOR_TEST | |||||
| QMAKE_CXXFLAGS *= -std=c++0x | QMAKE_CXXFLAGS *= -std=c++0x | ||||