8 #include "Process_List.h"
11 extern GSList
*gControl_Flow_Data_List
;
13 /*****************************************************************************
14 * Control Flow Viewer class implementation *
15 *****************************************************************************/
18 struct _ControlFlowData
{
20 GtkWidget
*Scrolled_Window_VC
;
22 ProcessList
*Process_List
;
26 GtkWidget
*Inside_HBox_V
;
28 GtkAdjustment
*VAdjust_C
;
30 /* Trace information */
31 //TraceSet *Trace_Set;
32 //TraceStatistics *Trace_Statistics;
34 /* Shown events information */
35 guint First_Event
, Last_Event
;
36 LttTime Begin_Time
, End_Time
;
39 /* TEST DATA, TO BE READ FROM THE TRACE */
40 gint Number_Of_Events
;
41 guint Currently_Selected_Event
;
42 gboolean Selected_Event
;
43 guint Number_Of_Process
;
49 * Control Flow Viewer's constructor
51 * This constructor is given as a parameter to the menuitem and toolbar button
52 * registration. It creates the drawing widget.
53 * @param ParentWindow A pointer to the parent window.
54 * @return The widget created.
59 GtkWidget
*Process_List_Widget
, *Drawing_Widget
;
61 ControlFlowData
* Control_Flow_Data
= g_new(ControlFlowData
,1) ;
63 /* Create the Drawing */
64 Control_Flow_Data
->Drawing
= Drawing_construct();
67 Drawing_getWidget(Control_Flow_Data
->Drawing
);
69 /* TEST DATA, TO BE READ FROM THE TRACE */
70 Control_Flow_Data
->Number_Of_Events
= 1000 ;
71 Control_Flow_Data
->Currently_Selected_Event
= FALSE
;
72 Control_Flow_Data
->Selected_Event
= 0;
73 Control_Flow_Data
->Number_Of_Process
= 10;
75 /* FIXME register Event_Selected_Hook */
79 /* Create the Process list */
80 Control_Flow_Data
->Process_List
= ProcessList_construct();
83 ProcessList_getWidget(Control_Flow_Data
->Process_List
);
85 Control_Flow_Data
->Inside_HBox_V
= gtk_hbox_new(0, 0);
88 GTK_BOX(Control_Flow_Data
->Inside_HBox_V
),
89 Process_List_Widget
, FALSE
, TRUE
, 0); // FALSE TRUE
91 GTK_BOX(Control_Flow_Data
->Inside_HBox_V
),
92 Drawing_Widget
, TRUE
, TRUE
, 0);
95 Control_Flow_Data
->VAdjust_C
=
96 GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */
101 0.0)); /* page size */
103 Control_Flow_Data
->Scrolled_Window_VC
=
104 gtk_scrolled_window_new (NULL
,
105 Control_Flow_Data
->VAdjust_C
);
107 gtk_scrolled_window_set_policy(
108 GTK_SCROLLED_WINDOW(Control_Flow_Data
->Scrolled_Window_VC
) ,
110 GTK_POLICY_AUTOMATIC
);
112 gtk_scrolled_window_add_with_viewport(
113 GTK_SCROLLED_WINDOW(Control_Flow_Data
->Scrolled_Window_VC
),
114 Control_Flow_Data
->Inside_HBox_V
);
117 //g_signal_connect (G_OBJECT (Control_Flow_Data->Drawing_Area_V),
119 // G_CALLBACK (expose_event_cb),
120 // Control_Flow_Data);
124 //g_signal_connect (G_OBJECT (Control_Flow_Data->VAdjust_C),
126 // G_CALLBACK (v_scroll_cb),
127 // Control_Flow_Data);
130 /* Set the size of the drawing area */
131 //Drawing_Resize(Drawing, h, w);
133 /* Get trace statistics */
134 //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
137 gtk_widget_show(Drawing_Widget
);
138 gtk_widget_show(Process_List_Widget
);
139 gtk_widget_show(Control_Flow_Data
->Inside_HBox_V
);
140 gtk_widget_show(Control_Flow_Data
->Scrolled_Window_VC
);
142 g_object_set_data_full(
143 G_OBJECT(Control_Flow_Data
->Scrolled_Window_VC
),
146 (GDestroyNotify
)GuiControlFlow_Destructor
);
148 g_slist_append(gControl_Flow_Data_List
,Control_Flow_Data
);
150 return Control_Flow_Data
;
154 /* Destroys widget also */
156 GuiControlFlow_Destructor_Full(ControlFlowData
*Control_Flow_Data
)
158 /* May already have been done by GTK window closing */
159 if(GTK_IS_WIDGET(Control_Flow_Data
->Scrolled_Window_VC
))
160 gtk_widget_destroy(Control_Flow_Data
->Scrolled_Window_VC
);
162 GuiControlFlow_Destructor(Control_Flow_Data
);
166 GuiControlFlow_Destructor(ControlFlowData
*Control_Flow_Data
)
170 /* Process List is removed with it's widget */
171 //ProcessList_destroy(Control_Flow_Data->Process_List);
173 g_slist_remove(gControl_Flow_Data_List
,Control_Flow_Data
);
174 g_free(Control_Flow_Data
);
177 GtkWidget
*GuiControlFlow_get_Widget(ControlFlowData
*Control_Flow_Data
)
179 return Control_Flow_Data
->Scrolled_Window_VC
;