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