f0d936c0 |
1 | #ifndef _DRAWING_H |
2 | #define _DRAWING_H |
3 | |
558aa013 |
4 | #include <glib.h> |
76a67e8a |
5 | #include <gdk/gdk.h> |
6 | #include <gtk/gtk.h> |
fa2c4dbe |
7 | #include <ltt/ltt.h> |
f7afe191 |
8 | #include "CFV.h" |
f0d936c0 |
9 | |
fa2c4dbe |
10 | /* This part of the viewer does : |
76a67e8a |
11 | * Draw horizontal lines, getting graphic context as arg. |
fa2c4dbe |
12 | * Copy region of the screen into another. |
76a67e8a |
13 | * Modify the boundaries to reflect a scale change. (resize) |
847b479d |
14 | * Refresh the physical screen with the pixmap |
189a5d08 |
15 | * A helper function is provided here to convert from time to process |
fa2c4dbe |
16 | * identifier to pixels and the contrary (will be useful for mouse selection). |
5f16133f |
17 | * Insert an empty square in the drawing, moving the bottom part. |
18 | * |
189a5d08 |
19 | * Note: The last point is exactly why it would not be so easy to add the |
20 | * vertical line functionnality as in the original version of LTT. In order |
21 | * to do so, we should keep all processes in the list for the duration of |
22 | * all the trace instead of dynamically adding and removing them when we |
23 | * scroll. Another possibility is to redraw all the visible area when a new |
24 | * process is added to the list. The second solution seems more appropriate |
25 | * to me. |
26 | * |
27 | * |
5f16133f |
28 | * The pixmap used has the width of the physical window, but the height |
29 | * of the shown processes. |
fa2c4dbe |
30 | */ |
f0d936c0 |
31 | |
32 | typedef struct _Drawing_t Drawing_t; |
33 | |
f7afe191 |
34 | |
cf6cb7e0 |
35 | //FIXME : TEMPORARILY PLACED HERE FOR GC !! |
f7afe191 |
36 | struct _Drawing_t { |
37 | GtkWidget *Drawing_Area_V; |
38 | GdkPixmap *Pixmap; |
39 | ControlFlowData *Control_Flow_Data; |
40 | |
41 | gint height, width, depth; |
42 | |
43 | }; |
44 | |
45 | |
4c69e0cc |
46 | Drawing_t *drawing_construct(ControlFlowData *Control_Flow_Data); |
47 | void drawing_destroy(Drawing_t *Drawing); |
f0d936c0 |
48 | |
4c69e0cc |
49 | GtkWidget *drawing_get_widget(Drawing_t *Drawing); |
76a67e8a |
50 | |
847b479d |
51 | //void Drawing_Refresh ( Drawing_t *Drawing, |
52 | // guint x, guint y, |
53 | // guint width, guint height); |
54 | |
4c69e0cc |
55 | void drawing_draw_line( Drawing_t *Drawing, |
847b479d |
56 | GdkPixmap *Pixmap, |
57 | guint x1, guint y1, |
58 | guint x2, guint y2, |
76a67e8a |
59 | GdkGC *GC); |
60 | |
847b479d |
61 | //void Drawing_copy( Drawing_t *Drawing, |
62 | // guint xsrc, guint ysrc, |
63 | // guint xdest, guint ydest, |
64 | // guint width, guint height); |
f0d936c0 |
65 | |
5f16133f |
66 | /* Insert a square corresponding to a new process in the list */ |
4c69e0cc |
67 | void drawing_insert_square(Drawing_t *Drawing, |
5f16133f |
68 | guint y, |
69 | guint height); |
70 | |
71 | /* Remove a square corresponding to a removed process in the list */ |
4c69e0cc |
72 | void drawing_remove_square(Drawing_t *Drawing, |
5f16133f |
73 | guint y, |
74 | guint height); |
75 | |
f0d936c0 |
76 | |
847b479d |
77 | //void Drawing_Resize(Drawing_t *Drawing, guint h, guint w); |
76a67e8a |
78 | |
fa2c4dbe |
79 | void convert_pixels_to_time( |
80 | Drawing_t *Drawing, |
81 | guint x, |
82 | LttTime *window_time_begin, |
83 | LttTime *window_time_end, |
84 | LttTime *begin); |
85 | |
86 | void convert_time_to_pixels( |
87 | LttTime window_time_begin, |
88 | LttTime window_time_end, |
89 | LttTime time, |
90 | Drawing_t *Drawing, |
91 | guint *x); |
f0d936c0 |
92 | |
f0d936c0 |
93 | #endif // _DRAWING_H |