summaryrefslogtreecommitdiffstats
authorDon Pellegrino <don@coffee.donpellegrino.com>2009-08-19 21:21:39 (GMT)
committer Don Pellegrino <don@coffee.donpellegrino.com>2009-08-19 21:21:39 (GMT)
commit7daba56120e9ee17ad9db4c885ef7e2dd927cb69 (patch) (unidiff)
tree79b142e6e3be68036b15f990126a162d3d7d60c3
parentcb29a04fa5a3349c8f14203ec873e861376ce4d8 (diff)
downloadexp005-7daba56120e9ee17ad9db4c885ef7e2dd927cb69.zip
exp005-7daba56120e9ee17ad9db4c885ef7e2dd927cb69.tar.gz
exp005-7daba56120e9ee17ad9db4c885ef7e2dd927cb69.tar.bz2
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.
-rw-r--r--README2
-rw-r--r--TODO1
-rw-r--r--src/controller/actions/sel_save.sqc3
-rw-r--r--src/controller/callbacks/mouse.c10
-rw-r--r--src/model/data/base.sqc3
5 files changed, 12 insertions, 7 deletions
diff --git a/README b/README
index 737b89f..f3fe1b8 100644
--- a/README
+++ b/README
@@ -5,7 +5,7 @@ used to highlight the selection.
55
6 ESC: Clear selection.6 ESC: Clear selection.
7 7
8 Left-click, drag: Pan.8 Right-click, drag: Pan.
99
10 CTRL + Left-click, drag and release: Add box to selection.10 CTRL + Left-click, drag and release: Add box to selection.
11 11
diff --git a/TODO b/TODO
index a188804..2da99f6 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,6 @@
1This is the todo list for the project.1This is the todo list for the project.
22
3* Features to add:3* Features to add:
4 - Preserve the aspect ratio when zooming.
5 - Handle multiple selections defined by the user.4 - Handle multiple selections defined by the user.
6 . Save a selection.5 . Save a selection.
7 . Load a selection.6 . 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)
29 {29 {
30 if (S.selection.set[i] == true)30 if (S.selection.set[i] == true)
31 {31 {
32 strncpy (gi, S.gi_data + i + 3, sizeof (gi));32 char *gi_data_row = S.gi_data + (i*20);
33 strncpy (gi, gi_data_row + 3, sizeof (gi));
33 EXEC SQL INSERT INTO vis_selection VALUES (:gi);34 EXEC SQL INSERT INTO vis_selection VALUES (:gi);
34 }35 }
35 }36 }
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 @@
20void20void
21mouse (int button, int state, int x, int y)21mouse (int button, int state, int x, int y)
22{22{
23 // Release left button.23 // Release right button.
24 if (button == GLUT_LEFT_BUTTON && state == GLUT_UP)24 if (button == GLUT_RIGHT_BUTTON && state == GLUT_UP)
25 {25 {
26 // Deactive a panning event if one was happening.26 // Deactive a panning event if one was happening.
27 S.pan.active = false;27 S.pan.active = false;
28 }
2829
30 // Release left button.
31 if (button == GLUT_LEFT_BUTTON && state == GLUT_UP)
32 {
29 if (S.selection.active &&33 if (S.selection.active &&
30 S.selection.purpose == ZOOM &&34 S.selection.purpose == ZOOM &&
31 glutGetModifiers () == GLUT_ACTIVE_CTRL)35 glutGetModifiers () == GLUT_ACTIVE_CTRL)
@@ -170,7 +174,7 @@ mouse (int button, int state, int x, int y)
170 }174 }
171175
172 // Pan.176 // Pan.
173 if (button == GLUT_LEFT_BUTTON &&177 if (button == GLUT_RIGHT_BUTTON &&
174 state == GLUT_DOWN && glutGetModifiers () != GLUT_ACTIVE_CTRL)178 state == GLUT_DOWN && glutGetModifiers () != GLUT_ACTIVE_CTRL)
175 {179 {
176 /*180 /*
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)
69 {69 {
70 int i = coordinates.coord_id - 1;70 int i = coordinates.coord_id - 1;
7171
72 strncpy (S.gi_data + i, coordinates.gi.data, sizeof (S.gi_data[i]));72 char *gi_data_row = S.gi_data + (i * 20);
73 strncpy (gi_data_row, coordinates.gi.data, sizeof (char) * 20);
7374
74 float *v = S.base_vertices_data + (i * 2);75 float *v = S.base_vertices_data + (i * 2);
75 *v = coordinates.x;76 *v = coordinates.x;

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.