From f6a4fab7e227dffb31c58bbbc6736fd5416edeeb Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 6 Feb 2014 21:07:05 +0000 Subject: [PATCH] Don't allow to add in/outs in juce-patchbay --- .../native-plugins/juce-host/FilterGraph.cpp | 17 +++++++++++++++++ .../native-plugins/juce-host/FilterGraph.h | 1 + .../juce-host/GraphEditorPanel.cpp | 6 ------ .../native-plugins/juce-host/MainHostWindow.cpp | 13 +------------ .../native-plugins/juce-host/MainHostWindow.h | 1 - 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/source/modules/native-plugins/juce-host/FilterGraph.cpp b/source/modules/native-plugins/juce-host/FilterGraph.cpp index c7c6330e1..55fda29f7 100644 --- a/source/modules/native-plugins/juce-host/FilterGraph.cpp +++ b/source/modules/native-plugins/juce-host/FilterGraph.cpp @@ -214,6 +214,23 @@ void FilterGraph::clear() changed(); } +void FilterGraph::clearKeepingInternals() +{ + if (panel != nullptr) + panel->closeAllCurrentlyOpenWindows(); + + graph.clear(); + + InternalPluginFormat internalFormat; + + addFilter (internalFormat.getDescriptionFor (InternalPluginFormat::audioInputFilter), 0.5f, 0.1f); + addFilter (internalFormat.getDescriptionFor (InternalPluginFormat::midiInputFilter), 0.25f, 0.1f); + addFilter (internalFormat.getDescriptionFor (InternalPluginFormat::audioOutputFilter), 0.5f, 0.9f); + addFilter (internalFormat.getDescriptionFor (InternalPluginFormat::midiOutputFilter), 0.25f, 0.9f); + + changed(); +} + //============================================================================== String FilterGraph::getDocumentTitle() { diff --git a/source/modules/native-plugins/juce-host/FilterGraph.h b/source/modules/native-plugins/juce-host/FilterGraph.h index 15897ef63..5a8f5d3e6 100644 --- a/source/modules/native-plugins/juce-host/FilterGraph.h +++ b/source/modules/native-plugins/juce-host/FilterGraph.h @@ -81,6 +81,7 @@ public: uint32 destFilterUID, int destFilterChannel); void clear(); + void clearKeepingInternals(); //============================================================================== diff --git a/source/modules/native-plugins/juce-host/GraphEditorPanel.cpp b/source/modules/native-plugins/juce-host/GraphEditorPanel.cpp index 7e5ce058b..997b25649 100644 --- a/source/modules/native-plugins/juce-host/GraphEditorPanel.cpp +++ b/source/modules/native-plugins/juce-host/GraphEditorPanel.cpp @@ -1084,9 +1084,6 @@ GraphDocumentComponent::GraphDocumentComponent (FilterGraph& g) { addAndMakeVisible (graphPanel = new GraphEditorPanel (graph)); - // listen for audio/midi count change - //deviceManager->addChangeListener (graphPanel); - //keyState.addListener (&graphPlayer.getMidiMessageCollector()); addAndMakeVisible (keyboardComp = new MidiKeyboardComponent (keyState, @@ -1103,9 +1100,6 @@ GraphDocumentComponent::~GraphDocumentComponent() { graph.setPanel(nullptr); - // listen for audio/midi count change - //deviceManager->removeChangeListener (graphPanel); - deleteAllChildren(); //keyState.removeListener (&graphPlayer.getMidiMessageCollector()); diff --git a/source/modules/native-plugins/juce-host/MainHostWindow.cpp b/source/modules/native-plugins/juce-host/MainHostWindow.cpp index d527669cb..8331c734e 100644 --- a/source/modules/native-plugins/juce-host/MainHostWindow.cpp +++ b/source/modules/native-plugins/juce-host/MainHostWindow.cpp @@ -92,9 +92,6 @@ MainHostWindow::MainHostWindow (AudioPluginFormatManager& fm, FilterGraph& graph setVisible (true); - InternalPluginFormat internalFormat; - internalFormat.getAllTypes (internalTypes); - ScopedPointer savedPluginList (appProperties.getUserSettings()->getXmlValue ("pluginList")); if (savedPluginList != nullptr) @@ -222,7 +219,7 @@ void MainHostWindow::menuItemSelected (int menuItemID, int /*topLevelMenuIndex*/ if (menuItemID == 250) { if (graphEditor != nullptr) - graphEditor->graph.clear(); + graphEditor->graph.clearKeepingInternals(); } else if (menuItemID >= 100 && menuItemID < 200) { @@ -263,19 +260,11 @@ void MainHostWindow::createPlugin (const PluginDescription* desc, int x, int y) void MainHostWindow::addPluginsToMenu (PopupMenu& m) const { - for (int i = 0; i < internalTypes.size(); ++i) - m.addItem (i + 1, internalTypes.getUnchecked(i)->name); - - m.addSeparator(); - knownPluginList.addToMenu (m, pluginSortMethod); } const PluginDescription* MainHostWindow::getChosenType (const int menuID) const { - if (menuID >= 1 && menuID < 1 + internalTypes.size()) - return internalTypes [menuID - 1]; - return knownPluginList.getType (knownPluginList.getIndexChosenByMenu (menuID)); } diff --git a/source/modules/native-plugins/juce-host/MainHostWindow.h b/source/modules/native-plugins/juce-host/MainHostWindow.h index bcb31fa64..c98a3c5bd 100644 --- a/source/modules/native-plugins/juce-host/MainHostWindow.h +++ b/source/modules/native-plugins/juce-host/MainHostWindow.h @@ -83,7 +83,6 @@ private: //============================================================================== AudioPluginFormatManager& formatManager; - OwnedArray internalTypes; KnownPluginList knownPluginList; KnownPluginList::SortMethod pluginSortMethod;