Skip to content
Snippets Groups Projects
Commit bdec143f authored by jsiegle's avatar jsiegle
Browse files

Enable right-click setting of second merger source

parent 2303f228
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,8 @@
#include "MergerEditor.h"
#include "../Utilities/Merger.h"
#include "../ProcessorGraph.h"
#include "../../UI/EditorViewport.h"
// PipelineSelectorButton::PipelineSelectorButton()
// : DrawableButton ("Selector", DrawableButton::ImageFitted)
......@@ -114,6 +116,55 @@ void MergerEditor::buttonEvent(Button* button)
}
}
void MergerEditor::mouseDown(const MouseEvent& e)
{
if (e.mods.isRightButtonDown())
{
PopupMenu m;
m.addItem(1, "Choose input 2:",false);
Array<GenericProcessor*> availableProcessors = getProcessorGraph()->getListOfProcessors();
for (int i = 0; i < availableProcessors.size(); i++)
{
if (!availableProcessors[i]->isSink() &&
!availableProcessors[i]->isMerger() &&
!availableProcessors[i]->isSplitter() &&
availableProcessors[i]->getDestNode() != getProcessor())
{
String name = String(availableProcessors[i]->getNodeId());
name += " - ";
name += availableProcessors[i]->getName();
m.addItem(i+2, name);
//processorsInList.add(availableProcessors[i]);
}
}
const int result = m.show();
if (result > 1)
{
std::cout << "Selected " << availableProcessors[result-2]->getName() << std::endl;
switchSource(1);
Merger* processor = (Merger*) getProcessor();
processor->setMergerSourceNode(availableProcessors[result-2]);
getEditorViewport()->makeEditorVisible(this, false, true);
}
}
}
void MergerEditor::switchSource(int source)
{
if (source == 0)
......
......@@ -50,6 +50,8 @@ public:
void switchIO(int);
void mouseDown(const MouseEvent& event);
private:
ImageButton* pipelineSelectorA;
......
......@@ -225,7 +225,30 @@ void ProcessorGraph::restoreParameters()
}
Array<GenericProcessor*> ProcessorGraph::getListOfProcessors()
{
Array<GenericProcessor*> a;
for (int i = 0; i < getNumNodes(); i++)
{
Node* node = getNode(i);
int nodeId = node->nodeId;
if (nodeId != OUTPUT_NODE_ID &&
nodeId != AUDIO_NODE_ID &&
nodeId != RECORD_NODE_ID &&
nodeId != RESAMPLING_NODE_ID)
{
GenericProcessor* p =(GenericProcessor*) node->getProcessor();
a.add(p);
}
}
return a;
}
void ProcessorGraph::clearConnections()
{
......
......@@ -83,6 +83,8 @@ public:
void setRecordState(bool);
Array<GenericProcessor*> getListOfProcessors();
private:
int currentNodeId;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment