diff --git a/resources/ui/carla_plugin_calf.ui b/resources/ui/carla_plugin_calf.ui index 9a362aa2c..625e08c47 100644 --- a/resources/ui/carla_plugin_calf.ui +++ b/resources/ui/carla_plugin_calf.ui @@ -344,6 +344,12 @@ + + + 0 + 0 + + 2 diff --git a/resources/ui/carla_plugin_default.ui b/resources/ui/carla_plugin_default.ui index c22a0a2ce..641fa7b18 100644 --- a/resources/ui/carla_plugin_default.ui +++ b/resources/ui/carla_plugin_default.ui @@ -114,7 +114,7 @@ - + :/bitmaps/button_gui.png:/bitmaps/button_gui.png @@ -149,7 +149,7 @@ - + :/bitmaps/button_edit.png:/bitmaps/button_edit.png @@ -426,6 +426,12 @@ + + + 0 + 0 + + 0 @@ -449,7 +455,19 @@ - + + 0 + + + 12 + + + 0 + + + 0 + + 0 diff --git a/resources/ui/carla_plugin_presets.ui b/resources/ui/carla_plugin_presets.ui index 7f88570cd..db3017f85 100644 --- a/resources/ui/carla_plugin_presets.ui +++ b/resources/ui/carla_plugin_presets.ui @@ -111,7 +111,7 @@ - + :/bitmaps/button_gui.png:/bitmaps/button_gui.png @@ -146,7 +146,7 @@ - + :/bitmaps/button_edit.png:/bitmaps/button_edit.png @@ -431,7 +431,19 @@ - + + 0 + + + 12 + + + 0 + + + 0 + + 0 diff --git a/source/frontend/carla_skin.py b/source/frontend/carla_skin.py index d44bcd02f..51fa0fe3f 100644 --- a/source/frontend/carla_skin.py +++ b/source/frontend/carla_skin.py @@ -242,6 +242,8 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta): if self.fPeaksOutputCount > 2: self.fPeaksOutputCount = 2 + self.fAdjustViewableKnobCountScheduled = False + # used during testing self.fIdleTimerId = 0 @@ -557,14 +559,11 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta): if self.w_knobs_left is not None: parameterCount = self.host.get_parameter_count(self.fPluginId) - if "calf" in self.fSkinStyle: - maxWidgets = 7 - else: - maxWidgets = 8 - index = 0 + layout = self.w_knobs_left.layout() for i in range(parameterCount): - if index >= maxWidgets: + # 50 should be enough for everybody, right? + if index >= 50: break paramInfo = self.host.get_parameter_info(self.fPluginId, i) @@ -600,7 +599,7 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta): index += 1 self.fParameterList.append([i, widget]) - self.w_knobs_left.layout().addWidget(widget) + layout.addWidget(widget) if self.w_knobs_right is not None and (self.fPluginInfo['hints'] & PLUGIN_CAN_DRYWET) != 0: widget = PixmapDial(self, PARAMETER_DRYWET) @@ -629,11 +628,17 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta): paramWidget.blockSignals(True) paramWidget.setValue(self.host.get_internal_parameter_value(self.fPluginId, paramIndex)) paramWidget.blockSignals(False) + if paramIndex >= 0: + paramWidget.hide() # ------------------------------------------------------------- self.setWindowTitle(self.fPluginInfo['name']) + if not self.fAdjustViewableKnobCountScheduled: + self.fAdjustViewableKnobCountScheduled = True + QTimer.singleShot(1, self.adjustViewableKnobCount) + #------------------------------------------------------------------ def getFixedHeight(self): @@ -1377,6 +1382,35 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta): #------------------------------------------------------------------ + def adjustViewableKnobCount(self): + # FIXME Object already destroyed, but timer still kicked in + if self is None: + return + + self.fAdjustViewableKnobCountScheduled = False + + if self.w_knobs_left is None: + return + + for index, widget in self.fParameterList: + if index < 0 or not widget.isVisible(): + break + widget.hide() + + prevWidth = 0 + for index, widget in self.fParameterList: + if index < 0: + break + + widget.show() + newWidth = self.w_knobs_left.width() + + if newWidth == prevWidth: + widget.hide() + break + + prevWidth = newWidth + def testTimer(self): self.fIdleTimerId = self.startTimer(25) @@ -1397,6 +1431,12 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta): QFrame.closeEvent(self, event) + def resizeEvent(self, event): + if not self.fAdjustViewableKnobCountScheduled: + self.fAdjustViewableKnobCountScheduled = True + QTimer.singleShot(100, self.adjustViewableKnobCount) + QFrame.resizeEvent(self, event) + def timerEvent(self, event): if event.timerId() == self.fIdleTimerId: self.host.engine_idle()