fcdf0ec2 |
1 | /*! \file gtkTraceSet.h |
2 | * \brief API used by the graphical viewers to interact with their top window. |
3 | * |
4 | * Main window (gui module) is the place to contain and display viewers. |
5 | * Viewers (lttv plugins) interacte with main window through this API and |
6 | * events sent by gtk. |
c5d77517 |
7 | * This header file should be included in each graphic module. |
fcdf0ec2 |
8 | * This library is used by graphical modules to interact with the |
9 | * tracesetWindow. |
10 | * |
c5d77517 |
11 | */ |
12 | |
13 | #include <gtk/gtk.h> |
14 | #include <ltt/ltt.h> |
15 | #include <lttv/hook.h> |
9af25d1f |
16 | #include <lttv/common.h> |
6b1d3120 |
17 | #include <lttv/stats.h> |
c5d77517 |
18 | |
19 | /** |
20 | * Function to register a view constructor so that main window can generate |
21 | * a toolbar item for the viewer in order to generate a new instance easily. |
22 | * It will be called by init function of the module. |
fcdf0ec2 |
23 | * @param ButtonPixmap image shown on the toolbar item. |
24 | * @param tooltip tooltip of the toolbar item. |
25 | * @param view_constructor constructor of the viewer. |
c5d77517 |
26 | */ |
27 | |
ee300ef7 |
28 | void ToolbarItemReg(char ** pixmap, char *tooltip, lttv_constructor view_constructor); |
c5d77517 |
29 | |
30 | |
31 | /** |
32 | * Function to unregister the viewer's constructor, release the space |
33 | * occupied by pixmap, tooltip and constructor of the viewer. |
34 | * It will be called when a module is unloaded. |
fcdf0ec2 |
35 | * @param view_constructor constructor of the viewer which is used as |
c5d77517 |
36 | * a reference to find out where the pixmap and tooltip are. |
37 | */ |
38 | |
ee300ef7 |
39 | void ToolbarItemUnreg(lttv_constructor view_constructor); |
c5d77517 |
40 | |
41 | |
42 | /** |
43 | * Function to register a view constructor so that main window can generate |
44 | * a menu item for the viewer in order to generate a new instance easily. |
45 | * It will be called by init function of the module. |
fcdf0ec2 |
46 | * @param menu_path path of the menu item. |
47 | * @param menu_text text of the menu item. |
48 | * @param view_constructor constructor of the viewer. |
c5d77517 |
49 | */ |
50 | |
ee300ef7 |
51 | void MenuItemReg(char *menu_path, char *menu_text, lttv_constructor view_constructor); |
c5d77517 |
52 | |
53 | |
54 | /** |
55 | * Function to unregister the viewer's constructor, release the space |
56 | * occupied by menu_path, menu_text and constructor of the viewer. |
57 | * It will be called when a module is unloaded. |
fcdf0ec2 |
58 | * @param view_constructor constructor of the viewer which is used as |
c5d77517 |
59 | * a reference to find out where the menu_path and menu_text are. |
60 | */ |
61 | |
ee300ef7 |
62 | void MenuItemUnreg(lttv_constructor view_constructor); |
c5d77517 |
63 | |
64 | |
65 | /** |
66 | * Attach a viewer to the current tab. |
67 | * It will be called in the constructor of the viewer. |
fcdf0ec2 |
68 | * @param main_win the main window the viewer belongs to. |
69 | * @param viewer viewer to be attached to the current tab |
c5d77517 |
70 | */ |
71 | |
fcdf0ec2 |
72 | // Not Needed : Main window add widget returned by constructor |
10bc4f50 |
73 | //void AttachViewer(mainWindow *main_win, GtkWidget *viewer); |
c5d77517 |
74 | |
75 | |
fcdf0ec2 |
76 | /* ?? Maybe we do not need this function, when a widget is destroyed, |
c5d77517 |
77 | * it will be removed automatically from its container |
78 | */ |
fcdf0ec2 |
79 | // Not needed |
c5d77517 |
80 | /** |
81 | * Detach a viewer from the current tab. |
82 | * It will be called in the destructor of the viewer. |
fcdf0ec2 |
83 | * @param main_win the main window the viewer belongs to. |
84 | * @param viewer viewer to be detached from the current tab. |
c5d77517 |
85 | */ |
86 | |
10bc4f50 |
87 | //void DetachViewer(mainWindow *main_win, GtkWidget *viewer); |
c5d77517 |
88 | |
89 | |
90 | /** |
91 | * Update the status bar whenever something changed in the viewer. |
fcdf0ec2 |
92 | * @param main_win the main window the viewer belongs to. |
93 | * @param info the message which will be shown in the status bar. |
c5d77517 |
94 | */ |
95 | |
10bc4f50 |
96 | void UpdateStatus(mainWindow *main_win, char *info); |
c5d77517 |
97 | |
98 | |
99 | /** |
f7afe191 |
100 | * Function to get the current time window of the current tab. |
c5d77517 |
101 | * It will be called by a viewer's hook function to update the |
f7afe191 |
102 | * time window of the viewer and also be called by the constructor |
c5d77517 |
103 | * of the viewer. |
fcdf0ec2 |
104 | * @param main_win the main window the viewer belongs to. |
105 | * @param time_interval a pointer where time interval will be stored. |
c5d77517 |
106 | */ |
107 | |
a2eab0c9 |
108 | void GetTimeWindow(mainWindow *main_win, TimeWindow *time_window); |
c5d77517 |
109 | |
110 | |
111 | /** |
112 | * Function to set the time interval of the current tab. |
113 | * It will be called by a viewer's signal handle associated with |
114 | * the move_slider signal |
fcdf0ec2 |
115 | * @param main_win the main window the viewer belongs to. |
116 | * @param time_interval a pointer where time interval is stored. |
c5d77517 |
117 | */ |
118 | |
a2eab0c9 |
119 | void SetTimeWindow(mainWindow *main_win, TimeWindow *time_window); |
c5d77517 |
120 | |
f7afe191 |
121 | /** |
122 | * Function to get the time span of the main window's traceset. |
123 | */ |
a2eab0c9 |
124 | void GetTracesetTimeSpan(mainWindow *main_win, TimeInterval *time_interval); |
c5d77517 |
125 | |
126 | /** |
127 | * Function to get the current time/event of the current tab. |
128 | * It will be called by a viewer's hook function to update the |
129 | * current time/event of the viewer. |
fcdf0ec2 |
130 | * @param main_win the main window the viewer belongs to. |
10bc4f50 |
131 | * @param time a pointer where time will be stored. |
c5d77517 |
132 | */ |
133 | |
10bc4f50 |
134 | void GetCurrentTime(mainWindow *main_win, LttTime *time); |
c5d77517 |
135 | |
136 | |
137 | /** |
138 | * Function to set the current time/event of the current tab. |
139 | * It will be called by a viewer's signal handle associated with |
140 | * the button-release-event signal |
fcdf0ec2 |
141 | * @param main_win the main window the viewer belongs to. |
10bc4f50 |
142 | * @param time a pointer where time is stored. |
c5d77517 |
143 | */ |
144 | |
10bc4f50 |
145 | void SetCurrentTime(mainWindow *main_win, LttTime *time); |
c5d77517 |
146 | |
147 | |
148 | /** |
149 | * Function to get the traceset from the current tab. |
150 | * It will be called by the constructor of the viewer and also be |
151 | * called by a hook funtion of the viewer to update its traceset. |
fcdf0ec2 |
152 | * @param main_win the main window the viewer belongs to. |
153 | * @param traceset a pointer to a traceset. |
c5d77517 |
154 | */ |
155 | |
10bc4f50 |
156 | //void GetTraceset(mainWindow *main_win, Traceset *traceset); |
c5d77517 |
157 | |
158 | |
159 | /** |
160 | * Function to get the filter of the current tab. |
161 | * It will be called by the constructor of the viewer and also be |
162 | * called by a hook funtion of the viewer to update its filter. |
163 | * @param main_win, the main window the viewer belongs to. |
164 | * @param filter, a pointer to a filter. |
165 | */ |
166 | |
10bc4f50 |
167 | //void GetFilter(mainWindow *main_win, Filter *filter); |
c5d77517 |
168 | |
169 | |
170 | /** |
171 | * Function to register a hook function for a viewer to set/update its |
172 | * time interval. |
173 | * It will be called by the constructor of the viewer. |
f7afe191 |
174 | * @param hook hook function of the viewer. Takes a TimeInterval* as call_data. |
fcdf0ec2 |
175 | * @param hook_data hook data associated with the hook function. |
176 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
177 | */ |
178 | |
10bc4f50 |
179 | void RegUpdateTimeInterval(LttvHook hook, gpointer hook_data, |
180 | mainWindow * main_win); |
c5d77517 |
181 | |
182 | |
183 | /** |
184 | * Function to unregister a viewer's hook function which is used to |
185 | * set/update the time interval of the viewer. |
186 | * It will be called by the destructor of the viewer. |
f7afe191 |
187 | * @param hook hook function of the viewer. Takes a TimeInterval as call_data. |
fcdf0ec2 |
188 | * @param hook_data hook data associated with the hook function. |
189 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
190 | */ |
191 | |
10bc4f50 |
192 | void UnregUpdateTimeInterval(LttvHook hook, gpointer hook_data, |
193 | mainWindow * main_win); |
c5d77517 |
194 | |
195 | |
196 | /** |
197 | * Function to register a hook function for a viewer to set/update its |
198 | * traceset. |
199 | * It will be called by the constructor of the viewer. |
fcdf0ec2 |
200 | * @param hook hook function of the viewer. |
201 | * @param hook_data hook data associated with the hook function. |
202 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
203 | */ |
204 | |
10bc4f50 |
205 | void RegUpdateTraceset(LttvHook hook, gpointer hook_data, |
206 | mainWindow * main_win); |
c5d77517 |
207 | |
208 | |
209 | /** |
210 | * Function to unregister a viewer's hook function which is used to |
211 | * set/update the traceset of the viewer. |
212 | * It will be called by the destructor of the viewer. |
fcdf0ec2 |
213 | * @param hook hook function of the viewer. |
214 | * @param hook_data hook data associated with the hook function. |
215 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
216 | */ |
217 | |
10bc4f50 |
218 | void UnregUpdateTraceset(LttvHook hook, gpointer hook_data, |
219 | mainWindow * main_win); |
c5d77517 |
220 | |
221 | |
222 | /** |
223 | * Function to register a hook function for a viewer to set/update its |
224 | * filter. |
225 | * It will be called by the constructor of the viewer. |
fcdf0ec2 |
226 | * @param hook hook function of the viewer. |
227 | * @param hook_data hook data associated with the hook function. |
228 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
229 | */ |
230 | |
10bc4f50 |
231 | void RegUpdateFilter(LttvHook hook, gpointer hook_data, |
232 | mainWindow *main_win); |
c5d77517 |
233 | |
234 | |
235 | /** |
236 | * Function to unregister a viewer's hook function which is used to |
237 | * set/update the filter of the viewer. |
238 | * It will be called by the destructor of the viewer. |
fcdf0ec2 |
239 | * @param hook hook function of the viewer. |
240 | * @param hook_data hook data associated with the hook function. |
241 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
242 | */ |
243 | |
10bc4f50 |
244 | void UnregUpdateFilter(LttvHook hook, gpointer hook_data, |
245 | mainWindow * main_win); |
c5d77517 |
246 | |
247 | |
248 | /** |
249 | * Function to register a hook function for a viewer to set/update its |
250 | * current time. |
251 | * It will be called by the constructor of the viewer. |
fcdf0ec2 |
252 | * @param hook hook function of the viewer. |
253 | * @param hook_data hook data associated with the hook function. |
254 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
255 | */ |
256 | |
10bc4f50 |
257 | void RegUpdateCurrentTime(LttvHook hook, gpointer hook_data, |
258 | mainWindow *main_win); |
c5d77517 |
259 | |
260 | |
261 | /** |
262 | * Function to unregister a viewer's hook function which is used to |
263 | * set/update the current time of the viewer. |
264 | * It will be called by the destructor of the viewer. |
fcdf0ec2 |
265 | * @param hook hook function of the viewer. |
266 | * @param hook_data hook data associated with the hook function. |
267 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
268 | */ |
269 | |
10bc4f50 |
270 | void UnregUpdateCurrentTime(LttvHook hook, gpointer hook_data, |
271 | mainWindow * main_win); |
272 | |
273 | |
274 | /** |
275 | * Function to set the focused pane (viewer). |
276 | * It will be called by a viewer's signal handle associated with |
277 | * the grab_focus signal |
278 | * @param main_win the main window the viewer belongs to. |
279 | * @param paned a pointer to a pane where the viewer is contained. |
280 | */ |
281 | |
282 | void SetFocusedPane(mainWindow *main_win, gpointer paned); |
283 | |
284 | |
285 | /** |
286 | * Function to register a hook function for a viewer to set/update the |
287 | * dividor of the hpane. |
288 | * It will be called by the constructor of the viewer. |
289 | * @param hook hook function of the viewer. |
290 | * @param hook_data hook data associated with the hook function. |
291 | * @param main_win the main window the viewer belongs to. |
292 | */ |
293 | |
294 | void RegUpdateDividor(LttvHook hook, gpointer hook_data, |
295 | mainWindow *main_win); |
296 | |
297 | |
298 | /** |
299 | * Function to unregister a viewer's hook function which is used to |
300 | * set/update hpane's dividor of the viewer. |
301 | * It will be called by the destructor of the viewer. |
302 | * @param hook hook function of the viewer. |
303 | * @param hook_data hook data associated with the hook function. |
304 | * @param main_win the main window the viewer belongs to. |
305 | */ |
306 | |
307 | void UnregUpdateDividor(LttvHook hook, gpointer hook_data, |
308 | mainWindow *main_win); |
309 | |
310 | |
311 | /** |
312 | * Function to set the position of the hpane's dividor (viewer). |
313 | * It will be called by a viewer's signal handle associated with |
314 | * the motion_notify_event event/signal |
315 | * @param main_win the main window the viewer belongs to. |
316 | * @param position position of the hpane's dividor. |
317 | */ |
318 | |
319 | void SetHPaneDividor(mainWindow *main_win, gint position); |
320 | |
321 | |
322 | /** |
323 | * Function to process traceset. It will call lttv_process_trace, |
324 | * each view will call this api to get events. |
325 | * @param main_win the main window the viewer belongs to. |
326 | * @param start the start time of the first event to be processed. |
327 | * @param end the end time of the last event to be processed. |
328 | */ |
329 | |
f4f8f203 |
330 | void processTraceset(mainWindow *main_win, LttTime start, |
331 | LttTime end, unsigned maxNumEvents); |
10bc4f50 |
332 | |
333 | |
334 | /** |
335 | * Function to add hooks into the context of a traceset, |
336 | * before reading events from traceset, viewer will call this api to |
337 | * register hooks |
338 | * @param main_win the main window the viewer belongs to. |
339 | * @param LttvHooks hooks to be registered. |
340 | */ |
341 | |
342 | void contextAddHooks(mainWindow *main_win , |
343 | LttvHooks *before_traceset, |
344 | LttvHooks *after_traceset, |
345 | LttvHooks *check_trace, |
346 | LttvHooks *before_trace, |
347 | LttvHooks *after_trace, |
348 | LttvHooks *check_tracefile, |
349 | LttvHooks *before_tracefile, |
350 | LttvHooks *after_tracefile, |
351 | LttvHooks *check_event, |
352 | LttvHooks *before_event, |
353 | LttvHooks *after_event); |
354 | |
355 | |
356 | /** |
357 | * Function to remove hooks from the context of a traceset, |
358 | * before reading events from traceset, viewer will call this api to |
359 | * unregister hooks |
360 | * @param main_win the main window the viewer belongs to. |
361 | * @param LttvHooks hooks to be registered. |
362 | */ |
363 | |
364 | void contextRemoveHooks(mainWindow *main_win , |
365 | LttvHooks *before_traceset, |
366 | LttvHooks *after_traceset, |
367 | LttvHooks *check_trace, |
368 | LttvHooks *before_trace, |
369 | LttvHooks *after_trace, |
370 | LttvHooks *check_tracefile, |
371 | LttvHooks *before_tracefile, |
372 | LttvHooks *after_tracefile, |
373 | LttvHooks *check_event, |
374 | LttvHooks *before_event, |
375 | LttvHooks *after_event); |
c5d77517 |
376 | |
377 | |
fb1a869e |
378 | /** |
379 | * Function to get the life span of the traceset |
380 | * @param main_win the main window the viewer belongs to. |
381 | * @param start start time of the traceset. |
382 | * @param end end time of the traceset. |
383 | */ |
384 | |
f7afe191 |
385 | void getTracesetTimeSpan(mainWindow *main_win, TimeInterval *time_span); |
6b1d3120 |
386 | |
387 | |
388 | /** |
389 | * Function to add/remove event hooks for state |
390 | * @param main_win the main window the viewer belongs to. |
391 | */ |
392 | |
393 | void stateAddEventHooks(mainWindow *main_win ); |
394 | void stateRemoveEventHooks(mainWindow *main_win ); |
395 | |
396 | |
397 | /** |
398 | * Function to add/remove event hooks for stats |
399 | * @param main_win the main window the viewer belongs to. |
400 | */ |
401 | |
402 | void statsAddEventHooks(mainWindow *main_win ); |
403 | void statsRemoveEventHooks(mainWindow *main_win ); |
404 | |
405 | |
406 | /** |
407 | * Function to get the stats of the traceset |
408 | * @param main_win the main window the viewer belongs to. |
409 | */ |
410 | |
411 | LttvTracesetStats* getTracesetStats(mainWindow *main_win); |