cf6cb7e0 |
1 | /****************************************************************************** |
2 | * Draw_Item.c |
3 | * |
4 | * This file contains methods responsible for drawing a generic type of data |
5 | * in a drawable. Doing this generically will permit user defined drawing |
6 | * behavior in a later time. |
7 | * |
f0728492 |
8 | * We keep each data type in attributes, keys to specific information |
9 | * being formed from the GQuark corresponding to the information received. |
10 | * (facilities / facility_name / events / eventname.) |
11 | * (cpus/cpu_name, process_states/ps_name, |
12 | * execution_modes/em_name, execution_submodes/es_name). |
cf6cb7e0 |
13 | * The goal is then to provide a generic way to print information on the |
14 | * screen for all this different information. |
15 | * |
16 | * Information can be printed as |
17 | * |
18 | * - text (text + color + size + position (over or under line) |
19 | * - icon (icon filename, corresponding to a loaded icon, accessible through |
20 | * a GQuark. Icons are loaded statically at the guiControlFlow level during |
21 | * module initialization and can be added on the fly if not present in the |
22 | * GQuark.) The habitual place for xpm icons is in |
23 | * ${prefix}/share/LinuxTraceToolkit.) + position (over or under line) |
24 | * - line (color, width, style) |
25 | * - point (color, size) |
26 | * - background color (color) |
27 | * |
7d5ffafa |
28 | * Each item has an array of hooks (hook list). Each hook represents an |
29 | * operation to perform. We seek the array each time we want to |
a2e850ff |
30 | * draw an item. We execute each operation in order. An operation type |
31 | * is associated with each hook to permit user listing and modification |
32 | * of these operations. The operation type is also used to find the |
33 | * corresponding priority for the sorting. Operation type and priorities |
34 | * are enum and a static int table. |
cf6cb7e0 |
35 | * |
36 | * The array has to be sorted by priority each time we add a task in it. |
a2e850ff |
37 | * A priority is associated with each operation type. It permits |
cf6cb7e0 |
38 | * to perform background color selection before line or text drawing. We also |
39 | * draw lines before text, so the text appears over the lines. |
40 | * |
41 | * Executing all the arrays of operations for a specific event (which |
42 | * implies information for state, event, cpu, execution mode and submode) |
43 | * has to be done in a same DrawContext. The goal there is to keep the offset |
44 | * of the text and icons over and under the middle line, so a specific |
45 | * event could be printed as ( R Si 0 for running, scheduled in, cpu 0 ), |
7d5ffafa |
46 | * text being easy to replace with icons. The DrawContext is passed as |
47 | * call_data for the operation hooks. |
cf6cb7e0 |
48 | * |
49 | * Author : Mathieu Desnoyers, October 2003 |
50 | */ |
7d5ffafa |
51 | |
52 | #include <glib.h> |
53 | #include <lttv/hook.h> |
f0728492 |
54 | #include <lttv/attribute.h> |
55 | #include <lttv/iattribute.h> |
7d5ffafa |
56 | |