| 1 | /*! \defgroup guiEvents libguiControlFlow: The GUI ControlFlow display plugin */ |
| 2 | /*\@{*/ |
| 3 | |
| 4 | /*! \file guiControlFlow.c |
| 5 | * \brief Graphical plugin for showing control flow of a trace. |
| 6 | * |
| 7 | * This plugin adds a Control Flow Viewer functionnality to Linux TraceToolkit |
| 8 | * GUI when this plugin is loaded. The init and destroy functions add the |
| 9 | * viewer's insertion menu item and toolbar icon by calling gtkTraceSet's |
| 10 | * API functions. Then, when a viewer's object is created, the constructor |
| 11 | * creates ans register through API functions what is needed to interact |
| 12 | * with the TraceSet window. |
| 13 | * |
| 14 | * This plugin uses the gdk library to draw the events and gtk to interact |
| 15 | * with the user. |
| 16 | * |
| 17 | * Author : Mathieu Desnoyers, June 2003 |
| 18 | */ |
| 19 | |
| 20 | #include <glib.h> |
| 21 | #include <gmodule.h> |
| 22 | #include <gtk.h> |
| 23 | #include <gdk.h> |
| 24 | |
| 25 | #include <lttv/module.h> |
| 26 | |
| 27 | #include "guiControlFlow.h" |
| 28 | #include "icons/guiControlFlowInsert.xpm" |
| 29 | |
| 30 | //! Event Viewer's constructor |
| 31 | GtkWidget *guiControlFlow(GtkWidget *ParentWindow); |
| 32 | |
| 33 | /** |
| 34 | * plugin's init function |
| 35 | * |
| 36 | * This function initializes the Control Flow Viewer functionnality through the |
| 37 | * gtkTraceSet API. |
| 38 | */ |
| 39 | G_MODULE_EXPORT void init() { |
| 40 | g_critical("GUI ControlFlow Viewer init()"); |
| 41 | |
| 42 | /* Register the toolbar insert button */ |
| 43 | ToolbarItemReg(guiEventsInsert_xpm, "Insert Control Flow Viewer", guiEvent); |
| 44 | |
| 45 | /* Register the menu item insert entry */ |
| 46 | MenuItemReg("/", "Insert Control Flow Viewer", guiEvent); |
| 47 | |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * plugin's destroy function |
| 52 | * |
| 53 | * This function releases the memory reserved by the module and unregisters |
| 54 | * everything that has been registered in the gtkTraceSet API. |
| 55 | */ |
| 56 | G_MODULE_EXPORT void destroy() { |
| 57 | g_critical("GUI Control Flow Viewer destroy()"); |
| 58 | |
| 59 | /* Unregister the toolbar insert button */ |
| 60 | ToolbarItemUnreg(guiEvent); |
| 61 | |
| 62 | /* Unregister the menu item insert entry */ |
| 63 | MenuItemUnreg(guiEvents); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Control Flow Viewer's constructor |
| 68 | * |
| 69 | * This constructor is given as a parameter to the menuitem and toolbar button |
| 70 | * registration. It creates the drawing widget. |
| 71 | * @param ParentWindow A pointer to the parent window. |
| 72 | * @return The widget created. |
| 73 | */ |
| 74 | static GtkWidget * |
| 75 | guiEvents(GtkWidget *ParentWindow) |
| 76 | { |
| 77 | GtkWidget *drawing_area = gtk_drawing_area_new (); |
| 78 | |
| 79 | g_signal_connect (G_OBJECT (drawing_area), "expose_event", |
| 80 | G_CALLBACK (expose_event_callback), NULL); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | |
| 85 | /*\@}*/ |