c85f674c |
1 | /* This file is part of the Linux Trace Toolkit Graphic User Interface |
5a5b35c5 |
2 | * Copyright (C) 2003-2004 Xiangxiu Yang, Mathieu Desnoyers |
3bc00fde |
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 |
20 | This file is what every viewer plugin writer should refer to. |
21 | |
5a5b35c5 |
22 | |
23 | Module Related API |
911b7a3c |
24 | |
c85f674c |
25 | A viewer plugin is, before anything, a plugin. As a dynamically loadable |
26 | module, it thus has an init and a destroy function called whenever it is |
27 | loaded/initialized and unloaded/destroyed. A graphical module depends on |
28 | lttvwindow for construction of its viewer instances. In order to achieve this, |
29 | it must register its constructor function to the main window along with |
30 | button description or text menu entry description. A module keeps a list of |
31 | every viewer that currently sits in memory so it can destroy them before the |
32 | module gets unloaded/destroyed. |
5a5b35c5 |
33 | |
ec2b1ff7 |
34 | The contructor registration to the main window adds button and menu entry |
35 | to each main window, thus allowing instanciation of viewers. |
36 | |
5a5b35c5 |
37 | |
84d9b2a1 |
38 | Main Window |
39 | |
40 | The main window is a container that offers menus, buttons and a notebook. Some |
41 | of those menus and buttons are part of the core of the main window, others |
42 | are dynamically added and removed when modules are loaded/unloaded. |
43 | |
44 | The notebook contains as much tabs as wanted. Each tab is linked with a |
45 | set of traces (traceset). Each trace contains many tracefiles (one per cpu). |
46 | A trace corresponds to a kernel being traced. A traceset corresponds to |
47 | many traces read together. The time span of a traceset goes from the |
48 | earliest start of all the traces to the latest end of all the traces. |
49 | |
50 | Inside each tab are added the viewers. When they interact with the main |
51 | window through the lttvwindow API, they affect the other viewers located |
52 | in the same tab as they are. |
53 | |
54 | The insertion of many viewers in a tab permits a quick look at all the |
55 | information wanted in a glance. The main window does merge the read requests |
56 | from all the viewers in the same tab in a way that every viewer will get exactly |
57 | the events it asked for, while the event reading loop and state update are |
58 | shared. It improves performance of events delivery to the viewers. |
59 | |
60 | |
61 | |
5a5b35c5 |
62 | Viewer Instance Related API |
911b7a3c |
63 | |
64 | The lifetime of a viewer is as follows. The viewer constructor function is |
65 | called each time an instance view is created (one subwindow of this viewer |
5a5b35c5 |
66 | type is created by the user either by clicking on the menu item or the button |
67 | corresponding to the viewer). Thereafter, the viewer gets hooks called for |
911b7a3c |
68 | different purposes by the window containing it. These hooks are detailed |
5a5b35c5 |
69 | below. It also has to deal with GTK Events. Finally, it can be destructed by |
70 | having its top level widget unreferenced by the main window or by any |
71 | GTK Event causing a "destroy-event" signal on the its top widget. Another |
72 | possible way for it do be destroyed is if the module gets unloaded. The module |
73 | unload function will have to emit a "destroy" signal on each top level widget |
74 | of all instances of its viewers. |
75 | |
76 | |
c85f674c |
77 | Notices from Main Window |
5a5b35c5 |
78 | |
79 | time_window : This is the time interval visible on the viewer's tab. Every |
80 | viewer that cares about being synchronised by respect to the |
81 | time with other viewers should register to this notification. |
82 | They should redraw all or part of their display when this occurs. |
83 | |
84 | traceset : This notification is called whenever a trace is added/removed |
85 | from the traceset. As it affects all the data displayed by the |
86 | viewer, it sould redraw itself totally. |
911b7a3c |
87 | |
5a5b35c5 |
88 | filter : FIXME : describe.. |
911b7a3c |
89 | |
5a5b35c5 |
90 | current_time: Being able to zoom nearer a specific time or highlight a specific |
91 | time on every viewer in synchronicity implies that the viewer |
92 | has to shown a visual sign over the drawing or select an event |
93 | when it receives this notice. It should also inform the main |
94 | window with the appropriate report API function when a user |
95 | selects a specific time as being the current time. |
96 | |
97 | dividor : This notice links the positions of the horizontal dividors |
98 | between the graphic display zone of every viewer and their Y axis, |
99 | typically showing processes, cpus, ... |
100 | |
101 | |
102 | FIXME : Add background computation explanation here |
911b7a3c |
103 | background_init: prepare for background computation (comes after show_end). |
104 | process_trace for background: done in small chunks in gtk_idle, hooks called. |
105 | background_end: remove the hooks and perhaps update the window. |
106 | |
5a5b35c5 |
107 | |
108 | Reporting Changes to the Main Window |
109 | |
110 | In most cases, the enclosing window knows about updates such as described in the |
111 | Notification section higher. There are a few cases, however, where updates are |
112 | caused by actions known by a view instance. For example, clicking in a view may |
113 | update the current time; all viewers within the same window must be told about |
114 | the new current time to change the currently highlighted time point. A viewer |
115 | reports such events by calling lttvwindow_report_current_time on its lttvwindow. |
c85f674c |
116 | The lttvwindow will consequently call current_time_notify for each of its |
117 | contained viewers. |
5a5b35c5 |
118 | |
119 | |
120 | Available report methods are : |
121 | |
122 | lttvwindow_report_status : reports the text of the status bar. |
123 | lttvwindow_report_time_window : reports the new time window. |
124 | lttvwindow_report_current_time : reports the new current time. |
125 | lttvwindow_report_dividor : reports the new horizontal dividor's position. |
126 | lttvwindow_report_focus : One on the widgets in the viewer has the keyboard's |
127 | focus from GTK. |
128 | |
5a5b35c5 |
129 | |
c85f674c |
130 | |
131 | Requesting Events to Main Window |
132 | |
133 | Events can be requested by passing a EventsRequest structure to the main window. |
134 | They will be delivered later when the next g_idle functions will be called. |
84d9b2a1 |
135 | Event delivery is done by calling the event hook for this event ID, or the |
136 | main event hooks. A pointer to the EventsRequest structure is passed as |
137 | hook_data to the event hooks of the viewers. |
c85f674c |
138 | |
139 | EventsRequest consists in |
84d9b2a1 |
140 | - a pointer to the viewer specific data structure |
c85f674c |
141 | - a start timestamp or position |
d2d36be7 |
142 | - a stop_flag, ending the read process when set to TRUE |
c85f674c |
143 | - a end timestamp and/or position and/or number of events to read |
144 | - hook lists to call for traceset/trace/tracefile begin and end, and for each |
84d9b2a1 |
145 | event (event hooks and event_by_id hooks). |
d2d36be7 |
146 | |
c85f674c |
147 | The main window will deliver events for every EventRequests it has pending |
148 | through an algorithm that guarantee that all events requested, and only them, |
149 | will be delivered to the viewer between the call of the tracefile_begin hooks |
150 | and the call of the tracefile_end hooks. |
151 | |
d2d36be7 |
152 | If a viewer wants to stop the event request at a certain point inside the event |
153 | hooks, it has to set the stop_flag to TRUE and return TRUE from the hook |
154 | function. Then return value will stop the process traceset. Then, the main |
155 | window will look for the stop_flag and remove the EventRequests from its lists, |
156 | calling the process_traceset_end for this request (it removes hooks from the |
157 | context and calls the after hooks). |
5a5b35c5 |
158 | |
d2d36be7 |
159 | It no stop_flag is rose, the end timestamp, end position or number of events to |
160 | read has to be reached to determine the end of the request. Otherwise, |
161 | the end of traceset does determine it. |
5a5b35c5 |
162 | |
163 | |
164 | GTK Events |
165 | |
c85f674c |
166 | Events and Signals |
167 | |
168 | GTK is quite different from the other graphical toolkits around there. The main |
169 | difference resides in that there are many X Windows inside one GtkWindow, |
170 | instead of just one. That means that X events are delivered by the glib main |
171 | loop directly to the widget corresponding to the GdkWindow affected by the X |
172 | event. |
173 | |
c042ad3b |
174 | Event delivery to a widget emits a signal on that widget. Then, if a handler |
175 | is connected to this widget's signal, it will be executed. There are default |
176 | handlers for signals, connected at class instantiation time. There is also |
177 | the possibility to connect other handlers to these signals, which is what |
178 | should be done in most cases when a viewer needs to interact with X in any |
179 | way. |
180 | |
181 | |
182 | |
183 | Signal emission and propagation is described there : |
c85f674c |
184 | |
185 | http://www.gtk.org/tutorial/sec-signalemissionandpropagation.html |
186 | |
187 | For further information on the GTK main loop (now a wrapper over glib main loop) |
188 | see : |
189 | |
190 | http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html |
191 | http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html |
192 | |
193 | |
194 | For documentation on event handling in GTK/GDK, see : |
195 | |
196 | http://developer.gnome.org/doc/API/2.0/gdk/gdk-Events.html |
197 | http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html |
198 | |
199 | |
200 | Signals can be connected to handlers, emitted, propagated, blocked, |
201 | stopped. See : |
202 | |
203 | http://developer.gnome.org/doc/API/2.0/gobject/gobject-Signals.html |
204 | |
205 | |
206 | |
5a5b35c5 |
207 | |
208 | The "expose_event" |
209 | |
210 | Provides the exposed region in the GdkEventExpose structure. |
211 | |
212 | There are two ways of dealing with exposures. The first one is to directly draw |
213 | on the screen and the second one is to draw in a pixmap buffer, and then to |
214 | update the screen when necessary. |
215 | |
216 | In the first case, the expose event will be responsible for registering hooks to |
217 | process_traceset and require time intervals to the main window. So, in this |
218 | scenario, if a part of the screen is damaged, the trace has to be read to |
219 | redraw the screen. |
220 | |
221 | In the second case, with a pixmap buffer, the expose handler is only responsible |
222 | of showing the pixmap buffer on the screen. If the pixmap buffer has never |
223 | been filled with a drawing, the expose handler may ask for it to be filled. |
224 | |
84d9b2a1 |
225 | The interest of using events request to the main window instead of reading the |
226 | events directly from the trace comes from the fact that the main window |
227 | does merge requests from the different viewers in the same tab so that the |
228 | read loop and the state update is shared. As viewers will, in the common |
229 | scenario, request the same events, only one pass through the trace that will |
230 | call the right hooks for the right intervals will be done. |
231 | |
232 | When the traceset read is over for a events request, the traceset_end hook is |
233 | called. It has the responsibility of finishing the drawing if some parts |
234 | still need to be drawn and to show it on the screen (if the viewer uses a pixmap |
235 | buffer). |
236 | |
5a5b35c5 |
237 | It can add dotted lines and such visual effects to enhance the user's |
238 | experience. |
239 | |
240 | |
241 | FIXME : explain other important events |
242 | |
f95bc830 |
243 | */ |
244 | |
245 | |
246 | |
247 | |
36b40c74 |
248 | /*! \file viewer.h |
3bc00fde |
249 | * \brief API used by the graphical viewers to interact with their top window. |
250 | * |
5a5b35c5 |
251 | * Main window (lttvwindow module) is the place to contain and display viewers. |
252 | * Viewers (lttv plugins) interact with main window through this API. |
3bc00fde |
253 | * This header file should be included in each graphic module. |
3bc00fde |
254 | * |
255 | */ |
256 | |
257 | #include <gtk/gtk.h> |
258 | #include <ltt/ltt.h> |
84d9b2a1 |
259 | #include <ltt/time.h> |
3bc00fde |
260 | #include <lttv/hook.h> |
84d9b2a1 |
261 | #include <lttv/tracecontext.h> |
3bc00fde |
262 | #include <lttv/stats.h> |
84d9b2a1 |
263 | #include <lttvwindow/common.h> |
224446ce |
264 | //FIXME (not ready yet) #include <lttv/filter.h> |
3bc00fde |
265 | |
5a5b35c5 |
266 | |
267 | /* Module Related API */ |
268 | |
269 | |
270 | /* constructor a the viewer */ |
271 | //FIXME explain LttvTracesetSelector and key |
272 | typedef GtkWidget * (*lttvwindow_viewer_constructor) |
273 | (MainWindow * main_window, LttvTracesetSelector * s, char *key); |
274 | |
275 | |
3bc00fde |
276 | /** |
277 | * Function to register a view constructor so that main window can generate |
ec2b1ff7 |
278 | * a menu item and a toolbar item for the viewer in order to generate a new |
279 | * instance easily. A menu entry and toolbar item will be added to each main |
280 | * window. |
5a5b35c5 |
281 | * |
282 | * It should be called by init function of the module. |
283 | * |
ec2b1ff7 |
284 | * @param menu_path path of the menu item. NULL : no menu entry. |
285 | * @param menu_text text of the menu item. |
286 | * @param pixmap Image shown on the toolbar item. NULL : no button. |
3bc00fde |
287 | * @param tooltip tooltip of the toolbar item. |
288 | * @param view_constructor constructor of the viewer. |
289 | */ |
290 | |
ec2b1ff7 |
291 | void lttvwindow_register_constructor |
292 | (char * menu_path, |
293 | char * menu_text, |
294 | char ** pixmap, |
5a5b35c5 |
295 | char * tooltip, |
296 | lttvwindow_viewer_constructor view_constructor); |
3bc00fde |
297 | |
298 | |
299 | /** |
300 | * Function to unregister the viewer's constructor, release the space |
ec2b1ff7 |
301 | * occupied by menu_path, menu_text, pixmap, tooltip and constructor of the |
302 | * viewer. |
5a5b35c5 |
303 | * |
3bc00fde |
304 | * It will be called when a module is unloaded. |
5a5b35c5 |
305 | * |
306 | * @param view_constructor constructor of the viewer. |
3bc00fde |
307 | */ |
308 | |
ec2b1ff7 |
309 | void lttvwindow_unregister_constructor |
5a5b35c5 |
310 | (lttvwindow_viewer_constructor view_constructor); |
3bc00fde |
311 | |
312 | |
3bc00fde |
313 | |
5a5b35c5 |
314 | |
315 | /* Viewer Instance Related API */ |
316 | |
3bc00fde |
317 | /** |
5a5b35c5 |
318 | * Structure used as hook_data for the time_window_notify hook. |
3bc00fde |
319 | */ |
224446ce |
320 | typedef struct _TimeWindowNotifyData { |
321 | TimeWindow *new_time_window; |
322 | TimeWindow *old_time_window; |
323 | } TimeWindowNotifyData; |
324 | |
5a5b35c5 |
325 | |
326 | /** |
327 | * Function to register a hook function that will be called by the main window |
328 | * when the time interval needs to be updated. |
329 | * |
330 | * This register function is typically called by the constructor of the viewer. |
331 | * |
332 | * @param main_win the main window the viewer belongs to. |
333 | * @param hook hook that sould be called by the main window when the time |
334 | * interval changes. This hook function takes a |
335 | * TimeWindowNotifyData* as call_data. |
336 | * @param hook_data hook data associated with the hook function. It will |
337 | * be typically a pointer to the viewer's data structure. |
338 | */ |
339 | |
340 | void lttvwindow_register_time_window_notify(MainWindow *main_win, |
341 | LttvHook hook, |
342 | gpointer hook_data); |
3bc00fde |
343 | |
344 | |
345 | /** |
5a5b35c5 |
346 | * Function to unregister the time_window notification hook. |
347 | * |
48f6f981 |
348 | * This unregister function is typically called by the destructor of the viewer. |
5a5b35c5 |
349 | * |
3bc00fde |
350 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
351 | * @param hook hook that sould be called by the main window when the time |
352 | * interval changes. This hook function takes a |
353 | * TimeWindowNotifyData* as call_data. |
354 | * @param hook_data hook data associated with the hook function. It will |
355 | * be typically a pointer to the viewer's data structure. |
3bc00fde |
356 | */ |
357 | |
5a5b35c5 |
358 | void lttvwindow_unregister_time_window_notify(MainWindow *main_win, |
359 | LttvHook hook, |
360 | gpointer hook_data); |
3bc00fde |
361 | |
362 | |
363 | /** |
5a5b35c5 |
364 | * Function to register a hook function that will be called by the main window |
365 | * when the traceset is changed. That means that the viewer must redraw |
366 | * itself completely or check if it's affected by the particular change to the |
48f6f981 |
367 | * traceset. |
5a5b35c5 |
368 | * |
48f6f981 |
369 | * This register function is typically called by the constructor of the viewer. |
5a5b35c5 |
370 | * |
3bc00fde |
371 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
372 | * @param hook hook that should be called whenever a change to the traceset |
373 | * occurs. The call_data of this hook is a NULL pointer. |
374 | * @param hook_data hook data associated with the hook function. It will |
375 | * be typically a pointer to the viewer's data structure. |
3bc00fde |
376 | */ |
377 | |
5a5b35c5 |
378 | void lttvwindow_register_traceset_notify(MainWindow *main_win, |
379 | LttvHook hook, |
380 | gpointer hook_data); |
3bc00fde |
381 | |
382 | |
383 | /** |
5a5b35c5 |
384 | * Function to unregister the traceset_notify hook. |
385 | * |
3bc00fde |
386 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
387 | * @param hook hook that should be called whenever a change to the traceset |
388 | * occurs. The call_data of this hook is a NULL pointer. |
389 | * @param hook_data hook data associated with the hook function. It will |
390 | * be typically a pointer to the viewer's data structure. |
3bc00fde |
391 | */ |
392 | |
5a5b35c5 |
393 | void lttvwindow_unregister_traceset_notify(MainWindow *main_win, |
394 | LttvHook hook, |
395 | gpointer hook_data); |
3bc00fde |
396 | |
397 | |
398 | /** |
48f6f981 |
399 | * Function to register a hook function for a viewer to set/update its |
5a5b35c5 |
400 | * filter. |
401 | * |
402 | * FIXME : Add information about what a filter is as seen from a viewer and how |
403 | * to use it. |
404 | * |
48f6f981 |
405 | * This register function is typically called by the constructor of the viewer. |
5a5b35c5 |
406 | * |
3bc00fde |
407 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
408 | * @param hook hook function called by the main window when a filter change |
409 | * occurs. |
410 | * @param hook_data hook data associated with the hook function. It will |
411 | * be typically a pointer to the viewer's data structure. |
3bc00fde |
412 | */ |
413 | |
224446ce |
414 | void lttvwindow_register_filter_notify(MainWindow *main_win, |
5a5b35c5 |
415 | LttvHook hook, |
416 | gpointer hook_data); |
3bc00fde |
417 | |
418 | |
419 | /** |
48f6f981 |
420 | * Function to unregister a viewer's hook function which is used to |
421 | * set/update the filter of the viewer. |
5a5b35c5 |
422 | * |
48f6f981 |
423 | * This unregistration is called by the destructor of the viewer. |
5a5b35c5 |
424 | * |
48f6f981 |
425 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
426 | * @param hook hook function called by the main window when a filter change |
427 | * occurs. |
428 | * @param hook_data hook data associated with the hook function. It will |
429 | * be typically a pointer to the viewer's data structure. |
3bc00fde |
430 | */ |
431 | |
5a5b35c5 |
432 | void lttvwindow_unregister_filter_notify(MainWindow * main_win, |
433 | LttvHook hook, |
434 | gpointer hook_data); |
3bc00fde |
435 | |
436 | |
437 | /** |
48f6f981 |
438 | * Function to register a hook function for a viewer to set/update its |
439 | * current time. |
5a5b35c5 |
440 | * |
3bc00fde |
441 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
442 | * @param hook hook function of the viewer that updates the current time. The |
443 | * call_data is a LttTime* representing the new current time. |
444 | * @param hook_data hook data associated with the hook function. It will |
445 | * be typically a pointer to the viewer's data structure. |
3bc00fde |
446 | */ |
447 | |
224446ce |
448 | void lttvwindow_register_current_time_notify(MainWindow *main_win, |
5a5b35c5 |
449 | LttvHook hook, |
450 | gpointer hook_data); |
3bc00fde |
451 | |
452 | |
453 | /** |
454 | * Function to unregister a viewer's hook function which is used to |
48f6f981 |
455 | * set/update the current time of the viewer. |
3bc00fde |
456 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
457 | * @param hook hook function of the viewer that updates the current time. The |
458 | * call_data is a LttTime* representing the new current time. |
459 | * @param hook_data hook data associated with the hook function. It will |
460 | * be typically a pointer to the viewer's data structure. |
3bc00fde |
461 | */ |
462 | |
5a5b35c5 |
463 | void lttvwindow_unregister_current_time_notify(MainWindow *main_win, |
464 | LttvHook hook, |
465 | gpointer hook_data); |
3bc00fde |
466 | |
467 | |
224446ce |
468 | /** |
469 | * Function to register a hook function for a viewer to set/update the |
470 | * dividor of the hpane. It provides a way to make the horizontal |
471 | * dividors of all the viewers linked together. |
5a5b35c5 |
472 | * |
224446ce |
473 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
474 | * @param hook hook function of the viewer that will be called whenever a |
475 | * dividor changes in another viewer. The call_data of this hook |
476 | * is a gint*. The value of the integer is the new position of the |
477 | * hpane dividor. |
478 | * @param hook_data hook data associated with the hook function. It will |
479 | * be typically a pointer to the viewer's data structure. |
224446ce |
480 | */ |
3bc00fde |
481 | |
224446ce |
482 | void lttvwindow_register_dividor(MainWindow *main_win, |
5a5b35c5 |
483 | LttvHook hook, |
484 | gpointer hook_data); |
3bc00fde |
485 | |
486 | |
224446ce |
487 | /** |
488 | * Function to unregister a viewer's hook function which is used to |
489 | * set/update hpane's dividor of the viewer. |
5a5b35c5 |
490 | * |
224446ce |
491 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
492 | * @param hook hook function of the viewer that will be called whenever a |
493 | * dividor changes in another viewer. The call_data of this hook |
494 | * is a gint*. The value of the integer is the new position of the |
495 | * hpane dividor. |
496 | * @param hook_data hook data associated with the hook function. It will |
497 | * be typically a pointer to the viewer's data structure. |
224446ce |
498 | */ |
499 | |
500 | void lttvwindow_unregister_dividor(MainWindow *main_win, |
5a5b35c5 |
501 | LttvHook hook, |
502 | gpointer hook_data); |
3bc00fde |
503 | |
3bc00fde |
504 | |
505 | |
506 | /** |
5a5b35c5 |
507 | * This method reports the information to show on the status bar in the |
508 | * main window. |
509 | * |
3bc00fde |
510 | * @param main_win the main window the viewer belongs to. |
48f6f981 |
511 | * @param info the message which will be shown in the status bar. |
3bc00fde |
512 | */ |
513 | |
5a5b35c5 |
514 | void lttvwindow_report_status(MainWindow *main_win, const char *info); |
3bc00fde |
515 | |
516 | |
517 | /** |
5a5b35c5 |
518 | * Function to set the time interval of the current tab.a |
519 | * |
3bc00fde |
520 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
521 | * @param time_interval pointer to the time interval value. |
3bc00fde |
522 | */ |
523 | |
5a5b35c5 |
524 | void lttvwindow_report_time_window(MainWindow *main_win, |
525 | const TimeWindow *time_window); |
3bc00fde |
526 | |
527 | /** |
48f6f981 |
528 | * Function to set the current time/event of the current tab. |
529 | * It will be called by a viewer's signal handle associated with |
530 | * the button-release-event signal |
3bc00fde |
531 | * @param main_win the main window the viewer belongs to. |
48f6f981 |
532 | * @param time a pointer where time is stored. |
3bc00fde |
533 | */ |
534 | |
5a5b35c5 |
535 | void lttvwindow_report_current_time(MainWindow *main_win, |
536 | const LttTime *time); |
3bc00fde |
537 | |
538 | |
539 | /** |
48f6f981 |
540 | * Function to set the position of the hpane's dividor (viewer). |
5a5b35c5 |
541 | * It will typically be called by a viewer's signal handle associated |
542 | * with the motion_notify_event event/signal. |
543 | * |
3bc00fde |
544 | * @param main_win the main window the viewer belongs to. |
48f6f981 |
545 | * @param position position of the hpane's dividor. |
3bc00fde |
546 | */ |
547 | |
224446ce |
548 | void lttvwindow_report_dividor(MainWindow *main_win, gint position); |
3bc00fde |
549 | |
550 | /** |
5a5b35c5 |
551 | * Function to set the focused viewer of the tab. |
3bc00fde |
552 | * It will be called by a viewer's signal handle associated with |
5a5b35c5 |
553 | * the grab_focus signal of all widgets in the viewer. |
554 | * |
3bc00fde |
555 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
556 | * @param top_widget the top widget containing all the other widgets of the |
557 | * viewer. |
3bc00fde |
558 | */ |
5a5b35c5 |
559 | void lttvwindow_report_focus(MainWindow *main_win, |
560 | GtkWidget *top_widget); |
3bc00fde |
561 | |
a43d67ba |
562 | |
5a5b35c5 |
563 | |
564 | /* Structure sent to the time request hook */ |
c85f674c |
565 | /* Value considered as empty */ |
566 | typedef struct _EventsRequest { |
84d9b2a1 |
567 | LttTime start_time, /* Unset : { 0, 0 } */ |
568 | LttvTracesetContextPosition start_position, /* Unset : num_traces = 0 */ |
569 | gboolean stop_flag, /* Continue:TRUE Stop:FALSE */ |
570 | LttTime end_time, /* Unset : { 0, 0 } */ |
571 | guint num_events, /* Unset : G_MAXUINT */ |
572 | LttvTracesetContextPosition end_position, /* Unset : num_traces = 0 */ |
573 | LttvHooks *before_traceset, /* Unset : NULL */ |
574 | LttvHooks *before_trace, /* Unset : NULL */ |
575 | LttvHooks *before_tracefile, /* Unset : NULL */ |
576 | LttvHooks *event, /* Unset : NULL */ |
577 | LttvHooksById *event_by_id, /* Unset : NULL */ |
578 | LttvHooks *after_tracefile, /* Unset : NULL */ |
579 | LttvHooks *after_trace, /* Unset : NULL */ |
580 | LttvHooks *after_traceset /* Unset : NULL */ |
c85f674c |
581 | } EventsRequest; |
582 | |
5a5b35c5 |
583 | |
a43d67ba |
584 | /** |
5a5b35c5 |
585 | * Function to request data in a specific time interval to the main window. The |
586 | * time request servicing is differed until the glib idle functions are |
587 | * called. |
588 | * |
c85f674c |
589 | * The viewer has to provide hooks that should be associated with the event |
590 | * request. |
5a5b35c5 |
591 | * |
c85f674c |
592 | * Either start time or start position must be defined in a EventRequest |
593 | * structure for it to be valid. |
594 | * |
595 | * end_time, end_position and num_events can all be defined. The first one |
596 | * to occur will be used as end criterion. |
597 | * |
a43d67ba |
598 | * @param main_win the main window the viewer belongs to. |
c85f674c |
599 | * @param events_requested the structure of request from. |
a43d67ba |
600 | */ |
601 | |
c85f674c |
602 | void lttvwindow_events_request(MainWindow *main_win, |
603 | EventsRequest events_request); |
a43d67ba |
604 | |
48f6f981 |
605 | /** |
606 | * Function to get the current time window of the current tab. |
5a5b35c5 |
607 | * |
48f6f981 |
608 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
609 | * @return a pointer to the current tab's time interval. |
48f6f981 |
610 | */ |
611 | |
224446ce |
612 | const TimeWindow *lttvwindow_get_time_window(MainWindow *main_win); |
3bc00fde |
613 | |
614 | |
3bc00fde |
615 | /** |
5a5b35c5 |
616 | * Function to get the current time of the current tab. |
617 | * |
3bc00fde |
618 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
619 | * @return a pointer to the current tab's current time. |
48f6f981 |
620 | */ |
621 | |
224446ce |
622 | const LttTime *lttvwindow_get_current_time(MainWindow *main_win); |
48f6f981 |
623 | |
48f6f981 |
624 | |
625 | /** |
626 | * Function to get the filter of the current tab. |
627 | * @param main_win, the main window the viewer belongs to. |
628 | * @param filter, a pointer to a filter. |
3bc00fde |
629 | */ |
630 | |
224446ce |
631 | //FIXME |
632 | typedef void lttv_filter; |
633 | //FIXME |
634 | const lttv_filter *lttvwindow_get_filter(MainWindow *main_win); |
3bc00fde |
635 | |
636 | |
3bc00fde |
637 | /** |
638 | * Function to get the stats of the traceset |
5a5b35c5 |
639 | * It must be non const so the viewer can modify it. |
640 | * FIXME : a set/get pair of functions would be more appropriate here. |
224446ce |
641 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
642 | * @return A pointer to Traceset statistics. |
224446ce |
643 | */ |
644 | |
645 | LttvTracesetStats* lttvwindow_get_traceset_stats(MainWindow *main_win); |
646 | |
647 | /** |
648 | * Function to get the context of the traceset |
649 | * It must be non const so the viewer can add and remove hooks from it. |
3bc00fde |
650 | * @param main_win the main window the viewer belongs to. |
5a5b35c5 |
651 | * @return Context of the current tab. |
3bc00fde |
652 | */ |
653 | |
48f6f981 |
654 | |
224446ce |
655 | LttvTracesetContext* lttvwindow_get_traceset_context(MainWindow *main_win); |
48f6f981 |
656 | |
3bc00fde |
657 | |