quit menu complete
[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"
9
f0d936c0 10
558aa013 11extern GSList *gControl_Flow_Data_List;
f0d936c0 12
13/*****************************************************************************
14 * Control Flow Viewer class implementation *
15 *****************************************************************************/
16
17
558aa013 18struct _ControlFlowData {
f0d936c0 19
f0d936c0 20 GtkWidget *Scrolled_Window_VC;
21
22 ProcessList *Process_List;
23 Drawing_t *Drawing;
24
1ab818de 25 //GtkWidget *HBox_V;
f0d936c0 26 GtkWidget *Inside_HBox_V;
27
28 GtkAdjustment *VAdjust_C ;
29
30 /* Trace information */
558aa013 31 //TraceSet *Trace_Set;
32 //TraceStatistics *Trace_Statistics;
f0d936c0 33
34 /* Shown events information */
35 guint First_Event, Last_Event;
fa2c4dbe 36 LttTime Begin_Time, End_Time;
f0d936c0 37
38
39 /* TEST DATA, TO BE READ FROM THE TRACE */
40 gint Number_Of_Events ;
41 guint Currently_Selected_Event ;
42 gboolean Selected_Event ;
43 guint Number_Of_Process;
44
558aa013 45} ;
f0d936c0 46
47
48/**
49 * Control Flow Viewer's constructor
50 *
51 * This constructor is given as a parameter to the menuitem and toolbar button
52 * registration. It creates the drawing widget.
53 * @param ParentWindow A pointer to the parent window.
54 * @return The widget created.
55 */
56ControlFlowData *
57GuiControlFlow(void)
58{
76a67e8a 59 GtkWidget *Process_List_Widget, *Drawing_Widget;
f0d936c0 60
61 ControlFlowData* Control_Flow_Data = g_new(ControlFlowData,1) ;
62
63 /* Create the Drawing */
76a67e8a 64 Control_Flow_Data->Drawing = Drawing_construct();
65
66 Drawing_Widget =
67 Drawing_getWidget(Control_Flow_Data->Drawing);
f0d936c0 68
69 /* TEST DATA, TO BE READ FROM THE TRACE */
70 Control_Flow_Data->Number_Of_Events = 1000 ;
71 Control_Flow_Data->Currently_Selected_Event = FALSE ;
72 Control_Flow_Data->Selected_Event = 0;
73 Control_Flow_Data->Number_Of_Process = 10;
74
75 /* FIXME register Event_Selected_Hook */
76
77
78
79 /* Create the Process list */
fa2c4dbe 80 Control_Flow_Data->Process_List = ProcessList_construct();
f0d936c0 81
fa2c4dbe 82 Process_List_Widget =
83 ProcessList_getWidget(Control_Flow_Data->Process_List);
f0d936c0 84
85 Control_Flow_Data->Inside_HBox_V = gtk_hbox_new(0, 0);
86
fa2c4dbe 87 gtk_box_pack_start(
88 GTK_BOX(Control_Flow_Data->Inside_HBox_V),
76a67e8a 89 Process_List_Widget, FALSE, TRUE, 0); // FALSE TRUE
90 gtk_box_pack_start(
91 GTK_BOX(Control_Flow_Data->Inside_HBox_V),
92 Drawing_Widget, TRUE, TRUE, 0);
f0d936c0 93
94
95 Control_Flow_Data->VAdjust_C =
96 GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */
97 0.0, /* Lower */
98 0.0, /* Upper */
99 0.0, /* Step inc. */
100 0.0, /* Page inc. */
101 0.0)); /* page size */
102
f0d936c0 103 Control_Flow_Data->Scrolled_Window_VC =
104 gtk_scrolled_window_new (NULL,
105 Control_Flow_Data->VAdjust_C);
106
107 gtk_scrolled_window_set_policy(
108 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC) ,
109 GTK_POLICY_NEVER,
110 GTK_POLICY_AUTOMATIC);
111
112 gtk_scrolled_window_add_with_viewport(
113 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC),
114 Control_Flow_Data->Inside_HBox_V);
115
116
117 //g_signal_connect (G_OBJECT (Control_Flow_Data->Drawing_Area_V),
118 // "expose_event",
119 // G_CALLBACK (expose_event_cb),
120 // Control_Flow_Data);
121
122
123
124 //g_signal_connect (G_OBJECT (Control_Flow_Data->VAdjust_C),
125 // "value-changed",
126 // G_CALLBACK (v_scroll_cb),
127 // Control_Flow_Data);
128
129
130 /* Set the size of the drawing area */
131 //Drawing_Resize(Drawing, h, w);
132
133 /* Get trace statistics */
134 //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
135
136
76a67e8a 137 gtk_widget_show(Drawing_Widget);
fa2c4dbe 138 gtk_widget_show(Process_List_Widget);
f0d936c0 139 gtk_widget_show(Control_Flow_Data->Inside_HBox_V);
140 gtk_widget_show(Control_Flow_Data->Scrolled_Window_VC);
1ab818de 141
f0d936c0 142 g_object_set_data_full(
1ab818de 143 G_OBJECT(Control_Flow_Data->Scrolled_Window_VC),
f0d936c0 144 "Control_Flow_Data",
145 Control_Flow_Data,
558aa013 146 (GDestroyNotify)GuiControlFlow_Destructor);
f0d936c0 147
558aa013 148 g_slist_append(gControl_Flow_Data_List,Control_Flow_Data);
f0d936c0 149
1ab3d149 150 //FIXME : data sent too fast. The widget must be
151 //inserted in the main window before the Drawing area
152 //can be configured (and this must happend bedore sending
153 //data)
154 send_test_data(Control_Flow_Data->Process_List,
155 Control_Flow_Data->Drawing);
5f16133f 156
f0d936c0 157 return Control_Flow_Data;
158
159}
160
78417791 161/* Destroys widget also */
162void
163GuiControlFlow_Destructor_Full(ControlFlowData *Control_Flow_Data)
164{
165 /* May already have been done by GTK window closing */
166 if(GTK_IS_WIDGET(Control_Flow_Data->Scrolled_Window_VC))
167 gtk_widget_destroy(Control_Flow_Data->Scrolled_Window_VC);
168
169 GuiControlFlow_Destructor(Control_Flow_Data);
170}
171
f0d936c0 172void
173GuiControlFlow_Destructor(ControlFlowData *Control_Flow_Data)
174{
175 guint index;
fa2c4dbe 176
177 /* Process List is removed with it's widget */
1ab818de 178 //ProcessList_destroy(Control_Flow_Data->Process_List);
f0d936c0 179
558aa013 180 g_slist_remove(gControl_Flow_Data_List,Control_Flow_Data);
78417791 181 g_free(Control_Flow_Data);
f0d936c0 182}
183
558aa013 184GtkWidget *GuiControlFlow_get_Widget(ControlFlowData *Control_Flow_Data)
185{
1ab818de 186 return Control_Flow_Data->Scrolled_Window_VC ;
558aa013 187}
f0d936c0 188
This page took 0.031391 seconds and 4 git commands to generate.