complete shedchange text information
[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{
76a67e8a 32 GtkWidget *Process_List_Widget, *Drawing_Widget;
f0d936c0 33
34 ControlFlowData* Control_Flow_Data = g_new(ControlFlowData,1) ;
35
36 /* Create the Drawing */
4c69e0cc 37 Control_Flow_Data->Drawing = drawing_construct(Control_Flow_Data);
76a67e8a 38
39 Drawing_Widget =
4c69e0cc 40 drawing_get_widget(Control_Flow_Data->Drawing);
f0d936c0 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 */
4c69e0cc 53 Control_Flow_Data->Process_List = processlist_construct();
f0d936c0 54
fa2c4dbe 55 Process_List_Widget =
4c69e0cc 56 processlist_get_widget(Control_Flow_Data->Process_List);
f0d936c0 57
5daf3878 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 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);
f0d936c0 69
70 Control_Flow_Data->VAdjust_C =
71 GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */
72 0.0, /* Lower */
73 0.0, /* Upper */
74 0.0, /* Step inc. */
75 0.0, /* Page inc. */
76 0.0)); /* page size */
77
f0d936c0 78 Control_Flow_Data->Scrolled_Window_VC =
79 gtk_scrolled_window_new (NULL,
80 Control_Flow_Data->VAdjust_C);
81
82 gtk_scrolled_window_set_policy(
83 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC) ,
84 GTK_POLICY_NEVER,
85 GTK_POLICY_AUTOMATIC);
86
87 gtk_scrolled_window_add_with_viewport(
88 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC),
5daf3878 89 //Control_Flow_Data->Inside_HBox_V);
90 Control_Flow_Data->HPaned);
f0d936c0 91
92 //g_signal_connect (G_OBJECT (Control_Flow_Data->Drawing_Area_V),
93 // "expose_event",
94 // G_CALLBACK (expose_event_cb),
95 // Control_Flow_Data);
96
97
98
99 //g_signal_connect (G_OBJECT (Control_Flow_Data->VAdjust_C),
100 // "value-changed",
101 // G_CALLBACK (v_scroll_cb),
102 // Control_Flow_Data);
103
104
105 /* Set the size of the drawing area */
106 //Drawing_Resize(Drawing, h, w);
107
108 /* Get trace statistics */
109 //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
110
111
76a67e8a 112 gtk_widget_show(Drawing_Widget);
fa2c4dbe 113 gtk_widget_show(Process_List_Widget);
5daf3878 114 //gtk_widget_show(Control_Flow_Data->Inside_HBox_V);
115 gtk_widget_show(Control_Flow_Data->HPaned);
f0d936c0 116 gtk_widget_show(Control_Flow_Data->Scrolled_Window_VC);
1ab818de 117
f0d936c0 118 g_object_set_data_full(
1ab818de 119 G_OBJECT(Control_Flow_Data->Scrolled_Window_VC),
f0d936c0 120 "Control_Flow_Data",
121 Control_Flow_Data,
4c69e0cc 122 (GDestroyNotify)guicontrolflow_destructor);
f66eba62 123
124 g_object_set_data(
125 G_OBJECT(Drawing_Widget),
126 "Control_Flow_Data",
127 Control_Flow_Data);
128
f7afe191 129 gControl_Flow_Data_List = g_slist_append(
130 gControl_Flow_Data_List,
131 Control_Flow_Data);
f0d936c0 132
f7afe191 133 //WARNING : The widget must be
1ab3d149 134 //inserted in the main window before the Drawing area
135 //can be configured (and this must happend bedore sending
136 //data)
f7afe191 137
f0d936c0 138 return Control_Flow_Data;
139
140}
141
78417791 142/* Destroys widget also */
143void
4c69e0cc 144guicontrolflow_destructor_full(ControlFlowData *Control_Flow_Data)
78417791 145{
189a5d08 146 g_info("CFV.c : guicontrolflow_destructor_full, %p", Control_Flow_Data);
78417791 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);
189a5d08 150 //Control_Flow_Data->Parent_Window = NULL;
151 //FIXME guicontrolflow_destructor(Control_Flow_Data);
78417791 152}
153
189a5d08 154/* When this destructor is called, the widgets are already disconnected */
f0d936c0 155void
4c69e0cc 156guicontrolflow_destructor(ControlFlowData *Control_Flow_Data)
f0d936c0 157{
158 guint index;
fa2c4dbe 159
189a5d08 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);
8d088fb2 162 if(GTK_IS_WIDGET(Control_Flow_Data->Scrolled_Window_VC))
163 g_info("widget still exists");
164
fa2c4dbe 165 /* Process List is removed with it's widget */
1ab818de 166 //ProcessList_destroy(Control_Flow_Data->Process_List);
189a5d08 167 if(Control_Flow_Data->Parent_Window != NULL)
168 {
169 unreg_update_time_window(update_time_window_hook,
f7afe191 170 Control_Flow_Data,
189a5d08 171 Control_Flow_Data->Parent_Window);
f7afe191 172
189a5d08 173 unreg_update_current_time(update_current_time_hook,
f7afe191 174 Control_Flow_Data,
189a5d08 175 Control_Flow_Data->Parent_Window);
176 }
177 g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data);
558aa013 178 g_slist_remove(gControl_Flow_Data_List,Control_Flow_Data);
78417791 179 g_free(Control_Flow_Data);
f0d936c0 180}
181
4c69e0cc 182GtkWidget *guicontrolflow_get_widget(ControlFlowData *Control_Flow_Data)
558aa013 183{
1ab818de 184 return Control_Flow_Data->Scrolled_Window_VC ;
558aa013 185}
f0d936c0 186
4c69e0cc 187ProcessList *guicontrolflow_get_process_list
f7afe191 188 (ControlFlowData *Control_Flow_Data)
189{
190 return Control_Flow_Data->Process_List ;
191}
192
4c69e0cc 193TimeWindow *guicontrolflow_get_time_window(ControlFlowData *Control_Flow_Data)
f7afe191 194{
195 return &Control_Flow_Data->Time_Window;
196}
4c69e0cc 197LttTime *guicontrolflow_get_current_time(ControlFlowData *Control_Flow_Data)
f7afe191 198{
199 return &Control_Flow_Data->Current_Time;
200}
201
202
This page took 0.031513 seconds and 4 git commands to generate.