show text : running state
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 10 Jan 2004 22:22:50 +0000 (22:22 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 10 Jan 2004 22:22:50 +0000 (22:22 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@372 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.c
ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.h
ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c
ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.h
ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c
ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.c

index 72536e7fe46fb5e572001ff2d5a2bfee4886e336..eccfef0fea5f876b46b58ab4c06bd5c499d28020 100644 (file)
@@ -105,13 +105,11 @@ gboolean draw_text( void *hook_data, void *call_data)
        gdk_gc_set_foreground(Draw_Context->gc, Properties->foreground);
        gdk_gc_set_background(Draw_Context->gc, Properties->background);
 
-       layout = gtk_widget_create_pango_layout(GTK_WIDGET(Draw_Context->drawable), NULL);
+       layout = Draw_Context->pango_layout;
        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_set_text(layout, Properties->Text, -1);
        pango_layout_get_pixel_extents(layout, &ink_rect, NULL);
        switch(Properties->position) {
@@ -139,10 +137,6 @@ gboolean draw_text( void *hook_data, void *call_data)
                        break;
        }
 
-
-       pango_font_description_set_size(FontDesc, Font_Size);
-       g_free(layout);
-       
        return 0;
 }
 
index de3a51c1dbb744fd8204a00501382bd409965900..6c35e97769baa470b0d89fcc5d9ec6d5d633abaa 100644 (file)
@@ -44,7 +44,7 @@ typedef enum _RelPos {
 struct _DrawContext {
        GdkDrawable     *drawable;
        GdkGC           *gc;
-       
+       PangoLayout *pango_layout;
 
        DrawInfo        *Current;
        DrawInfo        *Previous;
index ea056ff06ca5ac324a09f26676bd6e6f28e87f61..8f35e071138b6cb87c36dbb7e08c9c4f225b1655 100644 (file)
@@ -278,6 +278,9 @@ Drawing_t *drawing_construct(ControlFlowData *Control_Flow_Data)
        Drawing->Drawing_Area_V = gtk_drawing_area_new ();
        Drawing->Control_Flow_Data = Control_Flow_Data;
 
+       Drawing->pango_layout =
+               gtk_widget_create_pango_layout(Drawing->Drawing_Area_V, NULL);
+       
        //gtk_widget_set_size_request(Drawing->Drawing_Area_V->window, 50, 50);
        g_object_set_data_full(
                        G_OBJECT(Drawing->Drawing_Area_V),
@@ -327,6 +330,7 @@ void drawing_destroy(Drawing_t *Drawing)
        // Do not unref here, Drawing_t destroyed by it's widget.
        //g_object_unref( G_OBJECT(Drawing->Drawing_Area_V));
                
+       g_free(Drawing->pango_layout);
        g_free(Drawing);
 }
 
index f225e225525c65b4ef2a148fc77d8c11f79eab8d..d2aa0a6ab137aa72d2297dea5b58b6c61e983cd3 100644 (file)
@@ -39,9 +39,11 @@ struct _Drawing_t {
        GtkWidget       *Drawing_Area_V;
        GdkPixmap       *Pixmap;
        ControlFlowData *Control_Flow_Data;
+       
+       PangoLayout *pango_layout;
 
        gint            height, width, depth;
-
+       
 };
 
 Drawing_t *drawing_construct(ControlFlowData *Control_Flow_Data);
index de41f0c64cc01948438bab4a23eb0724aa98f445..0a103d6699345c5469a0b59fc3f4714714352205 100644 (file)
@@ -585,16 +585,45 @@ int draw_event_hook(void *hook_data, void *call_data)
        prop_arc.size = 10;
        prop_arc.filled = TRUE;
        prop_arc.position = OVER;
+
        DrawContext *draw_context = Hashed_Process_Data->draw_context;
        draw_context->Current->modify_over->x = x;
        draw_context->Current->modify_over->y = y;
        draw_context->drawable = control_flow_data->Drawing->Pixmap;
+       draw_context->pango_layout = control_flow_data->Drawing->pango_layout;
        GtkWidget *widget = control_flow_data->Drawing->Drawing_Area_V;
        //draw_context->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
        draw_context->gc = widget->style->black_gc;
        
-       draw_arc((void*)&prop_arc, (void*)draw_context);
+       //draw_arc((void*)&prop_arc, (void*)draw_context);
        //test_draw_item(control_flow_data->Drawing, control_flow_data->Drawing->Pixmap);
+       
+       GdkColor colorfg = { 0, 0x0000, 0x0000, 0x0000 };
+       GdkColor colorbg = { 0, 0xffff, 0x0000, 0xffff };
+       PropertiesText prop_text;
+       prop_text.foreground = &colorfg;
+       prop_text.background = &colorbg;
+       prop_text.size = 10;
+       prop_text.position = OVER;
+
+       /* Print status of the process : U, WF, WC, E, W, R */
+       if(tfs->process->state->s == LTTV_STATE_UNNAMED)
+               prop_text.Text = "U";
+       else if(tfs->process->state->s == LTTV_STATE_WAIT_FORK)
+               prop_text.Text = "WF";
+       else if(tfs->process->state->s == LTTV_STATE_WAIT_CPU)
+               prop_text.Text = "WC";
+       else if(tfs->process->state->s == LTTV_STATE_EXIT)
+               prop_text.Text = "E";
+       else if(tfs->process->state->s == LTTV_STATE_WAIT)
+               prop_text.Text = "W";
+       else if(tfs->process->state->s == LTTV_STATE_RUN)
+               prop_text.Text = "R";
+       else
+               prop_text.Text = "U";
+       
+       draw_text((void*)&prop_text, (void*)draw_context);
+       
        return 0;
 }
 
index 37069b1a7bd1f926bac1364f082d5d5717f55454..93298c5e5a921c18bf5d40c918b5cdc8ecff672e 100644 (file)
@@ -314,6 +314,7 @@ int processlist_add(        ProcessList *Process_List,
        Hashed_Process_Data->draw_context = g_new(DrawContext, 1);
        Hashed_Process_Data->draw_context->drawable = NULL;
        Hashed_Process_Data->draw_context->gc = NULL;
+       Hashed_Process_Data->draw_context->pango_layout = NULL;
        Hashed_Process_Data->draw_context->Current = g_new(DrawInfo,1);
        Hashed_Process_Data->draw_context->Current->over = g_new(ItemInfo,1);
        Hashed_Process_Data->draw_context->Current->over->x = -1;
This page took 0.028107 seconds and 4 git commands to generate.