| 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 | |
| 13 | #include <gtk/gtk.h> |
| 14 | #include <ltt/ltt.h> |
| 15 | #include <lttv/hook.h> |
| 16 | #include <lttv/common.h> |
| 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. |
| 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. |
| 25 | */ |
| 26 | |
| 27 | void ToolbarItemReg(char ** pixmap, char *tooltip, lttv_constructor view_constructor); |
| 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. |
| 34 | * @param view_constructor constructor of the viewer which is used as |
| 35 | * a reference to find out where the pixmap and tooltip are. |
| 36 | */ |
| 37 | |
| 38 | void ToolbarItemUnreg(lttv_constructor 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. |
| 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. |
| 48 | */ |
| 49 | |
| 50 | void MenuItemReg(char *menu_path, char *menu_text, lttv_constructor 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. |
| 57 | * @param view_constructor constructor of the viewer which is used as |
| 58 | * a reference to find out where the menu_path and menu_text are. |
| 59 | */ |
| 60 | |
| 61 | void MenuItemUnreg(lttv_constructor view_constructor); |
| 62 | |
| 63 | |
| 64 | /** |
| 65 | * Attach a viewer to the current tab. |
| 66 | * It will be called in the constructor of the viewer. |
| 67 | * @param main_win the main window the viewer belongs to. |
| 68 | * @param viewer viewer to be attached to the current tab |
| 69 | */ |
| 70 | |
| 71 | // Not Needed : Main window add widget returned by constructor |
| 72 | //void AttachViewer(mainWindow *main_win, GtkWidget *viewer); |
| 73 | |
| 74 | |
| 75 | /* ?? Maybe we do not need this function, when a widget is destroyed, |
| 76 | * it will be removed automatically from its container |
| 77 | */ |
| 78 | // Not needed |
| 79 | /** |
| 80 | * Detach a viewer from the current tab. |
| 81 | * It will be called in the destructor of the viewer. |
| 82 | * @param main_win the main window the viewer belongs to. |
| 83 | * @param viewer viewer to be detached from the current tab. |
| 84 | */ |
| 85 | |
| 86 | //void DetachViewer(mainWindow *main_win, GtkWidget *viewer); |
| 87 | |
| 88 | |
| 89 | /** |
| 90 | * Update the status bar whenever something changed in the viewer. |
| 91 | * @param main_win the main window the viewer belongs to. |
| 92 | * @param info the message which will be shown in the status bar. |
| 93 | */ |
| 94 | |
| 95 | void UpdateStatus(mainWindow *main_win, char *info); |
| 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. |
| 103 | * @param main_win the main window the viewer belongs to. |
| 104 | * @param time_interval a pointer where time interval will be stored. |
| 105 | */ |
| 106 | |
| 107 | void GetTimeInterval(mainWindow *main_win, TimeInterval *time_interval); |
| 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 |
| 114 | * @param main_win the main window the viewer belongs to. |
| 115 | * @param time_interval a pointer where time interval is stored. |
| 116 | */ |
| 117 | |
| 118 | void SetTimeInterval(mainWindow *main_win, TimeInterval *time_interval); |
| 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. |
| 125 | * @param main_win the main window the viewer belongs to. |
| 126 | * @param time a pointer where time will be stored. |
| 127 | */ |
| 128 | |
| 129 | void GetCurrentTime(mainWindow *main_win, LttTime *time); |
| 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 |
| 136 | * @param main_win the main window the viewer belongs to. |
| 137 | * @param time a pointer where time is stored. |
| 138 | */ |
| 139 | |
| 140 | void SetCurrentTime(mainWindow *main_win, LttTime *time); |
| 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. |
| 147 | * @param main_win the main window the viewer belongs to. |
| 148 | * @param traceset a pointer to a traceset. |
| 149 | */ |
| 150 | |
| 151 | //void GetTraceset(mainWindow *main_win, Traceset *traceset); |
| 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 | |
| 162 | //void GetFilter(mainWindow *main_win, Filter *filter); |
| 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. |
| 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. |
| 172 | */ |
| 173 | |
| 174 | void RegUpdateTimeInterval(LttvHook hook, gpointer hook_data, |
| 175 | mainWindow * main_win); |
| 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. |
| 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. |
| 185 | */ |
| 186 | |
| 187 | void UnregUpdateTimeInterval(LttvHook hook, gpointer hook_data, |
| 188 | mainWindow * main_win); |
| 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. |
| 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. |
| 198 | */ |
| 199 | |
| 200 | void RegUpdateTraceset(LttvHook hook, gpointer hook_data, |
| 201 | mainWindow * main_win); |
| 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. |
| 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. |
| 211 | */ |
| 212 | |
| 213 | void UnregUpdateTraceset(LttvHook hook, gpointer hook_data, |
| 214 | mainWindow * main_win); |
| 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. |
| 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. |
| 224 | */ |
| 225 | |
| 226 | void RegUpdateFilter(LttvHook hook, gpointer hook_data, |
| 227 | mainWindow *main_win); |
| 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. |
| 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. |
| 237 | */ |
| 238 | |
| 239 | void UnregUpdateFilter(LttvHook hook, gpointer hook_data, |
| 240 | mainWindow * main_win); |
| 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. |
| 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. |
| 250 | */ |
| 251 | |
| 252 | void RegUpdateCurrentTime(LttvHook hook, gpointer hook_data, |
| 253 | mainWindow *main_win); |
| 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. |
| 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. |
| 263 | */ |
| 264 | |
| 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, |
| 326 | LttTime end, unsigned maxNumEvents); |
| 327 | |
| 328 | |
| 329 | /** |
| 330 | * Function to add hooks into the context of a traceset, |
| 331 | * before reading events from traceset, viewer will call this api to |
| 332 | * register hooks |
| 333 | * @param main_win the main window the viewer belongs to. |
| 334 | * @param LttvHooks hooks to be registered. |
| 335 | */ |
| 336 | |
| 337 | void contextAddHooks(mainWindow *main_win , |
| 338 | LttvHooks *before_traceset, |
| 339 | LttvHooks *after_traceset, |
| 340 | LttvHooks *check_trace, |
| 341 | LttvHooks *before_trace, |
| 342 | LttvHooks *after_trace, |
| 343 | LttvHooks *check_tracefile, |
| 344 | LttvHooks *before_tracefile, |
| 345 | LttvHooks *after_tracefile, |
| 346 | LttvHooks *check_event, |
| 347 | LttvHooks *before_event, |
| 348 | LttvHooks *after_event); |
| 349 | |
| 350 | |
| 351 | /** |
| 352 | * Function to remove hooks from the context of a traceset, |
| 353 | * before reading events from traceset, viewer will call this api to |
| 354 | * unregister hooks |
| 355 | * @param main_win the main window the viewer belongs to. |
| 356 | * @param LttvHooks hooks to be registered. |
| 357 | */ |
| 358 | |
| 359 | void contextRemoveHooks(mainWindow *main_win , |
| 360 | LttvHooks *before_traceset, |
| 361 | LttvHooks *after_traceset, |
| 362 | LttvHooks *check_trace, |
| 363 | LttvHooks *before_trace, |
| 364 | LttvHooks *after_trace, |
| 365 | LttvHooks *check_tracefile, |
| 366 | LttvHooks *before_tracefile, |
| 367 | LttvHooks *after_tracefile, |
| 368 | LttvHooks *check_event, |
| 369 | LttvHooks *before_event, |
| 370 | LttvHooks *after_event); |
| 371 | |
| 372 | |