name change from gtktraceset.c to viewer.c, Makefile.am
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / viewer.h
CommitLineData
3bc00fde 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
f95bc830 19/*
911b7a3c 20This file is what every viewer plugin writer should refer to.
21
911b7a3c 22- Remove the _api functions which add nothing
23- streamline the rest.
24
25A viewer plugin is, before anything, a plugin. It thus has an init and
26a destroy function called whenever it is loaded/initialized and
27unloaded/destroyed. A viewer depends on lttvwindow and thus uses its init and
28destroy functions to register viewer related hooks defined in this file.
29
30The lifetime of a viewer is as follows. The viewer constructor function is
31called each time an instance view is created (one subwindow of this viewer
32type is created by the user). Thereafter, the viewer gets hooks called for
33different purposes by the window containing it. These hooks are detailed
34below.
35
36show: called initially once the trace, position and time window are known.
37 Do the drawing or register hooks
38process_trace for show: hooks called
39show_end: remove the hooks
40
41background_init: prepare for background computation (comes after show_end).
42process_trace for background: done in small chunks in gtk_idle, hooks called.
43background_end: remove the hooks and perhaps update the window.
44
45update: called when the windows is exposed/resized, the time window is changed,
46 the current time is changed or the traceset is changed (different
47 traceset or traces added/removed. Redraw or register hooks.
48process_trace for update: hooks called
49update_end: remove the hooks.
50
51There may be different versions of update functions for the different cases,
52or the type of update may be described in an argument. The expose method
53normally provides the exposed region. This should be used to register hooks
54to process_traceset but also tell about the time interval for which it is
55required. Then, a expose_end will be required to remove the hooks and finish
56the display as needed.
57
58In most cases, the enclosing window knows about updates such as a new trace
59added to a traceset, time window updates caused by scrolling and even
60expose events. There are a few cases, however, where updates are caused by
61actions known by a view instance. For example, clicking in a view may update
62the current time; all viewers within the same window must be told about the
63new current time to change the currently highlighted time point. A viewer
64reports such events by calling report_update on its lttvwindow. The lttvwindow
65will thereafter call update for each of its contained viewers.
66
f95bc830 67
68Things that can happen to a viewer:
69
70update_time_window
71update_current_time
72update_traceset
73update_filter
74show_viewer
75update_dividor
911b7a3c 76?? Reshape, damage as gtk methods ??
f95bc830 77
78Things that a viewer can do:
79
80update_status
81set_time_window
82set_current_time
83update_traceset?
84update_filter?
85show_viewer?
86set_focused_pane
87set_hpane_dividor
88*/
89
90
91
92
36b40c74 93/*! \file viewer.h
3bc00fde 94 * \brief API used by the graphical viewers to interact with their top window.
95 *
96 * Main window (gui module) is the place to contain and display viewers.
97 * Viewers (lttv plugins) interacte with main window through this API and
98 * events sent by gtk.
99 * This header file should be included in each graphic module.
100 * This library is used by graphical modules to interact with the
101 * tracesetWindow.
102 *
103 */
104
105#include <gtk/gtk.h>
106#include <ltt/ltt.h>
107#include <lttv/hook.h>
13f86ce2 108#include <lttvwindow/common.h>
3bc00fde 109#include <lttv/stats.h>
110
111/**
112 * Function to register a view constructor so that main window can generate
113 * a toolbar item for the viewer in order to generate a new instance easily.
114 * It will be called by init function of the module.
115 * @param ButtonPixmap image shown on the toolbar item.
116 * @param tooltip tooltip of the toolbar item.
117 * @param view_constructor constructor of the viewer.
118 */
119
120void toolbar_item_reg(char ** pixmap, char *tooltip, lttv_constructor view_constructor);
121
122
123/**
124 * Function to unregister the viewer's constructor, release the space
125 * occupied by pixmap, tooltip and constructor of the viewer.
126 * It will be called when a module is unloaded.
127 * @param view_constructor constructor of the viewer which is used as
128 * a reference to find out where the pixmap and tooltip are.
129 */
130
131void toolbar_item_unreg(lttv_constructor view_constructor);
132
133
134/**
135 * Function to register a view constructor so that main window can generate
136 * a menu item for the viewer in order to generate a new instance easily.
137 * It will be called by init function of the module.
138 * @param menu_path path of the menu item.
139 * @param menu_text text of the menu item.
140 * @param view_constructor constructor of the viewer.
141 */
142
143void menu_item_reg(char *menu_path, char *menu_text, lttv_constructor view_constructor);
144
145
146/**
147 * Function to unregister the viewer's constructor, release the space
148 * occupied by menu_path, menu_text and constructor of the viewer.
149 * It will be called when a module is unloaded.
150 * @param view_constructor constructor of the viewer which is used as
151 * a reference to find out where the menu_path and menu_text are.
152 */
153
154void menu_item_unreg(lttv_constructor view_constructor);
155
156
157/**
158 * Update the status bar whenever something changed in the viewer.
159 * @param main_win the main window the viewer belongs to.
160 * @param info the message which will be shown in the status bar.
161 */
162
163void update_status(MainWindow *main_win, char *info);
164
165
166/**
167 * Function to get the current time window of the current tab.
168 * It will be called by a viewer's hook function to update the
169 * time window of the viewer and also be called by the constructor
170 * of the viewer.
171 * @param main_win the main window the viewer belongs to.
172 * @param time_interval a pointer where time interval will be stored.
173 */
174
175void get_time_window(MainWindow *main_win, TimeWindow *time_window);
176
177
178/**
179 * Function to set the time interval of the current tab.
180 * It will be called by a viewer's signal handle associated with
181 * the move_slider signal
182 * @param main_win the main window the viewer belongs to.
183 * @param time_interval a pointer where time interval is stored.
184 */
185
186void set_time_window(MainWindow *main_win, TimeWindow *time_window);
187
188/**
189 * Function to get the current time/event of the current tab.
190 * It will be called by a viewer's hook function to update the
191 * current time/event of the viewer.
192 * @param main_win the main window the viewer belongs to.
193 * @param time a pointer where time will be stored.
194 */
195
196void get_current_time(MainWindow *main_win, LttTime *time);
197
198
199/**
200 * Function to set the current time/event of the current tab.
201 * It will be called by a viewer's signal handle associated with
202 * the button-release-event signal
203 * @param main_win the main window the viewer belongs to.
204 * @param time a pointer where time is stored.
205 */
206
207void set_current_time(MainWindow *main_win, LttTime *time);
208
209
210/**
211 * Function to get the traceset from the current tab.
212 * It will be called by the constructor of the viewer and also be
213 * called by a hook funtion of the viewer to update its traceset.
214 * @param main_win the main window the viewer belongs to.
215 * @param traceset a pointer to a traceset.
216 */
217
218//void get_traceset(MainWindow *main_win, Traceset *traceset);
219
220
221/**
222 * Function to get the filter of the current tab.
223 * It will be called by the constructor of the viewer and also be
224 * called by a hook funtion of the viewer to update its filter.
225 * @param main_win, the main window the viewer belongs to.
226 * @param filter, a pointer to a filter.
227 */
228
229//void get_filter(MainWindow *main_win, Filter *filter);
230
231
232/**
233 * Function to register a hook function for a viewer to set/update its
234 * time interval.
235 * It will be called by the constructor of the viewer.
236 * @param hook hook function of the viewer. Takes a TimeInterval* as call_data.
237 * @param hook_data hook data associated with the hook function.
238 * @param main_win the main window the viewer belongs to.
239 */
240
241void reg_update_time_window(LttvHook hook, gpointer hook_data,
242 MainWindow * main_win);
243
244
245/**
246 * Function to unregister a viewer's hook function which is used to
247 * set/update the time interval of the viewer.
248 * It will be called by the destructor of the viewer.
249 * @param hook hook function of the viewer. Takes a TimeInterval as call_data.
250 * @param hook_data hook data associated with the hook function.
251 * @param main_win the main window the viewer belongs to.
252 */
253
254void unreg_update_time_window(LttvHook hook, gpointer hook_data,
255 MainWindow * main_win);
256
257
258/**
259 * Function to register a hook function for a viewer to set/update its
260 * traceset.
261 * It will be called by the constructor of the viewer.
262 * @param hook hook function of the viewer.
263 * @param hook_data hook data associated with the hook function.
264 * @param main_win the main window the viewer belongs to.
265 */
266
267void reg_update_traceset(LttvHook hook, gpointer hook_data,
268 MainWindow * main_win);
269
270
271/**
272 * Function to unregister a viewer's hook function which is used to
273 * set/update the traceset of the viewer.
274 * It will be called by the destructor of the viewer.
275 * @param hook hook function of the viewer.
276 * @param hook_data hook data associated with the hook function.
277 * @param main_win the main window the viewer belongs to.
278 */
279
280void unreg_update_traceset(LttvHook hook, gpointer hook_data,
281 MainWindow * main_win);
282
283
284/**
285 * Function to redraw each viewer belonging to the current tab
286 * @param main_win the main window the viewer belongs to.
287 */
288
289void update_traceset(MainWindow * main_win);
290
291
292/**
293 * Function to register a hook function for a viewer to set/update its
294 * filter.
295 * It will be called by the constructor of the viewer.
296 * @param hook hook function of the viewer.
297 * @param hook_data hook data associated with the hook function.
298 * @param main_win the main window the viewer belongs to.
299 */
300
301void reg_update_filter(LttvHook hook, gpointer hook_data,
302 MainWindow *main_win);
303
304
305/**
306 * Function to unregister a viewer's hook function which is used to
307 * set/update the filter of the viewer.
308 * It will be called by the destructor of the viewer.
309 * @param hook hook function of the viewer.
310 * @param hook_data hook data associated with the hook function.
311 * @param main_win the main window the viewer belongs to.
312 */
313
314void unreg_update_filter(LttvHook hook, gpointer hook_data,
315 MainWindow * main_win);
316
317
318/**
319 * Function to register a hook function for a viewer to set/update its
320 * current time.
321 * It will be called by the constructor of the viewer.
322 * @param hook hook function of the viewer.
323 * @param hook_data hook data associated with the hook function.
324 * @param main_win the main window the viewer belongs to.
325 */
326
327void reg_update_current_time(LttvHook hook, gpointer hook_data,
328 MainWindow *main_win);
329
330
331/**
332 * Function to unregister a viewer's hook function which is used to
333 * set/update the current time of the viewer.
334 * It will be called by the destructor of the viewer.
335 * @param hook hook function of the viewer.
336 * @param hook_data hook data associated with the hook function.
337 * @param main_win the main window the viewer belongs to.
338 */
339
340void unreg_update_current_time(LttvHook hook, gpointer hook_data,
341 MainWindow * main_win);
342
343
344/**
345 * Function to register a hook function for a viewer to show
346 *the content of the viewer.
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
353void reg_show_viewer(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 * show the content 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
366void unreg_show_viewer(LttvHook hook, gpointer hook_data,
367 MainWindow * main_win);
368
369
370/**
371 * Function to show each viewer in the current tab.
372 * It will be called by main window after it called process_traceset
373 * @param main_win the main window the viewer belongs to.
374 */
375
376void show_viewer(MainWindow *main_win);
377
378
379/**
380 * Function to set the focused pane (viewer).
381 * It will be called by a viewer's signal handle associated with
382 * the grab_focus signal
383 * @param main_win the main window the viewer belongs to.
384 * @param paned a pointer to a pane where the viewer is contained.
385 */
386
387void set_focused_pane(MainWindow *main_win, gpointer paned);
388
389
390/**
391 * Function to register a hook function for a viewer to set/update the
392 * dividor of the hpane.
393 * It will be called by the constructor of the viewer.
394 * @param hook hook function of the viewer.
395 * @param hook_data hook data associated with the hook function.
396 * @param main_win the main window the viewer belongs to.
397 */
398
399void reg_update_dividor(LttvHook hook, gpointer hook_data,
400 MainWindow *main_win);
401
402
403/**
404 * Function to unregister a viewer's hook function which is used to
405 * set/update hpane's dividor of the viewer.
406 * It will be called by the destructor of the viewer.
407 * @param hook hook function of the viewer.
408 * @param hook_data hook data associated with the hook function.
409 * @param main_win the main window the viewer belongs to.
410 */
411
412void unreg_update_dividor(LttvHook hook, gpointer hook_data,
413 MainWindow *main_win);
414
415
416/**
417 * Function to set the position of the hpane's dividor (viewer).
418 * It will be called by a viewer's signal handle associated with
419 * the motion_notify_event event/signal
420 * @param main_win the main window the viewer belongs to.
421 * @param position position of the hpane's dividor.
422 */
423
424void set_hpane_dividor(MainWindow *main_win, gint position);
425
426
f95bc830 427/*
428CHECK These functions really should not appear here. Directr calls would
429be OK unless there is a linker problem.
430*/
3bc00fde 431/**
432 * Function to process traceset. It will call lttv_process_trace,
433 * each view will call this api to get events.
434 * @param main_win the main window the viewer belongs to.
435 * @param start the start time of the first event to be processed.
436 * @param end the end time of the last event to be processed.
437 */
438
439void process_traceset_api(MainWindow *main_win, LttTime start,
440 LttTime end, unsigned maxNumEvents);
441
442
443/**
444 * Function to add hooks into the context of a traceset,
445 * before reading events from traceset, viewer will call this api to
446 * register hooks
447 * @param main_win the main window the viewer belongs to.
448 * @param LttvHooks hooks to be registered.
449 */
450
451void context_add_hooks_api(MainWindow *main_win ,
452 LttvHooks *before_traceset,
453 LttvHooks *after_traceset,
454 LttvHooks *check_trace,
455 LttvHooks *before_trace,
456 LttvHooks *after_trace,
457 LttvHooks *check_tracefile,
458 LttvHooks *before_tracefile,
459 LttvHooks *after_tracefile,
460 LttvHooks *check_event,
461 LttvHooks *before_event,
462 LttvHooks *after_event);
463
464
465/**
466 * Function to remove hooks from the context of a traceset,
467 * before reading events from traceset, viewer will call this api to
468 * unregister hooks
469 * @param main_win the main window the viewer belongs to.
470 * @param LttvHooks hooks to be registered.
471 */
472
473void context_remove_hooks_api(MainWindow *main_win ,
474 LttvHooks *before_traceset,
475 LttvHooks *after_traceset,
476 LttvHooks *check_trace,
477 LttvHooks *before_trace,
478 LttvHooks *after_trace,
479 LttvHooks *check_tracefile,
480 LttvHooks *before_tracefile,
481 LttvHooks *after_tracefile,
482 LttvHooks *check_event,
483 LttvHooks *before_event,
484 LttvHooks *after_event);
485
486
487/**
488 * Function to get the life span of the traceset
489 * @param main_win the main window the viewer belongs to.
490 * @param start start time of the traceset.
491 * @param end end time of the traceset.
492 */
493
494void get_traceset_time_span(MainWindow *main_win, TimeInterval *time_span);
495
496
497/**
498 * Function to add/remove event hooks for state
499 * @param main_win the main window the viewer belongs to.
500 */
501
502void state_add_event_hooks_api(MainWindow *main_win );
503void state_remove_event_hooks_api(MainWindow *main_win );
504
505
506/**
507 * Function to add/remove event hooks for stats
508 * @param main_win the main window the viewer belongs to.
509 */
510
511void stats_add_event_hooks_api(MainWindow *main_win );
512void stats_remove_event_hooks_api(MainWindow *main_win );
513
514
515/**
516 * Function to get the stats of the traceset
517 * @param main_win the main window the viewer belongs to.
518 */
519
520LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win);
521
522LttvTracesetContext* get_traceset_context(MainWindow *main_win);
This page took 0.041431 seconds and 4 git commands to generate.