4 typedef struct _DrawContext DrawContext
;
5 typedef struct _DrawInfo DrawInfo
;
6 typedef struct _ItemInfo ItemInfo
;
8 typedef struct _IconStruct IconStruct
;
10 typedef struct _DrawOperation DrawOperation
;
13 typedef struct _PropertiesText PropertiesText
;
14 typedef struct _PropertiesIcon PropertiesIcon
;
15 typedef struct _PropertiesLine PropertiesLine
;
16 typedef struct _PropertiesArc PropertiesArc
;
17 typedef struct _PropertiesBG PropertiesBG
;
19 typedef enum _DrawableItems DrawableItems
;
21 ITEM_TEXT
, ITEM_ICON
, ITEM_LINE
, ITEM_POINT
, ITEM_BACKGROUND
25 typedef enum _RelPos
{
30 /* The DrawContext keeps information about the current drawing position and
31 * the previous one, so we can use both to draw lines.
33 * over : position for drawing over the middle line.
34 * middle : middle line position.
35 * under : position for drawing under the middle line.
37 * the modify_* are used to take into account that we should go forward
38 * when we draw a text, an arc or an icon, while it's unneeded when we
39 * draw a line or background.
43 GdkDrawable
*drawable
;
56 ItemInfo
*modify_over
;
57 ItemInfo
*modify_middle
;
58 ItemInfo
*modify_under
;
61 /* LttvExecutionState is accessible through the LttvTracefileState. Is has
62 * a pointer to the LttvProcessState which points to the top of stack
63 * execution state : LttvExecutionState *state.
65 * LttvExecutionState contains (useful here):
66 * LttvExecutionMode t,
67 * LttvExecutionSubmode n,
71 * LttvTraceState will be used in the case we need the string of the
72 * different processes, eventtype_names, syscall_names, trap_names, irq_names.
74 * LttvTracefileState also gives the cpu_name and, as it herits from
75 * LttvTracefileContext, it gives the LttEvent structure, which is needed
76 * to get facility name and event name.
81 LttvTracefileState
*tfs
;
85 * Structure used to keep information about icons.
94 * The Item element is only used so the DrawOperation is modifiable by users.
95 * During drawing, only the Hook is needed.
97 struct _DrawOperation
{
103 * We define here each items that can be drawn, together with their
104 * associated priority. Many item types can have the same priority,
105 * it's only used for quicksorting the operations when we add a new one
106 * to the array of operations to perform. Lower priorities are executed
107 * first. So, for example, we may want to give background color a value
108 * of 10 while a line would have 20, so the background color, which
109 * is in fact a rectangle, does not hide the line.
112 static int Items_Priorities
[] = {
117 10 /* ITEM_BACKGROUND */
121 * Here are the different structures describing each item type that can be
122 * drawn. They contain the information necessary to draw the item : not the
123 * position (this is provided by the DrawContext), but the text, icon name,
124 * line width, color; all the properties of the specific items.
127 struct _PropertiesText
{
128 GdkColor
*foreground
;
129 GdkColor
*background
;
136 struct _PropertiesIcon
{
143 struct _PropertiesLine
{
150 struct _PropertiesArc
{
152 gint size
; /* We force circle by width = height */
157 struct _PropertiesBG
{
163 void draw_item( GdkDrawable
*drawable
,
167 LttvTracefileState
*tfs
,
168 LttvIAttribute
*attributes
);
171 * The tree of attributes used to store drawing operations goes like this :
174 * "facility-event_type"
184 * So if, for example, we want to add a hook to get called each time we
185 * receive an event that is in state LTTV_STATE_SYSCALL, we put the
186 * pointer to the GArray of DrawOperation in
187 * process_states/ "name associated with LTTV_STATE_SYSCALL"
191 * The add_operation has to do a quick sort by priority to keep the operations
192 * in the right order.
194 void add_operation( LttvIAttribute
*attributes
,
196 DrawOperation
*Operation
);
199 * The del_operation seeks the array present at pathname (if any) and
200 * removes the DrawOperation if present. It returns 0 on success, -1
203 gint
del_operation( LttvIAttribute
*attributes
,
205 DrawOperation
*Operation
);
208 * The clean_operations removes all operations present at a pathname.
209 * returns 0 on success, -1 if it fails.
211 gint
clean_operations( LttvIAttribute
*attributes
,
216 * The list_operations gives a pointer to the operation array associated
217 * with the pathname. It will be NULL if no operation is present.
219 void list_operations( LttvIAttribute
*attributes
,
226 * exec_operation executes the operations if present in the attributes, or
227 * do nothing if not present.
229 void exec_operations( LttvIAttribute
*attributes
,
234 * Functions to create Properties structures.
237 PropertiesText
*properties_text_create(
238 GdkColor
*foreground
,
239 GdkColor
*background
,
244 PropertiesIcon
*properties_icon_create(
250 PropertiesLine
*properties_line_create(
256 PropertiesArc
*properties_arc_create(
262 PropertiesBG
*properties_bg_create(
269 * Here follow the prototypes of the hook functions used to draw the
273 gboolean
draw_text( void *hook_data
, void *call_data
);
274 gboolean
draw_icon( void *hook_data
, void *call_data
);
275 gboolean
draw_line( void *hook_data
, void *call_data
);
276 gboolean
draw_arc( void *hook_data
, void *call_data
);
277 gboolean
draw_bg( void *hook_data
, void *call_data
);
280 #endif // _DRAW_ITEM_H