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