CFV-private.h attribute name change
[lttv.git] / ltt / branches / poly / lttv / modules / guiControlFlow / CFV.c
... / ...
CommitLineData
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#include "Event_Hooks.h"
10#include "CFV-private.h"
11
12
13#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
14#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
15
16extern GSList *gControl_Flow_Data_List;
17
18/*****************************************************************************
19 * Control Flow Viewer class implementation *
20 *****************************************************************************/
21/**
22 * Control Flow Viewer's constructor
23 *
24 * This constructor is given as a parameter to the menuitem and toolbar button
25 * registration. It creates the drawing widget.
26 * @param ParentWindow A pointer to the parent window.
27 * @return The widget created.
28 */
29ControlFlowData *
30guicontrolflow(void)
31{
32 GtkWidget *process_list_Widget, *Drawing_Widget;//, *button;
33
34 ControlFlowData* Control_Flow_Data = g_new(ControlFlowData,1) ;
35
36 /* Create the Drawing */
37 Control_Flow_Data->Drawing = drawing_construct(Control_Flow_Data);
38
39 Drawing_Widget =
40 drawing_get_widget(Control_Flow_Data->Drawing);
41
42 Control_Flow_Data->number_of_process = 0;
43
44 /* Create the Process list */
45 Control_Flow_Data->process_list = processlist_construct();
46
47 process_list_Widget =
48 processlist_get_widget(Control_Flow_Data->process_list);
49
50 //Control_Flow_Data->Inside_HBox_V = gtk_hbox_new(0, 0);
51 Control_Flow_Data->h_paned = gtk_hpaned_new();
52
53 gtk_paned_pack1(GTK_PANED(Control_Flow_Data->h_paned), process_list_Widget, FALSE, TRUE);
54 gtk_paned_pack2(GTK_PANED(Control_Flow_Data->h_paned), Drawing_Widget, TRUE, TRUE);
55
56 Control_Flow_Data->v_adjust =
57 GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */
58 0.0, /* Lower */
59 0.0, /* Upper */
60 0.0, /* Step inc. */
61 0.0, /* Page inc. */
62 0.0)); /* page size */
63
64 Control_Flow_Data->scrolled_window =
65 gtk_scrolled_window_new (NULL,
66 Control_Flow_Data->v_adjust);
67
68 gtk_scrolled_window_set_policy(
69 GTK_SCROLLED_WINDOW(Control_Flow_Data->scrolled_window) ,
70 GTK_POLICY_NEVER,
71 GTK_POLICY_AUTOMATIC);
72
73 gtk_scrolled_window_add_with_viewport(
74 GTK_SCROLLED_WINDOW(Control_Flow_Data->scrolled_window),
75 Control_Flow_Data->h_paned);
76
77 /* Set the size of the drawing area */
78 //Drawing_Resize(Drawing, h, w);
79
80 /* Get trace statistics */
81 //Control_Flow_Data->Trace_Statistics = get_trace_statistics(Trace);
82
83
84 gtk_widget_show(Drawing_Widget);
85 gtk_widget_show(process_list_Widget);
86 gtk_widget_show(Control_Flow_Data->h_paned);
87 gtk_widget_show(Control_Flow_Data->scrolled_window);
88
89 g_object_set_data_full(
90 G_OBJECT(Control_Flow_Data->scrolled_window),
91 "Control_Flow_Data",
92 Control_Flow_Data,
93 (GDestroyNotify)guicontrolflow_destructor);
94
95 g_object_set_data(
96 G_OBJECT(Drawing_Widget),
97 "Control_Flow_Data",
98 Control_Flow_Data);
99
100 gControl_Flow_Data_List = g_slist_append(
101 gControl_Flow_Data_List,
102 Control_Flow_Data);
103
104 //WARNING : The widget must be
105 //inserted in the main window before the Drawing area
106 //can be configured (and this must happend bedore sending
107 //data)
108
109 return Control_Flow_Data;
110
111}
112
113/* Destroys widget also */
114void
115guicontrolflow_destructor_full(ControlFlowData *Control_Flow_Data)
116{
117 g_info("CFV.c : guicontrolflow_destructor_full, %p", Control_Flow_Data);
118 /* May already have been done by GTK window closing */
119 if(GTK_IS_WIDGET(Control_Flow_Data->scrolled_window))
120 gtk_widget_destroy(Control_Flow_Data->scrolled_window);
121 //Control_Flow_Data->mw = NULL;
122 //FIXME guicontrolflow_destructor(Control_Flow_Data);
123}
124
125/* When this destructor is called, the widgets are already disconnected */
126void
127guicontrolflow_destructor(ControlFlowData *Control_Flow_Data)
128{
129 guint index;
130
131 g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data);
132 g_info("%p, %p, %p", update_time_window_hook, Control_Flow_Data, Control_Flow_Data->mw);
133 if(GTK_IS_WIDGET(Control_Flow_Data->scrolled_window))
134 g_info("widget still exists");
135
136 /* Process List is removed with it's widget */
137 //ProcessList_destroy(Control_Flow_Data->process_list);
138 if(Control_Flow_Data->mw != NULL)
139 {
140 unreg_update_time_window(update_time_window_hook,
141 Control_Flow_Data,
142 Control_Flow_Data->mw);
143
144 unreg_update_current_time(update_current_time_hook,
145 Control_Flow_Data,
146 Control_Flow_Data->mw);
147 }
148 g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data);
149 g_slist_remove(gControl_Flow_Data_List,Control_Flow_Data);
150 g_free(Control_Flow_Data);
151}
152
153GtkWidget *guicontrolflow_get_widget(ControlFlowData *Control_Flow_Data)
154{
155 return Control_Flow_Data->scrolled_window ;
156}
157
158ProcessList *guicontrolflow_get_process_list
159 (ControlFlowData *Control_Flow_Data)
160{
161 return Control_Flow_Data->process_list ;
162}
163
164TimeWindow *guicontrolflow_get_time_window(ControlFlowData *Control_Flow_Data)
165{
166 return &Control_Flow_Data->time_window;
167}
168LttTime *guicontrolflow_get_current_time(ControlFlowData *Control_Flow_Data)
169{
170 return &Control_Flow_Data->current_time;
171}
172
173
This page took 0.022201 seconds and 4 git commands to generate.