121
121
unsigned int (*fct) (int, int, unsigned int);
122
122
fct = (unsigned int (*)(int, int, unsigned int))data;
123
123
uchar r = CTX::instance()->unpackRed
124
(fct(GUI::instance()->options->view.index, GMSH_GET, 0));
124
(fct(FlGui::instance()->options->view.index, GMSH_GET, 0));
125
125
uchar g = CTX::instance()->unpackGreen
126
(fct(GUI::instance()->options->view.index, GMSH_GET, 0));
126
(fct(FlGui::instance()->options->view.index, GMSH_GET, 0));
127
127
uchar b = CTX::instance()->unpackBlue
128
(fct(GUI::instance()->options->view.index, GMSH_GET, 0));
128
(fct(FlGui::instance()->options->view.index, GMSH_GET, 0));
129
129
if(fl_color_chooser("Color Chooser", r, g, b))
130
fct(GUI::instance()->options->view.index,
130
fct(FlGui::instance()->options->view.index,
131
131
GMSH_SET | GMSH_GUI, CTX::instance()->packColor(r, g, b, 255));
132
drawContext::global()->draw();
135
135
void options_cb(Fl_Widget *w, void *data)
137
GUI::instance()->options->win->show();
137
FlGui::instance()->options->win->show();
140
140
static void options_browser_cb(Fl_Widget *w, void *data)
142
GUI::instance()->options->showGroup(GUI::instance()->options->browser->value());
142
FlGui::instance()->options->showGroup(FlGui::instance()->options->browser->value());
145
145
void options_save_cb(Fl_Widget *w, void *data)
157
157
UnlinkFile(CTX::instance()->homeDir + CTX::instance()->optionsFileName);
158
158
ReInitOptions(0);
159
159
InitOptionsGUI(0);
160
if(GUI::instance()->menu->module->value() == 3) // hack to refresh the buttons
161
GUI::instance()->menu->setContext(menu_post, 0);
160
if(FlGui::instance()->menu->module->value() == 3) // hack to refresh the buttons
161
FlGui::instance()->menu->setContext(menu_post, 0);
162
drawContext::global()->draw();
165
165
void general_options_cb(Fl_Widget *w, void *data)
167
GUI::instance()->options->showGroup(1);
167
FlGui::instance()->options->showGroup(1);
170
170
static void general_options_color_scheme_cb(Fl_Widget *w, void *data)
172
172
opt_general_color_scheme
173
(0, GMSH_SET, GUI::instance()->options->general.choice[3]->value());
173
(0, GMSH_SET, FlGui::instance()->options->general.choice[3]->value());
174
drawContext::global()->draw();
177
177
static void general_options_rotation_center_select_cb(Fl_Widget *w, void *data)
179
179
Msg::StatusBar(3, false, "Select entity\n[Press 'q' to abort]");
180
char ib = GUI::instance()->selectEntity(ENT_ALL);
180
char ib = FlGui::instance()->selectEntity(ENT_ALL);
182
182
SPoint3 pc(0., 0., 0.);
183
if(GUI::instance()->selectedVertices.size())
184
pc.setPosition(GUI::instance()->selectedVertices[0]->x(),
185
GUI::instance()->selectedVertices[0]->y(),
186
GUI::instance()->selectedVertices[0]->z());
187
else if(GUI::instance()->selectedEdges.size())
188
pc = GUI::instance()->selectedEdges[0]->bounds().center();
189
else if(GUI::instance()->selectedFaces.size())
190
pc = GUI::instance()->selectedFaces[0]->bounds().center();
191
else if(GUI::instance()->selectedRegions.size())
192
pc = GUI::instance()->selectedRegions[0]->bounds().center();
193
else if(GUI::instance()->selectedElements.size())
194
pc = GUI::instance()->selectedElements[0]->barycenter();
183
if(FlGui::instance()->selectedVertices.size())
184
pc.setPosition(FlGui::instance()->selectedVertices[0]->x(),
185
FlGui::instance()->selectedVertices[0]->y(),
186
FlGui::instance()->selectedVertices[0]->z());
187
else if(FlGui::instance()->selectedEdges.size())
188
pc = FlGui::instance()->selectedEdges[0]->bounds().center();
189
else if(FlGui::instance()->selectedFaces.size())
190
pc = FlGui::instance()->selectedFaces[0]->bounds().center();
191
else if(FlGui::instance()->selectedRegions.size())
192
pc = FlGui::instance()->selectedRegions[0]->bounds().center();
193
else if(FlGui::instance()->selectedElements.size())
194
pc = FlGui::instance()->selectedElements[0]->barycenter();
195
195
opt_general_rotation_center_cg
196
(0, GMSH_SET, GUI::instance()->options->general.butt[15]->value());
196
(0, GMSH_SET, FlGui::instance()->options->general.butt[15]->value());
197
197
opt_general_rotation_center0(0, GMSH_SET|GMSH_GUI, pc.x());
198
198
opt_general_rotation_center1(0, GMSH_SET|GMSH_GUI, pc.y());
199
199
opt_general_rotation_center2(0, GMSH_SET|GMSH_GUI, pc.z());
201
201
GModel::current()->setSelection(0);
202
drawContext::global()->draw();
203
203
Msg::StatusBar(3, false, "");
206
206
static void general_options_ok_cb(Fl_Widget *w, void *data)
208
optionWindow *o = GUI::instance()->options;
208
optionWindow *o = FlGui::instance()->options;
209
209
o->activate((const char*)data);
211
211
static double lc = 0.;
322
322
opt_general_arrow_head_radius(0, GMSH_SET, a);
323
323
opt_general_arrow_stem_length(0, GMSH_SET, b);
324
324
opt_general_arrow_stem_radius(0, GMSH_SET, c);
325
drawContext::global()->draw();
329
329
void geometry_options_cb(Fl_Widget *w, void *data)
331
GUI::instance()->options->showGroup(2);
331
FlGui::instance()->options->showGroup(2);
334
334
static void geometry_options_ok_cb(Fl_Widget *w, void *data)
336
optionWindow *o = GUI::instance()->options;
336
optionWindow *o = FlGui::instance()->options;
337
337
o->activate((const char*)data);
339
339
opt_geometry_points(0, GMSH_SET, o->geo.butt[0]->value());
351
351
opt_geometry_occ_fix_small_faces(0, GMSH_SET, o->geo.butt[12]->value());
352
352
opt_geometry_occ_sew_faces(0, GMSH_SET, o->geo.butt[13]->value());
353
353
opt_geometry_light_two_side(0, GMSH_SET, o->geo.butt[14]->value());
354
opt_geometry_occ_connect_faces(0, GMSH_SET, o->geo.butt[15]->value());
355
356
opt_geometry_normals(0, GMSH_SET, o->geo.value[0]->value());
356
357
opt_geometry_tangents(0, GMSH_SET, o->geo.value[1]->value());
380
381
if(CTX::instance()->fastRedraw)
381
382
CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0;
383
drawContext::global()->draw();
383
384
CTX::instance()->post.draw = CTX::instance()->mesh.draw = 1;
386
387
void mesh_options_cb(Fl_Widget *w, void *data)
388
GUI::instance()->options->showGroup(3);
389
FlGui::instance()->options->showGroup(3);
391
392
static void mesh_options_ok_cb(Fl_Widget *w, void *data)
393
optionWindow *o = GUI::instance()->options;
394
optionWindow *o = FlGui::instance()->options;
394
395
o->activate((const char*)data);
396
397
opt_mesh_reverse_all_normals(0, GMSH_SET, o->mesh.butt[0]->value());
441
442
opt_mesh_point_type(0, GMSH_SET, o->mesh.choice[0]->value());
442
443
opt_mesh_algo2d(0, GMSH_SET,
443
(o->mesh.choice[2]->value() == 0) ? ALGO_2D_FRONTAL :
444
(o->mesh.choice[2]->value() == 0) ? ALGO_2D_MESHADAPT :
444
445
(o->mesh.choice[2]->value() == 1) ? ALGO_2D_DELAUNAY :
445
ALGO_2D_MESHADAPT_DELAUNAY);
446
447
opt_mesh_algo3d(0, GMSH_SET,
447
(o->mesh.choice[3]->value() == 0) ? ALGO_3D_TETGEN_DELAUNAY :
448
(o->mesh.choice[3]->value() == 0) ? ALGO_3D_DELAUNAY :
449
450
opt_mesh_algo_subdivide(0, GMSH_SET, o->mesh.choice[5]->value());
450
451
opt_mesh_color_carousel(0, GMSH_SET, o->mesh.choice[4]->value());
451
452
opt_mesh_quality_type(0, GMSH_SET, o->mesh.choice[6]->value());
454
455
if(CTX::instance()->fastRedraw)
455
456
CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0;
457
drawContext::global()->draw();
457
458
CTX::instance()->post.draw = CTX::instance()->mesh.draw = 1;
460
461
void solver_options_cb(Fl_Widget *w, void *data)
462
GUI::instance()->options->showGroup(4);
463
FlGui::instance()->options->showGroup(4);
465
466
static void solver_options_ok_cb(Fl_Widget *w, void *data)
467
optionWindow *o = GUI::instance()->options;
468
optionWindow *o = FlGui::instance()->options;
468
469
o->activate((const char*)data);
470
471
int old_listen = (int)opt_solver_listen(0, GMSH_GET, o->solver.butt[0]->value());
477
478
if(CTX::instance()->fastRedraw)
478
479
CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0;
480
drawContext::global()->draw();
480
481
CTX::instance()->post.draw = CTX::instance()->mesh.draw = 1;
483
484
void post_options_cb(Fl_Widget *w, void *data)
485
GUI::instance()->options->showGroup(5);
486
FlGui::instance()->options->showGroup(5);
488
489
static void post_options_ok_cb(Fl_Widget *w, void *data)
490
optionWindow *o = GUI::instance()->options;
491
optionWindow *o = FlGui::instance()->options;
491
492
o->activate((const char*)data);
493
494
opt_post_anim_cycle(0, GMSH_SET, o->post.butt[0]->value());
1111
1112
if(CTX::instance()->fastRedraw)
1112
1113
CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0;
1114
drawContext::global()->draw();
1114
1115
CTX::instance()->post.draw = CTX::instance()->mesh.draw = 1;
1117
1118
static void view_options_max_recursion_cb(Fl_Widget *w, void *data)
1119
1120
std::string str((const char*)data);
1120
int val = (int)GUI::instance()->options->view.value[33]->value();
1121
int val = (int)FlGui::instance()->options->view.value[33]->value();
1121
1122
if(str == "-" && val > 0)
1122
GUI::instance()->options->view.value[33]->value(val - 1);
1123
FlGui::instance()->options->view.value[33]->value(val - 1);
1123
1124
else if(str == "+")
1124
GUI::instance()->options->view.value[33]->value(val + 1);
1125
FlGui::instance()->options->view.value[33]->value(val + 1);
1125
1126
view_options_ok_cb(0, 0);
1627
1628
(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Sew faces in OpenCascade models");
1628
1629
geo.butt[13]->type(FL_TOGGLE_BUTTON);
1629
1630
geo.butt[13]->callback(geometry_options_ok_cb);
1631
geo.butt[15] = new Fl_Check_Button
1632
(L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Cut and merge faces in OpenCascade models");
1633
geo.butt[15]->type(FL_TOGGLE_BUTTON);
1634
geo.butt[15]->callback(geometry_options_ok_cb);
1631
1636
#if !defined(HAVE_OCC)
1632
1637
geo.butt[11]->deactivate();
1633
1638
geo.butt[12]->deactivate();
1634
1639
geo.butt[13]->deactivate();
1640
geo.butt[15]->deactivate();