From 781660dabfa52f68233c4edd6659f7db11bf58e2 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sat, 30 Oct 2004 15:23:23 +0000
Subject: [PATCH] better detection of the view number

---
 Plugin/CutMap.cpp   | 6 ++++--
 Plugin/CutPlane.cpp | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Plugin/CutMap.cpp b/Plugin/CutMap.cpp
index e561141eef..f287fa08ec 100644
--- a/Plugin/CutMap.cpp
+++ b/Plugin/CutMap.cpp
@@ -1,4 +1,4 @@
-// $Id: CutMap.cpp,v 1.39 2004-10-30 03:07:29 geuzaine Exp $
+// $Id: CutMap.cpp,v 1.40 2004-10-30 15:23:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -49,7 +49,9 @@ double GMSH_CutMapPlugin::callbackA(int num, int action, double value)
 {
   double min = 0., max = 1.;
   if(action > 0){
-    Post_View *v = (Post_View*)List_Pointer_Test(CTX.post.list, num);
+    int iview = (int)CutMapOptions_Number[3].def;
+    if(iview < 0) iview = num;
+    Post_View *v = (Post_View*)List_Pointer_Test(CTX.post.list, iview);
     if(v){
       min = v->Min;
       max = v->Max;
diff --git a/Plugin/CutPlane.cpp b/Plugin/CutPlane.cpp
index 3d5b1a291b..1f2513bff7 100644
--- a/Plugin/CutPlane.cpp
+++ b/Plugin/CutPlane.cpp
@@ -1,4 +1,4 @@
-// $Id: CutPlane.cpp,v 1.35 2004-10-30 03:07:29 geuzaine Exp $
+// $Id: CutPlane.cpp,v 1.36 2004-10-30 15:23:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -56,7 +56,9 @@ GMSH_CutPlanePlugin::GMSH_CutPlanePlugin()
 void GMSH_CutPlanePlugin::draw()
 {
 #if defined(HAVE_FLTK)
-  Post_View *v = (Post_View*)List_Pointer_Test(CTX.post.list, iview);
+  int num = (int)CutPlaneOptions_Number[4].def;
+  if(num < 0) num = iview;
+  Post_View *v = (Post_View*)List_Pointer_Test(CTX.post.list, num);
   if(!v) return;
   Draw_PlaneInBoundingBox(v->BBox[0], v->BBox[2], v->BBox[4],
 			  v->BBox[1], v->BBox[3], v->BBox[5],
-- 
GitLab