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.
45 GdkDrawable
*drawable
;
47 PangoLayout
*pango_layout
;
53 /* LttvExecutionState is accessible through the LttvTracefileState. Is has
54 * a pointer to the LttvProcessState which points to the top of stack
55 * execution state : LttvExecutionState *state.
57 * LttvExecutionState contains (useful here):
58 * LttvExecutionMode t,
59 * LttvExecutionSubmode n,
63 * LttvTraceState will be used in the case we need the string of the
64 * different processes, eventtype_names, syscall_names, trap_names, irq_names.
66 * LttvTracefileState also gives the cpu_name and, as it herits from
67 * LttvTracefileContext, it gives the LttEvent structure, which is needed
68 * to get facility name and event name.
75 ItemInfo
*modify_over
;
76 ItemInfo
*modify_middle
;
77 ItemInfo
*modify_under
;
79 LttvTracefileState
*tfs
;
87 * Structure used to keep information about icons.
96 * The Item element is only used so the DrawOperation is modifiable by users.
97 * During drawing, only the Hook is needed.
99 struct _DrawOperation
{
105 * We define here each items that can be drawn, together with their
106 * associated priority. Many item types can have the same priority,
107 * it's only used for quicksorting the operations when we add a new one
108 * to the array of operations to perform. Lower priorities are executed
109 * first. So, for example, we may want to give background color a value
110 * of 10 while a line would have 20, so the background color, which
111 * is in fact a rectangle, does not hide the line.
114 static int Items_Priorities
[] = {
119 10 /* ITEM_BACKGROUND */
123 * Here are the different structures describing each item type that can be
124 * drawn. They contain the information necessary to draw the item : not the
125 * position (this is provided by the DrawContext), but the text, icon name,
126 * line width, color; all the properties of the specific items.
129 struct _PropertiesText
{
130 GdkColor
*foreground
;
131 GdkColor
*background
;
138 struct _PropertiesIcon
{
145 struct _PropertiesLine
{
152 struct _PropertiesArc
{
154 gint size
; /* We force circle by width = height */
159 struct _PropertiesBG
{
165 void draw_item( GdkDrawable
*drawable
,
169 LttvTracefileState
*tfs
,
170 LttvIAttribute
*attributes
);
173 * The tree of attributes used to store drawing operations goes like this :
176 * "facility-event_type"
186 * So if, for example, we want to add a hook to get called each time we
187 * receive an event that is in state LTTV_STATE_SYSCALL, we put the
188 * pointer to the GArray of DrawOperation in
189 * process_states/ "name associated with LTTV_STATE_SYSCALL"
193 * The add_operation has to do a quick sort by priority to keep the operations
194 * in the right order.
196 void add_operation( LttvIAttribute
*attributes
,
198 DrawOperation
*Operation
);
201 * The del_operation seeks the array present at pathname (if any) and
202 * removes the DrawOperation if present. It returns 0 on success, -1
205 gint
del_operation( LttvIAttribute
*attributes
,
207 DrawOperation
*Operation
);
210 * The clean_operations removes all operations present at a pathname.
211 * returns 0 on success, -1 if it fails.
213 gint
clean_operations( LttvIAttribute
*attributes
,
218 * The list_operations gives a pointer to the operation array associated
219 * with the pathname. It will be NULL if no operation is present.
221 void list_operations( LttvIAttribute
*attributes
,
228 * exec_operation executes the operations if present in the attributes, or
229 * do nothing if not present.
231 void exec_operations( LttvIAttribute
*attributes
,
236 * Functions to create Properties structures.
239 PropertiesText
*properties_text_create(
240 GdkColor
*foreground
,
241 GdkColor
*background
,
246 PropertiesIcon
*properties_icon_create(
252 PropertiesLine
*properties_line_create(
258 PropertiesArc
*properties_arc_create(
264 PropertiesBG
*properties_bg_create(
271 * Here follow the prototypes of the hook functions used to draw the
275 gboolean
draw_text( void *hook_data
, void *call_data
);
276 gboolean
draw_icon( void *hook_data
, void *call_data
);
277 gboolean
draw_line( void *hook_data
, void *call_data
);
278 gboolean
draw_arc( void *hook_data
, void *call_data
);
279 gboolean
draw_bg( void *hook_data
, void *call_data
);
282 #endif // _DRAW_ITEM_H