Browse Source

Right-click replace plugin option, closes #4

tags/1.9.4
falkTX 11 years ago
parent
commit
f80b75d29b
4 changed files with 37 additions and 10 deletions
  1. +15
    -2
      source/backend/engine/CarlaEngine.cpp
  2. +12
    -3
      source/carla_host.py
  3. +1
    -1
      source/carla_rack.py
  4. +9
    -4
      source/carla_skin.py

+ 15
- 2
source/backend/engine/CarlaEngine.cpp View File

@@ -1197,16 +1197,29 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons

if (oldPlugin != nullptr)
{
bool wasActive = (oldPlugin->getInternalParameterValue(PARAMETER_ACTIVE) >= 0.5f);
float oldDryWet = oldPlugin->getInternalParameterValue(PARAMETER_DRYWET);
float oldVolume = oldPlugin->getInternalParameterValue(PARAMETER_VOLUME);

delete oldPlugin;
callback(ENGINE_CALLBACK_RELOAD_ALL, id, 0, 0, 0.0f, plugin->getName());

if (wasActive)
plugin->setActive(true, true, true);

if (plugin->getHints() & PLUGIN_CAN_DRYWET)
plugin->setDryWet(oldDryWet, true, true);

if (plugin->getHints() & PLUGIN_CAN_VOLUME)
plugin->setVolume(oldVolume, true, true);
}
else
{
++pData->curPluginCount;
callback(ENGINE_CALLBACK_PLUGIN_ADDED, id, 0, 0, 0.0f, plugin->getName());

if (pData->curPluginCount == 1 && pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK)
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED, 0, PATCHBAY_ICON_CARLA, 0, 0.0f, nullptr);
//if (pData->curPluginCount == 1 && pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK)
// callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED, 0, PATCHBAY_ICON_CARLA, 0, 0.0f, nullptr);
}

return true;


+ 12
- 3
source/carla_host.py View File

@@ -891,7 +891,7 @@ class HostWindow(QMainWindow):
# -----------------------------------------------------------------

@pyqtSlot()
def slot_pluginAdd(self):
def slot_pluginAdd(self, pluginToReplace = -1):
dialog = PluginDatabaseW(self)

if not dialog.exec_():
@@ -908,9 +908,18 @@ class HostWindow(QMainWindow):
uniqueId = dialog.fRetPlugin['uniqueId']
extraPtr = self.getExtraPtr(dialog.fRetPlugin)

if not gCarla.host.add_plugin(btype, ptype, filename, None, label, uniqueId, extraPtr):
if pluginToReplace >= 0:
if not gCarla.host.replace_plugin(pluginToReplace):
CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to replace plugin"), gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
return

ok = gCarla.host.add_plugin(btype, ptype, filename, None, label, uniqueId, extraPtr)

if pluginToReplace >= 0:
gCarla.host.replace_plugin(self.fContainer.getPluginCount())

if not ok:
CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to load plugin"), gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
return

@pyqtSlot()
def slot_pluginRemoveAll(self):


+ 1
- 1
source/carla_rack.py View File

@@ -176,7 +176,7 @@ class CarlaRackList(QListWidget):

if tryItem is not None:
gCarla.host.replace_plugin(self.parent().fPluginCount)
tryItem.widget.setActive(True, True, True)
#tryItem.widget.setActive(True, True, True)

def mousePressEvent(self, event):
if self.itemAt(event.pos()) is None:


+ 9
- 4
source/carla_skin.py View File

@@ -63,7 +63,7 @@ class AbstractPluginSlot(QFrame):
# -------------------------------------------------------------
# Internal stuff

self.fIsActive = False
self.fIsActive = bool(gCarla.host.get_internal_parameter_value(self.fPluginId, PARAMETER_ACTIVE) >= 0.5) if gCarla.host is not None else True
self.fIsSelected = False

self.fLastGreenLedState = False
@@ -117,6 +117,7 @@ class AbstractPluginSlot(QFrame):

def ready(self):
if self.b_enable is not None:
self.b_enable.setChecked(self.fIsActive)
self.b_enable.clicked.connect(self.slot_enableClicked)

if self.b_gui is not None:
@@ -481,9 +482,10 @@ class AbstractPluginSlot(QFrame):
actGui = None

menu.addSeparator()
actClone = menu.addAction(self.tr("Clone"))
actRename = menu.addAction(self.tr("Rename..."))
actRemove = menu.addAction(self.tr("Remove"))
actClone = menu.addAction(self.tr("Clone"))
actReplace = menu.addAction(self.tr("Replace..."))
actRename = menu.addAction(self.tr("Rename..."))
actRemove = menu.addAction(self.tr("Remove"))

actSel = menu.exec_(QCursor.pos())

@@ -527,6 +529,9 @@ class AbstractPluginSlot(QFrame):
CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),
gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)

elif actSel == actReplace:
gCarla.gui.slot_pluginAdd(self.fPluginId)

elif actSel == actRemove:
if gCarla.host is not None and not gCarla.host.remove_plugin(self.fPluginId):
CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),


Loading…
Cancel
Save