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