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
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
1ab3d149 18void send_test_data(ProcessList *Process_List, Drawing_t *Drawing)
5f16133f 19{
1ab3d149 20 guint height, size;
5f16133f 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);
1ab3d149 34 Drawing_Insert_Square( Drawing, height, 5);
35
5f16133f 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);
1ab3d149 45 Drawing_Insert_Square( Drawing, height, 5);
5f16133f 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);
1ab3d149 56 Drawing_Insert_Square( Drawing, height, 5);
5f16133f 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);
1ab3d149 67 Drawing_Insert_Square( Drawing, height, 5);
5f16133f 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);
1ab3d149 79 Drawing_Insert_Square( Drawing, height, 5);
5f16133f 80 g_critical("height : %u", height);
81
82 ProcessList_add(Process_List,
83 10000,
84 &birth,
85 &height);
1ab3d149 86 Drawing_Insert_Square( Drawing, height, 5);
5f16133f 87 g_critical("height : %u", height);
88
89
1ab3d149 90 ProcessList_get_process_pixels(Process_List,
91 10000,
92 &birth,
93 &height, &size);
5f16133f 94 ProcessList_remove( Process_List,
95 10000,
96 &birth);
1ab3d149 97
98 Drawing_Remove_Square( Drawing, height, 5);
5f16133f 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
f0d936c0 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 */
126GtkWidget *
558aa013 127hGuiControlFlow(mainWindow *pmParentWindow)
f0d936c0 128{
1ab818de 129 g_critical("hGuiControlFlow");
130 ControlFlowData *Control_Flow_Data = GuiControlFlow() ;
f0d936c0 131
558aa013 132 return GuiControlFlow_get_Widget(Control_Flow_Data) ;
f0d936c0 133
134}
135
136int 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
558aa013 150#ifdef DEBUG
f0d936c0 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 */
154int 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 */
184int Draw_Event_Hook(void *hook_data, void *call_data)
185{
186 EventRequest *Event_Request = (EventRequest*)hook_data;
187
188 return 0;
189}
190
191
192int 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}
558aa013 199#endif
This page took 0.030831 seconds and 4 git commands to generate.