8 #include "Process_List.h"
9 #include "Event_Hooks.h"
10 #include "CFV-private.h"
13 extern GSList
*gControl_Flow_Data_List
;
15 /*****************************************************************************
16 * Control Flow Viewer class implementation *
17 *****************************************************************************/
19 * Control Flow Viewer's constructor
21 * This constructor is given as a parameter to the menuitem and toolbar button
22 * registration. It creates the drawing widget.
23 * @param ParentWindow A pointer to the parent window.
24 * @return The widget created.
29 GtkWidget
*Process_List_Widget
, *Drawing_Widget
;
31 ControlFlowData
* Control_Flow_Data
= g_new(ControlFlowData
,1) ;
33 /* Create the Drawing */
34 Control_Flow_Data
->Drawing
= Drawing_construct(Control_Flow_Data
);
37 Drawing_getWidget(Control_Flow_Data
->Drawing
);
39 /* TEST DATA, TO BE READ FROM THE TRACE */
40 Control_Flow_Data
->Number_Of_Events
= 1000 ;
41 Control_Flow_Data
->Currently_Selected_Event
= FALSE
;
42 Control_Flow_Data
->Selected_Event
= 0;
43 Control_Flow_Data
->Number_Of_Process
= 10;
45 /* FIXME register Event_Selected_Hook */
49 /* Create the Process list */
50 Control_Flow_Data
->Process_List
= ProcessList_construct();
53 ProcessList_getWidget(Control_Flow_Data
->Process_List
);
55 Control_Flow_Data
->Inside_HBox_V
= gtk_hbox_new(0, 0);
58 GTK_BOX(Control_Flow_Data
->Inside_HBox_V
),
59 Process_List_Widget
, FALSE
, TRUE
, 0); // FALSE TRUE
61 GTK_BOX(Control_Flow_Data
->Inside_HBox_V
),
62 Drawing_Widget
, TRUE
, TRUE
, 0);
65 Control_Flow_Data
->VAdjust_C
=
66 GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */
71 0.0)); /* page size */
73 Control_Flow_Data
->Scrolled_Window_VC
=
74 gtk_scrolled_window_new (NULL
,
75 Control_Flow_Data
->VAdjust_C
);
77 gtk_scrolled_window_set_policy(
78 GTK_SCROLLED_WINDOW(Control_Flow_Data
->Scrolled_Window_VC
) ,
80 GTK_POLICY_AUTOMATIC
);
82 gtk_scrolled_window_add_with_viewport(
83 GTK_SCROLLED_WINDOW(Control_Flow_Data
->Scrolled_Window_VC
),
84 Control_Flow_Data
->Inside_HBox_V
);
87 //g_signal_connect (G_OBJECT (Control_Flow_Data->Drawing_Area_V),
89 // G_CALLBACK (expose_event_cb),
90 // Control_Flow_Data);
94 //g_signal_connect (G_OBJECT (Control_Flow_Data->VAdjust_C),
96 // G_CALLBACK (v_scroll_cb),
97 // Control_Flow_Data);
100 /* Set the size of the drawing area */
101 //Drawing_Resize(Drawing, h, w);
103 /* Get trace statistics */
104 //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
107 gtk_widget_show(Drawing_Widget
);
108 gtk_widget_show(Process_List_Widget
);
109 gtk_widget_show(Control_Flow_Data
->Inside_HBox_V
);
110 gtk_widget_show(Control_Flow_Data
->Scrolled_Window_VC
);
112 g_object_set_data_full(
113 G_OBJECT(Control_Flow_Data
->Scrolled_Window_VC
),
116 (GDestroyNotify
)GuiControlFlow_Destructor
);
118 gControl_Flow_Data_List
= g_slist_append(
119 gControl_Flow_Data_List
,
122 //WARNING : The widget must be
123 //inserted in the main window before the Drawing area
124 //can be configured (and this must happend bedore sending
127 return Control_Flow_Data
;
131 /* Destroys widget also */
133 GuiControlFlow_Destructor_Full(ControlFlowData
*Control_Flow_Data
)
135 /* May already have been done by GTK window closing */
136 if(GTK_IS_WIDGET(Control_Flow_Data
->Scrolled_Window_VC
))
137 gtk_widget_destroy(Control_Flow_Data
->Scrolled_Window_VC
);
139 GuiControlFlow_Destructor(Control_Flow_Data
);
143 GuiControlFlow_Destructor(ControlFlowData
*Control_Flow_Data
)
147 /* Process List is removed with it's widget */
148 //ProcessList_destroy(Control_Flow_Data->Process_List);
149 unreg_update_time_window(Update_Time_Window_Hook
,
151 Control_Flow_Data
->Scrolled_Window_VC
->parent
);
153 unreg_update_current_time(Update_Current_Time_Hook
,
155 Control_Flow_Data
->Scrolled_Window_VC
->parent
);
157 g_slist_remove(gControl_Flow_Data_List
,Control_Flow_Data
);
158 g_free(Control_Flow_Data
);
161 GtkWidget
*GuiControlFlow_get_Widget(ControlFlowData
*Control_Flow_Data
)
163 return Control_Flow_Data
->Scrolled_Window_VC
;
166 ProcessList
*GuiControlFlow_get_Process_List
167 (ControlFlowData
*Control_Flow_Data
)
169 return Control_Flow_Data
->Process_List
;
172 TimeWindow
*GuiControlFlow_get_Time_Window(ControlFlowData
*Control_Flow_Data
)
174 return &Control_Flow_Data
->Time_Window
;
176 LttTime
*GuiControlFlow_get_Current_Time(ControlFlowData
*Control_Flow_Data
)
178 return &Control_Flow_Data
->Current_Time
;