-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | src/controller/actions/sel_save.sqc | 3 | ||||
-rw-r--r-- | src/controller/callbacks/mouse.c | 10 | ||||
-rw-r--r-- | src/model/data/base.sqc | 3 |
5 files changed, 12 insertions, 7 deletions
@@ -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. @@ -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; |