Detail event viewer selects event based on other viewer's selection: update_current_time
[lttv.git] / ltt / branches / poly / lttv / modules / guiControlFlow / Draw_Item.h
CommitLineData
b782dd11 1#ifndef _DRAW_ITEM_H
2#define _DRAW_ITEM_H
3
4typedef struct _DrawContext DrawContext;
5typedef struct _DrawInfo DrawInfo;
6typedef struct _ItemInfo ItemInfo;
7
1a31868c 8typedef struct _IconStruct IconStruct;
9
b782dd11 10typedef struct _DrawOperation DrawOperation;
11
12
13typedef struct _PropertiesText PropertiesText;
14typedef struct _PropertiesIcon PropertiesIcon;
15typedef struct _PropertiesLine PropertiesLine;
16typedef struct _PropertiesArc PropertiesArc;
17typedef struct _PropertiesBG PropertiesBG;
18
09e2606f 19typedef enum _DrawableItems DrawableItems;
20enum _DrawableItems {
21 ITEM_TEXT, ITEM_ICON, ITEM_LINE, ITEM_POINT, ITEM_BACKGROUND
22};
23
24
25typedef enum _RelPos {
26 OVER, MIDDLE, UNDER
27} RelPos;
28
b782dd11 29
8d088fb2 30/* The DrawContext keeps information about the current drawing position and
31 * the previous one, so we can use both to draw lines.
32 *
33 * over : position for drawing over the middle line.
34 * middle : middle line position.
35 * under : position for drawing under the middle line.
36 *
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.
40 *
41 */
42struct _DrawContext {
43 GdkDrawable *drawable;
44 GdkGC *gc;
45
46
47 DrawInfo *Current;
48 DrawInfo *Previous;
49};
50
51struct _DrawInfo {
52 ItemInfo *over;
53 ItemInfo *middle;
54 ItemInfo *under;
55
56 ItemInfo *modify_over;
57 ItemInfo *modify_middle;
58 ItemInfo *modify_under;
59};
60
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.
64 *
65 * LttvExecutionState contains (useful here):
66 * LttvExecutionMode t,
67 * LttvExecutionSubmode n,
68 * LttvProcessStatus s
69 *
70 *
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.
73 *
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.
77 */
78struct _ItemInfo {
79 gint x, y;
80 LttvTraceState *ts;
81 LttvTracefileState *tfs;
82};
83
84/*
85 * Structure used to keep information about icons.
86 */
87struct _IconStruct {
88 GdkPixmap *pixmap;
89 GdkBitmap *mask;
90};
91
92
93/*
94 * The Item element is only used so the DrawOperation is modifiable by users.
95 * During drawing, only the Hook is needed.
96 */
97struct _DrawOperation {
98 DrawableItems Item;
99 LttvHooks *Hook;
100};
101
102/*
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.
110 */
111
112static int Items_Priorities[] = {
113 50, /* ITEM_TEXT */
114 40, /* ITEM_ICON */
115 20, /* ITEM_LINE */
116 30, /* ITEM_POINT */
117 10 /* ITEM_BACKGROUND */
118};
119
120/*
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.
125 */
126
127struct _PropertiesText {
128 GdkColor *foreground;
129 GdkColor *background;
130 gint size;
131 gchar *Text;
132 RelPos position;
133};
134
135
136struct _PropertiesIcon {
137 gchar *icon_name;
138 gint width;
139 gint height;
140 RelPos position;
141};
142
143struct _PropertiesLine {
144 GdkColor *color;
145 gint line_width;
146 GdkLineStyle style;
147 RelPos position;
148};
149
150struct _PropertiesArc {
151 GdkColor *color;
152 gint size; /* We force circle by width = height */
153 gboolean filled;
154 RelPos position;
155};
156
157struct _PropertiesBG {
158 GdkColor *color;
159};
160
161
162
4c69e0cc 163void draw_item( GdkDrawable *drawable,
b782dd11 164 gint x,
165 gint y,
166 LttvTraceState *ts,
167 LttvTracefileState *tfs,
168 LttvIAttribute *attributes);
169
170/*
171 * The tree of attributes used to store drawing operations goes like this :
172 *
173 * event_types/
174 * "facility-event_type"
175 * cpus/
176 * "cpu name"
177 * mode_types/
178 * "execution mode"/
179 * submodes/
180 * "submode"
181 * process_states/
182 * "state name"
183 *
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"
188 */
189
190/*
4c69e0cc 191 * The add_operation has to do a quick sort by priority to keep the operations
b782dd11 192 * in the right order.
193 */
4c69e0cc 194void add_operation( LttvIAttribute *attributes,
b782dd11 195 gchar *pathname,
196 DrawOperation *Operation);
197
198/*
4c69e0cc 199 * The del_operation seeks the array present at pathname (if any) and
b782dd11 200 * removes the DrawOperation if present. It returns 0 on success, -1
201 * if it fails.
202 */
4c69e0cc 203gint del_operation( LttvIAttribute *attributes,
b782dd11 204 gchar *pathname,
205 DrawOperation *Operation);
206
207/*
4c69e0cc 208 * The clean_operations removes all operations present at a pathname.
b782dd11 209 * returns 0 on success, -1 if it fails.
210 */
4c69e0cc 211gint clean_operations( LttvIAttribute *attributes,
b782dd11 212 gchar *pathname );
213
214
215/*
4c69e0cc 216 * The list_operations gives a pointer to the operation array associated
b782dd11 217 * with the pathname. It will be NULL if no operation is present.
218 */
4c69e0cc 219void list_operations( LttvIAttribute *attributes,
b782dd11 220 gchar *pathname,
221 GArray **Operation);
222
223
224
225/*
4c69e0cc 226 * exec_operation executes the operations if present in the attributes, or
b782dd11 227 * do nothing if not present.
228 */
4c69e0cc 229void exec_operations( LttvIAttribute *attributes,
b782dd11 230 gchar *pathname);
231
232
233/*
234 * Functions to create Properties structures.
235 */
236
237PropertiesText *properties_text_create(
238 GdkColor *foreground,
239 GdkColor *background,
240 gint size,
241 gchar *Text,
242 RelPos position);
243
244PropertiesIcon *properties_icon_create(
245 gchar *icon_name,
246 gint width,
247 gint height,
09e2606f 248 RelPos position);
b782dd11 249
250PropertiesLine *properties_line_create(
251 GdkColor *color,
252 gint line_width,
253 GdkLineStyle style,
09e2606f 254 RelPos position);
b782dd11 255
256PropertiesArc *properties_arc_create(
257 GdkColor *color,
258 gint size,
259 gboolean filled,
09e2606f 260 RelPos position);
b782dd11 261
262PropertiesBG *properties_bg_create(
263 GdkColor *color);
264
265
266
267
268/*
269 * Here follow the prototypes of the hook functions used to draw the
270 * different items.
271 */
272
4c69e0cc 273gboolean draw_text( void *hook_data, void *call_data);
274gboolean draw_icon( void *hook_data, void *call_data);
275gboolean draw_line( void *hook_data, void *call_data);
276gboolean draw_arc( void *hook_data, void *call_data);
277gboolean draw_bg( void *hook_data, void *call_data);
b782dd11 278
279
280#endif // _DRAW_ITEM_H
This page took 0.03424 seconds and 4 git commands to generate.