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) (side-by-side diff)
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.
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;

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.