update pid for all tracefiles of a trace
[lttv.git] / ltt / branches / poly / lttv / modules / guiControlFlow / CFV.c
index 18f3b52e4e484a31907d0c2cda856f8bb728b813..fa8b6a3fe77b25301d393a98a2f8f33a9236445c 100644 (file)
@@ -6,46 +6,18 @@
 #include "CFV.h"
 #include "Drawing.h"
 #include "Process_List.h"
+#include "Event_Hooks.h"
+#include "CFV-private.h"
 
 
+#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
+#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
+
 extern GSList *gControl_Flow_Data_List;
 
 /*****************************************************************************
  *                     Control Flow Viewer class implementation              *
  *****************************************************************************/
-
-
-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;
-       LttTime 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;
-
-} ;
-
-
 /**
  * Control Flow Viewer's constructor
  *
@@ -55,14 +27,17 @@ struct _ControlFlowData {
  * @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 ;
@@ -75,19 +50,19 @@ GuiControlFlow(void)
 
 
        /* Create the Process list */
-       Control_Flow_Data->Process_List = ProcessList_construct();
+       Control_Flow_Data->Process_List = processlist_construct();
        
        Process_List_Widget = 
-               ProcessList_getWidget(Control_Flow_Data->Process_List);
+               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, TRUE, TRUE, 0); // FALSE TRUE
-       //gtk_box_pack_start(
-       //      GTK_BOX(Control_Flow_Data->Inside_HBox_V),
-       //      Control_Flow_Data->Drawing_Area_V, TRUE, TRUE, 0);
+               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 = 
@@ -132,7 +107,7 @@ 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);
@@ -141,9 +116,16 @@ GuiControlFlow(void)
                        G_OBJECT(Control_Flow_Data->Scrolled_Window_VC),
                        "Control_Flow_Data",
                        Control_Flow_Data,
-                       (GDestroyNotify)GuiControlFlow_Destructor);
+                       (GDestroyNotify)guicontrolflow_destructor);
                        
-       g_slist_append(gControl_Flow_Data_List,Control_Flow_Data);
+       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;
 
@@ -151,29 +133,59 @@ GuiControlFlow(void)
 
 /* Destroys widget also */
 void
-GuiControlFlow_Destructor_Full(ControlFlowData *Control_Flow_Data)
+guicontrolflow_destructor_full(ControlFlowData *Control_Flow_Data)
 {
+       g_info("CFV.c : guicontrolflow_destructor_full, %p", Control_Flow_Data);
        /* 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);
+       //Control_Flow_Data->Parent_Window = NULL;
+       //FIXME guicontrolflow_destructor(Control_Flow_Data);
 }
 
+/* When this destructor is called, the widgets are already disconnected */
 void
-GuiControlFlow_Destructor(ControlFlowData *Control_Flow_Data)
+guicontrolflow_destructor(ControlFlowData *Control_Flow_Data)
 {
        guint index;
        
+       g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data);
+       g_info("%p, %p, %p", update_time_window_hook, Control_Flow_Data, Control_Flow_Data->Parent_Window);
        /* Process List is removed with it's widget */
        //ProcessList_destroy(Control_Flow_Data->Process_List);
-       
+       if(Control_Flow_Data->Parent_Window != NULL)
+       {
+               unreg_update_time_window(update_time_window_hook,
+                               Control_Flow_Data,
+                               Control_Flow_Data->Parent_Window);
+       
+               unreg_update_current_time(update_current_time_hook,
+                               Control_Flow_Data,
+                               Control_Flow_Data->Parent_Window);
+       }
+       g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data);
        g_slist_remove(gControl_Flow_Data_List,Control_Flow_Data);
        g_free(Control_Flow_Data);
 }
 
-GtkWidget *GuiControlFlow_get_Widget(ControlFlowData *Control_Flow_Data)
+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;
+}
+
+
This page took 0.03111 seconds and 4 git commands to generate.