X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2FguiControlFlow%2FDraw_Item.h;h=6c35e97769baa470b0d89fcc5d9ec6d5d633abaa;hb=e8814eec2e5ba7e735892c3a7d03ff1872f9a0d2;hp=51e1a0d596c42821c45af0849c55b99f42f2d0c7;hpb=b782dd11ec8e363e135b32a563687a8e4f70bedb;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 51e1a0d5..6c35e977 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.h +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.h @@ -5,6 +5,8 @@ typedef struct _DrawContext DrawContext; typedef struct _DrawInfo DrawInfo; typedef struct _ItemInfo ItemInfo; +typedef struct _IconStruct IconStruct; + typedef struct _DrawOperation DrawOperation; @@ -14,8 +16,153 @@ typedef struct _PropertiesLine PropertiesLine; typedef struct _PropertiesArc PropertiesArc; typedef struct _PropertiesBG PropertiesBG; +typedef enum _DrawableItems DrawableItems; +enum _DrawableItems { + ITEM_TEXT, ITEM_ICON, ITEM_LINE, ITEM_POINT, ITEM_BACKGROUND +}; + + +typedef enum _RelPos { + OVER, MIDDLE, UNDER +} 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; + PangoLayout *pango_layout; + + DrawInfo *Current; + DrawInfo *Previous; +}; + +/* 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 _DrawInfo { + ItemInfo *over; + ItemInfo *middle; + ItemInfo *under; + + ItemInfo *modify_over; + ItemInfo *modify_middle; + ItemInfo *modify_under; + LttvTraceState *ts; + LttvTracefileState *tfs; +}; + +struct _ItemInfo { + gint x, y; +}; + +/* + * 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, + + +void draw_item( GdkDrawable *drawable, gint x, gint y, LttvTraceState *ts, @@ -43,45 +190,45 @@ void Draw_Item( GdkDrawable *drawable, */ /* - * The AddOperation has to do a quick sort by priority to keep the operations + * The add_operation has to do a quick sort by priority to keep the operations * in the right order. */ -void AddOperation( LttvIAttribute *attributes, +void add_operation( LttvIAttribute *attributes, gchar *pathname, DrawOperation *Operation); /* - * The DelOperation seeks the array present at pathname (if any) and + * The del_operation seeks the array present at pathname (if any) and * removes the DrawOperation if present. It returns 0 on success, -1 * if it fails. */ -gint DelOperation( LttvIAttribute *attributes, +gint del_operation( LttvIAttribute *attributes, gchar *pathname, DrawOperation *Operation); /* - * The CleanOperations removes all operations present at a pathname. + * The clean_operations removes all operations present at a pathname. * returns 0 on success, -1 if it fails. */ -gint DelOperations( LttvIAttribute *attributes, +gint clean_operations( LttvIAttribute *attributes, gchar *pathname ); /* - * The ListOperation gives a pointer to the operation array associated + * The list_operations gives a pointer to the operation array associated * with the pathname. It will be NULL if no operation is present. */ -void ListOperations( LttvIAttribute *attributes, +void list_operations( LttvIAttribute *attributes, gchar *pathname, GArray **Operation); /* - * ExecOperation executes the operations if present in the attributes, or + * exec_operation executes the operations if present in the attributes, or * do nothing if not present. */ -void ExecOperations( LttvIAttribute *attributes, +void exec_operations( LttvIAttribute *attributes, gchar *pathname); @@ -100,19 +247,19 @@ PropertiesIcon *properties_icon_create( gchar *icon_name, gint width, gint height, - RelPos position), + RelPos position); PropertiesLine *properties_line_create( GdkColor *color, gint line_width, GdkLineStyle style, - RelPos position), + RelPos position); PropertiesArc *properties_arc_create( GdkColor *color, gint size, gboolean filled, - RelPos position), + RelPos position); PropertiesBG *properties_bg_create( GdkColor *color); @@ -125,11 +272,11 @@ PropertiesBG *properties_bg_create( * different items. */ -gboolean DrawText( void *hook_data, void *call_data); -gboolean DrawIcon( void *hook_data, void *call_data); -gboolean DrawLine( void *hook_data, void *call_data); -gboolean DrawArc( void *hook_data, void *call_data); -gboolean DrawBG( void *hook_data, void *call_data); +gboolean draw_text( void *hook_data, void *call_data); +gboolean draw_icon( void *hook_data, void *call_data); +gboolean draw_line( void *hook_data, void *call_data); +gboolean draw_arc( void *hook_data, void *call_data); +gboolean draw_bg( void *hook_data, void *call_data); #endif // _DRAW_ITEM_H