void PMixInterpolationSpaceLayout::mouseDoubleClick (const MouseEvent& e) { if(graphEditor.getLassoSelection().getNumSelected() == 1) { NodeComponent* selectedItem = dynamic_cast<NodeComponent*>(graphEditor.getLassoSelection().getSelectedItem(0)); if (selectedItem) { AudioProcessor* proc = audioEngine.getDoc().getNodeForId(selectedItem->nodeID)->getProcessor(); bool hasParams = (proc->getNumParameters() > 0); if (hasParams) { if (!InternalPluginFormat::isInternalFormat(proc->getName())) { double x = (double) e.getMouseDownX()/getWidth(); double y = (double) e.getMouseDownY()/getHeight(); audioEngine.getDoc().addPreset(selectedItem->nodeID, x, y); } } } } }
void update (AudioProcessor& audioProcessor, bool forceLegacyParamIDs) { clear(); legacyParamIDs = forceLegacyParamIDs; auto numParameters = audioProcessor.getNumParameters(); usingManagedParameters = (audioProcessor.getParameters().size() == numParameters) && (! legacyParamIDs); for (int i = 0; i < numParameters; ++i) { AudioProcessorParameter* param = usingManagedParameters ? audioProcessor.getParameters()[i] : (legacy.add (new LegacyAudioParameter (audioProcessor, i))); params.add (param); } }
static int getParamIndex (AudioProcessor& processor, AudioProcessorParameter* param) noexcept { if (auto* legacy = dynamic_cast<LegacyAudioParameter*> (param)) { return legacy->parameterIndex; } else { auto n = processor.getNumParameters(); jassert (n == processor.getParameters().size()); for (int i = 0; i < n; ++i) { if (processor.getParameters()[i] == param) return i; } } return -1; }
void PMixInterpolationSpaceLayout::mouseDown (const MouseEvent& e) { selectedItems.deselectAll(); if (e.mods.isPopupMenu()) { if(graphEditor.getLassoSelection().getNumSelected() == 1) { NodeComponent* selectedItem = dynamic_cast<NodeComponent*>(graphEditor.getLassoSelection().getSelectedItem(0)); if (selectedItem) { AudioProcessor* proc = audioEngine.getDoc().getNodeForId(selectedItem->nodeID)->getProcessor(); PopupMenu m; bool hasParams = (proc->getNumParameters() > 0); m.addItem (1, TRANS("Add preset for node"), hasParams); const int r = m.show(); if (r == 1) { if (!InternalPluginFormat::isInternalFormat(proc->getName())) { double x = (double) e.getMouseDownX()/getWidth(); double y = (double) e.getMouseDownY()/getHeight(); audioEngine.getDoc().addPreset(selectedItem->nodeID, x, y); } } } } } else { addChildComponent (lassoComp); lassoComp.beginLasso (e, this); } }