summaryrefslogtreecommitdiffstats
Side-by-side diff
-rw-r--r--README21
-rw-r--r--TODO3
-rw-r--r--src/Makefile.am27
-rw-r--r--src/controller/actions/pan.c57
-rw-r--r--src/controller/actions/pan.h2
-rw-r--r--src/controller/actions/sel_save.c2
-rw-r--r--src/controller/callbacks/keyboard.c2
-rw-r--r--src/controller/callbacks/mouse.c30
-rw-r--r--src/controller/callbacks/mouse_motion.c19
-rw-r--r--src/controller/callbacks/mouse_motion.h9
-rw-r--r--src/model/base.c417
-rw-r--r--src/model/base.h9
-rw-r--r--src/model/coordinates.h11
-rw-r--r--src/model/data/base.sqc (renamed from src/model/base.sqc)6
-rw-r--r--src/model/selection_info.h37
-rw-r--r--src/model/selection_info_init.c14
-rw-r--r--src/model/selection_info_init.h8
-rw-r--r--src/model/selection_purposes.h17
-rw-r--r--src/model/state/pan_info_init.h8
-rw-r--r--src/model/state/state.h (renamed from src/model/state.h)3
-rw-r--r--src/model/state/zoom_info.h (renamed from src/model/zoom_info.h)0
-rw-r--r--src/model/state/zoom_info_init.c (renamed from src/model/zoom_info_init.c)0
-rw-r--r--src/model/state/zoom_info_init.h (renamed from src/model/zoom_info_init.h)0
-rw-r--r--src/view/geometry.c8
-rw-r--r--src/view/init.c12
-rw-r--r--src/view/state0.h2
-rw-r--r--src/view/view.c4
27 files changed, 179 insertions, 549 deletions
diff --git a/src/controller/callbacks/mouse.c b/src/controller/callbacks/mouse.c
index 16e8b8b..f594c23 100644
--- a/src/controller/callbacks/mouse.c
+++ b/src/controller/callbacks/mouse.c
@@ -9,6 +9,7 @@
#include "reshape.h"
#include <GL/glut.h>
#include <math.h>
+#include <stdio.h>
#include <stdlib.h>
/*
@@ -19,8 +20,12 @@
void
mouse (int button, int state, int x, int y)
{
+ // Release left button.
if (button == GLUT_LEFT_BUTTON && state == GLUT_UP)
{
+ // Deactive a panning event if one was happening.
+ S.pan.active = false;
+
if (S.selection.active && S.selection.purpose == ZOOM)
{
/*
@@ -41,7 +46,9 @@ mouse (int button, int state, int x, int y)
/*
* Complete a selection if one was started and not cancelled.
*/
- if (S.selection.active && S.selection.purpose == SET)
+ if (S.selection.active &&
+ S.selection.purpose == SET &&
+ glutGetModifiers () == GLUT_ACTIVE_CTRL)
{
/*
@@ -116,12 +123,31 @@ mouse (int button, int state, int x, int y)
}
- if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
+ // Begin selection.
+ if (button == GLUT_LEFT_BUTTON &&
+ state == GLUT_DOWN &&
+ glutGetModifiers () == GLUT_ACTIVE_CTRL)
{
S.selection.active = true;
S.selection.x = x;
S.selection.y = y;
}
+ // Pan.
+ if (button == GLUT_LEFT_BUTTON &&
+ state == GLUT_DOWN &&
+ glutGetModifiers () != GLUT_ACTIVE_CTRL)
+ {
+ /*
+ * Detection of the first point in a panning event.
+ */
+ if (S.pan.active == false)
+ {
+ S.pan.active = true;
+ S.pan.begin[0] = x;
+ S.pan.begin[1] = y;
+ }
+ }
+
return;
}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.