From: yangxx Date: Mon, 20 Oct 2003 17:27:55 +0000 (+0000) Subject: following GTK convention X-Git-Tag: v0.12.20~3172 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=10f2da9501711d45ea6d3130efaa1337c7315e31;p=lttv.git following GTK convention git-svn-id: http://ltt.polymtl.ca/svn@317 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/modules/guiEvents.c b/ltt/branches/poly/lttv/modules/guiEvents.c index 3cb93299..5ee94109 100644 --- a/ltt/branches/poly/lttv/modules/guiEvents.c +++ b/ltt/branches/poly/lttv/modules/guiEvents.c @@ -177,9 +177,6 @@ G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) { return; } - - g_critical("GUI Event Viewer init()"); - /* Register the toolbar insert button */ ToolbarItemReg(hGuiEventsInsert_xpm, "Insert Event Viewer", h_gui_events); @@ -204,8 +201,6 @@ G_MODULE_EXPORT void destroy() { EventViewerData *event_viewer_data; - g_critical("GUI Event Viewer destroy()"); - if(g_event_viewer_data_list){ g_slist_foreach(g_event_viewer_data_list, event_destroy_walk, NULL ); g_slist_free(g_event_viewer_data_list); @@ -419,7 +414,6 @@ gui_events(mainWindow *parent_window) // event_viewer_data->vtree_adjust_c->upper; event_viewer_data->vadjust_c->page_size = 2.0; // event_viewer_data->vtree_adjust_c->upper; - g_critical("value : %u",event_viewer_data->vtree_adjust_c->upper); /* Raw event trace */ gtk_widget_show(event_viewer_data->hbox_v); gtk_widget_show(event_viewer_data->tree_v); @@ -506,7 +500,6 @@ void tree_v_get_cursor(EventViewerData *event_viewer_data) event_viewer_data->selected_event = FALSE; event_viewer_data->currently_selected_event = 0; } - g_critical("DEBUG : Event Selected : %i , num: %u", event_viewer_data->selected_event, event_viewer_data->currently_selected_event) ; gtk_tree_path_free(path); @@ -531,8 +524,6 @@ void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2, indices = gtk_tree_path_get_indices(path); - g_critical("DEBUG : move cursor step : %u , int : %i , indice : %i", (guint)arg1, arg2, indices[0]) ; - value = gtk_adjustment_get_value(event_viewer_data->vadjust_c); if(arg1 == GTK_MOVEMENT_DISPLAY_LINES) @@ -546,7 +537,6 @@ void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2, if(value + event_viewer_data->num_visible_events <= event_viewer_data->number_of_events -1) { - g_critical("need 1 event down") ; event_viewer_data->currently_selected_event += 1; // gtk_adjustment_set_value(event_viewer_data->vadjust_c, value+1); //gtk_tree_path_free(path); @@ -561,7 +551,6 @@ void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2, { if(value - 1 >= 0 ) { - g_critical("need 1 event up") ; event_viewer_data->currently_selected_event -= 1; // gtk_adjustment_set_value(event_viewer_data->vadjust_c, value-1); //gtk_tree_path_free(path); @@ -586,8 +575,6 @@ void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2, if(value + event_viewer_data->num_visible_events-1 <= event_viewer_data->number_of_events ) { - g_critical("need 1 page down") ; - event_viewer_data->currently_selected_event += event_viewer_data->num_visible_events-1; // gtk_adjustment_set_value(event_viewer_data->vadjust_c, // value+(event_viewer_data->num_visible_events-1)); @@ -605,8 +592,6 @@ void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2, { if(value - (event_viewer_data->num_visible_events-1) >= 0) { - g_critical("need 1 page up") ; - event_viewer_data->currently_selected_event -= event_viewer_data->num_visible_events-1; // gtk_adjustment_set_value(event_viewer_data->vadjust_c, @@ -618,8 +603,6 @@ void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2, } else { /* Go to first Event */ - g_critical("need 1 page up") ; - event_viewer_data->currently_selected_event == 0 ; // gtk_adjustment_set_value(event_viewer_data->vadjust_c, // 0); @@ -641,7 +624,6 @@ void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2, if(arg2 == 1) { /* move end of buffer */ - g_critical("End of buffer") ; event_viewer_data->currently_selected_event = event_viewer_data->number_of_events-1 ; // gtk_adjustment_set_value(event_viewer_data->vadjust_c, // event_viewer_data->number_of_events - @@ -652,7 +634,6 @@ void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2, g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor"); } else { /* Move beginning of buffer */ - g_critical("Beginning of buffer") ; event_viewer_data->currently_selected_event = 0 ; // gtk_adjustment_set_value(event_viewer_data->vadjust_c, 0); //gtk_tree_path_free(path); @@ -676,7 +657,6 @@ void tree_v_cursor_changed_cb (GtkWidget *widget, gpointer data) GtkTreeModel* model = GTK_TREE_MODEL(event_viewer_data->store_m); GtkTreePath *path; - g_critical("DEBUG : cursor change"); /* On cursor change, modify the currently selected event by calling * the right API function */ tree_v_get_cursor(event_viewer_data); @@ -702,8 +682,6 @@ void v_scroll_cb (GtkAdjustment *adjustment, gpointer data) EventViewerData *event_viewer_data = (EventViewerData*)data; GtkTreePath *tree_path; - g_critical("DEBUG : scroll signal, value : %f", adjustment->value); - get_test_data(adjustment->value, event_viewer_data->num_visible_events, event_viewer_data); @@ -735,10 +713,9 @@ gint get_cell_height(GtkTreeView *TreeView) gint height, width; GtkTreeViewColumn *column = gtk_tree_view_get_column(TreeView, 0); GList *Render_List = gtk_tree_view_column_get_cell_renderers(column); - GtkCellRenderer *Renderer = g_list_first(Render_List)->data; + GtkCellRenderer *renderer = g_list_first(Render_List)->data; gtk_tree_view_column_cell_get_size(column, NULL, NULL, NULL, NULL, &height); - g_critical("cell 0 height : %u",height); return height; } @@ -750,17 +727,12 @@ void tree_v_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer gint last_num_visible_events = event_viewer_data->num_visible_events; gdouble exact_num_visible; - g_critical("size-allocate"); - exact_num_visible = ( alloc->height - TREE_VIEW_HEADER_HEIGHT (GTK_TREE_VIEW(event_viewer_data->tree_v)) ) / (double)cell_height ; event_viewer_data->num_visible_events = ceil(exact_num_visible) ; - g_critical("number of events shown : %u",event_viewer_data->num_visible_events); - g_critical("ex number of events shown : %f",exact_num_visible); - /* event_viewer_data->vadjust_c->page_increment = floor(exact_num_visible); @@ -784,8 +756,6 @@ void tree_v_size_request_cb (GtkWidget *widget, GtkRequisition *requisition, gpo EventViewerData *event_viewer_data = (EventViewerData*)data; gint cell_height = get_cell_height(GTK_TREE_VIEW(event_viewer_data->tree_v)); - g_critical("size-request"); - h = cell_height + TREE_VIEW_HEADER_HEIGHT (GTK_TREE_VIEW(event_viewer_data->tree_v)); requisition->height = h; @@ -812,7 +782,6 @@ void get_test_data(double time_value, guint list_height, unsigned size = 1, count = 0; gboolean need_backward_again, backward; - g_warning("DEBUG : get_test_data, time value %f\n", time_value); // if(event_number > event_viewer_data->last_event || // event_number + list_height-1 < event_viewer_data->first_event || @@ -1124,7 +1093,6 @@ gui_events_free(EventViewerData *event_viewer_data) UnregUpdateCurrentTime(update_current_time,event_viewer_data, event_viewer_data->mw); g_event_viewer_data_list = g_slist_remove(g_event_viewer_data_list, event_viewer_data); - g_warning("Delete Event data\n"); g_free(event_viewer_data); } } @@ -1147,7 +1115,6 @@ gui_events_destructor(EventViewerData *event_viewer_data) //gtk_list_store_clear(event_viewer_data->store_m); //gtk_widget_destroy(GTK_WIDGET(event_viewer_data->store_m)); - g_warning("Delete Event data from destroy\n"); //gui_events_free(event_viewer_data); } @@ -1165,8 +1132,6 @@ tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data) { gtk_tree_model_get (model, &iter, EVENT_COLUMN, &event, -1); - g_print ("Event selected : %s\n", event); - g_free (event); } } @@ -1177,8 +1142,6 @@ int event_selected_hook(void *hook_data, void *call_data) EventViewerData *event_viewer_data = (EventViewerData*) hook_data; guint *event_number = (guint*) call_data; - g_critical("DEBUG : event selected by main window : %u", *event_number); - event_viewer_data->currently_selected_event = *event_number; event_viewer_data->selected_event = TRUE ; @@ -1494,425 +1457,3 @@ void remove_all_items_from_queue(GQueue *q) } - - - -/* Imported code from LTT 0.9.6pre2 tracevisualizer */ -#ifdef DEBUG - -/****************************************************************** - * Function : - * WDI_gtk_clist_set_last_row_data_full() - * Description : - * Appends data to the last row of a GtkClist. - * Parameters : - * Return values : - * NONE. - * History : - * J.H.D., 27/08/99, Initial typing. - * Note : - * Based on gtk_clist_set_row_data_full() version 1.2.3. - * Much faster than using gtk_clist_set_row_data_full(). - ******************************************************************/ -static void WDI_gtk_clist_set_last_row_data_full(GtkCList* pmClist, - gpointer pmData, - GtkDestroyNotify pmDestroy) -{ - GtkCListRow *pClistRow; - - g_return_if_fail (pmClist != NULL); - g_return_if_fail (GTK_IS_CLIST (pmClist)); - g_return_if_fail (pmClist->row_list_end != NULL); - - pClistRow = pmClist->row_list_end->data; - pClistRow->data = pmData; - pClistRow->destroy = pmDestroy; -} - - -/****************************************************************** - * Function : - * SHRTEventSelect() - * Description : - * Parameters : - * Return values : - * History : - * Note : - ******************************************************************/ -static void SHRTEventSelect(GtkWidget* pmCList, - gint pmRow, - gint pmColumn, - GdkEventButton* pmEvent, - gpointer pmData) -{ - systemView* pSysView; /* The system being displayed */ - - /* Do we have anything meaningfull */ - if((pSysView = (systemView*) pmData) == NULL) - return; - - /* Store the selected event */ - pSysView->Window->LastSelectedEvent = *(event*) gtk_clist_get_row_data(GTK_CLIST(pmCList), pmRow); - pSysView->Window->EventSelected = TRUE; -} - -/****************************************************************** - * Function : - * SHRTEventButtonPress() - * Description : - * Parameters : - * Return values : - * History : - * Note : - ******************************************************************/ -static void SHRTEventButtonPress(GtkWidget* pmCList, - GdkEventButton* pmEvent, - gpointer pmData) -{ - systemView* pSysView; /* The system being displayed */ - gint row, column; /* The clicked row and column */ - - /* Do we have anything meaningfull */ - if((pSysView = (systemView*) pmData) == NULL) - return; - - /* if we have a right-click event */ - if(pmEvent->button == 3) - /* If we clicked on an item, get its row and column values */ - if(gtk_clist_get_selection_info(GTK_CLIST(pmCList), pmEvent->x, pmEvent->y, &row, &column)) - { - /* Highlight the selected row */ - gtk_clist_select_row(GTK_CLIST(pmCList), row, column); - - /* Store the selected event */ - pSysView->Window->LastSelectedEvent = *(event*) gtk_clist_get_row_data(GTK_CLIST(pmCList), row); - pSysView->Window->EventSelected = TRUE; - - /* Display the popup menu */ - gtk_menu_popup(GTK_MENU(pSysView->Window->RawEventPopup), - NULL, NULL, NULL, NULL, - pmEvent->button, GDK_CURRENT_TIME); - } -} - - -/****************************************************************** - * Function : - * SHRTVAdjustValueChanged() - * Description : - * Parameters : - * Return values : - * History : - * Note : - ******************************************************************/ -static void SHRTVAdjustValueChanged(GtkAdjustment* pmVAdjust, - gpointer pmData) -{ - event lEvent; /* Event used for searching */ - guint32 lPosition; /* The position to scroll to */ - systemView* pSysView; /* The system being displayed */ - - /* Do we have anything meaningfull */ - if((pSysView = (systemView*) pmData) == NULL) - return; - - /* Is there an event database? */ - if(pSysView->EventDB == NULL) - return; - - /* Set the pointer to the first event */ - if(pSysView->EventDB->TraceStart == NULL) - return; - - /* Are we closer to the beginning? */ - if((pmVAdjust->value - (pmVAdjust->upper / 2)) < 0) - { - /* Set the navigation pointer to the beginning of the list */ - lEvent = pSysView->EventDB->FirstEvent; - - /* Calculate distance from beginning */ - lPosition = (guint32) pmVAdjust->value; - - /* Find the event in the event database */ - while(lPosition > 0) - { - lPosition--; - if(DBEventNext(pSysView->EventDB, &lEvent) != TRUE) - break; - } - } - else - { - /* Set the navigation pointer to the end of the list */ - lEvent = pSysView->EventDB->LastEvent; - - /* Calculate distance from end */ - lPosition = (guint32) (pmVAdjust->upper - pmVAdjust->value); - - /* Find the event in the event database */ - while(lPosition > 0) - { - lPosition--; - if(DBEventPrev(pSysView->EventDB, &lEvent) != TRUE) - break; - } - } - - /* Fill the event list according to what was found */ - WDFillEventList(pSysView->Window->RTCList, - pSysView->EventDB, - pSysView->System, - &lEvent, - &(pSysView->Window->LastSelectedEvent)); -} - - - -/****************************************************************** - * Function : - * WDConnectSignals() - * Description : - * Attaches signal handlers to the window items. - * Parameters : - * pmSysView, System view for which signals have to be connected - * Return values : - * NONE - * History : - * Note : - * This function attaches a pointer to the main window during - * the connect. This means that the handlers will get a pointer - * to the window in the data argument. - ******************************************************************/ -static void WDConnectSignals(systemView* pmSysView) -{ - /* Raw event Popup menu */ - gtk_signal_connect(GTK_OBJECT(pmSysView->Window->RawGotoProcess), - "activate", - GTK_SIGNAL_FUNC(SHGotoProcAnalysis), - pmSysView); - gtk_signal_connect(GTK_OBJECT(pmSysView->Window->RawViewEvent), - "activate", - GTK_SIGNAL_FUNC(SHViewEventInEG), - pmSysView); - - /* Set event list callbacks */ - gtk_signal_connect(GTK_OBJECT(pmSysView->Window->RTCList), - "select_row", - GTK_SIGNAL_FUNC(SHRTEventSelect), - pmSysView); - gtk_signal_connect(GTK_OBJECT(pmSysView->Window->RTCList), - "button-press-event", - GTK_SIGNAL_FUNC(SHRTEventButtonPress), - pmSysView); - gtk_signal_connect(GTK_OBJECT(pmSysView->Window->RTVAdjust), - "value-changed", - GTK_SIGNAL_FUNC(SHRTVAdjustValueChanged), - pmSysView); - - -} - - -/****************************************************************** - * Function : - * WDFillEventList() - * Description : - * Fills the window's event list using the trace database. - * Parameters : - * pmList, The list to be filled. - * pmTraceDB, The database of events. - * pmSystem, The system to which this list belongs. - * pmEvent, Event from which we start drawing. - * pmSelectedEvent, Event selected if any. - * Return values : - * NONE. - * History : - * K.Y., 18/06/99, Initial typing. - * Note : - ******************************************************************/ -static void WDFillEventList(GtkWidget* pmList, - db* pmTraceDB, - systemInfo* pmSystem, - event* pmEvent, - event* pmSelectedEvent) -{ - gint i = 0; /* Generic index */ - event lEvent; /* Generic event */ - gchar lTimeStr[TIME_STR_LEN]; /* Time of event */ - static gchar* lString[RTCLIST_NB_COLUMNS]={'\0'}; /* Strings describing event */ - process* pProcess; /* Generic process pointer */ -#if SUPP_RTAI - RTAItask* pTask = NULL; /* Generic task pointer */ -#endif /* SUPP_RTAI */ - eventDescription lEventDesc; /* Description of event */ - - /* Did we allocate space for strings */ - if(lString[0] == NULL) - /* Allocate space for strings */ - for (i = 0; i < RTCLIST_NB_COLUMNS - 1; i++) - lString[i] = (char*) g_malloc(MW_DEFAULT_STRLEN); - - /* Allocate space for description string */ - lString[RTCLIST_NB_COLUMNS - 1] = (char*) g_malloc(MW_LONG_STRLEN); - - /* If no event was supplied, start at the beginning */ - if(pmEvent == NULL) - lEvent = pmTraceDB->FirstEvent; - else - lEvent = *pmEvent; - - /* Freeze and clear clist */ - gtk_clist_freeze(GTK_CLIST(pmList)); - gtk_clist_clear(GTK_CLIST(pmList)); - - /* Reset index */ - i = 0; - - /* Go through the event list */ - do - { - /* Get the event description */ - DBEventDescription(pmTraceDB, &lEvent, TRUE, &lEventDesc); - - /* Get the event's process */ - pProcess = DBEventProcess(pmTraceDB, &lEvent, pmSystem, FALSE); - -#if SUPP_RTAI - /* Does this trace contain RTAI information */ - if(pmTraceDB->SystemType == TRACE_SYS_TYPE_RTAI_LINUX) - /* Get the RTAI task to which this event belongs */ - pTask = RTAIDBEventTask(pmTraceDB, &lEvent, pmSystem, FALSE); -#endif /* SUPP_RTAI */ - - /* Set the event's entry in the list of raw events displayed */ - sRawEventsDisplayed[i] = lEvent; - - /* Add text describing the event */ - /* The CPU ID */ - if(pmTraceDB->LogCPUID == TRUE) - snprintf(lString[0], MW_DEFAULT_STRLEN, "%d", lEventDesc.CPUID); - else - snprintf(lString[0], MW_DEFAULT_STRLEN, "0"); - - /* The event ID */ - snprintf(lString[1], MW_DEFAULT_STRLEN, "%s", pmTraceDB->EventString(pmTraceDB, lEventDesc.ID, &lEvent)); - - /* The event's time of occurence */ - DBFormatTimeInReadableString(lTimeStr, - lEventDesc.Time.tv_sec, - lEventDesc.Time.tv_usec); - snprintf(lString[2], MW_DEFAULT_STRLEN, "%s", lTimeStr); - - /* Is this an RT event */ - if(lEventDesc.ID <= TRACE_MAX) - { - /* The PID of the process to which the event belongs */ - if(pProcess != NULL) - snprintf(lString[3], MW_DEFAULT_STRLEN, "%d", pProcess->PID); - else - snprintf(lString[3], MW_DEFAULT_STRLEN, "N/A"); - } -#if SUPP_RTAI - else - { - /* The TID of the task to which the event belongs */ - if(pTask != NULL) - snprintf(lString[3], MW_DEFAULT_STRLEN, "RT:%d", pTask->TID); - else - snprintf(lString[3], MW_DEFAULT_STRLEN, "RT:N/A"); - } -#endif /* SUPP_RTAI */ - - /* The size of the entry */ - snprintf(lString[4], MW_DEFAULT_STRLEN, "%d", lEventDesc.Size); - - /* The string describing the event */ - snprintf(lString[5], MW_LONG_STRLEN, "%s", lEventDesc.String); - - /* Insert the entry into the list */ - gtk_clist_append(GTK_CLIST(pmList), lString); - - /* Set the row's data to point to the current event */ - WDI_gtk_clist_set_last_row_data_full(GTK_CLIST(pmList), (gpointer) &(sRawEventsDisplayed[i]), NULL); - - /* Was this the last selected event */ - if(DBEventsEqual(lEvent, (*pmSelectedEvent))) - gtk_clist_select_row(GTK_CLIST(pmList), i, 0); - - /* Go to next row */ - i++; - } while((DBEventNext(pmTraceDB, &lEvent) == TRUE) && (i < RTCLIST_NB_ROWS)); - - /* Resize the list's length */ - gtk_widget_queue_resize(pmList); - - /* Thaw the clist */ - gtk_clist_thaw(GTK_CLIST(pmList)); -} - -#endif //DEBUG - -static void destroy_cb( GtkWidget *widget, - gpointer data ) -{ - gtk_main_quit (); -} - - -/* -int main(int argc, char **argv) -{ - GtkWidget *Window; - GtkWidget *ListViewer; - GtkWidget *VBox_V; - EventViewerData *event_viewer_data; - guint ev_sel = 444 ; - - // Initialize i18n support - gtk_set_locale (); - - // Initialize the widget set - gtk_init (&argc, &argv); - - init(); - - Window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (Window), ("Test Window")); - - g_signal_connect (G_OBJECT (Window), "destroy", - G_CALLBACK (destroy_cb), NULL); - - - VBox_V = gtk_vbox_new(0, 0); - gtk_container_add (GTK_CONTAINER (Window), VBox_V); - - //ListViewer = h_gui_events(Window); - //gtk_box_pack_start(GTK_BOX(VBox_V), ListViewer, TRUE, TRUE, 0); - - //ListViewer = h_gui_events(Window); - //gtk_box_pack_start(GTK_BOX(VBox_V), ListViewer, FALSE, TRUE, 0); - - event_viewer_data = gui_events(g_new(mainWindow,1)); - ListViewer = event_viewer_data->hbox_v; - gtk_box_pack_start(GTK_BOX(VBox_V), ListViewer, TRUE, TRUE, 0); - - gtk_widget_show (VBox_V); - gtk_widget_show (Window); - - // event_selected_hook(event_viewer_data, &ev_sel); - - gtk_main (); - - g_critical("main loop finished"); - - //hGuiEvents_Destructor(ListViewer); - - //g_critical("GuiEvents Destructor finished"); - destroy(); - - return 0; -} -*/ - -/*\@}*/ - diff --git a/ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c b/ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c index 951a9882..3a9e5a8d 100644 --- a/ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c +++ b/ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c @@ -25,20 +25,20 @@ #define PATH_LENGTH 256 -static LttvModule *Main_Win_Module; +static LttvModule *statistic_main_win_module; /** Array containing instanced objects. Used when module is unloaded */ -static GSList *gStatistic_Viewer_Data_List = NULL ; +static GSList *g_statistic_viewer_data_list = NULL ; typedef struct _StatisticViewerData StatisticViewerData; //! Statistic Viewer's constructor hook -GtkWidget *hGuiStatistic(mainWindow *pmParentWindow); +GtkWidget *h_gui_statistic(mainWindow *parent_window); //! Statistic Viewer's constructor -StatisticViewerData *GuiStatistic(mainWindow *pmParentWindow); +StatisticViewerData *gui_statistic(mainWindow *parent_window); //! Statistic Viewer's destructor -void GuiStatistic_Destructor(StatisticViewerData *Statistic_Viewer_Data); -void GuiStatistic_free(StatisticViewerData *Statistic_Viewer_Data); +void gui_statistic_destructor(StatisticViewerData *statistic_viewer_data); +void gui_statistic_free(StatisticViewerData *statistic_viewer_data); void grab_focus(GtkWidget *widget, gpointer data); static void tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data); @@ -46,11 +46,11 @@ static void tree_selection_changed_cb (GtkTreeSelection *selection, gpointer dat void statistic_destroy_hash_key(gpointer key); void statistic_destroy_hash_data(gpointer data); -void get_traceset_stats(StatisticViewerData * Statistic_Viewer_Data); -void show_traceset_stats(StatisticViewerData * Statistic_Viewer_Data); -void show_tree(StatisticViewerData * Statistic_Viewer_Data, +void get_traceset_stats(StatisticViewerData * statistic_viewer_data); +void show_traceset_stats(StatisticViewerData * statistic_viewer_data); +void show_tree(StatisticViewerData * statistic_viewer_data, LttvAttribute* stats, GtkTreeIter* parent); -void show_statistic(StatisticViewerData * Statistic_Viewer_Data, +void show_statistic(StatisticViewerData * statistic_viewer_data, LttvAttribute* stats, GtkTextBuffer* buf); @@ -64,22 +64,22 @@ struct _StatisticViewerData{ mainWindow * mw; LttvTracesetStats * stats; - GtkWidget * HPaned_V; - GtkTreeStore * Store_M; - GtkWidget * Tree_V; + GtkWidget * hpaned_v; + GtkTreeStore * store_m; + GtkWidget * tree_v; //scroll window containing Tree View - GtkWidget * Scroll_Win_Tree; + GtkWidget * scroll_win_tree; - GtkWidget * Text_V; + GtkWidget * text_v; //scroll window containing Text View - GtkWidget * Scroll_Win_Text; + GtkWidget * scroll_win_text; // Selection handler - GtkTreeSelection *Select_C; + GtkTreeSelection *select_c; //hash - GHashTable *Statistic_Hash; + GHashTable *statistic_hash; }; @@ -91,26 +91,24 @@ struct _StatisticViewerData{ */ G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) { - Main_Win_Module = lttv_module_require(self, "mainwin", argc, argv); + statistic_main_win_module = lttv_module_require(self, "mainwin", argc, argv); - if(Main_Win_Module == NULL){ + if(statistic_main_win_module == NULL){ g_critical("Can't load Statistic Viewer : missing mainwin\n"); return; } - g_critical("GUI Statistic Viewer init()"); - /* Register the toolbar insert button */ - ToolbarItemReg(hGuiStatisticInsert_xpm, "Insert Statistic Viewer", hGuiStatistic); + ToolbarItemReg(hGuiStatisticInsert_xpm, "Insert Statistic Viewer", h_gui_statistic); /* Register the menu item insert entry */ - MenuItemReg("/", "Insert Statistic Viewer", hGuiStatistic); + MenuItemReg("/", "Insert Statistic Viewer", h_gui_statistic); } void statistic_destroy_walk(gpointer data, gpointer user_data) { - GuiStatistic_Destructor((StatisticViewerData*)data); + gui_statistic_destructor((StatisticViewerData*)data); } /** @@ -122,43 +120,38 @@ void statistic_destroy_walk(gpointer data, gpointer user_data) G_MODULE_EXPORT void destroy() { int i; - g_critical("GUI Statistic Viewer destroy()"); - - if(gStatistic_Viewer_Data_List){ - g_slist_foreach(gStatistic_Viewer_Data_List, statistic_destroy_walk, NULL ); - g_slist_free(gStatistic_Viewer_Data_List); + if(g_statistic_viewer_data_list){ + g_slist_foreach(g_statistic_viewer_data_list, statistic_destroy_walk, NULL ); + g_slist_free(g_statistic_viewer_data_list); } /* Unregister the toolbar insert button */ - ToolbarItemUnreg(hGuiStatistic); + ToolbarItemUnreg(h_gui_statistic); /* Unregister the menu item insert entry */ - MenuItemUnreg(hGuiStatistic); + MenuItemUnreg(h_gui_statistic); } void -GuiStatistic_free(StatisticViewerData *Statistic_Viewer_Data) +gui_statistic_free(StatisticViewerData *statistic_viewer_data) { - g_critical("GuiStatistic_free()"); - if(Statistic_Viewer_Data){ - g_hash_table_destroy(Statistic_Viewer_Data->Statistic_Hash); - gStatistic_Viewer_Data_List = g_slist_remove(gStatistic_Viewer_Data_List, Statistic_Viewer_Data); - g_warning("Delete Statistic data\n"); - g_free(Statistic_Viewer_Data); + if(statistic_viewer_data){ + g_hash_table_destroy(statistic_viewer_data->statistic_hash); + g_statistic_viewer_data_list = g_slist_remove(g_statistic_viewer_data_list, statistic_viewer_data); + g_free(statistic_viewer_data); } } void -GuiStatistic_Destructor(StatisticViewerData *Statistic_Viewer_Data) +gui_statistic_destructor(StatisticViewerData *statistic_viewer_data) { - g_critical("GuiStatistic_Destructor()"); /* May already been done by GTK window closing */ - if(GTK_IS_WIDGET(Statistic_Viewer_Data->HPaned_V)){ - gtk_widget_destroy(Statistic_Viewer_Data->HPaned_V); - Statistic_Viewer_Data = NULL; + if(GTK_IS_WIDGET(statistic_viewer_data->hpaned_v)){ + gtk_widget_destroy(statistic_viewer_data->hpaned_v); + statistic_viewer_data = NULL; } - //GuiStatistic_free(Statistic_Viewer_Data); + //gui_statistic_free(statistic_viewer_data); } @@ -167,16 +160,16 @@ GuiStatistic_Destructor(StatisticViewerData *Statistic_Viewer_Data) * * This constructor is given as a parameter to the menuitem and toolbar button * registration. It creates the list. - * @param pmParentWindow A pointer to the parent window. + * @param parent_window A pointer to the parent window. * @return The widget created. */ GtkWidget * -hGuiStatistic(mainWindow * pmParentWindow) +h_gui_statistic(mainWindow * parent_window) { - StatisticViewerData* Statistic_Viewer_Data = GuiStatistic(pmParentWindow) ; + StatisticViewerData* statistic_viewer_data = gui_statistic(parent_window) ; - if(Statistic_Viewer_Data) - return Statistic_Viewer_Data->HPaned_V; + if(statistic_viewer_data) + return statistic_viewer_data->hpaned_v; else return NULL; } @@ -188,35 +181,35 @@ hGuiStatistic(mainWindow * pmParentWindow) * @return The Statistic viewer data created. */ StatisticViewerData * -GuiStatistic(mainWindow *pmParentWindow) +gui_statistic(mainWindow *parent_window) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; - StatisticViewerData* Statistic_Viewer_Data = g_new(StatisticViewerData,1); + StatisticViewerData* statistic_viewer_data = g_new(StatisticViewerData,1); - Statistic_Viewer_Data->mw = pmParentWindow; - Statistic_Viewer_Data->stats = getTracesetStats(Statistic_Viewer_Data->mw); + statistic_viewer_data->mw = parent_window; + statistic_viewer_data->stats = getTracesetStats(statistic_viewer_data->mw); - Statistic_Viewer_Data->Statistic_Hash = g_hash_table_new_full(g_str_hash, g_str_equal, + statistic_viewer_data->statistic_hash = g_hash_table_new_full(g_str_hash, g_str_equal, statistic_destroy_hash_key, statistic_destroy_hash_data); - Statistic_Viewer_Data->HPaned_V = gtk_hpaned_new(); - Statistic_Viewer_Data->Store_M = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING); - Statistic_Viewer_Data->Tree_V = gtk_tree_view_new_with_model (GTK_TREE_MODEL (Statistic_Viewer_Data->Store_M)); - g_object_unref (G_OBJECT (Statistic_Viewer_Data->Store_M)); + statistic_viewer_data->hpaned_v = gtk_hpaned_new(); + statistic_viewer_data->store_m = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING); + statistic_viewer_data->tree_v = gtk_tree_view_new_with_model (GTK_TREE_MODEL (statistic_viewer_data->store_m)); + g_object_unref (G_OBJECT (statistic_viewer_data->store_m)); - g_signal_connect (G_OBJECT (Statistic_Viewer_Data->Tree_V), "grab-focus", + g_signal_connect (G_OBJECT (statistic_viewer_data->tree_v), "grab-focus", G_CALLBACK (grab_focus), - Statistic_Viewer_Data); + statistic_viewer_data); // Setup the selection handler - Statistic_Viewer_Data->Select_C = gtk_tree_view_get_selection (GTK_TREE_VIEW (Statistic_Viewer_Data->Tree_V)); - gtk_tree_selection_set_mode (Statistic_Viewer_Data->Select_C, GTK_SELECTION_SINGLE); - g_signal_connect (G_OBJECT (Statistic_Viewer_Data->Select_C), "changed", + statistic_viewer_data->select_c = gtk_tree_view_get_selection (GTK_TREE_VIEW (statistic_viewer_data->tree_v)); + gtk_tree_selection_set_mode (statistic_viewer_data->select_c, GTK_SELECTION_SINGLE); + g_signal_connect (G_OBJECT (statistic_viewer_data->select_c), "changed", G_CALLBACK (tree_selection_changed_cb), - Statistic_Viewer_Data); + statistic_viewer_data); renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Statistic Name", @@ -225,69 +218,69 @@ GuiStatistic(mainWindow *pmParentWindow) NULL); gtk_tree_view_column_set_alignment (column, 0.0); // gtk_tree_view_column_set_fixed_width (column, 45); - gtk_tree_view_append_column (GTK_TREE_VIEW (Statistic_Viewer_Data->Tree_V), column); + gtk_tree_view_append_column (GTK_TREE_VIEW (statistic_viewer_data->tree_v), column); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW (Statistic_Viewer_Data->Tree_V), FALSE); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW (statistic_viewer_data->tree_v), FALSE); - Statistic_Viewer_Data->Scroll_Win_Tree = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(Statistic_Viewer_Data->Scroll_Win_Tree), + statistic_viewer_data->scroll_win_tree = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(statistic_viewer_data->scroll_win_tree), GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (Statistic_Viewer_Data->Scroll_Win_Tree), Statistic_Viewer_Data->Tree_V); - gtk_paned_pack1(GTK_PANED(Statistic_Viewer_Data->HPaned_V),Statistic_Viewer_Data->Scroll_Win_Tree, TRUE, FALSE); - gtk_paned_set_position(GTK_PANED(Statistic_Viewer_Data->HPaned_V), 160); + gtk_container_add (GTK_CONTAINER (statistic_viewer_data->scroll_win_tree), statistic_viewer_data->tree_v); + gtk_paned_pack1(GTK_PANED(statistic_viewer_data->hpaned_v),statistic_viewer_data->scroll_win_tree, TRUE, FALSE); + gtk_paned_set_position(GTK_PANED(statistic_viewer_data->hpaned_v), 160); - Statistic_Viewer_Data->Scroll_Win_Text = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(Statistic_Viewer_Data->Scroll_Win_Text), + statistic_viewer_data->scroll_win_text = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(statistic_viewer_data->scroll_win_text), GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); - Statistic_Viewer_Data->Text_V = gtk_text_view_new (); - g_signal_connect (G_OBJECT (Statistic_Viewer_Data->Text_V), "grab-focus", + statistic_viewer_data->text_v = gtk_text_view_new (); + g_signal_connect (G_OBJECT (statistic_viewer_data->text_v), "grab-focus", G_CALLBACK (grab_focus), - Statistic_Viewer_Data); + statistic_viewer_data); - gtk_text_view_set_editable(GTK_TEXT_VIEW(Statistic_Viewer_Data->Text_V),FALSE); - gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(Statistic_Viewer_Data->Text_V),FALSE); - gtk_container_add (GTK_CONTAINER (Statistic_Viewer_Data->Scroll_Win_Text), Statistic_Viewer_Data->Text_V); - gtk_paned_pack2(GTK_PANED(Statistic_Viewer_Data->HPaned_V), Statistic_Viewer_Data->Scroll_Win_Text, TRUE, FALSE); + gtk_text_view_set_editable(GTK_TEXT_VIEW(statistic_viewer_data->text_v),FALSE); + gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(statistic_viewer_data->text_v),FALSE); + gtk_container_add (GTK_CONTAINER (statistic_viewer_data->scroll_win_text), statistic_viewer_data->text_v); + gtk_paned_pack2(GTK_PANED(statistic_viewer_data->hpaned_v), statistic_viewer_data->scroll_win_text, TRUE, FALSE); - gtk_widget_show(Statistic_Viewer_Data->Scroll_Win_Tree); - gtk_widget_show(Statistic_Viewer_Data->Scroll_Win_Text); - gtk_widget_show(Statistic_Viewer_Data->Tree_V); - gtk_widget_show(Statistic_Viewer_Data->Text_V); - gtk_widget_show(Statistic_Viewer_Data->HPaned_V); + gtk_widget_show(statistic_viewer_data->scroll_win_tree); + gtk_widget_show(statistic_viewer_data->scroll_win_text); + gtk_widget_show(statistic_viewer_data->tree_v); + gtk_widget_show(statistic_viewer_data->text_v); + gtk_widget_show(statistic_viewer_data->hpaned_v); g_object_set_data_full( - G_OBJECT(Statistic_Viewer_Data->HPaned_V), - "Statistic_Viewer_Data", - Statistic_Viewer_Data, - (GDestroyNotify)GuiStatistic_free); + G_OBJECT(statistic_viewer_data->hpaned_v), + "statistic_viewer_data", + statistic_viewer_data, + (GDestroyNotify)gui_statistic_free); /* Add the object's information to the module's array */ - gStatistic_Viewer_Data_List = g_slist_append( - gStatistic_Viewer_Data_List, - Statistic_Viewer_Data); + g_statistic_viewer_data_list = g_slist_append( + g_statistic_viewer_data_list, + statistic_viewer_data); - get_traceset_stats(Statistic_Viewer_Data); + get_traceset_stats(statistic_viewer_data); - return Statistic_Viewer_Data; + return statistic_viewer_data; } void grab_focus(GtkWidget *widget, gpointer data) { - StatisticViewerData *Statistic_Viewer_Data = (StatisticViewerData *)data; - mainWindow * mw = Statistic_Viewer_Data->mw; - SetFocusedPane(mw, gtk_widget_get_parent(Statistic_Viewer_Data->HPaned_V)); + StatisticViewerData *statistic_viewer_data = (StatisticViewerData *)data; + mainWindow * mw = statistic_viewer_data->mw; + SetFocusedPane(mw, gtk_widget_get_parent(statistic_viewer_data->hpaned_v)); } static void tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data) { - StatisticViewerData *Statistic_Viewer_Data = (StatisticViewerData*)data; + StatisticViewerData *statistic_viewer_data = (StatisticViewerData*)data; GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(Statistic_Viewer_Data->Store_M); - gchar *Event; + GtkTreeModel *model = GTK_TREE_MODEL(statistic_viewer_data->store_m); + gchar *event; GtkTextBuffer* buf; gchar * str; GtkTreePath * path; @@ -296,23 +289,23 @@ tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data) if (gtk_tree_selection_get_selected (selection, &model, &iter)) { - gtk_tree_model_get (model, &iter, NAME_COLUMN, &Event, -1); + gtk_tree_model_get (model, &iter, NAME_COLUMN, &event, -1); path = gtk_tree_model_get_path(GTK_TREE_MODEL(model),&iter); str = gtk_tree_path_to_string (path); - stats = (LttvAttribute*)g_hash_table_lookup (Statistic_Viewer_Data->Statistic_Hash,str); + stats = (LttvAttribute*)g_hash_table_lookup (statistic_viewer_data->statistic_hash,str); g_free(str); - buf = gtk_text_view_get_buffer((GtkTextView*)Statistic_Viewer_Data->Text_V); + buf = gtk_text_view_get_buffer((GtkTextView*)statistic_viewer_data->text_v); gtk_text_buffer_set_text(buf,"Statistic for '", -1); gtk_text_buffer_get_end_iter(buf, &text_iter); - gtk_text_buffer_insert(buf, &text_iter, Event, strlen(Event)); + gtk_text_buffer_insert(buf, &text_iter, event, strlen(event)); gtk_text_buffer_get_end_iter(buf, &text_iter); gtk_text_buffer_insert(buf, &text_iter, "' :\n\n",5); - show_statistic(Statistic_Viewer_Data, stats, buf); + show_statistic(statistic_viewer_data, stats, buf); - g_free (Event); + g_free (event); } } @@ -326,7 +319,7 @@ void statistic_destroy_hash_data(gpointer data) // g_free(data); } -void get_traceset_stats(StatisticViewerData * Statistic_Viewer_Data) +void get_traceset_stats(StatisticViewerData * statistic_viewer_data) { LttTime start, end; @@ -335,29 +328,29 @@ void get_traceset_stats(StatisticViewerData * Statistic_Viewer_Data) end.tv_sec = G_MAXULONG; end.tv_nsec = G_MAXULONG; - stateAddEventHooks(Statistic_Viewer_Data->mw); - statsAddEventHooks(Statistic_Viewer_Data->mw); + stateAddEventHooks(statistic_viewer_data->mw); + statsAddEventHooks(statistic_viewer_data->mw); - processTraceset(Statistic_Viewer_Data->mw, start, end, G_MAXULONG); + processTraceset(statistic_viewer_data->mw, start, end, G_MAXULONG); - stateRemoveEventHooks(Statistic_Viewer_Data->mw); - statsRemoveEventHooks(Statistic_Viewer_Data->mw); + stateRemoveEventHooks(statistic_viewer_data->mw); + statsRemoveEventHooks(statistic_viewer_data->mw); //establish tree view for stats - show_traceset_stats(Statistic_Viewer_Data); + show_traceset_stats(statistic_viewer_data); } -void show_traceset_stats(StatisticViewerData * Statistic_Viewer_Data) +void show_traceset_stats(StatisticViewerData * statistic_viewer_data) { int i, nb; LttvTraceset *ts; LttvTraceStats *tcs; LttSystemDescription *desc; - LttvTracesetStats * tscs = Statistic_Viewer_Data->stats; + LttvTracesetStats * tscs = statistic_viewer_data->stats; gchar * str, trace_str[PATH_LENGTH]; GtkTreePath * path; GtkTreeIter iter; - GtkTreeStore * store = Statistic_Viewer_Data->Store_M; + GtkTreeStore * store = statistic_viewer_data->store_m; if(tscs->stats == NULL) return; @@ -367,9 +360,9 @@ void show_traceset_stats(StatisticViewerData * Statistic_Viewer_Data) -1); path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); str = gtk_tree_path_to_string (path); - g_hash_table_insert(Statistic_Viewer_Data->Statistic_Hash, + g_hash_table_insert(statistic_viewer_data->statistic_hash, (gpointer)str, tscs->stats); - show_tree(Statistic_Viewer_Data, tscs->stats, &iter); + show_tree(statistic_viewer_data, tscs->stats, &iter); //show stats for all traces ts = tscs->parent.parent.ts; @@ -385,13 +378,13 @@ void show_traceset_stats(StatisticViewerData * Statistic_Viewer_Data) gtk_tree_store_set (store, &iter,NAME_COLUMN,trace_str,-1); path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); str = gtk_tree_path_to_string (path); - g_hash_table_insert(Statistic_Viewer_Data->Statistic_Hash, + g_hash_table_insert(statistic_viewer_data->statistic_hash, (gpointer)str,tcs->stats); - show_tree(Statistic_Viewer_Data, tcs->stats, &iter); + show_tree(statistic_viewer_data, tcs->stats, &iter); } } -void show_tree(StatisticViewerData * Statistic_Viewer_Data, +void show_tree(StatisticViewerData * statistic_viewer_data, LttvAttribute* stats, GtkTreeIter* parent) { int i, nb; @@ -402,7 +395,7 @@ void show_tree(StatisticViewerData * Statistic_Viewer_Data, gchar * str, dir_str[PATH_LENGTH]; GtkTreePath * path; GtkTreeIter iter; - GtkTreeStore * store = Statistic_Viewer_Data->Store_M; + GtkTreeStore * store = statistic_viewer_data->store_m; nb = lttv_attribute_get_number(stats); for(i = 0 ; i < nb ; i++) { @@ -416,9 +409,9 @@ void show_tree(StatisticViewerData * Statistic_Viewer_Data, gtk_tree_store_set (store, &iter,NAME_COLUMN,dir_str,-1); path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); str = gtk_tree_path_to_string (path); - g_hash_table_insert(Statistic_Viewer_Data->Statistic_Hash, + g_hash_table_insert(statistic_viewer_data->statistic_hash, (gpointer)str, subtree); - show_tree(Statistic_Viewer_Data, subtree, &iter); + show_tree(statistic_viewer_data, subtree, &iter); } break; default: @@ -427,7 +420,7 @@ void show_tree(StatisticViewerData * Statistic_Viewer_Data, } } -void show_statistic(StatisticViewerData * Statistic_Viewer_Data, +void show_statistic(StatisticViewerData * statistic_viewer_data, LttvAttribute* stats, GtkTextBuffer* buf) { int i, nb , flag;