4 #include <lttv/state.h>
6 typedef struct _DrawContext DrawContext
;
7 typedef struct _DrawInfo DrawInfo
;
8 typedef struct _ItemInfo ItemInfo
;
10 typedef struct _IconStruct IconStruct
;
12 typedef struct _DrawOperation DrawOperation
;
15 typedef struct _PropertiesText PropertiesText
;
16 typedef struct _PropertiesIcon PropertiesIcon
;
17 typedef struct _PropertiesLine PropertiesLine
;
18 typedef struct _PropertiesArc PropertiesArc
;
19 typedef struct _PropertiesBG PropertiesBG
;
21 typedef enum _DrawableItems DrawableItems
;
23 ITEM_TEXT
, ITEM_ICON
, ITEM_LINE
, ITEM_POINT
, ITEM_BACKGROUND
27 typedef enum _RelPos
{
32 /* The DrawContext keeps information about the current drawing position and
33 * the previous one, so we can use both to draw lines.
35 * over : position for drawing over the middle line.
36 * middle : middle line position.
37 * under : position for drawing under the middle line.
39 * the modify_* are used to take into account that we should go forward
40 * when we draw a text, an arc or an icon, while it's unneeded when we
41 * draw a line or background.
47 GdkDrawable
*drawable
;
49 PangoLayout
*pango_layout
;
55 /* LttvExecutionState is accessible through the LttvTracefileState. Is has
56 * a pointer to the LttvProcessState which points to the top of stack
57 * execution state : LttvExecutionState *state.
59 * LttvExecutionState contains (useful here):
60 * LttvExecutionMode t,
61 * LttvExecutionSubmode n,
65 * LttvTraceState will be used in the case we need the string of the
66 * different processes, eventtype_names, syscall_names, trap_names, irq_names.
68 * LttvTracefileState also gives the cpu_name and, as it herits from
69 * LttvTracefileContext, it gives the LttEvent structure, which is needed
70 * to get facility name and event name.
77 ItemInfo
*modify_over
;
78 ItemInfo
*modify_middle
;
79 ItemInfo
*modify_under
;
80 LttvProcessStatus status
;
88 * Structure used to keep information about icons.
97 * The Item element is only used so the DrawOperation is modifiable by users.
98 * During drawing, only the Hook is needed.
100 struct _DrawOperation
{
106 * We define here each items that can be drawn, together with their
107 * associated priority. Many item types can have the same priority,
108 * it's only used for quicksorting the operations when we add a new one
109 * to the array of operations to perform. Lower priorities are executed
110 * first. So, for example, we may want to give background color a value
111 * of 10 while a line would have 20, so the background color, which
112 * is in fact a rectangle, does not hide the line.
115 static int Items_Priorities
[] = {
120 10 /* ITEM_BACKGROUND */
124 * Here are the different structures describing each item type that can be
125 * drawn. They contain the information necessary to draw the item : not the
126 * position (this is provided by the DrawContext), but the text, icon name,
127 * line width, color; all the properties of the specific items.
130 struct _PropertiesText
{
131 GdkColor
*foreground
;
132 GdkColor
*background
;
139 struct _PropertiesIcon
{
146 struct _PropertiesLine
{
153 struct _PropertiesArc
{
155 gint size
; /* We force circle by width = height */
160 struct _PropertiesBG
{
166 void draw_item( GdkDrawable
*drawable
,
170 LttvTracefileState
*tfs
,
171 LttvIAttribute
*attributes
);
174 * The tree of attributes used to store drawing operations goes like this :
177 * "facility-event_type"
187 * So if, for example, we want to add a hook to get called each time we
188 * receive an event that is in state LTTV_STATE_SYSCALL, we put the
189 * pointer to the GArray of DrawOperation in
190 * process_states/ "name associated with LTTV_STATE_SYSCALL"
194 * The add_operation has to do a quick sort by priority to keep the operations
195 * in the right order.
197 void add_operation( LttvIAttribute
*attributes
,
199 DrawOperation
*Operation
);
202 * The del_operation seeks the array present at pathname (if any) and
203 * removes the DrawOperation if present. It returns 0 on success, -1
206 gint
del_operation( LttvIAttribute
*attributes
,
208 DrawOperation
*Operation
);
211 * The clean_operations removes all operations present at a pathname.
212 * returns 0 on success, -1 if it fails.
214 gint
clean_operations( LttvIAttribute
*attributes
,
219 * The list_operations gives a pointer to the operation array associated
220 * with the pathname. It will be NULL if no operation is present.
222 void list_operations( LttvIAttribute
*attributes
,
229 * exec_operation executes the operations if present in the attributes, or
230 * do nothing if not present.
232 void exec_operations( LttvIAttribute
*attributes
,
237 * Functions to create Properties structures.
240 PropertiesText
*properties_text_create(
241 GdkColor
*foreground
,
242 GdkColor
*background
,
247 PropertiesIcon
*properties_icon_create(
253 PropertiesLine
*properties_line_create(
259 PropertiesArc
*properties_arc_create(
265 PropertiesBG
*properties_bg_create(
272 * Here follow the prototypes of the hook functions used to draw the
276 gboolean
draw_text( void *hook_data
, void *call_data
);
277 gboolean
draw_icon( void *hook_data
, void *call_data
);
278 gboolean
draw_line( void *hook_data
, void *call_data
);
279 gboolean
draw_arc( void *hook_data
, void *call_data
);
280 gboolean
draw_bg( void *hook_data
, void *call_data
);
283 #endif // _DRAW_ITEM_H