Example #1
0
void GraphViewer::paint(Graphics& g)
{
    g.fillAll(Colours::darkgrey);

    g.setFont(labelFont);
    g.setFont(50);

    g.setColour(Colours::grey);

    JUCEApplication* app = JUCEApplication::getInstance();
    String text = "GUI version ";
    text += app->getApplicationVersion();

    g.drawFittedText("open ephys", 40, 40, getWidth()-50, getHeight()-60, Justification::bottomRight, 100);

    g.setFont(Font("Small Text", 14, Font::plain));
    g.drawFittedText(text, 40, 40, getWidth()-50, getHeight()-45, Justification::bottomRight, 100);

    // draw connections

    for (int i = 0; i < availableNodes.size(); i++)
    {

        if (!availableNodes[i]->isSplitter())
        {
            if (availableNodes[i]->getDest() != nullptr)
            {
                int indexOfDest = indexOfEditor(availableNodes[i]->getDest());

                if (indexOfDest > -1)
                    connectNodes(i, indexOfDest, g);
            }
        }
        else
        {

            Array<GenericEditor*> editors = availableNodes[i]->getConnectedEditors();

            for (int path = 0; path < 2; path++)
            {
                int indexOfDest = indexOfEditor(editors[path]);

                if (indexOfDest > -1)
                    connectNodes(i, indexOfDest, g);
            }


        }

    }
}
Example #2
0
void GraphViewer::removeNode(GenericEditor* editor)
{
    
    availableNodes.remove(indexOfEditor(editor));
    
    updateNodeLocations();

}
Example #3
0
GraphNode* GraphViewer::getNodeForEditor(GenericEditor* editor)
{
    int index = indexOfEditor(editor);

    if (index > -1)
        return availableNodes[index];
    else
        return nullptr;
}