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