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