summaryrefslogtreecommitdiffstats
authorDon Pellegrino <don@coffee.donpellegrino.com>2009-08-18 19:48:41 (GMT)
committer Don Pellegrino <don@coffee.donpellegrino.com>2009-08-18 19:48:41 (GMT)
commitcb29a04fa5a3349c8f14203ec873e861376ce4d8 (patch) (unidiff)
tree45edb32e24b75380c79ded903b7d87b387d5a2a4
parent27556ba574b91a768c8a5fc2e70247f1c2fd5cc0 (diff)
downloadexp005-cb29a04fa5a3349c8f14203ec873e861376ce4d8.zip
exp005-cb29a04fa5a3349c8f14203ec873e861376ce4d8.tar.gz
exp005-cb29a04fa5a3349c8f14203ec873e861376ce4d8.tar.bz2
Ran GNU indent.
-rw-r--r--Makefile.am17
-rw-r--r--src/controller/actions/pan.c23
-rw-r--r--src/controller/actions/set_ortho.c5
-rw-r--r--src/controller/actions/zoom.c8
-rw-r--r--src/controller/callbacks/keyboard.c2
-rw-r--r--src/controller/callbacks/mouse.c30
-rw-r--r--src/controller/callbacks/mouse_motion.c2
-rw-r--r--src/controller/callbacks/mouse_wheel.c8
-rw-r--r--src/controller/callbacks/reshape.c26
-rw-r--r--src/model/geometry/map_geometry.c10
-rw-r--r--src/model/state/pan_info_init.h2
-rw-r--r--src/model/state/zoom_info_init.c2
12 files changed, 70 insertions, 65 deletions
diff --git a/Makefile.am b/Makefile.am
index 8638119..d54aa2f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,15 +1,26 @@
1ACLOCAL_AMFLAGS = -I ax1ACLOCAL_AMFLAGS = -I ax
2SUBDIRS = src2SUBDIRS = src
33
4# Ident formats the source code to conform with GNU style conventions.
4indent :5indent :
5 indent \6 indent \
6 src/*.c \7 src/*.c \
7 src/controller/*.c src/controller/*.sqc src/controller/*.h \8 src/controller/actions/*.c src/controller/actions/*.sqc src/controller/actions/*.h \
9 src/controller/callbacks/*.c src/controller/callbacks/*.h \
8 src/db/*.c src/db/*.sqc src/db/*.h \10 src/db/*.c src/db/*.sqc src/db/*.h \
9 src/model/*.c src/model/*.sqc src/model/*.h \11 src/model/data/*.c src/model/data/*.sqc src/model/data/*.h \
10 src/model/geometry/*.c src/mode/geometry/*.h \12 src/model/geometry/*.c src/model/geometry/*.h \
13 src/model/state/*.c src/model/state/*.h \
11 src/util/*.c src/util/*.h \14 src/util/*.c src/util/*.h \
12 src/util/amd_performance_monitor/*.c \15 src/util/amd_performance_monitor/*.c \
13 src/util/amd_performance_monitor/*.h \16 src/util/amd_performance_monitor/*.h \
14 src/view/*.c src/view/*.h17 src/view/*.c src/view/*.h
1518
19# Splint analyzes the code for security vulnerabilities and
20# programming mistakes. It would be great to add a target to run
21# splint here but as of Splint 3.1.2 it does not yet handle C99
22# variable declarations which are used heavily in this project. This
23# is discussed at
24# http://www.cs.virginia.edu/pipermail/splint-discuss/2009-March/001288.html.
25
26
diff --git a/src/controller/actions/pan.c b/src/controller/actions/pan.c
index 2f856b0..52e5fc1 100644
--- a/src/controller/actions/pan.c
+++ b/src/controller/actions/pan.c
@@ -10,10 +10,10 @@ pan (int x1, int y1, int x2, int y2)
10{10{
11 int dx = x1 - x2;11 int dx = x1 - x2;
12 int dy = y1 - x2;12 int dy = y1 - x2;
13 13
14 if (dx == 0 && dy == 0)14 if (dx == 0 && dy == 0)
15 return;15 return;
16 16
17 /*17 /*
18 * Convert the selection boundary from window coordinates to18 * Convert the selection boundary from window coordinates to
19 * world coordinates.19 * world coordinates.
@@ -26,9 +26,9 @@ pan (int x1, int y1, int x2, int y2)
26 glGetDoublev (GL_PROJECTION_MATRIX, projection);26 glGetDoublev (GL_PROJECTION_MATRIX, projection);
27 GLint viewport[4];27 GLint viewport[4];
28 glGetIntegerv (GL_VIEWPORT, viewport);28 glGetIntegerv (GL_VIEWPORT, viewport);
29 29
30 check_error (__FILE__, __LINE__);30 check_error (__FILE__, __LINE__);
31 31
32 GLdouble start_position[3];32 GLdouble start_position[3];
33 gluUnProject (x1,33 gluUnProject (x1,
34 y1,34 y1,
@@ -36,11 +36,10 @@ pan (int x1, int y1, int x2, int y2)
36 model,36 model,
37 projection,37 projection,
38 viewport,38 viewport,
39 &start_position[0],39 &start_position[0], &start_position[1], &start_position[2]);
40 &start_position[1], &start_position[2]);40
41
42 check_error (__FILE__, __LINE__);41 check_error (__FILE__, __LINE__);
43 42
44 GLdouble end_position[3];43 GLdouble end_position[3];
45 gluUnProject (x2,44 gluUnProject (x2,
46 y2,45 y2,
@@ -49,13 +48,13 @@ pan (int x1, int y1, int x2, int y2)
49 projection,48 projection,
50 viewport,49 viewport,
51 &end_position[0], &end_position[1], &end_position[2]);50 &end_position[0], &end_position[1], &end_position[2]);
52 51
53 check_error (__FILE__, __LINE__);52 check_error (__FILE__, __LINE__);
54 53
55 S.pan.trans[0] += end_position[0] - start_position[0];54 S.pan.trans[0] += end_position[0] - start_position[0];
56 S.pan.trans[1] -= end_position[1] - start_position[1];55 S.pan.trans[1] -= end_position[1] - start_position[1];
57 56
58 glutPostRedisplay ();57 glutPostRedisplay ();
59 58
60 return;59 return;
61}60}
diff --git a/src/controller/actions/set_ortho.c b/src/controller/actions/set_ortho.c
index ce66f60..e73846c 100644
--- a/src/controller/actions/set_ortho.c
+++ b/src/controller/actions/set_ortho.c
@@ -7,10 +7,7 @@
7void7void
8set_ortho (void)8set_ortho (void)
9{9{
10 gluOrtho2D (S.ortho.min_x, 10 gluOrtho2D (S.ortho.min_x, S.ortho.max_x, S.ortho.min_y, S.ortho.max_y);
11 S.ortho.max_x,
12 S.ortho.min_y,
13 S.ortho.max_y);
1411
15 return;12 return;
16}13}
diff --git a/src/controller/actions/zoom.c b/src/controller/actions/zoom.c
index 7209e85..53da49b 100644
--- a/src/controller/actions/zoom.c
+++ b/src/controller/actions/zoom.c
@@ -14,7 +14,7 @@ void
14zoom (double x1, double y1, double x2, double y2)14zoom (double x1, double y1, double x2, double y2)
15{15{
16 S.zoom.active = true;16 S.zoom.active = true;
17 17
18 S.zoom.coords[0] = x1;18 S.zoom.coords[0] = x1;
19 S.zoom.coords[1] = x2;19 S.zoom.coords[1] = x2;
20 S.zoom.coords[2] = y1;20 S.zoom.coords[2] = y1;
@@ -30,7 +30,7 @@ zoom (double x1, double y1, double x2, double y2)
30 */30 */
31 double width = S.zoom.coords[1] - S.zoom.coords[0];31 double width = S.zoom.coords[1] - S.zoom.coords[0];
32 double height = S.zoom.coords[3] - S.zoom.coords[2];32 double height = S.zoom.coords[3] - S.zoom.coords[2];
33 double difference = fabs(width - height);33 double difference = fabs (width - height);
3434
35 if (width > height)35 if (width > height)
36 {36 {
@@ -46,8 +46,8 @@ zoom (double x1, double y1, double x2, double y2)
46 GLint viewport[4];46 GLint viewport[4];
47 glGetIntegerv (GL_VIEWPORT, viewport);47 glGetIntegerv (GL_VIEWPORT, viewport);
48 reshape (viewport[2], viewport[3]);48 reshape (viewport[2], viewport[3]);
49 49
50 glutPostRedisplay ();50 glutPostRedisplay ();
51 51
52 return;52 return;
53}53}
diff --git a/src/controller/callbacks/keyboard.c b/src/controller/callbacks/keyboard.c
index 9e667d8..a74ac7b 100644
--- a/src/controller/callbacks/keyboard.c
+++ b/src/controller/callbacks/keyboard.c
@@ -45,7 +45,7 @@ keyboard (unsigned char key, int x, int y)
45 * Reset the view (unzoom, recenter).45 * Reset the view (unzoom, recenter).
46 */46 */
47 pan_info_init (&S.pan);47 pan_info_init (&S.pan);
48 zoom_info_init (&S.zoom); 48 zoom_info_init (&S.zoom);
4949
50 GLint viewport[4];50 GLint viewport[4];
51 glGetIntegerv (GL_VIEWPORT, viewport);51 glGetIntegerv (GL_VIEWPORT, viewport);
diff --git a/src/controller/callbacks/mouse.c b/src/controller/callbacks/mouse.c
index 34ff290..5f5be43 100644
--- a/src/controller/callbacks/mouse.c
+++ b/src/controller/callbacks/mouse.c
@@ -25,8 +25,8 @@ mouse (int button, int state, int x, int y)
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 28
29 if (S.selection.active && 29 if (S.selection.active &&
30 S.selection.purpose == ZOOM &&30 S.selection.purpose == ZOOM &&
31 glutGetModifiers () == GLUT_ACTIVE_CTRL)31 glutGetModifiers () == GLUT_ACTIVE_CTRL)
32 {32 {
@@ -35,7 +35,7 @@ mouse (int button, int state, int x, int y)
35 */35 */
36 if (x == S.selection.x || y == S.selection.y)36 if (x == S.selection.x || y == S.selection.y)
37 return;37 return;
38 38
39 /*39 /*
40 * Convert the selection boundary from window coordinates to40 * Convert the selection boundary from window coordinates to
41 * world coordinates.41 * world coordinates.
@@ -48,21 +48,21 @@ mouse (int button, int state, int x, int y)
48 glGetDoublev (GL_PROJECTION_MATRIX, projection);48 glGetDoublev (GL_PROJECTION_MATRIX, projection);
49 GLint viewport[4];49 GLint viewport[4];
50 glGetIntegerv (GL_VIEWPORT, viewport);50 glGetIntegerv (GL_VIEWPORT, viewport);
51 51
52 check_error (__FILE__, __LINE__);52 check_error (__FILE__, __LINE__);
53 53
54 GLdouble start_position[3];54 GLdouble start_position[3];
55 gluUnProject (x,55 gluUnProject (x,
56 viewport[3] -y,56 viewport[3] - y,
57 0,57 0,
58 model,58 model,
59 projection,59 projection,
60 viewport,60 viewport,
61 &start_position[0],61 &start_position[0],
62 &start_position[1], &start_position[2]);62 &start_position[1], &start_position[2]);
63 63
64 check_error (__FILE__, __LINE__);64 check_error (__FILE__, __LINE__);
65 65
66 GLdouble end_position[3];66 GLdouble end_position[3];
67 gluUnProject (S.selection.x,67 gluUnProject (S.selection.x,
68 viewport[3] - S.selection.y,68 viewport[3] - S.selection.y,
@@ -71,9 +71,9 @@ mouse (int button, int state, int x, int y)
71 projection,71 projection,
72 viewport,72 viewport,
73 &end_position[0], &end_position[1], &end_position[2]);73 &end_position[0], &end_position[1], &end_position[2]);
74 74
75 check_error (__FILE__, __LINE__);75 check_error (__FILE__, __LINE__);
76 76
77 zoom (fmin (start_position[0], end_position[0]),77 zoom (fmin (start_position[0], end_position[0]),
78 fmin (start_position[1], end_position[1]),78 fmin (start_position[1], end_position[1]),
79 fmax (start_position[0], end_position[0]),79 fmax (start_position[0], end_position[0]),
@@ -83,7 +83,7 @@ mouse (int button, int state, int x, int y)
83 /*83 /*
84 * Complete a selection if one was started and not cancelled.84 * Complete a selection if one was started and not cancelled.
85 */85 */
86 if (S.selection.active && 86 if (S.selection.active &&
87 S.selection.purpose == SET &&87 S.selection.purpose == SET &&
88 glutGetModifiers () == GLUT_ACTIVE_CTRL)88 glutGetModifiers () == GLUT_ACTIVE_CTRL)
89 {89 {
@@ -161,9 +161,8 @@ mouse (int button, int state, int x, int y)
161 }161 }
162162
163 // Begin selection.163 // Begin selection.
164 if (button == GLUT_LEFT_BUTTON && 164 if (button == GLUT_LEFT_BUTTON &&
165 state == GLUT_DOWN && 165 state == GLUT_DOWN && glutGetModifiers () == GLUT_ACTIVE_CTRL)
166 glutGetModifiers () == GLUT_ACTIVE_CTRL)
167 {166 {
168 S.selection.active = true;167 S.selection.active = true;
169 S.selection.x = x;168 S.selection.x = x;
@@ -172,8 +171,7 @@ mouse (int button, int state, int x, int y)
172171
173 // Pan.172 // Pan.
174 if (button == GLUT_LEFT_BUTTON &&173 if (button == GLUT_LEFT_BUTTON &&
175 state == GLUT_DOWN &&174 state == GLUT_DOWN && glutGetModifiers () != GLUT_ACTIVE_CTRL)
176 glutGetModifiers () != GLUT_ACTIVE_CTRL)
177 {175 {
178 /*176 /*
179 * Detection of the first point in a panning event.177 * Detection of the first point in a panning event.
diff --git a/src/controller/callbacks/mouse_motion.c b/src/controller/callbacks/mouse_motion.c
index 3279773..5cdbac7 100644
--- a/src/controller/callbacks/mouse_motion.c
+++ b/src/controller/callbacks/mouse_motion.c
@@ -14,6 +14,6 @@ mouse_motion (int x, int y)
14 S.pan.begin[0] = x;14 S.pan.begin[0] = x;
15 S.pan.begin[1] = y;15 S.pan.begin[1] = y;
16 }16 }
17 17
18 return;18 return;
19}19}
diff --git a/src/controller/callbacks/mouse_wheel.c b/src/controller/callbacks/mouse_wheel.c
index 9ca73bc..05ce734 100644
--- a/src/controller/callbacks/mouse_wheel.c
+++ b/src/controller/callbacks/mouse_wheel.c
@@ -6,7 +6,7 @@
66
7#define S state07#define S state0
88
9void 9void
10mouse_wheel (int button, int dir, int x, int y)10mouse_wheel (int button, int dir, int x, int y)
11{11{
12 /*12 /*
@@ -14,8 +14,8 @@ mouse_wheel (int button, int dir, int x, int y)
14 * start at the position of the mouse. Calculate a bounding box14 * start at the position of the mouse. Calculate a bounding box
15 * that will be the selection and zoom to it.15 * that will be the selection and zoom to it.
16 */16 */
17 double width = fabs(S.ortho.max_x - S.ortho.min_x);17 double width = fabs (S.ortho.max_x - S.ortho.min_x);
18 double height = fabs(S.ortho.max_y - S.ortho.min_y);18 double height = fabs (S.ortho.max_y - S.ortho.min_y);
1919
20 /*20 /*
21 * Box the smaller of the two dimensions.21 * Box the smaller of the two dimensions.
@@ -60,7 +60,7 @@ mouse_wheel (int button, int dir, int x, int y)
60 }60 }
6161
62 // Zoom in62 // Zoom in
63 if (dir > 0) 63 if (dir > 0)
64 {64 {
65 zoom (x1 + step, y1 + step, x2 - step, y2 - step);65 zoom (x1 + step, y1 + step, x2 - step, y2 - step);
66 }66 }
diff --git a/src/controller/callbacks/reshape.c b/src/controller/callbacks/reshape.c
index fec5443..0414be6 100644
--- a/src/controller/callbacks/reshape.c
+++ b/src/controller/callbacks/reshape.c
@@ -21,23 +21,25 @@ reshape (int w, int h)
21 {21 {
22 if (w >= h)22 if (w >= h)
23 {23 {
24 double scale 24 double scale
25 = ( ( (S.zoom.coords[1] - S.zoom.coords[0]) * ((double) w / (double) h) )25 =
26 - (S.zoom.coords[1] - S.zoom.coords[0]) )26 (((S.zoom.coords[1] -
27 * 0.5;27 S.zoom.coords[0]) * ((double) w / (double) h)) -
28 (S.zoom.coords[1] - S.zoom.coords[0])) * 0.5;
2829
29 S.ortho.min_x = S.zoom.coords[0] - scale;30 S.ortho.min_x = S.zoom.coords[0] - scale;
30 S.ortho.max_x = S.zoom.coords[1] + scale; 31 S.ortho.max_x = S.zoom.coords[1] + scale;
31 S.ortho.min_y = S.zoom.coords[2];32 S.ortho.min_y = S.zoom.coords[2];
32 S.ortho.max_y = S.zoom.coords[3];33 S.ortho.max_y = S.zoom.coords[3];
33 }34 }
34 else35 else
35 {36 {
36 double scale 37 double scale
37 = ( ( (S.zoom.coords[3] - S.zoom.coords[2]) * ((double) h / (double) w) )38 =
38 - (S.zoom.coords[3] - S.zoom.coords[2]) )39 (((S.zoom.coords[3] -
39 * 0.5;40 S.zoom.coords[2]) * ((double) h / (double) w)) -
40 41 (S.zoom.coords[3] - S.zoom.coords[2])) * 0.5;
42
41 S.ortho.min_x = S.zoom.coords[0];43 S.ortho.min_x = S.zoom.coords[0];
42 S.ortho.max_x = S.zoom.coords[1];44 S.ortho.max_x = S.zoom.coords[1];
43 S.ortho.min_y = S.zoom.coords[2] - scale;45 S.ortho.min_y = S.zoom.coords[2] - scale;
@@ -45,7 +47,7 @@ reshape (int w, int h)
45 }47 }
46 }48 }
4749
48 else 50 else
49 {51 {
50 /*52 /*
51 * This scaling produces an odd effect when the coordinates are53 * This scaling produces an odd effect when the coordinates are
@@ -68,7 +70,7 @@ reshape (int w, int h)
68 S.ortho.min_y = S.ortho_min;70 S.ortho.min_y = S.ortho_min;
69 S.ortho.max_y = S.ortho_max;71 S.ortho.max_y = S.ortho_max;
70 }72 }
71 } 73 }
7274
73 set_ortho ();75 set_ortho ();
7476
diff --git a/src/model/geometry/map_geometry.c b/src/model/geometry/map_geometry.c
index 8bc79a3..c4c8db0 100644
--- a/src/model/geometry/map_geometry.c
+++ b/src/model/geometry/map_geometry.c
@@ -15,10 +15,9 @@ map_geometry (void)
15 glLoadName (i);15 glLoadName (i);
1616
17 // Draw the protein geometry.17 // Draw the protein geometry.
18 float* v = S.base_vertices_data + (i * 2);18 float *v = S.base_vertices_data + (i * 2);
19 glPushMatrix ();19 glPushMatrix ();
20 glTranslatef (*v,20 glTranslatef (*v, *(v + 1), 0.0);
21 *(v+1), 0.0);
22 glColor4fv (S.base_colors_data + (i * 4));21 glColor4fv (S.base_colors_data + (i * 4));
23 glCallList (S.list_offset + PROTEIN_GEOMETRY);22 glCallList (S.list_offset + PROTEIN_GEOMETRY);
24 glPopMatrix ();23 glPopMatrix ();
@@ -27,10 +26,9 @@ map_geometry (void)
27 if (S.selection.set[i])26 if (S.selection.set[i])
28 {27 {
29 glPushMatrix ();28 glPushMatrix ();
30 glTranslatef (*v,29 glTranslatef (*v, *(v + 1), 0.0);
31 *(v+1), 0.0);
32 glColor4f (0.5, 0.5, 0.5, 1.0);30 glColor4f (0.5, 0.5, 0.5, 1.0);
33 glCallList (S.list_offset + PROTEIN_SELECTED_GEOMETRY); 31 glCallList (S.list_offset + PROTEIN_SELECTED_GEOMETRY);
34 glPopMatrix ();32 glPopMatrix ();
35 }33 }
36 }34 }
diff --git a/src/model/state/pan_info_init.h b/src/model/state/pan_info_init.h
index f47b790..0d01659 100644
--- a/src/model/state/pan_info_init.h
+++ b/src/model/state/pan_info_init.h
@@ -3,6 +3,6 @@
33
4#include "pan_info.h"4#include "pan_info.h"
55
6void pan_info_init (PAN_INFO* p);6void pan_info_init (PAN_INFO * p);
77
8#endif // PAN_INFO_INIT_H8#endif // PAN_INFO_INIT_H
diff --git a/src/model/state/zoom_info_init.c b/src/model/state/zoom_info_init.c
index aa230d8..662c575 100644
--- a/src/model/state/zoom_info_init.c
+++ b/src/model/state/zoom_info_init.c
@@ -8,6 +8,6 @@ zoom_info_init (ZOOM_INFO * z)
8 z->coords[1] = 0.0;8 z->coords[1] = 0.0;
9 z->coords[2] = 0.0;9 z->coords[2] = 0.0;
10 z->coords[3] = 0.0;10 z->coords[3] = 0.0;
11 11
12 return;12 return;
13}13}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.