f0d936c0 |
1 | /***************************************************************************** |
2 | * Hooks to be called by the main window * |
3 | *****************************************************************************/ |
4 | |
f0d936c0 |
5 | |
558aa013 |
6 | #include <gtk/gtk.h> |
7 | #include <gdk/gdk.h> |
8 | #include <lttv/hook.h> |
9 | #include <lttv/common.h> |
f0d936c0 |
10 | |
11 | #include "CFV.h" |
12 | |
13 | /** |
14 | * Event Viewer's constructor hook |
15 | * |
16 | * This constructor is given as a parameter to the menuitem and toolbar button |
17 | * registration. It creates the list. |
18 | * @param pmParentWindow A pointer to the parent window. |
19 | * @return The widget created. |
20 | */ |
21 | GtkWidget * |
558aa013 |
22 | hGuiControlFlow(mainWindow *pmParentWindow) |
f0d936c0 |
23 | { |
24 | ControlFlowData* Control_Flow_Data = GuiControlFlow() ; |
25 | |
558aa013 |
26 | return GuiControlFlow_get_Widget(Control_Flow_Data) ; |
f0d936c0 |
27 | |
28 | } |
29 | |
30 | int Event_Selected_Hook(void *hook_data, void *call_data) |
31 | { |
32 | ControlFlowData *Control_Flow_Data = (ControlFlowData*) hook_data; |
33 | guint *Event_Number = (guint*) call_data; |
34 | |
35 | g_critical("DEBUG : event selected by main window : %u", *Event_Number); |
36 | |
37 | // Control_Flow_Data->Currently_Selected_Event = *Event_Number; |
38 | // Control_Flow_Data->Selected_Event = TRUE ; |
39 | |
40 | // Tree_V_set_cursor(Control_Flow_Data); |
41 | |
42 | } |
43 | |
558aa013 |
44 | #ifdef DEBUG |
f0d936c0 |
45 | /* Hook called before drawing. Gets the initial context at the beginning of the |
46 | * drawing interval and copy it to the context in Event_Request. |
47 | */ |
48 | int Draw_Before_Hook(void *hook_data, void *call_data) |
49 | { |
50 | EventRequest *Event_Request = (EventRequest*)hook_data; |
51 | EventsContext Events_Context = (EventsContext*)call_data; |
52 | |
53 | Event_Request->Events_Context = Events_Context; |
54 | |
55 | return 0; |
56 | } |
57 | |
58 | /* |
59 | * The draw event hook is called by the reading API to have a |
60 | * particular event drawn on the screen. |
61 | * @param hook_data ControlFlowData structure of the viewer. |
62 | * @param call_data Event context. |
63 | * |
64 | * This function basically draw lines and icons. Two types of lines are drawn : |
65 | * one small (3 pixels?) representing the state of the process and the second |
66 | * type is thicker (10 pixels?) representing on which CPU a process is running |
67 | * (and this only in running state). |
68 | * |
69 | * Extremums of the lines : |
70 | * x_min : time of the last event context for this process kept in memory. |
71 | * x_max : time of the current event. |
72 | * y : middle of the process in the process list. The process is found in the |
73 | * list, therefore is it's position in pixels. |
74 | * |
75 | * The choice of lines'color is defined by the context of the last event for this |
76 | * process. |
77 | */ |
78 | int Draw_Event_Hook(void *hook_data, void *call_data) |
79 | { |
80 | EventRequest *Event_Request = (EventRequest*)hook_data; |
81 | |
82 | return 0; |
83 | } |
84 | |
85 | |
86 | int Draw_After_Hook(void *hook_data, void *call_data) |
87 | { |
88 | EventRequest *Event_Request = (EventRequest*)hook_data; |
89 | |
90 | g_free(Event_Request); |
91 | return 0; |
92 | } |
558aa013 |
93 | #endif |