function name fixes
[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 *
4c69e0cc 27guicontrolflow(void)
f0d936c0 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 */
4c69e0cc 34 Control_Flow_Data->Drawing = drawing_construct(Control_Flow_Data);
76a67e8a 35
36 Drawing_Widget =
4c69e0cc 37 drawing_get_widget(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 */
4c69e0cc 50 Control_Flow_Data->Process_List = processlist_construct();
f0d936c0 51
fa2c4dbe 52 Process_List_Widget =
4c69e0cc 53 processlist_get_widget(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,
4c69e0cc 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
4c69e0cc 133guicontrolflow_destructor_full(ControlFlowData *Control_Flow_Data)
78417791 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
4c69e0cc 139 guicontrolflow_destructor(Control_Flow_Data);
78417791 140}
141
f0d936c0 142void
4c69e0cc 143guicontrolflow_destructor(ControlFlowData *Control_Flow_Data)
f0d936c0 144{
145 guint index;
fa2c4dbe 146
147 /* Process List is removed with it's widget */
1ab818de 148 //ProcessList_destroy(Control_Flow_Data->Process_List);
3cff8cc1 149 unreg_update_time_window(update_time_window_hook,
f7afe191 150 Control_Flow_Data,
151 Control_Flow_Data->Scrolled_Window_VC->parent);
152
3cff8cc1 153 unreg_update_current_time(update_current_time_hook,
f7afe191 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
4c69e0cc 161GtkWidget *guicontrolflow_get_widget(ControlFlowData *Control_Flow_Data)
558aa013 162{
1ab818de 163 return Control_Flow_Data->Scrolled_Window_VC ;
558aa013 164}
f0d936c0 165
4c69e0cc 166ProcessList *guicontrolflow_get_process_list
f7afe191 167 (ControlFlowData *Control_Flow_Data)
168{
169 return Control_Flow_Data->Process_List ;
170}
171
4c69e0cc 172TimeWindow *guicontrolflow_get_time_window(ControlFlowData *Control_Flow_Data)
f7afe191 173{
174 return &Control_Flow_Data->Time_Window;
175}
4c69e0cc 176LttTime *guicontrolflow_get_current_time(ControlFlowData *Control_Flow_Data)
f7afe191 177{
178 return &Control_Flow_Data->Current_Time;
179}
180
181
This page took 0.039945 seconds and 4 git commands to generate.