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

attribute "GmshOption" to set Gmsh options directly from onelab (without using a macro)

parent a54d1007
No related branches found
No related tags found
No related merge requests found
...@@ -778,6 +778,7 @@ static void _setStandardOptions(onelab::parameter *p, ...@@ -778,6 +778,7 @@ static void _setStandardOptions(onelab::parameter *p,
if(copt.count("Highlight")) p->setAttribute("Highlight", copt["Highlight"][0]); if(copt.count("Highlight")) p->setAttribute("Highlight", copt["Highlight"][0]);
if(copt.count("AutoCheck")) p->setAttribute("AutoCheck", copt["AutoCheck"][0]); if(copt.count("AutoCheck")) p->setAttribute("AutoCheck", copt["AutoCheck"][0]);
if(copt.count("Macro")) p->setAttribute("Macro", copt["Macro"][0]); if(copt.count("Macro")) p->setAttribute("Macro", copt["Macro"][0]);
if(copt.count("GmshOption")) p->setAttribute("GmshOption", copt["GmshOption"][0]);
} }
static std::string _getParameterName(const std::string &key, static std::string _getParameterName(const std::string &key,
......
...@@ -27,6 +27,7 @@ typedef unsigned long intptr_t; ...@@ -27,6 +27,7 @@ typedef unsigned long intptr_t;
#include "graphicWindow.h" #include "graphicWindow.h"
#include "fileDialogs.h" #include "fileDialogs.h"
#include "onelabGroup.h" #include "onelabGroup.h"
#include "Gmsh.h"
#include "FlGui.h" #include "FlGui.h"
#include "Context.h" #include "Context.h"
#include "GModel.h" #include "GModel.h"
...@@ -853,6 +854,16 @@ viewButton *onelabGroup::getViewButton(int num) ...@@ -853,6 +854,16 @@ viewButton *onelabGroup::getViewButton(int num)
return 0; return 0;
} }
static void setGmshOption(onelab::number &n)
{
std::string opt = n.getAttribute("GmshOption");
if(opt.empty()) return;
std::string::size_type dot = opt.find('.');
if(dot == std::string::npos) return;
GmshSetOption(opt.substr(0, dot), opt.substr(dot + 1), n.getValue());
drawContext::global()->draw();
}
static void onelab_number_check_button_cb(Fl_Widget *w, void *data) static void onelab_number_check_button_cb(Fl_Widget *w, void *data)
{ {
if(!data) return; if(!data) return;
...@@ -864,6 +875,7 @@ static void onelab_number_check_button_cb(Fl_Widget *w, void *data) ...@@ -864,6 +875,7 @@ static void onelab_number_check_button_cb(Fl_Widget *w, void *data)
onelab::number old = numbers[0]; onelab::number old = numbers[0];
numbers[0].setValue(o->value()); numbers[0].setValue(o->value());
onelab::server::instance()->set(numbers[0]); onelab::server::instance()->set(numbers[0]);
setGmshOption(numbers[0]);
autoCheck(old, numbers[0]); autoCheck(old, numbers[0]);
} }
} }
...@@ -880,6 +892,7 @@ static void onelab_number_choice_cb(Fl_Widget *w, void *data) ...@@ -880,6 +892,7 @@ static void onelab_number_choice_cb(Fl_Widget *w, void *data)
onelab::number old = numbers[0]; onelab::number old = numbers[0];
if(o->value() < (int)choices.size()) numbers[0].setValue(choices[o->value()]); if(o->value() < (int)choices.size()) numbers[0].setValue(choices[o->value()]);
onelab::server::instance()->set(numbers[0]); onelab::server::instance()->set(numbers[0]);
setGmshOption(numbers[0]);
autoCheck(old, numbers[0]); autoCheck(old, numbers[0]);
} }
} }
...@@ -904,6 +917,7 @@ static void onelab_number_input_range_cb(Fl_Widget *w, void *data) ...@@ -904,6 +917,7 @@ static void onelab_number_input_range_cb(Fl_Widget *w, void *data)
numbers[0].setAttribute("Loop", o->loop()); numbers[0].setAttribute("Loop", o->loop());
numbers[0].setAttribute("Graph", o->graph()); numbers[0].setAttribute("Graph", o->graph());
onelab::server::instance()->set(numbers[0]); onelab::server::instance()->set(numbers[0]);
setGmshOption(numbers[0]);
updateGraphs(); updateGraphs();
autoCheck(old, numbers[0]); autoCheck(old, numbers[0]);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment