merge modifications for multiple viewer read at the same time, better expose handling...
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / viewer.c
CommitLineData
cef97e7c 1/* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 XangXiu 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
36b40c74 19/*! \file lttvviewer.c
561f5852 20 * \brief API used by the graphical viewers to interact with their top window.
21 *
22 * Main window (gui module) is the place to contain and display viewers.
23 * Viewers (lttv plugins) interacte with main window through this API and
24 * events sent by gtk.
25 * This header file should be included in each graphic module.
26 * This library is used by graphical modules to interact with the
27 * tracesetWindow.
28 *
29 */
30
561f5852 31#include <ltt/ltt.h>
32#include <lttv/lttv.h>
a43d67ba 33#include <lttv/state.h>
34#include <lttv/stats.h>
35#include <lttv/tracecontext.h>
36#include <lttvwindow/common.h>
13f86ce2 37#include <lttvwindow/mainwindow.h>
36b40c74 38#include <lttvwindow/viewer.h>
13f86ce2 39#include <lttvwindow/toolbar.h>
40#include <lttvwindow/menu.h>
a43d67ba 41#include <lttvwindow/callbacks.h> // for execute_time_requests
6b1d3120 42
561f5852 43
44/**
45 * Internal function parts
46 */
47
561f5852 48/**
49 * Function to set/update traceset for the viewers
50 * @param main_win main window
51 * @param traceset traceset of the main window.
224446ce 52 * return value :
53 * -1 : error
54 * 0 : traceset updated
55 * 1 : no traceset hooks to update; not an error.
561f5852 56 */
57
224446ce 58int SetTraceset(MainWindow * main_win, gpointer traceset)
561f5852 59{
60 LttvHooks * tmp;
61 LttvAttributeValue value;
62
224446ce 63 if( lttv_iattribute_find_by_path(main_win->attributes,
64 "hooks/updatetraceset", LTTV_POINTER, &value) != 0)
65 return -1;
66
561f5852 67 tmp = (LttvHooks*)*(value.v_pointer);
224446ce 68 if(tmp == NULL) return 1;
a43d67ba 69
224446ce 70
561f5852 71 lttv_hooks_call(tmp,traceset);
a43d67ba 72
224446ce 73 return 0;
561f5852 74}
75
76
77/**
78 * Function to set/update filter for the viewers
79 * @param main_win main window
80 * @param filter filter of the main window.
224446ce 81 * return value :
82 * -1 : error
83 * 0 : filters updated
84 * 1 : no filter hooks to update; not an error.
561f5852 85 */
86
224446ce 87int SetFilter(MainWindow * main_win, gpointer filter)
561f5852 88{
89 LttvHooks * tmp;
90 LttvAttributeValue value;
91
224446ce 92 if(lttv_iattribute_find_by_path(main_win->attributes,
93 "hooks/updatefilter", LTTV_POINTER, &value) != 0)
94 return -1;
95
561f5852 96 tmp = (LttvHooks*)*(value.v_pointer);
97
224446ce 98 if(tmp == NULL) return 1;
561f5852 99 lttv_hooks_call(tmp,filter);
224446ce 100
101 return 0;
102}
103
104/**
105 * Function to redraw each viewer belonging to the current tab
106 * @param main_win the main window the viewer belongs to.
107 */
108
109void update_traceset(MainWindow * main_win)
110{
111 LttvAttributeValue value;
112 LttvHooks * tmp;
113 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
114 "hooks/updatetraceset", LTTV_POINTER, &value));
115 tmp = (LttvHooks*)*(value.v_pointer);
116 if(tmp == NULL) return;
117 lttv_hooks_call(tmp, NULL);
118}
119
a43d67ba 120void set_time_window_adjustment(MainWindow * main_win, const TimeWindow* new_time_window)
121{
122 gtk_multi_vpaned_set_adjust(main_win->current_tab->multi_vpaned, new_time_window, FALSE);
123}
224446ce 124
125
a43d67ba 126void set_time_window(MainWindow * main_win, const TimeWindow *time_window)
224446ce 127{
128 LttvAttributeValue value;
129 LttvHooks * tmp;
a43d67ba 130
131 TimeWindowNotifyData time_window_notify_data;
132 TimeWindow old_time_window = main_win->current_tab->time_window;
133 time_window_notify_data.old_time_window = &old_time_window;
134 main_win->current_tab->time_window = *time_window;
135 time_window_notify_data.new_time_window =
136 &(main_win->current_tab->time_window);
137
224446ce 138 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
a43d67ba 139 "hooks/updatetimewindow", LTTV_POINTER, &value));
224446ce 140 tmp = (LttvHooks*)*(value.v_pointer);
141 if(tmp == NULL) return;
a43d67ba 142 lttv_hooks_call(tmp, &time_window_notify_data);
561f5852 143
144
a43d67ba 145}
224446ce 146
561f5852 147/**
148 * API parts
149 */
150
151/**
152 * Function to register a view constructor so that main window can generate
153 * a toolbar item for the viewer in order to generate a new instance easily.
154 * It will be called by init function of the module.
155 * @param ButtonPixmap image shown on the toolbar item.
156 * @param tooltip tooltip of the toolbar item.
157 * @param view_constructor constructor of the viewer.
158 */
159
224446ce 160void lttvwindow_register_toolbar(char ** pixmap, char *tooltip, lttvwindow_viewer_constructor view_constructor)
561f5852 161{
162 LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
163 LttvToolbars * toolbar;
164 LttvAttributeValue value;
165
166 g_assert(lttv_iattribute_find_by_path(attributes_global,
d2811a98 167 "viewers/toolbar", LTTV_POINTER, &value));
561f5852 168 toolbar = (LttvToolbars*)*(value.v_pointer);
169
224446ce 170 if(toolbar == NULL){
561f5852 171 toolbar = lttv_toolbars_new();
172 *(value.v_pointer) = toolbar;
173 }
174 lttv_toolbars_add(toolbar, view_constructor, tooltip, pixmap);
175}
176
177
178/**
179 * Function to unregister the viewer's constructor, release the space
180 * occupied by pixmap, tooltip and constructor of the viewer.
181 * It will be called when a module is unloaded.
182 * @param view_constructor constructor of the viewer which is used as
183 * a reference to find out where the pixmap and tooltip are.
184 */
185
224446ce 186void lttvwindow_unregister_toolbar(lttvwindow_viewer_constructor view_constructor)
561f5852 187{
188 LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
189 LttvToolbars * toolbar;
190 LttvAttributeValue value;
191
192 g_assert(lttv_iattribute_find_by_path(attributes_global,
d2811a98 193 "viewers/toolbar", LTTV_POINTER, &value));
561f5852 194 toolbar = (LttvToolbars*)*(value.v_pointer);
195
2061e03d 196 main_window_remove_toolbar_item(view_constructor);
197
198 lttv_toolbars_remove(toolbar, view_constructor);
561f5852 199}
200
201
202/**
203 * Function to register a view constructor so that main window can generate
204 * a menu item for the viewer in order to generate a new instance easily.
205 * It will be called by init function of the module.
206 * @param menu_path path of the menu item.
207 * @param menu_text text of the menu item.
208 * @param view_constructor constructor of the viewer.
209 */
210
224446ce 211void lttvwindow_register_menu(char *menu_path, char *menu_text, lttvwindow_viewer_constructor view_constructor)
561f5852 212{
213 LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
214 LttvMenus * menu;
215 LttvAttributeValue value;
216
217 g_assert(lttv_iattribute_find_by_path(attributes_global,
d2811a98 218 "viewers/menu", LTTV_POINTER, &value));
561f5852 219 menu = (LttvMenus*)*(value.v_pointer);
220
221 if(menu == NULL){
222 menu = lttv_menus_new();
223 *(value.v_pointer) = menu;
224 }
225 lttv_menus_add(menu, view_constructor, menu_path, menu_text);
226}
227
228/**
229 * Function to unregister the viewer's constructor, release the space
230 * occupied by menu_path, menu_text and constructor of the viewer.
231 * It will be called when a module is unloaded.
232 * @param view_constructor constructor of the viewer which is used as
233 * a reference to find out where the menu_path and menu_text are.
234 */
235
224446ce 236void lttvwindow_unregister_menu(lttvwindow_viewer_constructor view_constructor)
561f5852 237{
238 LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
239 LttvMenus * menu;
240 LttvAttributeValue value;
241
242 g_assert(lttv_iattribute_find_by_path(attributes_global,
c4c15b5e 243 "viewers/menu", LTTV_POINTER, &value));
561f5852 244 menu = (LttvMenus*)*(value.v_pointer);
245
2061e03d 246 main_window_remove_menu_item(view_constructor);
247
248 lttv_menus_remove(menu, view_constructor);
561f5852 249}
250
561f5852 251/**
252 * Function to register a hook function for a viewer to set/update its
253 * time interval.
561f5852 254 * @param hook hook function of the viewer.
255 * @param hook_data hook data associated with the hook function.
256 * @param main_win the main window the viewer belongs to.
257 */
224446ce 258void lttvwindow_register_time_window_notify(MainWindow * main_win,
259 LttvHook hook, gpointer hook_data)
561f5852 260{
261 LttvAttributeValue value;
262 LttvHooks * tmp;
bca3b81f 263 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 264 "hooks/updatetimewindow", LTTV_POINTER, &value));
561f5852 265 tmp = (LttvHooks*)*(value.v_pointer);
266 if(tmp == NULL){
267 tmp = lttv_hooks_new();
268 *(value.v_pointer) = tmp;
269 }
270 lttv_hooks_add(tmp, hook,hook_data);
271}
272
273
274/**
275 * Function to unregister a viewer's hook function which is used to
276 * set/update the time interval of the viewer.
561f5852 277 * @param hook hook function of the viewer.
278 * @param hook_data hook data associated with the hook function.
279 * @param main_win the main window the viewer belongs to.
280 */
281
224446ce 282void lttvwindow_unregister_time_window_notify(MainWindow * main_win,
283 LttvHook hook, gpointer hook_data)
561f5852 284{
285 LttvAttributeValue value;
286 LttvHooks * tmp;
bca3b81f 287 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 288 "hooks/updatetimewindow", LTTV_POINTER, &value));
561f5852 289 tmp = (LttvHooks*)*(value.v_pointer);
290 if(tmp == NULL) return;
291 lttv_hooks_remove_data(tmp, hook, hook_data);
292}
293
561f5852 294/**
295 * Function to register a hook function for a viewer to set/update its
296 * traceset.
561f5852 297 * @param hook hook function of the viewer.
298 * @param hook_data hook data associated with the hook function.
299 * @param main_win the main window the viewer belongs to.
300 */
301
224446ce 302void lttvwindow_register_traceset_notify(MainWindow * main_win,
303 LttvHook hook, gpointer hook_data)
561f5852 304{
305 LttvAttributeValue value;
306 LttvHooks * tmp;
a8c0f09d 307 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 308 "hooks/updatetraceset", LTTV_POINTER, &value));
561f5852 309 tmp = (LttvHooks*)*(value.v_pointer);
310 if(tmp == NULL){
311 tmp = lttv_hooks_new();
312 *(value.v_pointer) = tmp;
313 }
314 lttv_hooks_add(tmp, hook, hook_data);
315}
316
317
318/**
319 * Function to unregister a viewer's hook function which is used to
320 * set/update the traceset of the viewer.
561f5852 321 * @param hook hook function of the viewer.
322 * @param hook_data hook data associated with the hook function.
323 * @param main_win the main window the viewer belongs to.
324 */
325
224446ce 326void lttvwindow_unregister_traceset_notify(MainWindow * main_win,
327 LttvHook hook, gpointer hook_data)
561f5852 328{
329 LttvAttributeValue value;
330 LttvHooks * tmp;
a8c0f09d 331 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 332 "hooks/updatetraceset", LTTV_POINTER, &value));
561f5852 333 tmp = (LttvHooks*)*(value.v_pointer);
334 if(tmp == NULL) return;
335 lttv_hooks_remove_data(tmp, hook, hook_data);
336}
337
561f5852 338/**
339 * Function to register a hook function for a viewer to set/update its
340 * filter.
561f5852 341 * @param hook hook function of the viewer.
342 * @param hook_data hook data associated with the hook function.
343 * @param main_win the main window the viewer belongs to.
344 */
345
224446ce 346void lttvwindow_register_filter_notify(MainWindow *main_win,
347 LttvHook hook, gpointer hook_data)
561f5852 348{
349 LttvAttributeValue value;
350 LttvHooks * tmp;
bca3b81f 351 g_assert(lttv_iattribute_find_by_path(main_win->attributes,
d2811a98 352 "hooks/updatefilter", LTTV_POINTER, &value));
561f5852 353 tmp = (LttvHooks*)*(value.v_pointer);
354 if(tmp == NULL){
355 tmp = lttv_hooks_new();
356 *(value.v_pointer) = tmp;
357 }
358 lttv_hooks_add(tmp, hook, hook_data);
359}
360
361
362/**
363 * Function to unregister a viewer's hook function which is used to
364 * set/update the filter of the viewer.
561f5852 365 * @param hook hook function of the viewer.
366 * @param hook_data hook data associated with the hook function.
367 * @param main_win the main window the viewer belongs to.
368 */
369
224446ce 370void lttvwindow_unregister_filter_notify(LttvHook hook, gpointer hook_data,
371 MainWindow * main_win)
561f5852 372{
373 LttvAttributeValue value;
374 LttvHooks * tmp;
bca3b81f 375 g_assert(lttv_iattribute_find_by_path(main_win->attributes,
d2811a98 376 "hooks/updatefilter", LTTV_POINTER, &value));
561f5852 377 tmp = (LttvHooks*)*(value.v_pointer);
378 if(tmp == NULL) return;
379 lttv_hooks_remove_data(tmp, hook, hook_data);
380}
381
561f5852 382/**
383 * Function to register a hook function for a viewer to set/update its
384 * current time.
561f5852 385 * @param hook hook function of the viewer.
386 * @param hook_data hook data associated with the hook function.
387 * @param main_win the main window the viewer belongs to.
388 */
389
224446ce 390void lttvwindow_register_current_time_notify(MainWindow *main_win,
391 LttvHook hook, gpointer hook_data)
561f5852 392{
393 LttvAttributeValue value;
394 LttvHooks * tmp;
bca3b81f 395 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 396 "hooks/updatecurrenttime", LTTV_POINTER, &value));
561f5852 397 tmp = (LttvHooks*)*(value.v_pointer);
398 if(tmp == NULL){
399 tmp = lttv_hooks_new();
400 *(value.v_pointer) = tmp;
401 }
402 lttv_hooks_add(tmp, hook, hook_data);
403}
404
405
406/**
407 * Function to unregister a viewer's hook function which is used to
408 * set/update the current time of the viewer.
561f5852 409 * @param hook hook function of the viewer.
410 * @param hook_data hook data associated with the hook function.
411 * @param main_win the main window the viewer belongs to.
412 */
413
224446ce 414void lttvwindow_unregister_current_time_notify(MainWindow * main_win,
415 LttvHook hook, gpointer hook_data)
561f5852 416{
417 LttvAttributeValue value;
418 LttvHooks * tmp;
bca3b81f 419 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 420 "hooks/updatecurrenttime", LTTV_POINTER, &value));
561f5852 421 tmp = (LttvHooks*)*(value.v_pointer);
422 if(tmp == NULL) return;
423 lttv_hooks_remove_data(tmp, hook, hook_data);
424}
425
426
202f6c8f 427/**
428 * Function to register a hook function for a viewer to show
224446ce 429 * the content of the viewer.
202f6c8f 430 * @param hook hook function of the viewer.
431 * @param hook_data hook data associated with the hook function.
432 * @param main_win the main window the viewer belongs to.
433 */
434
a43d67ba 435void lttvwindow_register_show_notify(MainWindow *main_win,
224446ce 436 LttvHook hook, gpointer hook_data)
202f6c8f 437{
438 LttvAttributeValue value;
439 LttvHooks * tmp;
440 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 441 "hooks/showviewer", LTTV_POINTER, &value));
202f6c8f 442 tmp = (LttvHooks*)*(value.v_pointer);
443 if(tmp == NULL){
444 tmp = lttv_hooks_new();
445 *(value.v_pointer) = tmp;
446 }
447 lttv_hooks_add(tmp, hook, hook_data);
448}
449
450
451/**
452 * Function to unregister a viewer's hook function which is used to
453 * show the content of the viewer..
202f6c8f 454 * @param hook hook function of the viewer.
455 * @param hook_data hook data associated with the hook function.
456 * @param main_win the main window the viewer belongs to.
457 */
458
a43d67ba 459void lttvwindow_unregister_show_notify(MainWindow * main_win,
224446ce 460 LttvHook hook, gpointer hook_data)
202f6c8f 461{
462 LttvAttributeValue value;
463 LttvHooks * tmp;
464 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 465 "hooks/showviewer", LTTV_POINTER, &value));
202f6c8f 466 tmp = (LttvHooks*)*(value.v_pointer);
467 if(tmp == NULL) return;
468 lttv_hooks_remove_data(tmp, hook, hook_data);
469}
470
561f5852 471/**
472 * Function to register a hook function for a viewer to set/update the
473 * dividor of the hpane.
561f5852 474 * @param hook hook function of the viewer.
475 * @param hook_data hook data associated with the hook function.
476 * @param main_win the main window the viewer belongs to.
477 */
478
224446ce 479void lttvwindow_register_dividor(MainWindow *main_win,
480 LttvHook hook, gpointer hook_data)
561f5852 481{
482 LttvAttributeValue value;
483 LttvHooks * tmp;
bca3b81f 484 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 485 "hooks/hpanedividor", LTTV_POINTER, &value));
561f5852 486 tmp = (LttvHooks*)*(value.v_pointer);
487 if(tmp == NULL){
488 tmp = lttv_hooks_new();
489 *(value.v_pointer) = tmp;
490 }
491 lttv_hooks_add(tmp, hook, hook_data);
492}
493
494
495/**
496 * Function to unregister a viewer's hook function which is used to
497 * set/update hpane's dividor of the viewer.
498 * It will be called by the destructor of the viewer.
499 * @param hook hook function of the viewer.
500 * @param hook_data hook data associated with the hook function.
501 * @param main_win the main window the viewer belongs to.
502 */
503
224446ce 504void lttvwindow_unregister_dividor(MainWindow *main_win,
505 LttvHook hook, gpointer hook_data)
561f5852 506{
507 LttvAttributeValue value;
508 LttvHooks * tmp;
bca3b81f 509 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 510 "hooks/hpanedividor", LTTV_POINTER, &value));
561f5852 511 tmp = (LttvHooks*)*(value.v_pointer);
512 if(tmp == NULL) return;
513 lttv_hooks_remove_data(tmp, hook, hook_data);
514}
515
516
224446ce 517/**
518 * Update the status bar whenever something changed in the viewer.
519 * @param main_win the main window the viewer belongs to.
520 * @param info the message which will be shown in the status bar.
521 */
522
523void lttvwindow_report_status(MainWindow *main_win, char *info)
524{
525 //FIXME
526 g_warning("update_status not implemented in viewer.c");
527}
528
529/**
530 * Function to set the time interval of the current tab.
531 * It will be called by a viewer's signal handle associated with
532 * the move_slider signal
533 * @param main_win the main window the viewer belongs to.
534 * @param time_interval a pointer where time interval is stored.
535 */
536
537void lttvwindow_report_time_window(MainWindow *main_win,
538 TimeWindow *time_window)
539{
a43d67ba 540 set_time_window(main_win, time_window);
541 set_time_window_adjustment(main_win, time_window);
224446ce 542}
543
a43d67ba 544
224446ce 545/**
546 * Function to set the current time/event of the current tab.
547 * It will be called by a viewer's signal handle associated with
548 * the button-release-event signal
549 * @param main_win the main window the viewer belongs to.
550 * @param time a pointer where time is stored.
551 */
552
553void lttvwindow_report_current_time(MainWindow *main_win, LttTime *time)
554{
555 LttvAttributeValue value;
556 LttvHooks * tmp;
557 main_win->current_tab->current_time = *time;
558 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
559 "hooks/updatecurrenttime", LTTV_POINTER, &value));
560 tmp = (LttvHooks*)*(value.v_pointer);
561
562 if(tmp == NULL)return;
563 lttv_hooks_call(tmp, time);
564}
565
561f5852 566/**
567 * Function to set the position of the hpane's dividor (viewer).
568 * It will be called by a viewer's signal handle associated with
569 * the motion_notify_event event/signal
570 * @param main_win the main window the viewer belongs to.
571 * @param position position of the hpane's dividor.
572 */
573
224446ce 574void lttvwindow_report_dividor(MainWindow *main_win, gint position)
561f5852 575{
576 LttvAttributeValue value;
577 LttvHooks * tmp;
bca3b81f 578 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 579 "hooks/hpanedividor", LTTV_POINTER, &value));
561f5852 580 tmp = (LttvHooks*)*(value.v_pointer);
581 if(tmp == NULL) return;
582 lttv_hooks_call(tmp, &position);
583}
584
224446ce 585/**
586 * Function to set the focused pane (viewer).
587 * It will be called by a viewer's signal handle associated with
588 * the grab_focus signal
589 * @param main_win the main window the viewer belongs to.
590 * @param paned a pointer to a pane where the viewer is contained.
591 */
592
593void lttvwindow_report_focus(MainWindow *main_win, gpointer paned)
594{
595 gtk_multi_vpaned_set_focus((GtkWidget*)main_win->current_tab->multi_vpaned,paned);
596}
597
598
a43d67ba 599/**
600 * Function to request data in a specific time interval to the main window.
601 * The main window will use this time interval and the others present
602 * to get the data from the process trace.
603 * @param main_win the main window the viewer belongs to.
604 * @param paned a pointer to a pane where the viewer is contained.
605 */
606
607void lttvwindow_time_interval_request(MainWindow *main_win,
608 TimeWindow time_requested, guint num_events,
609 LttvHook after_process_traceset,
610 gpointer after_process_traceset_data)
611{
612 TimeRequest time_request;
613
614 time_request.time_window = time_requested;
615 time_request.num_events = num_events;
616 time_request.after_hook = after_process_traceset;
617 time_request.after_hook_data = after_process_traceset_data;
618
619 g_array_append_val(main_win->current_tab->time_requests, time_request);
620
621 if(!main_win->current_tab->time_request_pending)
622 {
623 /* Redraw has +20 priority. We want a prio higher than that, so +19 */
624 g_idle_add_full((G_PRIORITY_HIGH_IDLE + 19),
625 (GSourceFunc)execute_time_requests,
626 main_win,
627 NULL);
628 main_win->current_tab->time_request_pending = TRUE;
629 }
630}
631
632
224446ce 633
634/**
635 * Function to get the current time interval of the current traceset.
636 * It will be called by a viewer's hook function to update the
637 * time interval of the viewer and also be called by the constructor
638 * of the viewer.
639 * @param main_win the main window the viewer belongs to.
640 * @param time_interval a pointer where time interval will be stored.
641 */
642
643const TimeInterval *lttvwindow_get_time_span(MainWindow *main_win)
644{
645 //time_window->start_time = main_win->current_tab->time_window.start_time;
646 //time_window->time_width = main_win->current_tab->time_window.time_width;
647 return (LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
648 traceset_context)->Time_Span);
649}
650
651
652
653/**
654 * Function to get the current time interval shown on the current tab.
655 * It will be called by a viewer's hook function to update the
656 * shown time interval of the viewer and also be called by the constructor
657 * of the viewer.
658 * @param main_win the main window the viewer belongs to.
659 * @param time_interval a pointer where time interval will be stored.
660 */
661
662const TimeWindow *lttvwindow_get_time_window(MainWindow *main_win)
663{
664 //time_window->start_time = main_win->current_tab->time_window.start_time;
665 //time_window->time_width = main_win->current_tab->time_window.time_width;
666 return &(main_win->current_tab->time_window);
667
668}
669
670
671/**
672 * Function to get the current time/event of the current tab.
673 * It will be called by a viewer's hook function to update the
674 * current time/event of the viewer.
675 * @param main_win the main window the viewer belongs to.
676 * @param time a pointer where time will be stored.
677 */
678
679const LttTime *lttvwindow_get_current_time(MainWindow *main_win)
680{
681 return &(main_win->current_tab->current_time);
682}
683
684
685/**
686 * Function to get the traceset from the current tab.
687 * It will be called by the constructor of the viewer and also be
688 * called by a hook funtion of the viewer to update its traceset.
689 * @param main_win the main window the viewer belongs to.
690 * @param traceset a pointer to a traceset.
691 */
692const LttvTraceset *lttvwindow_get_traceset(MainWindow *main_win)
693{
694 return main_win->current_tab->traceset_info->traceset;
695}
696
697/**
698 * Function to get the filter of the current tab.
699 * It will be called by the constructor of the viewer and also be
700 * called by a hook funtion of the viewer to update its filter.
701 * @param main_win, the main window the viewer belongs to.
702 * @param filter, a pointer to a filter.
703 */
704const lttv_filter *lttvwindow_get_filter(MainWindow *main_win)
705{
706 //FIXME
707 g_warning("lttvwindow_get_filter not implemented in viewer.c");
708}
709
710
6b1d3120 711/**
712 * Function to get the stats of the traceset
713 * @param main_win the main window the viewer belongs to.
714 */
715
224446ce 716LttvTracesetStats* lttvwindow_get_traceset_stats(MainWindow *main_win)
6b1d3120 717{
716e4367 718 return main_win->current_tab->traceset_info->traceset_context;
6b1d3120 719}
a8c0f09d 720
721
224446ce 722LttvTracesetContext* lttvwindow_get_traceset_context(MainWindow *main_win)
a8c0f09d 723{
724 return (LttvTracesetContext*)main_win->current_tab->traceset_info->traceset_context;
725}
This page took 0.092491 seconds and 4 git commands to generate.