summaryrefslogtreecommitdiffstats
Side-by-side diff
-rw-r--r--src/Makefile.am14
-rw-r--r--src/controller/clear_selection.sqc2
-rw-r--r--src/controller/exp004processhits.c6
-rw-r--r--src/controller/exp004processhits.h2
-rw-r--r--src/controller/exp004reshape.c2
-rw-r--r--src/controller/selection_from_db.sqc2
-rw-r--r--src/model/exp004state.h3
-rw-r--r--src/model/geometry/density_legend_geometry.c (renamed from src/model/density_legend_geometry.c)4
-rw-r--r--src/model/geometry/density_legend_geometry.h (renamed from src/model/density_legend_geometry.h)0
-rw-r--r--src/model/geometry/map_geometry.c40
-rw-r--r--src/model/geometry/map_geometry.h (renamed from src/model/map_geometry.h)0
-rw-r--r--src/model/geometry/protein_geometry.c (renamed from src/model/protein_geometry.c)2
-rw-r--r--src/model/geometry/protein_geometry.h (renamed from src/model/protein_geometry.h)0
-rw-r--r--src/model/geometry/protein_selected_geometry.c30
-rw-r--r--src/model/geometry/protein_selected_geometry.h9
-rw-r--r--src/model/map_geometry.c27
-rw-r--r--src/model/selection_info_init.c2
-rw-r--r--src/view/exp004init.c8
18 files changed, 106 insertions, 47 deletions
diff --git a/src/model/geometry/density_legend_geometry.c b/src/model/geometry/density_legend_geometry.c
new file mode 100644
index 0000000..83f34d9
--- a/dev/null
+++ b/src/model/geometry/density_legend_geometry.c
@@ -0,0 +1,83 @@
+#include "density_legend_geometry.h"
+#include "../../view/exp004state0.h"
+#include "../../controller/exp004reshape.h"
+#include <GL/glut.h>
+
+#define S exp004state0
+
+void
+density_legend_geometry (void)
+{
+ glNewList (S.list_offset + DENSITY_LEGEND_GEOMETRY, GL_COMPILE);
+ glPolygonMode (GL_FRONT, GL_FILL);
+ glColor4f (DEFAULT_COLOR_R, DEFAULT_COLOR_G, DEFAULT_COLOR_B,
+ DEFAULT_COLOR_A);
+
+ /*
+ * Calculate the bounding box for the legend.
+ */
+
+ double a[2];
+ double b[2];
+ double c[2];
+ double d[2];
+
+ const double *left;
+ const double *right;
+ const double *top;
+ const double *bottom;
+
+ if (S.zoom.active)
+ {
+ left = &S.zoom.coords[0];
+ right = &S.zoom.coords[1];
+ bottom = &S.zoom.coords[2];
+ top = &S.zoom.coords[3];
+ }
+ else
+ {
+ left = &S.ortho.min_x;
+ right = &S.ortho.max_x;
+ bottom = &S.ortho.min_y;
+ top = &S.ortho.max_y;
+ }
+
+ /*
+ * This value should be a percentage of the world height so that it
+ * remains a fixed number of pixels tall when the window is resized
+ * or zoomed.
+ */
+ double legend_height = (*top - *bottom) / S.viewport.h * 10.0;
+
+ a[0] = *left;
+ a[1] = *top;
+ b[0] = *right;
+ b[1] = *top;
+ c[0] = *right;
+ c[1] = *top - legend_height;
+ d[0] = *left;
+ d[1] = *top - legend_height;
+
+ /*
+ * Overlay a legend from default saturation / alpha to full saturation.
+ */
+ for (int i = 1; i <= 1 / DEFAULT_COLOR_A; i++)
+ {
+ glBegin (GL_QUADS);
+ glVertex2dv (a);
+ glVertex2dv (b);
+ glVertex2dv (c);
+ glVertex2dv (d);
+ glEnd ();
+
+ /*
+ * Step left to right along the x-coordinate.
+ */
+ a[0] = *left + (*right - *left) * (DEFAULT_COLOR_A * i);
+ d[0] = a[0];
+ }
+
+ glEndList ();
+
+ return;
+}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.