diff --git a/source/frontend/CarlaFrontend.h b/source/frontend/CarlaFrontend.h index b0800f92a..0b2221901 100644 --- a/source/frontend/CarlaFrontend.h +++ b/source/frontend/CarlaFrontend.h @@ -51,6 +51,8 @@ typedef struct { uint parameterOuts; } PluginListDialogResults; +struct PluginListDialog; + // -------------------------------------------------------------------------------------------------------------------- CARLA_API void @@ -59,6 +61,12 @@ carla_frontend_createAndExecAboutJuceDialog(void* parent); CARLA_API const JackAppDialogResults* carla_frontend_createAndExecJackAppDialog(void* parent, const char* projectFilename); +CARLA_API PluginListDialog* +carla_frontend_createPluginListDialog(void* parent); + +CARLA_API const PluginListDialogResults* +carla_frontend_execPluginListDialog(PluginListDialog* dialog); + CARLA_API const PluginListDialogResults* carla_frontend_createAndExecPluginListDialog(void* parent/*, const HostSettings& hostSettings*/); diff --git a/source/frontend/carla_frontend.py b/source/frontend/carla_frontend.py index c54dc3176..6d9381a8d 100644 --- a/source/frontend/carla_frontend.py +++ b/source/frontend/carla_frontend.py @@ -87,7 +87,13 @@ class CarlaFrontendLib(): self.lib.carla_frontend_createAndExecJackAppDialog.argtypes = (c_void_p, c_char_p) self.lib.carla_frontend_createAndExecJackAppDialog.restype = POINTER(JackApplicationDialogResults) - self.lib.carla_frontend_createAndExecPluginListDialog.argtypes = (c_void_p,) # , c_bool) + self.lib.carla_frontend_createPluginListDialog.argtypes = (c_void_p,) + self.lib.carla_frontend_createPluginListDialog.restype = c_void_p + + self.lib.carla_frontend_execPluginListDialog.argtypes = (c_void_p,) + self.lib.carla_frontend_execPluginListDialog.restype = POINTER(PluginListDialogResults) + + self.lib.carla_frontend_createAndExecPluginListDialog.argtypes = (c_void_p,) self.lib.carla_frontend_createAndExecPluginListDialog.restype = POINTER(PluginListDialogResults) # -------------------------------------------------------------------------------------------------------- @@ -99,6 +105,12 @@ class CarlaFrontendLib(): return structToDictOrNull(self.lib.carla_frontend_createAndExecJackAppDialog(unwrapinstance(parent), projectFilename.encode("utf-8"))) + def createPluginListDialog(self, parent, useSystemIcons): + return self.lib.carla_frontend_createPluginListDialog(unwrapinstance(parent)) + + def execPluginListDialog(self, dialog): + return structToDictOrNull(self.lib.carla_frontend_execPluginListDialog(dialog)) + def createAndExecPluginListDialog(self, parent, useSystemIcons): return structToDictOrNull(self.lib.carla_frontend_createAndExecPluginListDialog(unwrapinstance(parent))) diff --git a/source/frontend/carla_host.py b/source/frontend/carla_host.py index 36f716796..b6bdd2b8b 100644 --- a/source/frontend/carla_host.py +++ b/source/frontend/carla_host.py @@ -161,7 +161,7 @@ class HostWindow(QMainWindow): self.fPluginCount = 0 self.fPluginList = [] - self.fPluginDatabaseDialog = None + self.fPluginListDialog = None self.fFavoritePlugins = [] self.fProjectFilename = "" @@ -1208,8 +1208,10 @@ class HostWindow(QMainWindow): def showAddPluginDialog(self): # TODO self.fHasLoadedLv2Plugins - ret = gCarla.felib.createAndExecPluginListDialog(self.fParentOrSelf, - self.fSavedSettings[CARLA_KEY_MAIN_SYSTEM_ICONS]) + if self.fPluginListDialog is None: + self.fPluginListDialog = gCarla.felib.createPluginListDialog(self.fParentOrSelf, + self.fSavedSettings[CARLA_KEY_MAIN_SYSTEM_ICONS]) + ret = gCarla.felib.execPluginListDialog(self.fPluginListDialog) print(ret) # TODO diff --git a/source/frontend/pluginlist/pluginlistdialog.cpp b/source/frontend/pluginlist/pluginlistdialog.cpp index 52bad48b6..8b24667e5 100644 --- a/source/frontend/pluginlist/pluginlistdialog.cpp +++ b/source/frontend/pluginlist/pluginlistdialog.cpp @@ -1901,13 +1901,17 @@ void PluginListDialog::saveSettings() // -------------------------------------------------------------------------------------------------------------------- -const PluginListDialogResults* -carla_frontend_createAndExecPluginListDialog(void* const parent/*, const HostSettings& hostSettings*/) +PluginListDialog* +carla_frontend_createPluginListDialog(void* const parent) { const HostSettings hostSettings = {}; - PluginListDialog gui(reinterpret_cast(parent), hostSettings); + return new PluginListDialog(reinterpret_cast(parent), hostSettings); +} - if (gui.exec()) +const PluginListDialogResults* +carla_frontend_execPluginListDialog(PluginListDialog* const dialog) +{ + if (dialog->exec()) { static PluginListDialogResults ret; static CarlaString category; @@ -1916,7 +1920,7 @@ carla_frontend_createAndExecPluginListDialog(void* const parent/*, const HostSet static CarlaString label; static CarlaString maker; - const PluginInfo& plugin(gui.getSelectedPluginInfo()); + const PluginInfo& plugin(dialog->getSelectedPluginInfo()); category = plugin.category.toUtf8(); filename = plugin.filename.toUtf8(); @@ -1949,3 +1953,14 @@ carla_frontend_createAndExecPluginListDialog(void* const parent/*, const HostSet } // -------------------------------------------------------------------------------------------------------------------- + +const PluginListDialogResults* +carla_frontend_createAndExecPluginListDialog(void* const parent/*, const HostSettings& hostSettings*/) +{ + const HostSettings hostSettings = {}; + PluginListDialog gui(reinterpret_cast(parent), hostSettings); + + return carla_frontend_execPluginListDialog(&gui); +} + +// --------------------------------------------------------------------------------------------------------------------