From 60d188976eb8ede2dbfddb4b234b8971a30663a4 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sat, 26 Jan 2002 01:25:20 +0000
Subject: [PATCH] Remove invisible views

---
 Fltk/Callbacks.cpp | 13 ++++++++++++-
 Fltk/Callbacks.h   |  1 +
 Fltk/GUI.cpp       |  4 +++-
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index d83419c224..1a471b8633 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.101 2002-01-03 10:25:06 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.102 2002-01-26 01:25:20 geuzaine Exp $
 
 #include <sys/types.h>
 #include <signal.h>
@@ -1775,6 +1775,17 @@ void view_remove_visible_cb(CALLBACK_ARGS) {
   Draw();
 }
 
+void view_remove_invisible_cb(CALLBACK_ARGS) {
+  int i;
+  if(!CTX.post.list) return;
+  REMOVE_ALL_VIEWS = 1;
+  for(i=List_Nbr(CTX.post.list)-1 ; i>=0 ; i--)
+    if(!opt_view_visible(i, GMSH_GET, 0))
+      view_remove_cb(NULL, (void*)i);
+  REMOVE_ALL_VIEWS = 0;
+  Draw();
+}
+
 void view_remove_cb(CALLBACK_ARGS){
   int i, play=0;
 
diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h
index ce82715571..9580932b88 100644
--- a/Fltk/Callbacks.h
+++ b/Fltk/Callbacks.h
@@ -222,6 +222,7 @@ void view_reload_visible_cb(CALLBACK_ARGS) ;
 void view_remove_cb(CALLBACK_ARGS) ;
 void view_remove_all_cb(CALLBACK_ARGS) ;
 void view_remove_visible_cb(CALLBACK_ARGS) ;
+void view_remove_invisible_cb(CALLBACK_ARGS) ;
 void view_save_ascii_cb(CALLBACK_ARGS) ;
 void view_save_binary_cb(CALLBACK_ARGS) ;
 void view_duplicate_cb(CALLBACK_ARGS) ;
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index c5cf0d062b..e25cbcc6ad 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.143 2002-01-21 18:49:17 geuzaine Exp $
+// $Id: GUI.cpp,v 1.144 2002-01-26 01:25:20 geuzaine Exp $
 
 // To make the interface as visually consistent as possible, please:
 // - use the IW, BB, BH, BW and WB values
@@ -674,6 +674,8 @@ void GUI::create_menu_window(int argc, char **argv){
 			 (Fl_Callback *)view_remove_all_cb, (void*)i, 0);
     m_popup_butt[i]->add("Remove/All visible views", 0, 
 			 (Fl_Callback *)view_remove_visible_cb, (void*)i, 0);
+    m_popup_butt[i]->add("Remove/All invisible views", 0, 
+			 (Fl_Callback *)view_remove_invisible_cb, (void*)i, 0);
     m_popup_butt[i]->add("Duplicate/View without options", 0,
 			 (Fl_Callback *)view_duplicate_cb, (void*)i, 0) ;
     m_popup_butt[i]->add("Duplicate/View with options", 0,
-- 
GitLab