| 1 | #ifndef _DRAWING_H |
| 2 | #define _DRAWING_H |
| 3 | |
| 4 | #include <glib.h> |
| 5 | #include <gdk/gdk.h> |
| 6 | #include <gtk/gtk.h> |
| 7 | #include <ltt/ltt.h> |
| 8 | |
| 9 | /* This part of the viewer does : |
| 10 | * Draw horizontal lines, getting graphic context as arg. |
| 11 | * Copy region of the screen into another. |
| 12 | * Modify the boundaries to reflect a scale change. (resize) |
| 13 | * Refresh the physical screen with the pixmap |
| 14 | * A helper function is provided here to convert from time and process |
| 15 | * identifier to pixels and the contrary (will be useful for mouse selection). |
| 16 | * Insert an empty square in the drawing, moving the bottom part. |
| 17 | * |
| 18 | * The pixmap used has the width of the physical window, but the height |
| 19 | * of the shown processes. |
| 20 | */ |
| 21 | |
| 22 | typedef struct _Drawing_t Drawing_t; |
| 23 | |
| 24 | Drawing_t *Drawing_construct(void); |
| 25 | void Drawing_destroy(Drawing_t *Drawing); |
| 26 | |
| 27 | GtkWidget *Drawing_getWidget(Drawing_t *Drawing); |
| 28 | |
| 29 | //void Drawing_Refresh ( Drawing_t *Drawing, |
| 30 | // guint x, guint y, |
| 31 | // guint width, guint height); |
| 32 | |
| 33 | void Drawing_draw_line( Drawing_t *Drawing, |
| 34 | GdkPixmap *Pixmap, |
| 35 | guint x1, guint y1, |
| 36 | guint x2, guint y2, |
| 37 | GdkGC *GC); |
| 38 | |
| 39 | //void Drawing_copy( Drawing_t *Drawing, |
| 40 | // guint xsrc, guint ysrc, |
| 41 | // guint xdest, guint ydest, |
| 42 | // guint width, guint height); |
| 43 | |
| 44 | /* Insert a square corresponding to a new process in the list */ |
| 45 | void Drawing_Insert_Square(Drawing_t *Drawing, |
| 46 | guint y, |
| 47 | guint height); |
| 48 | |
| 49 | /* Remove a square corresponding to a removed process in the list */ |
| 50 | void Drawing_Remove_Square(Drawing_t *Drawing, |
| 51 | guint y, |
| 52 | guint height); |
| 53 | |
| 54 | |
| 55 | //void Drawing_Resize(Drawing_t *Drawing, guint h, guint w); |
| 56 | |
| 57 | void convert_pixels_to_time( |
| 58 | Drawing_t *Drawing, |
| 59 | guint x, |
| 60 | LttTime *window_time_begin, |
| 61 | LttTime *window_time_end, |
| 62 | LttTime *begin); |
| 63 | |
| 64 | void convert_time_to_pixels( |
| 65 | LttTime window_time_begin, |
| 66 | LttTime window_time_end, |
| 67 | LttTime time, |
| 68 | Drawing_t *Drawing, |
| 69 | guint *x); |
| 70 | |
| 71 | #endif // _DRAWING_H |