[chronojump] kneeangle: main menu accepts keys



commit b2671e5b8ec0dda4392f4d988ae9b1c082d068fa
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Mar 25 17:19:09 2010 +0800

    kneeangle: main menu accepts keys

 src/angle/kneeAngle.cpp          |   11 ++++++++++-
 src/angle/kneeAngleFunctions.cpp |   21 ---------------------
 2 files changed, 10 insertions(+), 22 deletions(-)
---
diff --git a/src/angle/kneeAngle.cpp b/src/angle/kneeAngle.cpp
index bbef52e..a34d41d 100644
--- a/src/angle/kneeAngle.cpp
+++ b/src/angle/kneeAngle.cpp
@@ -1687,11 +1687,20 @@ int menu(IplImage * gui, CvFont font)
 
 	int row = 1;
 	int step = 16;
+	int key = NULL;
 
 	cvSetMouseCallback( "gui", on_mouse_gui_menu, 0 );
 
 	do {
-		cvWaitKey(100);
+		key = (char) cvWaitKey(100);
+		switch ( key ) {
+			case 27: mouseClicked = quit; 			break; //27: ESC
+			case 'q': mouseClicked = quit; 			break;
+			case '1': mouseClicked = validation; 		break;
+			case '2': mouseClicked = blackWithoutMarkers; 	break;
+			case '3': mouseClicked = skinOnlyMarkers; 	break;
+			case '4': mouseClicked = blackOnlyMarkers; 	break;
+		}
 	} while (mouseClicked == undefined);
 
 	if(mouseClicked == quit)
diff --git a/src/angle/kneeAngleFunctions.cpp b/src/angle/kneeAngleFunctions.cpp
index 146e757..5dc11f0 100644
--- a/src/angle/kneeAngleFunctions.cpp
+++ b/src/angle/kneeAngleFunctions.cpp
@@ -1315,27 +1315,6 @@ void on_mouse_mark_point( int event, int x, int y, int flags, void* param )
 	switch( event ) {
 		case CV_EVENT_LBUTTONDOWN:
 			{
-				/*
-				if(forceMouseMark == TOGGLEHIP) 
-				{
-					//hipMouse = clicked;
-					markedMouse = clicked;
-					forceMouseHip = false;
-				} 
-				else if(forceMouseMark == TOGGLEKNEE) 
-				{
-					//kneeMouse = clicked;
-					markedMouse = clicked;
-					forceMouseKnee = false;
-				} 
-				else if(forceMouseMark == TOGGLETOE) 
-				{
-					//toeMouse = clicked;
-					markedMouse = clicked;
-					forceMouseToe = false;
-				} 
-				*/
-				
 				if(forceMouseMark == TOGGLEHIP || forceMouseMark == TOGGLEKNEE || 
 						forceMouseMark == TOGGLETOE) {
 					markedMouse = clicked;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]