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