convert from svn repository: remove tags directory
[lttv.git] / trunk / lttng-xenomai / LinuxTraceToolkitViewer-0.8.61-xenoltt / lttv / modules / gui / controlflow / drawitem.h
CommitLineData
ce0214a6 1/* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Mathieu Desnoyers
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16 * MA 02111-1307, USA.
17 */
18
19
b782dd11 20#ifndef _DRAW_ITEM_H
21#define _DRAW_ITEM_H
22
8b90e648 23#include <lttv/state.h>
24
b782dd11 25typedef struct _DrawContext DrawContext;
26typedef struct _DrawInfo DrawInfo;
27typedef struct _ItemInfo ItemInfo;
28
1a31868c 29typedef struct _IconStruct IconStruct;
30
b782dd11 31typedef struct _DrawOperation DrawOperation;
32
33
34typedef struct _PropertiesText PropertiesText;
35typedef struct _PropertiesIcon PropertiesIcon;
36typedef struct _PropertiesLine PropertiesLine;
37typedef struct _PropertiesArc PropertiesArc;
38typedef struct _PropertiesBG PropertiesBG;
39
09e2606f 40typedef enum _DrawableItems DrawableItems;
41enum _DrawableItems {
a56a1ba4 42 ITEM_TEXT, ITEM_ICON, ITEM_LINE, ITEM_POINT, ITEM_BACKGROUND
09e2606f 43};
44
e800cf84 45typedef enum _RelPosX {
46 POS_START, POS_END
47} RelPosX;
09e2606f 48
e800cf84 49typedef enum _RelPosY {
a56a1ba4 50 OVER, MIDDLE, UNDER
e800cf84 51} RelPosY;
09e2606f 52
b782dd11 53
8d088fb2 54/* The DrawContext keeps information about the current drawing position and
55 * the previous one, so we can use both to draw lines.
56 *
57 * over : position for drawing over the middle line.
58 * middle : middle line position.
59 * under : position for drawing under the middle line.
60 *
61 * the modify_* are used to take into account that we should go forward
62 * when we draw a text, an arc or an icon, while it's unneeded when we
63 * draw a line or background.
64 *
c8bba5fa 65 * The modify_* positions are altered by the draw item functions.
66 *
8d088fb2 67 */
80a52ff8 68
69
8d088fb2 70struct _DrawContext {
a56a1ba4 71 GdkDrawable *drawable;
72 GdkGC *gc;
73 PangoLayout *pango_layout;
8d088fb2 74
c8bba5fa 75 struct {
e800cf84 76 struct {
77 gint x;
78 struct {
79 gint over;
80 gint middle;
81 gint under;
82 } offset;
83 } start;
84
85 struct {
86 gint x;
87 struct {
88 gint over;
89 gint middle;
90 gint under;
91 } offset;
92 } end;
93
94 struct {
95 gint over;
96 gint middle;
97 gint under;
98 } y;
8d088fb2 99
c8bba5fa 100 } drawinfo;
80a52ff8 101};
102
c8bba5fa 103
104
105
8d088fb2 106/*
107 * Structure used to keep information about icons.
108 */
109struct _IconStruct {
a56a1ba4 110 GdkPixmap *pixmap;
111 GdkBitmap *mask;
8d088fb2 112};
113
114
115/*
116 * The Item element is only used so the DrawOperation is modifiable by users.
117 * During drawing, only the Hook is needed.
118 */
119struct _DrawOperation {
68997a22 120 DrawableItems item;
121 LttvHooks *hook;
8d088fb2 122};
2eef04b5 123#if 0
8d088fb2 124/*
125 * We define here each items that can be drawn, together with their
126 * associated priority. Many item types can have the same priority,
127 * it's only used for quicksorting the operations when we add a new one
128 * to the array of operations to perform. Lower priorities are executed
129 * first. So, for example, we may want to give background color a value
130 * of 10 while a line would have 20, so the background color, which
131 * is in fact a rectangle, does not hide the line.
132 */
133
134static int Items_Priorities[] = {
a56a1ba4 135 50, /* ITEM_TEXT */
136 40, /* ITEM_ICON */
137 20, /* ITEM_LINE */
138 30, /* ITEM_POINT */
139 10 /* ITEM_BACKGROUND */
8d088fb2 140};
2eef04b5 141#endif //0
8d088fb2 142
143/*
144 * Here are the different structures describing each item type that can be
145 * drawn. They contain the information necessary to draw the item : not the
146 * position (this is provided by the DrawContext), but the text, icon name,
147 * line width, color; all the properties of the specific items.
148 */
149
150struct _PropertiesText {
a56a1ba4 151 GdkColor *foreground;
152 GdkColor *background;
e800cf84 153 gint size;
154 gchar *text;
155 struct {
156 RelPosX x;
157 RelPosY y;
158 } position;
8d088fb2 159};
160
161
162struct _PropertiesIcon {
a56a1ba4 163 gchar *icon_name;
164 gint width;
165 gint height;
e800cf84 166 struct {
167 RelPosX x;
168 RelPosY y;
169 } position;
8d088fb2 170};
171
172struct _PropertiesLine {
c8bba5fa 173 GdkColor color;
a56a1ba4 174 gint line_width;
175 GdkLineStyle style;
e800cf84 176 RelPosY y;
8d088fb2 177};
178
179struct _PropertiesArc {
a56a1ba4 180 GdkColor *color;
181 gint size; /* We force circle by width = height */
182 gboolean filled;
e800cf84 183 struct {
184 RelPosX x;
185 RelPosY y;
186 } position;
8d088fb2 187};
188
189struct _PropertiesBG {
a56a1ba4 190 GdkColor *color;
8d088fb2 191};
192
193
194
a56a1ba4 195void draw_item( GdkDrawable *drawable,
196 gint x,
197 gint y,
198 LttvTraceState *ts,
199 LttvTracefileState *tfs,
200 LttvIAttribute *attributes);
b782dd11 201
202/*
203 * The tree of attributes used to store drawing operations goes like this :
204 *
205 * event_types/
206 * "facility-event_type"
207 * cpus/
208 * "cpu name"
209 * mode_types/
210 * "execution mode"/
211 * submodes/
212 * "submode"
213 * process_states/
214 * "state name"
215 *
216 * So if, for example, we want to add a hook to get called each time we
217 * receive an event that is in state LTTV_STATE_SYSCALL, we put the
218 * pointer to the GArray of DrawOperation in
219 * process_states/ "name associated with LTTV_STATE_SYSCALL"
220 */
221
e800cf84 222
223#if 0
b782dd11 224/*
4c69e0cc 225 * The add_operation has to do a quick sort by priority to keep the operations
b782dd11 226 * in the right order.
227 */
a56a1ba4 228void add_operation( LttvIAttribute *attributes,
229 gchar *pathname,
68997a22 230 DrawOperation *operation);
b782dd11 231
232/*
4c69e0cc 233 * The del_operation seeks the array present at pathname (if any) and
b782dd11 234 * removes the DrawOperation if present. It returns 0 on success, -1
235 * if it fails.
236 */
a56a1ba4 237gint del_operation( LttvIAttribute *attributes,
238 gchar *pathname,
68997a22 239 DrawOperation *operation);
b782dd11 240
241/*
4c69e0cc 242 * The clean_operations removes all operations present at a pathname.
b782dd11 243 * returns 0 on success, -1 if it fails.
244 */
a56a1ba4 245gint clean_operations( LttvIAttribute *attributes,
246 gchar *pathname );
b782dd11 247
248
249/*
4c69e0cc 250 * The list_operations gives a pointer to the operation array associated
b782dd11 251 * with the pathname. It will be NULL if no operation is present.
252 */
a56a1ba4 253void list_operations( LttvIAttribute *attributes,
254 gchar *pathname,
68997a22 255 GArray **operation);
b782dd11 256
257
258
259/*
4c69e0cc 260 * exec_operation executes the operations if present in the attributes, or
b782dd11 261 * do nothing if not present.
262 */
a56a1ba4 263void exec_operations( LttvIAttribute *attributes,
264 gchar *pathname);
e800cf84 265#endif //0
b782dd11 266
267/*
268 * Here follow the prototypes of the hook functions used to draw the
269 * different items.
270 */
271
6550d711 272gboolean draw_text( void *hook_data, void *call_data);
273gboolean draw_icon( void *hook_data, void *call_data);
274gboolean draw_line( void *hook_data, void *call_data);
275gboolean draw_arc( void *hook_data, void *call_data);
276gboolean draw_bg( void *hook_data, void *call_data);
b782dd11 277
278
279#endif // _DRAW_ITEM_H
This page took 0.066799 seconds and 4 git commands to generate.