process trace connection : time interval too long : 1 second. Result for now : proces...
[lttv.git] / ltt / branches / poly / lttv / modules / guiControlFlow / CFV.c
1
2 #include <glib.h>
3 #include <gtk/gtk.h>
4 #include <gdk/gdk.h>
5
6 #include "CFV.h"
7 #include "Drawing.h"
8 #include "Process_List.h"
9 #include "Event_Hooks.h"
10 #include "CFV-private.h"
11
12
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)
15
16 extern GSList *gControl_Flow_Data_List;
17
18 /*****************************************************************************
19 * Control Flow Viewer class implementation *
20 *****************************************************************************/
21 /**
22 * Control Flow Viewer's constructor
23 *
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.
28 */
29 ControlFlowData *
30 guicontrolflow(void)
31 {
32 GtkWidget *Process_List_Widget, *Drawing_Widget;
33
34 ControlFlowData* Control_Flow_Data = g_new(ControlFlowData,1) ;
35
36 /* Create the Drawing */
37 Control_Flow_Data->Drawing = drawing_construct(Control_Flow_Data);
38
39 Drawing_Widget =
40 drawing_get_widget(Control_Flow_Data->Drawing);
41
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;
47
48 /* FIXME register Event_Selected_Hook */
49
50
51
52 /* Create the Process list */
53 Control_Flow_Data->Process_List = processlist_construct();
54
55 Process_List_Widget =
56 processlist_get_widget(Control_Flow_Data->Process_List);
57
58 Control_Flow_Data->Inside_HBox_V = gtk_hbox_new(0, 0);
59
60 gtk_box_pack_start(
61 GTK_BOX(Control_Flow_Data->Inside_HBox_V),
62 Process_List_Widget, FALSE, TRUE, 0); // FALSE TRUE
63 gtk_box_pack_start(
64 GTK_BOX(Control_Flow_Data->Inside_HBox_V),
65 Drawing_Widget, TRUE, TRUE, 0);
66
67
68 Control_Flow_Data->VAdjust_C =
69 GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */
70 0.0, /* Lower */
71 0.0, /* Upper */
72 0.0, /* Step inc. */
73 0.0, /* Page inc. */
74 0.0)); /* page size */
75
76 Control_Flow_Data->Scrolled_Window_VC =
77 gtk_scrolled_window_new (NULL,
78 Control_Flow_Data->VAdjust_C);
79
80 gtk_scrolled_window_set_policy(
81 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC) ,
82 GTK_POLICY_NEVER,
83 GTK_POLICY_AUTOMATIC);
84
85 gtk_scrolled_window_add_with_viewport(
86 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC),
87 Control_Flow_Data->Inside_HBox_V);
88
89
90 //g_signal_connect (G_OBJECT (Control_Flow_Data->Drawing_Area_V),
91 // "expose_event",
92 // G_CALLBACK (expose_event_cb),
93 // Control_Flow_Data);
94
95
96
97 //g_signal_connect (G_OBJECT (Control_Flow_Data->VAdjust_C),
98 // "value-changed",
99 // G_CALLBACK (v_scroll_cb),
100 // Control_Flow_Data);
101
102
103 /* Set the size of the drawing area */
104 //Drawing_Resize(Drawing, h, w);
105
106 /* Get trace statistics */
107 //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
108
109
110 gtk_widget_show(Drawing_Widget);
111 gtk_widget_show(Process_List_Widget);
112 gtk_widget_show(Control_Flow_Data->Inside_HBox_V);
113 gtk_widget_show(Control_Flow_Data->Scrolled_Window_VC);
114
115 g_object_set_data_full(
116 G_OBJECT(Control_Flow_Data->Scrolled_Window_VC),
117 "Control_Flow_Data",
118 Control_Flow_Data,
119 (GDestroyNotify)guicontrolflow_destructor);
120
121 g_object_set_data(
122 G_OBJECT(Drawing_Widget),
123 "Control_Flow_Data",
124 Control_Flow_Data);
125
126 gControl_Flow_Data_List = g_slist_append(
127 gControl_Flow_Data_List,
128 Control_Flow_Data);
129
130 //WARNING : The widget must be
131 //inserted in the main window before the Drawing area
132 //can be configured (and this must happend bedore sending
133 //data)
134
135 return Control_Flow_Data;
136
137 }
138
139 /* Destroys widget also */
140 void
141 guicontrolflow_destructor_full(ControlFlowData *Control_Flow_Data)
142 {
143 g_info("CFV.c : guicontrolflow_destructor_full, %p", Control_Flow_Data);
144 /* May already have been done by GTK window closing */
145 if(GTK_IS_WIDGET(Control_Flow_Data->Scrolled_Window_VC))
146 gtk_widget_destroy(Control_Flow_Data->Scrolled_Window_VC);
147 //Control_Flow_Data->Parent_Window = NULL;
148 //FIXME guicontrolflow_destructor(Control_Flow_Data);
149 }
150
151 /* When this destructor is called, the widgets are already disconnected */
152 void
153 guicontrolflow_destructor(ControlFlowData *Control_Flow_Data)
154 {
155 guint index;
156
157 g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data);
158 g_info("%p, %p, %p", update_time_window_hook, Control_Flow_Data, Control_Flow_Data->Parent_Window);
159 if(GTK_IS_WIDGET(Control_Flow_Data->Scrolled_Window_VC))
160 g_info("widget still exists");
161
162 /* Process List is removed with it's widget */
163 //ProcessList_destroy(Control_Flow_Data->Process_List);
164 if(Control_Flow_Data->Parent_Window != NULL)
165 {
166 unreg_update_time_window(update_time_window_hook,
167 Control_Flow_Data,
168 Control_Flow_Data->Parent_Window);
169
170 unreg_update_current_time(update_current_time_hook,
171 Control_Flow_Data,
172 Control_Flow_Data->Parent_Window);
173 }
174 g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data);
175 g_slist_remove(gControl_Flow_Data_List,Control_Flow_Data);
176 g_free(Control_Flow_Data);
177 }
178
179 GtkWidget *guicontrolflow_get_widget(ControlFlowData *Control_Flow_Data)
180 {
181 return Control_Flow_Data->Scrolled_Window_VC ;
182 }
183
184 ProcessList *guicontrolflow_get_process_list
185 (ControlFlowData *Control_Flow_Data)
186 {
187 return Control_Flow_Data->Process_List ;
188 }
189
190 TimeWindow *guicontrolflow_get_time_window(ControlFlowData *Control_Flow_Data)
191 {
192 return &Control_Flow_Data->Time_Window;
193 }
194 LttTime *guicontrolflow_get_current_time(ControlFlowData *Control_Flow_Data)
195 {
196 return &Control_Flow_Data->Current_Time;
197 }
198
199
This page took 0.033214 seconds and 4 git commands to generate.