toolbar menus now add/remove symmetrical
[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
001d8606 151
561f5852 152/**
153 * Function to register a view constructor so that main window can generate
001d8606 154 * a menu item and a toolbar item for the viewer in order to generate a new
155 * instance easily. A menu entry and toolbar item will be added to each main
156 * window.
157 *
158 * It should be called by init function of the module.
159 *
160 * @param menu_path path of the menu item.
161 * @param menu_text text of the menu item.
162 * @param pixmap Image shown on the toolbar item.
561f5852 163 * @param tooltip tooltip of the toolbar item.
164 * @param view_constructor constructor of the viewer.
165 */
166
001d8606 167void lttvwindow_register_constructor
168 (char * menu_path,
169 char * menu_text,
170 char ** pixmap,
171 char * tooltip,
172 lttvwindow_viewer_constructor view_constructor)
561f5852 173{
174 LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
175 LttvToolbars * toolbar;
001d8606 176 LttvMenus * menu;
561f5852 177 LttvAttributeValue value;
178
001d8606 179 if(pixmap != NULL) {
180 g_assert(lttv_iattribute_find_by_path(attributes_global,
181 "viewers/toolbar", LTTV_POINTER, &value));
182 toolbar = (LttvToolbars*)*(value.v_pointer);
561f5852 183
001d8606 184 if(toolbar == NULL) {
185 toolbar = lttv_toolbars_new();
186 *(value.v_pointer) = toolbar;
187 }
188 lttv_toolbars_add(toolbar, view_constructor, tooltip, pixmap);
189 main_window_add_toolbars_item(toolbar, view_constructor, tooltip, pixmap);
190 }
191
192 if(menu_path != NULL) {
193 g_assert(lttv_iattribute_find_by_path(attributes_global,
194 "viewers/menu", LTTV_POINTER, &value));
195 menu = (LttvMenus*)*(value.v_pointer);
196
197 if(menu == NULL) {
198 menu = lttv_menus_new();
199 *(value.v_pointer) = menu;
200 }
201 lttv_menus_add(menu, view_constructor, menu_path, menu_text);
202 main_window_add_menu_item(menu, view_constructor, menu_path, menu_text);
561f5852 203 }
561f5852 204}
205
206
207/**
208 * Function to unregister the viewer's constructor, release the space
001d8606 209 * occupied by menu_path, menu_text, pixmap, tooltip and constructor of the
210 * viewer.
211 *
561f5852 212 * It will be called when a module is unloaded.
001d8606 213 *
214 * @param view_constructor constructor of the viewer.
561f5852 215 */
216
001d8606 217
218void lttvwindow_unregister_constructor
219 (lttvwindow_viewer_constructor view_constructor)
561f5852 220{
221 LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
222 LttvToolbars * toolbar;
001d8606 223 LttvMenus * menu;
561f5852 224 LttvAttributeValue value;
225
226 g_assert(lttv_iattribute_find_by_path(attributes_global,
d2811a98 227 "viewers/toolbar", LTTV_POINTER, &value));
561f5852 228 toolbar = (LttvToolbars*)*(value.v_pointer);
229
001d8606 230 if(toolbar != NULL) {
231 main_window_remove_toolbar_item(view_constructor);
232 lttv_toolbars_remove(toolbar, view_constructor);
233 }
561f5852 234
235 g_assert(lttv_iattribute_find_by_path(attributes_global,
d2811a98 236 "viewers/menu", LTTV_POINTER, &value));
561f5852 237 menu = (LttvMenus*)*(value.v_pointer);
238
001d8606 239 if(menu != NULL) {
240 main_window_remove_menu_item(view_constructor);
241 lttv_menus_remove(menu, view_constructor);
561f5852 242 }
561f5852 243
561f5852 244
561f5852 245}
246
001d8606 247
561f5852 248/**
249 * Function to register a hook function for a viewer to set/update its
250 * time interval.
561f5852 251 * @param hook hook function of the viewer.
252 * @param hook_data hook data associated with the hook function.
253 * @param main_win the main window the viewer belongs to.
254 */
224446ce 255void lttvwindow_register_time_window_notify(MainWindow * main_win,
256 LttvHook hook, gpointer hook_data)
561f5852 257{
258 LttvAttributeValue value;
259 LttvHooks * tmp;
bca3b81f 260 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 261 "hooks/updatetimewindow", LTTV_POINTER, &value));
561f5852 262 tmp = (LttvHooks*)*(value.v_pointer);
263 if(tmp == NULL){
264 tmp = lttv_hooks_new();
265 *(value.v_pointer) = tmp;
266 }
267 lttv_hooks_add(tmp, hook,hook_data);
268}
269
270
271/**
272 * Function to unregister a viewer's hook function which is used to
273 * set/update the time interval of the viewer.
561f5852 274 * @param hook hook function of the viewer.
275 * @param hook_data hook data associated with the hook function.
276 * @param main_win the main window the viewer belongs to.
277 */
278
224446ce 279void lttvwindow_unregister_time_window_notify(MainWindow * main_win,
280 LttvHook hook, gpointer hook_data)
561f5852 281{
282 LttvAttributeValue value;
283 LttvHooks * tmp;
bca3b81f 284 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 285 "hooks/updatetimewindow", LTTV_POINTER, &value));
561f5852 286 tmp = (LttvHooks*)*(value.v_pointer);
287 if(tmp == NULL) return;
288 lttv_hooks_remove_data(tmp, hook, hook_data);
289}
290
561f5852 291/**
292 * Function to register a hook function for a viewer to set/update its
293 * traceset.
561f5852 294 * @param hook hook function of the viewer.
295 * @param hook_data hook data associated with the hook function.
296 * @param main_win the main window the viewer belongs to.
297 */
298
224446ce 299void lttvwindow_register_traceset_notify(MainWindow * main_win,
300 LttvHook hook, gpointer hook_data)
561f5852 301{
302 LttvAttributeValue value;
303 LttvHooks * tmp;
a8c0f09d 304 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 305 "hooks/updatetraceset", LTTV_POINTER, &value));
561f5852 306 tmp = (LttvHooks*)*(value.v_pointer);
307 if(tmp == NULL){
308 tmp = lttv_hooks_new();
309 *(value.v_pointer) = tmp;
310 }
311 lttv_hooks_add(tmp, hook, hook_data);
312}
313
314
315/**
316 * Function to unregister a viewer's hook function which is used to
317 * set/update the traceset of the viewer.
561f5852 318 * @param hook hook function of the viewer.
319 * @param hook_data hook data associated with the hook function.
320 * @param main_win the main window the viewer belongs to.
321 */
322
224446ce 323void lttvwindow_unregister_traceset_notify(MainWindow * main_win,
324 LttvHook hook, gpointer hook_data)
561f5852 325{
326 LttvAttributeValue value;
327 LttvHooks * tmp;
a8c0f09d 328 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 329 "hooks/updatetraceset", LTTV_POINTER, &value));
561f5852 330 tmp = (LttvHooks*)*(value.v_pointer);
331 if(tmp == NULL) return;
332 lttv_hooks_remove_data(tmp, hook, hook_data);
333}
334
561f5852 335/**
336 * Function to register a hook function for a viewer to set/update its
337 * filter.
561f5852 338 * @param hook hook function of the viewer.
339 * @param hook_data hook data associated with the hook function.
340 * @param main_win the main window the viewer belongs to.
341 */
342
224446ce 343void lttvwindow_register_filter_notify(MainWindow *main_win,
344 LttvHook hook, gpointer hook_data)
561f5852 345{
346 LttvAttributeValue value;
347 LttvHooks * tmp;
bca3b81f 348 g_assert(lttv_iattribute_find_by_path(main_win->attributes,
d2811a98 349 "hooks/updatefilter", LTTV_POINTER, &value));
561f5852 350 tmp = (LttvHooks*)*(value.v_pointer);
351 if(tmp == NULL){
352 tmp = lttv_hooks_new();
353 *(value.v_pointer) = tmp;
354 }
355 lttv_hooks_add(tmp, hook, hook_data);
356}
357
358
359/**
360 * Function to unregister a viewer's hook function which is used to
361 * set/update the filter of the viewer.
561f5852 362 * @param hook hook function of the viewer.
363 * @param hook_data hook data associated with the hook function.
364 * @param main_win the main window the viewer belongs to.
365 */
366
5a5b35c5 367void lttvwindow_unregister_filter_notify(MainWindow * main_win,
368 LttvHook hook,
369 gpointer hook_data)
561f5852 370{
371 LttvAttributeValue value;
372 LttvHooks * tmp;
bca3b81f 373 g_assert(lttv_iattribute_find_by_path(main_win->attributes,
d2811a98 374 "hooks/updatefilter", LTTV_POINTER, &value));
561f5852 375 tmp = (LttvHooks*)*(value.v_pointer);
376 if(tmp == NULL) return;
377 lttv_hooks_remove_data(tmp, hook, hook_data);
378}
379
561f5852 380/**
381 * Function to register a hook function for a viewer to set/update its
382 * current time.
561f5852 383 * @param hook hook function of the viewer.
384 * @param hook_data hook data associated with the hook function.
385 * @param main_win the main window the viewer belongs to.
386 */
387
224446ce 388void lttvwindow_register_current_time_notify(MainWindow *main_win,
389 LttvHook hook, gpointer hook_data)
561f5852 390{
391 LttvAttributeValue value;
392 LttvHooks * tmp;
bca3b81f 393 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 394 "hooks/updatecurrenttime", LTTV_POINTER, &value));
561f5852 395 tmp = (LttvHooks*)*(value.v_pointer);
396 if(tmp == NULL){
397 tmp = lttv_hooks_new();
398 *(value.v_pointer) = tmp;
399 }
400 lttv_hooks_add(tmp, hook, hook_data);
401}
402
403
404/**
405 * Function to unregister a viewer's hook function which is used to
406 * set/update the current time of the viewer.
561f5852 407 * @param hook hook function of the viewer.
408 * @param hook_data hook data associated with the hook function.
409 * @param main_win the main window the viewer belongs to.
410 */
411
224446ce 412void lttvwindow_unregister_current_time_notify(MainWindow * main_win,
413 LttvHook hook, gpointer hook_data)
561f5852 414{
415 LttvAttributeValue value;
416 LttvHooks * tmp;
bca3b81f 417 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 418 "hooks/updatecurrenttime", LTTV_POINTER, &value));
561f5852 419 tmp = (LttvHooks*)*(value.v_pointer);
420 if(tmp == NULL) return;
421 lttv_hooks_remove_data(tmp, hook, hook_data);
422}
423
424
202f6c8f 425/**
426 * Function to register a hook function for a viewer to show
224446ce 427 * the content of the viewer.
202f6c8f 428 * @param hook hook function of the viewer.
429 * @param hook_data hook data associated with the hook function.
430 * @param main_win the main window the viewer belongs to.
431 */
432
a43d67ba 433void lttvwindow_register_show_notify(MainWindow *main_win,
224446ce 434 LttvHook hook, gpointer hook_data)
202f6c8f 435{
436 LttvAttributeValue value;
437 LttvHooks * tmp;
438 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 439 "hooks/showviewer", LTTV_POINTER, &value));
202f6c8f 440 tmp = (LttvHooks*)*(value.v_pointer);
441 if(tmp == NULL){
442 tmp = lttv_hooks_new();
443 *(value.v_pointer) = tmp;
444 }
445 lttv_hooks_add(tmp, hook, hook_data);
446}
447
448
449/**
450 * Function to unregister a viewer's hook function which is used to
451 * show the content of the viewer..
202f6c8f 452 * @param hook hook function of the viewer.
453 * @param hook_data hook data associated with the hook function.
454 * @param main_win the main window the viewer belongs to.
455 */
456
a43d67ba 457void lttvwindow_unregister_show_notify(MainWindow * main_win,
224446ce 458 LttvHook hook, gpointer hook_data)
202f6c8f 459{
460 LttvAttributeValue value;
461 LttvHooks * tmp;
462 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 463 "hooks/showviewer", LTTV_POINTER, &value));
202f6c8f 464 tmp = (LttvHooks*)*(value.v_pointer);
465 if(tmp == NULL) return;
466 lttv_hooks_remove_data(tmp, hook, hook_data);
467}
468
561f5852 469/**
470 * Function to register a hook function for a viewer to set/update the
471 * dividor of the hpane.
561f5852 472 * @param hook hook function of the viewer.
473 * @param hook_data hook data associated with the hook function.
474 * @param main_win the main window the viewer belongs to.
475 */
476
224446ce 477void lttvwindow_register_dividor(MainWindow *main_win,
478 LttvHook hook, gpointer hook_data)
561f5852 479{
480 LttvAttributeValue value;
481 LttvHooks * tmp;
bca3b81f 482 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 483 "hooks/hpanedividor", LTTV_POINTER, &value));
561f5852 484 tmp = (LttvHooks*)*(value.v_pointer);
485 if(tmp == NULL){
486 tmp = lttv_hooks_new();
487 *(value.v_pointer) = tmp;
488 }
489 lttv_hooks_add(tmp, hook, hook_data);
490}
491
492
493/**
494 * Function to unregister a viewer's hook function which is used to
495 * set/update hpane's dividor of the viewer.
496 * It will be called by the destructor of the viewer.
497 * @param hook hook function of the viewer.
498 * @param hook_data hook data associated with the hook function.
499 * @param main_win the main window the viewer belongs to.
500 */
501
224446ce 502void lttvwindow_unregister_dividor(MainWindow *main_win,
503 LttvHook hook, gpointer hook_data)
561f5852 504{
505 LttvAttributeValue value;
506 LttvHooks * tmp;
bca3b81f 507 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 508 "hooks/hpanedividor", LTTV_POINTER, &value));
561f5852 509 tmp = (LttvHooks*)*(value.v_pointer);
510 if(tmp == NULL) return;
511 lttv_hooks_remove_data(tmp, hook, hook_data);
512}
513
514
224446ce 515/**
516 * Update the status bar whenever something changed in the viewer.
517 * @param main_win the main window the viewer belongs to.
518 * @param info the message which will be shown in the status bar.
519 */
520
5a5b35c5 521void lttvwindow_report_status(MainWindow *main_win, const char *info)
224446ce 522{
523 //FIXME
524 g_warning("update_status not implemented in viewer.c");
525}
526
527/**
528 * Function to set the time interval of the current tab.
529 * It will be called by a viewer's signal handle associated with
530 * the move_slider signal
531 * @param main_win the main window the viewer belongs to.
532 * @param time_interval a pointer where time interval is stored.
533 */
534
535void lttvwindow_report_time_window(MainWindow *main_win,
5a5b35c5 536 const TimeWindow *time_window)
224446ce 537{
a43d67ba 538 set_time_window(main_win, time_window);
539 set_time_window_adjustment(main_win, time_window);
224446ce 540}
541
a43d67ba 542
224446ce 543/**
544 * Function to set the current time/event of the current tab.
545 * It will be called by a viewer's signal handle associated with
546 * the button-release-event signal
547 * @param main_win the main window the viewer belongs to.
548 * @param time a pointer where time is stored.
549 */
550
5a5b35c5 551void lttvwindow_report_current_time(MainWindow *main_win,
552 const LttTime *time)
224446ce 553{
554 LttvAttributeValue value;
555 LttvHooks * tmp;
556 main_win->current_tab->current_time = *time;
557 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
558 "hooks/updatecurrenttime", LTTV_POINTER, &value));
559 tmp = (LttvHooks*)*(value.v_pointer);
560
561 if(tmp == NULL)return;
5a5b35c5 562 lttv_hooks_call(tmp, &main_win->current_tab->current_time);
224446ce 563}
564
561f5852 565/**
566 * Function to set the position of the hpane's dividor (viewer).
567 * It will be called by a viewer's signal handle associated with
568 * the motion_notify_event event/signal
569 * @param main_win the main window the viewer belongs to.
570 * @param position position of the hpane's dividor.
571 */
572
224446ce 573void lttvwindow_report_dividor(MainWindow *main_win, gint position)
561f5852 574{
575 LttvAttributeValue value;
576 LttvHooks * tmp;
bca3b81f 577 g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
d2811a98 578 "hooks/hpanedividor", LTTV_POINTER, &value));
561f5852 579 tmp = (LttvHooks*)*(value.v_pointer);
580 if(tmp == NULL) return;
581 lttv_hooks_call(tmp, &position);
582}
583
224446ce 584/**
585 * Function to set the focused pane (viewer).
586 * It will be called by a viewer's signal handle associated with
587 * the grab_focus signal
588 * @param main_win the main window the viewer belongs to.
5a5b35c5 589 * @param top_widget the top widget containing all the other widgets of the
590 * viewer.
224446ce 591 */
592
5a5b35c5 593void lttvwindow_report_focus(MainWindow *main_win, GtkWidget *top_widget)
224446ce 594{
5a5b35c5 595 gtk_multi_vpaned_set_focus((GtkWidget*)main_win->current_tab->multi_vpaned,
596 gtk_widget_get_parent(top_widget));
224446ce 597}
598
599
a43d67ba 600/**
601 * Function to request data in a specific time interval to the main window.
602 * The main window will use this time interval and the others present
603 * to get the data from the process trace.
604 * @param main_win the main window the viewer belongs to.
605 * @param paned a pointer to a pane where the viewer is contained.
606 */
607
608void lttvwindow_time_interval_request(MainWindow *main_win,
609 TimeWindow time_requested, guint num_events,
610 LttvHook after_process_traceset,
611 gpointer after_process_traceset_data)
612{
613 TimeRequest time_request;
614
615 time_request.time_window = time_requested;
616 time_request.num_events = num_events;
617 time_request.after_hook = after_process_traceset;
618 time_request.after_hook_data = after_process_traceset_data;
619
620 g_array_append_val(main_win->current_tab->time_requests, time_request);
621
622 if(!main_win->current_tab->time_request_pending)
623 {
624 /* Redraw has +20 priority. We want a prio higher than that, so +19 */
625 g_idle_add_full((G_PRIORITY_HIGH_IDLE + 19),
626 (GSourceFunc)execute_time_requests,
627 main_win,
628 NULL);
629 main_win->current_tab->time_request_pending = TRUE;
630 }
631}
632
224446ce 633/**
634 * Function to get the current time interval shown on the current tab.
635 * It will be called by a viewer's hook function to update the
636 * shown time interval of the viewer and also be called by the constructor
637 * of the viewer.
638 * @param main_win the main window the viewer belongs to.
639 * @param time_interval a pointer where time interval will be stored.
640 */
641
642const TimeWindow *lttvwindow_get_time_window(MainWindow *main_win)
643{
644 //time_window->start_time = main_win->current_tab->time_window.start_time;
645 //time_window->time_width = main_win->current_tab->time_window.time_width;
646 return &(main_win->current_tab->time_window);
647
648}
649
650
651/**
652 * Function to get the current time/event of the current tab.
653 * It will be called by a viewer's hook function to update the
654 * current time/event of the viewer.
655 * @param main_win the main window the viewer belongs to.
656 * @param time a pointer where time will be stored.
657 */
658
659const LttTime *lttvwindow_get_current_time(MainWindow *main_win)
660{
661 return &(main_win->current_tab->current_time);
662}
663
664
224446ce 665/**
666 * Function to get the filter of the current tab.
667 * It will be called by the constructor of the viewer and also be
668 * called by a hook funtion of the viewer to update its filter.
669 * @param main_win, the main window the viewer belongs to.
670 * @param filter, a pointer to a filter.
671 */
672const lttv_filter *lttvwindow_get_filter(MainWindow *main_win)
673{
674 //FIXME
675 g_warning("lttvwindow_get_filter not implemented in viewer.c");
676}
677
678
6b1d3120 679/**
680 * Function to get the stats of the traceset
681 * @param main_win the main window the viewer belongs to.
682 */
683
224446ce 684LttvTracesetStats* lttvwindow_get_traceset_stats(MainWindow *main_win)
6b1d3120 685{
716e4367 686 return main_win->current_tab->traceset_info->traceset_context;
6b1d3120 687}
a8c0f09d 688
689
224446ce 690LttvTracesetContext* lttvwindow_get_traceset_context(MainWindow *main_win)
a8c0f09d 691{
692 return (LttvTracesetContext*)main_win->current_tab->traceset_info->traceset_context;
693}
This page took 0.061475 seconds and 4 git commands to generate.