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