From d007c2fa04aa9e6bbf02e7e7e663a79d859c3ea5 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sun, 14 Feb 2016 09:22:20 +0000 Subject: [PATCH] do a onelab(check) when opening/merging/renaming files --- Fltk/graphicWindow.cpp | 21 +++++++++++++-------- utils/solvers/c++/onelab.h | 11 ++++++++--- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index 9d8186ce00..b05f188d80 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -150,8 +150,12 @@ static void file_open_merge_cb(Fl_Widget *w, void *data) } if(n != (int)PView::list.size()) FlGui::instance()->openModule("Post-processing"); - if(CTX::instance()->launchSolverAtStartup >= 0) + if(CTX::instance()->launchSolverAtStartup >= 0){ solver_cb(0, (void*)CTX::instance()->launchSolverAtStartup); + } + else{ + onelab_cb(0, (void*)"check"); + } } static void file_open_recent_cb(Fl_Widget *w, void *data) @@ -163,8 +167,12 @@ static void file_open_recent_cb(Fl_Widget *w, void *data) drawContext::global()->draw(); if(n != (int)PView::list.size()) FlGui::instance()->openModule("Post-processing"); - if(CTX::instance()->launchSolverAtStartup >= 0) + if(CTX::instance()->launchSolverAtStartup >= 0){ solver_cb(0, (void*)CTX::instance()->launchSolverAtStartup); + } + else{ + onelab_cb(0, (void*)"check"); + } } static void file_clear_cb(Fl_Widget *w, void *data) @@ -494,6 +502,7 @@ static void file_rename_cb(Fl_Widget *w, void *data) rename(GModel::current()->getFileName().c_str(), name.c_str()); GModel::current()->setFileName(name); GModel::current()->setName(SplitFileName(name)[1]); + onelab_cb(0, (void*)"check"); drawContext::global()->draw(); } } @@ -573,18 +582,14 @@ void onelab_reload_cb(Fl_Widget *w, void *data) std::string fileName = GModel::current()->getFileName(); ClearProject(); - GModel::current()->setFileName(fileName); - //OpenProject(fileName); - onelab_cb(0, (void*)"reset"); // this will call OpenProject - + onelab_cb(0, (void*)"reset"); // will call OpenProject drawContext::global()->draw(); } void geometry_reload_cb(Fl_Widget *w, void *data) { - std::string fileName = GModel::current()->getFileName(); - OpenProject(fileName); + onelab_cb(0, (void*)"check"); // will call OpenProject drawContext::global()->draw(); } diff --git a/utils/solvers/c++/onelab.h b/utils/solvers/c++/onelab.h index adffa0d5ac..912f0d2ddb 100644 --- a/utils/solvers/c++/onelab.h +++ b/utils/solvers/c++/onelab.h @@ -568,7 +568,8 @@ namespace onelab{ } return true; } - template <class T> T* _getPtr(std::string name, const std::string client, std::set<T*, parameterLessThan> ps) + template <class T> T* _getPtr(std::string name, const std::string client, + std::set<T*, parameterLessThan> ps) { T tmp(name); typename std::set<T*, parameterLessThan>::iterator it = ps.find(&tmp); @@ -611,9 +612,13 @@ namespace onelab{ bool get(std::vector<onelab::string> &ps, const std::string &name="", const std::string &client=""){ return _get(ps, name, client, _strings); } void getPtr(number **ptr, const std::string name, const std::string client="") - {*ptr = _getPtr(name, client, _numbers);} + { + *ptr = _getPtr(name, client, _numbers); + } void getPtr(string **ptr, const std::string name, const std::string client="") - {*ptr = _getPtr(name, client, _strings);} + { + *ptr = _getPtr(name, client, _strings); + } void getAllParameters(std::set<parameter*, parameterLessThan> &ps) const { ps.insert(_numbers.begin(), _numbers.end()); -- GitLab