More intermediate cleanup
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / src / gtktraceset.h
1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Xiangxiu Yang
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16 * MA 02111-1307, USA.
17 */
18
19 /*
20 CHECK Rename to viewer.h
21
22 Things that can happen to a viewer:
23
24 update_time_window
25 update_current_time
26 update_traceset
27 update_filter
28 show_viewer
29 update_dividor
30 ?? Reshape, damage ??
31
32 Things that a viewer can do:
33
34 update_status
35 set_time_window
36 set_current_time
37 update_traceset?
38 update_filter?
39 show_viewer?
40 set_focused_pane
41 set_hpane_dividor
42 */
43
44
45
46
47 /*! \file gtktraceset.h
48 * \brief API used by the graphical viewers to interact with their top window.
49 *
50 * Main window (gui module) is the place to contain and display viewers.
51 * Viewers (lttv plugins) interacte with main window through this API and
52 * events sent by gtk.
53 * This header file should be included in each graphic module.
54 * This library is used by graphical modules to interact with the
55 * tracesetWindow.
56 *
57 */
58
59 #include <gtk/gtk.h>
60 #include <ltt/ltt.h>
61 #include <lttv/hook.h>
62 #include <lttvwindow/common.h>
63 #include <lttv/stats.h>
64
65 /**
66 * Function to register a view constructor so that main window can generate
67 * a toolbar item for the viewer in order to generate a new instance easily.
68 * It will be called by init function of the module.
69 * @param ButtonPixmap image shown on the toolbar item.
70 * @param tooltip tooltip of the toolbar item.
71 * @param view_constructor constructor of the viewer.
72 */
73
74 void toolbar_item_reg(char ** pixmap, char *tooltip, lttv_constructor view_constructor);
75
76
77 /**
78 * Function to unregister the viewer's constructor, release the space
79 * occupied by pixmap, tooltip and constructor of the viewer.
80 * It will be called when a module is unloaded.
81 * @param view_constructor constructor of the viewer which is used as
82 * a reference to find out where the pixmap and tooltip are.
83 */
84
85 void toolbar_item_unreg(lttv_constructor view_constructor);
86
87
88 /**
89 * Function to register a view constructor so that main window can generate
90 * a menu item for the viewer in order to generate a new instance easily.
91 * It will be called by init function of the module.
92 * @param menu_path path of the menu item.
93 * @param menu_text text of the menu item.
94 * @param view_constructor constructor of the viewer.
95 */
96
97 void menu_item_reg(char *menu_path, char *menu_text, lttv_constructor view_constructor);
98
99
100 /**
101 * Function to unregister the viewer's constructor, release the space
102 * occupied by menu_path, menu_text and constructor of the viewer.
103 * It will be called when a module is unloaded.
104 * @param view_constructor constructor of the viewer which is used as
105 * a reference to find out where the menu_path and menu_text are.
106 */
107
108 void menu_item_unreg(lttv_constructor view_constructor);
109
110
111 /**
112 * Update the status bar whenever something changed in the viewer.
113 * @param main_win the main window the viewer belongs to.
114 * @param info the message which will be shown in the status bar.
115 */
116
117 void update_status(MainWindow *main_win, char *info);
118
119
120 /**
121 * Function to get the current time window of the current tab.
122 * It will be called by a viewer's hook function to update the
123 * time window of the viewer and also be called by the constructor
124 * of the viewer.
125 * @param main_win the main window the viewer belongs to.
126 * @param time_interval a pointer where time interval will be stored.
127 */
128
129 void get_time_window(MainWindow *main_win, TimeWindow *time_window);
130
131
132 /**
133 * Function to set the time interval of the current tab.
134 * It will be called by a viewer's signal handle associated with
135 * the move_slider signal
136 * @param main_win the main window the viewer belongs to.
137 * @param time_interval a pointer where time interval is stored.
138 */
139
140 void set_time_window(MainWindow *main_win, TimeWindow *time_window);
141
142 /**
143 * Function to get the current time/event of the current tab.
144 * It will be called by a viewer's hook function to update the
145 * current time/event of the viewer.
146 * @param main_win the main window the viewer belongs to.
147 * @param time a pointer where time will be stored.
148 */
149
150 void get_current_time(MainWindow *main_win, LttTime *time);
151
152
153 /**
154 * Function to set the current time/event of the current tab.
155 * It will be called by a viewer's signal handle associated with
156 * the button-release-event signal
157 * @param main_win the main window the viewer belongs to.
158 * @param time a pointer where time is stored.
159 */
160
161 void set_current_time(MainWindow *main_win, LttTime *time);
162
163
164 /**
165 * Function to get the traceset from the current tab.
166 * It will be called by the constructor of the viewer and also be
167 * called by a hook funtion of the viewer to update its traceset.
168 * @param main_win the main window the viewer belongs to.
169 * @param traceset a pointer to a traceset.
170 */
171
172 //void get_traceset(MainWindow *main_win, Traceset *traceset);
173
174
175 /**
176 * Function to get the filter of the current tab.
177 * It will be called by the constructor of the viewer and also be
178 * called by a hook funtion of the viewer to update its filter.
179 * @param main_win, the main window the viewer belongs to.
180 * @param filter, a pointer to a filter.
181 */
182
183 //void get_filter(MainWindow *main_win, Filter *filter);
184
185
186 /**
187 * Function to register a hook function for a viewer to set/update its
188 * time interval.
189 * It will be called by the constructor of the viewer.
190 * @param hook hook function of the viewer. Takes a TimeInterval* as call_data.
191 * @param hook_data hook data associated with the hook function.
192 * @param main_win the main window the viewer belongs to.
193 */
194
195 void reg_update_time_window(LttvHook hook, gpointer hook_data,
196 MainWindow * main_win);
197
198
199 /**
200 * Function to unregister a viewer's hook function which is used to
201 * set/update the time interval of the viewer.
202 * It will be called by the destructor of the viewer.
203 * @param hook hook function of the viewer. Takes a TimeInterval as call_data.
204 * @param hook_data hook data associated with the hook function.
205 * @param main_win the main window the viewer belongs to.
206 */
207
208 void unreg_update_time_window(LttvHook hook, gpointer hook_data,
209 MainWindow * main_win);
210
211
212 /**
213 * Function to register a hook function for a viewer to set/update its
214 * traceset.
215 * It will be called by the constructor of the viewer.
216 * @param hook hook function of the viewer.
217 * @param hook_data hook data associated with the hook function.
218 * @param main_win the main window the viewer belongs to.
219 */
220
221 void reg_update_traceset(LttvHook hook, gpointer hook_data,
222 MainWindow * main_win);
223
224
225 /**
226 * Function to unregister a viewer's hook function which is used to
227 * set/update the traceset of the viewer.
228 * It will be called by the destructor of the viewer.
229 * @param hook hook function of the viewer.
230 * @param hook_data hook data associated with the hook function.
231 * @param main_win the main window the viewer belongs to.
232 */
233
234 void unreg_update_traceset(LttvHook hook, gpointer hook_data,
235 MainWindow * main_win);
236
237
238 /**
239 * Function to redraw each viewer belonging to the current tab
240 * @param main_win the main window the viewer belongs to.
241 */
242
243 void update_traceset(MainWindow * main_win);
244
245
246 /**
247 * Function to register a hook function for a viewer to set/update its
248 * filter.
249 * It will be called by the constructor of the viewer.
250 * @param hook hook function of the viewer.
251 * @param hook_data hook data associated with the hook function.
252 * @param main_win the main window the viewer belongs to.
253 */
254
255 void reg_update_filter(LttvHook hook, gpointer hook_data,
256 MainWindow *main_win);
257
258
259 /**
260 * Function to unregister a viewer's hook function which is used to
261 * set/update the filter of the viewer.
262 * It will be called by the destructor of the viewer.
263 * @param hook hook function of the viewer.
264 * @param hook_data hook data associated with the hook function.
265 * @param main_win the main window the viewer belongs to.
266 */
267
268 void unreg_update_filter(LttvHook hook, gpointer hook_data,
269 MainWindow * main_win);
270
271
272 /**
273 * Function to register a hook function for a viewer to set/update its
274 * current time.
275 * It will be called by the constructor of the viewer.
276 * @param hook hook function of the viewer.
277 * @param hook_data hook data associated with the hook function.
278 * @param main_win the main window the viewer belongs to.
279 */
280
281 void reg_update_current_time(LttvHook hook, gpointer hook_data,
282 MainWindow *main_win);
283
284
285 /**
286 * Function to unregister a viewer's hook function which is used to
287 * set/update the current time of the viewer.
288 * It will be called by the destructor 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 unreg_update_current_time(LttvHook hook, gpointer hook_data,
295 MainWindow * main_win);
296
297
298 /**
299 * Function to register a hook function for a viewer to show
300 *the content of the viewer.
301 * It will be called by the constructor 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 reg_show_viewer(LttvHook hook, gpointer hook_data,
308 MainWindow *main_win);
309
310
311 /**
312 * Function to unregister a viewer's hook function which is used to
313 * show the content of the viewer..
314 * It will be called by the destructor of the viewer.
315 * @param hook hook function of the viewer.
316 * @param hook_data hook data associated with the hook function.
317 * @param main_win the main window the viewer belongs to.
318 */
319
320 void unreg_show_viewer(LttvHook hook, gpointer hook_data,
321 MainWindow * main_win);
322
323
324 /**
325 * Function to show each viewer in the current tab.
326 * It will be called by main window after it called process_traceset
327 * @param main_win the main window the viewer belongs to.
328 */
329
330 void show_viewer(MainWindow *main_win);
331
332
333 /**
334 * Function to set the focused pane (viewer).
335 * It will be called by a viewer's signal handle associated with
336 * the grab_focus signal
337 * @param main_win the main window the viewer belongs to.
338 * @param paned a pointer to a pane where the viewer is contained.
339 */
340
341 void set_focused_pane(MainWindow *main_win, gpointer paned);
342
343
344 /**
345 * Function to register a hook function for a viewer to set/update the
346 * dividor of the hpane.
347 * It will be called by the constructor of the viewer.
348 * @param hook hook function of the viewer.
349 * @param hook_data hook data associated with the hook function.
350 * @param main_win the main window the viewer belongs to.
351 */
352
353 void reg_update_dividor(LttvHook hook, gpointer hook_data,
354 MainWindow *main_win);
355
356
357 /**
358 * Function to unregister a viewer's hook function which is used to
359 * set/update hpane's dividor of the viewer.
360 * It will be called by the destructor of the viewer.
361 * @param hook hook function of the viewer.
362 * @param hook_data hook data associated with the hook function.
363 * @param main_win the main window the viewer belongs to.
364 */
365
366 void unreg_update_dividor(LttvHook hook, gpointer hook_data,
367 MainWindow *main_win);
368
369
370 /**
371 * Function to set the position of the hpane's dividor (viewer).
372 * It will be called by a viewer's signal handle associated with
373 * the motion_notify_event event/signal
374 * @param main_win the main window the viewer belongs to.
375 * @param position position of the hpane's dividor.
376 */
377
378 void set_hpane_dividor(MainWindow *main_win, gint position);
379
380
381 /*
382 CHECK These functions really should not appear here. Directr calls would
383 be OK unless there is a linker problem.
384 */
385 /**
386 * Function to process traceset. It will call lttv_process_trace,
387 * each view will call this api to get events.
388 * @param main_win the main window the viewer belongs to.
389 * @param start the start time of the first event to be processed.
390 * @param end the end time of the last event to be processed.
391 */
392
393 void process_traceset_api(MainWindow *main_win, LttTime start,
394 LttTime end, unsigned maxNumEvents);
395
396
397 /**
398 * Function to add hooks into the context of a traceset,
399 * before reading events from traceset, viewer will call this api to
400 * register hooks
401 * @param main_win the main window the viewer belongs to.
402 * @param LttvHooks hooks to be registered.
403 */
404
405 void context_add_hooks_api(MainWindow *main_win ,
406 LttvHooks *before_traceset,
407 LttvHooks *after_traceset,
408 LttvHooks *check_trace,
409 LttvHooks *before_trace,
410 LttvHooks *after_trace,
411 LttvHooks *check_tracefile,
412 LttvHooks *before_tracefile,
413 LttvHooks *after_tracefile,
414 LttvHooks *check_event,
415 LttvHooks *before_event,
416 LttvHooks *after_event);
417
418
419 /**
420 * Function to remove hooks from the context of a traceset,
421 * before reading events from traceset, viewer will call this api to
422 * unregister hooks
423 * @param main_win the main window the viewer belongs to.
424 * @param LttvHooks hooks to be registered.
425 */
426
427 void context_remove_hooks_api(MainWindow *main_win ,
428 LttvHooks *before_traceset,
429 LttvHooks *after_traceset,
430 LttvHooks *check_trace,
431 LttvHooks *before_trace,
432 LttvHooks *after_trace,
433 LttvHooks *check_tracefile,
434 LttvHooks *before_tracefile,
435 LttvHooks *after_tracefile,
436 LttvHooks *check_event,
437 LttvHooks *before_event,
438 LttvHooks *after_event);
439
440
441 /**
442 * Function to get the life span of the traceset
443 * @param main_win the main window the viewer belongs to.
444 * @param start start time of the traceset.
445 * @param end end time of the traceset.
446 */
447
448 void get_traceset_time_span(MainWindow *main_win, TimeInterval *time_span);
449
450
451 /**
452 * Function to add/remove event hooks for state
453 * @param main_win the main window the viewer belongs to.
454 */
455
456 void state_add_event_hooks_api(MainWindow *main_win );
457 void state_remove_event_hooks_api(MainWindow *main_win );
458
459
460 /**
461 * Function to add/remove event hooks for stats
462 * @param main_win the main window the viewer belongs to.
463 */
464
465 void stats_add_event_hooks_api(MainWindow *main_win );
466 void stats_remove_event_hooks_api(MainWindow *main_win );
467
468
469 /**
470 * Function to get the stats of the traceset
471 * @param main_win the main window the viewer belongs to.
472 */
473
474 LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win);
475
476 LttvTracesetContext* get_traceset_context(MainWindow *main_win);
This page took 0.043184 seconds and 4 git commands to generate.