| 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 | * |
| 8 | * We keep each data type in a hash table, as this container suits the |
| 9 | * best the information we receive (GQuark). |
| 10 | * (A hash table for facilities, pointing to an array per facility, containing |
| 11 | * event_number events.) |
| 12 | * (hash tables for cpus, for process state, for execution mode and submode). |
| 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 | * |
| 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 |
| 30 | * draw an item. We execute each operation in order. |
| 31 | * |
| 32 | * The array has to be sorted by priority each time we add a task in it. |
| 33 | * A priority is associated with each hook. It permits |
| 34 | * to perform background color selection before line or text drawing. We also |
| 35 | * draw lines before text, so the text appears over the lines. |
| 36 | * |
| 37 | * Executing all the arrays of operations for a specific event (which |
| 38 | * implies information for state, event, cpu, execution mode and submode) |
| 39 | * has to be done in a same DrawContext. The goal there is to keep the offset |
| 40 | * of the text and icons over and under the middle line, so a specific |
| 41 | * event could be printed as ( R Si 0 for running, scheduled in, cpu 0 ), |
| 42 | * text being easy to replace with icons. The DrawContext is passed as |
| 43 | * call_data for the operation hooks. |
| 44 | * |
| 45 | * Author : Mathieu Desnoyers, October 2003 |
| 46 | */ |
| 47 | |
| 48 | #include <glib.h> |
| 49 | #include <lttv/hook.h> |
| 50 | |
| 51 | |