X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2FguiControlFlow%2FCFV.c;h=109d5a03265ea4a2a2b7f48e8db4522b0e01ae80;hb=4c69e0cc2b20bbe101918f769842e31101045767;hp=9855da64bebbcc5fbe2a0609908ab0aa8fb1a8f0;hpb=f0d936c08dae39e9a913357a49885b4937aca847;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/CFV.c b/ltt/branches/poly/lttv/modules/guiControlFlow/CFV.c index 9855da64..109d5a03 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/CFV.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/CFV.c @@ -6,50 +6,15 @@ #include "CFV.h" #include "Drawing.h" #include "Process_List.h" +#include "Event_Hooks.h" +#include "CFV-private.h" -#include "../icons/hGuiControlFlowInsert.xpm" +extern GSList *gControl_Flow_Data_List; /***************************************************************************** * Control Flow Viewer class implementation * *****************************************************************************/ - - -typedef struct _ControlFlowData { - - GtkWidget *Drawing_Area_V; - GtkWidget *Scrolled_Window_VC; - - ProcessList *Process_List; - Drawing_t *Drawing; - - GtkWidget *HBox_V; - GtkWidget *Inside_HBox_V; - - GtkAdjustment *VAdjust_C ; - - /* Trace information */ - TraceSet *Trace_Set; - TraceStatistics *Trace_Statistics; - - /* Shown events information */ - guint First_Event, Last_Event; - ltt_time Begin_Time, End_Time; - - - /* TEST DATA, TO BE READ FROM THE TRACE */ - gint Number_Of_Events ; - guint Currently_Selected_Event ; - gboolean Selected_Event ; - guint Number_Of_Process; - -} ControlFlowData ; - - -/** Array containing instanced objects. Used when module is unloaded */ -static GSList *sControl_Flow_Data_List = NULL ; - - /** * Control Flow Viewer's constructor * @@ -59,14 +24,17 @@ static GSList *sControl_Flow_Data_List = NULL ; * @return The widget created. */ ControlFlowData * -GuiControlFlow(void) +guicontrolflow(void) { - GtkWidget *Process_List_Widget; + GtkWidget *Process_List_Widget, *Drawing_Widget; ControlFlowData* Control_Flow_Data = g_new(ControlFlowData,1) ; /* Create the Drawing */ - //Control_Flow_Data->Drawing = Drawing(); + Control_Flow_Data->Drawing = drawing_construct(Control_Flow_Data); + + Drawing_Widget = + drawing_get_widget(Control_Flow_Data->Drawing); /* TEST DATA, TO BE READ FROM THE TRACE */ Control_Flow_Data->Number_Of_Events = 1000 ; @@ -79,19 +47,19 @@ GuiControlFlow(void) /* Create the Process list */ - //Control_Flow_Data->Process_List = ProcessList(); + Control_Flow_Data->Process_List = processlist_construct(); - //Process_List_Widget = - // ProcessList_getWidget(Control_Flow_Data->Process_List); + Process_List_Widget = + processlist_get_widget(Control_Flow_Data->Process_List); Control_Flow_Data->Inside_HBox_V = gtk_hbox_new(0, 0); - //gtk_box_pack_start( - // GTK_BOX(Control_Flow_Data->Inside_HBox_V), - // Process_List_Widget, FALSE, TRUE, 0); - //gtk_box_pack_start( - // GTK_BOX(Control_Flow_Data->Inside_HBox_V), - // Control_Flow_Data->Drawing_Area_V, TRUE, TRUE, 0); + gtk_box_pack_start( + GTK_BOX(Control_Flow_Data->Inside_HBox_V), + Process_List_Widget, FALSE, TRUE, 0); // FALSE TRUE + gtk_box_pack_start( + GTK_BOX(Control_Flow_Data->Inside_HBox_V), + Drawing_Widget, TRUE, TRUE, 0); Control_Flow_Data->VAdjust_C = @@ -102,7 +70,6 @@ GuiControlFlow(void) 0.0, /* Page inc. */ 0.0)); /* page size */ - Control_Flow_Data->Scrolled_Window_VC = gtk_scrolled_window_new (NULL, Control_Flow_Data->VAdjust_C); @@ -137,36 +104,78 @@ GuiControlFlow(void) //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace); - gtk_widget_show(Control_Flow_Data->Drawing_Area_V); + gtk_widget_show(Drawing_Widget); gtk_widget_show(Process_List_Widget); gtk_widget_show(Control_Flow_Data->Inside_HBox_V); gtk_widget_show(Control_Flow_Data->Scrolled_Window_VC); - + g_object_set_data_full( - G_OBJECT(Control_Flow_Data->HBox_V), + G_OBJECT(Control_Flow_Data->Scrolled_Window_VC), "Control_Flow_Data", Control_Flow_Data, - GuiControlFlow_Destructor); + (GDestroyNotify)guicontrolflow_destructor); + gControl_Flow_Data_List = g_slist_append( + gControl_Flow_Data_List, + Control_Flow_Data); + + //WARNING : The widget must be + //inserted in the main window before the Drawing area + //can be configured (and this must happend bedore sending + //data) return Control_Flow_Data; } +/* Destroys widget also */ void -GuiControlFlow_Destructor(ControlFlowData *Control_Flow_Data) +guicontrolflow_destructor_full(ControlFlowData *Control_Flow_Data) { - guint index; + /* May already have been done by GTK window closing */ + if(GTK_IS_WIDGET(Control_Flow_Data->Scrolled_Window_VC)) + gtk_widget_destroy(Control_Flow_Data->Scrolled_Window_VC); + + guicontrolflow_destructor(Control_Flow_Data); +} - /* May already been done by GTK window closing */ - if(GTK_IS_WIDGET(Control_Flow_Data->HBox_V)) - gtk_widget_destroy(Control_Flow_Data->HBox_V); +void +guicontrolflow_destructor(ControlFlowData *Control_Flow_Data) +{ + guint index; - ProcessList_destroy(Control_Flow_Data->Process_List); + /* Process List is removed with it's widget */ + //ProcessList_destroy(Control_Flow_Data->Process_List); + unreg_update_time_window(Update_Time_Window_Hook, + Control_Flow_Data, + Control_Flow_Data->Scrolled_Window_VC->parent); - g_slist_remove(sControl_Flow_Data_List,Control_Flow_Data); + unreg_update_current_time(Update_Current_Time_Hook, + Control_Flow_Data, + Control_Flow_Data->Scrolled_Window_VC->parent); + + g_slist_remove(gControl_Flow_Data_List,Control_Flow_Data); + g_free(Control_Flow_Data); } -//FIXME : call hGuiEvents_Destructor for corresponding data upon widget destroy +GtkWidget *guicontrolflow_get_widget(ControlFlowData *Control_Flow_Data) +{ + return Control_Flow_Data->Scrolled_Window_VC ; +} + +ProcessList *guicontrolflow_get_process_list + (ControlFlowData *Control_Flow_Data) +{ + return Control_Flow_Data->Process_List ; +} + +TimeWindow *guicontrolflow_get_time_window(ControlFlowData *Control_Flow_Data) +{ + return &Control_Flow_Data->Time_Window; +} +LttTime *guicontrolflow_get_current_time(ControlFlowData *Control_Flow_Data) +{ + return &Control_Flow_Data->Current_Time; +}