summaryrefslogtreecommitdiffstats
Unidiff
-rw-r--r--src/Makefile.am4
-rw-r--r--src/controller/exp004mouse.c55
-rw-r--r--src/controller/mousewheel.c45
-rw-r--r--src/controller/mousewheel.h11
-rw-r--r--src/controller/performzoom.c65
-rw-r--r--src/controller/performzoom.h9
-rw-r--r--src/view/exp004view.c4
7 files changed, 149 insertions, 44 deletions
diff --git a/src/controller/exp004mouse.c b/src/controller/exp004mouse.c
index 17ff19c..cf09bef 100644
--- a/src/controller/exp004mouse.c
+++ b/src/controller/exp004mouse.c
@@ -1,6 +1,7 @@
1#include "exp004mouse.h"1#include "exp004mouse.h"
2#include "exp004processhits.h"2#include "exp004processhits.h"
3#include "exp004reshape.h"3#include "exp004reshape.h"
4#include "performzoom.h"
4#include "set_ortho.h"5#include "set_ortho.h"
5#include "../view/exp004geometry.h"6#include "../view/exp004geometry.h"
6#include "../view/exp004state0.h"7#include "../view/exp004state0.h"
@@ -28,53 +29,19 @@ exp004mouse (int button, int state, int x, int y)
28 if (x == S.selection.x || y == S.selection.y)29 if (x == S.selection.x || y == S.selection.y)
29 return;30 return;
3031
31 /*
32 * Convert the selection boundary from window coordinates to
33 * world coordinates.
34 */
35 glMatrixMode (GL_MODELVIEW);
36 glLoadIdentity ();
37 GLdouble model[16];
38 glGetDoublev (GL_MODELVIEW_MATRIX, model);
39 GLdouble projection[16];
40 glGetDoublev (GL_PROJECTION_MATRIX, projection);
41 GLint viewport[4];32 GLint viewport[4];
42 glGetIntegerv (GL_VIEWPORT, viewport);33 glGetIntegerv (GL_VIEWPORT, viewport);
4334
44 check_error (__FILE__, __LINE__);35 printf ("Zooming to: %i, %i, %i, %i\n",
4536 S.selection.x,
46 GLdouble start_position[3];37 viewport[3] - S.selection.y,
47 gluUnProject (S.selection.x,38 x,
48 viewport[3] - S.selection.y,39 viewport[3] - y);
49 0,40
50 model,41 performzoom (S.selection.x,
51 projection,42 viewport[3] - S.selection.y,
52 viewport,43 x,
53 &start_position[0],44 viewport[3] - y);
54 &start_position[1], &start_position[2]);
55
56 check_error (__FILE__, __LINE__);
57
58 GLdouble end_position[3];
59 gluUnProject (x,
60 viewport[3] - y,
61 0,
62 model,
63 projection,
64 viewport,
65 &end_position[0], &end_position[1], &end_position[2]);
66
67 check_error (__FILE__, __LINE__);
68
69 S.zoom.active = true;
70 S.zoom.coords[0] = fmin (start_position[0], end_position[0]);
71 S.zoom.coords[1] = fmax (start_position[0], end_position[0]);
72 S.zoom.coords[2] = fmin (start_position[1], end_position[1]);
73 S.zoom.coords[3] = fmax (start_position[1], end_position[1]);
74
75 exp004reshape (S.viewport.w, S.viewport.h);
76
77 glutPostRedisplay ();
78 }45 }
7946
80 /*47 /*

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.