state update hooks are added by the main window
[lttv.git] / ltt / branches / poly / lttv / modules / guiControlFlow / Draw_Item.c
index 6dcf0a48004392e77a9eb50a8219afa452825c78..c73aee01c26dadb26e7a64e8f081382d1ecb91f9 100644 (file)
@@ -98,51 +98,49 @@ gboolean draw_text( void *hook_data, void *call_data)
 
        PangoContext *context;
        PangoLayout *layout;
+       PangoAttribute *attribute;
        PangoFontDescription *FontDesc;// = pango_font_description_new();
        gint Font_Size;
        PangoRectangle ink_rect;
                
-       gdk_gc_set_foreground(Draw_Context->gc, Properties->foreground);
-       gdk_gc_set_background(Draw_Context->gc, Properties->background);
+       layout = Draw_Context->pango_layout;
 
-       layout = gtk_widget_create_pango_layout(GTK_WIDGET(Draw_Context->drawable), NULL);
        context = pango_layout_get_context(layout);
        FontDesc = pango_context_get_font_description(context);
-       Font_Size = pango_font_description_get_size(FontDesc);
+
        pango_font_description_set_size(FontDesc, Properties->size*PANGO_SCALE);
-       
-       
+       pango_layout_context_changed(layout);
+
        pango_layout_set_text(layout, Properties->Text, -1);
        pango_layout_get_pixel_extents(layout, &ink_rect, NULL);
        switch(Properties->position) {
                case OVER:
-                                                       gdk_draw_layout(Draw_Context->drawable, Draw_Context->gc,
+                                                       gdk_draw_layout_with_colors(Draw_Context->drawable,
+                                                               Draw_Context->gc,
                                                                Draw_Context->Current->modify_over->x,
                                                                Draw_Context->Current->modify_over->y,
-                                                               layout);
+                                                               layout, Properties->foreground, Properties->background);
                                                        Draw_Context->Current->modify_over->x += ink_rect.width;
 
                        break;
                case MIDDLE:
-                                                       gdk_draw_layout(Draw_Context->drawable, Draw_Context->gc,
+                                                       gdk_draw_layout_with_colors(Draw_Context->drawable,
+                                                               Draw_Context->gc,
                                                                Draw_Context->Current->modify_middle->x,
                                                                Draw_Context->Current->modify_middle->y,
-                                                               layout);
+                                                               layout, Properties->foreground, Properties->background);
                                                        Draw_Context->Current->modify_middle->x += ink_rect.width;
                        break;
                case UNDER:
-                                                       gdk_draw_layout(Draw_Context->drawable, Draw_Context->gc,
+                                                       gdk_draw_layout_with_colors(Draw_Context->drawable,
+                                                               Draw_Context->gc,
                                                                Draw_Context->Current->modify_under->x,
                                                                Draw_Context->Current->modify_under->y,
-                                                               layout);
+                                                               layout, Properties->foreground, Properties->background);
                                                        Draw_Context->Current->modify_under->x += ink_rect.width;
                        break;
        }
 
-
-       pango_font_description_set_size(FontDesc, Font_Size);
-       g_free(layout);
-       
        return 0;
 }
 
@@ -237,8 +235,11 @@ 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);
+       //GdkGC *gc = gdk_gc_new(Draw_Context->drawable);
+       
+       //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_line_attributes(     Draw_Context->gc,
                                                                                                                        Properties->line_width,
                                                                                                                        Properties->style,
@@ -275,7 +276,9 @@ gboolean draw_line( void *hook_data, void *call_data)
 
                        break;
        }
-
+       
+       //gdk_gc_unref(gc);
+       
        return 0;
 }
 
@@ -284,7 +287,8 @@ 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_foreground(Draw_Context->gc, Properties->color);
+       gdk_gc_set_rgb_fg_color(Draw_Context->gc, Properties->color);
 
        switch(Properties->position) {
                case OVER:
@@ -293,7 +297,6 @@ gboolean draw_arc( void *hook_data, void *call_data)
                                                        Draw_Context->Current->modify_over->x,
                                                        Draw_Context->Current->modify_over->y,
                                                        Properties->size, Properties->size, 0, 360*64);
-                       g_critical("I draw arc over, x: %i, y: %i", Draw_Context->Current->modify_over->x, Draw_Context->Current->modify_over->y);
                        Draw_Context->Current->modify_over->x += Properties->size;
                        break;
                case MIDDLE:
@@ -325,7 +328,8 @@ 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_foreground(Draw_Context->gc, Properties->color);
+       gdk_gc_set_rgb_fg_color(Draw_Context->gc, Properties->color);
 
 
        gdk_draw_rectangle(Draw_Context->drawable, Draw_Context->gc,
This page took 0.025612 seconds and 4 git commands to generate.