color allocation fixed
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 12 Aug 2004 21:31:41 +0000 (21:31 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 12 Aug 2004 21:31:41 +0000 (21:31 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@719 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c
ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.c

index 64abc0bdf54e6578122a19af5da272d6bd955447..28934be2dc5f27b271f668e6d451bb903ed1b851 100644 (file)
@@ -858,6 +858,12 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data)
   gtk_widget_show(drawing->scrollbar);
   gtk_widget_show(drawing->hbox);
 
+  /* Allocate the colors */
+  GdkColormap* colormap = gdk_colormap_get_system();
+
+  gdk_colormap_alloc_colors(colormap, drawing_colors, NUM_COLORS, FALSE,
+                            TRUE, NULL);
+  
   
   return drawing;
 }
@@ -865,6 +871,14 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data)
 void drawing_destroy(Drawing_t *drawing)
 {
   g_info("drawing_destroy %p", drawing);
+
+  /* Free the colors */
+  GdkColormap* colormap = gdk_colormap_get_system();
+
+  gdk_colormap_free_colors(colormap, drawing_colors, NUM_COLORS);
+  
+
+
   // Do not unref here, Drawing_t destroyed by it's widget.
   //g_object_unref( G_OBJECT(drawing->drawing_area));
   if(drawing->gc != NULL)
index 7284a2e8185889605b2d137c16dca31dd8cc2298..f7dd664bd0784329bbc5713e009cb238e94720b7 100644 (file)
@@ -316,9 +316,8 @@ __inline gboolean draw_line( void *hook_data, void *call_data)
   PropertiesLine *properties = (PropertiesLine*)hook_data;
   DrawContext *draw_context = (DrawContext*)call_data;
   
-  //gdk_gc_set_foreground(draw_context->gc, properties->color);
-  gdk_gc_set_rgb_fg_color(draw_context->gc, &properties->color);
-  //gdk_gc_set_foreground(gc, properties->color);
+  gdk_gc_set_foreground(draw_context->gc, &properties->color);
+  //gdk_gc_set_rgb_fg_color(draw_context->gc, &properties->color);
   gdk_gc_set_line_attributes( draw_context->gc,
                               properties->line_width,
                               properties->style,
@@ -363,8 +362,8 @@ __inline gboolean draw_arc( void *hook_data, void *call_data)
   PropertiesArc *properties = (PropertiesArc*)hook_data;
   DrawContext *draw_context = (DrawContext*)call_data;
 
-  //gdk_gc_set_foreground(draw_context->gc, properties->color);
-  gdk_gc_set_rgb_fg_color(draw_context->gc, properties->color);
+  gdk_gc_set_foreground(draw_context->gc, properties->color);
+  //gdk_gc_set_rgb_fg_color(draw_context->gc, properties->color);
 
   gint x=0, y=0;
   gint *offset=NULL;
@@ -439,8 +438,8 @@ __inline gboolean draw_bg( void *hook_data, void *call_data)
   PropertiesBG *properties = (PropertiesBG*)hook_data;
   DrawContext *draw_context = (DrawContext*)call_data;
 
-  //gdk_gc_set_foreground(draw_context->gc, properties->color);
-  gdk_gc_set_rgb_fg_color(draw_context->gc, properties->color);
+  gdk_gc_set_foreground(draw_context->gc, properties->color);
+  //gdk_gc_set_rgb_fg_color(draw_context->gc, properties->color);
 
   //g_critical("DRAWING RECT : x: %i, y: %i, w:%i, h:%i, val1 :%i, val2:%i ", 
   //    draw_context->previous->over->x,
This page took 0.025378 seconds and 4 git commands to generate.