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); }
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(); }
void LfpDisplayCanvas::mouseDown(const MouseEvent& e) { Point<int> pos = e.getPosition(); int xcoord = pos.getX(); if (xcoord < getWidth()-getScrollBarWidth()) { int chan = (e.getMouseDownY() + getScrollAmount())/(yBuffer+plotHeight); selectedChan = chan; repaint(); } mouseDownInCanvas(e); }
void LfpDisplayCanvas::mouseDownInCanvas(const MouseEvent& e) { Point<int> pos = e.getPosition(); int xcoord = pos.getX(); int ycoord = pos.getY(); if (xcoord < getWidth()-getScrollBarWidth() && ycoord > headerHeight) { int ycoord = e.getMouseDownY() - headerHeight - interplotDistance/2;// - interplotDistance/2;// - interplotDistance; int chan = (ycoord + getScrollAmount())/(yBuffer+interplotDistance); selectedChan = chan; repaint(); } }
void ProcessorList::mouseDownInCanvas(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()) { if (e.mods.isRightButtonDown() || e.mods.isCtrlDown()) { if (fli->getName().equalsIgnoreCase("Sources")) { currentColor = SOURCE_COLOR; } else if (fli->getName().equalsIgnoreCase("Filters")) { currentColor = FILTER_COLOR; } else if (fli->getName().equalsIgnoreCase("Utilities")) { currentColor = UTILITY_COLOR; } else if (fli->getName().equalsIgnoreCase("Sinks")) { currentColor = SINK_COLOR; } else { return; } int options; 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 (getProcessorGraph()); colourSelector.setColour (ColourSelector::backgroundColourId, Colours::transparentBlack); colourSelector.setSize (300, 275); CallOutBox callOut (colourSelector, *fli, 0);//*this, 0); callOut.setTopLeftPosition (e.getScreenX(), e.getScreenY()); callOut.setArrowSize(0.0f); callOut.runModalLoop(); } else { fli->reverseOpenState(); } } if (fli == baseItem) { if (fli->isOpen()) { getUIComponent()->childComponentChanged(); } else { getUIComponent()->childComponentChanged(); totalHeight = itemHeight + 2*yBuffer; } } } repaint(); }