+ControlFlowData *
+GuiControlFlow(void)
+{
+
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+
+ ControlFlowData* Control_Flow_Data = g_new(ControlFlowData,1) ;
+ Control_Flow_Data->Drawing_Area_V = gtk_drawing_area_new ();
+
+
+ /* TEST DATA, TO BE READ FROM THE TRACE */
+ Control_Flow_Data->Number_Of_Events = 1000 ;
+ Control_Flow_Data->Currently_Selected_Event = FALSE ;
+ Control_Flow_Data->Selected_Event = 0;
+ Control_Flow_Data->Number_Of_Process = 10;
+
+ /* FIXME register Event_Selected_Hook */
+
+
+
+ /* Create the Process list */
+ Control_Flow_Data->Store_M = gtk_list_store_new ( N_COLUMNS,
+ G_TYPE_STRING);
+
+
+ Control_Flow_Data->Process_List_VC = gtk_tree_view_new_with_model (GTK_TREE_MODEL (Control_Flow_Data->Store_M));
+
+ g_object_unref (G_OBJECT (Control_Flow_Data->Store_M));
+
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(Control_Flow_Data->Process_List_VC), FALSE);
+
+ /* Create a column, associating the "text" attribute of the
+ * cell_renderer to the first column of the model */
+ /* Columns alignment : 0.0 : Left 0.5 : Center 1.0 : Right */
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Process",
+ renderer,
+ "text", PROCESS_COLUMN,
+ 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 (Control_Flow_Data->Process_List_VC), column);
+
+
+
+ Control_Flow_Data->Inside_HBox_V = gtk_hbox_new(0, 0);
+
+ gtk_box_pack_start(GTK_BOX(Control_Flow_Data->Inside_HBox_V), Control_Flow_Data->Process_List_VC, FALSE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(Control_Flow_Data->Inside_HBox_V), Control_Flow_Data->Drawing_Area_V, TRUE, TRUE, 0);
+
+
+ Control_Flow_Data->VAdjust_C = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, /* Value */
+ 0.0, /* Lower */
+ 0.0, /* Upper */
+ 0.0, /* Step inc. */
+ 0.0, /* Page inc. */
+ 0.0 )); /* page size */
+
+
+ Control_Flow_Data->Scrolled_Window_VC = gtk_scrolled_window_new (NULL,
+ Control_Flow_Data->VAdjust_C);
+ gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC) ,
+ GTK_POLICY_NEVER,
+ GTK_POLICY_AUTOMATIC);
+
+ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC),
+ Control_Flow_Data->Inside_HBox_V);
+
+
+ g_signal_connect (G_OBJECT (Control_Flow_Data->Drawing_Area_V), "expose_event",
+ G_CALLBACK (expose_event_cb), Control_Flow_Data);
+
+
+
+ g_signal_connect (G_OBJECT (Control_Flow_Data->VAdjust_C), "value-changed",
+ G_CALLBACK (v_scroll_cb),
+ Control_Flow_Data);
+
+ add_test_process(Control_Flow_Data);
+
+
+
+ /* Set the size of the drawing area */
+ Drawing_Area_Init(Control_Flow_Data);
+
+ /* Get trace statistics */
+ Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
+
+
+ gtk_widget_show(Control_Flow_Data->Drawing_Area_V);
+ gtk_widget_show(Control_Flow_Data->Process_List_VC);
+ gtk_widget_show(Control_Flow_Data->Inside_HBox_V);
+ gtk_widget_show(Control_Flow_Data->Scrolled_Window_VC);
+
+ test_draw(Control_Flow_Data);
+
+ return Control_Flow_Data;
+
+}
+
+void
+GuiControlFlow_Destructor(ControlFlowData *Control_Flow_Data)
+{
+ guint index;
+
+ /* 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);
+
+ /* Destroy the Tree View */
+ //gtk_widget_destroy(Control_Flow_Data->Tree_V);
+
+ /* Clear raw event list */
+ //gtk_list_store_clear(Control_Flow_Data->Store_M);
+ //gtk_widget_destroy(GTK_WIDGET(Control_Flow_Data->Store_M));
+
+ g_slist_remove(sControl_Flow_Data_List,Control_Flow_Data);
+}
+
+//FIXME : call hGuiEvents_Destructor for corresponding data upon widget destroy
+
+
+
+/*****************************************************************************
+ * Drawing functions *
+ *****************************************************************************/
+
+typedef enum
+{
+ RED,
+ GREEN,
+ BLUE,
+ WHITE,
+ BLACK
+
+} ControlFlowColors;
+
+/* Vector of unallocated colors */
+static GdkColor CF_Colors [] =
+{
+ { 0, 0xffff, 0x0000, 0x0000 }, // RED
+ { 0, 0x0000, 0xffff, 0x0000 }, // GREEN
+ { 0, 0x0000, 0x0000, 0xffff }, // BLUE
+ { 0, 0xffff, 0xffff, 0xffff }, // WHITE
+ { 0, 0x0000, 0x0000, 0x0000 } // BLACK
+};
+
+
+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;
+
+ gtk_tree_view_column_cell_get_size(Column, NULL, NULL, NULL, NULL, &height);
+ g_critical("cell 0 height : %u",height);
+
+ return height;
+}
+
+
+/* get_time_from_pixels
+ *
+ * Get the time interval from window time and pixels, and pixels requested. This
+ * function uses TimeMul, which should only be used if the float value is lower
+ * that 4, and here it's always lower than 1, so it's ok.
+ */
+void get_time_from_pixels(guint area_x, guint area_width,
+ guint window_width,
+ ltt_time &window_time_begin, ltt_time &window_time_end,
+ ltt_time &time_begin, ltt_time &time_end)
+{
+ ltt_time window_time_interval;
+
+ TimeSub(window_time_interval, window_time_end, window_time_begin);
+
+
+ TimeMul(time_begin, window_time_interval, (area_x/(float)window_width));
+ TimeAdd(time_begin, window_time_begin, time_begin);
+
+ TimeMul(time_end, window_time_interval, (area_width/(float)window_width));
+ TimeAdd(time_end, time_begin, time_end);
+
+}
+
+void Drawing_Area_Init(ControlFlowData *Control_Flow_Data)
+{
+ DrawingAreaInfo *Drawing_Area_Info = &Control_Flow_Data->Drawing_Area_Info;
+ guint w;
+
+ w = 500;
+
+
+ Drawing_Area_Info->height =
+ get_cell_height(GTK_TREE_VIEW(Control_Flow_Data->Process_List_VC))
+ * Control_Flow_Data->Number_Of_Process ;
+
+ gtk_widget_modify_bg(Control_Flow_Data->Drawing_Area_V,
+ GTK_STATE_NORMAL,
+ &CF_Colors[BLACK]);
+
+
+ gtk_widget_set_size_request (Control_Flow_Data->Drawing_Area_V,
+ w,
+ Drawing_Area_Info->height);
+
+
+}
+
+
+
+void add_test_process(ControlFlowData *Control_Flow_Data)
+{
+ GtkTreeIter iter;
+ int i;
+ gchar *process[] = { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" };
+
+ for(i=0; i<Control_Flow_Data->Number_Of_Process; i++)
+ {
+ /* Add a new row to the model */
+ gtk_list_store_append (Control_Flow_Data->Store_M, &iter);
+ gtk_list_store_set (Control_Flow_Data->Store_M, &iter,
+ PROCESS_COLUMN, process[i],
+ -1);
+ }
+
+}
+
+
+
+void test_draw(ControlFlowData *Control_Flow_Data)
+{
+ /* Draw event states using available height, Number of process, cell height
+ * (don't forget to remove two pixels at beginning and end).
+ * For horizontal : use width, Time_Begin, Time_End.
+ * This function calls the reading library to get the draw_hook called
+ * for the desired period of time. */
+
+ DrawingAreaInfo *Drawing_Area_Info = &Control_Flow_Data->Drawing_Area_Info;
+
+
+}
+
+
+/*****************************************************************************
+ * Hooks to be called by the main window *
+ *****************************************************************************/
+/**
+ * Event Viewer's constructor hook
+ *
+ * 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.
+ * @return The widget created.
+ */
+GtkWidget *
+hGuiControlFlow(GtkWidget *pmParentWindow)