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

- if iView==-1 and there is no current view, use the last one (instead of View[0])

- simpler plugin script save
parent dd43e88f
Branches
Tags
No related merge requests found
...@@ -109,16 +109,8 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view) ...@@ -109,16 +109,8 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view)
if(!FlGui::instance()->plugins->record->value()) return; if(!FlGui::instance()->plugins->record->value()) return;
std::string fileName; std::string fileName;
int oldIndex = -1; if(view)
if(view){
for(int i = 0; i < p->getNbOptions(); i++){
if(p->getOption(i)->str == "iView") {
oldIndex = p->getOption(i)->def;
p->getOption(i)->def = view->getIndex();
}
}
fileName = view->getData()->getFileName(); fileName = view->getData()->getFileName();
}
else else
fileName = GModel::current()->getFileName(); fileName = GModel::current()->getFileName();
...@@ -131,14 +123,6 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view) ...@@ -131,14 +123,6 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view)
fprintf(fp, "%s", p->serialize().c_str()); fprintf(fp, "%s", p->serialize().c_str());
fclose(fp); fclose(fp);
} }
if(view && oldIndex != -1){
for(int i = 0; i < p->getNbOptions(); i++){
if(p->getOption(i)->str == "iView"){
p->getOption(i)->def = oldIndex;
}
}
}
} }
static void plugin_run_cb(Fl_Widget *w, void *data) static void plugin_run_cb(Fl_Widget *w, void *data)
......
...@@ -78,7 +78,7 @@ PView *GMSH_PostPlugin::executeRemote(PView *view) ...@@ -78,7 +78,7 @@ PView *GMSH_PostPlugin::executeRemote(PView *view)
PView *GMSH_PostPlugin::getView(int index, PView *view) PView *GMSH_PostPlugin::getView(int index, PView *view)
{ {
if(index < 0) if(index < 0)
index = view ? view->getIndex() : 0; index = view ? view->getIndex() : PView::list.size() - 1;
if(index >= 0 && index < (int)PView::list.size()){ if(index >= 0 && index < (int)PView::list.size()){
return PView::list[index]; return PView::list[index];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment