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