1
// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
3
// See the LICENSE.txt file for license information. Please report all
4
// bugs and problems to <gmsh@geuz.org>.
6
#include <FL/Fl_Tabs.H>
7
#include <FL/Fl_Return_Button.H>
10
#include "contextWindow.h"
11
#include "paletteWindow.h"
13
#include "GeoStringInterface.h"
19
static void con_geometry_define_parameter_cb(Fl_Widget *w, void *data)
21
add_param(GUI::instance()->geoContext->input[0]->value(),
22
GUI::instance()->geoContext->input[1]->value(),
23
GModel::current()->getFileName());
24
GUI::instance()->resetVisibility();
27
static void con_geometry_define_point_cb(Fl_Widget *w, void *data)
29
add_point(GModel::current()->getFileName(),
30
GUI::instance()->geoContext->input[2]->value(),
31
GUI::instance()->geoContext->input[3]->value(),
32
GUI::instance()->geoContext->input[4]->value(),
33
GUI::instance()->geoContext->input[5]->value());
34
GUI::instance()->resetVisibility();
35
GModel::current()->setSelection(0);
40
static void con_geometry_snap_cb(Fl_Widget *w, void *data)
42
CTX.geom.snap[0] = GUI::instance()->geoContext->value[0]->value();
43
CTX.geom.snap[1] = GUI::instance()->geoContext->value[1]->value();
44
CTX.geom.snap[2] = GUI::instance()->geoContext->value[2]->value();
47
geometryContextWindow::geometryContextWindow(int deltaFontSize)
49
FL_NORMAL_SIZE -= deltaFontSize;
51
int width = 31 * FL_NORMAL_SIZE;
52
int height = 4 * WB + 8 * BH;
54
win = new paletteWindow(width, height, CTX.non_modal_windows ? true : false,
55
"Contextual Geometry Definitions");
56
win->box(GMSH_WINDOW_BOX);
58
Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 2 * WB);
61
group[0] = new Fl_Group
62
(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Parameter");
63
input[0] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Name");
64
input[0]->value("lc");
65
input[1] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Value");
66
input[1]->value("0.1");
67
for(int i = 0; i < 2; i++) {
68
input[i]->align(FL_ALIGN_RIGHT);
71
Fl_Return_Button *o = new Fl_Return_Button
72
(width - BB - 2 * WB, 2 * WB + 7 * BH, BB, BH, "Add");
73
o->callback(con_geometry_define_parameter_cb);
79
group[1] = new Fl_Group
80
(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Point");
81
input[2] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "X coordinate");
83
input[3] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Y coordinate");
85
input[4] = new Fl_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "Z coordinate");
87
input[5] = new Fl_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, "Characteristic length");
89
for(int i = 2; i < 6; i++) {
90
input[i]->align(FL_ALIGN_RIGHT);
92
value[0] = new Fl_Value_Input(2 * WB, 2 * WB + 5 * BH, IW/3, BH);
93
value[1] = new Fl_Value_Input(2 * WB + IW/3, 2 * WB + 5 * BH, IW/3, BH);
94
value[2] = new Fl_Value_Input(2 * WB + 2*IW/3, 2 * WB + 5 * BH, IW/3, BH,
95
"Snapping grid spacing");
96
for(int i = 0; i < 3; i++) {
97
value[i]->align(FL_ALIGN_RIGHT);
98
value[i]->callback(con_geometry_snap_cb);
101
Fl_Return_Button *o = new Fl_Return_Button
102
(width - BB - 2 * WB, 2 * WB + 7 * BH, BB, BH, "Add");
103
o->callback(con_geometry_define_point_cb);
109
group[2] = new Fl_Group
110
(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Translation");
111
input[6] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "X component");
112
input[6]->value("0");
113
input[7] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Y component");
114
input[7]->value("0");
115
input[8] = new Fl_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "Z component");
116
input[8]->value("1");
117
for(int i = 6; i < 9; i++) {
118
input[i]->align(FL_ALIGN_RIGHT);
124
group[3] = new Fl_Group
125
(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Rotation");
126
input[9] = new Fl_Input
127
(2 * WB, 2 * WB + 1 * BH, IW, BH, "X coordinate of an axis point");
128
input[9]->value("0");
129
input[10] = new Fl_Input
130
(2 * WB, 2 * WB + 2 * BH, IW, BH, "Y coordinate of an axis point");
131
input[10]->value("0");
132
input[11] = new Fl_Input
133
(2 * WB, 2 * WB + 3 * BH, IW, BH, "Z coordinate of an axis point");
134
input[11]->value("0");
135
input[12] = new Fl_Input
136
(2 * WB, 2 * WB + 4 * BH, IW, BH, "X component of axis direction");
137
input[12]->value("0");
138
input[13] = new Fl_Input
139
(2 * WB, 2 * WB + 5 * BH, IW, BH, "Y component of axis direction");
140
input[13]->value("1");
141
input[14] = new Fl_Input
142
(2 * WB, 2 * WB + 6 * BH, IW, BH, "Z component of axis direction");
143
input[14]->value("0");
144
input[15] = new Fl_Input
145
(2 * WB, 2 * WB + 7 * BH, IW, BH, "Angle in radians");
146
input[15]->value("Pi/4");
147
for(int i = 9; i < 16; i++) {
148
input[i]->align(FL_ALIGN_RIGHT);
154
group[4] = new Fl_Group
155
(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Scale");
156
input[16] = new Fl_Input
157
(2 * WB, 2 * WB + 1 * BH, IW, BH, "X component of direction");
158
input[16]->value("0");
159
input[17] = new Fl_Input
160
(2 * WB, 2 * WB + 2 * BH, IW, BH, "Y component of direction");
161
input[17]->value("0");
162
input[18] = new Fl_Input
163
(2 * WB, 2 * WB + 3 * BH, IW, BH, "Z component of direction");
164
input[18]->value("0");
165
input[19] = new Fl_Input
166
(2 * WB, 2 * WB + 4 * BH, IW, BH, "Factor");
167
input[19]->value("0.5");
168
for(int i = 16; i < 20; i++) {
169
input[i]->align(FL_ALIGN_RIGHT);
175
group[5] = new Fl_Group
176
(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Symmetry");
177
input[20] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "A");
178
input[20]->value("1");
179
input[21] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "B");
180
input[21]->value("0");
181
input[22] = new Fl_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "C");
182
input[22]->value("0");
183
input[23] = new Fl_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, "D");
184
input[23]->value("1");
185
for(int i = 20; i < 24; i++) {
186
input[i]->align(FL_ALIGN_RIGHT);
193
win->position(CTX.ctx_position[0], CTX.ctx_position[1]);
196
FL_NORMAL_SIZE += deltaFontSize;
199
void geometryContextWindow::show(int pane)
201
for(int i = 0; i < 6; i++)
207
meshContextWindow::meshContextWindow(int deltaFontSize)
209
FL_NORMAL_SIZE -= deltaFontSize;
211
static Fl_Menu menu_transfinite_dir[] = {
214
{"Alternated", 0, 0, 0},
218
int width = 29 * FL_NORMAL_SIZE;
219
int height = 4 * WB + 4 * BH;
221
win = new paletteWindow
222
(width, height, CTX.non_modal_windows, "Contextual Mesh Definitions");
223
win->box(GMSH_WINDOW_BOX);
225
Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 2 * WB);
226
// 0: Characteristic length
228
group[0] = new Fl_Group
229
(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Characteristic Length");
230
input[0] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Value");
231
input[0]->value("0.1");
232
input[0]->align(FL_ALIGN_RIGHT);
235
// 1: Transfinite line
237
group[1] = new Fl_Group
238
(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Transfinite Line");
239
input[1] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Number of points");
240
input[1]->value("10");
241
input[2] = new Fl_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "Parameter");
242
input[2]->value("1");
243
for(int i = 1; i < 3; i++) {
244
input[i]->align(FL_ALIGN_RIGHT);
246
static Fl_Menu_Item menu_trsf_mesh[] = {
247
{"Progression", 0, 0, 0},
251
choice[0] = new Fl_Choice(2 * WB, 2 * WB + 2 * BH, IW, BH, "Type");
252
choice[0]->menu(menu_trsf_mesh);
253
choice[0]->align(FL_ALIGN_RIGHT);
257
// 2: Transfinite surface
259
group[2] = new Fl_Group
260
(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Transfinite Surface");
262
choice[1] = new Fl_Choice
263
(2 * WB, 2 * WB + 1 * BH, IW, BH, "Transfinite Arrangement");
264
choice[1]->menu(menu_transfinite_dir);
265
choice[1]->align(FL_ALIGN_RIGHT);
272
win->position(CTX.ctx_position[0], CTX.ctx_position[1]);
275
FL_NORMAL_SIZE += deltaFontSize;
278
void meshContextWindow::show(int pane)
280
for(int i = 0; i < 3; i++)