Пример #1
0
void ProcessorList::mouseDrag(const MouseEvent& e)
{

	if (e.getMouseDownX() < getWidth() && !(isDragging))
	{

		ProcessorListItem* listItem = getListItemForYPos(e.getMouseDownY());

		if (listItem != 0)
		{

			if (!listItem->hasSubItems())
			{
				isDragging = true;

				String b = listItem->getName();

				const String dragDescription = b;

				//std::cout << dragDescription << std::endl;

				if (dragDescription.isNotEmpty())
				{
					DragAndDropContainer* const dragContainer
						= DragAndDropContainer::findParentDragContainerFor(this);

					if (dragContainer != 0)
					{
						//pos.setSize (pos.getWidth(), 10);

						Image dragImage(Image::ARGB, 100, 15, true);

						Graphics g(dragImage);
						g.setColour(findColour(listItem->colorId));
						g.fillAll();
						g.setColour(Colours::white);
						g.setFont(14);
						g.drawSingleLineText(listItem->getName(),10,12);//,75,15,Justification::centredRight,true);

						dragImage.multiplyAllAlphas(0.6f);

						Point<int> imageOffset(20,10);

						//See ProcessorGraph::createProcesorFromDescription for description info
						Array<var> dragData;
						dragData.add(true);
						dragData.add(dragDescription);
						dragData.add(listItem->processorType);
						dragData.add(listItem->processorId);
						dragData.add(listItem->getParentName());

						dragContainer->startDragging(dragData, this,
								dragImage, true, &imageOffset);
					}
				}
			}
		}
	}

}
Пример #2
0
void ProcessorList::toggleState()
{
    ProcessorListItem* fli = getListItemForYPos(0);
    fli->reverseOpenState();
    AccessClass::getUIComponent()->childComponentChanged();
    repaint();
}
Пример #3
0
void ProcessorList::mouseDrag(const MouseEvent& e) 
{

	if (e.getMouseDownX() < getWidth()-getScrollBarWidth() && !(isDragging))
	{

		ProcessorListItem* fli = getListItemForYPos(e.getMouseDownY());

		if (fli != 0)
		{

			if (!fli->hasSubItems())
			{
				isDragging = true;

				String b = fli->getParentName();
				b += "/";
				b += fli->getName();

				const String dragDescription = b;

				//std::cout << dragDescription << std::endl;

				if (dragDescription.isNotEmpty())
				{
					DragAndDropContainer* const dragContainer
						= DragAndDropContainer::findParentDragContainerFor (this);

					if (dragContainer != 0)
					{
						//pos.setSize (pos.getWidth(), 10);

						Image dragImage (Image::ARGB, 100, 15, true);

						Graphics g(dragImage);
						g.setColour (fli->color);
						g.fillAll();
						g.setColour(Colours::white);
						g.setFont(14);
						g.drawSingleLineText(fli->getName(),10,12);//,75,15,Justification::centredRight,true);

						dragImage.multiplyAllAlphas(0.6f);

						Point<int> imageOffset (20,10);
						dragContainer->startDragging(dragDescription, this,
											         dragImage, true, &imageOffset);
					}
				}
			}
		}
	}

	mouseDragInCanvas(e);
}
Пример #4
0
void ProcessorList::mouseDown(const MouseEvent& e) 
{

	isDragging = false;

	Point<int> pos = e.getPosition();
	int xcoord = pos.getX();
	int ycoord = pos.getY();

	//std::cout << xcoord << " " << ycoord << std::endl;

	ProcessorListItem* fli = getListItemForYPos(ycoord);

	if (fli != 0) 
	{
		//std::cout << "Selecting: " << fli->getName() << std::endl;
		if (!fli->hasSubItems()){
			clearSelectionState();
			fli->setSelected(true);
		}
			
	} else {
		//std::cout << "No selection." << std::endl;
	}

	if (fli != 0) {
		if (xcoord < getWidth() - getScrollBarWidth())
		{
			fli->reverseOpenState();
		}

		if (fli == baseItem)
		{
			if (fli->isOpen()) {
				getUIComponent()->childComponentChanged();
			}
			else
			{
				getUIComponent()->childComponentChanged();
				//setBounds(0,0,225,itemHeight + 2*yBuffer); 
				totalHeight = itemHeight + 2*yBuffer;
			}
			
		}
	}

	mouseDownInCanvas(e);

	repaint();
}
Пример #5
0
ProcessorList::ProcessorList() : isDragging(false),
                           itemHeight(32),
                           subItemHeight(22),
                           totalHeight(800),
                           xBuffer(1),
                           yBuffer(1)
{

	ProcessorListItem* sources = new ProcessorListItem("Sources");
	sources->addSubItem(new ProcessorListItem("Intan Demo Board"));
	sources->addSubItem(new ProcessorListItem("Signal Generator"));
	//sources->addSubItem(new ProcessorListItem("Custom FPGA"));
	//sources->addSubItem(new ProcessorListItem("File Reader"));
	sources->addSubItem(new ProcessorListItem("Event Generator"));

	ProcessorListItem* filters = new ProcessorListItem("Filters");
	filters->addSubItem(new ProcessorListItem("Bandpass Filter"));
	//filters->addSubItem(new ProcessorListItem("Resampler"));
	//filters->addSubItem(new ProcessorListItem("Spike Detector"));

	ProcessorListItem* sinks = new ProcessorListItem("Sinks");
	sinks->addSubItem(new ProcessorListItem("LFP Viewer"));
	//sinks->addSubItem(new ProcessorListItem("Spike Display"));
	sinks->addSubItem(new ProcessorListItem("WiFi Output"));

	//ProcessorListItem* utilities = new ProcessorListItem("Utilities");
	//utilities->addSubItem(new ProcessorListItem("Splitter"));
	//utilities->addSubItem(new ProcessorListItem("Merger"));

	baseItem = new ProcessorListItem("Processors");
	baseItem->addSubItem(sources);
	baseItem->addSubItem(filters);
	baseItem->addSubItem(sinks);
	//baseItem->addSubItem(utilities);

	// set parent names / colors
	baseItem->setParentName("Processors");

	for (int n = 0; n < baseItem->getNumSubItems(); n++)
	{

		const String category = baseItem->getSubItem(n)->getName();
		baseItem->getSubItem(n)->setParentName(category);

			for (int m = 0; m < baseItem->getSubItem(n)->getNumSubItems(); m++)
			{

				baseItem->getSubItem(n)->getSubItem(m)->setParentName(category);// = category;

			}
			
	}

}
Пример #6
0
ProcessorList::ProcessorList()
    : isDragging(false), totalHeight(800), itemHeight(32), subItemHeight(22),
      xBuffer(1), yBuffer(1)
{

    listFontLight = Font("Default Light", 25, Font::plain);
    listFontPlain = Font("Default", 20, Font::plain);

    setColour(PROCESSOR_COLOR, Colour(59, 59, 59));
    setColour(FILTER_COLOR, Colour(0, 174, 239));
    setColour(SINK_COLOR, Colour(0, 166, 81));
    setColour(SOURCE_COLOR, Colour(241, 90, 41));
    setColour(UTILITY_COLOR, Colour(147, 149, 152));

    ProcessorListItem* sources = new ProcessorListItem("Sources");
    //sources->addSubItem(new ProcessorListItem("RHA2000-EVAL"));
    //sources->addSubItem(new ProcessorListItem("Signal Generator"));
    //sources->addSubItem(new ProcessorListItem("Custom FPGA"));
    sources->addSubItem(new ProcessorListItem("Rhythm FPGA"));
#if JUCE_WINDOWS // eCube module currently only available for Windows
#ifdef ECUBE_COMPILE
    sources->addSubItem(new ProcessorListItem("eCube")); // Added by Michael Borisov
#endif
#endif
    sources->addSubItem(new ProcessorListItem("File Reader"));
#ifdef ZEROMQ
    sources->addSubItem(new ProcessorListItem("Network Events"));
#endif
    sources->addSubItem(new ProcessorListItem("Serial Port"));
    //sources->addSubItem(new ProcessorListItem("Event Generator"));

    ProcessorListItem* filters = new ProcessorListItem("Filters");
    filters->addSubItem(new ProcessorListItem("Bandpass Filter"));
    filters->addSubItem(new ProcessorListItem("Spike Detector"));
    filters->addSubItem(new ProcessorListItem("Spike Sorter"));
    //filters->addSubItem(new ProcessorListItem("Resampler"));
    filters->addSubItem(new ProcessorListItem("Phase Detector"));
    //filters->addSubItem(new ProcessorListItem("Digital Ref"));
    filters->addSubItem(new ProcessorListItem("Channel Map"));
    filters->addSubItem(new ProcessorListItem("Common Avg Ref"));
    filters->addSubItem(new ProcessorListItem("Rectifier"));
    //filters->addSubItem(new ProcessorListItem("Eye Tracking"));


    ProcessorListItem* sinks = new ProcessorListItem("Sinks");
    sinks->addSubItem(new ProcessorListItem("LFP Viewer"));
    //sinks->addSubItem(new ProcessorListItem("LFP Trig. Avg."));
    sinks->addSubItem(new ProcessorListItem("Spike Viewer"));
    sinks->addSubItem(new ProcessorListItem("PSTH"));
    //sinks->addSubItem(new ProcessorListItem("Network Sink"));
    //sinks->addSubItem(new ProcessorListItem("WiFi Output"));
    sinks->addSubItem(new ProcessorListItem("Arduino Output"));
    // sinks->addSubItem(new ProcessorListItem("FPGA Output"));
    sinks->addSubItem(new ProcessorListItem("Pulse Pal"));
#ifdef ZEROMQ
    sinks->addSubItem(new ProcessorListItem("Event Broadcaster"));
#endif

    ProcessorListItem* utilities = new ProcessorListItem("Utilities");
    utilities->addSubItem(new ProcessorListItem("Splitter"));
    utilities->addSubItem(new ProcessorListItem("Merger"));
    utilities->addSubItem(new ProcessorListItem("Record Control"));
    //utilities->addSubItem(new ProcessorListItem("Advancers"));

    baseItem = new ProcessorListItem("Processors");
    baseItem->addSubItem(sources);
    baseItem->addSubItem(filters);
    baseItem->addSubItem(sinks);
    baseItem->addSubItem(utilities);

    // set parent names / colors
    baseItem->setParentName("Processors");

    for (int n = 0; n < baseItem->getNumSubItems(); n++)
    {

        const String category = baseItem->getSubItem(n)->getName();
        baseItem->getSubItem(n)->setParentName(category);

        for (int m = 0; m < baseItem->getSubItem(n)->getNumSubItems(); m++)
        {

            baseItem->getSubItem(n)->getSubItem(m)->setParentName(category);// = category;

        }

    }

}
Пример #7
0
void ProcessorList::mouseDown(const MouseEvent& e)
{

    isDragging = false;

    Point<int> pos = e.getPosition();
    int xcoord = pos.getX();
    int ycoord = pos.getY();

    //std::cout << xcoord << " " << ycoord << std::endl;

    ProcessorListItem* listItem = getListItemForYPos(ycoord);

    if (listItem != 0)
    {
        //std::cout << "Selecting: " << fli->getName() << std::endl;
        if (!listItem->hasSubItems())
        {
            clearSelectionState();
            listItem->setSelected(true);
        }

    }
    else
    {
        //std::cout << "No selection." << std::endl;
    }

    if (listItem != 0)
    {
        if (xcoord < getWidth())
        {
            if (e.mods.isRightButtonDown() || e.mods.isCtrlDown())
            {

                if (listItem->getName().equalsIgnoreCase("Sources"))
                {
                    currentColor = SOURCE_COLOR;
                }
                else if (listItem->getName().equalsIgnoreCase("Filters"))
                {
                    currentColor = FILTER_COLOR;
                }
                else if (listItem->getName().equalsIgnoreCase("Utilities"))
                {
                    currentColor = UTILITY_COLOR;
                }
                else if (listItem->getName().equalsIgnoreCase("Sinks"))
                {
                    currentColor = SINK_COLOR;
                }
                else
                {
                    return;
                }

                int options=0;
                options += (0 << 0); // showAlpha
                options += (0 << 1); // showColorAtTop
                options += (0 << 2); // showSliders
                options += (1 << 3); // showColourSpace

                ColourSelector colourSelector(options);
                colourSelector.setName("background");
                colourSelector.setCurrentColour(findColour(currentColor));
                colourSelector.addChangeListener(this);
                colourSelector.addChangeListener(AccessClass::getProcessorGraph());
                colourSelector.setColour(ColourSelector::backgroundColourId, Colours::transparentBlack);
                colourSelector.setSize(300, 275);

                juce::Rectangle<int> rect = juce::Rectangle<int>(0,0,10,10);

                CallOutBox callOut(colourSelector, rect, nullptr);
                callOut.setTopLeftPosition(e.getScreenX(), e.getScreenY());
                callOut.setArrowSize(0.0f);

                callOut.runModalLoop();

            }
            else
            {
                listItem->reverseOpenState();
            }
        }

        if (listItem == baseItem)
        {
            if (listItem->isOpen())
            {
                AccessClass::getUIComponent()->childComponentChanged();
            }
            else
            {
                AccessClass::getUIComponent()->childComponentChanged();
                // totalHeight = itemHeight + 2*yBuffer;
            }

        }
    }

    repaint();
}
Пример #8
0
ProcessorList::ProcessorList() : isDragging(false),
                           itemHeight(32),
                           subItemHeight(22),
                           totalHeight(800),
                           xBuffer(1),
                           yBuffer(1)
{


	setColour(PROCESSOR_COLOR, Colour(59, 59, 59));
	setColour(FILTER_COLOR, Colour(41, 76, 158));//Colour(255, 89, 0));
	setColour(SINK_COLOR, Colour(93, 125, 199));//Colour(255, 149, 0));
	setColour(SOURCE_COLOR, Colour(48, 67, 112)); //Colour(255, 0, 0));
	setColour(UTILITY_COLOR, Colour(90, 80, 80));

	ProcessorListItem* sources = new ProcessorListItem("Sources");
	sources->addSubItem(new ProcessorListItem("Intan Demo Board"));
	sources->addSubItem(new ProcessorListItem("Signal Generator"));
	sources->addSubItem(new ProcessorListItem("Custom FPGA"));
	sources->addSubItem(new ProcessorListItem("File Reader"));
	sources->addSubItem(new ProcessorListItem("Event Generator"));

	ProcessorListItem* filters = new ProcessorListItem("Filters");
	filters->addSubItem(new ProcessorListItem("Bandpass Filter"));
	//filters->addSubItem(new ProcessorListItem("Resampler"));
	filters->addSubItem(new ProcessorListItem("Spike Detector"));

	ProcessorListItem* sinks = new ProcessorListItem("Sinks");
	sinks->addSubItem(new ProcessorListItem("LFP Viewer"));
	sinks->addSubItem(new ProcessorListItem("Spike Viewer"));
	sinks->addSubItem(new ProcessorListItem("WiFi Output"));
	sinks->addSubItem(new ProcessorListItem("Arduino Output"));

	ProcessorListItem* utilities = new ProcessorListItem("Utilities");
	utilities->addSubItem(new ProcessorListItem("Splitter"));
	utilities->addSubItem(new ProcessorListItem("Merger"));

	baseItem = new ProcessorListItem("Processors");
	baseItem->addSubItem(sources);
	baseItem->addSubItem(filters);
	baseItem->addSubItem(sinks);
	baseItem->addSubItem(utilities);

	// set parent names / colors
	baseItem->setParentName("Processors");

	for (int n = 0; n < baseItem->getNumSubItems(); n++)
	{

		const String category = baseItem->getSubItem(n)->getName();
		baseItem->getSubItem(n)->setParentName(category);

			for (int m = 0; m < baseItem->getSubItem(n)->getNumSubItems(); m++)
			{

				baseItem->getSubItem(n)->getSubItem(m)->setParentName(category);// = category;

			}
			
	}

}
Пример #9
0
ProcessorList::ProcessorList()
    : isDragging(false), totalHeight(800), itemHeight(32), subItemHeight(22),
      xBuffer(1), yBuffer(1)
{

    listFontLight = Font("Default Light", 25, Font::plain);
    listFontPlain = Font("Default", 20, Font::plain);

    setColour(PROCESSOR_COLOR, Colour(59, 59, 59));
    setColour(FILTER_COLOR, Colour(0, 174, 239));
    setColour(SINK_COLOR, Colour(0, 166, 81));
    setColour(SOURCE_COLOR, Colour(241, 90, 41));
    setColour(UTILITY_COLOR, Colour(147, 149, 152));

    ProcessorListItem* sources = new ProcessorListItem("Sources");
    //sources->addSubItem(new ProcessorListItem("RHA2000-EVAL"));
    //sources->addSubItem(new ProcessorListItem("Signal Generator"));
    //sources->addSubItem(new ProcessorListItem("Custom FPGA"));
    sources->addSubItem(new ProcessorListItem("Rhythm FPGA"));
    sources->addSubItem(new ProcessorListItem("File Reader"));
    //sources->addSubItem(new ProcessorListItem("Event Generator"));

    ProcessorListItem* filters = new ProcessorListItem("Filters");
    filters->addSubItem(new ProcessorListItem("Bandpass Filter"));
    //filters->addSubItem(new ProcessorListItem("Event Detector"));
    filters->addSubItem(new ProcessorListItem("Spike Detector"));
    //filters->addSubItem(new ProcessorListItem("Resampler"));
    filters->addSubItem(new ProcessorListItem("Phase Detector"));
    //filters->addSubItem(new ProcessorListItem("Digital Ref"));
    filters->addSubItem(new ProcessorListItem("Channel Map"));

    ProcessorListItem* sinks = new ProcessorListItem("Sinks");
    sinks->addSubItem(new ProcessorListItem("LFP Viewer"));
    //sinks->addSubItem(new ProcessorListItem("LFP Trig. Avg."));
    sinks->addSubItem(new ProcessorListItem("Spike Viewer"));
    //sinks->addSubItem(new ProcessorListItem("WiFi Output"));
    //sinks->addSubItem(new ProcessorListItem("Arduino Output"));
    // sinks->addSubItem(new ProcessorListItem("FPGA Output"));
    sinks->addSubItem(new ProcessorListItem("Pulse Pal"));

    ProcessorListItem* utilities = new ProcessorListItem("Utilities");
    utilities->addSubItem(new ProcessorListItem("Splitter"));
    utilities->addSubItem(new ProcessorListItem("Merger"));
    utilities->addSubItem(new ProcessorListItem("Record Control"));

    baseItem = new ProcessorListItem("Processors");
    baseItem->addSubItem(sources);
    baseItem->addSubItem(filters);
    baseItem->addSubItem(sinks);
    baseItem->addSubItem(utilities);

    // set parent names / colors
    baseItem->setParentName("Processors");

    for (int n = 0; n < baseItem->getNumSubItems(); n++)
    {

        const String category = baseItem->getSubItem(n)->getName();
        baseItem->getSubItem(n)->setParentName(category);

        for (int m = 0; m < baseItem->getSubItem(n)->getNumSubItems(); m++)
        {

            baseItem->getSubItem(n)->getSubItem(m)->setParentName(category);// = category;

        }

    }

}