initial control flow viewer structure rework
[lttv.git] / ltt / branches / poly / lttv / modules / guiControlFlow / test.c
CommitLineData
f0d936c0 1
2
3static void destroy_cb( GtkWidget *widget,
4 gpointer data )
5{
6 gtk_main_quit ();
7}
8
9
10
11int main(int argc, char **argv)
12{
13 GtkWidget *Window;
14 GtkWidget *CF_Viewer;
15 GtkWidget *VBox_V;
16 GtkWidget *HScroll_VC;
17 ControlFlowData *Control_Flow_Data;
18 guint ev_sel = 444 ;
19 /* Horizontal scrollbar and it's adjustment */
20 GtkWidget *VScroll_VC;
21 GtkAdjustment *VAdjust_C ;
22
23 /* Initialize i18n support */
24 gtk_set_locale ();
25
26 /* Initialize the widget set */
27 gtk_init (&argc, &argv);
28
29 init();
30
31 Window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
32 gtk_window_set_title (GTK_WINDOW (Window), ("Test Window"));
33
34 g_signal_connect (G_OBJECT (Window), "destroy",
35 G_CALLBACK (destroy_cb), NULL);
36
37
38 VBox_V = gtk_vbox_new(0, 0);
39 gtk_container_add (GTK_CONTAINER (Window), VBox_V);
40
41 //ListViewer = hGuiEvents(Window);
42 //gtk_box_pack_start(GTK_BOX(VBox_V), ListViewer, TRUE, TRUE, 0);
43
44 //ListViewer = hGuiEvents(Window);
45 //gtk_box_pack_start(GTK_BOX(VBox_V), ListViewer, FALSE, TRUE, 0);
46
47 Control_Flow_Data = GuiControlFlow();
48 CF_Viewer = Control_Flow_Data->Scrolled_Window_VC;
49 gtk_box_pack_start(GTK_BOX(VBox_V), CF_Viewer, TRUE, TRUE, 0);
50
51 /* Create horizontal scrollbar and pack it */
52 HScroll_VC = gtk_hscrollbar_new(NULL);
53 gtk_box_pack_start(GTK_BOX(VBox_V), HScroll_VC, FALSE, TRUE, 0);
54
55
56 gtk_widget_show (HScroll_VC);
57 gtk_widget_show (VBox_V);
58 gtk_widget_show (Window);
59
60 //Event_Selected_Hook(Control_Flow_Data, &ev_sel);
61
62 gtk_main ();
63
64 g_critical("main loop finished");
65
66 //hGuiEvents_Destructor(ListViewer);
67
68 //g_critical("GuiEvents Destructor finished");
69 destroy();
70
71 return 0;
72}
73
74
75
76void add_test_process(ControlFlowData *Control_Flow_Data)
77{
78 GtkTreeIter iter;
79 int i;
80 gchar *process[] = { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" };
81
82 for(i=0; i<Control_Flow_Data->Number_Of_Process; i++)
83 {
84 /* Add a new row to the model */
85 gtk_list_store_append (Control_Flow_Data->Store_M, &iter);
86 gtk_list_store_set (Control_Flow_Data->Store_M, &iter,
87 PROCESS_COLUMN, process[i],
88 -1);
89 }
90
91}
92
93
94
95
96
97
98void test_draw(ControlFlowData *Control_Flow_Data)
99{
100 /* Draw event states using available height, Number of process, cell height
101 * (don't forget to remove two pixels at beginning and end).
102 * For horizontal : use width, Time_Begin, Time_End.
103 * This function calls the reading library to get the draw_hook called
104 * for the desired period of time. */
105
106 DrawingAreaInfo *Drawing_Area_Info = &Control_Flow_Data->Drawing_Area_Info;
107
108
109}
110
111#ifdef DEBUG
112void test_draw() {
113 gint cell_height = get_cell_height(GTK_TREE_VIEW(Control_Flow_Data->Process_List_VC));
114 GdkGC *GC = gdk_gc_new(widget->window);
115 GdkColor color = CF_Colors[GREEN];
116
117 gdk_color_alloc (gdk_colormap_get_system () , &color);
118
119 g_critical("expose");
120
121 /* When redrawing, use widget->allocation.width to get the width of
122 * drawable area. */
123 Control_Flow_Data->Drawing_Area_Info.width = widget->allocation.width;
124
125 test_draw(Control_Flow_Data);
126
127 gdk_gc_copy(GC,widget->style->white_gc);
128 gdk_gc_set_foreground(GC,&color);
129
130 //gdk_draw_arc (widget->window,
131 // widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
132 // TRUE,
133 // //0, 0, widget->allocation.width, widget->allocation.height,
134 // 0, 0, widget->allocation.width,
135 // Control_Flow_Data->Drawing_Area_Info.height,
136 // 0, 64 * 360);
137
138
139 //Drawing_Area_Init(Control_Flow_Data);
140
141 // 2 pixels for the box around the drawing area, 1 pixel for off-by-one
142 // (starting from 0)
143 //gdk_gc_copy (&GC, widget->style->fg_gc[GTK_WIDGET_STATE (widget)]);
144
145 gdk_gc_set_line_attributes(GC,12, GDK_LINE_SOLID, GDK_CAP_NOT_LAST,GDK_JOIN_MITER);
146
147 gdk_draw_line (widget->window,
148 GC,
149 0, (cell_height-1)/2,
150 widget->allocation.width, (cell_height-1)/2);
151
152 color = CF_Colors[BLUE];
153
154 gdk_color_alloc (gdk_colormap_get_system () , &color);
155
156 gdk_gc_set_foreground(GC,&color);
157
158
159 gdk_gc_set_line_attributes(GC,3, GDK_LINE_SOLID, GDK_CAP_NOT_LAST,GDK_JOIN_MITER);
160
161 gdk_draw_line (widget->window,
162 GC,
163 0, (cell_height-1)/2,
164 widget->allocation.width,(cell_height-1)/2);
165
166
167
168
169
170
171 g_object_unref(GC);
172
173 //gdk_colormap_alloc_colors(gdk_colormap_get_system(), TRUE,
174
175 //gdk_gc_set_line_attributes(GC,5, GDK_LINE_SOLID, GDK_CAP_NOT_LAST,GDK_JOIN_MITER);
176 //gdk_gc_set_foreground(GC,
177
178 //gdk_draw_line (widget->window,
179 // GC,
180 // 0, (2*cell_height)-2-1,
181 // 50, (2*cell_height)-2-1);
182
183}
184#endif //DEBUG
185
This page took 0.028874 seconds and 4 git commands to generate.