mega modif by Mathieu Desnoyers. Independant main windows, multiple tracesets, contro...
[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 extern GSList *gControl_Flow_Data_List;
14
15 /*****************************************************************************
16 * Control Flow Viewer class implementation *
17 *****************************************************************************/
18 /**
19 * Control Flow Viewer's constructor
20 *
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.
25 */
26 ControlFlowData *
27 GuiControlFlow(void)
28 {
29 GtkWidget *Process_List_Widget, *Drawing_Widget;
30
31 ControlFlowData* Control_Flow_Data = g_new(ControlFlowData,1) ;
32
33 /* Create the Drawing */
34 Control_Flow_Data->Drawing = Drawing_construct(Control_Flow_Data);
35
36 Drawing_Widget =
37 Drawing_getWidget(Control_Flow_Data->Drawing);
38
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;
44
45 /* FIXME register Event_Selected_Hook */
46
47
48
49 /* Create the Process list */
50 Control_Flow_Data->Process_List = ProcessList_construct();
51
52 Process_List_Widget =
53 ProcessList_getWidget(Control_Flow_Data->Process_List);
54
55 Control_Flow_Data->Inside_HBox_V = gtk_hbox_new(0, 0);
56
57 gtk_box_pack_start(
58 GTK_BOX(Control_Flow_Data->Inside_HBox_V),
59 Process_List_Widget, FALSE, TRUE, 0); // FALSE TRUE
60 gtk_box_pack_start(
61 GTK_BOX(Control_Flow_Data->Inside_HBox_V),
62 Drawing_Widget, TRUE, TRUE, 0);
63
64
65 Control_Flow_Data->VAdjust_C =
66 GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */
67 0.0, /* Lower */
68 0.0, /* Upper */
69 0.0, /* Step inc. */
70 0.0, /* Page inc. */
71 0.0)); /* page size */
72
73 Control_Flow_Data->Scrolled_Window_VC =
74 gtk_scrolled_window_new (NULL,
75 Control_Flow_Data->VAdjust_C);
76
77 gtk_scrolled_window_set_policy(
78 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC) ,
79 GTK_POLICY_NEVER,
80 GTK_POLICY_AUTOMATIC);
81
82 gtk_scrolled_window_add_with_viewport(
83 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC),
84 Control_Flow_Data->Inside_HBox_V);
85
86
87 //g_signal_connect (G_OBJECT (Control_Flow_Data->Drawing_Area_V),
88 // "expose_event",
89 // G_CALLBACK (expose_event_cb),
90 // Control_Flow_Data);
91
92
93
94 //g_signal_connect (G_OBJECT (Control_Flow_Data->VAdjust_C),
95 // "value-changed",
96 // G_CALLBACK (v_scroll_cb),
97 // Control_Flow_Data);
98
99
100 /* Set the size of the drawing area */
101 //Drawing_Resize(Drawing, h, w);
102
103 /* Get trace statistics */
104 //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
105
106
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);
111
112 g_object_set_data_full(
113 G_OBJECT(Control_Flow_Data->Scrolled_Window_VC),
114 "Control_Flow_Data",
115 Control_Flow_Data,
116 (GDestroyNotify)GuiControlFlow_Destructor);
117
118 gControl_Flow_Data_List = g_slist_append(
119 gControl_Flow_Data_List,
120 Control_Flow_Data);
121
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
125 //data)
126
127 return Control_Flow_Data;
128
129 }
130
131 /* Destroys widget also */
132 void
133 GuiControlFlow_Destructor_Full(ControlFlowData *Control_Flow_Data)
134 {
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);
138
139 GuiControlFlow_Destructor(Control_Flow_Data);
140 }
141
142 void
143 GuiControlFlow_Destructor(ControlFlowData *Control_Flow_Data)
144 {
145 guint index;
146
147 /* Process List is removed with it's widget */
148 //ProcessList_destroy(Control_Flow_Data->Process_List);
149 UnregUpdateTimeWindow(Update_Time_Window_Hook,
150 Control_Flow_Data,
151 Control_Flow_Data->Scrolled_Window_VC->parent);
152
153 UnregUpdateCurrentTime(Update_Current_Time_Hook,
154 Control_Flow_Data,
155 Control_Flow_Data->Scrolled_Window_VC->parent);
156
157 g_slist_remove(gControl_Flow_Data_List,Control_Flow_Data);
158 g_free(Control_Flow_Data);
159 }
160
161 GtkWidget *GuiControlFlow_get_Widget(ControlFlowData *Control_Flow_Data)
162 {
163 return Control_Flow_Data->Scrolled_Window_VC ;
164 }
165
166 ProcessList *GuiControlFlow_get_Process_List
167 (ControlFlowData *Control_Flow_Data)
168 {
169 return Control_Flow_Data->Process_List ;
170 }
171
172 TimeWindow *GuiControlFlow_get_Time_Window(ControlFlowData *Control_Flow_Data)
173 {
174 return &Control_Flow_Data->Time_Window;
175 }
176 LttTime *GuiControlFlow_get_Current_Time(ControlFlowData *Control_Flow_Data)
177 {
178 return &Control_Flow_Data->Current_Time;
179 }
180
181
This page took 0.032619 seconds and 4 git commands to generate.