From 9f6858a940fa2dd7471d48bb110afa2749331530 Mon Sep 17 00:00:00 2001 From: compudj Date: Wed, 14 Jan 2004 02:43:49 +0000 Subject: [PATCH] finally got text color right git-svn-id: http://ltt.polymtl.ca/svn@377 04897980-b3bd-0310-b5e0-8ef037075253 --- .../lttv/modules/guiControlFlow/Draw_Item.c | 41 +++++-------------- .../lttv/modules/guiControlFlow/Drawing.c | 4 +- 2 files changed, 13 insertions(+), 32 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.c b/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.c index 6e5e41f9..f86edea7 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.c @@ -99,63 +99,44 @@ gboolean draw_text( void *hook_data, void *call_data) PangoContext *context; PangoLayout *layout; PangoAttribute *attribute; - PangoAttrList* attrib_list;// = pango_attr_list_new(); 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; + context = pango_layout_get_context(layout); FontDesc = pango_context_get_font_description(context); - attrib_list = pango_layout_get_attributes(layout); - if(attrib_list == NULL) - { - attrib_list = pango_attr_list_new(); - } + pango_font_description_set_size(FontDesc, Properties->size*PANGO_SCALE); pango_layout_context_changed(layout); - attribute = pango_attr_foreground_new(Properties->foreground->red, - Properties->foreground->green, - Properties->foreground->blue); - //pango_attr_list_change(attrib_list, attribute); - pango_attr_list_change(attrib_list, attribute); - //pango_attribute_destroy(attribute); - attribute = pango_attr_background_new(Properties->background->red, - Properties->background->green, - Properties->background->blue); - pango_attr_list_change(attrib_list, attribute); - pango_layout_set_attributes(layout, attrib_list); - - //pango_attr_list_unref(attrib_list); - pango_layout_set_text(layout, Properties->Text, -1); pango_layout_get_pixel_extents(layout, &ink_rect, NULL); - pango_layout_context_changed(layout); 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; } diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c b/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c index 2235c121..e10534fd 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c @@ -105,8 +105,8 @@ void drawing_data_request(Drawing_t *Drawing, //LttvHooks *event = lttv_hooks_new(); LttvHooks *after_event = lttv_hooks_new(); - state_add_event_hooks_api(control_flow_data->Parent_Window); //lttv_hooks_add(event, draw_event_hook, &event_request); + state_add_event_hooks_api(control_flow_data->Parent_Window); lttv_hooks_add(after_event, draw_after_hook, &event_request); lttv_process_traceset_seek_time(tsc, start); @@ -116,8 +116,8 @@ void drawing_data_request(Drawing_t *Drawing, lttv_process_traceset(tsc, end, G_MAXULONG); lttv_traceset_context_remove_hooks(tsc, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,after_event); - state_remove_event_hooks_api(control_flow_data->Parent_Window); + //lttv_hooks_destroy(event); lttv_hooks_destroy(after_event); } -- 2.34.1