quit menu complete
[lttv.git] / ltt / branches / poly / lttv / modules / guiControlFlow / Event_Hooks.c
CommitLineData
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>
5f16133f 8#include <glib.h>
9
558aa013 10#include <lttv/hook.h>
11#include <lttv/common.h>
f0d936c0 12
1ab818de 13#include "Event_Hooks.h"
f0d936c0 14#include "CFV.h"
5f16133f 15#include "Process_List.h"
1ab3d149 16#include "Drawing.h"
5f16133f 17
96cfe486 18/* NOTE : no draing data should be sent there, as the drawing widget
19 * has not been initialized */
1ab3d149 20void send_test_data(ProcessList *Process_List, Drawing_t *Drawing)
5f16133f 21{
1ab3d149 22 guint height, size;
5f16133f 23 int i;
24 ProcessInfo Process_Info = {10000, 12000, 55600};
25 //ProcessInfo Process_Info = {156, 14000, 55500};
26 GtkTreeRowReference *got_RowRef;
27
28 LttTime birth;
29 birth.tv_sec = 12000;
30 birth.tv_nsec = 55500;
31
32 ProcessList_add(Process_List,
33 1,
34 &birth,
35 &height);
96cfe486 36 //Drawing_Insert_Square( Drawing, height, 5);
1ab3d149 37
5f16133f 38 g_critical("height : %u", height);
39
40 birth.tv_sec = 14000;
41 birth.tv_nsec = 55500;
42
43 ProcessList_add(Process_List,
44 156,
45 &birth,
46 &height);
96cfe486 47 //Drawing_Insert_Square( Drawing, height, 5);
5f16133f 48
49 g_critical("height : %u", height);
50
51 birth.tv_sec = 12000;
52 birth.tv_nsec = 55700;
53
54 ProcessList_add(Process_List,
55 10,
56 &birth,
57 &height);
96cfe486 58 //Drawing_Insert_Square( Drawing, height, 5);
5f16133f 59
60 for(i=0; i<10; i++)
61 {
62 birth.tv_sec = i*12000;
63 birth.tv_nsec = i*55700;
64
65 ProcessList_add(Process_List,
66 i,
67 &birth,
68 &height);
96cfe486 69 //Drawing_Insert_Square( Drawing, height, 5);
5f16133f 70
71 }
72 g_critical("height : %u", height);
73
74 birth.tv_sec = 12000;
75 birth.tv_nsec = 55600;
76
77 ProcessList_add(Process_List,
78 10,
79 &birth,
80 &height);
96cfe486 81 //Drawing_Insert_Square( Drawing, height, 5);
5f16133f 82 g_critical("height : %u", height);
83
84 ProcessList_add(Process_List,
85 10000,
86 &birth,
87 &height);
96cfe486 88 //Drawing_Insert_Square( Drawing, height, 5);
5f16133f 89 g_critical("height : %u", height);
90
91
1ab3d149 92 ProcessList_get_process_pixels(Process_List,
93 10000,
94 &birth,
95 &height, &size);
5f16133f 96 ProcessList_remove( Process_List,
97 10000,
98 &birth);
1ab3d149 99
96cfe486 100 //Drawing_Remove_Square( Drawing, height, 5);
5f16133f 101
102 if(got_RowRef =
103 (GtkTreeRowReference*)g_hash_table_lookup(
104 Process_List->Process_Hash,
105 &Process_Info))
106 {
107 g_critical("key found");
108 g_critical("position in the list : %s",
109 gtk_tree_path_to_string (
110 gtk_tree_row_reference_get_path(
111 (GtkTreeRowReference*)got_RowRef)
112 ));
113
114 }
115
116}
117
118
f0d936c0 119
120/**
121 * Event Viewer's constructor hook
122 *
123 * This constructor is given as a parameter to the menuitem and toolbar button
124 * registration. It creates the list.
125 * @param pmParentWindow A pointer to the parent window.
126 * @return The widget created.
127 */
128GtkWidget *
558aa013 129hGuiControlFlow(mainWindow *pmParentWindow)
f0d936c0 130{
1ab818de 131 g_critical("hGuiControlFlow");
132 ControlFlowData *Control_Flow_Data = GuiControlFlow() ;
f0d936c0 133
558aa013 134 return GuiControlFlow_get_Widget(Control_Flow_Data) ;
f0d936c0 135
136}
137
138int Event_Selected_Hook(void *hook_data, void *call_data)
139{
140 ControlFlowData *Control_Flow_Data = (ControlFlowData*) hook_data;
141 guint *Event_Number = (guint*) call_data;
142
143 g_critical("DEBUG : event selected by main window : %u", *Event_Number);
144
145// Control_Flow_Data->Currently_Selected_Event = *Event_Number;
146// Control_Flow_Data->Selected_Event = TRUE ;
147
148// Tree_V_set_cursor(Control_Flow_Data);
149
150}
151
558aa013 152#ifdef DEBUG
f0d936c0 153/* Hook called before drawing. Gets the initial context at the beginning of the
154 * drawing interval and copy it to the context in Event_Request.
155 */
156int Draw_Before_Hook(void *hook_data, void *call_data)
157{
158 EventRequest *Event_Request = (EventRequest*)hook_data;
159 EventsContext Events_Context = (EventsContext*)call_data;
160
161 Event_Request->Events_Context = Events_Context;
162
163 return 0;
164}
165
166/*
167 * The draw event hook is called by the reading API to have a
168 * particular event drawn on the screen.
169 * @param hook_data ControlFlowData structure of the viewer.
170 * @param call_data Event context.
171 *
172 * This function basically draw lines and icons. Two types of lines are drawn :
173 * one small (3 pixels?) representing the state of the process and the second
174 * type is thicker (10 pixels?) representing on which CPU a process is running
175 * (and this only in running state).
176 *
177 * Extremums of the lines :
178 * x_min : time of the last event context for this process kept in memory.
179 * x_max : time of the current event.
180 * y : middle of the process in the process list. The process is found in the
181 * list, therefore is it's position in pixels.
182 *
183 * The choice of lines'color is defined by the context of the last event for this
184 * process.
185 */
186int Draw_Event_Hook(void *hook_data, void *call_data)
187{
188 EventRequest *Event_Request = (EventRequest*)hook_data;
189
190 return 0;
191}
192
193
194int Draw_After_Hook(void *hook_data, void *call_data)
195{
196 EventRequest *Event_Request = (EventRequest*)hook_data;
197
198 g_free(Event_Request);
199 return 0;
200}
558aa013 201#endif
This page took 0.031509 seconds and 4 git commands to generate.