| 1 | /** |
| 2 | * Main window (main module) is the place to contain and display viewers. |
| 3 | * Viewers (lttv modules) interacter with main window though API of the |
| 4 | * main window and hooks of itself. |
| 5 | * This header file should be included in each graphic module. |
| 6 | */ |
| 7 | |
| 8 | #include <gtk/gtk.h> |
| 9 | #include <ltt/ltt.h> |
| 10 | #include <lttv/hook.h> |
| 11 | |
| 12 | /** |
| 13 | * Function to register a view constructor so that main window can generate |
| 14 | * a toolbar item for the viewer in order to generate a new instance easily. |
| 15 | * It will be called by init function of the module. |
| 16 | * @param pixmap, pixmap shown on the toolbar item. |
| 17 | * @param tooltip, tooltip of the toolbar item. |
| 18 | * @view_constructor, constructor of the viewer. |
| 19 | */ |
| 20 | |
| 21 | void ToolbarItemReg(GdkPixmap *pixmap, char *tooltip, void *view_constructor); |
| 22 | |
| 23 | |
| 24 | /** |
| 25 | * Function to unregister the viewer's constructor, release the space |
| 26 | * occupied by pixmap, tooltip and constructor of the viewer. |
| 27 | * It will be called when a module is unloaded. |
| 28 | * @param view_constructor, constructor of the viewer which is used as |
| 29 | * a reference to find out where the pixmap and tooltip are. |
| 30 | */ |
| 31 | |
| 32 | void ToolbarItemUnreg(void *view_constructor); |
| 33 | |
| 34 | |
| 35 | /** |
| 36 | * Function to register a view constructor so that main window can generate |
| 37 | * a menu item for the viewer in order to generate a new instance easily. |
| 38 | * It will be called by init function of the module. |
| 39 | * @param menu_path, path of the menu item. |
| 40 | * @param menu_text, text of the menu item. |
| 41 | * @view_constructor, constructor of the viewer. |
| 42 | */ |
| 43 | |
| 44 | void MenuItemReg(char *menu_path, char *menu_text, void *view_constructor); |
| 45 | |
| 46 | |
| 47 | /** |
| 48 | * Function to unregister the viewer's constructor, release the space |
| 49 | * occupied by menu_path, menu_text and constructor of the viewer. |
| 50 | * It will be called when a module is unloaded. |
| 51 | * @param view_constructor, constructor of the viewer which is used as |
| 52 | * a reference to find out where the menu_path and menu_text are. |
| 53 | */ |
| 54 | |
| 55 | void MenuItemUnreg(void *view_constructor); |
| 56 | |
| 57 | |
| 58 | /** |
| 59 | * Attach a viewer to the current tab. |
| 60 | * It will be called in the constructor of the viewer. |
| 61 | * @param main_win, the main window the viewer belongs to. |
| 62 | * @param viewer, viewer to be attached to the current tab |
| 63 | */ |
| 64 | |
| 65 | void AttachViewer(MainWindow *main_win, GtkWidget *viewer); |
| 66 | |
| 67 | |
| 68 | /* ?? Maybe we do not need this function, when a widget is destoried, |
| 69 | * it will be removed automatically from its container |
| 70 | */ |
| 71 | |
| 72 | /** |
| 73 | * Detach a viewer from the current tab. |
| 74 | * It will be called in the destructor of the viewer. |
| 75 | * @param main_win, the main window the viewer belongs to. |
| 76 | * @param viewer, viewer to be detached from the current tab. |
| 77 | */ |
| 78 | |
| 79 | void DetachViewer(MainWindow *main_win, GtkWidget *viewer); |
| 80 | |
| 81 | |
| 82 | /** |
| 83 | * Update the status bar whenever something changed in the viewer. |
| 84 | * @param main_win, the main window the viewer belongs to. |
| 85 | * @param info, the message which will be shown in the status bar. |
| 86 | */ |
| 87 | |
| 88 | void UpdateStatus(MainWindow *main_win, char *info); |
| 89 | |
| 90 | |
| 91 | /** |
| 92 | * Function to get the current time interval of the current tab. |
| 93 | * It will be called by a viewer's hook function to update the |
| 94 | * time interval of the viewer and also be called by the constructor |
| 95 | * of the viewer. |
| 96 | * @param main_win, the main window the viewer belongs to. |
| 97 | * @param time_interval, a pointer where time interval will be stored. |
| 98 | */ |
| 99 | |
| 100 | void GetTimeInterval(MainWindow *main_win, TimeInterval *time_interval); |
| 101 | |
| 102 | |
| 103 | /** |
| 104 | * Function to set the time interval of the current tab. |
| 105 | * It will be called by a viewer's signal handle associated with |
| 106 | * the move_slider signal |
| 107 | * @param main_win, the main window the viewer belongs to. |
| 108 | * @param time_interval, a pointer where time interval is stored. |
| 109 | */ |
| 110 | |
| 111 | void SetTimeInterval(MainWindow *main_win, TimeInterval *time_interval); |
| 112 | |
| 113 | |
| 114 | /** |
| 115 | * Function to get the current time/event of the current tab. |
| 116 | * It will be called by a viewer's hook function to update the |
| 117 | * current time/event of the viewer. |
| 118 | * @param main_win, the main window the viewer belongs to. |
| 119 | * @param ltt_time, a pointer where time will be stored. |
| 120 | */ |
| 121 | |
| 122 | void GetCurrentTime(MainWindow *main_win, ltt_time *time); |
| 123 | |
| 124 | |
| 125 | /** |
| 126 | * Function to set the current time/event of the current tab. |
| 127 | * It will be called by a viewer's signal handle associated with |
| 128 | * the button-release-event signal |
| 129 | * @param main_win, the main window the viewer belongs to. |
| 130 | * @param ltt_time, a pointer where time is stored. |
| 131 | */ |
| 132 | |
| 133 | void SetCurrentTime(MainWindow *main_win, ltt_time *time); |
| 134 | |
| 135 | |
| 136 | /** |
| 137 | * Function to get the traceset from the current tab. |
| 138 | * It will be called by the constructor of the viewer and also be |
| 139 | * called by a hook funtion of the viewer to update its traceset. |
| 140 | * @param main_win, the main window the viewer belongs to. |
| 141 | * @param traceset, a pointer to a traceset. |
| 142 | */ |
| 143 | |
| 144 | void GetTraceset(MainWindow *main_win, Traceset *traceset); |
| 145 | |
| 146 | |
| 147 | /** |
| 148 | * Function to get the filter of the current tab. |
| 149 | * It will be called by the constructor of the viewer and also be |
| 150 | * called by a hook funtion of the viewer to update its filter. |
| 151 | * @param main_win, the main window the viewer belongs to. |
| 152 | * @param filter, a pointer to a filter. |
| 153 | */ |
| 154 | |
| 155 | void GetFilter(MainWindow *main_win, Filter *filter); |
| 156 | |
| 157 | |
| 158 | /** |
| 159 | * Function to register a hook function for a viewer to set/update its |
| 160 | * time interval. |
| 161 | * It will be called by the constructor of the viewer. |
| 162 | * @param hook, hook function of the viewer. |
| 163 | * @param hook_data, hook data associated with the hook function. |
| 164 | * @param main_win, the main window the viewer belongs to. |
| 165 | */ |
| 166 | |
| 167 | void RegUpdateTimeInterval(lttv_hook *hook, TimeInterval *hook_data, |
| 168 | MainWindow * main_win); |
| 169 | |
| 170 | |
| 171 | /** |
| 172 | * Function to unregister a viewer's hook function which is used to |
| 173 | * set/update the time interval of the viewer. |
| 174 | * It will be called by the destructor of the viewer. |
| 175 | * @param hook, hook function of the viewer. |
| 176 | * @param hook_data, hook data associated with the hook function. |
| 177 | * @param main_win, the main window the viewer belongs to. |
| 178 | */ |
| 179 | |
| 180 | void UnregUpdateTimeInterval(lttv_hook *hook, TimeInterval *hook_data, |
| 181 | MainWindow * main_win); |
| 182 | |
| 183 | |
| 184 | /** |
| 185 | * Function to register a hook function for a viewer to set/update its |
| 186 | * traceset. |
| 187 | * It will be called by the constructor of the viewer. |
| 188 | * @param hook, hook function of the viewer. |
| 189 | * @param hook_data, hook data associated with the hook function. |
| 190 | * @param main_win, the main window the viewer belongs to. |
| 191 | */ |
| 192 | |
| 193 | void RegUpdateTraceset(lttv_hook *hook, Traceset *hook_data, |
| 194 | MainWindow * main_win); |
| 195 | |
| 196 | |
| 197 | /** |
| 198 | * Function to unregister a viewer's hook function which is used to |
| 199 | * set/update the traceset of the viewer. |
| 200 | * It will be called by the destructor of the viewer. |
| 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. |
| 204 | */ |
| 205 | |
| 206 | void UnregUpdateTraceset(lttv_hook *hook, Traceset *hook_data, |
| 207 | MainWindow * main_win); |
| 208 | |
| 209 | |
| 210 | /** |
| 211 | * Function to register a hook function for a viewer to set/update its |
| 212 | * filter. |
| 213 | * It will be called by the constructor of the viewer. |
| 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. |
| 217 | */ |
| 218 | |
| 219 | void RegUpdateFilter(lttv_hook *hook, Filter *hook_data, |
| 220 | MainWindow *main_win); |
| 221 | |
| 222 | |
| 223 | /** |
| 224 | * Function to unregister a viewer's hook function which is used to |
| 225 | * set/update the filter of the viewer. |
| 226 | * It will be called by the destructor of the viewer. |
| 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. |
| 230 | */ |
| 231 | |
| 232 | void UnregUpdateFilter(lttv_hook *hook, Filter *hook_data, |
| 233 | MainWindow * main_win); |
| 234 | |
| 235 | |
| 236 | /** |
| 237 | * Function to register a hook function for a viewer to set/update its |
| 238 | * current time. |
| 239 | * It will be called by the constructor of the viewer. |
| 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. |
| 243 | */ |
| 244 | |
| 245 | void RegUpdateCurrentTime(lttv_hook *hook, ltt_time *hook_data, |
| 246 | MainWindow *main_win); |
| 247 | |
| 248 | |
| 249 | /** |
| 250 | * Function to unregister a viewer's hook function which is used to |
| 251 | * set/update the current time of the viewer. |
| 252 | * It will be called by the destructor of the viewer. |
| 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. |
| 256 | */ |
| 257 | |
| 258 | void UnregUpdateCurrentTime(lttv_hook *hook, ltt_time *hook_data, |
| 259 | MainWindow * main_win); |
| 260 | |
| 261 | |