initial control flow viewer structure rework
[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
10#include "../icons/hGuiControlFlowInsert.xpm"
11
12
13/*****************************************************************************
14 * Control Flow Viewer class implementation *
15 *****************************************************************************/
16
17
18typedef struct _ControlFlowData {
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 */
32 TraceSet *Trace_Set;
33 TraceStatistics *Trace_Statistics;
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
46} ControlFlowData ;
47
48
49/** Array containing instanced objects. Used when module is unloaded */
50static GSList *sControl_Flow_Data_List = NULL ;
51
52
53/**
54 * Control Flow Viewer's constructor
55 *
56 * This constructor is given as a parameter to the menuitem and toolbar button
57 * registration. It creates the drawing widget.
58 * @param ParentWindow A pointer to the parent window.
59 * @return The widget created.
60 */
61ControlFlowData *
62GuiControlFlow(void)
63{
64 GtkWidget *Process_List_Widget;
65
66 ControlFlowData* Control_Flow_Data = g_new(ControlFlowData,1) ;
67
68 /* Create the Drawing */
69 //Control_Flow_Data->Drawing = Drawing();
70
71 /* TEST DATA, TO BE READ FROM THE TRACE */
72 Control_Flow_Data->Number_Of_Events = 1000 ;
73 Control_Flow_Data->Currently_Selected_Event = FALSE ;
74 Control_Flow_Data->Selected_Event = 0;
75 Control_Flow_Data->Number_Of_Process = 10;
76
77 /* FIXME register Event_Selected_Hook */
78
79
80
81 /* Create the Process list */
82 //Control_Flow_Data->Process_List = ProcessList();
83
84 //Process_List_Widget =
85 // ProcessList_getWidget(Control_Flow_Data->Process_List);
86
87 Control_Flow_Data->Inside_HBox_V = gtk_hbox_new(0, 0);
88
89 //gtk_box_pack_start(
90 // GTK_BOX(Control_Flow_Data->Inside_HBox_V),
91 // Process_List_Widget, FALSE, TRUE, 0);
92 //gtk_box_pack_start(
93 // GTK_BOX(Control_Flow_Data->Inside_HBox_V),
94 // Control_Flow_Data->Drawing_Area_V, TRUE, TRUE, 0);
95
96
97 Control_Flow_Data->VAdjust_C =
98 GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */
99 0.0, /* Lower */
100 0.0, /* Upper */
101 0.0, /* Step inc. */
102 0.0, /* Page inc. */
103 0.0)); /* page size */
104
105
106 Control_Flow_Data->Scrolled_Window_VC =
107 gtk_scrolled_window_new (NULL,
108 Control_Flow_Data->VAdjust_C);
109
110 gtk_scrolled_window_set_policy(
111 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC) ,
112 GTK_POLICY_NEVER,
113 GTK_POLICY_AUTOMATIC);
114
115 gtk_scrolled_window_add_with_viewport(
116 GTK_SCROLLED_WINDOW(Control_Flow_Data->Scrolled_Window_VC),
117 Control_Flow_Data->Inside_HBox_V);
118
119
120 //g_signal_connect (G_OBJECT (Control_Flow_Data->Drawing_Area_V),
121 // "expose_event",
122 // G_CALLBACK (expose_event_cb),
123 // Control_Flow_Data);
124
125
126
127 //g_signal_connect (G_OBJECT (Control_Flow_Data->VAdjust_C),
128 // "value-changed",
129 // G_CALLBACK (v_scroll_cb),
130 // Control_Flow_Data);
131
132
133 /* Set the size of the drawing area */
134 //Drawing_Resize(Drawing, h, w);
135
136 /* Get trace statistics */
137 //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
138
139
140 gtk_widget_show(Control_Flow_Data->Drawing_Area_V);
141 gtk_widget_show(Process_List_Widget);
142 gtk_widget_show(Control_Flow_Data->Inside_HBox_V);
143 gtk_widget_show(Control_Flow_Data->Scrolled_Window_VC);
144
145 g_object_set_data_full(
146 G_OBJECT(Control_Flow_Data->HBox_V),
147 "Control_Flow_Data",
148 Control_Flow_Data,
149 GuiControlFlow_Destructor);
150
151
152 return Control_Flow_Data;
153
154}
155
156void
157GuiControlFlow_Destructor(ControlFlowData *Control_Flow_Data)
158{
159 guint index;
160
161 /* May already been done by GTK window closing */
162 if(GTK_IS_WIDGET(Control_Flow_Data->HBox_V))
163 gtk_widget_destroy(Control_Flow_Data->HBox_V);
164
165 ProcessList_destroy(Control_Flow_Data->Process_List);
166
167 g_slist_remove(sControl_Flow_Data_List,Control_Flow_Data);
168}
169
170//FIXME : call hGuiEvents_Destructor for corresponding data upon widget destroy
171
172
This page took 0.029274 seconds and 4 git commands to generate.