From 0e2c2b05c6964eae75fe85bad40a4c714e22b58d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert=20Kl=C3=B6fkorn?= <robertk@dune-project.org>
Date: Thu, 17 Mar 2005 23:09:38 +0000
Subject: [PATCH] Bugfix for LeafIterator Button. Now works correct.

[[Imported from SVN: r1671]]
---
 io/visual/grape/ghmesh.cc | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/io/visual/grape/ghmesh.cc b/io/visual/grape/ghmesh.cc
index 9b1e36990..734c975a8 100644
--- a/io/visual/grape/ghmesh.cc
+++ b/io/visual/grape/ghmesh.cc
@@ -1157,16 +1157,8 @@ int switchMethods(GENMESHnD *actHmesh)
       printf("Warning: Only data on leaf level, use LeafIterator! \n");
   }
 
-  if(leafButton->on_off == OFF)
-  {
-    /* the button is not pressed */
-    dune->first_macro = dune->fst_macro;
-    dune->next_macro  = dune->nxt_macro;
-    actHmesh->first_child = &first_child;
-    actHmesh->next_child = &next_child;
-    /*printf("Leaf is off \n");*/
-  }
-  else
+  // this marks the state before
+  if(leafButton->on_off == OFF) // off means it is going to be on
   {
     /* the button is pressed */
     dune->first_macro = dune->fst_leaf;
@@ -1176,6 +1168,15 @@ int switchMethods(GENMESHnD *actHmesh)
     isLeaf = 1;
     /*printf("Leaf is on \n");*/
   }
+  else
+  {
+    /* the button is not pressed */
+    dune->first_macro = dune->fst_macro;
+    dune->next_macro  = dune->nxt_macro;
+    actHmesh->first_child = &first_child;
+    actHmesh->next_child = &next_child;
+    /*printf("Leaf is off \n");*/
+  }
 
   return isLeaf;
 }
-- 
GitLab