final inline compile fixes
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / cfv.c
1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Mathieu Desnoyers
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16 * MA 02111-1307, USA.
17 */
18
19 #include <glib.h>
20 #include <gtk/gtk.h>
21 #include <gdk/gdk.h>
22
23 #include "cfv.h"
24 #include "drawing.h"
25 #include "processlist.h"
26 #include "eventhooks.h"
27 #include <lttv/lttv.h>
28
29 extern GSList *g_control_flow_data_list;
30
31 static gboolean
32 header_size_allocate(GtkWidget *widget,
33 GtkAllocation *allocation,
34 gpointer user_data)
35 {
36 Drawing_t *drawing = (Drawing_t*)user_data;
37
38 gtk_widget_set_size_request(drawing->ruler, -1, allocation->height);
39 //gtk_widget_queue_resize(drawing->padding);
40 //gtk_widget_queue_resize(drawing->ruler);
41 gtk_container_check_resize(GTK_CONTAINER(drawing->ruler_hbox));
42 return 0;
43 }
44
45
46
47 /*****************************************************************************
48 * Control Flow Viewer class implementation *
49 *****************************************************************************/
50 /**
51 * Control Flow Viewer's constructor
52 *
53 * This constructor is given as a parameter to the menuitem and toolbar button
54 * registration. It creates the drawing widget.
55 * @param ParentWindow A pointer to the parent window.
56 * @return The widget created.
57 */
58 ControlFlowData *
59 guicontrolflow(void)
60 {
61 GtkWidget *process_list_widget, *drawing_widget, *drawing_area;
62
63 ControlFlowData* control_flow_data = g_new(ControlFlowData,1) ;
64
65 control_flow_data->v_adjust =
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
73 /* Create the drawing */
74 control_flow_data->drawing = drawing_construct(control_flow_data);
75
76 drawing_widget =
77 drawing_get_widget(control_flow_data->drawing);
78
79 drawing_area =
80 drawing_get_drawing_area(control_flow_data->drawing);
81
82 control_flow_data->number_of_process = 0;
83 control_flow_data->background_info_waiting = 0;
84
85 /* Create the Process list */
86 control_flow_data->process_list = processlist_construct();
87
88 process_list_widget =
89 processlist_get_widget(control_flow_data->process_list);
90
91 gtk_tree_view_set_vadjustment(GTK_TREE_VIEW(process_list_widget),
92 GTK_ADJUSTMENT(
93 control_flow_data->v_adjust));
94
95 g_signal_connect (G_OBJECT(control_flow_data->process_list->button),
96 "size-allocate",
97 G_CALLBACK(header_size_allocate),
98 (gpointer)control_flow_data->drawing);
99 #if 0 /* not ready */
100 g_signal_connect (
101 // G_OBJECT(control_flow_data->process_list->process_list_widget),
102 G_OBJECT(control_flow_data->process_list->list_store),
103 "row-changed",
104 G_CALLBACK (tree_row_activated),
105 (gpointer)control_flow_data);
106 #endif //0
107
108 control_flow_data->h_paned = gtk_hpaned_new();
109 control_flow_data->box = gtk_event_box_new();
110 control_flow_data->top_widget = control_flow_data->box;
111 gtk_container_add(GTK_CONTAINER(control_flow_data->box),
112 control_flow_data->h_paned);
113
114 gtk_paned_pack1(GTK_PANED(control_flow_data->h_paned),
115 process_list_widget, FALSE, TRUE);
116 gtk_paned_pack2(GTK_PANED(control_flow_data->h_paned),
117 drawing_widget, TRUE, TRUE);
118
119 /* Set the size of the drawing area */
120 //drawing_Resize(drawing, h, w);
121
122 /* Get trace statistics */
123 //control_flow_data->Trace_Statistics = get_trace_statistics(Trace);
124
125 gtk_widget_show(drawing_widget);
126 gtk_widget_show(process_list_widget);
127 gtk_widget_show(control_flow_data->h_paned);
128 gtk_widget_show(control_flow_data->box);
129
130 g_object_set_data_full(
131 G_OBJECT(control_flow_data->top_widget),
132 "control_flow_data",
133 control_flow_data,
134 (GDestroyNotify)guicontrolflow_destructor);
135
136 g_object_set_data(
137 G_OBJECT(drawing_area),
138 "control_flow_data",
139 control_flow_data);
140
141 g_control_flow_data_list = g_slist_append(
142 g_control_flow_data_list,
143 control_flow_data);
144
145 //WARNING : The widget must be
146 //inserted in the main window before the drawing area
147 //can be configured (and this must happend bedore sending
148 //data)
149
150
151 return control_flow_data;
152
153 }
154
155 /* Destroys widget also */
156 void
157 guicontrolflow_destructor_full(ControlFlowData *control_flow_data)
158 {
159 g_info("CFV.c : guicontrolflow_destructor_full, %p", control_flow_data);
160 /* May already have been done by GTK window closing */
161 if(GTK_IS_WIDGET(guicontrolflow_get_widget(control_flow_data)))
162 gtk_widget_destroy(guicontrolflow_get_widget(control_flow_data));
163 //control_flow_data->mw = NULL;
164 //FIXME guicontrolflow_destructor(control_flow_data);
165 }
166
167 /* When this destructor is called, the widgets are already disconnected */
168 void
169 guicontrolflow_destructor(ControlFlowData *control_flow_data)
170 {
171 Tab *tab = control_flow_data->tab;
172
173 g_info("CFV.c : guicontrolflow_destructor, %p", control_flow_data);
174 g_info("%p, %p, %p", update_time_window_hook, control_flow_data, tab);
175 if(GTK_IS_WIDGET(guicontrolflow_get_widget(control_flow_data)))
176 g_info("widget still exists");
177
178 /* Process List is removed with it's widget */
179 //ProcessList_destroy(control_flow_data->process_list);
180 if(tab != NULL)
181 {
182 /* Delete reading hooks */
183 lttvwindow_unregister_traceset_notify(tab,
184 traceset_notify,
185 control_flow_data);
186
187 lttvwindow_unregister_time_window_notify(tab,
188 update_time_window_hook,
189 control_flow_data);
190
191 lttvwindow_unregister_current_time_notify(tab,
192 update_current_time_hook,
193 control_flow_data);
194
195 lttvwindow_unregister_redraw_notify(tab, redraw_notify, control_flow_data);
196 lttvwindow_unregister_continue_notify(tab,
197 continue_notify,
198 control_flow_data);
199
200 lttvwindow_events_request_remove_all(control_flow_data->tab,
201 control_flow_data);
202
203 }
204 lttvwindowtraces_background_notify_remove(control_flow_data);
205 g_control_flow_data_list =
206 g_slist_remove(g_control_flow_data_list,control_flow_data);
207
208 g_info("CFV.c : guicontrolflow_destructor end, %p", control_flow_data);
209 g_free(control_flow_data);
210
211 }
212
213
This page took 0.036526 seconds and 4 git commands to generate.