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