retabulation 2 spaces
[lttv.git] / ltt / branches / poly / lttv / modules / guiControlFlow / CFV.c
CommitLineData
f0d936c0 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"
f7afe191 9#include "Event_Hooks.h"
10#include "CFV-private.h"
f0d936c0 11
f0d936c0 12
189a5d08 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
558aa013 16extern GSList *gControl_Flow_Data_List;
f0d936c0 17
18/*****************************************************************************
19 * Control Flow Viewer class implementation *
20 *****************************************************************************/
f0d936c0 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 */
29ControlFlowData *
4c69e0cc 30guicontrolflow(void)
f0d936c0 31{
a56a1ba4 32 GtkWidget *Process_List_Widget, *Drawing_Widget;//, *button;
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 Control_Flow_Data->HPaned = gtk_hpaned_new();
60
61 //gtk_box_pack_start(
62 // GTK_BOX(Control_Flow_Data->Inside_HBox_V),
63 // Process_List_Widget, FALSE, TRUE, 0); // FALSE TRUE
64 //gtk_box_pack_start(
65 // GTK_BOX(Control_Flow_Data->Inside_HBox_V),
66 // Drawing_Widget, TRUE, TRUE, 0);
67
68 //button = gtk_button_new();
69 //gtk_button_set_relief(button, GTK_RELIEF_NONE);
70 //gtk_container_set_border_width(GTK_CONTAINER(button),0);
71 //gtk_container_add(GTK_CONTAINER(button), Drawing_Widget);
72 gtk_paned_pack1(GTK_PANED(Control_Flow_Data->HPaned), Process_List_Widget, FALSE, TRUE);
73 gtk_paned_pack2(GTK_PANED(Control_Flow_Data->HPaned), Drawing_Widget, TRUE, TRUE);
74
75 Control_Flow_Data->VAdjust_C =
76 GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */
77 0.0, /* Lower */
78 0.0, /* Upper */
79 0.0, /* Step inc. */
80 0.0, /* Page inc. */
81 0.0)); /* page size */
82
83 Control_Flow_Data->Scrolled_Window_VC =
84 gtk_scrolled_window_new (NULL,
85 Control_Flow_Data->VAdjust_C);
86
87 gtk_scrolled_window_set_policy(
88 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC) ,
89 GTK_POLICY_NEVER,
90 GTK_POLICY_AUTOMATIC);
91
92 gtk_scrolled_window_add_with_viewport(
93 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC),
94 //Control_Flow_Data->Inside_HBox_V);
95 Control_Flow_Data->HPaned);
96
97 //g_signal_connect (G_OBJECT (Control_Flow_Data->Drawing_Area_V),
98 // "expose_event",
99 // G_CALLBACK (expose_event_cb),
100 // Control_Flow_Data);
101
102
103
104 //g_signal_connect (G_OBJECT (Control_Flow_Data->VAdjust_C),
105 // "value-changed",
106 // G_CALLBACK (v_scroll_cb),
107 // Control_Flow_Data);
108
109
110 /* Set the size of the drawing area */
111 //Drawing_Resize(Drawing, h, w);
112
113 /* Get trace statistics */
114 //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
115
116
117 gtk_widget_show(Drawing_Widget);
118 //gtk_widget_show(button);
119 gtk_widget_show(Process_List_Widget);
120 //gtk_widget_show(Control_Flow_Data->Inside_HBox_V);
121 gtk_widget_show(Control_Flow_Data->HPaned);
122 gtk_widget_show(Control_Flow_Data->Scrolled_Window_VC);
123
124 g_object_set_data_full(
125 G_OBJECT(Control_Flow_Data->Scrolled_Window_VC),
126 "Control_Flow_Data",
127 Control_Flow_Data,
128 (GDestroyNotify)guicontrolflow_destructor);
129
130 g_object_set_data(
131 G_OBJECT(Drawing_Widget),
132 "Control_Flow_Data",
133 Control_Flow_Data);
134
135 gControl_Flow_Data_List = g_slist_append(
136 gControl_Flow_Data_List,
137 Control_Flow_Data);
138
139 //WARNING : The widget must be
140 //inserted in the main window before the Drawing area
141 //can be configured (and this must happend bedore sending
142 //data)
143
144 return Control_Flow_Data;
f0d936c0 145
146}
147
78417791 148/* Destroys widget also */
149void
4c69e0cc 150guicontrolflow_destructor_full(ControlFlowData *Control_Flow_Data)
78417791 151{
a56a1ba4 152 g_info("CFV.c : guicontrolflow_destructor_full, %p", Control_Flow_Data);
153 /* May already have been done by GTK window closing */
154 if(GTK_IS_WIDGET(Control_Flow_Data->Scrolled_Window_VC))
155 gtk_widget_destroy(Control_Flow_Data->Scrolled_Window_VC);
156 //Control_Flow_Data->Parent_Window = NULL;
157 //FIXME guicontrolflow_destructor(Control_Flow_Data);
78417791 158}
159
189a5d08 160/* When this destructor is called, the widgets are already disconnected */
f0d936c0 161void
4c69e0cc 162guicontrolflow_destructor(ControlFlowData *Control_Flow_Data)
f0d936c0 163{
a56a1ba4 164 guint index;
165
166 g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data);
167 g_info("%p, %p, %p", update_time_window_hook, Control_Flow_Data, Control_Flow_Data->Parent_Window);
168 if(GTK_IS_WIDGET(Control_Flow_Data->Scrolled_Window_VC))
169 g_info("widget still exists");
170
171 /* Process List is removed with it's widget */
172 //ProcessList_destroy(Control_Flow_Data->Process_List);
173 if(Control_Flow_Data->Parent_Window != NULL)
174 {
175 unreg_update_time_window(update_time_window_hook,
176 Control_Flow_Data,
177 Control_Flow_Data->Parent_Window);
178
179 unreg_update_current_time(update_current_time_hook,
180 Control_Flow_Data,
181 Control_Flow_Data->Parent_Window);
182 }
183 g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data);
184 g_slist_remove(gControl_Flow_Data_List,Control_Flow_Data);
185 g_free(Control_Flow_Data);
f0d936c0 186}
187
4c69e0cc 188GtkWidget *guicontrolflow_get_widget(ControlFlowData *Control_Flow_Data)
558aa013 189{
a56a1ba4 190 return Control_Flow_Data->Scrolled_Window_VC ;
558aa013 191}
f0d936c0 192
4c69e0cc 193ProcessList *guicontrolflow_get_process_list
a56a1ba4 194 (ControlFlowData *Control_Flow_Data)
f7afe191 195{
a56a1ba4 196 return Control_Flow_Data->Process_List ;
f7afe191 197}
198
4c69e0cc 199TimeWindow *guicontrolflow_get_time_window(ControlFlowData *Control_Flow_Data)
f7afe191 200{
a56a1ba4 201 return &Control_Flow_Data->Time_Window;
f7afe191 202}
4c69e0cc 203LttTime *guicontrolflow_get_current_time(ControlFlowData *Control_Flow_Data)
f7afe191 204{
a56a1ba4 205 return &Control_Flow_Data->Current_Time;
f7afe191 206}
207
208
This page took 0.030798 seconds and 4 git commands to generate.