fcdf0ec2 |
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. |
c5d77517 |
7 | * This header file should be included in each graphic module. |
fcdf0ec2 |
8 | * This library is used by graphical modules to interact with the |
9 | * tracesetWindow. |
10 | * |
c5d77517 |
11 | */ |
12 | |
13 | #include <gtk/gtk.h> |
14 | #include <ltt/ltt.h> |
15 | #include <lttv/hook.h> |
9af25d1f |
16 | #include <lttv/common.h> |
6b1d3120 |
17 | #include <lttv/stats.h> |
c5d77517 |
18 | |
19 | /** |
20 | * Function to register a view constructor so that main window can generate |
21 | * a toolbar item for the viewer in order to generate a new instance easily. |
22 | * It will be called by init function of the module. |
fcdf0ec2 |
23 | * @param ButtonPixmap image shown on the toolbar item. |
24 | * @param tooltip tooltip of the toolbar item. |
25 | * @param view_constructor constructor of the viewer. |
c5d77517 |
26 | */ |
27 | |
41a76985 |
28 | void toolbar_item_reg(char ** pixmap, char *tooltip, lttv_constructor view_constructor); |
c5d77517 |
29 | |
30 | |
31 | /** |
32 | * Function to unregister the viewer's constructor, release the space |
33 | * occupied by pixmap, tooltip and constructor of the viewer. |
34 | * It will be called when a module is unloaded. |
fcdf0ec2 |
35 | * @param view_constructor constructor of the viewer which is used as |
c5d77517 |
36 | * a reference to find out where the pixmap and tooltip are. |
37 | */ |
38 | |
41a76985 |
39 | void toolbar_item_unreg(lttv_constructor view_constructor); |
c5d77517 |
40 | |
41 | |
42 | /** |
43 | * Function to register a view constructor so that main window can generate |
44 | * a menu item for the viewer in order to generate a new instance easily. |
45 | * It will be called by init function of the module. |
fcdf0ec2 |
46 | * @param menu_path path of the menu item. |
47 | * @param menu_text text of the menu item. |
48 | * @param view_constructor constructor of the viewer. |
c5d77517 |
49 | */ |
50 | |
41a76985 |
51 | void menu_item_reg(char *menu_path, char *menu_text, lttv_constructor view_constructor); |
c5d77517 |
52 | |
53 | |
54 | /** |
55 | * Function to unregister the viewer's constructor, release the space |
56 | * occupied by menu_path, menu_text and constructor of the viewer. |
57 | * It will be called when a module is unloaded. |
fcdf0ec2 |
58 | * @param view_constructor constructor of the viewer which is used as |
c5d77517 |
59 | * a reference to find out where the menu_path and menu_text are. |
60 | */ |
61 | |
41a76985 |
62 | void menu_item_unreg(lttv_constructor view_constructor); |
c5d77517 |
63 | |
64 | |
65 | /** |
66 | * Update the status bar whenever something changed in the viewer. |
fcdf0ec2 |
67 | * @param main_win the main window the viewer belongs to. |
68 | * @param info the message which will be shown in the status bar. |
c5d77517 |
69 | */ |
70 | |
41a76985 |
71 | void update_status(MainWindow *main_win, char *info); |
c5d77517 |
72 | |
73 | |
74 | /** |
f7afe191 |
75 | * Function to get the current time window of the current tab. |
c5d77517 |
76 | * It will be called by a viewer's hook function to update the |
f7afe191 |
77 | * time window of the viewer and also be called by the constructor |
c5d77517 |
78 | * of the viewer. |
fcdf0ec2 |
79 | * @param main_win the main window the viewer belongs to. |
80 | * @param time_interval a pointer where time interval will be stored. |
c5d77517 |
81 | */ |
82 | |
41a76985 |
83 | void get_time_window(MainWindow *main_win, TimeWindow *time_window); |
c5d77517 |
84 | |
85 | |
86 | /** |
87 | * Function to set the time interval of the current tab. |
88 | * It will be called by a viewer's signal handle associated with |
89 | * the move_slider signal |
fcdf0ec2 |
90 | * @param main_win the main window the viewer belongs to. |
91 | * @param time_interval a pointer where time interval is stored. |
c5d77517 |
92 | */ |
93 | |
41a76985 |
94 | void set_time_window(MainWindow *main_win, TimeWindow *time_window); |
c5d77517 |
95 | |
96 | /** |
97 | * Function to get the current time/event of the current tab. |
98 | * It will be called by a viewer's hook function to update the |
99 | * current time/event of the viewer. |
fcdf0ec2 |
100 | * @param main_win the main window the viewer belongs to. |
10bc4f50 |
101 | * @param time a pointer where time will be stored. |
c5d77517 |
102 | */ |
103 | |
41a76985 |
104 | void get_current_time(MainWindow *main_win, LttTime *time); |
c5d77517 |
105 | |
106 | |
107 | /** |
108 | * Function to set the current time/event of the current tab. |
109 | * It will be called by a viewer's signal handle associated with |
110 | * the button-release-event signal |
fcdf0ec2 |
111 | * @param main_win the main window the viewer belongs to. |
10bc4f50 |
112 | * @param time a pointer where time is stored. |
c5d77517 |
113 | */ |
114 | |
41a76985 |
115 | void set_current_time(MainWindow *main_win, LttTime *time); |
c5d77517 |
116 | |
117 | |
118 | /** |
119 | * Function to get the traceset from the current tab. |
120 | * It will be called by the constructor of the viewer and also be |
121 | * called by a hook funtion of the viewer to update its traceset. |
fcdf0ec2 |
122 | * @param main_win the main window the viewer belongs to. |
123 | * @param traceset a pointer to a traceset. |
c5d77517 |
124 | */ |
125 | |
41a76985 |
126 | //void get_traceset(MainWindow *main_win, Traceset *traceset); |
c5d77517 |
127 | |
128 | |
129 | /** |
130 | * Function to get the filter of the current tab. |
131 | * It will be called by the constructor of the viewer and also be |
132 | * called by a hook funtion of the viewer to update its filter. |
133 | * @param main_win, the main window the viewer belongs to. |
134 | * @param filter, a pointer to a filter. |
135 | */ |
136 | |
41a76985 |
137 | //void get_filter(MainWindow *main_win, Filter *filter); |
c5d77517 |
138 | |
139 | |
140 | /** |
141 | * Function to register a hook function for a viewer to set/update its |
142 | * time interval. |
143 | * It will be called by the constructor of the viewer. |
f7afe191 |
144 | * @param hook hook function of the viewer. Takes a TimeInterval* as call_data. |
fcdf0ec2 |
145 | * @param hook_data hook data associated with the hook function. |
146 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
147 | */ |
148 | |
41a76985 |
149 | void reg_update_time_window(LttvHook hook, gpointer hook_data, |
150 | MainWindow * main_win); |
c5d77517 |
151 | |
152 | |
153 | /** |
154 | * Function to unregister a viewer's hook function which is used to |
155 | * set/update the time interval of the viewer. |
156 | * It will be called by the destructor of the viewer. |
f7afe191 |
157 | * @param hook hook function of the viewer. Takes a TimeInterval as call_data. |
fcdf0ec2 |
158 | * @param hook_data hook data associated with the hook function. |
159 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
160 | */ |
161 | |
41a76985 |
162 | void unreg_update_time_window(LttvHook hook, gpointer hook_data, |
163 | MainWindow * main_win); |
c5d77517 |
164 | |
165 | |
166 | /** |
167 | * Function to register a hook function for a viewer to set/update its |
168 | * traceset. |
169 | * It will be called by the constructor of the viewer. |
fcdf0ec2 |
170 | * @param hook hook function of the viewer. |
171 | * @param hook_data hook data associated with the hook function. |
172 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
173 | */ |
174 | |
41a76985 |
175 | void reg_update_traceset(LttvHook hook, gpointer hook_data, |
bca3b81f |
176 | MainWindow * main_win); |
c5d77517 |
177 | |
178 | |
179 | /** |
180 | * Function to unregister a viewer's hook function which is used to |
181 | * set/update the traceset of the viewer. |
182 | * It will be called by the destructor of the viewer. |
fcdf0ec2 |
183 | * @param hook hook function of the viewer. |
184 | * @param hook_data hook data associated with the hook function. |
185 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
186 | */ |
187 | |
41a76985 |
188 | void unreg_update_traceset(LttvHook hook, gpointer hook_data, |
bca3b81f |
189 | MainWindow * main_win); |
c5d77517 |
190 | |
191 | |
a8c0f09d |
192 | /** |
193 | * Function to redraw each viewer belonging to the current tab |
194 | * @param main_win the main window the viewer belongs to. |
195 | */ |
196 | |
197 | void update_traceset(MainWindow * main_win); |
198 | |
199 | |
c5d77517 |
200 | /** |
201 | * Function to register a hook function for a viewer to set/update its |
202 | * filter. |
203 | * It will be called by the constructor of the viewer. |
fcdf0ec2 |
204 | * @param hook hook function of the viewer. |
205 | * @param hook_data hook data associated with the hook function. |
206 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
207 | */ |
208 | |
41a76985 |
209 | void reg_update_filter(LttvHook hook, gpointer hook_data, |
bca3b81f |
210 | MainWindow *main_win); |
c5d77517 |
211 | |
212 | |
213 | /** |
214 | * Function to unregister a viewer's hook function which is used to |
215 | * set/update the filter of the viewer. |
216 | * It will be called by the destructor of the viewer. |
fcdf0ec2 |
217 | * @param hook hook function of the viewer. |
218 | * @param hook_data hook data associated with the hook function. |
219 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
220 | */ |
221 | |
41a76985 |
222 | void unreg_update_filter(LttvHook hook, gpointer hook_data, |
bca3b81f |
223 | MainWindow * main_win); |
c5d77517 |
224 | |
225 | |
226 | /** |
227 | * Function to register a hook function for a viewer to set/update its |
228 | * current time. |
229 | * It will be called by the constructor of the viewer. |
fcdf0ec2 |
230 | * @param hook hook function of the viewer. |
231 | * @param hook_data hook data associated with the hook function. |
232 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
233 | */ |
234 | |
41a76985 |
235 | void reg_update_current_time(LttvHook hook, gpointer hook_data, |
bca3b81f |
236 | MainWindow *main_win); |
c5d77517 |
237 | |
238 | |
239 | /** |
240 | * Function to unregister a viewer's hook function which is used to |
241 | * set/update the current time of the viewer. |
242 | * It will be called by the destructor of the viewer. |
fcdf0ec2 |
243 | * @param hook hook function of the viewer. |
244 | * @param hook_data hook data associated with the hook function. |
245 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
246 | */ |
247 | |
41a76985 |
248 | void unreg_update_current_time(LttvHook hook, gpointer hook_data, |
bca3b81f |
249 | MainWindow * main_win); |
10bc4f50 |
250 | |
251 | |
202f6c8f |
252 | /** |
253 | * Function to register a hook function for a viewer to show |
254 | *the content of the viewer. |
255 | * It will be called by the constructor of the viewer. |
256 | * @param hook hook function of the viewer. |
257 | * @param hook_data hook data associated with the hook function. |
258 | * @param main_win the main window the viewer belongs to. |
259 | */ |
260 | |
261 | void reg_show_viewer(LttvHook hook, gpointer hook_data, |
262 | MainWindow *main_win); |
263 | |
264 | |
265 | /** |
266 | * Function to unregister a viewer's hook function which is used to |
267 | * show the content of the viewer.. |
268 | * It will be called by the destructor of the viewer. |
269 | * @param hook hook function of the viewer. |
270 | * @param hook_data hook data associated with the hook function. |
271 | * @param main_win the main window the viewer belongs to. |
272 | */ |
273 | |
274 | void unreg_show_viewer(LttvHook hook, gpointer hook_data, |
275 | MainWindow * main_win); |
276 | |
277 | |
278 | /** |
279 | * Function to show each viewer in the current tab. |
280 | * It will be called by main window after it called process_traceset |
281 | * @param main_win the main window the viewer belongs to. |
282 | */ |
283 | |
284 | void show_viewer(MainWindow *main_win); |
285 | |
286 | |
10bc4f50 |
287 | /** |
288 | * Function to set the focused pane (viewer). |
289 | * It will be called by a viewer's signal handle associated with |
290 | * the grab_focus signal |
291 | * @param main_win the main window the viewer belongs to. |
292 | * @param paned a pointer to a pane where the viewer is contained. |
293 | */ |
294 | |
41a76985 |
295 | void set_focused_pane(MainWindow *main_win, gpointer paned); |
10bc4f50 |
296 | |
297 | |
298 | /** |
299 | * Function to register a hook function for a viewer to set/update the |
300 | * dividor of the hpane. |
301 | * It will be called by the constructor of the viewer. |
302 | * @param hook hook function of the viewer. |
303 | * @param hook_data hook data associated with the hook function. |
304 | * @param main_win the main window the viewer belongs to. |
305 | */ |
306 | |
41a76985 |
307 | void reg_update_dividor(LttvHook hook, gpointer hook_data, |
bca3b81f |
308 | MainWindow *main_win); |
10bc4f50 |
309 | |
310 | |
311 | /** |
312 | * Function to unregister a viewer's hook function which is used to |
313 | * set/update hpane's dividor of the viewer. |
314 | * It will be called by the destructor of the viewer. |
315 | * @param hook hook function of the viewer. |
316 | * @param hook_data hook data associated with the hook function. |
317 | * @param main_win the main window the viewer belongs to. |
318 | */ |
319 | |
41a76985 |
320 | void unreg_update_dividor(LttvHook hook, gpointer hook_data, |
bca3b81f |
321 | MainWindow *main_win); |
10bc4f50 |
322 | |
323 | |
324 | /** |
325 | * Function to set the position of the hpane's dividor (viewer). |
326 | * It will be called by a viewer's signal handle associated with |
327 | * the motion_notify_event event/signal |
328 | * @param main_win the main window the viewer belongs to. |
329 | * @param position position of the hpane's dividor. |
330 | */ |
331 | |
41a76985 |
332 | void set_hpane_dividor(MainWindow *main_win, gint position); |
10bc4f50 |
333 | |
334 | |
335 | /** |
336 | * Function to process traceset. It will call lttv_process_trace, |
337 | * each view will call this api to get events. |
338 | * @param main_win the main window the viewer belongs to. |
339 | * @param start the start time of the first event to be processed. |
340 | * @param end the end time of the last event to be processed. |
341 | */ |
342 | |
41a76985 |
343 | void process_traceset_api(MainWindow *main_win, LttTime start, |
344 | LttTime end, unsigned maxNumEvents); |
10bc4f50 |
345 | |
346 | |
347 | /** |
348 | * Function to add hooks into the context of a traceset, |
349 | * before reading events from traceset, viewer will call this api to |
350 | * register hooks |
351 | * @param main_win the main window the viewer belongs to. |
352 | * @param LttvHooks hooks to be registered. |
353 | */ |
354 | |
41a76985 |
355 | void context_add_hooks_api(MainWindow *main_win , |
356 | LttvHooks *before_traceset, |
357 | LttvHooks *after_traceset, |
358 | LttvHooks *check_trace, |
359 | LttvHooks *before_trace, |
360 | LttvHooks *after_trace, |
361 | LttvHooks *check_tracefile, |
362 | LttvHooks *before_tracefile, |
363 | LttvHooks *after_tracefile, |
364 | LttvHooks *check_event, |
365 | LttvHooks *before_event, |
366 | LttvHooks *after_event); |
10bc4f50 |
367 | |
368 | |
369 | /** |
370 | * Function to remove hooks from the context of a traceset, |
371 | * before reading events from traceset, viewer will call this api to |
372 | * unregister hooks |
373 | * @param main_win the main window the viewer belongs to. |
374 | * @param LttvHooks hooks to be registered. |
375 | */ |
376 | |
41a76985 |
377 | void context_remove_hooks_api(MainWindow *main_win , |
378 | LttvHooks *before_traceset, |
379 | LttvHooks *after_traceset, |
380 | LttvHooks *check_trace, |
381 | LttvHooks *before_trace, |
382 | LttvHooks *after_trace, |
383 | LttvHooks *check_tracefile, |
384 | LttvHooks *before_tracefile, |
385 | LttvHooks *after_tracefile, |
386 | LttvHooks *check_event, |
387 | LttvHooks *before_event, |
388 | LttvHooks *after_event); |
c5d77517 |
389 | |
390 | |
fb1a869e |
391 | /** |
392 | * Function to get the life span of the traceset |
393 | * @param main_win the main window the viewer belongs to. |
394 | * @param start start time of the traceset. |
395 | * @param end end time of the traceset. |
396 | */ |
397 | |
41a76985 |
398 | void get_traceset_time_span(MainWindow *main_win, TimeInterval *time_span); |
6b1d3120 |
399 | |
400 | |
401 | /** |
402 | * Function to add/remove event hooks for state |
403 | * @param main_win the main window the viewer belongs to. |
404 | */ |
405 | |
41a76985 |
406 | void state_add_event_hooks_api(MainWindow *main_win ); |
407 | void state_remove_event_hooks_api(MainWindow *main_win ); |
6b1d3120 |
408 | |
409 | |
410 | /** |
411 | * Function to add/remove event hooks for stats |
412 | * @param main_win the main window the viewer belongs to. |
413 | */ |
414 | |
41a76985 |
415 | void stats_add_event_hooks_api(MainWindow *main_win ); |
416 | void stats_remove_event_hooks_api(MainWindow *main_win ); |
6b1d3120 |
417 | |
418 | |
419 | /** |
420 | * Function to get the stats of the traceset |
421 | * @param main_win the main window the viewer belongs to. |
422 | */ |
423 | |
41a76985 |
424 | LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win); |
a8c0f09d |
425 | |
426 | LttvTracesetContext* get_traceset_context(MainWindow *main_win); |