-
Notifications
You must be signed in to change notification settings - Fork 6
/
GTK_main.c
145 lines (119 loc) · 6.56 KB
/
GTK_main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/* Copyright (C) RongTao, All right reserve. */
#include<gtk/gtk.h>
#include<stdio.h>
#include<malloc.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#include"include/function/GTK_menu.c"
#include"GTK_gpuvti2dfd.c"
#include"GTK_gpuvti3dfd.c"
#include"GTK_cpuvti2dfd.c"
//###################################Main function#########################################
int main( int argc, char *argv[] )
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *label;
GtkWidget *table;
GtkWidget *frame;
GtkWidget *boxV,*boxH,*boxbutton,*boxH2;
GtkWidget *align;
gtk_init(&argc,&argv);
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window),"VTI-FD-GTK");
gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
g_signal_connect(GTK_OBJECT(window),"delete_event",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);
boxV = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), boxV);
gtk_menu(window,boxV);
boxH2 = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (boxV), boxH2);
gtk_widget_set_size_request (boxH2, 500, 100);
/*********************************frame**************************************/
/****** CPU ******/
frame = gtk_frame_new (NULL);
gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
align = gtk_alignment_new(0.5,0,0,0);
gtk_container_add(GTK_CONTAINER(align),frame);
gtk_box_pack_start (GTK_BOX (boxH2), align, TRUE, TRUE, 0);
gtk_frame_set_label (GTK_FRAME (frame), "CPU");
gtk_frame_set_label_align (GTK_FRAME (frame), 0.0, 1.0);
boxH = gtk_hbox_new (TRUE, 0);
gtk_container_add (GTK_CONTAINER (frame), boxH);
gtk_container_set_border_width (GTK_CONTAINER (boxH), 10);
boxbutton=xpm_label_box("include/picture/2d.png","2D");
button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),boxbutton);
align = gtk_alignment_new(0.5,0.5,0,0);
gtk_container_add(GTK_CONTAINER(align),button);
gtk_box_pack_start (GTK_BOX (boxH), align, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(GTK_cpuvti2dfd),NULL);
/*********************************frame**************************************/
/****** GPU ******/
frame = gtk_frame_new (NULL);
gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
align = gtk_alignment_new(0.5,0,0,0);
gtk_container_add(GTK_CONTAINER(align),frame);
gtk_box_pack_start (GTK_BOX (boxH2), align, TRUE, TRUE, 0);
gtk_frame_set_label (GTK_FRAME (frame), "CPU&GPU");
gtk_frame_set_label_align (GTK_FRAME (frame), 0.0, 1.0);
boxH = gtk_hbox_new (TRUE, 0);
gtk_container_add (GTK_CONTAINER (frame), boxH);
gtk_container_set_border_width (GTK_CONTAINER (boxH), 10);
boxbutton=xpm_label_box("include/picture/2d.png","2D");
button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),boxbutton);
align = gtk_alignment_new(0.5,0.5,0,0);
gtk_container_add(GTK_CONTAINER(align),button);
gtk_box_pack_start (GTK_BOX (boxH), align, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(GTK_gpuvti2dfd),NULL);
boxbutton=xpm_label_box("include/picture/3d.png","3D");
button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),boxbutton);
align = gtk_alignment_new(0.5,0.5,0,0);
gtk_container_add(GTK_CONTAINER(align),button);
gtk_box_pack_start (GTK_BOX (boxH), align, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(GTK_gpuvti3dfd),NULL);
/*********************************frame**************************************/
/****** CPU&GPU ******/
frame = gtk_frame_new (NULL);
gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
align = gtk_alignment_new(0.5,0,0,0);
gtk_container_add(GTK_CONTAINER(align),frame);
gtk_box_pack_start (GTK_BOX (boxH2), align, TRUE, TRUE, 0);
gtk_frame_set_label (GTK_FRAME (frame), "CPU&GPU&MPI");
gtk_frame_set_label_align (GTK_FRAME (frame), 0.0, 1.0);
boxH = gtk_hbox_new (TRUE, 0);
gtk_container_add (GTK_CONTAINER (frame), boxH);
gtk_container_set_border_width (GTK_CONTAINER (boxH), 10);
boxbutton=xpm_label_box("include/picture/2d.png","2D");
button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),boxbutton);
align = gtk_alignment_new(0.5,0.5,0,0);
gtk_container_add(GTK_CONTAINER(align),button);
gtk_box_pack_start (GTK_BOX (boxH), align, FALSE, FALSE, 0);
//g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(GTK_vti2dfd),NULL);
boxbutton=xpm_label_box("include/picture/3d.png","3D");
button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),boxbutton);
align = gtk_alignment_new(0.5,0.5,0,0);
gtk_container_add(GTK_CONTAINER(align),button);
gtk_box_pack_start (GTK_BOX (boxH), align, FALSE, FALSE, 0);
// g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(GTK_vti2dfd),NULL);
frame = gtk_frame_new (NULL);
gtk_widget_set_size_request (frame, 450, 370);
boxbutton=xpm_label_box("include/picture/background3.png"," ");
gtk_container_add (GTK_CONTAINER (frame), boxbutton);
gtk_box_pack_start (GTK_BOX (boxV), frame, FALSE, FALSE, 0);
/*********************************frame**************************************/
frame = gtk_frame_new (NULL);
gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
gtk_box_pack_start (GTK_BOX (boxV), frame, FALSE, FALSE, 0);
label=gtk_label_new("China University of Petroleum (East China)\n"
" Developer:Rong Tao");
gtk_container_add(GTK_CONTAINER(frame),label);
gtk_widget_show_all(window);
gtk_main ();
return 0;
}