X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=inline;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2FguiControlFlow%2FDraw_Item.h;h=63efcc11baa989d9fc529c59a3c373fdcc596a82;hb=8d088fb270b8b2e03e3632f1b5733485a6675c07;hp=6e5f5eb5cd2bfcdacc07531c941d4293757b3393;hpb=1a31868cb394a6b2214965baee974fa3cea927f3;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.h b/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.h index 6e5f5eb5..63efcc11 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.h +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.h @@ -27,6 +27,139 @@ typedef enum _RelPos { } RelPos; +/* The DrawContext keeps information about the current drawing position and + * the previous one, so we can use both to draw lines. + * + * over : position for drawing over the middle line. + * middle : middle line position. + * under : position for drawing under the middle line. + * + * the modify_* are used to take into account that we should go forward + * when we draw a text, an arc or an icon, while it's unneeded when we + * draw a line or background. + * + */ +struct _DrawContext { + GdkDrawable *drawable; + GdkGC *gc; + + + DrawInfo *Current; + DrawInfo *Previous; +}; + +struct _DrawInfo { + ItemInfo *over; + ItemInfo *middle; + ItemInfo *under; + + ItemInfo *modify_over; + ItemInfo *modify_middle; + ItemInfo *modify_under; +}; + +/* LttvExecutionState is accessible through the LttvTracefileState. Is has + * a pointer to the LttvProcessState which points to the top of stack + * execution state : LttvExecutionState *state. + * + * LttvExecutionState contains (useful here): + * LttvExecutionMode t, + * LttvExecutionSubmode n, + * LttvProcessStatus s + * + * + * LttvTraceState will be used in the case we need the string of the + * different processes, eventtype_names, syscall_names, trap_names, irq_names. + * + * LttvTracefileState also gives the cpu_name and, as it herits from + * LttvTracefileContext, it gives the LttEvent structure, which is needed + * to get facility name and event name. + */ +struct _ItemInfo { + gint x, y; + LttvTraceState *ts; + LttvTracefileState *tfs; +}; + +/* + * Structure used to keep information about icons. + */ +struct _IconStruct { + GdkPixmap *pixmap; + GdkBitmap *mask; +}; + + +/* + * The Item element is only used so the DrawOperation is modifiable by users. + * During drawing, only the Hook is needed. + */ +struct _DrawOperation { + DrawableItems Item; + LttvHooks *Hook; +}; + +/* + * We define here each items that can be drawn, together with their + * associated priority. Many item types can have the same priority, + * it's only used for quicksorting the operations when we add a new one + * to the array of operations to perform. Lower priorities are executed + * first. So, for example, we may want to give background color a value + * of 10 while a line would have 20, so the background color, which + * is in fact a rectangle, does not hide the line. + */ + +static int Items_Priorities[] = { + 50, /* ITEM_TEXT */ + 40, /* ITEM_ICON */ + 20, /* ITEM_LINE */ + 30, /* ITEM_POINT */ + 10 /* ITEM_BACKGROUND */ +}; + +/* + * Here are the different structures describing each item type that can be + * drawn. They contain the information necessary to draw the item : not the + * position (this is provided by the DrawContext), but the text, icon name, + * line width, color; all the properties of the specific items. + */ + +struct _PropertiesText { + GdkColor *foreground; + GdkColor *background; + gint size; + gchar *Text; + RelPos position; +}; + + +struct _PropertiesIcon { + gchar *icon_name; + gint width; + gint height; + RelPos position; +}; + +struct _PropertiesLine { + GdkColor *color; + gint line_width; + GdkLineStyle style; + RelPos position; +}; + +struct _PropertiesArc { + GdkColor *color; + gint size; /* We force circle by width = height */ + gboolean filled; + RelPos position; +}; + +struct _PropertiesBG { + GdkColor *color; +}; + + + void draw_item( GdkDrawable *drawable, gint x, gint y,