draw item : generic way to draw something on a drawable, architecture description
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 13 Oct 2003 18:30:08 +0000 (18:30 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 13 Oct 2003 18:30:08 +0000 (18:30 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@301 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.c [new file with mode: 0644]
ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.h
ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c

diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.c b/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.c
new file mode 100644 (file)
index 0000000..1c89f70
--- /dev/null
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * Draw_Item.c
+ *
+ * This file contains methods responsible for drawing a generic type of data
+ * in a drawable. Doing this generically will permit user defined drawing
+ * behavior in a later time.
+ *
+ * We keep each data type in a hash table, as this container suits the
+ * best the information we receive (GQuark).
+ * (A hash table for facilities, pointing to an array per facility, containing
+ * event_number events.)
+ * (hash tables for cpus, for process state, for execution mode and submode).
+ * The goal is then to provide a generic way to print information on the
+ * screen for all this different information.
+ *
+ * Information can be printed as
+ *
+ * - text (text + color + size + position (over or under line)
+ * - icon (icon filename, corresponding to a loaded icon, accessible through
+ *   a GQuark. Icons are loaded statically at the guiControlFlow level during
+ *   module initialization and can be added on the fly if not present in the
+ *   GQuark.) The habitual place for xpm icons is in
+ *   ${prefix}/share/LinuxTraceToolkit.) + position (over or under line)
+ * - line (color, width, style)
+ * - point (color, size)
+ * - background color (color)
+ *
+ * Each item has an array of pointers to operation structures, which define
+ * the information type selector. We seek the array each time we want to
+ * draw an item. We execute each operation in order, casting to the right
+ * operation type corresponding to the information type selector.
+ *
+ * The array has to be sorted by priority each time we add a task in it.
+ * A priority is associated with each information type selector. It permits
+ * to perform background color selection before line or text drawing. We also
+ * draw lines before text, so the text appears over the lines.
+ *
+ * Executing all the arrays of operations for a specific event (which
+ * implies information for state, event, cpu, execution mode and submode)
+ * has to be done in a same DrawContext. The goal there is to keep the offset
+ * of the text and icons over and under the middle line, so a specific
+ * event could be printed as (  R Si 0 for running, scheduled in, cpu 0  ),
+ * text being easy to replace with icons.
+ *
+ * Author : Mathieu Desnoyers, October 2003
+ */
index 354021498f5bbe8b57a8f2bf9b5d46788924f795..418f68858c0065f610d82497b03bbe243ca8a3e6 100644 (file)
@@ -23,7 +23,7 @@
 typedef struct _Drawing_t Drawing_t;
 
 
-//FIXME : TEMPORARILY FOR GC !!
+//FIXME : TEMPORARILY PLACED HERE FOR GC !!
 struct _Drawing_t {
        GtkWidget       *Drawing_Area_V;
        GdkPixmap       *Pixmap;
index 12cf5c4d9dcb9d724ecb270c58ec3e19b03c8af2..3c0f6e815697b256ac9611a972014c250377a172 100644 (file)
@@ -3,10 +3,13 @@
  *****************************************************************************/
 
 
+//#define PANGO_ENABLE_BACKEND
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 #include <glib.h>
 
+//#include <pango/pango.h>
+
 #include <lttv/hook.h>
 #include <lttv/common.h>
 
@@ -30,7 +33,22 @@ void send_test_drawing(ProcessList *Process_List,
        ProcessInfo Process_Info = {10000, 12000, 55600};
        //ProcessInfo Process_Info = {156, 14000, 55500};
        GtkTreeRowReference *got_RowRef;
+       PangoContext *context;
+       PangoLayout *layout;
+       PangoFontDescription *FontDesc;// = pango_font_description_new();
+       gint Font_Size;
+
+       /* Sent text data */
+       layout = gtk_widget_create_pango_layout(Drawing->Drawing_Area_V,
+                       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, Font_Size-3*PANGO_SCALE);
+       
        
+
+
        LttTime birth;
        birth.tv_sec = 12000;
        birth.tv_nsec = 55500;
@@ -47,6 +65,10 @@ void send_test_drawing(ProcessList *Process_List,
                y+(height/2), x + width, y+(height/2),
                Drawing->Drawing_Area_V->style->black_gc);
 
+       pango_layout_set_text(layout, "Test", -1);
+       gdk_draw_layout(Pixmap, Drawing->Drawing_Area_V->style->black_gc,
+                       0, y+height, layout);
+
        birth.tv_sec = 14000;
        birth.tv_nsec = 55500;
 
@@ -118,7 +140,11 @@ void send_test_drawing(ProcessList *Process_List,
                Drawing->Drawing_Area_V->style->black_gc);
 
        g_critical("y : %u, height : %u", y, height);
-       
+
+
+       pango_font_description_set_size(FontDesc, Font_Size);
+       g_free(layout);
+       //g_free(context);
 }
 
 void send_test_process(ProcessList *Process_List, Drawing_t *Drawing)
This page took 0.025894 seconds and 4 git commands to generate.