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