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