viewer.h API functions name change, second commit : breaks compilation
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / viewer.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 This file is what every viewer plugin writer should refer to.
21
22 - streamline the rest.
23
24 A viewer plugin is, before anything, a plugin. It thus has an init and
25 a destroy function called whenever it is loaded/initialized and
26 unloaded/destroyed. A viewer depends on lttvwindow and thus uses its init and
27 destroy functions to register viewer related hooks defined in this file.
28
29 The lifetime of a viewer is as follows. The viewer constructor function is
30 called each time an instance view is created (one subwindow of this viewer
31 type is created by the user). Thereafter, the viewer gets hooks called for
32 different purposes by the window containing it. These hooks are detailed
33 below.
34
35 show: called initially once the trace, position and time window are known.
36 Do the drawing or register hooks
37 process_trace for show: hooks called
38 show_end: remove the hooks
39
40 background_init: prepare for background computation (comes after show_end).
41 process_trace for background: done in small chunks in gtk_idle, hooks called.
42 background_end: remove the hooks and perhaps update the window.
43
44 update: called when the windows is exposed/resized, the time window is changed,
45 the current time is changed or the traceset is changed (different
46 traceset or traces added/removed. Redraw or register hooks.
47 process_trace for update: hooks called
48 update_end: remove the hooks.
49
50 There may be different versions of update functions for the different cases,
51 or the type of update may be described in an argument. The expose method
52 normally provides the exposed region. This should be used to register hooks
53 to process_traceset but also tell about the time interval for which it is
54 required. Then, a expose_end will be required to remove the hooks and finish
55 the display as needed.
56
57 In most cases, the enclosing window knows about updates such as a new trace
58 added to a traceset, time window updates caused by scrolling and even
59 expose events. There are a few cases, however, where updates are caused by
60 actions known by a view instance. For example, clicking in a view may update
61 the current time; all viewers within the same window must be told about the
62 new current time to change the currently highlighted time point. A viewer
63 reports such events by calling report_update on its lttvwindow. The lttvwindow
64 will thereafter call update for each of its contained viewers.
65
66
67 Things that can happen to a viewer:
68
69 update_time_window
70 update_current_time
71 update_traceset
72 update_filter
73 show_viewer
74 update_dividor
75 ?? Reshape, damage as gtk methods ??
76
77 Things that a viewer can do:
78
79 update_status
80 set_time_window
81 set_current_time
82 update_traceset?
83 update_filter?
84 show_viewer?
85 set_focused_pane
86 set_hpane_dividor
87 */
88
89
90
91
92 /*! \file viewer.h
93 * \brief API used by the graphical viewers to interact with their top window.
94 *
95 * Main window (gui module) is the place to contain and display viewers.
96 * Viewers (lttv plugins) interacte with main window through this API and
97 * events sent by gtk.
98 * This header file should be included in each graphic module.
99 * This library is used by graphical modules to interact with the
100 * tracesetWindow.
101 *
102 */
103
104 #include <gtk/gtk.h>
105 #include <ltt/ltt.h>
106 #include <lttv/hook.h>
107 #include <lttvwindow/common.h>
108 #include <lttv/stats.h>
109 #include <lttv/filter.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
120 void lttvwindow_viewer_register_toolbar(char ** pixmap, char *tooltip, lttvwindow_viewer_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
131 void lttvwindow_viewer_unregister_toolbar(lttvwindow_viewer_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
143 void lttvwindow_viewer_register_menu(char *menu_path, char *menu_text, lttvwindow_viewer_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
154 void lttvwindow_viewer_unregister_menu(lttvwindow_viewer_constructor view_constructor);
155
156
157 /**
158 * Function to register a hook function for a viewer to update its
159 * time interval.
160 * This register function is typically called by the constructor of the viewer.
161 * @param hook hook function of the viewer. Takes a TimeInterval* as call_data.
162 * @param hook_data hook data associated with the hook function.
163 * @param main_win the main window the viewer belongs to.
164 */
165
166 void lttvwindow_viewer_register_time_window_notify(MainWindow * main_win,
167 LttvHook hook, gpointer hook_data);
168
169
170 /**
171 * Function to unregister a viewer's hook function which is used to
172 * set/update the time interval of the viewer.
173 * This unregister function is typically called by the destructor of the viewer.
174 * @param hook hook function of the viewer. Takes a TimeInterval as call_data.
175 * @param hook_data hook data associated with the hook function.
176 * @param main_win the main window the viewer belongs to.
177 */
178
179 void lttvwindow_viewer_unregister_time_window_notify(MainWindow * main_win,
180 LttvHook hook, gpointer hook_data);
181
182
183 /**
184 * Function to register a hook function for a viewer to set/update its
185 * traceset.
186 * This register function is typically called by the constructor of the viewer.
187 * @param hook hook function of the viewer.
188 * @param hook_data hook data associated with the hook function.
189 * @param main_win the main window the viewer belongs to.
190 */
191
192 void lttvwindow_viewer_register_traceset_notify(MainWindow * main_win,
193 LttvHook hook, gpointer hook_data);
194
195
196 /**
197 * Function to unregister a viewer's hook function which is used to
198 * set/update the traceset of the viewer.
199 * @param hook hook function of the viewer.
200 * @param hook_data hook data associated with the hook function.
201 * @param main_win the main window the viewer belongs to.
202 */
203
204 void lttvwindow_viewer_unregister_traceset_notify(MainWindow * main_win,
205 LttvHook hook, gpointer hook_data);
206
207
208 /**
209 * Function to register a hook function for a viewer to set/update its
210 * filter.
211 * This register function is typically called by the constructor of the viewer.
212 * @param hook hook function of the viewer.
213 * @param hook_data hook data associated with the hook function.
214 * @param main_win the main window the viewer belongs to.
215 */
216
217 void lttvwindow_viewer_register_filter_notify(MainWindow *main_win,
218 LttvHook hook, gpointer hook_data);
219
220
221 /**
222 * Function to unregister a viewer's hook function which is used to
223 * set/update the filter of the viewer.
224 * This unregistration is called by the destructor of the viewer.
225 * @param hook hook function of the viewer.
226 * @param hook_data hook data associated with the hook function.
227 * @param main_win the main window the viewer belongs to.
228 */
229
230 void lttvwindow_viewer_unregister_filter_notify(LttvHook hook, gpointer hook_data,
231 MainWindow * main_win);
232
233
234 /**
235 * Function to register a hook function for a viewer to set/update its
236 * current time.
237 * @param hook hook function of the viewer.
238 * @param hook_data hook data associated with the hook function.
239 * @param main_win the main window the viewer belongs to.
240 */
241
242 void lttvwindow_viewer_register_current_time_notify(MainWindow *main_win,
243 LttvHook hook, gpointer hook_data);
244
245
246 /**
247 * Function to unregister a viewer's hook function which is used to
248 * set/update the current time of the viewer.
249 * @param hook hook function of the viewer.
250 * @param hook_data hook data associated with the hook function.
251 * @param main_win the main window the viewer belongs to.
252 */
253
254 void lttvwindow_viewer_unregister_current_time_notify(MainWindow * main_win,
255 LttvHook hook, gpointer hook_data);
256
257
258 /**
259 * Function to register a hook function for a viewer to show
260 * its content.
261 * @param hook hook function of the viewer.
262 * @param hook_data hook data associated with the hook function.
263 * @param main_win the main window the viewer belongs to.
264 */
265
266 void lttvwindow_viewer_register_show(MainWindow *main_win,
267 LttvHook hook, gpointer hook_data);
268
269
270 /**
271 * Function to unregister a viewer's hook function which is used to
272 * show the content of the viewer.
273 * @param hook hook function of the viewer.
274 * @param hook_data hook data associated with the hook function.
275 * @param main_win the main window the viewer belongs to.
276 */
277
278 void lttvwindow_viewer_unregister_show(MainWindow * main_win,
279 LttvHook hook, gpointer hook_data);
280
281
282
283
284
285
286
287
288 /**
289 * Update the status bar whenever something changed in the viewer.
290 * @param main_win the main window the viewer belongs to.
291 * @param info the message which will be shown in the status bar.
292 */
293
294 void lttvwindow_viewer_report_status(MainWindow *main_win, char *info);
295
296
297 /**
298 * Function to set the time interval of the current tab.
299 * It will be called by a viewer's signal handle associated with
300 * the move_slider signal
301 * @param main_win the main window the viewer belongs to.
302 * @param time_interval a pointer where time interval is stored.
303 */
304
305 void lttvwindow_viewer_report_time_window(MainWindow *main_win, TimeWindow *time_window);
306
307 /**
308 * Function to set the current time/event of the current tab.
309 * It will be called by a viewer's signal handle associated with
310 * the button-release-event signal
311 * @param main_win the main window the viewer belongs to.
312 * @param time a pointer where time is stored.
313 */
314
315 void lttvwindow_viewer_report_current_time(MainWindow *main_win, LttTime *time);
316
317
318 /**
319 * Function to set the position of the hpane's dividor (viewer).
320 * It will be called by a viewer's signal handle associated with
321 * the motion_notify_event event/signal
322 * @param main_win the main window the viewer belongs to.
323 * @param position position of the hpane's dividor.
324 */
325
326 void lttvwindow_viewer_report_dividor(MainWindow *main_win, gint position);
327
328 /**
329 * Function to redraw each viewer belonging to the current tab, when a traceset
330 * change has been made by the viewer.
331 * @param main_win the main window the viewer belongs to.
332 */
333 // FIXME : should never be directly changed by a viewer.
334 //void lttvwindow_viewer_report_traceset(MainWindow * main_win);
335
336
337 /**
338 * Function to show each viewer in the current tab.
339 * It will be called by main window after it called process_traceset
340 * @param main_win the main window the viewer belongs to.
341 */
342 //FIXME : not an API function, belongs to the main window.
343 //void lttvwindow_viewer_report_show(MainWindow *main_win);
344
345
346 /**
347 * Function to set the focused pane (viewer).
348 * It will be called by a viewer's signal handle associated with
349 * the grab_focus signal
350 * @param main_win the main window the viewer belongs to.
351 * @param paned a pointer to a pane where the viewer is contained.
352 */
353 //FIXME : can we do this through normal GTK signals ?
354 //void set_focused_pane(MainWindow *main_win, gpointer paned);
355
356
357 /**
358 * Function to register a hook function for a viewer to set/update the
359 * dividor of the hpane. It provides a way to make the horizontal
360 * dividors of all the viewers linked together.
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 lttvwindow_viewer_register_dividor(MainWindow *main_win,
367 LttvHook hook, gpointer hook_data);
368
369
370 /**
371 * Function to unregister a viewer's hook function which is used to
372 * set/update hpane's dividor of the viewer.
373 * @param hook hook function of the viewer.
374 * @param hook_data hook data associated with the hook function.
375 * @param main_win the main window the viewer belongs to.
376 */
377
378 void lttvwindow_viewer_unregister_dividor(MainWindow *main_win,
379 LttvHook hook, gpointer hook_data);
380
381
382 /**
383 * Function to get the life span of the traceset
384 * @param main_win the main window the viewer belongs to.
385 * @param start start time of the traceset.
386 * @param end end time of the traceset.
387 */
388
389 const TimeInterval *lttvwindow_viewer_get_time_span(MainWindow *main_win);
390
391 /**
392 * Function to get the current time window of the current tab.
393 * @param main_win the main window the viewer belongs to.
394 * @param time_interval a pointer where time interval will be stored.
395 */
396
397 const TimeWindow *lttvwindow_viewer_get_time_window(MainWindow *main_win);
398
399
400 /**
401 * Function to get the current time/event of the current tab.
402 * @param main_win the main window the viewer belongs to.
403 * @param time a pointer where time will be stored.
404 */
405
406 const LttTime *lttvwindow_viewer_get_current_time(MainWindow *main_win);
407
408 /**
409 * Function to get the traceset from the current tab.
410 * @param main_win the main window the viewer belongs to.
411 * @param traceset a pointer to a traceset.
412 */
413
414 const LttvTraceset *lttvwindow_viewer_get_traceset(MainWindow *main_win);
415
416
417 /**
418 * Function to get the filter of the current tab.
419 * @param main_win, the main window the viewer belongs to.
420 * @param filter, a pointer to a filter.
421 */
422
423 const lttv_filter *lttvwindow_viewer_get_filter(MainWindow *main_win);
424
425
426 /**
427 * Function to get the stats of the traceset
428 * @param main_win the main window the viewer belongs to.
429 */
430
431 LttvTracesetStats* lttvwindow_viewer_get_traceset_stats(MainWindow *main_win);
432
433 LttvTracesetContext* lttvwindow_viewer_get_traceset_context(MainWindow *main_win);
434
435
This page took 0.037834 seconds and 4 git commands to generate.