8 #include "Process_List.h"
9 #include "Event_Hooks.h"
10 #include "CFV-private.h"
13 #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
14 #define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
16 extern GSList
*gControl_Flow_Data_List
;
18 /*****************************************************************************
19 * Control Flow Viewer class implementation *
20 *****************************************************************************/
22 * Control Flow Viewer's constructor
24 * This constructor is given as a parameter to the menuitem and toolbar button
25 * registration. It creates the drawing widget.
26 * @param ParentWindow A pointer to the parent window.
27 * @return The widget created.
32 GtkWidget
*Process_List_Widget
, *Drawing_Widget
;
34 ControlFlowData
* Control_Flow_Data
= g_new(ControlFlowData
,1) ;
36 /* Create the Drawing */
37 Control_Flow_Data
->Drawing
= drawing_construct(Control_Flow_Data
);
40 drawing_get_widget(Control_Flow_Data
->Drawing
);
42 /* TEST DATA, TO BE READ FROM THE TRACE */
43 Control_Flow_Data
->Number_Of_Events
= 1000 ;
44 Control_Flow_Data
->Currently_Selected_Event
= FALSE
;
45 Control_Flow_Data
->Selected_Event
= 0;
46 Control_Flow_Data
->Number_Of_Process
= 10;
48 /* FIXME register Event_Selected_Hook */
52 /* Create the Process list */
53 Control_Flow_Data
->Process_List
= processlist_construct();
56 processlist_get_widget(Control_Flow_Data
->Process_List
);
58 //Control_Flow_Data->Inside_HBox_V = gtk_hbox_new(0, 0);
59 Control_Flow_Data
->HPaned
= gtk_hpaned_new();
62 // GTK_BOX(Control_Flow_Data->Inside_HBox_V),
63 // Process_List_Widget, FALSE, TRUE, 0); // FALSE TRUE
65 // GTK_BOX(Control_Flow_Data->Inside_HBox_V),
66 // Drawing_Widget, TRUE, TRUE, 0);
67 gtk_paned_pack1(GTK_PANED(Control_Flow_Data
->HPaned
), Process_List_Widget
, FALSE
, TRUE
);
68 gtk_paned_pack2(GTK_PANED(Control_Flow_Data
->HPaned
), Drawing_Widget
, TRUE
, TRUE
);
70 Control_Flow_Data
->VAdjust_C
=
71 GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */
76 0.0)); /* page size */
78 Control_Flow_Data
->Scrolled_Window_VC
=
79 gtk_scrolled_window_new (NULL
,
80 Control_Flow_Data
->VAdjust_C
);
82 gtk_scrolled_window_set_policy(
83 GTK_SCROLLED_WINDOW(Control_Flow_Data
->Scrolled_Window_VC
) ,
85 GTK_POLICY_AUTOMATIC
);
87 gtk_scrolled_window_add_with_viewport(
88 GTK_SCROLLED_WINDOW(Control_Flow_Data
->Scrolled_Window_VC
),
89 //Control_Flow_Data->Inside_HBox_V);
90 Control_Flow_Data
->HPaned
);
92 //g_signal_connect (G_OBJECT (Control_Flow_Data->Drawing_Area_V),
94 // G_CALLBACK (expose_event_cb),
95 // Control_Flow_Data);
99 //g_signal_connect (G_OBJECT (Control_Flow_Data->VAdjust_C),
101 // G_CALLBACK (v_scroll_cb),
102 // Control_Flow_Data);
105 /* Set the size of the drawing area */
106 //Drawing_Resize(Drawing, h, w);
108 /* Get trace statistics */
109 //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
112 gtk_widget_show(Drawing_Widget
);
113 gtk_widget_show(Process_List_Widget
);
114 //gtk_widget_show(Control_Flow_Data->Inside_HBox_V);
115 gtk_widget_show(Control_Flow_Data
->HPaned
);
116 gtk_widget_show(Control_Flow_Data
->Scrolled_Window_VC
);
118 g_object_set_data_full(
119 G_OBJECT(Control_Flow_Data
->Scrolled_Window_VC
),
122 (GDestroyNotify
)guicontrolflow_destructor
);
125 G_OBJECT(Drawing_Widget
),
129 gControl_Flow_Data_List
= g_slist_append(
130 gControl_Flow_Data_List
,
133 //WARNING : The widget must be
134 //inserted in the main window before the Drawing area
135 //can be configured (and this must happend bedore sending
138 return Control_Flow_Data
;
142 /* Destroys widget also */
144 guicontrolflow_destructor_full(ControlFlowData
*Control_Flow_Data
)
146 g_info("CFV.c : guicontrolflow_destructor_full, %p", Control_Flow_Data
);
147 /* May already have been done by GTK window closing */
148 if(GTK_IS_WIDGET(Control_Flow_Data
->Scrolled_Window_VC
))
149 gtk_widget_destroy(Control_Flow_Data
->Scrolled_Window_VC
);
150 //Control_Flow_Data->Parent_Window = NULL;
151 //FIXME guicontrolflow_destructor(Control_Flow_Data);
154 /* When this destructor is called, the widgets are already disconnected */
156 guicontrolflow_destructor(ControlFlowData
*Control_Flow_Data
)
160 g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data
);
161 g_info("%p, %p, %p", update_time_window_hook
, Control_Flow_Data
, Control_Flow_Data
->Parent_Window
);
162 if(GTK_IS_WIDGET(Control_Flow_Data
->Scrolled_Window_VC
))
163 g_info("widget still exists");
165 /* Process List is removed with it's widget */
166 //ProcessList_destroy(Control_Flow_Data->Process_List);
167 if(Control_Flow_Data
->Parent_Window
!= NULL
)
169 unreg_update_time_window(update_time_window_hook
,
171 Control_Flow_Data
->Parent_Window
);
173 unreg_update_current_time(update_current_time_hook
,
175 Control_Flow_Data
->Parent_Window
);
177 g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data
);
178 g_slist_remove(gControl_Flow_Data_List
,Control_Flow_Data
);
179 g_free(Control_Flow_Data
);
182 GtkWidget
*guicontrolflow_get_widget(ControlFlowData
*Control_Flow_Data
)
184 return Control_Flow_Data
->Scrolled_Window_VC
;
187 ProcessList
*guicontrolflow_get_process_list
188 (ControlFlowData
*Control_Flow_Data
)
190 return Control_Flow_Data
->Process_List
;
193 TimeWindow
*guicontrolflow_get_time_window(ControlFlowData
*Control_Flow_Data
)
195 return &Control_Flow_Data
->Time_Window
;
197 LttTime
*guicontrolflow_get_current_time(ControlFlowData
*Control_Flow_Data
)
199 return &Control_Flow_Data
->Current_Time
;