guiControlFlow Process List completed
[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
1ab818de 26 //GtkWidget *HBox_V;
f0d936c0 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;
fa2c4dbe 37 LttTime Begin_Time, End_Time;
f0d936c0 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 */
fa2c4dbe 78 Control_Flow_Data->Process_List = ProcessList_construct();
f0d936c0 79
fa2c4dbe 80 Process_List_Widget =
81 ProcessList_getWidget(Control_Flow_Data->Process_List);
f0d936c0 82
83 Control_Flow_Data->Inside_HBox_V = gtk_hbox_new(0, 0);
84
fa2c4dbe 85 gtk_box_pack_start(
86 GTK_BOX(Control_Flow_Data->Inside_HBox_V),
87 Process_List_Widget, TRUE, TRUE, 0); // FALSE TRUE
f0d936c0 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
f0d936c0 101 Control_Flow_Data->Scrolled_Window_VC =
102 gtk_scrolled_window_new (NULL,
103 Control_Flow_Data->VAdjust_C);
104
105 gtk_scrolled_window_set_policy(
106 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC) ,
107 GTK_POLICY_NEVER,
108 GTK_POLICY_AUTOMATIC);
109
110 gtk_scrolled_window_add_with_viewport(
111 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC),
112 Control_Flow_Data->Inside_HBox_V);
113
114
115 //g_signal_connect (G_OBJECT (Control_Flow_Data->Drawing_Area_V),
116 // "expose_event",
117 // G_CALLBACK (expose_event_cb),
118 // Control_Flow_Data);
119
120
121
122 //g_signal_connect (G_OBJECT (Control_Flow_Data->VAdjust_C),
123 // "value-changed",
124 // G_CALLBACK (v_scroll_cb),
125 // Control_Flow_Data);
126
127
128 /* Set the size of the drawing area */
129 //Drawing_Resize(Drawing, h, w);
130
131 /* Get trace statistics */
132 //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
133
134
1ab818de 135 //gtk_widget_show(Control_Flow_Data->Drawing_Area_V);
fa2c4dbe 136 gtk_widget_show(Process_List_Widget);
f0d936c0 137 gtk_widget_show(Control_Flow_Data->Inside_HBox_V);
138 gtk_widget_show(Control_Flow_Data->Scrolled_Window_VC);
1ab818de 139
f0d936c0 140 g_object_set_data_full(
1ab818de 141 G_OBJECT(Control_Flow_Data->Scrolled_Window_VC),
f0d936c0 142 "Control_Flow_Data",
143 Control_Flow_Data,
558aa013 144 (GDestroyNotify)GuiControlFlow_Destructor);
f0d936c0 145
558aa013 146 g_slist_append(gControl_Flow_Data_List,Control_Flow_Data);
f0d936c0 147
148 return Control_Flow_Data;
149
150}
151
78417791 152/* Destroys widget also */
153void
154GuiControlFlow_Destructor_Full(ControlFlowData *Control_Flow_Data)
155{
156 /* May already have been done by GTK window closing */
157 if(GTK_IS_WIDGET(Control_Flow_Data->Scrolled_Window_VC))
158 gtk_widget_destroy(Control_Flow_Data->Scrolled_Window_VC);
159
160 GuiControlFlow_Destructor(Control_Flow_Data);
161}
162
f0d936c0 163void
164GuiControlFlow_Destructor(ControlFlowData *Control_Flow_Data)
165{
166 guint index;
fa2c4dbe 167
168 /* Process List is removed with it's widget */
1ab818de 169 //ProcessList_destroy(Control_Flow_Data->Process_List);
f0d936c0 170
558aa013 171 g_slist_remove(gControl_Flow_Data_List,Control_Flow_Data);
78417791 172 g_free(Control_Flow_Data);
f0d936c0 173}
174
558aa013 175GtkWidget *GuiControlFlow_get_Widget(ControlFlowData *Control_Flow_Data)
176{
1ab818de 177 return Control_Flow_Data->Scrolled_Window_VC ;
558aa013 178}
f0d936c0 179
This page took 0.03004 seconds and 4 git commands to generate.