Beispiel #1
0
void GUIAxes::guiEvent(ofxUIEventArgs &e){
    // events based on mouse released
    if(ofGetMousePressed()){return;}
    
    
    
    string name = e.getName();
    
    
    int axe = getNumAxe(e.getParent());
    ofLogNotice("GUI") << e.getParent()->getName() << " // " << e.getName() << "// " <<  axe ;
    
    // attributes and aggregator modification
    if( axe!=-1 && attr[axe]->getSelected().size()>0 ){
        if(isAnAttributeList(e.getParent())){
            shouldUpdateAggregator = axe;
        }
        else if (aggr[axe]->getSelected().size()>0 && scaleType[axe]->getSelectedIndeces().size()>0) {
            reorderAxe(axe);
        }
        
    }
    else if(e.getParent() == coordinateType){
        for(int i = 0 ; i <3; i++){
            reorderAxe(i);
        }
    }
    
    
    // mins maxs modifications
    else if (e.getKind() == OFX_UI_WIDGET_NUMBERDIALER){
        axe = getNumAxe(e.widget);
        float s =((ofxUINumberDialer*)e.widget)->getValue();
        
        ofVec3f mask(axe==0?1:0,axe==1?1:0,axe==2?1:0);
        if(name.substr(0,name.length()-1)=="min"){
            Physics::mins = s*mask + (-mask+ofVec3f(1))*Physics::mins;
        }
        if(name.substr(0,name.length()-1)=="max"){
            Physics::maxs = s*mask + (-mask+ofVec3f(1))*Physics::maxs;
        }
        scaleType[axe]->getToggles()[2]->setValue(true);
        scaleType[axe]->getToggles()[2]->triggerSelf();
        Physics::orderByAttributes(attr[axe]->getSelected()[0]->getName()+"."+aggr[axe]->getSelected()[0]->getName(), axe, scaleType[axe]->getSelectedIndeces()[0]);
        
    }
    
    
    checkOverlapingDDL(e);
        
}
Beispiel #2
0
void GUIMidi::guiEvent(ofxUIEventArgs & e){
    
    if(e.getParent() == midiPorts){
        Midi::i()->midiIn.closePort();
        Midi::i()->midiIn.openPort(e.getName());
    }
    
    else if(e.widget == midiVelCenter || e.widget == midiVelRange){
        Midi::velScale.set(midiVelCenter->getValue() - midiVelRange->getValue()/2.0,midiVelCenter->getValue() + midiVelRange->getValue()/2.0);
    }
    else if(e.widget == resetNoteMap && !resetNoteMap->getValue()){
        Midi::midiNotes.clear();
        
    }
    else if(e.widget == midiRadius){
        Midi::radius = midiRadius->getValue();
        for(auto & m:Midi::midiSpots){
            m.radius = Midi::radius;
        }
    }
    else if(e.widget == midiHold){
        Midi::hold=midiHold->getValue();
    }
    else if(e.widget == midiLink2Cam){
        Midi::link2Cam = midiLink2Cam->getValue();
    }
    else if(e.widget == vel2Vol ){
        Midi::vel2VolScale.set(vel2Vol->getValueLow(),vel2Vol->getValueHigh());
    }
    else if(e.widget == midiSpots){
        Midi::bMidiSpot = e.getBool();
    }
    else if(e.widget==randomMidi){
        Midi::random = e.getDouble();
    }
}