From c0e32ef7278e108614186ff51f8e4260313a0e9e Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 24 Apr 2018 22:32:17 +0100 Subject: bugfix --- gui/src/main.cpp | 3 +++ gui/src/ofApp.cpp | 24 ++++++++++++++++++------ gui/src/ofApp.h | 4 ++++ 3 files changed, 25 insertions(+), 6 deletions(-) (limited to 'gui') diff --git a/gui/src/main.cpp b/gui/src/main.cpp index 14f4f21..a171351 100644 --- a/gui/src/main.cpp +++ b/gui/src/main.cpp @@ -68,6 +68,9 @@ int main(int argc, char *argv[]){ #ifdef PREVIEW_WINDOW ofAddListener(previewWindow->events().draw,mainApp.get(),&ofApp::draw); #endif + ofAddListener(guiWindow->events().mousePressed,mainApp.get(),&ofApp::guiMousePressed); + ofAddListener(guiWindow->events().mouseDragged,mainApp.get(),&ofApp::guiMouseDragged); + ofAddListener(guiWindow->events().mouseReleased,mainApp.get(),&ofApp::guiMouseReleased); ofRunApp(mainWindow, mainApp); ofRunMainLoop(); diff --git a/gui/src/ofApp.cpp b/gui/src/ofApp.cpp index 570dfb3..08a77a8 100644 --- a/gui/src/ofApp.cpp +++ b/gui/src/ofApp.cpp @@ -336,29 +336,41 @@ void ofApp::mouseMoved(int x, int y ){ //-------------------------------------------------------------- void ofApp::mouseDragged(int x, int y, int button){ - sets[selected_set].mouseDragged(x,y,button); + +} + +void ofApp::guiMouseDragged(ofMouseEventArgs &args){ + sets[selected_set].mouseDragged(args.x,args.y,args.button); } //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ +} + +void ofApp::guiMousePressed(ofMouseEventArgs &args){ if (commandPressed){ - if (y<200){ - sets[0].mousePressed(x,y,OF_MOUSE_BUTTON_4); + if (args.y<200){ + sets[0].mousePressed(args.x,args.y,OF_MOUSE_BUTTON_4); } else { - sets[1].mousePressed(x,y,OF_MOUSE_BUTTON_4); + sets[1].mousePressed(args.x,args.y,OF_MOUSE_BUTTON_4); } } else { - sets[selected_set].mousePressed(x,y,button); + sets[selected_set].mousePressed(args.x,args.y,args.button); } } //-------------------------------------------------------------- void ofApp::mouseReleased(int x, int y, int button){ - sets[selected_set].mouseReleased(x,y,button); + +} + +void ofApp::guiMouseReleased(ofMouseEventArgs &args){ + sets[selected_set].mouseReleased(args.x,args.y,args.button); } + //-------------------------------------------------------------- void ofApp::mouseEntered(int x, int y){ diff --git a/gui/src/ofApp.h b/gui/src/ofApp.h index 7224b96..a7d1c06 100644 --- a/gui/src/ofApp.h +++ b/gui/src/ofApp.h @@ -103,6 +103,10 @@ class ofApp : public ofBaseApp, public ofxMidiListener{ void guiWindowResized(ofResizeEventArgs &resizeargs); void guiDragEvent(ofDragInfo &dragInfo); + void guiMouseDragged(ofMouseEventArgs &args); + void guiMousePressed(ofMouseEventArgs &args); + void guiMouseReleased(ofMouseEventArgs &args); + void keyPressed(ofKeyEventArgs &keyargs); void keyReleased(int key); void mouseMoved(int x, int y ); -- cgit v1.2.3