return new_color;
}
+/*****************************************************************************/
+/* Convert canvas color into a GdkColor */
+/*****************************************************************************/
+GdkColor *
+gl_color_to_gdk_color (guint color)
+{
+ GdkColor *gdk_color;
+
+ gdk_color = g_new0 (GdkColor, 1);
+
+ gdk_color->red = GL_COLOR_F_RED (color) * 65535;
+ gdk_color->green = GL_COLOR_F_GREEN (color) * 65535;
+ gdk_color->blue = GL_COLOR_F_BLUE (color) * 65535;
+
+ return gdk_color;
+}
+
#define GL_COLOR_F_BLUE(x) ( (((x)>>8) & 0xff) / 255.0 )
#define GL_COLOR_F_ALPHA(x) ( ( (x) & 0xff) / 255.0 )
-guint gl_color_set_opacity (guint color, gdouble opacity);
+guint gl_color_set_opacity (guint color, gdouble opacity);
+
+GdkColor *gl_color_to_gdk_color (guint color);
G_END_DECLS
/* Private macros and constants. */
/*==========================================================================*/
+#define BG_COLOR GL_COLOR (192, 192, 192)
#define OUTLINE_COLOR GL_COLOR (173, 216, 230)
#define PAPER_COLOR GL_COLOR (255, 255, 255)
-#define GRID_COLOR GL_COLOR (192, 192, 192)
+#define GRID_COLOR BG_COLOR
#define MARKUP_COLOR GL_COLOR (240, 100, 100)
#define SEL_LINE_COLOR GL_COLOR_A (0, 0, 255, 128)
static GtkWidget *
gl_view_construct_canvas (glView *view)
{
- gdouble scale;
- glLabel *label = view->label;
- gdouble label_width, label_height;
+ gdouble scale;
+ glLabel *label = view->label;
+ gdouble label_width, label_height;
+ GdkColor *bg_color;
gl_debug (DEBUG_VIEW, "START");
view->canvas = gnome_canvas_new_aa ();
gtk_widget_pop_colormap ();
+ bg_color = gl_color_to_gdk_color (BG_COLOR);
+ gtk_widget_modify_bg (GTK_WIDGET(view->canvas), GTK_STATE_NORMAL, bg_color);
+ g_free (bg_color);
+
gl_label_get_size (label, &label_width, &label_height);
gl_debug (DEBUG_VIEW, "Label size: w=%lf, h=%lf",
label_width, label_height);