From 7daba56120e9ee17ad9db4c885ef7e2dd927cb69 Mon Sep 17 00:00:00 2001 From: Don Pellegrino Date: Wed, 19 Aug 2009 21:21:39 +0000 Subject: Changed user interface to pan with the right mouse button so that the left mouse button can be preserved for selection. Fix bug in updating the database with the current selection. This bug was introduced with the conversion to dynamic memory allocation for the number of records. Indexing into the list of GI values is not handled correctly. --- diff --git a/README b/README index 737b89f..f3fe1b8 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ used to highlight the selection. ESC: Clear selection. - Left-click, drag: Pan. + Right-click, drag: Pan. CTRL + Left-click, drag and release: Add box to selection. diff --git a/TODO b/TODO index a188804..2da99f6 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,6 @@ This is the todo list for the project. * Features to add: - - Preserve the aspect ratio when zooming. - Handle multiple selections defined by the user. . Save a selection. . Load a selection. diff --git a/src/controller/actions/sel_save.sqc b/src/controller/actions/sel_save.sqc index 79fa3de..922071e 100644 --- a/src/controller/actions/sel_save.sqc +++ b/src/controller/actions/sel_save.sqc @@ -29,7 +29,8 @@ sel_save (void) { if (S.selection.set[i] == true) { - strncpy (gi, S.gi_data + i + 3, sizeof (gi)); + char *gi_data_row = S.gi_data + (i*20); + strncpy (gi, gi_data_row + 3, sizeof (gi)); EXEC SQL INSERT INTO vis_selection VALUES (:gi); } } diff --git a/src/controller/callbacks/mouse.c b/src/controller/callbacks/mouse.c index 5f5be43..5b1a794 100644 --- a/src/controller/callbacks/mouse.c +++ b/src/controller/callbacks/mouse.c @@ -20,12 +20,16 @@ void mouse (int button, int state, int x, int y) { - // Release left button. - if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) + // Release right button. + if (button == GLUT_RIGHT_BUTTON && state == GLUT_UP) { // Deactive a panning event if one was happening. S.pan.active = false; + } + // Release left button. + if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) + { if (S.selection.active && S.selection.purpose == ZOOM && glutGetModifiers () == GLUT_ACTIVE_CTRL) @@ -170,7 +174,7 @@ mouse (int button, int state, int x, int y) } // Pan. - if (button == GLUT_LEFT_BUTTON && + if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN && glutGetModifiers () != GLUT_ACTIVE_CTRL) { /* diff --git a/src/model/data/base.sqc b/src/model/data/base.sqc index ad1c395..f15d18b 100644 --- a/src/model/data/base.sqc +++ b/src/model/data/base.sqc @@ -69,7 +69,8 @@ base (void) { int i = coordinates.coord_id - 1; - strncpy (S.gi_data + i, coordinates.gi.data, sizeof (S.gi_data[i])); + char *gi_data_row = S.gi_data + (i * 20); + strncpy (gi_data_row, coordinates.gi.data, sizeof (char) * 20); float *v = S.base_vertices_data + (i * 2); *v = coordinates.x; -- cgit v0.8.3.1-22-g547a