From 7e56e5d02950250d500d7e86d35dda5bde55a62e Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 21 Dec 2000 10:41:03 +0000
Subject: [PATCH] post.nb_views

---
 Common/Context.h   | 4 ++--
 Common/Options.h   | 3 ++-
 Common/Views.cpp   | 4 +++-
 Unix/CbContext.cpp | 4 +++-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/Common/Context.h b/Common/Context.h
index ee31682287..a6065ff486 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -1,4 +1,4 @@
-/* $Id: Context.h,v 1.21 2000-12-20 10:40:49 geuzaine Exp $ */
+/* $Id: Context.h,v 1.22 2000-12-21 10:41:01 geuzaine Exp $ */
 #ifndef _CONTEXT_H_
 #define _CONTEXT_H_
 
@@ -135,7 +135,7 @@ class Context_T {
   struct{
     int draw, scales, link ;
     int  initial_visibility, initial_nbiso, initial_intervals ;
-    long anim_delay ;
+    long anim_delay, nb_views ;
   }post;
 
   /* print options */
diff --git a/Common/Options.h b/Common/Options.h
index a644bbea31..a63800439a 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -1,4 +1,4 @@
-/* $Id: Options.h,v 1.10 2000-12-21 10:19:56 geuzaine Exp $ */
+/* $Id: Options.h,v 1.11 2000-12-21 10:41:02 geuzaine Exp $ */
 #ifndef _OPTIONS_H_
 #define _OPTIONS_H_
 
@@ -190,6 +190,7 @@ StringXNumber PostProcessingOptions_Number[] = {
   { "IntervalsMode"    , GMSH_INT,    (void*)&CTX.post.initial_intervals  , DRAW_POST_ISO }, 
   { "IntervalsNumber"  , GMSH_INT,    (void*)&CTX.post.initial_nbiso      , 15. }, 
   { "AnimationDelay"   , GMSH_INT,    (void*)&CTX.post.anim_delay         , 0. }, 
+  { "NbViews"          , GMSH_INT,    (void*)&CTX.post.nb_views           , 0. }, 
   { NULL               , GMSH_DOUBLE, NULL , 0. }
 } ;
 
diff --git a/Common/Views.cpp b/Common/Views.cpp
index f7a57fac4e..ef9e02e1f7 100644
--- a/Common/Views.cpp
+++ b/Common/Views.cpp
@@ -1,4 +1,4 @@
-/* $Id: Views.cpp,v 1.18 2000-12-18 09:03:51 geuzaine Exp $ */
+/* $Id: Views.cpp,v 1.19 2000-12-21 10:41:02 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Views.h"
@@ -254,6 +254,7 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name,
   if(!Number){
     ActualView->Num = ++ActualViewNum;    
     List_Add(Post_ViewList,ActualView);
+    CTX.post.nb_views = List_Nbr(Post_ViewList);
     if(AddInUI)
       AddViewInUI(List_Nbr(Post_ViewList), ActualView->Name, ActualView->Num);
   }
@@ -276,6 +277,7 @@ bool FreeView(int num){
   v = (Post_View*)List_Pointer(Post_ViewList, num);
   FreeView(v);
   List_Suppress(Post_ViewList, v, fcmpPostViewNum);
+  CTX.post.nb_views = List_Nbr(Post_ViewList);
 
   Msg(INFOS, "View %d deleted (%d views left)",num, List_Nbr(Post_ViewList));
   return true;
diff --git a/Unix/CbContext.cpp b/Unix/CbContext.cpp
index 1c0f3a286d..fa99ffd5bc 100644
--- a/Unix/CbContext.cpp
+++ b/Unix/CbContext.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbContext.cpp,v 1.8 2000-12-13 13:57:00 geuzaine Exp $ */
+/* $Id: CbContext.cpp,v 1.9 2000-12-21 10:41:03 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -633,6 +633,8 @@ void RemoveViewCb(Widget w, XtPointer client_data, XtPointer call_data){
   if(!List_Suppress(Post_ViewList, v, fcmpPostViewNum))
     Msg(ERROR, "Could Not Suppress View from List");
 
+  CTX.post.nb_views = List_Nbr(Post_ViewList);
+
   if(actual_global_context == CONTEXT_POST)
     ActualizeContextCb(NULL,(XtPointer)actual_global_context,NULL);  
 
-- 
GitLab