From ae6ce70b96395c1a73c5b1e2be498a18628c44e1 Mon Sep 17 00:00:00 2001 From: Don Pellegrino Date: Thu, 18 Jun 2009 21:13:44 +0000 Subject: Implemented zooming. --- diff --git a/src/model/exp004base.sqc b/src/model/exp004base.sqc index cbf2291..2742138 100644 --- a/src/model/exp004base.sqc +++ b/src/model/exp004base.sqc @@ -4,11 +4,12 @@ #include "exp004base.h" #include "../view/exp004state0.h" +#include "../util/check_error.h" #include #include #include - -EXEC SQL INCLUDE sqlca; +#include "sqlca.h" +extern struct sqlca sqlca; /* * A simple alias to make the code more readable. @@ -18,8 +19,6 @@ EXEC SQL INCLUDE sqlca; void exp004base (void) { - EXEC SQL CONNECT TO exp004; - /* * This implementation can be improved by mapping the video memory * directly rather than loading into system memory and then copying @@ -49,7 +48,7 @@ exp004base (void) EXEC SQL FETCH c2 INTO :coordinates; while (sqlca.sqlcode != 100) { - int i = coordinates.coord_id; + int i = coordinates.coord_id - 1; strncpy(S.gi_data[i], coordinates.gi.data, @@ -70,7 +69,7 @@ exp004base (void) /* * Deselected by default. */ - S.selection[i] = false; + S.selection.set[i] = false; S.base_colors_data[i][0] = DEFAULT_COLOR_R; S.base_colors_data[i][1] = DEFAULT_COLOR_G; diff --git a/src/model/exp004state.h b/src/model/exp004state.h index e3106ec..11e9ebd 100644 --- a/src/model/exp004state.h +++ b/src/model/exp004state.h @@ -1,7 +1,8 @@ #ifndef EXP004STATE_H #define EXP004STATE_H -#include +#include "selection_info.h" +#include "zoom_info.h" /* * Buffer object identifiers. @@ -9,11 +10,6 @@ #define BASE_VERTICES 0 #define BASE_COLORS 1 -/* - * Vertices in the graph. - */ -#define ROWS 83905 - #define DEFAULT_COLOR_R 0.5 #define DEFAULT_COLOR_G 0.5 #define DEFAULT_COLOR_B 0.5 @@ -88,31 +84,10 @@ typedef struct */ float base_colors_data[ROWS][4]; - /* - * Selection list. - */ - bool selection[ROWS]; - - /* - * Indicate if the user is currently defining a selection. - */ - bool selecting; - - /* - * X coordinate of mouse when selection mode initiated. - */ - int select_x; - - /* - * Y coordinate of mouse when selection mode initiated. - */ - int select_y; - - /* - * Indicate if a selection should be used for a new set or a zoom region. - */ - bool zoom; + SELECTION_INFO selection; + ZOOM_INFO zoom; + } EXP004STATE; #endif // EXP004STATE_H diff --git a/src/view/exp004init.c b/src/view/exp004init.c index fa4b2b0..97bd779 100644 --- a/src/view/exp004init.c +++ b/src/view/exp004init.c @@ -1,12 +1,15 @@ #include "exp004init.h" #include "exp004state0.h" +#include "../model/selection_info_init.h" +#include "../model/zoom_info_init.h" #define S exp004state0 void exp004init (void) { - S.zoom = false; + selection_info_init (&S.selection); + zoom_info_init (&S.zoom); return; } diff --git a/src/view/exp004view.c b/src/view/exp004view.c index aa6e966..cc27a93 100644 --- a/src/view/exp004view.c +++ b/src/view/exp004view.c @@ -2,6 +2,7 @@ #include "../controller/exp004mouse.h" #include "../controller/exp004reshape.h" #include "../controller/keyboard.h" +#include "../db/dbconnect.h" #include "../model/exp004base.h" #include "exp004init.h" #include "exp004view.h" @@ -10,6 +11,9 @@ void exp004view (void) { + // Connect to the database. + dbconnect (); + // GLUT Initialization glutInitWindowSize (500, 500); glutInitWindowPosition (100, 100); -- cgit v0.8.3.1-22-g547a