1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 XangXiu Yang
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;
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.
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,
19 /*! \file lttvviewer.c
20 * \brief API used by the graphical viewers to interact with their top window.
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
25 * This header file should be included in each graphic module.
26 * This library is used by graphical modules to interact with the
32 #include <lttv/lttv.h>
33 #include <lttv/state.h>
34 #include <lttv/stats.h>
35 #include <lttv/tracecontext.h>
36 #include <lttvwindow/common.h>
37 #include <lttvwindow/mainwindow.h>
38 #include <lttvwindow/viewer.h>
39 #include <lttvwindow/toolbar.h>
40 #include <lttvwindow/menu.h>
41 #include <lttvwindow/callbacks.h> // for execute_time_requests
45 * Internal function parts
49 * Function to set/update traceset for the viewers
50 * @param main_win main window
51 * @param traceset traceset of the main window.
54 * 0 : traceset updated
55 * 1 : no traceset hooks to update; not an error.
58 int SetTraceset(MainWindow
* main_win
, gpointer traceset
)
61 LttvAttributeValue value
;
63 if( lttv_iattribute_find_by_path(main_win
->attributes
,
64 "hooks/updatetraceset", LTTV_POINTER
, &value
) != 0)
67 tmp
= (LttvHooks
*)*(value
.v_pointer
);
68 if(tmp
== NULL
) return 1;
71 lttv_hooks_call(tmp
,traceset
);
78 * Function to set/update filter for the viewers
79 * @param main_win main window
80 * @param filter filter of the main window.
84 * 1 : no filter hooks to update; not an error.
87 int SetFilter(MainWindow
* main_win
, gpointer filter
)
90 LttvAttributeValue value
;
92 if(lttv_iattribute_find_by_path(main_win
->attributes
,
93 "hooks/updatefilter", LTTV_POINTER
, &value
) != 0)
96 tmp
= (LttvHooks
*)*(value
.v_pointer
);
98 if(tmp
== NULL
) return 1;
99 lttv_hooks_call(tmp
,filter
);
105 * Function to redraw each viewer belonging to the current tab
106 * @param main_win the main window the viewer belongs to.
109 void update_traceset(MainWindow
* main_win
)
111 LttvAttributeValue value
;
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
);
120 void set_time_window_adjustment(MainWindow
* main_win
, const TimeWindow
* new_time_window
)
122 gtk_multi_vpaned_set_adjust(main_win
->current_tab
->multi_vpaned
, new_time_window
, FALSE
);
126 void set_time_window(MainWindow
* main_win
, const TimeWindow
*time_window
)
128 LttvAttributeValue value
;
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
);
138 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
139 "hooks/updatetimewindow", LTTV_POINTER
, &value
));
140 tmp
= (LttvHooks
*)*(value
.v_pointer
);
141 if(tmp
== NULL
) return;
142 lttv_hooks_call(tmp
, &time_window_notify_data
);
148 /* Remove menu entry and tool button from main window for the
152 void remove_menu_item(gpointer main_win
, gpointer user_data
)
154 MainWindow
* mw
= (MainWindow
*) main_win
;
155 lttv_menu_closure
*menu_item
= (lttv_menu_closure
*)user_data
;
156 GtkWidget
* tool_menu_title_menu
, *insert_view
;
158 tool_menu_title_menu
= lookup_widget(mw
->mwindow
,"ToolMenuTitle_menu");
159 insert_view
= (GtkWidget
*)g_hash_table_lookup(mw
->hash_menu_item
,
160 menu_item
->menuText
);
162 g_hash_table_remove(mw
->hash_menu_item
, menu_item
->menuText
);
163 gtk_container_remove (GTK_CONTAINER (tool_menu_title_menu
), insert_view
);
167 void remove_toolbar_item(gpointer main_win
, gpointer user_data
)
169 MainWindow
* mw
= (MainWindow
*) main_win
;
170 lttv_toolbar_closure
*toolbar_item
= (lttv_toolbar_closure
*)user_data
;
171 GtkWidget
* tool_menu_title_menu
, *insert_view
;
174 tool_menu_title_menu
= lookup_widget(mw
->mwindow
,"MToolbar1");
175 insert_view
= (GtkWidget
*)g_hash_table_lookup(mw
->hash_toolbar_item
,
176 toolbar_item
->tooltip
);
178 g_hash_table_remove(mw
->hash_toolbar_item
, toolbar_item
->tooltip
);
179 gtk_container_remove (GTK_CONTAINER (tool_menu_title_menu
), insert_view
);
184 * Remove menu and toolbar item when a module unloaded from all
188 void main_window_remove_menu_item(lttvwindow_viewer_constructor constructor
)
192 lttv_menu_closure
*menu_item
;
193 LttvAttributeValue value
;
194 LttvIAttribute
*attributes
= LTTV_IATTRIBUTE(lttv_global_attributes());
196 g_assert(lttv_iattribute_find_by_path(attributes
,
197 "viewers/menu", LTTV_POINTER
, &value
));
198 menu
= (LttvMenus
*)*(value
.v_pointer
);
201 for(i
=0;i
<menu
->len
;i
++){
202 menu_item
= &g_array_index(menu
, lttv_menu_closure
, i
);
203 if(menu_item
->con
!= constructor
) continue;
204 if(g_main_window_list
){
205 g_slist_foreach(g_main_window_list
, remove_menu_item
, menu_item
);
213 void main_window_remove_toolbar_item(lttvwindow_viewer_constructor constructor
)
216 LttvToolbars
* toolbar
;
217 lttv_toolbar_closure
*toolbar_item
;
218 LttvAttributeValue value
;
219 LttvIAttribute
*attributes
= LTTV_IATTRIBUTE(lttv_global_attributes());
221 g_assert(lttv_iattribute_find_by_path(attributes
,
222 "viewers/toolbar", LTTV_POINTER
, &value
));
223 toolbar
= (LttvToolbars
*)*(value
.v_pointer
);
226 for(i
=0;i
<toolbar
->len
;i
++){
227 toolbar_item
= &g_array_index(toolbar
, lttv_toolbar_closure
, i
);
228 if(toolbar_item
->con
!= constructor
) continue;
229 if(g_main_window_list
){
230 g_slist_foreach(g_main_window_list
, remove_toolbar_item
, toolbar_item
);
245 * Function to register a view constructor so that main window can generate
246 * a toolbar item for the viewer in order to generate a new instance easily.
247 * It will be called by init function of the module.
248 * @param ButtonPixmap image shown on the toolbar item.
249 * @param tooltip tooltip of the toolbar item.
250 * @param view_constructor constructor of the viewer.
253 void lttvwindow_register_toolbar(char ** pixmap
, char *tooltip
, lttvwindow_viewer_constructor view_constructor
)
255 LttvIAttribute
*attributes_global
= LTTV_IATTRIBUTE(lttv_global_attributes());
256 LttvToolbars
* toolbar
;
257 LttvAttributeValue value
;
259 g_assert(lttv_iattribute_find_by_path(attributes_global
,
260 "viewers/toolbar", LTTV_POINTER
, &value
));
261 toolbar
= (LttvToolbars
*)*(value
.v_pointer
);
264 toolbar
= lttv_toolbars_new();
265 *(value
.v_pointer
) = toolbar
;
267 lttv_toolbars_add(toolbar
, view_constructor
, tooltip
, pixmap
);
272 * Function to unregister the viewer's constructor, release the space
273 * occupied by pixmap, tooltip and constructor of the viewer.
274 * It will be called when a module is unloaded.
275 * @param view_constructor constructor of the viewer which is used as
276 * a reference to find out where the pixmap and tooltip are.
279 void lttvwindow_unregister_toolbar(lttvwindow_viewer_constructor view_constructor
)
281 LttvIAttribute
*attributes_global
= LTTV_IATTRIBUTE(lttv_global_attributes());
282 LttvToolbars
* toolbar
;
283 LttvAttributeValue value
;
285 g_assert(lttv_iattribute_find_by_path(attributes_global
,
286 "viewers/toolbar", LTTV_POINTER
, &value
));
287 toolbar
= (LttvToolbars
*)*(value
.v_pointer
);
289 main_window_remove_toolbar_item(view_constructor
);
291 lttv_toolbars_remove(toolbar
, view_constructor
);
296 * Function to register a view constructor so that main window can generate
297 * a menu item for the viewer in order to generate a new instance easily.
298 * It will be called by init function of the module.
299 * @param menu_path path of the menu item.
300 * @param menu_text text of the menu item.
301 * @param view_constructor constructor of the viewer.
304 void lttvwindow_register_menu(char *menu_path
, char *menu_text
, lttvwindow_viewer_constructor view_constructor
)
306 LttvIAttribute
*attributes_global
= LTTV_IATTRIBUTE(lttv_global_attributes());
308 LttvAttributeValue value
;
310 g_assert(lttv_iattribute_find_by_path(attributes_global
,
311 "viewers/menu", LTTV_POINTER
, &value
));
312 menu
= (LttvMenus
*)*(value
.v_pointer
);
315 menu
= lttv_menus_new();
316 *(value
.v_pointer
) = menu
;
318 lttv_menus_add(menu
, view_constructor
, menu_path
, menu_text
);
322 * Function to unregister the viewer's constructor, release the space
323 * occupied by menu_path, menu_text and constructor of the viewer.
324 * It will be called when a module is unloaded.
325 * @param view_constructor constructor of the viewer which is used as
326 * a reference to find out where the menu_path and menu_text are.
329 void lttvwindow_unregister_menu(lttvwindow_viewer_constructor view_constructor
)
331 LttvIAttribute
*attributes_global
= LTTV_IATTRIBUTE(lttv_global_attributes());
333 LttvAttributeValue value
;
335 g_assert(lttv_iattribute_find_by_path(attributes_global
,
336 "viewers/menu", LTTV_POINTER
, &value
));
337 menu
= (LttvMenus
*)*(value
.v_pointer
);
339 main_window_remove_menu_item(view_constructor
);
341 lttv_menus_remove(menu
, view_constructor
);
345 * Function to register a hook function for a viewer to set/update its
347 * @param hook hook function of the viewer.
348 * @param hook_data hook data associated with the hook function.
349 * @param main_win the main window the viewer belongs to.
351 void lttvwindow_register_time_window_notify(MainWindow
* main_win
,
352 LttvHook hook
, gpointer hook_data
)
354 LttvAttributeValue value
;
356 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
357 "hooks/updatetimewindow", LTTV_POINTER
, &value
));
358 tmp
= (LttvHooks
*)*(value
.v_pointer
);
360 tmp
= lttv_hooks_new();
361 *(value
.v_pointer
) = tmp
;
363 lttv_hooks_add(tmp
, hook
,hook_data
);
368 * Function to unregister a viewer's hook function which is used to
369 * set/update the time interval of the viewer.
370 * @param hook hook function of the viewer.
371 * @param hook_data hook data associated with the hook function.
372 * @param main_win the main window the viewer belongs to.
375 void lttvwindow_unregister_time_window_notify(MainWindow
* main_win
,
376 LttvHook hook
, gpointer hook_data
)
378 LttvAttributeValue value
;
380 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
381 "hooks/updatetimewindow", LTTV_POINTER
, &value
));
382 tmp
= (LttvHooks
*)*(value
.v_pointer
);
383 if(tmp
== NULL
) return;
384 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
388 * Function to register a hook function for a viewer to set/update its
390 * @param hook hook function of the viewer.
391 * @param hook_data hook data associated with the hook function.
392 * @param main_win the main window the viewer belongs to.
395 void lttvwindow_register_traceset_notify(MainWindow
* main_win
,
396 LttvHook hook
, gpointer hook_data
)
398 LttvAttributeValue value
;
400 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
401 "hooks/updatetraceset", LTTV_POINTER
, &value
));
402 tmp
= (LttvHooks
*)*(value
.v_pointer
);
404 tmp
= lttv_hooks_new();
405 *(value
.v_pointer
) = tmp
;
407 lttv_hooks_add(tmp
, hook
, hook_data
);
412 * Function to unregister a viewer's hook function which is used to
413 * set/update the traceset of the viewer.
414 * @param hook hook function of the viewer.
415 * @param hook_data hook data associated with the hook function.
416 * @param main_win the main window the viewer belongs to.
419 void lttvwindow_unregister_traceset_notify(MainWindow
* main_win
,
420 LttvHook hook
, gpointer hook_data
)
422 LttvAttributeValue value
;
424 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
425 "hooks/updatetraceset", LTTV_POINTER
, &value
));
426 tmp
= (LttvHooks
*)*(value
.v_pointer
);
427 if(tmp
== NULL
) return;
428 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
432 * Function to register a hook function for a viewer to set/update its
434 * @param hook hook function of the viewer.
435 * @param hook_data hook data associated with the hook function.
436 * @param main_win the main window the viewer belongs to.
439 void lttvwindow_register_filter_notify(MainWindow
*main_win
,
440 LttvHook hook
, gpointer hook_data
)
442 LttvAttributeValue value
;
444 g_assert(lttv_iattribute_find_by_path(main_win
->attributes
,
445 "hooks/updatefilter", LTTV_POINTER
, &value
));
446 tmp
= (LttvHooks
*)*(value
.v_pointer
);
448 tmp
= lttv_hooks_new();
449 *(value
.v_pointer
) = tmp
;
451 lttv_hooks_add(tmp
, hook
, hook_data
);
456 * Function to unregister a viewer's hook function which is used to
457 * set/update the filter of the viewer.
458 * @param hook hook function of the viewer.
459 * @param hook_data hook data associated with the hook function.
460 * @param main_win the main window the viewer belongs to.
463 void lttvwindow_unregister_filter_notify(MainWindow
* main_win
,
467 LttvAttributeValue value
;
469 g_assert(lttv_iattribute_find_by_path(main_win
->attributes
,
470 "hooks/updatefilter", LTTV_POINTER
, &value
));
471 tmp
= (LttvHooks
*)*(value
.v_pointer
);
472 if(tmp
== NULL
) return;
473 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
477 * Function to register a hook function for a viewer to set/update its
479 * @param hook hook function of the viewer.
480 * @param hook_data hook data associated with the hook function.
481 * @param main_win the main window the viewer belongs to.
484 void lttvwindow_register_current_time_notify(MainWindow
*main_win
,
485 LttvHook hook
, gpointer hook_data
)
487 LttvAttributeValue value
;
489 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
490 "hooks/updatecurrenttime", LTTV_POINTER
, &value
));
491 tmp
= (LttvHooks
*)*(value
.v_pointer
);
493 tmp
= lttv_hooks_new();
494 *(value
.v_pointer
) = tmp
;
496 lttv_hooks_add(tmp
, hook
, hook_data
);
501 * Function to unregister a viewer's hook function which is used to
502 * set/update the current time of the viewer.
503 * @param hook hook function of the viewer.
504 * @param hook_data hook data associated with the hook function.
505 * @param main_win the main window the viewer belongs to.
508 void lttvwindow_unregister_current_time_notify(MainWindow
* main_win
,
509 LttvHook hook
, gpointer hook_data
)
511 LttvAttributeValue value
;
513 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
514 "hooks/updatecurrenttime", LTTV_POINTER
, &value
));
515 tmp
= (LttvHooks
*)*(value
.v_pointer
);
516 if(tmp
== NULL
) return;
517 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
522 * Function to register a hook function for a viewer to show
523 * the content of the viewer.
524 * @param hook hook function of the viewer.
525 * @param hook_data hook data associated with the hook function.
526 * @param main_win the main window the viewer belongs to.
529 void lttvwindow_register_show_notify(MainWindow
*main_win
,
530 LttvHook hook
, gpointer hook_data
)
532 LttvAttributeValue value
;
534 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
535 "hooks/showviewer", LTTV_POINTER
, &value
));
536 tmp
= (LttvHooks
*)*(value
.v_pointer
);
538 tmp
= lttv_hooks_new();
539 *(value
.v_pointer
) = tmp
;
541 lttv_hooks_add(tmp
, hook
, hook_data
);
546 * Function to unregister a viewer's hook function which is used to
547 * show the content of the viewer..
548 * @param hook hook function of the viewer.
549 * @param hook_data hook data associated with the hook function.
550 * @param main_win the main window the viewer belongs to.
553 void lttvwindow_unregister_show_notify(MainWindow
* main_win
,
554 LttvHook hook
, gpointer hook_data
)
556 LttvAttributeValue value
;
558 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
559 "hooks/showviewer", LTTV_POINTER
, &value
));
560 tmp
= (LttvHooks
*)*(value
.v_pointer
);
561 if(tmp
== NULL
) return;
562 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
566 * Function to register a hook function for a viewer to set/update the
567 * dividor of the hpane.
568 * @param hook hook function of the viewer.
569 * @param hook_data hook data associated with the hook function.
570 * @param main_win the main window the viewer belongs to.
573 void lttvwindow_register_dividor(MainWindow
*main_win
,
574 LttvHook hook
, gpointer hook_data
)
576 LttvAttributeValue value
;
578 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
579 "hooks/hpanedividor", LTTV_POINTER
, &value
));
580 tmp
= (LttvHooks
*)*(value
.v_pointer
);
582 tmp
= lttv_hooks_new();
583 *(value
.v_pointer
) = tmp
;
585 lttv_hooks_add(tmp
, hook
, hook_data
);
590 * Function to unregister a viewer's hook function which is used to
591 * set/update hpane's dividor of the viewer.
592 * It will be called by the destructor of the viewer.
593 * @param hook hook function of the viewer.
594 * @param hook_data hook data associated with the hook function.
595 * @param main_win the main window the viewer belongs to.
598 void lttvwindow_unregister_dividor(MainWindow
*main_win
,
599 LttvHook hook
, gpointer hook_data
)
601 LttvAttributeValue value
;
603 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
604 "hooks/hpanedividor", LTTV_POINTER
, &value
));
605 tmp
= (LttvHooks
*)*(value
.v_pointer
);
606 if(tmp
== NULL
) return;
607 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
612 * Update the status bar whenever something changed in the viewer.
613 * @param main_win the main window the viewer belongs to.
614 * @param info the message which will be shown in the status bar.
617 void lttvwindow_report_status(MainWindow
*main_win
, const char *info
)
620 g_warning("update_status not implemented in viewer.c");
624 * Function to set the time interval of the current tab.
625 * It will be called by a viewer's signal handle associated with
626 * the move_slider signal
627 * @param main_win the main window the viewer belongs to.
628 * @param time_interval a pointer where time interval is stored.
631 void lttvwindow_report_time_window(MainWindow
*main_win
,
632 const TimeWindow
*time_window
)
634 set_time_window(main_win
, time_window
);
635 set_time_window_adjustment(main_win
, time_window
);
640 * Function to set the current time/event of the current tab.
641 * It will be called by a viewer's signal handle associated with
642 * the button-release-event signal
643 * @param main_win the main window the viewer belongs to.
644 * @param time a pointer where time is stored.
647 void lttvwindow_report_current_time(MainWindow
*main_win
,
650 LttvAttributeValue value
;
652 main_win
->current_tab
->current_time
= *time
;
653 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
654 "hooks/updatecurrenttime", LTTV_POINTER
, &value
));
655 tmp
= (LttvHooks
*)*(value
.v_pointer
);
657 if(tmp
== NULL
)return;
658 lttv_hooks_call(tmp
, &main_win
->current_tab
->current_time
);
662 * Function to set the position of the hpane's dividor (viewer).
663 * It will be called by a viewer's signal handle associated with
664 * the motion_notify_event event/signal
665 * @param main_win the main window the viewer belongs to.
666 * @param position position of the hpane's dividor.
669 void lttvwindow_report_dividor(MainWindow
*main_win
, gint position
)
671 LttvAttributeValue value
;
673 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
674 "hooks/hpanedividor", LTTV_POINTER
, &value
));
675 tmp
= (LttvHooks
*)*(value
.v_pointer
);
676 if(tmp
== NULL
) return;
677 lttv_hooks_call(tmp
, &position
);
681 * Function to set the focused pane (viewer).
682 * It will be called by a viewer's signal handle associated with
683 * the grab_focus signal
684 * @param main_win the main window the viewer belongs to.
685 * @param top_widget the top widget containing all the other widgets of the
689 void lttvwindow_report_focus(MainWindow
*main_win
, GtkWidget
*top_widget
)
691 gtk_multi_vpaned_set_focus((GtkWidget
*)main_win
->current_tab
->multi_vpaned
,
692 gtk_widget_get_parent(top_widget
));
697 * Function to request data in a specific time interval to the main window.
698 * The main window will use this time interval and the others present
699 * to get the data from the process trace.
700 * @param main_win the main window the viewer belongs to.
701 * @param paned a pointer to a pane where the viewer is contained.
704 void lttvwindow_time_interval_request(MainWindow
*main_win
,
705 TimeWindow time_requested
, guint num_events
,
706 LttvHook after_process_traceset
,
707 gpointer after_process_traceset_data
)
709 TimeRequest time_request
;
711 time_request
.time_window
= time_requested
;
712 time_request
.num_events
= num_events
;
713 time_request
.after_hook
= after_process_traceset
;
714 time_request
.after_hook_data
= after_process_traceset_data
;
716 g_array_append_val(main_win
->current_tab
->time_requests
, time_request
);
718 if(!main_win
->current_tab
->time_request_pending
)
720 /* Redraw has +20 priority. We want a prio higher than that, so +19 */
721 g_idle_add_full((G_PRIORITY_HIGH_IDLE
+ 19),
722 (GSourceFunc
)execute_time_requests
,
725 main_win
->current_tab
->time_request_pending
= TRUE
;
730 * Function to get the current time interval shown on the current tab.
731 * It will be called by a viewer's hook function to update the
732 * shown time interval of the viewer and also be called by the constructor
734 * @param main_win the main window the viewer belongs to.
735 * @param time_interval a pointer where time interval will be stored.
738 const TimeWindow
*lttvwindow_get_time_window(MainWindow
*main_win
)
740 //time_window->start_time = main_win->current_tab->time_window.start_time;
741 //time_window->time_width = main_win->current_tab->time_window.time_width;
742 return &(main_win
->current_tab
->time_window
);
748 * Function to get the current time/event of the current tab.
749 * It will be called by a viewer's hook function to update the
750 * current time/event of the viewer.
751 * @param main_win the main window the viewer belongs to.
752 * @param time a pointer where time will be stored.
755 const LttTime
*lttvwindow_get_current_time(MainWindow
*main_win
)
757 return &(main_win
->current_tab
->current_time
);
762 * Function to get the filter of the current tab.
763 * It will be called by the constructor of the viewer and also be
764 * called by a hook funtion of the viewer to update its filter.
765 * @param main_win, the main window the viewer belongs to.
766 * @param filter, a pointer to a filter.
768 const lttv_filter
*lttvwindow_get_filter(MainWindow
*main_win
)
771 g_warning("lttvwindow_get_filter not implemented in viewer.c");
776 * Function to get the stats of the traceset
777 * @param main_win the main window the viewer belongs to.
780 LttvTracesetStats
* lttvwindow_get_traceset_stats(MainWindow
*main_win
)
782 return main_win
->current_tab
->traceset_info
->traceset_context
;
786 LttvTracesetContext
* lttvwindow_get_traceset_context(MainWindow
*main_win
)
788 return (LttvTracesetContext
*)main_win
->current_tab
->traceset_info
->traceset_context
;