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 | |
ee300ef7 |
28 | void ToolbarItemReg(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 | |
ee300ef7 |
39 | void ToolbarItemUnreg(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 | |
ee300ef7 |
51 | void MenuItemReg(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 | |
ee300ef7 |
62 | void MenuItemUnreg(lttv_constructor view_constructor); |
c5d77517 |
63 | |
64 | |
65 | /** |
66 | * Attach a viewer to the current tab. |
67 | * It will be called in the constructor of the viewer. |
fcdf0ec2 |
68 | * @param main_win the main window the viewer belongs to. |
69 | * @param viewer viewer to be attached to the current tab |
c5d77517 |
70 | */ |
71 | |
fcdf0ec2 |
72 | // Not Needed : Main window add widget returned by constructor |
10bc4f50 |
73 | //void AttachViewer(mainWindow *main_win, GtkWidget *viewer); |
c5d77517 |
74 | |
75 | |
fcdf0ec2 |
76 | /* ?? Maybe we do not need this function, when a widget is destroyed, |
c5d77517 |
77 | * it will be removed automatically from its container |
78 | */ |
fcdf0ec2 |
79 | // Not needed |
c5d77517 |
80 | /** |
81 | * Detach a viewer from the current tab. |
82 | * It will be called in the destructor of the viewer. |
fcdf0ec2 |
83 | * @param main_win the main window the viewer belongs to. |
84 | * @param viewer viewer to be detached from the current tab. |
c5d77517 |
85 | */ |
86 | |
10bc4f50 |
87 | //void DetachViewer(mainWindow *main_win, GtkWidget *viewer); |
c5d77517 |
88 | |
89 | |
90 | /** |
91 | * Update the status bar whenever something changed in the viewer. |
fcdf0ec2 |
92 | * @param main_win the main window the viewer belongs to. |
93 | * @param info the message which will be shown in the status bar. |
c5d77517 |
94 | */ |
95 | |
10bc4f50 |
96 | void UpdateStatus(mainWindow *main_win, char *info); |
c5d77517 |
97 | |
98 | |
99 | /** |
100 | * Function to get the current time interval of the current tab. |
101 | * It will be called by a viewer's hook function to update the |
102 | * time interval of the viewer and also be called by the constructor |
103 | * of the viewer. |
fcdf0ec2 |
104 | * @param main_win the main window the viewer belongs to. |
105 | * @param time_interval a pointer where time interval will be stored. |
c5d77517 |
106 | */ |
107 | |
10bc4f50 |
108 | void GetTimeInterval(mainWindow *main_win, TimeInterval *time_interval); |
c5d77517 |
109 | |
110 | |
111 | /** |
112 | * Function to set the time interval of the current tab. |
113 | * It will be called by a viewer's signal handle associated with |
114 | * the move_slider signal |
fcdf0ec2 |
115 | * @param main_win the main window the viewer belongs to. |
116 | * @param time_interval a pointer where time interval is stored. |
c5d77517 |
117 | */ |
118 | |
10bc4f50 |
119 | void SetTimeInterval(mainWindow *main_win, TimeInterval *time_interval); |
c5d77517 |
120 | |
121 | |
122 | /** |
123 | * Function to get the current time/event of the current tab. |
124 | * It will be called by a viewer's hook function to update the |
125 | * current time/event of the viewer. |
fcdf0ec2 |
126 | * @param main_win the main window the viewer belongs to. |
10bc4f50 |
127 | * @param time a pointer where time will be stored. |
c5d77517 |
128 | */ |
129 | |
10bc4f50 |
130 | void GetCurrentTime(mainWindow *main_win, LttTime *time); |
c5d77517 |
131 | |
132 | |
133 | /** |
134 | * Function to set the current time/event of the current tab. |
135 | * It will be called by a viewer's signal handle associated with |
136 | * the button-release-event signal |
fcdf0ec2 |
137 | * @param main_win the main window the viewer belongs to. |
10bc4f50 |
138 | * @param time a pointer where time is stored. |
c5d77517 |
139 | */ |
140 | |
10bc4f50 |
141 | void SetCurrentTime(mainWindow *main_win, LttTime *time); |
c5d77517 |
142 | |
143 | |
144 | /** |
145 | * Function to get the traceset from the current tab. |
146 | * It will be called by the constructor of the viewer and also be |
147 | * called by a hook funtion of the viewer to update its traceset. |
fcdf0ec2 |
148 | * @param main_win the main window the viewer belongs to. |
149 | * @param traceset a pointer to a traceset. |
c5d77517 |
150 | */ |
151 | |
10bc4f50 |
152 | //void GetTraceset(mainWindow *main_win, Traceset *traceset); |
c5d77517 |
153 | |
154 | |
155 | /** |
156 | * Function to get the filter of the current tab. |
157 | * It will be called by the constructor of the viewer and also be |
158 | * called by a hook funtion of the viewer to update its filter. |
159 | * @param main_win, the main window the viewer belongs to. |
160 | * @param filter, a pointer to a filter. |
161 | */ |
162 | |
10bc4f50 |
163 | //void GetFilter(mainWindow *main_win, Filter *filter); |
c5d77517 |
164 | |
165 | |
166 | /** |
167 | * Function to register a hook function for a viewer to set/update its |
168 | * time interval. |
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 | |
10bc4f50 |
175 | void RegUpdateTimeInterval(LttvHook hook, gpointer hook_data, |
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 time interval 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 | |
10bc4f50 |
188 | void UnregUpdateTimeInterval(LttvHook hook, gpointer hook_data, |
189 | mainWindow * main_win); |
c5d77517 |
190 | |
191 | |
192 | /** |
193 | * Function to register a hook function for a viewer to set/update its |
194 | * traceset. |
195 | * It will be called by the constructor of the viewer. |
fcdf0ec2 |
196 | * @param hook hook function of the viewer. |
197 | * @param hook_data hook data associated with the hook function. |
198 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
199 | */ |
200 | |
10bc4f50 |
201 | void RegUpdateTraceset(LttvHook hook, gpointer hook_data, |
202 | mainWindow * main_win); |
c5d77517 |
203 | |
204 | |
205 | /** |
206 | * Function to unregister a viewer's hook function which is used to |
207 | * set/update the traceset of the viewer. |
208 | * It will be called by the destructor of the viewer. |
fcdf0ec2 |
209 | * @param hook hook function of the viewer. |
210 | * @param hook_data hook data associated with the hook function. |
211 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
212 | */ |
213 | |
10bc4f50 |
214 | void UnregUpdateTraceset(LttvHook hook, gpointer hook_data, |
215 | mainWindow * main_win); |
c5d77517 |
216 | |
217 | |
218 | /** |
219 | * Function to register a hook function for a viewer to set/update its |
220 | * filter. |
221 | * It will be called by the constructor of the viewer. |
fcdf0ec2 |
222 | * @param hook hook function of the viewer. |
223 | * @param hook_data hook data associated with the hook function. |
224 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
225 | */ |
226 | |
10bc4f50 |
227 | void RegUpdateFilter(LttvHook hook, gpointer hook_data, |
228 | mainWindow *main_win); |
c5d77517 |
229 | |
230 | |
231 | /** |
232 | * Function to unregister a viewer's hook function which is used to |
233 | * set/update the filter of the viewer. |
234 | * It will be called by the destructor of the viewer. |
fcdf0ec2 |
235 | * @param hook hook function of the viewer. |
236 | * @param hook_data hook data associated with the hook function. |
237 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
238 | */ |
239 | |
10bc4f50 |
240 | void UnregUpdateFilter(LttvHook hook, gpointer hook_data, |
241 | mainWindow * main_win); |
c5d77517 |
242 | |
243 | |
244 | /** |
245 | * Function to register a hook function for a viewer to set/update its |
246 | * current time. |
247 | * It will be called by the constructor of the viewer. |
fcdf0ec2 |
248 | * @param hook hook function of the viewer. |
249 | * @param hook_data hook data associated with the hook function. |
250 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
251 | */ |
252 | |
10bc4f50 |
253 | void RegUpdateCurrentTime(LttvHook hook, gpointer hook_data, |
254 | mainWindow *main_win); |
c5d77517 |
255 | |
256 | |
257 | /** |
258 | * Function to unregister a viewer's hook function which is used to |
259 | * set/update the current time of the viewer. |
260 | * It will be called by the destructor of the viewer. |
fcdf0ec2 |
261 | * @param hook hook function of the viewer. |
262 | * @param hook_data hook data associated with the hook function. |
263 | * @param main_win the main window the viewer belongs to. |
c5d77517 |
264 | */ |
265 | |
10bc4f50 |
266 | void UnregUpdateCurrentTime(LttvHook hook, gpointer hook_data, |
267 | mainWindow * main_win); |
268 | |
269 | |
270 | /** |
271 | * Function to set the focused pane (viewer). |
272 | * It will be called by a viewer's signal handle associated with |
273 | * the grab_focus signal |
274 | * @param main_win the main window the viewer belongs to. |
275 | * @param paned a pointer to a pane where the viewer is contained. |
276 | */ |
277 | |
278 | void SetFocusedPane(mainWindow *main_win, gpointer paned); |
279 | |
280 | |
281 | /** |
282 | * Function to register a hook function for a viewer to set/update the |
283 | * dividor of the hpane. |
284 | * It will be called by the constructor of the viewer. |
285 | * @param hook hook function of the viewer. |
286 | * @param hook_data hook data associated with the hook function. |
287 | * @param main_win the main window the viewer belongs to. |
288 | */ |
289 | |
290 | void RegUpdateDividor(LttvHook hook, gpointer hook_data, |
291 | mainWindow *main_win); |
292 | |
293 | |
294 | /** |
295 | * Function to unregister a viewer's hook function which is used to |
296 | * set/update hpane's dividor of the viewer. |
297 | * It will be called by the destructor of the viewer. |
298 | * @param hook hook function of the viewer. |
299 | * @param hook_data hook data associated with the hook function. |
300 | * @param main_win the main window the viewer belongs to. |
301 | */ |
302 | |
303 | void UnregUpdateDividor(LttvHook hook, gpointer hook_data, |
304 | mainWindow *main_win); |
305 | |
306 | |
307 | /** |
308 | * Function to set the position of the hpane's dividor (viewer). |
309 | * It will be called by a viewer's signal handle associated with |
310 | * the motion_notify_event event/signal |
311 | * @param main_win the main window the viewer belongs to. |
312 | * @param position position of the hpane's dividor. |
313 | */ |
314 | |
315 | void SetHPaneDividor(mainWindow *main_win, gint position); |
316 | |
317 | |
318 | /** |
319 | * Function to process traceset. It will call lttv_process_trace, |
320 | * each view will call this api to get events. |
321 | * @param main_win the main window the viewer belongs to. |
322 | * @param start the start time of the first event to be processed. |
323 | * @param end the end time of the last event to be processed. |
324 | */ |
325 | |
f4f8f203 |
326 | void processTraceset(mainWindow *main_win, LttTime start, |
327 | LttTime end, unsigned maxNumEvents); |
10bc4f50 |
328 | |
329 | |
330 | /** |
331 | * Function to add hooks into the context of a traceset, |
332 | * before reading events from traceset, viewer will call this api to |
333 | * register hooks |
334 | * @param main_win the main window the viewer belongs to. |
335 | * @param LttvHooks hooks to be registered. |
336 | */ |
337 | |
338 | void contextAddHooks(mainWindow *main_win , |
339 | LttvHooks *before_traceset, |
340 | LttvHooks *after_traceset, |
341 | LttvHooks *check_trace, |
342 | LttvHooks *before_trace, |
343 | LttvHooks *after_trace, |
344 | LttvHooks *check_tracefile, |
345 | LttvHooks *before_tracefile, |
346 | LttvHooks *after_tracefile, |
347 | LttvHooks *check_event, |
348 | LttvHooks *before_event, |
349 | LttvHooks *after_event); |
350 | |
351 | |
352 | /** |
353 | * Function to remove hooks from the context of a traceset, |
354 | * before reading events from traceset, viewer will call this api to |
355 | * unregister hooks |
356 | * @param main_win the main window the viewer belongs to. |
357 | * @param LttvHooks hooks to be registered. |
358 | */ |
359 | |
360 | void contextRemoveHooks(mainWindow *main_win , |
361 | LttvHooks *before_traceset, |
362 | LttvHooks *after_traceset, |
363 | LttvHooks *check_trace, |
364 | LttvHooks *before_trace, |
365 | LttvHooks *after_trace, |
366 | LttvHooks *check_tracefile, |
367 | LttvHooks *before_tracefile, |
368 | LttvHooks *after_tracefile, |
369 | LttvHooks *check_event, |
370 | LttvHooks *before_event, |
371 | LttvHooks *after_event); |
c5d77517 |
372 | |
373 | |
fb1a869e |
374 | /** |
375 | * Function to get the life span of the traceset |
376 | * @param main_win the main window the viewer belongs to. |
377 | * @param start start time of the traceset. |
378 | * @param end end time of the traceset. |
379 | */ |
380 | |
381 | void getTracesetTimeSpan(mainWindow *main_win, LttTime * start, LttTime* end); |
6b1d3120 |
382 | |
383 | |
384 | /** |
385 | * Function to add/remove event hooks for state |
386 | * @param main_win the main window the viewer belongs to. |
387 | */ |
388 | |
389 | void stateAddEventHooks(mainWindow *main_win ); |
390 | void stateRemoveEventHooks(mainWindow *main_win ); |
391 | |
392 | |
393 | /** |
394 | * Function to add/remove event hooks for stats |
395 | * @param main_win the main window the viewer belongs to. |
396 | */ |
397 | |
398 | void statsAddEventHooks(mainWindow *main_win ); |
399 | void statsRemoveEventHooks(mainWindow *main_win ); |
400 | |
401 | |
402 | /** |
403 | * Function to get the stats of the traceset |
404 | * @param main_win the main window the viewer belongs to. |
405 | */ |
406 | |
407 | LttvTracesetStats* getTracesetStats(mainWindow *main_win); |