Skip to content
Snippets Groups Projects
Commit 584abd46 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

better

parent 36143206
No related branches found
No related tags found
No related merge requests found
...@@ -36,24 +36,25 @@ static void numberOrStringChooser(const std::string &category, int index, ...@@ -36,24 +36,25 @@ static void numberOrStringChooser(const std::string &category, int index,
NumberOption(GMSH_GET, category.c_str(), index, name.c_str(), valn); NumberOption(GMSH_GET, category.c_str(), index, name.c_str(), valn);
else else
StringOption(GMSH_GET, category.c_str(), index, name.c_str(), vals); StringOption(GMSH_GET, category.c_str(), index, name.c_str(), vals);
int width = 3 * BB, height = BH; int width = 4 * BB, height = BH;
int BB1 = (int)(3. * BB / 4.), BB2 = 2 * BB - BB1;
Fl_Double_Window *win = new Fl_Double_Window(width, height, "Set Value"); Fl_Double_Window *win = new Fl_Double_Window(width, height, "Set Value");
win->border(0); win->border(0);
win->set_modal(); win->set_modal();
win->hotspot(win); //win->hotspot(win);
win->position(Fl::event_x_root() - BB, Fl::event_y_root() - BH / 2);
Fl_Value_Input *number = 0; Fl_Value_Input *number = 0;
Fl_Input *string = 0; Fl_Input *string = 0;
if(num){ if(num){
number = new Fl_Value_Input(0, 0, width - BB, height); number = new Fl_Value_Input(0, 0, width - BB1 - BB2, height);
number->when(FL_WHEN_ENTER_KEY_ALWAYS);
number->value(valn); number->value(valn);
} }
else{ else{
string = new Fl_Input(0, 0, width - BB, height); string = new Fl_Input(0, 0, width - BB1 - BB2, height);
string->when(FL_WHEN_ENTER_KEY_ALWAYS);
string->value(vals.c_str()); string->value(vals.c_str());
} }
Fl_Button *reset = new Fl_Button(width - BB, 0, BB, height, "Use default"); Fl_Button *set = new Fl_Return_Button(width - BB1 - BB2, 0, BB1, height, "Set");
Fl_Button *reset = new Fl_Button(width - BB2, 0, BB2, height, "Restore default");
win->end(); win->end();
win->show(); win->show();
if(number) number->take_focus(); if(number) number->take_focus();
...@@ -68,16 +69,17 @@ static void numberOrStringChooser(const std::string &category, int index, ...@@ -68,16 +69,17 @@ static void numberOrStringChooser(const std::string &category, int index,
if (o == win) { if (o == win) {
done = true; done = true;
} }
if(o == number){ if(o == set){
valn = number->value(); if(num){
NumberOption(GMSH_SET|GMSH_GUI, category.c_str(), index, valn = number->value();
name.c_str(), valn); NumberOption(GMSH_SET|GMSH_GUI, category.c_str(), index,
done = true; name.c_str(), valn);
} }
if(o == string){ else{
vals = string->value(); vals = string->value();
StringOption(GMSH_SET|GMSH_GUI, category.c_str(), index, StringOption(GMSH_SET|GMSH_GUI, category.c_str(), index,
name.c_str(), vals); name.c_str(), vals);
}
done = true; done = true;
} }
if(o == reset){ if(o == reset){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment