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