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
No related branches found
No related tags found
No related merge requests found
......@@ -109,16 +109,8 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view)
if(!FlGui::instance()->plugins->record->value()) return;
std::string fileName;
int oldIndex = -1;
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();
}
}
if(view)
fileName = view->getData()->getFileName();
}
else
fileName = GModel::current()->getFileName();
......@@ -131,14 +123,6 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view)
fprintf(fp, "%s", p->serialize().c_str());
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)
......
......@@ -78,7 +78,7 @@ PView *GMSH_PostPlugin::executeRemote(PView *view)
PView *GMSH_PostPlugin::getView(int index, PView *view)
{
if(index < 0)
index = view ? view->getIndex() : 0;
index = view ? view->getIndex() : PView::list.size() - 1;
if(index >= 0 && index < (int)PView::list.size()){
return PView::list[index];
......
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