561f5852 |
1 | /*! \file gtkTraceSet.h |
2 | * \brief API used by the graphical viewers to interact with their top window. |
3 | * |
4 | * Main window (gui module) is the place to contain and display viewers. |
5 | * Viewers (lttv plugins) interacte with main window through this API and |
6 | * events sent by gtk. |
7 | * This header file should be included in each graphic module. |
8 | * This library is used by graphical modules to interact with the |
9 | * tracesetWindow. |
10 | * |
11 | */ |
12 | |
d0cf1bcd |
13 | #include <lttv/common.h> |
561f5852 |
14 | #include <ltt/ltt.h> |
15 | #include <lttv/lttv.h> |
16 | #include <lttv/mainWindow.h> |
17 | #include <lttv/gtkTraceSet.h> |
18 | #include <lttv/processTrace.h> |
c4c15b5e |
19 | #include <lttv/toolbar.h> |
20 | #include <lttv/menu.h> |
6b1d3120 |
21 | #include <lttv/state.h> |
22 | #include <lttv/stats.h> |
23 | |
561f5852 |
24 | |
25 | /** |
26 | * Internal function parts |
27 | */ |
28 | |
561f5852 |
29 | /** |
30 | * Function to set/update traceset for the viewers |
31 | * @param main_win main window |
32 | * @param traceset traceset of the main window. |
33 | */ |
34 | |
bca3b81f |
35 | void SetTraceset(MainWindow * main_win, gpointer traceset) |
561f5852 |
36 | { |
37 | LttvHooks * tmp; |
38 | LttvAttributeValue value; |
39 | |
bca3b81f |
40 | g_assert(lttv_iattribute_find_by_path(main_win->attributes, |
561f5852 |
41 | "hooks/updatetraceset", LTTV_POINTER, &value)); |
42 | tmp = (LttvHooks*)*(value.v_pointer); |
43 | if(tmp == NULL)return; |
44 | lttv_hooks_call(tmp,traceset); |
45 | } |
46 | |
47 | |
48 | /** |
49 | * Function to set/update filter for the viewers |
50 | * @param main_win main window |
51 | * @param filter filter of the main window. |
52 | */ |
53 | |
bca3b81f |
54 | void SetFilter(MainWindow * main_win, gpointer filter) |
561f5852 |
55 | { |
56 | LttvHooks * tmp; |
57 | LttvAttributeValue value; |
58 | |
bca3b81f |
59 | g_assert(lttv_iattribute_find_by_path(main_win->attributes, |
561f5852 |
60 | "hooks/updatefilter", LTTV_POINTER, &value)); |
61 | tmp = (LttvHooks*)*(value.v_pointer); |
62 | |
63 | if(tmp == NULL)return; |
64 | lttv_hooks_call(tmp,filter); |
65 | } |
66 | |
67 | |
68 | |
69 | /** |
70 | * API parts |
71 | */ |
72 | |
73 | /** |
74 | * Function to register a view constructor so that main window can generate |
75 | * a toolbar item for the viewer in order to generate a new instance easily. |
76 | * It will be called by init function of the module. |
77 | * @param ButtonPixmap image shown on the toolbar item. |
78 | * @param tooltip tooltip of the toolbar item. |
79 | * @param view_constructor constructor of the viewer. |
80 | */ |
81 | |
41a76985 |
82 | void toolbar_item_reg(char ** pixmap, char *tooltip, lttv_constructor view_constructor) |
561f5852 |
83 | { |
84 | LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); |
85 | LttvToolbars * toolbar; |
86 | LttvAttributeValue value; |
87 | |
88 | g_assert(lttv_iattribute_find_by_path(attributes_global, |
89 | "viewers/toolbar", LTTV_POINTER, &value)); |
90 | toolbar = (LttvToolbars*)*(value.v_pointer); |
91 | |
92 | if(toolbar == NULL){ |
93 | toolbar = lttv_toolbars_new(); |
94 | *(value.v_pointer) = toolbar; |
95 | } |
96 | lttv_toolbars_add(toolbar, view_constructor, tooltip, pixmap); |
97 | } |
98 | |
99 | |
100 | /** |
101 | * Function to unregister the viewer's constructor, release the space |
102 | * occupied by pixmap, tooltip and constructor of the viewer. |
103 | * It will be called when a module is unloaded. |
104 | * @param view_constructor constructor of the viewer which is used as |
105 | * a reference to find out where the pixmap and tooltip are. |
106 | */ |
107 | |
41a76985 |
108 | void toolbar_item_unreg(lttv_constructor view_constructor) |
561f5852 |
109 | { |
110 | LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); |
111 | LttvToolbars * toolbar; |
112 | LttvAttributeValue value; |
113 | |
114 | g_assert(lttv_iattribute_find_by_path(attributes_global, |
115 | "viewers/toolbar", LTTV_POINTER, &value)); |
116 | toolbar = (LttvToolbars*)*(value.v_pointer); |
117 | |
2061e03d |
118 | main_window_remove_toolbar_item(view_constructor); |
119 | |
120 | lttv_toolbars_remove(toolbar, view_constructor); |
561f5852 |
121 | } |
122 | |
123 | |
124 | /** |
125 | * Function to register a view constructor so that main window can generate |
126 | * a menu item for the viewer in order to generate a new instance easily. |
127 | * It will be called by init function of the module. |
128 | * @param menu_path path of the menu item. |
129 | * @param menu_text text of the menu item. |
130 | * @param view_constructor constructor of the viewer. |
131 | */ |
132 | |
41a76985 |
133 | void menu_item_reg(char *menu_path, char *menu_text, lttv_constructor view_constructor) |
561f5852 |
134 | { |
135 | LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); |
136 | LttvMenus * menu; |
137 | LttvAttributeValue value; |
138 | |
139 | g_assert(lttv_iattribute_find_by_path(attributes_global, |
140 | "viewers/menu", LTTV_POINTER, &value)); |
141 | menu = (LttvMenus*)*(value.v_pointer); |
142 | |
143 | if(menu == NULL){ |
144 | menu = lttv_menus_new(); |
145 | *(value.v_pointer) = menu; |
146 | } |
147 | lttv_menus_add(menu, view_constructor, menu_path, menu_text); |
148 | } |
149 | |
150 | /** |
151 | * Function to unregister the viewer's constructor, release the space |
152 | * occupied by menu_path, menu_text and constructor of the viewer. |
153 | * It will be called when a module is unloaded. |
154 | * @param view_constructor constructor of the viewer which is used as |
155 | * a reference to find out where the menu_path and menu_text are. |
156 | */ |
157 | |
41a76985 |
158 | void menu_item_unreg(lttv_constructor view_constructor) |
561f5852 |
159 | { |
160 | LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); |
161 | LttvMenus * menu; |
162 | LttvAttributeValue value; |
163 | |
164 | g_assert(lttv_iattribute_find_by_path(attributes_global, |
c4c15b5e |
165 | "viewers/menu", LTTV_POINTER, &value)); |
561f5852 |
166 | menu = (LttvMenus*)*(value.v_pointer); |
167 | |
2061e03d |
168 | main_window_remove_menu_item(view_constructor); |
169 | |
170 | lttv_menus_remove(menu, view_constructor); |
561f5852 |
171 | } |
172 | |
173 | |
174 | /** |
175 | * Update the status bar whenever something changed in the viewer. |
176 | * @param main_win the main window the viewer belongs to. |
177 | * @param info the message which will be shown in the status bar. |
178 | */ |
179 | |
41a76985 |
180 | void update_status(MainWindow *main_win, char *info) |
561f5852 |
181 | { |
182 | } |
183 | |
184 | |
185 | /** |
f7afe191 |
186 | * Function to get the current time interval shown on the current tab. |
187 | * It will be called by a viewer's hook function to update the |
188 | * shown time interval of the viewer and also be called by the constructor |
189 | * of the viewer. |
190 | * @param main_win the main window the viewer belongs to. |
191 | * @param time_interval a pointer where time interval will be stored. |
192 | */ |
193 | |
41a76985 |
194 | void get_time_window(MainWindow *main_win, TimeWindow *time_window) |
f7afe191 |
195 | { |
bca3b81f |
196 | //time_window->start_time = main_win->current_tab->time_window.start_time; |
197 | //time_window->time_width = main_win->current_tab->time_window.time_width; |
198 | *time_window = main_win->current_tab->time_window; |
f7afe191 |
199 | } |
200 | |
201 | /** |
202 | * Function to get the current time interval of the current traceset. |
561f5852 |
203 | * It will be called by a viewer's hook function to update the |
204 | * time interval of the viewer and also be called by the constructor |
205 | * of the viewer. |
206 | * @param main_win the main window the viewer belongs to. |
207 | * @param time_interval a pointer where time interval will be stored. |
208 | */ |
209 | |
41a76985 |
210 | void get_traceset_time_span(MainWindow *main_win, TimeInterval *time_interval) |
561f5852 |
211 | { |
bca3b81f |
212 | //time_window->start_time = main_win->current_tab->time_window.start_time; |
213 | //time_window->time_width = main_win->current_tab->time_window.time_width; |
716e4367 |
214 | *time_interval = *(LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info-> |
215 | traceset_context)->Time_Span); |
561f5852 |
216 | } |
217 | |
218 | |
f7afe191 |
219 | |
561f5852 |
220 | /** |
221 | * Function to set the time interval of the current tab. |
222 | * It will be called by a viewer's signal handle associated with |
223 | * the move_slider signal |
224 | * @param main_win the main window the viewer belongs to. |
225 | * @param time_interval a pointer where time interval is stored. |
226 | */ |
227 | |
41a76985 |
228 | void set_time_window(MainWindow *main_win, TimeWindow *time_window) |
561f5852 |
229 | { |
230 | LttvAttributeValue value; |
231 | LttvHooks * tmp; |
bca3b81f |
232 | main_win->current_tab->time_window = *time_window; |
233 | g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, |
f7afe191 |
234 | "hooks/updatetimewindow", LTTV_POINTER, &value)); |
561f5852 |
235 | tmp = (LttvHooks*)*(value.v_pointer); |
f7afe191 |
236 | if(tmp == NULL) return; |
a2eab0c9 |
237 | lttv_hooks_call(tmp, time_window); |
561f5852 |
238 | } |
239 | |
240 | |
241 | /** |
242 | * Function to get the current time/event of the current tab. |
243 | * It will be called by a viewer's hook function to update the |
244 | * current time/event of the viewer. |
245 | * @param main_win the main window the viewer belongs to. |
246 | * @param time a pointer where time will be stored. |
247 | */ |
248 | |
41a76985 |
249 | void get_current_time(MainWindow *main_win, LttTime *time) |
561f5852 |
250 | { |
bca3b81f |
251 | time = &main_win->current_tab->current_time; |
561f5852 |
252 | } |
253 | |
254 | |
255 | /** |
256 | * Function to set the current time/event of the current tab. |
257 | * It will be called by a viewer's signal handle associated with |
258 | * the button-release-event signal |
259 | * @param main_win the main window the viewer belongs to. |
260 | * @param time a pointer where time is stored. |
261 | */ |
262 | |
41a76985 |
263 | void set_current_time(MainWindow *main_win, LttTime *time) |
561f5852 |
264 | { |
265 | LttvAttributeValue value; |
266 | LttvHooks * tmp; |
bca3b81f |
267 | main_win->current_tab->current_time = *time; |
268 | g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, |
561f5852 |
269 | "hooks/updatecurrenttime", LTTV_POINTER, &value)); |
270 | tmp = (LttvHooks*)*(value.v_pointer); |
271 | |
272 | if(tmp == NULL)return; |
273 | lttv_hooks_call(tmp, time); |
274 | } |
275 | |
276 | |
277 | /** |
278 | * Function to get the traceset from the current tab. |
279 | * It will be called by the constructor of the viewer and also be |
280 | * called by a hook funtion of the viewer to update its traceset. |
281 | * @param main_win the main window the viewer belongs to. |
282 | * @param traceset a pointer to a traceset. |
283 | */ |
284 | /* |
41a76985 |
285 | void get_traceset(MainWindow *main_win, Traceset *traceset) |
561f5852 |
286 | { |
287 | } |
288 | */ |
289 | |
290 | /** |
291 | * Function to get the filter of the current tab. |
292 | * It will be called by the constructor of the viewer and also be |
293 | * called by a hook funtion of the viewer to update its filter. |
294 | * @param main_win, the main window the viewer belongs to. |
295 | * @param filter, a pointer to a filter. |
296 | */ |
297 | /* |
41a76985 |
298 | void get_filter(MainWindow *main_win, Filter *filter) |
561f5852 |
299 | { |
300 | } |
301 | */ |
302 | |
303 | /** |
304 | * Function to register a hook function for a viewer to set/update its |
305 | * time interval. |
306 | * It will be called by the constructor of the viewer. |
307 | * @param hook hook function of the viewer. |
308 | * @param hook_data hook data associated with the hook function. |
309 | * @param main_win the main window the viewer belongs to. |
310 | */ |
311 | |
41a76985 |
312 | void reg_update_time_window(LttvHook hook, gpointer hook_data, |
bca3b81f |
313 | MainWindow * main_win) |
561f5852 |
314 | { |
315 | LttvAttributeValue value; |
316 | LttvHooks * tmp; |
bca3b81f |
317 | g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, |
f7afe191 |
318 | "hooks/updatetimewindow", LTTV_POINTER, &value)); |
561f5852 |
319 | tmp = (LttvHooks*)*(value.v_pointer); |
320 | if(tmp == NULL){ |
321 | tmp = lttv_hooks_new(); |
322 | *(value.v_pointer) = tmp; |
323 | } |
324 | lttv_hooks_add(tmp, hook,hook_data); |
325 | } |
326 | |
327 | |
328 | /** |
329 | * Function to unregister a viewer's hook function which is used to |
330 | * set/update the time interval of the viewer. |
331 | * It will be called by the destructor of the viewer. |
332 | * @param hook hook function of the viewer. |
333 | * @param hook_data hook data associated with the hook function. |
334 | * @param main_win the main window the viewer belongs to. |
335 | */ |
336 | |
41a76985 |
337 | void unreg_update_time_window(LttvHook hook, gpointer hook_data, |
bca3b81f |
338 | MainWindow * main_win) |
561f5852 |
339 | { |
340 | LttvAttributeValue value; |
341 | LttvHooks * tmp; |
bca3b81f |
342 | g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, |
f7afe191 |
343 | "hooks/updatetimewindow", LTTV_POINTER, &value)); |
561f5852 |
344 | tmp = (LttvHooks*)*(value.v_pointer); |
345 | if(tmp == NULL) return; |
346 | lttv_hooks_remove_data(tmp, hook, hook_data); |
347 | } |
348 | |
349 | |
350 | /** |
351 | * Function to register a hook function for a viewer to set/update its |
352 | * traceset. |
353 | * It will be called by the constructor of the viewer. |
354 | * @param hook hook function of the viewer. |
355 | * @param hook_data hook data associated with the hook function. |
356 | * @param main_win the main window the viewer belongs to. |
357 | */ |
358 | |
41a76985 |
359 | void reg_update_traceset(LttvHook hook, gpointer hook_data, |
bca3b81f |
360 | MainWindow * main_win) |
561f5852 |
361 | { |
362 | LttvAttributeValue value; |
363 | LttvHooks * tmp; |
bca3b81f |
364 | g_assert(lttv_iattribute_find_by_path(main_win->attributes, |
561f5852 |
365 | "hooks/updatetraceset", LTTV_POINTER, &value)); |
366 | tmp = (LttvHooks*)*(value.v_pointer); |
367 | if(tmp == NULL){ |
368 | tmp = lttv_hooks_new(); |
369 | *(value.v_pointer) = tmp; |
370 | } |
371 | lttv_hooks_add(tmp, hook, hook_data); |
372 | } |
373 | |
374 | |
375 | /** |
376 | * Function to unregister a viewer's hook function which is used to |
377 | * set/update the traceset of the viewer. |
378 | * It will be called by the destructor of the viewer. |
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. |
382 | */ |
383 | |
41a76985 |
384 | void unreg_update_traceset(LttvHook hook, gpointer hook_data, |
bca3b81f |
385 | MainWindow * main_win) |
561f5852 |
386 | { |
387 | LttvAttributeValue value; |
388 | LttvHooks * tmp; |
bca3b81f |
389 | g_assert(lttv_iattribute_find_by_path(main_win->attributes, |
561f5852 |
390 | "hooks/updatetraceset", LTTV_POINTER, &value)); |
391 | tmp = (LttvHooks*)*(value.v_pointer); |
392 | if(tmp == NULL) return; |
393 | lttv_hooks_remove_data(tmp, hook, hook_data); |
394 | } |
395 | |
396 | |
397 | /** |
398 | * Function to register a hook function for a viewer to set/update its |
399 | * filter. |
400 | * It will be called by the constructor of the viewer. |
401 | * @param hook hook function of the viewer. |
402 | * @param hook_data hook data associated with the hook function. |
403 | * @param main_win the main window the viewer belongs to. |
404 | */ |
405 | |
41a76985 |
406 | void reg_update_filter(LttvHook hook, gpointer hook_data, |
bca3b81f |
407 | MainWindow *main_win) |
561f5852 |
408 | { |
409 | LttvAttributeValue value; |
410 | LttvHooks * tmp; |
bca3b81f |
411 | g_assert(lttv_iattribute_find_by_path(main_win->attributes, |
561f5852 |
412 | "hooks/updatefilter", LTTV_POINTER, &value)); |
413 | tmp = (LttvHooks*)*(value.v_pointer); |
414 | if(tmp == NULL){ |
415 | tmp = lttv_hooks_new(); |
416 | *(value.v_pointer) = tmp; |
417 | } |
418 | lttv_hooks_add(tmp, hook, hook_data); |
419 | } |
420 | |
421 | |
422 | /** |
423 | * Function to unregister a viewer's hook function which is used to |
424 | * set/update the filter of the viewer. |
425 | * It will be called by the destructor of the viewer. |
426 | * @param hook hook function of the viewer. |
427 | * @param hook_data hook data associated with the hook function. |
428 | * @param main_win the main window the viewer belongs to. |
429 | */ |
430 | |
41a76985 |
431 | void unreg_update_filter(LttvHook hook, gpointer hook_data, |
bca3b81f |
432 | MainWindow * main_win) |
561f5852 |
433 | { |
434 | LttvAttributeValue value; |
435 | LttvHooks * tmp; |
bca3b81f |
436 | g_assert(lttv_iattribute_find_by_path(main_win->attributes, |
561f5852 |
437 | "hooks/updatefilter", LTTV_POINTER, &value)); |
438 | tmp = (LttvHooks*)*(value.v_pointer); |
439 | if(tmp == NULL) return; |
440 | lttv_hooks_remove_data(tmp, hook, hook_data); |
441 | } |
442 | |
443 | |
444 | /** |
445 | * Function to register a hook function for a viewer to set/update its |
446 | * current time. |
447 | * It will be called by the constructor of the viewer. |
448 | * @param hook hook function of the viewer. |
449 | * @param hook_data hook data associated with the hook function. |
450 | * @param main_win the main window the viewer belongs to. |
451 | */ |
452 | |
41a76985 |
453 | void reg_update_current_time(LttvHook hook, gpointer hook_data, |
bca3b81f |
454 | MainWindow *main_win) |
561f5852 |
455 | { |
456 | LttvAttributeValue value; |
457 | LttvHooks * tmp; |
bca3b81f |
458 | g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, |
561f5852 |
459 | "hooks/updatecurrenttime", LTTV_POINTER, &value)); |
460 | tmp = (LttvHooks*)*(value.v_pointer); |
461 | if(tmp == NULL){ |
462 | tmp = lttv_hooks_new(); |
463 | *(value.v_pointer) = tmp; |
464 | } |
465 | lttv_hooks_add(tmp, hook, hook_data); |
466 | } |
467 | |
468 | |
469 | /** |
470 | * Function to unregister a viewer's hook function which is used to |
471 | * set/update the current time of the viewer. |
472 | * It will be called by the destructor of the viewer. |
473 | * @param hook hook function of the viewer. |
474 | * @param hook_data hook data associated with the hook function. |
475 | * @param main_win the main window the viewer belongs to. |
476 | */ |
477 | |
41a76985 |
478 | void unreg_update_current_time(LttvHook hook, gpointer hook_data, |
bca3b81f |
479 | MainWindow * main_win) |
561f5852 |
480 | { |
481 | LttvAttributeValue value; |
482 | LttvHooks * tmp; |
bca3b81f |
483 | g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, |
561f5852 |
484 | "hooks/updatecurrenttime", LTTV_POINTER, &value)); |
485 | tmp = (LttvHooks*)*(value.v_pointer); |
486 | if(tmp == NULL) return; |
487 | lttv_hooks_remove_data(tmp, hook, hook_data); |
488 | } |
489 | |
490 | |
491 | /** |
492 | * Function to set the focused pane (viewer). |
493 | * It will be called by a viewer's signal handle associated with |
494 | * the grab_focus signal |
495 | * @param main_win the main window the viewer belongs to. |
496 | * @param paned a pointer to a pane where the viewer is contained. |
497 | */ |
498 | |
41a76985 |
499 | void set_focused_pane(MainWindow *main_win, gpointer paned) |
561f5852 |
500 | { |
daecc161 |
501 | gtk_multi_vpaned_set_focus((GtkWidget*)main_win->current_tab->multi_vpaned,paned); |
561f5852 |
502 | } |
503 | |
504 | |
505 | /** |
506 | * Function to register a hook function for a viewer to set/update the |
507 | * dividor of the hpane. |
508 | * It will be called by the constructor of the viewer. |
509 | * @param hook hook function of the viewer. |
510 | * @param hook_data hook data associated with the hook function. |
511 | * @param main_win the main window the viewer belongs to. |
512 | */ |
513 | |
41a76985 |
514 | void reg_update_dividor(LttvHook hook, gpointer hook_data, |
bca3b81f |
515 | MainWindow *main_win) |
561f5852 |
516 | { |
517 | LttvAttributeValue value; |
518 | LttvHooks * tmp; |
bca3b81f |
519 | g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, |
561f5852 |
520 | "hooks/hpanedividor", LTTV_POINTER, &value)); |
521 | tmp = (LttvHooks*)*(value.v_pointer); |
522 | if(tmp == NULL){ |
523 | tmp = lttv_hooks_new(); |
524 | *(value.v_pointer) = tmp; |
525 | } |
526 | lttv_hooks_add(tmp, hook, hook_data); |
527 | } |
528 | |
529 | |
530 | /** |
531 | * Function to unregister a viewer's hook function which is used to |
532 | * set/update hpane's dividor of the viewer. |
533 | * It will be called by the destructor of the viewer. |
534 | * @param hook hook function of the viewer. |
535 | * @param hook_data hook data associated with the hook function. |
536 | * @param main_win the main window the viewer belongs to. |
537 | */ |
538 | |
41a76985 |
539 | void unreg_update_dividor(LttvHook hook, gpointer hook_data, |
bca3b81f |
540 | MainWindow *main_win) |
561f5852 |
541 | { |
542 | LttvAttributeValue value; |
543 | LttvHooks * tmp; |
bca3b81f |
544 | g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, |
561f5852 |
545 | "hooks/hpanedividor", LTTV_POINTER, &value)); |
546 | tmp = (LttvHooks*)*(value.v_pointer); |
547 | if(tmp == NULL) return; |
548 | lttv_hooks_remove_data(tmp, hook, hook_data); |
549 | } |
550 | |
551 | |
552 | /** |
553 | * Function to set the position of the hpane's dividor (viewer). |
554 | * It will be called by a viewer's signal handle associated with |
555 | * the motion_notify_event event/signal |
556 | * @param main_win the main window the viewer belongs to. |
557 | * @param position position of the hpane's dividor. |
558 | */ |
559 | |
41a76985 |
560 | void set_hpane_dividor(MainWindow *main_win, gint position) |
561f5852 |
561 | { |
562 | LttvAttributeValue value; |
563 | LttvHooks * tmp; |
bca3b81f |
564 | g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, |
561f5852 |
565 | "hooks/hpanedividor", LTTV_POINTER, &value)); |
566 | tmp = (LttvHooks*)*(value.v_pointer); |
567 | if(tmp == NULL) return; |
568 | lttv_hooks_call(tmp, &position); |
569 | } |
570 | |
571 | |
572 | /** |
573 | * Function to process traceset. It will call lttv_process_trace, |
574 | * each view will call this api to get events. |
575 | * @param main_win the main window the viewer belongs to. |
576 | * @param start the start time of the first event to be processed. |
577 | * @param end the end time of the last event to be processed. |
578 | */ |
579 | |
41a76985 |
580 | void process_traceset_api(MainWindow *main_win, LttTime start, |
581 | LttTime end, unsigned maxNumEvents) |
561f5852 |
582 | { |
716e4367 |
583 | lttv_process_traceset_seek_time(main_win->current_tab->traceset_info-> |
584 | traceset_context, start); |
585 | lttv_process_traceset(main_win->current_tab->traceset_info-> |
586 | traceset_context, end, maxNumEvents); |
561f5852 |
587 | } |
588 | |
589 | /** |
590 | * Function to add hooks into the context of a traceset, |
591 | * before reading events from traceset, viewer will call this api to |
592 | * register hooks |
593 | * @param main_win the main window the viewer belongs to. |
594 | * @param LttvHooks hooks to be registered. |
595 | */ |
596 | |
41a76985 |
597 | void context_add_hooks_api(MainWindow *main_win , |
598 | LttvHooks *before_traceset, |
599 | LttvHooks *after_traceset, |
600 | LttvHooks *check_trace, |
601 | LttvHooks *before_trace, |
602 | LttvHooks *after_trace, |
603 | LttvHooks *check_tracefile, |
604 | LttvHooks *before_tracefile, |
605 | LttvHooks *after_tracefile, |
606 | LttvHooks *check_event, |
607 | LttvHooks *before_event, |
608 | LttvHooks *after_event) |
561f5852 |
609 | { |
f7afe191 |
610 | LttvTracesetContext * tsc = |
716e4367 |
611 | LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info-> |
612 | traceset_context); |
561f5852 |
613 | lttv_traceset_context_add_hooks(tsc,before_traceset,after_traceset, |
614 | check_trace,before_trace,after_trace, |
615 | check_tracefile,before_tracefile,after_tracefile, |
616 | check_event,before_event, after_event); |
617 | } |
618 | |
619 | |
620 | /** |
621 | * Function to remove hooks from the context of a traceset, |
622 | * before reading events from traceset, viewer will call this api to |
623 | * unregister hooks |
624 | * @param main_win the main window the viewer belongs to. |
625 | * @param LttvHooks hooks to be registered. |
626 | */ |
627 | |
41a76985 |
628 | void context_remove_hooks_api(MainWindow *main_win , |
629 | LttvHooks *before_traceset, |
630 | LttvHooks *after_traceset, |
631 | LttvHooks *check_trace, |
632 | LttvHooks *before_trace, |
633 | LttvHooks *after_trace, |
634 | LttvHooks *check_tracefile, |
635 | LttvHooks *before_tracefile, |
636 | LttvHooks *after_tracefile, |
637 | LttvHooks *check_event, |
638 | LttvHooks *before_event, |
639 | LttvHooks *after_event) |
561f5852 |
640 | { |
f7afe191 |
641 | LttvTracesetContext * tsc = |
716e4367 |
642 | LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->traceset_context); |
561f5852 |
643 | lttv_traceset_context_remove_hooks(tsc,before_traceset,after_traceset, |
644 | check_trace,before_trace,after_trace, |
645 | check_tracefile,before_tracefile,after_tracefile, |
646 | check_event,before_event, after_event); |
647 | } |
f735c59a |
648 | |
649 | |
6b1d3120 |
650 | /** |
651 | * Function to add/remove event hooks for state |
652 | * @param main_win the main window the viewer belongs to. |
653 | */ |
654 | |
41a76985 |
655 | void state_add_event_hooks_api(MainWindow *main_win ) |
6b1d3120 |
656 | { |
f7afe191 |
657 | lttv_state_add_event_hooks( |
716e4367 |
658 | (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context); |
6b1d3120 |
659 | } |
660 | |
41a76985 |
661 | void state_remove_event_hooks_api(MainWindow *main_win ) |
6b1d3120 |
662 | { |
f7afe191 |
663 | lttv_state_remove_event_hooks( |
716e4367 |
664 | (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context); |
6b1d3120 |
665 | } |
666 | |
667 | |
668 | /** |
669 | * Function to add/remove event hooks for stats |
670 | * @param main_win the main window the viewer belongs to. |
671 | */ |
672 | |
41a76985 |
673 | void stats_add_event_hooks_api(MainWindow *main_win ) |
6b1d3120 |
674 | { |
f7afe191 |
675 | lttv_stats_add_event_hooks( |
716e4367 |
676 | (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context); |
6b1d3120 |
677 | } |
678 | |
41a76985 |
679 | void stats_remove_event_hooks_api(MainWindow *main_win ) |
6b1d3120 |
680 | { |
f7afe191 |
681 | lttv_stats_remove_event_hooks( |
716e4367 |
682 | (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context); |
6b1d3120 |
683 | } |
684 | |
685 | /** |
686 | * Function to get the stats of the traceset |
687 | * @param main_win the main window the viewer belongs to. |
688 | */ |
689 | |
41a76985 |
690 | LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win) |
6b1d3120 |
691 | { |
716e4367 |
692 | return main_win->current_tab->traceset_info->traceset_context; |
6b1d3120 |
693 | } |