//==============================================================================
void VstPluginExternalEditor::mouseWheelMove (const MouseEvent& e,
                                              float incrementX,
                                              float incrementY)
{
#if defined(LINUX)
    if (! handle) return;

    XEvent ev;
    zerostruct (ev);
    ev.xbutton.display = display;
    ev.xbutton.type = ButtonPress;
    ev.xbutton.window = handle;
    ev.xbutton.root = RootWindow (display, DefaultScreen (display));
    ev.xbutton.time = CurrentTime;
    ev.xbutton.x = e.x;
    ev.xbutton.y = e.y;
    ev.xbutton.x_root = e.getScreenX ();
    ev.xbutton.y_root = e.getScreenY ();

    translateJuceToXMouseWheelModifiers (e, incrementY, ev);

    sendEventToChild (& ev);

    // TODO - put a usleep here ?

    ev.xbutton.type = ButtonRelease;
    sendEventToChild (& ev);
#endif
}
//==============================================================================
void VstPluginExternalEditor::mouseExit (const MouseEvent& e)
{
#if defined(LINUX)
    if (! handle) return;

    XEvent ev;
    zerostruct (ev);
    ev.xcrossing.display = display;
    ev.xcrossing.type = LeaveNotify;
    ev.xcrossing.window = handle;
    ev.xcrossing.root = RootWindow (display, DefaultScreen (display));
    ev.xcrossing.time = CurrentTime;
    ev.xcrossing.x = e.x;
    ev.xcrossing.y = e.y;
    ev.xcrossing.x_root = e.getScreenX ();
    ev.xcrossing.y_root = e.getScreenY ();
    ev.xcrossing.mode = NotifyNormal; // NotifyGrab, NotifyUngrab
    ev.xcrossing.detail = NotifyAncestor; // NotifyVirtual, NotifyInferior, NotifyNonlinear,NotifyNonlinearVirtual
    ev.xcrossing.focus = hasKeyboardFocus (true); // TODO - yes ?

    translateJuceToXCrossingModifiers (e, ev);

    sendEventToChild (& ev);
#endif
}
//==============================================================================
void VstPluginExternalEditor::mouseMove (const MouseEvent& e)
{
#if defined(LINUX)
    if (! handle) return;

    XEvent ev;
    zerostruct (ev);
    ev.xmotion.display = display;
    ev.xmotion.type = MotionNotify;
    ev.xmotion.window = handle;
    ev.xmotion.root = RootWindow (display, DefaultScreen (display));
    ev.xmotion.time = CurrentTime;
    ev.xmotion.is_hint = NotifyNormal;
    ev.xmotion.x = e.x;
    ev.xmotion.y = e.y;
    ev.xmotion.x_root = e.getScreenX ();
    ev.xmotion.y_root = e.getScreenY ();

    sendEventToChild (& ev);
#endif
}
//==============================================================================
void VstPluginExternalEditor::mouseUp (const MouseEvent& e)
{
#if defined(LINUX)
    if (! handle) return;

    XEvent ev;
    zerostruct (ev);
    ev.xbutton.display = display;
    ev.xbutton.type = ButtonRelease;
    ev.xbutton.window = handle;
    ev.xbutton.root = RootWindow (display, DefaultScreen (display));
    ev.xbutton.time = CurrentTime;
    ev.xbutton.x = e.x;
    ev.xbutton.y = e.y;
    ev.xbutton.x_root = e.getScreenX ();
    ev.xbutton.y_root = e.getScreenY ();

    translateJuceToXButtonModifiers (e, ev);

    sendEventToChild (& ev);
#endif
}
Beispiel #5
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();
}
Beispiel #6
0
void MainContentComponent::mouseMove (const MouseEvent& event){
    std::cout << "Move" << event.getScreenX() << std::endl;
    drawingLine = false;
}