From 8af3b6fb74db30540bc877049ca795fc2428f383 Mon Sep 17 00:00:00 2001 From: Don Pellegrino Date: Mon, 17 Aug 2009 16:59:55 +0000 Subject: Refactored the controller package into separate actions and callbacks. Design justification added as a README to the controller subdirectory. --- diff --git a/src/Makefile.am b/src/Makefile.am index 3bb95ee..1ccb4f8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,17 +1,18 @@ bin_PROGRAMS = exp004viz exp004viz_SOURCES = \ - controller/clear_selection.c \ - controller/exp004display.c \ - controller/exp004mouse.c \ - controller/exp004processhits.c \ - controller/exp004reshape.c \ - controller/keyboard.c \ - controller/mousewheel.c \ - controller/performzoom.c \ - controller/selection_from_db.c \ - controller/selsave.c \ - controller/set_ortho.c \ + controller/actions/clear_selection.c \ + controller/actions/pan.c \ + controller/actions/process_hits.c \ + controller/actions/sel_save.c \ + controller/actions/selection_from_db.c \ + controller/actions/set_ortho.c \ + controller/actions/zoom.c \ + controller/callbacks/display.c \ + controller/callbacks/keyboard.c \ + controller/callbacks/mouse.c \ + controller/callbacks/mouse_wheel.c \ + controller/callbacks/reshape.c \ db/dbconnect.c \ exp004viz.c \ model/exp004base.c \ @@ -32,24 +33,26 @@ exp004viz_SOURCES = \ exp004viz_LDADD = ${GLUT_LIBS} noinst_HEADERS = \ - controller/clear_selection.h \ - controller/exp004display.h \ - controller/exp004mouse.h \ - controller/exp004processhits.h \ - controller/exp004reshape.h \ - controller/keyboard.h \ - controller/mousewheel.h \ - controller/performzoom.h \ - controller/selection_from_db.h \ - controller/selsave.h \ - controller/set_ortho.h \ + controller/actions/clear_selection.h \ + controller/actions/pan.h \ + controller/actions/process_hits.h \ + controller/actions/sel_save.h \ + controller/actions/selection_from_db.h \ + controller/actions/set_ortho.h \ + controller/actions/vis_sel_set.h \ + controller/actions/zoom.h \ + controller/callbacks/display.h \ + controller/callbacks/keyboard.h \ + controller/callbacks/mouse.h \ + controller/callbacks/mouse_wheel.h \ + controller/callbacks/reshape.h \ db/dbconnect.h \ model/exp004base.h \ model/exp004state.h \ model/geometry/density_legend_geometry.h \ + model/geometry/map_geometry.h \ model/geometry/protein_geometry.h \ model/geometry/protein_selected_geometry.h \ - model/geometry/map_geometry.h \ model/selection_info.h \ model/selection_info_init.h \ model/selection_purposes.h \ @@ -79,8 +82,8 @@ AM_CFLAGS = -Wall -ggdb -std=gnu99 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_S db2 PRECOMPILE $<; CLEANFILES = \ - controller/clear_selection.c \ - controller/selection_from_db.c \ - controller/selsave.c \ + controller/actions/clear_selection.c \ + controller/actions/selection_from_db.c \ + controller/actions/sel_save.c \ db/dbconnect.c \ model/exp004base.c diff --git a/src/controller/README_controller.txt b/src/controller/README_controller.txt new file mode 100644 index 0000000..c9e7f83 --- a/dev/null +++ b/src/controller/README_controller.txt @@ -0,0 +1,18 @@ +The controller is split into two sections. The callbacks subdirectory +contains the functions that are used as callbacks from the GLUT event +loop. The actions subdirectory contains functions that operate on the +data and state. To the extent possible callbacks should be empty +shells that transform information from hardware and the event loop to +the calling parameters of actions. This design has the advantage of +facilitating the scripting of user actions in the future. A script +should be able to call action functions and generate equivalent +behaviors as if the user had initiated the sequences of actions using +the user interface. Another advantage is that multiple user interface +callbacks can share the same actions. A common example of this is the +execution of the same function through either a menu selection +callback or a toolbar callback. As per the "GNU Coding Standards" +section "5.4 Naming Variables, Functions, and Files +[http://www.gnu.org/prep/standards/html_node/Names.html#Names]" +underscores should be used to separate words in a name. + + LocalWords: callbacks callback diff --git a/src/controller/clear_selection.h b/src/controller/actions/clear_selection.h index c57e358..c57e358 100644 --- a/src/controller/clear_selection.h +++ b/src/controller/actions/clear_selection.h diff --git a/src/controller/clear_selection.sqc b/src/controller/actions/clear_selection.sqc index 4549c22..e527c30 100644 --- a/src/controller/clear_selection.sqc +++ b/src/controller/actions/clear_selection.sqc @@ -1,7 +1,7 @@ #define GL_GLEXT_PROTOTYPES #include "clear_selection.h" -#include "../model/geometry/map_geometry.h" -#include "../view/exp004state0.h" +#include "../../model/geometry/map_geometry.h" +#include "../../view/exp004state0.h" #include #include "sqlca.h" extern struct sqlca sqlca; diff --git a/src/controller/actions/pan.c b/src/controller/actions/pan.c new file mode 100644 index 0000000..cdc5cad --- a/dev/null +++ b/src/controller/actions/pan.c @@ -0,0 +1,8 @@ +#include "pan.h" + +void +pan () +{ + + return; +} diff --git a/src/controller/actions/pan.h b/src/controller/actions/pan.h new file mode 100644 index 0000000..18ac876 --- a/dev/null +++ b/src/controller/actions/pan.h @@ -0,0 +1,9 @@ +#ifndef PAN_H +#define PAN_H + +/* + * Pan around the geometry. + */ +void pan (); + +#endif // PAN_H diff --git a/src/controller/exp004processhits.c b/src/controller/actions/process_hits.c index c51e170..4a76d1c 100644 --- a/src/controller/exp004processhits.c +++ b/src/controller/actions/process_hits.c @@ -1,8 +1,8 @@ #define GL_GLEXT_PROTOTYPES -#include "../view/exp004state0.h" -#include "../model/geometry/map_geometry.h" -#include "exp004processhits.h" -#include "selsave.h" +#include "../../view/exp004state0.h" +#include "../../model/geometry/map_geometry.h" +#include "process_hits.h" +#include "sel_save.h" /* * A simple alias to make the code more readable. @@ -14,7 +14,7 @@ * [Angel,2008,pp80-81]. */ void -exp004processhits (const GLint hits, const GLuint * hitlist) +process_hits (const GLint hits, const GLuint * hitlist) { for (unsigned int i = 0; i < hits; i++) { @@ -28,7 +28,7 @@ exp004processhits (const GLint hits, const GLuint * hitlist) hitlist++; } - selsave (); + sel_save (); glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]); glColorPointer (4, GL_FLOAT, 0, 0); diff --git a/src/controller/actions/process_hits.h b/src/controller/actions/process_hits.h new file mode 100644 index 0000000..d664a6e --- a/dev/null +++ b/src/controller/actions/process_hits.h @@ -0,0 +1,8 @@ +#ifndef PROCESS_HITS_H +#define PROCESS_HITS_H + +#include + +void process_hits (const GLint hits, const GLuint * hitlist); + +#endif // PROCESS_HITS_H diff --git a/src/controller/actions/sel_save.c b/src/controller/actions/sel_save.c new file mode 100644 index 0000000..424f101 --- a/dev/null +++ b/src/controller/actions/sel_save.c @@ -0,0 +1,141 @@ +static char sqla_program_id[292] = +{ + 172,0,65,69,65,78,65,73,108,65,118,119,77,82,73,90,48,49,49,49, + 49,32,50,32,32,32,32,32,32,32,32,32,8,0,68,79,78,32,32,32, + 32,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,8,0,83,69,76,95,83,65,86,69,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0 +}; + +#include "sqladef.h" + +static struct sqla_runtime_info sqla_rtinfo = +{{'S','Q','L','A','R','T','I','N'}, sizeof(wchar_t), 0, {' ',' ',' ',' '}}; + + +static const short sqlIsLiteral = SQL_IS_LITERAL; +static const short sqlIsInputHvar = SQL_IS_INPUT_HVAR; + + +#line 1 "sel_save.sqc" +#include "../../util/check_error.h" +#include "../../view/exp004state0.h" +#include "sel_save.h" +#include "sqlca.h" +#include +extern struct sqlca sqlca; + +/* + * A simple alias to make the code more readable. + */ +#define S exp004state0 + +void +sel_save (void) +{ + +/* +EXEC SQL BEGIN DECLARE SECTION; +*/ + +#line 16 "sel_save.sqc" + + char gi[255]; + +/* +EXEC SQL END DECLARE SECTION; +*/ + +#line 18 "sel_save.sqc" + + + /* + * WHERE gi IS NOT NULL is added to prevent the PRECOMPILE command + * from throwing a warning about modifying an entire table. Since + * gi is defined as NOT NULL this will clear the entire table. + */ + +/* +EXEC SQL DELETE FROM vis_selection WHERE gi IS NOT NULL; +*/ + +{ +#line 25 "sel_save.sqc" + sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); +#line 25 "sel_save.sqc" + sqlacall((unsigned short)24,1,0,0,0L); +#line 25 "sel_save.sqc" + sqlastop(0L); +} + +#line 25 "sel_save.sqc" + + check_error (__FILE__, __LINE__); + + for (unsigned int i = 0; i < S.rows; i++) + { + if (S.selection.set[i] == true) + { + strncpy (gi, S.gi_data + i + 3, sizeof (gi)); + +/* +EXEC SQL INSERT INTO vis_selection VALUES (:gi); +*/ + +{ +#line 33 "sel_save.sqc" + sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); +#line 33 "sel_save.sqc" + sqlaaloc(2,1,1,0L); + { + struct sqla_setdata_list sql_setdlist[1]; +#line 33 "sel_save.sqc" + sql_setdlist[0].sqltype = 460; sql_setdlist[0].sqllen = 255; +#line 33 "sel_save.sqc" + sql_setdlist[0].sqldata = (void*)gi; +#line 33 "sel_save.sqc" + sql_setdlist[0].sqlind = 0L; +#line 33 "sel_save.sqc" + sqlasetdata(2,0,1,sql_setdlist,0L,0L); + } +#line 33 "sel_save.sqc" + sqlacall((unsigned short)24,2,2,0,0L); +#line 33 "sel_save.sqc" + sqlastop(0L); +} + +#line 33 "sel_save.sqc" + + } + } + + +/* +EXEC SQL COMMIT; +*/ + +{ +#line 37 "sel_save.sqc" + sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); +#line 37 "sel_save.sqc" + sqlacall((unsigned short)21,0,0,0,0L); +#line 37 "sel_save.sqc" + sqlastop(0L); +} + +#line 37 "sel_save.sqc" + + check_error (__FILE__, __LINE__); + + return; +} diff --git a/src/controller/actions/sel_save.h b/src/controller/actions/sel_save.h new file mode 100644 index 0000000..11b5785 --- a/dev/null +++ b/src/controller/actions/sel_save.h @@ -0,0 +1,9 @@ +#ifndef SEL_SAVE_H +#define SEL_SAVE_H + +/* + * Send the current selection from memory to the database. + */ +void sel_save (void); + +#endif // SEL_SAVE_H diff --git a/src/controller/selsave.sqc b/src/controller/actions/sel_save.sqc index 8c192ad..5fa614f 100644 --- a/src/controller/selsave.sqc +++ b/src/controller/actions/sel_save.sqc @@ -1,6 +1,6 @@ -#include "../util/check_error.h" -#include "../view/exp004state0.h" -#include "selsave.h" +#include "../../util/check_error.h" +#include "../../view/exp004state0.h" +#include "sel_save.h" #include "sqlca.h" #include extern struct sqlca sqlca; @@ -11,7 +11,7 @@ extern struct sqlca sqlca; #define S exp004state0 void -selsave (void) +sel_save (void) { EXEC SQL BEGIN DECLARE SECTION; char gi[255]; diff --git a/src/controller/selection_from_db.h b/src/controller/actions/selection_from_db.h index 8f0d8a2..8f0d8a2 100644 --- a/src/controller/selection_from_db.h +++ b/src/controller/actions/selection_from_db.h diff --git a/src/controller/selection_from_db.sqc b/src/controller/actions/selection_from_db.sqc index f847e16..442f7c2 100644 --- a/src/controller/selection_from_db.sqc +++ b/src/controller/actions/selection_from_db.sqc @@ -1,8 +1,8 @@ #define GL_GLEXT_PROTOTYPES #include "selection_from_db.h" -#include "../model/geometry/map_geometry.h" -#include "../view/exp004state0.h" -#include "../util/check_error.h" +#include "../../model/geometry/map_geometry.h" +#include "../../view/exp004state0.h" +#include "../../util/check_error.h" #include #include "sqlca.h" extern struct sqlca sqlca; @@ -19,7 +19,7 @@ selection_from_db (void) * db2dclgn -d exp004 -t vis_sel_set */ EXEC SQL BEGIN DECLARE SECTION; - EXEC SQL INCLUDE 'controller/vis_sel_set.h'; + EXEC SQL INCLUDE 'controller/actions/vis_sel_set.h'; EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE c3 CURSOR FOR diff --git a/src/controller/set_ortho.h b/src/controller/actions/set_ortho.h index 4e95330..4e95330 100644 --- a/src/controller/set_ortho.h +++ b/src/controller/actions/set_ortho.h diff --git a/src/controller/vis_sel_set.h b/src/controller/actions/vis_sel_set.h index 5df08f1..5df08f1 100644 --- a/src/controller/vis_sel_set.h +++ b/src/controller/actions/vis_sel_set.h diff --git a/src/controller/performzoom.c b/src/controller/actions/zoom.c index 2fed1d2..e33dcb8 100644 --- a/src/controller/performzoom.c +++ b/src/controller/actions/zoom.c @@ -1,7 +1,7 @@ -#include "performzoom.h" -#include "exp004reshape.h" -#include "../util/check_error.h" -#include "../view/exp004state0.h" +#include "zoom.h" +#include "../callbacks/reshape.h" +#include "../../util/check_error.h" +#include "../../view/exp004state0.h" #include #include @@ -11,7 +11,7 @@ #define S exp004state0 void -performzoom (int x1, int y1, int x2, int y2) +zoom (int x1, int y1, int x2, int y2) { /* * Convert the selection boundary from window coordinates to @@ -57,7 +57,7 @@ performzoom (int x1, int y1, int x2, int y2) S.zoom.coords[2] = fmin (start_position[1], end_position[1]); S.zoom.coords[3] = fmax (start_position[1], end_position[1]); - exp004reshape (S.viewport.w, S.viewport.h); + reshape (S.viewport.w, S.viewport.h); glutPostRedisplay (); diff --git a/src/controller/actions/zoom.h b/src/controller/actions/zoom.h new file mode 100644 index 0000000..bd5b852 --- a/dev/null +++ b/src/controller/actions/zoom.h @@ -0,0 +1,9 @@ +#ifndef ZOOM_H +#define ZOOM_H + +/* + * Perform a zoom operation. + */ +void zoom (int x1, int y1, int x2, int y2); + +#endif // ZOOM_H diff --git a/src/controller/exp004display.c b/src/controller/callbacks/display.c index dd9c387..68211b5 100644 --- a/src/controller/exp004display.c +++ b/src/controller/callbacks/display.c @@ -1,11 +1,9 @@ -#include "exp004display.h" -#include "../view/exp004geometry.h" +#include "display.h" +#include "../../view/exp004geometry.h" #include -#define WINHEIGHT 500 - void -exp004display (void) +display (void) { glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); exp004geometry (GL_RENDER); diff --git a/src/controller/callbacks/display.h b/src/controller/callbacks/display.h new file mode 100644 index 0000000..a57ba8f --- a/dev/null +++ b/src/controller/callbacks/display.h @@ -0,0 +1,9 @@ +#ifndef DISPLAY_H +#define DISPLAY_H + +/* + * Draw the contents of the window. + */ +void display (void); + +#endif // DISPLAY_H diff --git a/src/controller/keyboard.c b/src/controller/callbacks/keyboard.c index 99a20d0..1187bce 100644 --- a/src/controller/keyboard.c +++ b/src/controller/callbacks/keyboard.c @@ -1,8 +1,8 @@ #include "keyboard.h" -#include "clear_selection.h" -#include "selection_from_db.h" -#include "exp004reshape.h" -#include "../view/exp004state0.h" +#include "../actions/clear_selection.h" +#include "../actions/selection_from_db.h" +#include "reshape.h" +#include "../../view/exp004state0.h" #include #define S exp004state0 @@ -43,7 +43,7 @@ keyboard (unsigned char key, int x, int y) * Reset the view (unzoom). */ S.zoom.active = false; - exp004reshape (S.viewport.w, S.viewport.h); + reshape (S.viewport.w, S.viewport.h); glutPostRedisplay (); break; diff --git a/src/controller/keyboard.h b/src/controller/callbacks/keyboard.h index c01fc5f..c01fc5f 100644 --- a/src/controller/keyboard.h +++ b/src/controller/callbacks/keyboard.h diff --git a/src/controller/exp004mouse.c b/src/controller/callbacks/mouse.c index cf09bef..fc48eff 100644 --- a/src/controller/exp004mouse.c +++ b/src/controller/callbacks/mouse.c @@ -1,12 +1,12 @@ -#include "exp004mouse.h" -#include "exp004processhits.h" -#include "exp004reshape.h" -#include "performzoom.h" -#include "set_ortho.h" -#include "../view/exp004geometry.h" -#include "../view/exp004state0.h" -#include "../util/check_error.h" -#include "../util/pick_convert.h" +#include "../../util/check_error.h" +#include "../../util/pick_convert.h" +#include "../../view/exp004geometry.h" +#include "../../view/exp004state0.h" +#include "../actions/process_hits.h" +#include "../actions/set_ortho.h" +#include "../actions/zoom.h" +#include "mouse.h" +#include "reshape.h" #include #include #include @@ -17,7 +17,7 @@ #define S exp004state0 void -exp004mouse (int button, int state, int x, int y) +mouse (int button, int state, int x, int y) { if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) { @@ -32,16 +32,10 @@ exp004mouse (int button, int state, int x, int y) GLint viewport[4]; glGetIntegerv (GL_VIEWPORT, viewport); - printf ("Zooming to: %i, %i, %i, %i\n", - S.selection.x, - viewport[3] - S.selection.y, - x, - viewport[3] - y); - - performzoom (S.selection.x, - viewport[3] - S.selection.y, - x, - viewport[3] - y); + zoom (S.selection.x, + viewport[3] - S.selection.y, + x, + viewport[3] - y); } /* @@ -114,7 +108,7 @@ exp004mouse (int button, int state, int x, int y) check_error (__FILE__, __LINE__); /* "process hits from selection mode rendering [Angel,2008]." */ - exp004processhits (hits, select_buf); + process_hits (hits, select_buf); /* "normal render [Angel,2008]." */ glutPostRedisplay (); diff --git a/src/controller/callbacks/mouse.h b/src/controller/callbacks/mouse.h new file mode 100644 index 0000000..2dfc838 --- a/dev/null +++ b/src/controller/callbacks/mouse.h @@ -0,0 +1,9 @@ +#ifndef MOUSE_H +#define MOUSE_H + +/* + * Handle events generated by the mouse. + */ +void mouse (int button, int state, int x, int y); + +#endif // MOUSE_H diff --git a/src/controller/mousewheel.c b/src/controller/callbacks/mouse_wheel.c index c9ac742..52d3c8b 100644 --- a/src/controller/mousewheel.c +++ b/src/controller/callbacks/mouse_wheel.c @@ -1,9 +1,9 @@ -#include "mousewheel.h" -#include "performzoom.h" +#include "mouse_wheel.h" +#include "../actions/zoom.h" #include void -mousewheel (int button, int dir, int x, int y) +mouse_wheel (int button, int dir, int x, int y) { /* * Get the current coordinates, substract some fixed amount and @@ -26,19 +26,19 @@ mousewheel (int button, int dir, int x, int y) // Zoom in if (dir > 0) { - performzoom (step, - step, - viewport[3] - step, - viewport[3] - step); + zoom (step, + step, + viewport[3] - step, + viewport[3] - step); } // Zoom out else { - performzoom (-step, - -step, - viewport[3] + step, - viewport[3] + step); + zoom (-step, + -step, + viewport[3] + step, + viewport[3] + step); } return; diff --git a/src/controller/mousewheel.h b/src/controller/callbacks/mouse_wheel.h index a3944d0..8f6a57d 100644 --- a/src/controller/mousewheel.h +++ b/src/controller/callbacks/mouse_wheel.h @@ -1,11 +1,11 @@ -#ifndef MOUSEWHEEL_H -#define MOUSEWHEEL_H +#ifndef MOUSE_WHEEL_H +#define MOUSE_WHEEL_H /* * GLUT callback to be called whenever the scroll wheel is scrolled. * Based on code from Ashwin at * http://stackoverflow.com/questions/14378/using-the-mouse-scrollwheel-in-glut/14444. */ -void mousewheel (int, int, int, int); +void mouse_wheel (int, int, int, int); -#endif // MOUSEWHEEL_H +#endif // MOUSE_WHEEL_H diff --git a/src/controller/exp004reshape.c b/src/controller/callbacks/reshape.c index a127e46..da2e2bf 100644 --- a/src/controller/exp004reshape.c +++ b/src/controller/callbacks/reshape.c @@ -1,13 +1,13 @@ -#include "exp004reshape.h" -#include "set_ortho.h" -#include "../view/exp004state0.h" -#include "../model/geometry/density_legend_geometry.h" +#include "../../model/geometry/density_legend_geometry.h" +#include "../../view/exp004state0.h" +#include "../actions/set_ortho.h" +#include "reshape.h" #include #define S exp004state0 void -exp004reshape (int w, int h) +reshape (int w, int h) { glMatrixMode (GL_PROJECTION); glLoadIdentity (); diff --git a/src/controller/callbacks/reshape.h b/src/controller/callbacks/reshape.h new file mode 100644 index 0000000..8a829b4 --- a/dev/null +++ b/src/controller/callbacks/reshape.h @@ -0,0 +1,6 @@ +#ifndef RESHAPE_H +#define RESHAPE_H + +void reshape (int w, int h); + +#endif // RESHAPE_H diff --git a/src/controller/exp004display.h b/src/controller/exp004display.h deleted file mode 100644 index 6a5f9f7..0000000 --- a/src/controller/exp004display.h +++ b/dev/null @@ -1,6 +0,0 @@ -#ifndef EXP004DISPLAY_H -#define EXP004DISPLAY_H - -void exp004display (void); - -#endif // EXP004DISPLAY_H diff --git a/src/controller/exp004mouse.h b/src/controller/exp004mouse.h deleted file mode 100644 index a6809be..0000000 --- a/src/controller/exp004mouse.h +++ b/dev/null @@ -1,6 +0,0 @@ -#ifndef EXP004MOUSE_H -#define EXP004MOUSE_H - -void exp004mouse (int button, int state, int x, int y); - -#endif // EXP004MOUSE_H diff --git a/src/controller/exp004processhits.h b/src/controller/exp004processhits.h deleted file mode 100644 index 0cc9e4b..0000000 --- a/src/controller/exp004processhits.h +++ b/dev/null @@ -1,8 +0,0 @@ -#ifndef EXP004PROCESSHITS_H -#define EXP004PROCESSHITS_H - -#include - -void exp004processhits (const GLint hits, const GLuint * hitlist); - -#endif // EXP004PROCESSHITS_H diff --git a/src/controller/exp004reshape.h b/src/controller/exp004reshape.h deleted file mode 100644 index 3bb20a5..0000000 --- a/src/controller/exp004reshape.h +++ b/dev/null @@ -1,6 +0,0 @@ -#ifndef EXP004RESHAPE_H -#define EXP004RESHAPE_H - -void exp004reshape (int w, int h); - -#endif // EXP004RESHAPE_H diff --git a/src/controller/performzoom.h b/src/controller/performzoom.h deleted file mode 100644 index 323cc20..0000000 --- a/src/controller/performzoom.h +++ b/dev/null @@ -1,9 +0,0 @@ -#ifndef PERFORMZOOM_H -#define PERFORMZOOM_H - -/* - * Perform a zoom operation. - */ -void performzoom (int x1, int y1, int x2, int y2); - -#endif // PERFORMZOOM_H diff --git a/src/controller/selsave.h b/src/controller/selsave.h deleted file mode 100644 index f5b8fa7..0000000 --- a/src/controller/selsave.h +++ b/dev/null @@ -1,9 +0,0 @@ -#ifndef SELSAVE_H -#define SELSAVE_H - -/* - * Send the current selection from memory to the database. - */ -void selsave (void); - -#endif // SELSAVE_H diff --git a/src/controller/set_ortho.c b/src/controller/set_ortho.c deleted file mode 100644 index 6478d21..0000000 --- a/src/controller/set_ortho.c +++ b/dev/null @@ -1,21 +0,0 @@ -#include "set_ortho.h" -#include "../view/exp004state0.h" -#include - -#define S exp004state0 - -void -set_ortho (void) -{ - if (S.zoom.active) - { - gluOrtho2D (S.zoom.coords[0], - S.zoom.coords[1], S.zoom.coords[2], S.zoom.coords[3]); - } - else - { - gluOrtho2D (S.ortho.min_x, S.ortho.max_x, S.ortho.min_y, S.ortho.max_y); - } - - return; -} diff --git a/src/model/geometry/density_legend_geometry.c b/src/model/geometry/density_legend_geometry.c index 83f34d9..ed34b8d 100644 --- a/src/model/geometry/density_legend_geometry.c +++ b/src/model/geometry/density_legend_geometry.c @@ -1,6 +1,6 @@ -#include "density_legend_geometry.h" +#include "../../controller/callbacks/reshape.h" #include "../../view/exp004state0.h" -#include "../../controller/exp004reshape.h" +#include "density_legend_geometry.h" #include #define S exp004state0 diff --git a/src/view/exp004view.c b/src/view/exp004view.c index 434c016..b16597d 100644 --- a/src/view/exp004view.c +++ b/src/view/exp004view.c @@ -1,8 +1,8 @@ -#include "../controller/exp004display.h" -#include "../controller/exp004mouse.h" -#include "../controller/exp004reshape.h" -#include "../controller/keyboard.h" -#include "../controller/mousewheel.h" +#include "../controller/callbacks/display.h" +#include "../controller/callbacks/keyboard.h" +#include "../controller/callbacks/mouse.h" +#include "../controller/callbacks/mouse_wheel.h" +#include "../controller/callbacks/reshape.h" #include "../db/dbconnect.h" #include "exp004init.h" #include "exp004state0.h" @@ -44,12 +44,12 @@ exp004view (void) // Initialize the model. exp004init (); - // Callbacks (Controllers) - glutDisplayFunc (exp004display); + // Callbacks + glutDisplayFunc (display); glutKeyboardFunc (keyboard); - glutMouseFunc (exp004mouse); - glutMouseWheelFunc (mousewheel); - glutReshapeFunc (exp004reshape); + glutMouseFunc (mouse); + glutMouseWheelFunc (mouse_wheel); + glutReshapeFunc (reshape); return; } -- cgit v0.8.3.1-22-g547a