Ejemplo n.º 1
0
void MantaStats::mouseReleased(ofMouseEventArgs &evt)
{
    dragging = false;
    
    if (!mouseActive ||
        !mainDrawRect.inside(evt.x, evt.y) ||
        ofDist(dragPoint1.x, dragPoint1.y, dragPoint2.x, dragPoint2.y) > 1 ) {
    }
    
    if (!mouseActive ||
        (!mainDrawRect.inside(evt.x, evt.y) && !statsDrawRect.inside(evt.x, evt.y))) {
        return;
    }
    
    for (int i=0; i<2; i++)
    {
        if (sliderPositions[i].inside(evt.x, evt.y))
        {
            if (!shift && !getIsDragging()) clearSelection();
            addSliderToSelection(i);
            redrawComponents();
            ofNotifyEvent(eventSliderClick, i);
            return;
        }
    }
    for (int i=0; i<4; i++)
    {
        if (buttonPositions[i].inside(evt.x, evt.y))
        {
            if (!shift && !getIsDragging()) clearSelection();
            addButtonToSelection(i);
            redrawComponents();
            ofNotifyEvent(eventButtonClick, i);
            return;
        }
    }
    for (int i=0; i<48; i++)
    {
        if (padPositions[i].inside(evt.x, evt.y))
        {
            if (!shift && !getIsDragging()) clearSelection();
            addPadToSelection(floor(i / 8), i % 8);
            redrawComponents();
            ofNotifyEvent(eventPadClick, i);
            return;
        }
    }
    for (int i=0; i<13; i++)
    {
        if (statRects[i].inside(evt.x, evt.y))
        {
            if (!shift && !getIsDragging()) clearSelection();
            statSelection = i;
            toRedrawStats = true;
            redrawComponents();
            ofNotifyEvent(eventStatClick, i);
            return;
        }
    }
}
Ejemplo n.º 2
0
void MantaController::setPadSelection(vector<int> idx, int selection)
{
    clearPadSelection();
    for (int i = 0; i < idx.size(); i++)
    {
        int row = floor(idx[i] / 8);
        int col = idx[i] % 8;
        addPadToSelection(row, col, selection);
    }
}
Ejemplo n.º 3
0
void MantaAudioUnitController::mapAllPadsToMidiNotes(AudioUnitInstrument & synth)
{
    clearMidiMapping();
    for (int r = 0; r < 6; r++) {
        for (int c = 0; c < 8; c++) {
            addPadToSelection(r, c);
        }
    }
    mapSelectionToMidiNotes(synth);
}
Ejemplo n.º 4
0
void MantaController::mouseReleased(ofMouseEventArgs &evt)
{
    //if (viewParameters) return;
    dragging = false;
    
    if (!mouseActive ||
        !mainDrawRect.inside(evt.x, evt.y) ||
        ofDist(dragPoint1.x, dragPoint1.y, dragPoint2.x, dragPoint2.y) > 1 ) {
        return;
    }
    
    for (int i=0; i<2; i++)
    {
        if (sliderPositions[i].inside(evt.x, evt.y))
        {
            if (!shift) clearSelection(selection);
            addSliderToSelection(i, selection);
            //MantaElement mantaEvt(SLIDER, i, selection);
            //ofNotifyEvent(clickEvent, mantaEvt, this);
            return;
        }
    }
    for (int i=0; i<4; i++)
    {
        if (buttonPositions[i].inside(evt.x, evt.y))
        {
            if (!shift) clearSelection(selection);
            addButtonToSelection(i, selection);
            //MantaElement mantaEvt(BUTTON, i, selection);
            //ofNotifyEvent(clickEvent, mantaEvt, this);
            return;
        }
    }
    for (int i=0; i<48; i++)
    {
        if (padPositions[i].inside(evt.x, evt.y))
        {
            if (!shift) clearSelection(selection);
            addPadToSelection(floor(i / 8), i % 8, selection);
            //MantaElement mantaEvt(PAD, i, selection);
            //ofNotifyEvent(clickEvent, mantaEvt, this);
            return;
        }
    }
    
    //MantaElement mantaEvt;
    //ofNotifyEvent(clickEvent, mantaEvt, this);
}
Ejemplo n.º 5
0
void MantaStats::getMantaElementsInBox(int x, int y)
{
    clearSelection();
    dragPoint2 = ofPoint(x, y);
    ofRectangle rect = ofRectangle(min(dragPoint1.x, dragPoint2.x), min(dragPoint1.y, dragPoint2.y),
                                   abs(dragPoint1.x - dragPoint2.x), abs(dragPoint1.y - dragPoint2.y));
    for (int i=0; i<48; i++)
    {
        if (rect.inside(padPositions[i].x, padPositions[i].y) ||
            rect.inside(padPositions[i].x+ padPositions[i].width, padPositions[i].y) ||
            rect.inside(padPositions[i].x+ padPositions[i].width, padPositions[i].y+ padPositions[i].height) ||
            rect.inside(padPositions[i].x, padPositions[i].y+ padPositions[i].height)) {
            int row = floor(i / 8);
            int col = i % 8;
            addPadToSelection(row, col);
        }
    }
    for (int i=0; i<2; i++)
    {
        if (rect.inside(sliderPositions[i].x, sliderPositions[i].y) ||
            rect.inside(sliderPositions[i].x+ sliderPositions[i].width, sliderPositions[i].y) ||
            rect.inside(sliderPositions[i].x+ sliderPositions[i].width, sliderPositions[i].y+sliderPositions[i].height) ||
            rect.inside(sliderPositions[i].x, sliderPositions[i].y+ sliderPositions[i].height)) {
            addSliderToSelection(i);
        }
    }
    for (int i=0; i<2; i++)
    {
        if (rect.inside(buttonPositions[i].x, buttonPositions[i].y) ||
            rect.inside(buttonPositions[i].x+ buttonPositions[i].width, buttonPositions[i].y) ||
            rect.inside(buttonPositions[i].x+ buttonPositions[i].width, buttonPositions[i].y+ buttonPositions[i].height) ||
            rect.inside(buttonPositions[i].x, buttonPositions[i].y+ buttonPositions[i].height)) {
            addButtonToSelection(i);
        }
    }
    redrawComponents();
}