complete shedchange text information
[lttv.git] / ltt / branches / poly / lttv / modules / guiControlFlow / Draw_Item.h
1 #ifndef _DRAW_ITEM_H
2 #define _DRAW_ITEM_H
3
4 typedef struct _DrawContext DrawContext;
5 typedef struct _DrawInfo DrawInfo;
6 typedef struct _ItemInfo ItemInfo;
7
8 typedef struct _IconStruct IconStruct;
9
10 typedef struct _DrawOperation DrawOperation;
11
12
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;
18
19 typedef enum _DrawableItems DrawableItems;
20 enum _DrawableItems {
21 ITEM_TEXT, ITEM_ICON, ITEM_LINE, ITEM_POINT, ITEM_BACKGROUND
22 };
23
24
25 typedef enum _RelPos {
26 OVER, MIDDLE, UNDER
27 } RelPos;
28
29
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 */
42
43
44 struct _DrawContext {
45 GdkDrawable *drawable;
46 GdkGC *gc;
47 PangoLayout *pango_layout;
48
49 DrawInfo *Current;
50 DrawInfo *Previous;
51 };
52
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 */
70 struct _DrawInfo {
71 ItemInfo *over;
72 ItemInfo *middle;
73 ItemInfo *under;
74
75 ItemInfo *modify_over;
76 ItemInfo *modify_middle;
77 ItemInfo *modify_under;
78 LttvTraceState *ts;
79 LttvTracefileState *tfs;
80 };
81
82 struct _ItemInfo {
83 gint x, y;
84 };
85
86 /*
87 * Structure used to keep information about icons.
88 */
89 struct _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 */
99 struct _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
114 static 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
129 struct _PropertiesText {
130 GdkColor *foreground;
131 GdkColor *background;
132 gint size;
133 gchar *Text;
134 RelPos position;
135 };
136
137
138 struct _PropertiesIcon {
139 gchar *icon_name;
140 gint width;
141 gint height;
142 RelPos position;
143 };
144
145 struct _PropertiesLine {
146 GdkColor *color;
147 gint line_width;
148 GdkLineStyle style;
149 RelPos position;
150 };
151
152 struct _PropertiesArc {
153 GdkColor *color;
154 gint size; /* We force circle by width = height */
155 gboolean filled;
156 RelPos position;
157 };
158
159 struct _PropertiesBG {
160 GdkColor *color;
161 };
162
163
164
165 void draw_item( GdkDrawable *drawable,
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 /*
193 * The add_operation has to do a quick sort by priority to keep the operations
194 * in the right order.
195 */
196 void add_operation( LttvIAttribute *attributes,
197 gchar *pathname,
198 DrawOperation *Operation);
199
200 /*
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
203 * if it fails.
204 */
205 gint del_operation( LttvIAttribute *attributes,
206 gchar *pathname,
207 DrawOperation *Operation);
208
209 /*
210 * The clean_operations removes all operations present at a pathname.
211 * returns 0 on success, -1 if it fails.
212 */
213 gint clean_operations( LttvIAttribute *attributes,
214 gchar *pathname );
215
216
217 /*
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.
220 */
221 void list_operations( LttvIAttribute *attributes,
222 gchar *pathname,
223 GArray **Operation);
224
225
226
227 /*
228 * exec_operation executes the operations if present in the attributes, or
229 * do nothing if not present.
230 */
231 void exec_operations( LttvIAttribute *attributes,
232 gchar *pathname);
233
234
235 /*
236 * Functions to create Properties structures.
237 */
238
239 PropertiesText *properties_text_create(
240 GdkColor *foreground,
241 GdkColor *background,
242 gint size,
243 gchar *Text,
244 RelPos position);
245
246 PropertiesIcon *properties_icon_create(
247 gchar *icon_name,
248 gint width,
249 gint height,
250 RelPos position);
251
252 PropertiesLine *properties_line_create(
253 GdkColor *color,
254 gint line_width,
255 GdkLineStyle style,
256 RelPos position);
257
258 PropertiesArc *properties_arc_create(
259 GdkColor *color,
260 gint size,
261 gboolean filled,
262 RelPos position);
263
264 PropertiesBG *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
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);
280
281
282 #endif // _DRAW_ITEM_H
This page took 0.044463 seconds and 5 git commands to generate.