From d4b880159e14313669ce567d6d294de21639343c Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 31 Jan 2012 06:01:50 +0000
Subject: [PATCH] fine-tuning

---
 Fltk/onelabWindow.cpp |  2 +-
 Post/PView.cpp        | 19 ++++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/Fltk/onelabWindow.cpp b/Fltk/onelabWindow.cpp
index 8c03508dfb..f5d184aa35 100644
--- a/Fltk/onelabWindow.cpp
+++ b/Fltk/onelabWindow.cpp
@@ -127,8 +127,8 @@ static void mergePostProcessingFile(const std::string &fileName)
   GModel *old = GModel::current();
   if(haveMesh){
     GModel *m = new GModel();
+    m->setVisibility(0);
     GModel::setCurrent(m);
-    m->setVisibility(false);
   }
   MergeFile(fileName);
   GModel::setCurrent(old);
diff --git a/Post/PView.cpp b/Post/PView.cpp
index 0b6ed79263..cdf0593a6d 100644
--- a/Post/PView.cpp
+++ b/Post/PView.cpp
@@ -102,7 +102,7 @@ PView::PView(std::string xname, std::string yname,
   _options->axesLabel[0] = xname;
 }
 
-PView::PView(std::string name, std::string type, 
+PView::PView(std::string name, std::string type,
              GModel *model, std::map<int, std::vector<double> > &data,
              double time, int numComp)
 {
@@ -129,7 +129,7 @@ PView::PView(std::string name, std::string type,
                             _options->targetError);
 }
 
-void PView::addStep(GModel *model, std::map<int, std::vector<double> > &data, 
+void PView::addStep(GModel *model, std::map<int, std::vector<double> > &data,
                     double time, int numComp)
 {
   PViewDataGModel *d = dynamic_cast<PViewDataGModel*>(_data);
@@ -153,14 +153,14 @@ PView::~PView()
   for(unsigned int i = 0; i < list.size(); i++)
     if(list[i]->getAliasOf() == _num)
       return;
-  
+
   // do not delete if this view is an alias and 1) if the original
   // still exists, or 2) if there are other aliases to the same view
   if(_aliasOf)
     for(unsigned int i = 0; i < list.size(); i++)
       if(list[i]->getNum() == _aliasOf || list[i]->getAliasOf() == _aliasOf)
         return;
-  
+
   Msg::Debug("Deleting data in View[%d] (unique num = %d)", _index, _num);
   delete _data;
 }
@@ -183,7 +183,7 @@ void PView::setOptions(PViewOptions *val)
 }
 
 PViewData *PView::getData(bool useAdaptiveIfAvailable)
-{ 
+{
   if(useAdaptiveIfAvailable && _data->getAdaptiveData() && !_data->isRemote())
     return _data->getAdaptiveData()->getData();
   else
@@ -191,11 +191,11 @@ PViewData *PView::getData(bool useAdaptiveIfAvailable)
 }
 
 void PView::setChanged(bool val)
-{ 
-  _changed = val; 
+{
+  _changed = val;
   // reset the eye position everytime we change the view so that the
   // arrays get resorted for transparency
-  if(_changed) _eye = SPoint3(0., 0., 0.); 
+  if(_changed) _eye = SPoint3(0., 0., 0.);
 }
 
 void PView::combine(bool time, int how, bool remove)
@@ -284,7 +284,8 @@ void PView::combine(bool time, int how, bool remove)
 
 PView *PView::getViewByName(std::string name, int timeStep, int partition)
 {
-  for(unsigned int i = 0; i < list.size(); i++){
+  // search views from most recently to least recently added
+  for(int i = list.size() - 1; i >= 0; i--){
     if(list[i]->getData()->getName() == name &&
        ((timeStep < 0 || !list[i]->getData()->hasTimeStep(timeStep)) ||
         (partition < 0 || !list[i]->getData()->hasPartition(timeStep, partition))))
-- 
GitLab