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
;//, *button;
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 Control_Flow_Data
->number_of_process
= 0;
44 /* Create the Process list */
45 Control_Flow_Data
->process_list
= processlist_construct();
48 processlist_get_widget(Control_Flow_Data
->process_list
);
50 //Control_Flow_Data->Inside_HBox_V = gtk_hbox_new(0, 0);
51 Control_Flow_Data
->h_paned
= gtk_hpaned_new();
53 gtk_paned_pack1(GTK_PANED(Control_Flow_Data
->h_paned
), process_list_Widget
, FALSE
, TRUE
);
54 gtk_paned_pack2(GTK_PANED(Control_Flow_Data
->h_paned
), Drawing_Widget
, TRUE
, TRUE
);
56 Control_Flow_Data
->v_adjust
=
57 GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */
62 0.0)); /* page size */
64 Control_Flow_Data
->scrolled_window
=
65 gtk_scrolled_window_new (NULL
,
66 Control_Flow_Data
->v_adjust
);
68 gtk_scrolled_window_set_policy(
69 GTK_SCROLLED_WINDOW(Control_Flow_Data
->scrolled_window
) ,
71 GTK_POLICY_AUTOMATIC
);
73 gtk_scrolled_window_add_with_viewport(
74 GTK_SCROLLED_WINDOW(Control_Flow_Data
->scrolled_window
),
75 Control_Flow_Data
->h_paned
);
77 /* Set the size of the drawing area */
78 //Drawing_Resize(Drawing, h, w);
80 /* Get trace statistics */
81 //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
84 gtk_widget_show(Drawing_Widget
);
85 gtk_widget_show(process_list_Widget
);
86 gtk_widget_show(Control_Flow_Data
->h_paned
);
87 gtk_widget_show(Control_Flow_Data
->scrolled_window
);
89 g_object_set_data_full(
90 G_OBJECT(Control_Flow_Data
->scrolled_window
),
93 (GDestroyNotify
)guicontrolflow_destructor
);
96 G_OBJECT(Drawing_Widget
),
100 gControl_Flow_Data_List
= g_slist_append(
101 gControl_Flow_Data_List
,
104 //WARNING : The widget must be
105 //inserted in the main window before the Drawing area
106 //can be configured (and this must happend bedore sending
109 return Control_Flow_Data
;
113 /* Destroys widget also */
115 guicontrolflow_destructor_full(ControlFlowData
*Control_Flow_Data
)
117 g_info("CFV.c : guicontrolflow_destructor_full, %p", Control_Flow_Data
);
118 /* May already have been done by GTK window closing */
119 if(GTK_IS_WIDGET(Control_Flow_Data
->scrolled_window
))
120 gtk_widget_destroy(Control_Flow_Data
->scrolled_window
);
121 //Control_Flow_Data->mw = NULL;
122 //FIXME guicontrolflow_destructor(Control_Flow_Data);
125 /* When this destructor is called, the widgets are already disconnected */
127 guicontrolflow_destructor(ControlFlowData
*Control_Flow_Data
)
131 g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data
);
132 g_info("%p, %p, %p", update_time_window_hook
, Control_Flow_Data
, Control_Flow_Data
->mw
);
133 if(GTK_IS_WIDGET(Control_Flow_Data
->scrolled_window
))
134 g_info("widget still exists");
136 /* Process List is removed with it's widget */
137 //ProcessList_destroy(Control_Flow_Data->process_list);
138 if(Control_Flow_Data
->mw
!= NULL
)
140 unreg_update_time_window(update_time_window_hook
,
142 Control_Flow_Data
->mw
);
144 unreg_update_current_time(update_current_time_hook
,
146 Control_Flow_Data
->mw
);
148 g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data
);
149 g_slist_remove(gControl_Flow_Data_List
,Control_Flow_Data
);
150 g_free(Control_Flow_Data
);
153 GtkWidget
*guicontrolflow_get_widget(ControlFlowData
*Control_Flow_Data
)
155 return Control_Flow_Data
->scrolled_window
;
158 ProcessList
*guicontrolflow_get_process_list
159 (ControlFlowData
*Control_Flow_Data
)
161 return Control_Flow_Data
->process_list
;
164 TimeWindow
*guicontrolflow_get_time_window(ControlFlowData
*Control_Flow_Data
)
166 return &Control_Flow_Data
->time_window
;
168 LttTime
*guicontrolflow_get_current_time(ControlFlowData
*Control_Flow_Data
)
170 return &Control_Flow_Data
->current_time
;