--------------------------------------------------------------
| 94 | |
| 95 | //-------------------------------------------------------------- |
| 96 | void testApp::guiEvent(ofxUIEventArgs &e){ |
| 97 | |
| 98 | if(e.widget == ipInput){ |
| 99 | //this check could be smarter but o well |
| 100 | if(ipInput->getTextString() != currentIP && isNumber(ipInput->getTextString())){ |
| 101 | currentIP = ipInput->getTextString(); |
| 102 | sender.setup(currentIP, currentPort); |
| 103 | } |
| 104 | else{ |
| 105 | ipInput->setTextString(currentIP); |
| 106 | } |
| 107 | } |
| 108 | else if(e.widget == portInput){ |
| 109 | int newPort = ofToInt(portInput->getTextString()); |
| 110 | if(newPort != currentPort && isNumber(portInput->getTextString())){ |
| 111 | currentPort = newPort; |
| 112 | sender.setup(currentIP, currentPort); |
| 113 | } |
| 114 | else{ |
| 115 | portInput->setTextString(ofToString(currentPort)); |
| 116 | } |
| 117 | } |
| 118 | else if(e.widget == sendButton && sendButton->getValue()){ |
| 119 | sendCurrentCommand(); |
| 120 | } |
| 121 | else if(e.widget == playButton && playButton->getValue()){ |
| 122 | clearArgs(); |
| 123 | commandInput->setTextString("/duration/play"); |
| 124 | sendCurrentCommand(); |
| 125 | } |
| 126 | else if(e.widget == stopButton && stopButton->getValue()){ |
| 127 | clearArgs(); |
| 128 | commandInput->setTextString("/duration/stop"); |
| 129 | sendCurrentCommand(); |
| 130 | } |
| 131 | else if(e.widget == saveButton && saveButton->getValue()){ |
| 132 | clearArgs(); |
| 133 | commandInput->setTextString("/duration/save"); |
| 134 | sendCurrentCommand(); |
| 135 | } |
| 136 | else if(e.widget == addTrackDropdown && !addTrackDropdown->isOpen() && addTrackDropdown->getSelected().size() == 1){ |
| 137 | addTrackDropdown->setLabelText(addTrackDropdown->getSelected()[0]->getName()); |
| 138 | } |
| 139 | else if(e.widget == addTrackButton && |
| 140 | addTrackButton->getValue() && |
| 141 | addTrackDropdown->getSelected().size() == 1 && |
| 142 | trackNameInput->getTextString() != "") |
| 143 | { |
| 144 | clearArgs(); |
| 145 | commandInput->setTextString("/duration/addtrack"); |
| 146 | arg1->setTextString(addTrackDropdown->getSelected()[0]->getName()); |
| 147 | arg2->setTextString(trackNameInput->getTextString()); |
| 148 | if(filePathInput->getTextString().find(".xml") != string::npos){ |
| 149 | arg3->setTextString(filePathInput->getTextString()); |
| 150 | } |
| 151 | sendCurrentCommand(); |
| 152 | } |
| 153 | else if(e.widget == removeTrackButton && removeTrackButton->getValue()){ |