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
);
147 void add_toolbar_constructor(MainWindow
*mw
, LttvToolbarClosure
*toolbar_c
)
149 LttvIAttribute
*attributes
= LTTV_IATTRIBUTES(mw
->attributes
);
150 LttvAttributeValue value
;
151 LttvToolbars
* instance_toolbar
;
152 lttvwindow_viewer_constructor constructor
;
153 GtkWidget
* tool_menu_title_menu
, *new_widget
, *pixmap
;
156 g_assert(lttv_iattribute_find_by_path(attributes
,
157 "viewers/toolbar", LTTV_POINTER
, &value
));
158 if(*(value
.v_pointer
) == NULL
)
159 (LttvToolbars
*)*(value
.v_pointer
) = lttv_toolbars_new();
160 instance_toolbar
= (LttvToolbars
*)*(value
.v_pointer
);
162 constructor
= toolbar_c
->con
;
163 tool_menu_title_menu
= lookup_widget(mw
->mwindow
,"MToolbar1");
164 pixbuf
= gdk_pixbuf_new_from_xpm_data((const char**)toolbar_c
->pixmap
);
165 pixmap
= gtk_image_new_from_pixbuf(pixbuf
);
167 gtk_toolbar_append_element (GTK_TOOLBAR (tool_menu_title_menu
),
168 GTK_TOOLBAR_CHILD_BUTTON
,
171 toolbar_item
->tooltip
, NULL
,
173 gtk_label_set_use_underline(
174 GTK_LABEL (((GtkToolbarChild
*) (
175 g_list_last (GTK_TOOLBAR
176 (tool_menu_title_menu
)->children
)->data
))->label
),
178 gtk_container_set_border_width (GTK_CONTAINER (new_widget
), 1);
179 g_signal_connect ((gpointer
) new_widget
,
181 G_CALLBACK (insert_viewer_wrap
),
183 gtk_widget_show (new_widget
);
185 lttv_toolbars_add(instance_toolbar
, toolbar_item_i
->con
,
186 toolbar_item_i
->tooltip
,
187 toolbar_item_i
->pixmap
,
192 void add_menu_constructor(MainWindow
*mw
, LttvMenuClosure
*menu_c
)
194 LttvIAttribute
*attributes
= LTTV_IATTRIBUTES(mw
->attributes
);
195 LttvAttributeValue value
;
196 LttvToolbars
* instance_menu
;
197 lttvwindow_viewer_constructor constructor
;
198 GtkWidget
* tool_menu_title_menu
, *new_widget
;
200 g_assert(lttv_iattribute_find_by_path(attributes
,
201 "viewers/menu", LTTV_POINTER
, &value
));
202 if(*(value
.v_pointer
) == NULL
)
203 (LttvMenus
*)*(value
.v_pointer
) = lttv_menus_new();
204 instance_menu
= (LttvMenus
*)*(value
.v_pointer
);
207 constructor
= menu_item
->con
;
208 tool_menu_title_menu
= lookup_widget(mw
->mwindow
,"ToolMenuTitle_menu");
210 gtk_menu_item_new_with_mnemonic (menu_c
->menuText
);
211 gtk_container_add (GTK_CONTAINER (tool_menu_title_menu
),
213 g_signal_connect ((gpointer
) new_widget
, "activate",
214 G_CALLBACK (insert_viewer_wrap
),
216 gtk_widget_show (new_widget
);
217 lttv_menus_add(instance_menu
, menu_c
->con
,
223 void remove_toolbar_constructor(MainWindow
*mw
, lttvwindow_viewer_constructor viewer_constructor
)
225 LttvIAttribute
*attributes
= LTTV_IATTRIBUTES(mw
->attributes
);
226 LttvAttributeValue value
;
227 LttvToolbars
* instance_toolbar
;
228 lttvwindow_viewer_constructor constructor
;
229 GtkWidget
* tool_menu_title_menu
, *widget
;
231 g_assert(lttv_iattribute_find_by_path(attributes
,
232 "viewers/toolbar", LTTV_POINTER
, &value
));
233 if(*(value
.v_pointer
) == NULL
)
234 (LttvToolbars
*)*(value
.v_pointer
) = lttv_toolbars_new();
235 instance_toolbar
= (LttvToolbars
*)*(value
.v_pointer
);
237 tool_menu_title_menu
= lookup_widget(mw
->mwindow
,"MToolbar1");
238 widget
= lttv_menus_remove(instance_toolbar
, viewer_constructor
);
239 gtk_container_remove (GTK_CONTAINER (tool_menu_title_menu
),
244 void remove_menu_constructor(MainWindow
*mw
, lttvwindow_viewer_constructor viewer_constructor
)
246 LttvIAttribute
*attributes
= LTTV_IATTRIBUTES(mw
->attributes
);
247 LttvAttributeValue value
;
248 LttvMenus
* instance_menu
;
249 lttvwindow_viewer_constructor constructor
;
250 GtkWidget
* tool_menu_title_menu
, *widget
;
251 LttvMenuClosure
*menu_item_i
;
253 g_assert(lttv_iattribute_find_by_path(attributes
,
254 "viewers/menu", LTTV_POINTER
, &value
));
255 if(*(value
.v_pointer
) == NULL
)
256 (LttvMenus
*)*(value
.v_pointer
) = lttv_menus_new();
257 instance_menu
= (LttvMenus
*)*(value
.v_pointer
);
259 widget
= lttv_menus_remove(instance_menu
, viewer_constructor
);
260 tool_menu_title_menu
= lookup_widget(mw
->mwindow
,"ToolMenuTitle_menu");
261 gtk_container_remove (GTK_CONTAINER (tool_menu_title_menu
), widget
);
271 * Function to register a view constructor so that main window can generate
272 * a menu item and a toolbar item for the viewer in order to generate a new
273 * instance easily. A menu entry and toolbar item will be added to each main
276 * It should be called by init function of the module.
278 * @param menu_path path of the menu item.
279 * @param menu_text text of the menu item.
280 * @param pixmap Image shown on the toolbar item.
281 * @param tooltip tooltip of the toolbar item.
282 * @param view_constructor constructor of the viewer.
285 void lttvwindow_register_constructor
290 lttvwindow_viewer_constructor view_constructor
)
292 LttvIAttribute
*attributes_global
= LTTV_IATTRIBUTE(lttv_global_attributes());
293 LttvToolbars
* toolbar
;
295 LttvToolbarClosure toolbar_c
;
296 LttvMenuClosure menu_c
;
297 LttvAttributeValue value
;
300 g_assert(lttv_iattribute_find_by_path(attributes_global
,
301 "viewers/toolbar", LTTV_POINTER
, &value
));
302 toolbar
= (LttvToolbars
*)*(value
.v_pointer
);
304 if(toolbar
== NULL
) {
305 toolbar
= lttv_toolbars_new();
306 *(value
.v_pointer
) = toolbar
;
308 toolbar_c
= lttv_toolbars_add(toolbar
, view_constructor
, tooltip
, pixmap
);
310 g_slist_foreach(g_main_window_list
,
311 (gpointer
)add_toolbar_constructor
,
315 if(menu_path
!= NULL
) {
316 g_assert(lttv_iattribute_find_by_path(attributes_global
,
317 "viewers/menu", LTTV_POINTER
, &value
));
318 menu
= (LttvMenus
*)*(value
.v_pointer
);
321 menu
= lttv_menus_new();
322 *(value
.v_pointer
) = menu
;
324 menu_c
= lttv_menus_add(menu
, view_constructor
, menu_path
, menu_text
);
326 g_slist_foreach(g_main_window_list
,
327 (gpointer
)add_menu_constructor
,
334 * Function to unregister the viewer's constructor, release the space
335 * occupied by menu_path, menu_text, pixmap, tooltip and constructor of the
338 * It will be called when a module is unloaded.
340 * @param view_constructor constructor of the viewer.
344 void lttvwindow_unregister_constructor
345 (lttvwindow_viewer_constructor view_constructor
)
347 LttvIAttribute
*attributes_global
= LTTV_IATTRIBUTE(lttv_global_attributes());
348 LttvToolbars
* toolbar
;
350 LttvAttributeValue value
;
352 g_assert(lttv_iattribute_find_by_path(attributes_global
,
353 "viewers/toolbar", LTTV_POINTER
, &value
));
354 toolbar
= (LttvToolbars
*)*(value
.v_pointer
);
356 if(toolbar
!= NULL
) {
357 g_slist_foreach(g_main_window_list
,
358 (gpointer
)remove_toolbar_constructor
,
360 lttv_toolbars_remove(toolbar
, view_constructor
);
363 g_assert(lttv_iattribute_find_by_path(attributes_global
,
364 "viewers/menu", LTTV_POINTER
, &value
));
365 menu
= (LttvMenus
*)*(value
.v_pointer
);
368 g_slist_foreach(g_main_window_list
,
369 (gpointer
)remove_menu_constructor
,
371 lttv_menus_remove(menu
, view_constructor
);
377 * Function to register a hook function for a viewer to set/update its
379 * @param hook hook function of the viewer.
380 * @param hook_data hook data associated with the hook function.
381 * @param main_win the main window the viewer belongs to.
383 void lttvwindow_register_time_window_notify(MainWindow
* main_win
,
384 LttvHook hook
, gpointer hook_data
)
386 LttvAttributeValue value
;
388 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
389 "hooks/updatetimewindow", LTTV_POINTER
, &value
));
390 tmp
= (LttvHooks
*)*(value
.v_pointer
);
392 tmp
= lttv_hooks_new();
393 *(value
.v_pointer
) = tmp
;
395 lttv_hooks_add(tmp
, hook
,hook_data
);
400 * Function to unregister a viewer's hook function which is used to
401 * set/update the time interval of the viewer.
402 * @param hook hook function of the viewer.
403 * @param hook_data hook data associated with the hook function.
404 * @param main_win the main window the viewer belongs to.
407 void lttvwindow_unregister_time_window_notify(MainWindow
* main_win
,
408 LttvHook hook
, gpointer hook_data
)
410 LttvAttributeValue value
;
412 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
413 "hooks/updatetimewindow", LTTV_POINTER
, &value
));
414 tmp
= (LttvHooks
*)*(value
.v_pointer
);
415 if(tmp
== NULL
) return;
416 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
420 * Function to register a hook function for a viewer to set/update its
422 * @param hook hook function of the viewer.
423 * @param hook_data hook data associated with the hook function.
424 * @param main_win the main window the viewer belongs to.
427 void lttvwindow_register_traceset_notify(MainWindow
* main_win
,
428 LttvHook hook
, gpointer hook_data
)
430 LttvAttributeValue value
;
432 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
433 "hooks/updatetraceset", LTTV_POINTER
, &value
));
434 tmp
= (LttvHooks
*)*(value
.v_pointer
);
436 tmp
= lttv_hooks_new();
437 *(value
.v_pointer
) = tmp
;
439 lttv_hooks_add(tmp
, hook
, hook_data
);
444 * Function to unregister a viewer's hook function which is used to
445 * set/update the traceset of the viewer.
446 * @param hook hook function of the viewer.
447 * @param hook_data hook data associated with the hook function.
448 * @param main_win the main window the viewer belongs to.
451 void lttvwindow_unregister_traceset_notify(MainWindow
* main_win
,
452 LttvHook hook
, gpointer hook_data
)
454 LttvAttributeValue value
;
456 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
457 "hooks/updatetraceset", LTTV_POINTER
, &value
));
458 tmp
= (LttvHooks
*)*(value
.v_pointer
);
459 if(tmp
== NULL
) return;
460 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
464 * Function to register a hook function for a viewer to set/update its
466 * @param hook hook function of the viewer.
467 * @param hook_data hook data associated with the hook function.
468 * @param main_win the main window the viewer belongs to.
471 void lttvwindow_register_filter_notify(MainWindow
*main_win
,
472 LttvHook hook
, gpointer hook_data
)
474 LttvAttributeValue value
;
476 g_assert(lttv_iattribute_find_by_path(main_win
->attributes
,
477 "hooks/updatefilter", LTTV_POINTER
, &value
));
478 tmp
= (LttvHooks
*)*(value
.v_pointer
);
480 tmp
= lttv_hooks_new();
481 *(value
.v_pointer
) = tmp
;
483 lttv_hooks_add(tmp
, hook
, hook_data
);
488 * Function to unregister a viewer's hook function which is used to
489 * set/update the filter of the viewer.
490 * @param hook hook function of the viewer.
491 * @param hook_data hook data associated with the hook function.
492 * @param main_win the main window the viewer belongs to.
495 void lttvwindow_unregister_filter_notify(MainWindow
* main_win
,
499 LttvAttributeValue value
;
501 g_assert(lttv_iattribute_find_by_path(main_win
->attributes
,
502 "hooks/updatefilter", LTTV_POINTER
, &value
));
503 tmp
= (LttvHooks
*)*(value
.v_pointer
);
504 if(tmp
== NULL
) return;
505 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
509 * Function to register a hook function for a viewer to set/update its
511 * @param hook hook function of the viewer.
512 * @param hook_data hook data associated with the hook function.
513 * @param main_win the main window the viewer belongs to.
516 void lttvwindow_register_current_time_notify(MainWindow
*main_win
,
517 LttvHook hook
, gpointer hook_data
)
519 LttvAttributeValue value
;
521 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
522 "hooks/updatecurrenttime", LTTV_POINTER
, &value
));
523 tmp
= (LttvHooks
*)*(value
.v_pointer
);
525 tmp
= lttv_hooks_new();
526 *(value
.v_pointer
) = tmp
;
528 lttv_hooks_add(tmp
, hook
, hook_data
);
533 * Function to unregister a viewer's hook function which is used to
534 * set/update the current time of the viewer.
535 * @param hook hook function of the viewer.
536 * @param hook_data hook data associated with the hook function.
537 * @param main_win the main window the viewer belongs to.
540 void lttvwindow_unregister_current_time_notify(MainWindow
* main_win
,
541 LttvHook hook
, gpointer hook_data
)
543 LttvAttributeValue value
;
545 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
546 "hooks/updatecurrenttime", LTTV_POINTER
, &value
));
547 tmp
= (LttvHooks
*)*(value
.v_pointer
);
548 if(tmp
== NULL
) return;
549 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
554 * Function to register a hook function for a viewer to show
555 * the content of the viewer.
556 * @param hook hook function of the viewer.
557 * @param hook_data hook data associated with the hook function.
558 * @param main_win the main window the viewer belongs to.
561 void lttvwindow_register_show_notify(MainWindow
*main_win
,
562 LttvHook hook
, gpointer hook_data
)
564 LttvAttributeValue value
;
566 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
567 "hooks/showviewer", LTTV_POINTER
, &value
));
568 tmp
= (LttvHooks
*)*(value
.v_pointer
);
570 tmp
= lttv_hooks_new();
571 *(value
.v_pointer
) = tmp
;
573 lttv_hooks_add(tmp
, hook
, hook_data
);
578 * Function to unregister a viewer's hook function which is used to
579 * show the content of the viewer..
580 * @param hook hook function of the viewer.
581 * @param hook_data hook data associated with the hook function.
582 * @param main_win the main window the viewer belongs to.
585 void lttvwindow_unregister_show_notify(MainWindow
* main_win
,
586 LttvHook hook
, gpointer hook_data
)
588 LttvAttributeValue value
;
590 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
591 "hooks/showviewer", LTTV_POINTER
, &value
));
592 tmp
= (LttvHooks
*)*(value
.v_pointer
);
593 if(tmp
== NULL
) return;
594 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
598 * Function to register a hook function for a viewer to set/update the
599 * dividor of the hpane.
600 * @param hook hook function of the viewer.
601 * @param hook_data hook data associated with the hook function.
602 * @param main_win the main window the viewer belongs to.
605 void lttvwindow_register_dividor(MainWindow
*main_win
,
606 LttvHook hook
, gpointer hook_data
)
608 LttvAttributeValue value
;
610 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
611 "hooks/hpanedividor", LTTV_POINTER
, &value
));
612 tmp
= (LttvHooks
*)*(value
.v_pointer
);
614 tmp
= lttv_hooks_new();
615 *(value
.v_pointer
) = tmp
;
617 lttv_hooks_add(tmp
, hook
, hook_data
);
622 * Function to unregister a viewer's hook function which is used to
623 * set/update hpane's dividor of the viewer.
624 * It will be called by the destructor of the viewer.
625 * @param hook hook function of the viewer.
626 * @param hook_data hook data associated with the hook function.
627 * @param main_win the main window the viewer belongs to.
630 void lttvwindow_unregister_dividor(MainWindow
*main_win
,
631 LttvHook hook
, gpointer hook_data
)
633 LttvAttributeValue value
;
635 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
636 "hooks/hpanedividor", LTTV_POINTER
, &value
));
637 tmp
= (LttvHooks
*)*(value
.v_pointer
);
638 if(tmp
== NULL
) return;
639 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
644 * Update the status bar whenever something changed in the viewer.
645 * @param main_win the main window the viewer belongs to.
646 * @param info the message which will be shown in the status bar.
649 void lttvwindow_report_status(MainWindow
*main_win
, const char *info
)
652 g_warning("update_status not implemented in viewer.c");
656 * Function to set the time interval of the current tab.
657 * It will be called by a viewer's signal handle associated with
658 * the move_slider signal
659 * @param main_win the main window the viewer belongs to.
660 * @param time_interval a pointer where time interval is stored.
663 void lttvwindow_report_time_window(MainWindow
*main_win
,
664 const TimeWindow
*time_window
)
666 set_time_window(main_win
, time_window
);
667 set_time_window_adjustment(main_win
, time_window
);
672 * Function to set the current time/event of the current tab.
673 * It will be called by a viewer's signal handle associated with
674 * the button-release-event signal
675 * @param main_win the main window the viewer belongs to.
676 * @param time a pointer where time is stored.
679 void lttvwindow_report_current_time(MainWindow
*main_win
,
682 LttvAttributeValue value
;
684 main_win
->current_tab
->current_time
= *time
;
685 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
686 "hooks/updatecurrenttime", LTTV_POINTER
, &value
));
687 tmp
= (LttvHooks
*)*(value
.v_pointer
);
689 if(tmp
== NULL
)return;
690 lttv_hooks_call(tmp
, &main_win
->current_tab
->current_time
);
694 * Function to set the position of the hpane's dividor (viewer).
695 * It will be called by a viewer's signal handle associated with
696 * the motion_notify_event event/signal
697 * @param main_win the main window the viewer belongs to.
698 * @param position position of the hpane's dividor.
701 void lttvwindow_report_dividor(MainWindow
*main_win
, gint position
)
703 LttvAttributeValue value
;
705 g_assert(lttv_iattribute_find_by_path(main_win
->current_tab
->attributes
,
706 "hooks/hpanedividor", LTTV_POINTER
, &value
));
707 tmp
= (LttvHooks
*)*(value
.v_pointer
);
708 if(tmp
== NULL
) return;
709 lttv_hooks_call(tmp
, &position
);
713 * Function to set the focused pane (viewer).
714 * It will be called by a viewer's signal handle associated with
715 * the grab_focus signal
716 * @param main_win the main window the viewer belongs to.
717 * @param top_widget the top widget containing all the other widgets of the
721 void lttvwindow_report_focus(MainWindow
*main_win
, GtkWidget
*top_widget
)
723 gtk_multi_vpaned_set_focus((GtkWidget
*)main_win
->current_tab
->multi_vpaned
,
724 gtk_widget_get_parent(top_widget
));
729 * Function to request data in a specific time interval to the main window.
730 * The main window will use this time interval and the others present
731 * to get the data from the process trace.
732 * @param main_win the main window the viewer belongs to.
733 * @param paned a pointer to a pane where the viewer is contained.
736 void lttvwindow_time_interval_request(MainWindow
*main_win
,
737 TimeWindow time_requested
, guint num_events
,
738 LttvHook after_process_traceset
,
739 gpointer after_process_traceset_data
)
741 TimeRequest time_request
;
743 time_request
.time_window
= time_requested
;
744 time_request
.num_events
= num_events
;
745 time_request
.after_hook
= after_process_traceset
;
746 time_request
.after_hook_data
= after_process_traceset_data
;
748 g_array_append_val(main_win
->current_tab
->time_requests
, time_request
);
750 if(!main_win
->current_tab
->time_request_pending
)
752 /* Redraw has +20 priority. We want a prio higher than that, so +19 */
753 g_idle_add_full((G_PRIORITY_HIGH_IDLE
+ 19),
754 (GSourceFunc
)execute_time_requests
,
757 main_win
->current_tab
->time_request_pending
= TRUE
;
762 * Function to get the current time interval shown on the current tab.
763 * It will be called by a viewer's hook function to update the
764 * shown time interval of the viewer and also be called by the constructor
766 * @param main_win the main window the viewer belongs to.
767 * @param time_interval a pointer where time interval will be stored.
770 const TimeWindow
*lttvwindow_get_time_window(MainWindow
*main_win
)
772 //time_window->start_time = main_win->current_tab->time_window.start_time;
773 //time_window->time_width = main_win->current_tab->time_window.time_width;
774 return &(main_win
->current_tab
->time_window
);
780 * Function to get the current time/event of the current tab.
781 * It will be called by a viewer's hook function to update the
782 * current time/event of the viewer.
783 * @param main_win the main window the viewer belongs to.
784 * @param time a pointer where time will be stored.
787 const LttTime
*lttvwindow_get_current_time(MainWindow
*main_win
)
789 return &(main_win
->current_tab
->current_time
);
794 * Function to get the filter of the current tab.
795 * It will be called by the constructor of the viewer and also be
796 * called by a hook funtion of the viewer to update its filter.
797 * @param main_win, the main window the viewer belongs to.
798 * @param filter, a pointer to a filter.
800 const lttv_filter
*lttvwindow_get_filter(MainWindow
*main_win
)
803 g_warning("lttvwindow_get_filter not implemented in viewer.c");
808 * Function to get the stats of the traceset
809 * @param main_win the main window the viewer belongs to.
812 LttvTracesetStats
* lttvwindow_get_traceset_stats(MainWindow
*main_win
)
814 return main_win
->current_tab
->traceset_info
->traceset_context
;
818 LttvTracesetContext
* lttvwindow_get_traceset_context(MainWindow
*main_win
)
820 return (LttvTracesetContext
*)main_win
->current_tab
->traceset_info
->traceset_context
;