]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Thu, 24 Apr 2008 10:11:27 +0000 (10:11 +0000)
committerguigues <guigues>
Thu, 24 Apr 2008 10:11:27 +0000 (10:11 +0000)
24 files changed:
kernel/cmake/BBTKAddDefinitions.cmake
kernel/cmake/BBTKDefineOptions.cmake
kernel/cmake/BBTKFindLibraries.cmake
kernel/src/CMakeLists.txt
kernel/src/bbtkAny.h
kernel/src/bbtkAtomicBlackBox.cxx
kernel/src/bbtkAtomicBlackBoxGetSetFunctor.h
kernel/src/bbtkAtomicBlackBoxMacros.h
kernel/src/bbtkBlackBox.cxx
kernel/src/bbtkBlackBoxInputConnector.cxx
kernel/src/bbtkBlackBoxOutputConnector.cxx
kernel/src/bbtkComplexBlackBox.cxx
kernel/src/bbtkConnection.cxx
kernel/src/bbtkMessageManager.cxx
kernel/src/bbtkWx.cxx
kernel/src/bbtkWx.h
kernel/src/bbtkWxBlackBox.cxx
kernel/src/bbtkWxBlackBox.h
kernel/src/bbtkWxGUIConsole.cxx
kernel/src/bbtkWxGUIConsole.h
kernel/src/bbtkWxGUIPackageBrowser.cxx
kernel/src/bbtkWxGUIPackageBrowser2.cxx
kernel/src/bbtkWxGUIScriptingInterface.cxx
kernel/src/bbtkWxGUITextEditor.cxx

index 6568de740afd94800147a649dc9c70b21a5f8bb5..9831d477ee1d59c894215fd2b607ee323ec0cc48 100644 (file)
@@ -21,6 +21,4 @@ ENDIF (BBTK_COMPILE_WARNING_MESSAGES)
 IF (BBTK_COMPILE_ERROR_MESSAGES) 
   ADD_DEF( BBTK_COMPILE_ERROR_MESSAGES )
 ENDIF (BBTK_COMPILE_ERROR_MESSAGES) 
-
-ADD_DEF(_USE_BOOST__)
 #-----------------------------------------------------------------------------
index 69531a065b95b7991ec2b233257c6201dba42616..e604473e49bb55d6753981f5387459040d63ae33 100644 (file)
@@ -53,9 +53,6 @@ ENDIF(BUILD_BBTK_DOC)
 
 #-----------------------------------------------------------------------------
 # BOOST C++
-OPTION(BBTK_USE_BOOST "Use the boost C++ library" ON)
-IF(BBTK_USE_BOOST)
-ADD_DEF( _USE_BOOST_ )
-ENDIF(BBTK_USE_BOOST)
+OPTION(BBTK_USE_INTERNAL_BOOST "Use the internal boost C++ library" OFF)
 #-----------------------------------------------------------------------------
 
index 6294b257f502fffa388cc36f3e26cc68af5b001a..9ed48fde924fbb2912e14575a8827c79e0303521 100644 (file)
@@ -157,3 +157,18 @@ IF(USE_TTH)
   MARK_AS_ADVANCED(LATEX_tth_CONVERTER)
 ENDIF(USE_TTH)
 #-----------------------------------------------------------------------------
+
+
+#-----------------------------------------------------------------------------
+# TO DO : FIND BOOST 
+SET(USE_BOOST TRUE)
+IF(USE_BOOST)
+  FIND_PACKAGE(Boost REQUIRED)
+  MESSAGE(STATUS "Looking for boost C++ library... - found in ${Boost_INCLUDE_DIRS}")
+  INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
+  LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} )
+  SET(BBTK_BOOST_LIBRARIES
+    boost_signals
+    )  
+ENDIF(USE_BOOST)
+#-----------------------------------------------------------------------------
index d8114d4ea794f7da9e814829b6429fc53d8cec82..8987f72d724c77175c53ecc8adf305bbee9513ba 100644 (file)
@@ -91,6 +91,16 @@ IF(BBTK_USE_WXWIDGETS)
 ENDIF(BBTK_USE_WXWIDGETS)
 #-----------------------------------------------------------------------------
 
+#-----------------------------------------------------------------------------
+# BOOST 
+IF(BBTK_USE_BOOST)
+  SET(BBTK_LINK_LIBRARIES
+    ${BBTK_LINK_LIBRARIES}
+    ${BBTK_BOOST_LIBRARIES} 
+    )  
+ENDIF(BBTK_USE_BOOST)
+#-----------------------------------------------------------------------------
+
 #-----------------------------------------------------------------------------
 # On unix systems, need to link against dl for dynamic librairies open/close
 IF(UNIX)
index d5ae85f10b91756ad6b1e3dfb6b8c2222012d776..3c8b534bfadef18635366bdb2a337e6bc9ab6f76 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkAny.h,v $
   Language:  C++
-  Date:      $Date: 2008/02/20 16:05:38 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2008/04/24 10:11:27 $
+  Version:   $Revision: 1.3 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -38,9 +38,7 @@
 #include "bbtkMessageManager.h"
 #include "bbtkException.h"
 
-#ifdef _USE_BOOST_
 #include <boost/type_traits/is_pointer.hpp>
-#endif 
 
 namespace bbtk 
 {
@@ -451,105 +449,5 @@ namespace bbtk
 
 
 
-/*
-
-// TRY TO INCLUDE BOOST DIRECTLY : OK WORKS !
-#include <algorithm>
-#include <typeinfo>
-
-#include "boost/config.hpp"
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/type_traits/is_reference.hpp>
-#include <boost/throw_exception.hpp>
-#include <boost/static_assert.hpp>
-
-
-namespace bbtk
-{
-
-
-  class bad_any_cast : public std::bad_cast
-  {
-  public:
-    virtual const char * what() const throw()
-    {
-      return "boost::bad_any_cast: "
-       "failed conversion using boost::any_cast";
-    }
-  };
-  
-  typedef any<thing> anything;
-
-  template<typename ValueType>
-  ValueType * any_cast(anything * operand)
-  {
-    return operand && operand->type() == typeid(ValueType)
-      ? &static_cast<anything::holder<ValueType> *>(operand->content)->held
-      : 0;
-  }
-  
-    template<typename ValueType>
-    const ValueType * any_cast(const anything * operand)
-    {
-        return any_cast<ValueType>(const_cast<anything *>(operand));
-    }
-
-    template<typename ValueType>
-    ValueType any_cast(const anything & operand)
-    {
-      typedef BOOST_DEDUCED_TYPENAME boost::remove_reference<ValueType>::type nonref;
-
-#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-        // If 'nonref' is still reference type, it means the user has not
-        // specialized 'remove_reference'.
-
-        // Please use BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION macro
-        // to generate specialization of remove_reference for your class
-        // See type traits library documentation for details
-      BOOST_STATIC_ASSERT(!boost::is_reference<nonref>::value);
-#endif
-
-        const nonref * result = any_cast<nonref>(&operand);
-        if(!result)
-            boost::throw_exception(bad_any_cast());
-        return *result;
-    }
-
-    template<typename ValueType>
-    ValueType any_cast(anything & operand)
-    {
-      typedef BOOST_DEDUCED_TYPENAME boost::remove_reference<ValueType>::type nonref;
-
-#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-        // The comment in the above version of 'any_cast' explains when this
-        // assert is fired and what to do.
-        BOOST_STATIC_ASSERT(!is_reference<nonref>::value);
-#endif
-
-        nonref * result = any_cast<nonref>(&operand);
-        if(!result)
-            boost::throw_exception(bad_any_cast());
-        return *result;
-    }
-
-    // Note: The "unsafe" versions of any_cast are not part of the
-    // public interface and may be removed at any time. They are
-    // required where we know what type is stored in the any and can't
-    // use typeid() comparison, e.g., when our types may travel across
-    // different shared libraries.
-    template<typename ValueType>
-    inline ValueType * unsafe_any_cast(anything * operand)
-    {
-        return &static_cast<anything::holder<ValueType> *>(operand->content)->held;
-    }
-
-    template<typename ValueType>
-    inline const ValueType * unsafe_any_cast(const anything * operand)
-    {
-        return unsafe_any_cast<ValueType>(const_cast<anything *>(operand));
-    }
-}
-*/ // EO TRY TO INCLUDE BOOST
-
 #endif
 
index 99fe6d25946abc9f219d07f95a6ca5b09227b2f0..1dba6df361e943a0857a2fdaa979883317692e59 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkAtomicBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/21 12:43:05 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2008/04/24 10:11:27 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -76,14 +76,14 @@ namespace bbtk
   /// Main processing method of the box.
   IOStatus AtomicBlackBox::bbBackwardUpdate( Connection::Pointer caller )
   {
-    bbtkDebugMessageInc("Process",1,
+    bbtkDebugMessageInc("process",3,
                        "=> AtomicBlackBox::bbBackwardUpdate("
                        <<(caller?caller->GetFullName():"0")<<") ["
                        <<bbGetFullName()<<"]"<<std::endl);
     
-    bbtkDebugMessage("Process",5,"Initial Status  = "<<bbGetStatus()
+    bbtkDebugMessage("process",5,"Initial Status  = "<<bbGetStatus()
                     <<std::endl);
-    bbtkDebugMessage("Process",5,"BoxProcessMode  = "
+    bbtkDebugMessage("process",5,"BoxProcessMode  = "
                     <<bbGetInputBoxProcessMode()<<std::endl);
    
 
@@ -96,7 +96,7 @@ namespace bbtk
         // Updates its inputs
         IOStatus s = bbUpdateInputs();
     
-        bbtkDebugMessage("Process",6,"Inputs post-update status = "<<s<<std::endl);
+        bbtkDebugMessage("process",6,"Inputs post-update status = "<<s<<std::endl);
         // If all inputs are in UPTODATE post-update status 
         // and mProcessMode is not "Always"
         // then the box is now UPTODATE
@@ -122,15 +122,14 @@ namespace bbtk
       }
     else 
       {
-        bbtkDebugMessage("Process",5,"Up-to-date : nothing to do"<<std::endl);
+        bbtkDebugMessage("process",5,"Up-to-date : nothing to do"<<std::endl);
       }
 
-    bbtkDebugMessage("Process",5,"Final Status    = "
+    bbtkDebugMessage("process",5,"Final Status    = "
             <<bbGetStatus()<<std::endl);
-    bbtkDebugMessage("Process",1,
+    bbtkDebugMessage("process",3,
             "<= AtomicBlackBox::bbBackwardUpdate() ["
             <<bbGetFullName()<<"]"<<std::endl);
-    bbtkDebugDecTab("Process",1);
 
 
     return bbGetStatus();
index e67b76f1d30e8d3c1f96ef6794a17ad884233916..6eec77c05a09453c86372d315fe698262d239af4 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkAtomicBlackBoxGetSetFunctor.h,v $
   Language:  C++
-  Date:      $Date: 2008/02/07 11:06:37 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/04/24 10:11:27 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -131,11 +131,7 @@ namespace bbtk
     /// 
     virtual bool IsPointerType() const 
     {
-#ifdef _USE_BOOST_
-       return boost::is_pointer<T>::value;
-#else
-       return false;
-#endif
+      return boost::is_pointer<T>::value;
     }
 
   private:
index 7ff6640249c0f4c5baddb15655bf704a77581c37..df08807f69fd3288d441505560551ec9df4594b2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkAtomicBlackBoxMacros.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/18 12:59:15 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2008/04/24 10:11:27 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
   public:                                                              \
   inline void bbUserProcess()                                          \
   {                                                                    \
-    bbtkDebugMessageInc("Process",1,"=> "<<bbGetTypeName()<<"::bbUserProcess() [" \
-                       <<bbGetFullName()<<"]"<<std::endl);             \
+    bbtkDebugMessage("process",1,"**> Processing ["<<bbGetFullName()   \
+                    <<"]"<<std::endl);                                 \
     CALLBACK();                                                                \
-    bbtkDebugMessageDec("Process",1,"<= "<<bbGetTypeName()<<"::bbUserProcess() [" \
-                       <<bbGetFullName()<<"]"<<std::endl);             \
+    bbtkDebugMessage("process",1,"<** Processing ["<<bbGetFullName()   \
+                    <<"]"<<std::endl);                                 \
   }
 //============================================================================
 
index de8091778b696f5c507e30164aab68c88b6fd8e5..edca10ce191024bd2a961e6013ba11534e5a1349 100644 (file)
@@ -3,8 +3,8 @@
 Program:   bbtk
 Module:    $RCSfile: bbtkBlackBox.cxx,v $
 Language:  C++
-Date:      $Date: 2008/04/23 14:49:27 $
-Version:   $Revision: 1.15 $
+Date:      $Date: 2008/04/24 10:11:27 $
+Version:   $Revision: 1.16 $
                                                                                 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
 l'Image). All rights reserved. See doc/license.txt or
@@ -138,7 +138,7 @@ namespace bbtk
   /// Main processing method of the box.
   void BlackBox::bbExecute(bool force)
   {
-    bbtkDebugMessageInc("Process",1,
+    bbtkDebugMessageInc("process",2,
                        "=> BlackBox::bbExecute() ["
                        <<bbGetFullName()<<"]"<<std::endl);
  
@@ -147,7 +147,7 @@ namespace bbtk
     // If execution frozen : return
     if (bbGlobalGetFreezeExecution()) 
       {
-       bbtkDebugMessage("Process",1,
+       bbtkDebugMessage("process",2,
                         " -> FreezeExecution global flag is 'true' : abort execution"<<std::endl);
       }
 
@@ -159,7 +159,7 @@ namespace bbtk
 
     Wx::EndBusyCursor();
 
-    bbtkDebugMessageDec("Process",1,
+    bbtkDebugMessageDec("process",2,
                        "<= BlackBox::bbExecute() ["
                        <<bbGetFullName()<<"]"<<std::endl);
   }
@@ -368,7 +368,7 @@ namespace bbtk
   /// User overloadable destruction method of a black box
   void BlackBox::bbUserDelete() 
   {   
-    bbtkDebugMessage("Process",5,
+    bbtkDebugMessage("process",5,
                     "=> BlackBox::bbUserDelete() ["
                     <<bbGetFullName()<<"]"
                     <<" : not overloaded; using standard deletion"
@@ -455,7 +455,7 @@ namespace bbtk
     this->bbSignalOutputModification(false);
 
     /* 
-  bbtkDebugMessageDec("Process",5,
+  bbtkDebugMessageDec("process",5,
                        "<= BlackBox::bbSetModifiedStatus("<<c<<") ["
                        <<bbGetFullName()<<"]"<<std::endl);
     */
@@ -465,7 +465,7 @@ namespace bbtk
   //=========================================================================  
   void BlackBox::bbSignalOutputModification(bool reaction)
   {
-    bbtkDebugMessageInc("Process",5,
+    bbtkDebugMessageInc("process",5,
                        "=> BlackBox::bbSignalOutputModification() ["
                        <<bbGetFullName()<<"]"<<std::endl);
     
@@ -486,7 +486,7 @@ namespace bbtk
 
     if (reaction) bbGlobalProcessExecutionList();
 
-    bbtkDebugMessageDec("Process",5,
+    bbtkDebugMessageDec("process",5,
                        "<= BlackBox::bbSignalOutputModification() ["
                        <<bbGetFullName()<<"]"<<std::endl);
     
@@ -496,7 +496,7 @@ namespace bbtk
   void BlackBox::bbSignalOutputModification(const std::string& output,
        bool reaction)
   {
-    bbtkDebugMessageInc("Process",5,
+    bbtkDebugMessageInc("process",5,
                        "=> BlackBox::bbSignalOutputModification("
                        <<output<<") ["
                        <<bbGetFullName()<<"]"<<std::endl);
@@ -518,7 +518,7 @@ namespace bbtk
       }
   if (reaction) bbGlobalProcessExecutionList();
 
-  bbtkDebugMessageDec("Process",5,
+  bbtkDebugMessageDec("process",5,
                       "<= BlackBox::bbSignalOutputModification("
                       <<output<<") ["
                       <<bbGetFullName()<<"]"<<std::endl);
@@ -529,7 +529,7 @@ namespace bbtk
   void BlackBox::bbSignalOutputModification(const std::vector<std::string>& output,
        bool reaction)
   {
-    bbtkDebugMessageInc("Process",5,
+    bbtkDebugMessageInc("process",5,
                        "=> BlackBox::bbSignalOutputModification(vector of outputs) ["
                        <<bbGetFullName()<<"]"<<std::endl);
     OutputConnectorMapType::iterator i;
@@ -554,7 +554,7 @@ namespace bbtk
       }
   if (reaction) bbGlobalProcessExecutionList();
 
-   bbtkDebugMessageDec("Process",5,
+   bbtkDebugMessageDec("process",5,
                       "<= BlackBox::bbSignalOutputModification(vector of outputs) ["
                        <<bbGetFullName()<<"]"<<std::endl);
 
@@ -567,7 +567,7 @@ namespace bbtk
   ///          else MODIFIED 
   IOStatus BlackBox::bbUpdateInputs(bool excludeParent)
   {
-    bbtkDebugMessageInc("Process",4,
+    bbtkDebugMessageInc("process",4,
                        "=> BlackBox::bbUpdateInputs() ["
                        <<bbGetFullName()<<"]"
                        <<std::endl);   
@@ -589,7 +589,7 @@ namespace bbtk
        if (t==MODIFIED) s = MODIFIED;
       }
     
-   bbtkDebugMessageDec("Process",4,
+   bbtkDebugMessageDec("process",4,
                        "<= BlackBox::bbUpdateInputs() ["
                        <<bbGetFullName()<<"]"
                        <<std::endl);   
@@ -1104,7 +1104,7 @@ namespace bbtk
   //=========================================================================
    void BlackBox::bbGlobalProcessExecutionList()
    {   
-     bbtkDebugMessageInc("Process",1,
+     bbtkDebugMessageInc("process",3,
                         "=> BlackBox::bbGlobalProcessExecutionList()"
                         <<std::endl);     
      
@@ -1113,13 +1113,13 @@ namespace bbtk
          i!=bbmgExecutionList.end();
          ++i)
        {
-        bbtkDebugMessage("Process",2,
+        bbtkDebugMessage("process",4,
                          " -> Executing "<<(*i)->bbGetFullName()<<std::endl);
         (*i)->bbExecute(true);
        }
      
      bbmgExecutionList.clear();
-     bbtkDebugMessageDec("Process",1,
+     bbtkDebugMessageDec("process",3,
                         "<= BlackBox::bbGlobalProcessExecutionList()"
                         <<std::endl);     
      
index 46dfec6dc77ebcb9108e971a631c6efcf54fc8c9..5c2bd13a28f19a6c24f1767a8a936bb7c09e8cc5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBoxInputConnector.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/22 14:30:25 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2008/04/24 10:11:28 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -54,8 +54,8 @@ namespace bbtk
   
   IOStatus BlackBoxInputConnector::BackwardUpdate()
   {
-    bbtkDebugMessageInc("Process",4,"BlackBoxInputConnector::BackwardUpdate()"
-                       <<std::endl);
+    bbtkDebugMessage("process",9,"==> BlackBoxInputConnector::BackwardUpdate()"
+                    <<std::endl);
 
     if (mConnection) //.lock()) 
       {
@@ -67,8 +67,6 @@ namespace bbtk
        mStatus = UPTODATE;
       }
 
-    bbtkDecTab("Process",4);
-
     return mStatus;
 
   }
index 5b990f6db00ca50b7562cfd49e6abb5347e8249e..cdc8f3335f8e38b2aaacc680e4399f51bf5146ca 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBoxOutputConnector.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/23 14:49:27 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2008/04/24 10:11:28 $
+  Version:   $Revision: 1.7 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -107,7 +107,6 @@ namespace bbtk
        (*i)->SetModifiedStatus();
       }
     
-    //    bbtkDebugDecTab("Process",5);
     
    }
  
index 8a6c65b2ee07d55d927dab236b69d9cb298f5da4..3a9c3c0e1e02d376352e79366634aa334234bb67 100644 (file)
@@ -3,8 +3,8 @@
 Program:   bbtk
 Module:    $RCSfile: bbtkComplexBlackBox.cxx,v $
 Language:  C++
-Date:      $Date: 2008/04/23 14:49:27 $
-Version:   $Revision: 1.16 $
+Date:      $Date: 2008/04/24 10:11:28 $
+Version:   $Revision: 1.17 $
                                                                                 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
 l'Image). All rights reserved. See Doc/License.txt or
@@ -231,8 +231,8 @@ namespace bbtk
   /// Executes the box so that its outputs are up-to-date on exit
   void ComplexBlackBox::bbExecute(bool force)
   {
-    bbtkDebugMessageInc("Process",1,
-                       "ComplexBlackBox::bbExecute() ["
+    bbtkDebugMessageInc("process",2,
+                       "=> ComplexBlackBox::bbExecute() ["
                        <<bbGetFullName()<<"]"<<std::endl);
 
 
@@ -246,7 +246,7 @@ namespace bbtk
             i!=mExecutionList.end();
             ++i) 
          {
-           bbtkDebugMessage("Process",2," -> Executing '"<<*i<<"'"<<std::endl);
+           bbtkDebugMessage("process",3," -> Executing '"<<*i<<"'"<<std::endl);
            mBlackBoxMap[*i]->bbExecute(force);
          }
       }
@@ -261,8 +261,6 @@ namespace bbtk
 
     Wx::EndBusyCursor();
     
-
-    bbtkDebugDecTab("Process",1);
     
   }
   //==================================================================
@@ -302,8 +300,8 @@ namespace bbtk
   //==================================================================
   IOStatus ComplexBlackBox::bbBackwardUpdate(Connection::Pointer caller)
   {
-    bbtkDebugMessageInc("Process",1,
-                       "ComplexBlackBox::bbBackwardUpdate("
+    bbtkDebugMessageInc("process",3,
+                       "==> ComplexBlackBox::bbBackwardUpdate("
                        <<(caller?caller->GetFullName():"0")<<") ["
                        <<bbGetFullName()<<"]"<<std::endl);
     //    bbtkInternalError("ComplexBlackBox::bbBackwardUpdate should never be called !");
@@ -335,7 +333,7 @@ namespace bbtk
        // Get the internal box 
        BlackBox::Pointer b = bbUnsafeGetBlackBox ( d->GetTarget() );
        // Calls BackwardUpdate on it
-       bbtkDebugMessageInc("Process",2,"Internal box connected to output : "<<d->GetTarget()<<std::endl);
+       bbtkDebugMessageInc("process",4,"Internal box connected to output : "<<d->GetTarget()<<std::endl);
        // Because internal box can also be a complex box we have to 
        // temporarily change the connection BlackBoxFromOutput to the 
        // mapped one
@@ -356,13 +354,11 @@ namespace bbtk
        // ??? STATUS OF CBBs ???
        // ??? Here it is only the final status of the boxes connected to the output 
        if (s1==MODIFIED) s=MODIFIED;
-       bbtkDebugDecTab("Process",2);
       }
     else 
       {
        bbtkError("Connection '"<<caller->GetFullName()<<"' does not point to a valid output of the complex box !");
       }
-    bbtkDebugDecTab("Process",1);
 
     return s;
     
index 09c30c56938219b33e93f27bfbbddf9617b93164..69f847d6bd54c16eef540449850b43b73ef900b3 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkConnection.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/23 14:49:27 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2008/04/24 10:11:28 $
+  Version:   $Revision: 1.12 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -199,9 +199,9 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
   /// Backward Update
   IOStatus Connection::BackwardUpdate()
   {
-    bbtkDebugMessageInc("Process",2,
-                       "Connection::BackwardUpdate() ["
-                       <<GetFullName()<<"]"<<std::endl);
+    bbtkDebugMessage("process",5,
+                    "===> Connection::BackwardUpdate() ["
+                    <<GetFullName()<<"]"<<std::endl);
 
     IOStatus s = UPTODATE;
     s = mFrom->bbBackwardUpdate(GetThisPointer<Connection>());
@@ -210,8 +210,9 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
 
     if (mAdaptor && (s==MODIFIED)) mAdaptor->bbSetModifiedStatus();
 
-    bbtkDebugDecTab("Process",2);
-
+    bbtkDebugMessage("process",5,
+                    "<=== Connection::BackwardUpdate() ["
+                    <<GetFullName()<<"]"<<std::endl);
     return s;
   }
   //==================================================================
@@ -221,7 +222,7 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
   /// Forward Update
   void Connection::ForwardUpdate()
   {
-    bbtkDebugMessageInc("Process",2,
+    bbtkDebugMessageInc("process",2,
                        "Connection::ForwardUpdate() ["
                        <<GetFullName()<<"]"<<std::endl);
 
@@ -230,7 +231,7 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
 
     mTo->bbForwardUpdate(this);
 
-    bbtkDebugDecTab("Process",2);
+    bbtkDebugDecTab("process",2);
   }
   //==================================================================
   */
@@ -240,7 +241,7 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
   /// doing necessary conversions (adaptation or pointer cast)
   void Connection::TransferData()
   {
-    bbtkDebugMessageInc("Process",3,
+    bbtkDebugMessageInc("data",3,
                        "Connection::TransferData() ["
                        <<GetFullName()<<"]"<<std::endl);
     
@@ -257,16 +258,13 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
     // If no adaptor but source type is an any and target is not an any
     else if ( mFromAny && (! mToAny) )
       {
-       bbtkDebugMessage("Data",3,
-                        "Connection::TransferData() ["
-                        <<GetFullName()<<"]"<<std::endl);
-       bbtkDebugMessage("Data",3,
+       bbtkDebugMessage("data",3,
                         " * Source type is an "
                         <<HumanTypeName<Data>()
                         <<" which contains a <"
                         <<HumanTypeName(mFrom->bbGetOutput(mOutput).type())
                         <<">"<<std::endl);
-       bbtkDebugMessage("Data",3,
+       bbtkDebugMessage("data",3,
                         " * Target type is <"
                         <<HumanTypeName(mTo->bbGetInputType(mInput))
                         <<">"<<std::endl);
@@ -275,7 +273,7 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
        if (mFrom->bbGetOutput(mOutput)
            .contains( mTo->bbGetInputType(mInput) ) )
          {
-           bbtkDebugMessage("Data",3,
+           bbtkDebugMessage("data",3,
                             " -> Equal types : transfer ok"<<std::endl);
            mTo->bbSetInput( mInput, 
                             mFrom->bbGetOutput(mOutput),
@@ -297,7 +295,7 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
              }
            if (adaptor)  
              {
-               bbtkDebugMessage("Data",3," -> Adaptor found : using it"
+               bbtkDebugMessage("data",3," -> Adaptor found : using it"
                                 <<std::endl);
                  adaptor->bbSetInput("In",mFrom->bbGetOutput(mOutput),false);
                adaptor->bbExecute();
@@ -311,7 +309,7 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
                      (mTo->bbGetDescriptor()->GetInputDescriptor(mInput)
                       ->IsPointerType()) )
              {
-               bbtkDebugMessage("Data",3,
+               bbtkDebugMessage("data",3,
                                 " -> No adaptor found but source and target types are both pointers : trying up or down cast"<<std::endl);
                
                void* nptr = 
@@ -348,7 +346,6 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
        mTo->bbSetInput(mInput, mFrom->bbGetOutput(mOutput),false);
       }
 
-    bbtkDebugDecTab("Process",3);
   }
   //==================================================================
   
index fa5572497ea55e6874dc81925a028a2c6eca7cbe..314129343c5d47cdf49039085c97a6ed94b8fba9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkMessageManager.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/23 14:49:27 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2008/04/24 10:11:28 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -41,7 +41,7 @@ namespace bbtk
     mMessageLevel[key] = 0;
     mMessageHelp[key] = "Messages generated by the core classes of the lib";
     if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
-    key ="Process";
+    key ="process";
     mMessageLevel[key] = 0;
     mMessageHelp[key] = "Messages related to box processing";
     if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
index 346d0fbfe94263dfe720a2a634ce61041691943c..aa05db7b0633e969f12352490573b3335a180011 100644 (file)
@@ -2,41 +2,65 @@
 
 #include "bbtkWx.h"
 #include "bbtkMessageManager.h"
+#include <boost/signal.hpp>
+//#include <boost/bind.hpp>
 
 namespace bbtk
 {
 
-//EED
   static wxWindow* mgTopWindow = 0;
   static int mgNbWindowsAlive  = 0;
   static int mgNbWindowsShown  = 0;
+  static bool mgAutoDestroyTopWindow = true;
 
-  void Wx::CreateInvisibleTopWindow(wxWindow* parent)
+  // BBTKWXSIG
+  static Wx::Signal_type mgWxSignal;
+  // \BBTKWXSIG
+
+
+  //=========================================================================
+  void Wx::CreateTopWindow(wxWindow* parent, bool autodestroy)
   {
-    wxWindow* top = new wxFrame(parent,
-                               -1,_T("TOP (YOU SHOULD NOT SEE ME !!)"));
+    wxWindow* top = 
+      new wxFrame(parent,
+                 -1,
+                 _T("TOP BBTK FRAME (YOU SHOULD NOT SEE ME !!)"));
     top->Hide();
     Wx::SetTopWindow(top);
+    mgAutoDestroyTopWindow = autodestroy;
   }
-  void Wx::ResetCursor() 
+  //=========================================================================
+  
+  //=========================================================================
+  wxWindow* Wx::GetTopWindow() 
+  { 
+    if (mgTopWindow==0) Wx::CreateTopWindow(0);
+    return mgTopWindow; 
+  }
+  //=========================================================================
+  
+  //=========================================================================
+  bool Wx::TopWindowExists()
   {
-    if (!GetTopWindow()) return;
-    bbtkDebugMessage("wx",9,"wx::ResetCursor()"<<std::endl);
-    while (wxIsBusy()) ::wxEndBusyCursor();
+    return (mgTopWindow!=0);
   }
-  void Wx::BeginBusyCursor() 
+  //=========================================================================
+
+  // BBTKWXSIG
+  //=========================================================================
+  void Wx::AddSignalObserver(Slot_function_type f)
   {
-    if (!GetTopWindow()) return;
-    bbtkDebugMessage("wx",9,"wx::BeginBusyCursor()"<<std::endl);
-    ::wxBeginBusyCursor();
+    mgWxSignal.connect(f);
   }
-  void Wx::EndBusyCursor()
+  //=========================================================================
+  // \BBTKWXSIG
+
+  //=========================================================================
+  void Wx::AutoDestroyTopWindow(bool b)
   {
-    if (!GetTopWindow()) return;
-    bbtkDebugMessage("wx",9,"wx::EndBusyCursor()"<<std::endl);
-    ::wxEndBusyCursor();
+    mgAutoDestroyTopWindow = b;
   }
+  //=========================================================================
   
   //=========================================================================
   void Wx::SetTopWindow(wxWindow* w) 
@@ -48,17 +72,48 @@ namespace bbtk
     mgTopWindow = w;
   }
   //=========================================================================
+
+
+  //=========================================================================
+  void Wx::IncNbWindowsAlive() 
+  { 
+    mgNbWindowsAlive++; 
+    bbtkDebugMessage("wx",2,"* Number of windows alive = "<<mgNbWindowsAlive
+                    <<std::endl);
+    // BBTKWXSIG
+    mgWxSignal();
+    // \BBTKWXSIG
+  }
+  //=========================================================================
+
   //=========================================================================
   void Wx::DecNbWindowsAlive()
   { 
     mgNbWindowsAlive--; 
-    /*
-    if ( (bbmgNbWindowsAlive==0) && 
-        bbmgTopWindow && (!bbmgTopWindow->IsShown()))
+    bbtkDebugMessage("wx",2,"* Number of windows alive = "<<mgNbWindowsAlive
+                    <<std::endl);
+    if ( (mgNbWindowsAlive==0) && 
+        (mgAutoDestroyTopWindow) )
       {
-       bbmgTopWindow->Close();
+    bbtkDebugMessage("wx",2,"  --> Destructing top window"<<std::endl);
+       mgTopWindow->Close();
+       mgTopWindow = 0;
       }
-    */
+    // BBTKWXSIG
+    mgWxSignal();
+    // \BBTKWXSIG
+  }
+  //=========================================================================
+  
+  //=========================================================================
+  void Wx::IncNbWindowsShown() 
+  { 
+    mgNbWindowsShown++; 
+    bbtkDebugMessage("wx",2,"* Number of windows shown = "<<mgNbWindowsShown
+                    <<std::endl);
+    // BBTKWXSIG
+    mgWxSignal();
+    // \BBTKWXSIG
   }
   //=========================================================================
 
@@ -66,60 +121,77 @@ namespace bbtk
   void Wx::DecNbWindowsShown()
   { 
     mgNbWindowsShown--; 
-    if ( (mgNbWindowsShown==0) && 
-        mgTopWindow && (!mgTopWindow->IsShown()))
+    bbtkDebugMessage("wx",2,"* Number of windows shown = "<<mgNbWindowsShown
+                    <<std::endl);
+    if ( (mgNbWindowsAlive==0) && 
+        (mgAutoDestroyTopWindow) )
       {
-       mgTopWindow->Close();
+       bbtkDebugMessage("wx",2,"  --> Destructing top window"<<std::endl);
+       mgTopWindow->Close();
+       mgTopWindow = 0;
       }
+    // BBTKWXSIG
+    mgWxSignal();
+    // \BBTKWXSIG
   }
   //=========================================================================
 
+
   //=========================================================================
-/*EED
-  // Static members 
-  wxWindow* Wx::mgTopWindow = 0;
-  int Wx::mgNbWindowsAlive  = 0;
-  int Wx::mgNbWindowsShown  = 0;
-*/
+  int  Wx::GetNbWindowsAlive() 
+  { 
+    return mgNbWindowsAlive; 
+  }
+  //=========================================================================
+  
+  //=========================================================================
+  bool Wx::IsSomeWindowAlive() 
+  { 
+    return (mgNbWindowsAlive>0);
+  }
+  //=========================================================================
+  
+  
+  //=========================================================================
+  int  Wx::GetNbWindowsShown() 
+  { 
+    return mgNbWindowsShown; 
+  }
+  //=========================================================================
+  
+  //=========================================================================
+  bool Wx::IsSomeWindowShown() 
+  { 
+    return (mgNbWindowsShown>0);
+  }
+  //=========================================================================
+  
+  //=========================================================================
+  void Wx::ResetCursor() 
+  {
+    if (!TopWindowExists()) return;
+    bbtkDebugMessage("wx",9,"Wx::ResetCursor()"<<std::endl);
+    while (wxIsBusy()) ::wxEndBusyCursor();
+  }
+  //=========================================================================
+  //=========================================================================
+  void Wx::BeginBusyCursor() 
+  {
+    if (!TopWindowExists()) return;
+    bbtkDebugMessage("wx",9,"Wx::BeginBusyCursor()"<<std::endl);
+    ::wxBeginBusyCursor();
+  }
+  //=========================================================================
+  //=========================================================================
+  void Wx::EndBusyCursor()
+  {
+    if (!TopWindowExists()) return;
+    bbtkDebugMessage("wx",9,"Wx::EndBusyCursor()"<<std::endl);
+    ::wxEndBusyCursor();
+  }
   //=========================================================================
 
 
-//EED
-    wxWindow* Wx::GetTopWindow() 
-       { 
-               return mgTopWindow; 
-       }
-
-    void Wx::IncNbWindowsAlive() 
-       { 
-               mgNbWindowsAlive++; 
-       }
-
-    int  Wx::GetNbWindowsAlive() 
-       { 
-               return mgNbWindowsAlive; 
-       }
-
-    bool Wx::IsSomeWindowAlive() 
-       { 
-               return (mgNbWindowsAlive>0);
-       }
-
-    void Wx::IncNbWindowsShown() 
-       { 
-               mgNbWindowsShown++; 
-       }
-
-    int  Wx::GetNbWindowsShown() 
-       { 
-               return mgNbWindowsShown; 
-       }
-
-    bool Wx::IsSomeWindowShown() 
-       { 
-               return (mgNbWindowsShown>0);
-       }
-
 }
 
 #endif
index 2969edb205a9853cea914b4d575b3fef0b9cd4ff..30c86f8ab7335c3a02ea5fcc1efa72217e322edb 100644 (file)
 
 #include "bbtkSystem.h"
 
+// SIGNAL/SLOT MECHANISM 
+// FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION 
+// BBTKWXSIG
+#include <boost/signal.hpp>
+#include <boost/bind.hpp>
+// \BBTKWXSIG
+
 namespace bbtk
 {
   //==================================================================
   /// Global wx handlers (cursor...)
   
+// BBTKWXSIG
+#define bbtkAddWxSignalObserver(METHOD)                \
+  Wx::AddSignalObserver(boost::bind(&METHOD, this))
+// \BBTKWXSIG
+
   struct BBTK_EXPORT Wx
   {    
   public:
+    // BBTKWXSIG
+    typedef boost::signals::trackable SignalObserver;
+    typedef boost::signal<void ()>  Signal_type;
+    typedef Signal_type::slot_function_type Slot_function_type;
+    // \BBTKWXSIG
+
     static void ResetCursor();
     static void BeginBusyCursor(); 
     static void EndBusyCursor();
-    static int mBeginBusyCallsCount;
 
-    static void CreateInvisibleTopWindow(wxWindow* parent=0);
-    /// Returns the global parent of all bbtk windows
+    static void CreateTopWindow(wxWindow* parent=0, bool autodestroy=true);
+    /// Returns the creation time parent of all bbtk windows 
+    /// (window can be reparented after creation)
     static wxWindow* GetTopWindow();
-    /// Sets the global parent of all bbtk windows
-    static void SetTopWindow(wxWindow*);
+    static bool TopWindowExists();
+
+    static void AutoDestroyTopWindow(bool);
     
     static void IncNbWindowsAlive();
     static void DecNbWindowsAlive();
@@ -59,13 +78,13 @@ namespace bbtk
     static void DecNbWindowsShown();
     static int  GetNbWindowsShown();
     static bool IsSomeWindowShown();
-    
-/*EED
+
+    // BBTKWXSIG
+    static void AddSignalObserver(Slot_function_type);
+    // \BBTKWXSIG
   private:
-    static wxWindow* mgTopWindow;
-    static int mgNbWindowsAlive;
-    static int mgNbWindowsShown;
-*/
+    /// Sets the creation time parent of all bbtk windows
+    static void SetTopWindow(wxWindow*);
   }; // struct Wx
   //==================================================================
   
index e4a8410357eedb865837908d5effa2763157f6df..a66ecc617eb28f3c0c1c00c4c115505f2fd830fb 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/23 14:49:28 $
-  Version:   $Revision: 1.15 $
+  Date:      $Date: 2008/04/24 10:11:28 $
+  Version:   $Revision: 1.16 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -55,8 +55,6 @@ namespace bbtk
                     mBox.lock()->bbGetFullName()<<")"<<std::endl);
     mBox.lock()->bbSetWindow(this);
     Wx::IncNbWindowsAlive();
-    bbtkDebugMessage("wx",5," -> Number of windows alive = "
-                    <<Wx::GetNbWindowsAlive()<<std::endl);
   }
   //=========================================================================
 
@@ -71,11 +69,6 @@ namespace bbtk
       {
        mBox.lock()->bbSetWindow(0);
       }
-    else 
-      {
-      }
-    bbtkDebugMessage("wx",5," -> Number of windows alive = "
-                    <<Wx::GetNbWindowsAlive()<<std::endl);
   }
   //========================================================================= 
 
@@ -87,8 +80,6 @@ namespace bbtk
     bbtkDebugMessage("wx",9,"WxBlackBoxWindow::bbShow()"<<std::endl);
     Wx::IncNbWindowsShown();
     mShown = true;
-    bbtkDebugMessage("wx",5," -> Number of windows shown = "
-                    <<Wx::GetNbWindowsShown()<<std::endl);
   }
   //=========================================================================
 
@@ -99,8 +90,6 @@ namespace bbtk
     bbtkDebugMessage("wx",9,"WxBlackBoxWindow::bbHide()"<<std::endl);
     Wx::DecNbWindowsShown();
     mShown = false;
-    bbtkDebugMessage("wx",5," -> Number of windows shown = "
-                    <<Wx::GetNbWindowsShown()<<std::endl);
   }
   //=========================================================================
 
@@ -387,7 +376,7 @@ namespace bbtk
   /// Main processing method of the box.
   void WxBlackBox::bbExecute(bool force)
   {
-    bbtkDebugMessageInc("Process",1,
+    bbtkDebugMessageInc("process",2,
                        "=> WxBlackBox::bbExecute() ["
                        <<bbGetFullName()<<"]"<<std::endl);
 
@@ -398,7 +387,7 @@ namespace bbtk
 
     if ( i->second->GetConnectionVector().size() != 0 ) 
       {
-       bbtkDebugMessage("Process",2,
+       bbtkDebugMessage("process",3,
                         "-> Output 'Widget' connected : transfering execution to parent"
                         <<std::endl);
        
@@ -413,7 +402,7 @@ namespace bbtk
       }
     //
 
-    bbtkDebugMessageDec("Process",1,
+    bbtkDebugMessageDec("process",2,
                        "<= WxBlackBox::bbExecute() ["
                        <<bbGetFullName()<<"]"<<std::endl);
   }
@@ -424,7 +413,7 @@ namespace bbtk
   /// Main processing method of the box.
   IOStatus WxBlackBox::bbBackwardUpdate( Connection::Pointer caller )
   {
-    bbtkDebugMessage("Process",1,
+    bbtkDebugMessage("process",3,
                     "=> WxBlackBox::bbBackwardUpdate("
                     <<(caller?caller->GetFullName():"0")<<") ["
                     <<bbGetFullName()<<"]"<<std::endl);
@@ -433,8 +422,8 @@ namespace bbtk
     if ( ! (( bbGetStatus() == MODIFIED ) ||
            ( bbBoxProcessModeIsAlways() )) )
       {
-       bbtkDebugMessage("Process",2,"Up-to-date : nothing to do"<<std::endl);
-       bbtkDebugMessage("Process",1,
+       bbtkDebugMessage("process",3,"Up-to-date : nothing to do"<<std::endl);
+       bbtkDebugMessage("process",3,
                         "<= WxBlackBox::bbBackwardUpdate("
                         <<(caller?caller->GetFullName():"0")<<") ["
                         <<bbGetFullName()<<"]"<<std::endl);
@@ -451,7 +440,7 @@ namespace bbtk
                
        if (caller) 
          {
-           bbtkDebugMessage("Process",2,
+           bbtkDebugMessage("process",3,
                             "-> Output 'Widget' connected to '"
                             <<to->bbGetFullName()<<"' - caller->to = '"
                             <<caller->GetBlackBoxTo()->bbGetFullName()
@@ -460,7 +449,7 @@ namespace bbtk
          }
        else
          {
-           bbtkDebugMessage("Process",2,
+           bbtkDebugMessage("process",3,
                             "-> Output 'Widget' connected to '"
                             <<to->bbGetFullName()<<"'"
                             <<std::endl);
@@ -470,7 +459,7 @@ namespace bbtk
             (caller->GetBlackBoxTo() != to))&&
            (!bbGetUpdateTransferedToParent()))
          {
-           bbtkDebugMessage("Process",2,
+           bbtkDebugMessage("process",3,
                             "   ... Transfering update order to parent"
                             <<std::endl);
            
@@ -481,7 +470,7 @@ namespace bbtk
        else
          {
            bbSetUpdateTransferedToParent(false);
-           bbtkDebugMessage("Process",2,
+           bbtkDebugMessage("process",3,
                             "   ... No need to transfer to parent"
                             <<std::endl);
          }
@@ -505,7 +494,7 @@ namespace bbtk
        AtomicBlackBox::bbBackwardUpdate(caller);
       }
     
-    bbtkDebugMessageDec("Process",1,
+    bbtkDebugMessageDec("process",3,
                        "<= WxBlackBox::bbBackwardUpdate() ["
                        <<bbGetFullName()<<"]"<<std::endl);
     
@@ -526,7 +515,7 @@ namespace bbtk
   /// (called after bbProcess during bbExecute)
   void WxBlackBox::bbShowWindow()
   {
-    bbtkDebugMessageInc("Process",1,"=> WxBlackBox::bbShowWindow() ["
+    bbtkDebugMessageInc("wx",1,"=> WxBlackBox::bbShowWindow() ["
                        <<bbGetFullName()<<"]"<<std::endl);
  
     // If Event Handler for the widget does not exist or is obsolete : create it 
@@ -534,7 +523,7 @@ namespace bbtk
       {
        if (bbGetWidgetEventHandler()==0)
          {
-           bbtkDebugMessage("Process",3,
+           bbtkDebugMessage("wx",3,
                             "-> No widget event handler : creating one"
                             <<std::endl);
            new WxBlackBoxWidgetEventHandler(GetThisPointer<WxBlackBox>(),
@@ -543,7 +532,7 @@ namespace bbtk
        else if ( ! bbGetWidgetEventHandler()->IsHandlerOf 
                  ( bbGetOutputWidget() ) )
          {
-           bbtkDebugMessage("Process",3,
+           bbtkDebugMessage("wx",3,
                             "-> Obsolete widget event handler : re-creating one"
                             <<std::endl);
            delete bbGetWidgetEventHandler();
@@ -560,10 +549,9 @@ namespace bbtk
         ->GetConnectionVector().size() != 0 ) 
       {
        
-       bbtkDebugMessage("Process",2,
+       bbtkDebugMessage("wx",2,
                         "-> Output 'Widget' connected : nothing to do"
                         <<std::endl);
-       bbtkDebugDecTab("Process",1);
        return;
       }
 
@@ -572,7 +560,7 @@ namespace bbtk
     // If the window already exists : no need creating it
     if (bbGetWindow()!=0)
       {
-       bbtkDebugMessage("Process",2,
+       bbtkDebugMessage("wx",2,
                         "-> Window already exists"
                         <<std::endl);
        show = bbGetWindow();
@@ -580,7 +568,7 @@ namespace bbtk
     // Else if the widget exists : create window 
     else if (bbGetOutputWidget()!=0) 
       {
-       bbtkDebugMessage("Process",2,
+       bbtkDebugMessage("wx",2,
                         "-> Widget exists : creating the window"
                         <<std::endl);
 
@@ -588,7 +576,7 @@ namespace bbtk
        // Input WinDialog set to true : creating a Dialog
        if (bbGetInputWinDialog()) 
          {
-           bbtkDebugMessage("Process",2,
+           bbtkDebugMessage("wx",2,
                             "   Input WinDialog set to true : creating a Dialog"
                             <<std::endl);
            show = (Window*) new WxBlackBoxDialog( GetThisPointer<WxBlackBox>(),
@@ -599,7 +587,7 @@ namespace bbtk
        // Input WinDialog set to false : creating a Frame
        else 
          {
-           bbtkDebugMessage("Process",2,
+           bbtkDebugMessage("process",2,
                             "   Input WinDialog set to false : creating a Frame"
                             <<std::endl);
            show = (Window*) new WxBlackBoxFrame( GetThisPointer<WxBlackBox>(),
@@ -625,13 +613,13 @@ namespace bbtk
       }
     else 
       {
-       bbtkDebugMessage("Process",2,"-> Already shown : nothing to do"<<std::endl);
+       bbtkDebugMessage("wx",2,"-> Already shown : nothing to do"<<std::endl);
       }
   
 
-    bbtkDebugMessage("Process",1,"<= WxBlackBox::bbShowWindow() ["
+    bbtkDebugMessage("wx",1,"<= WxBlackBox::bbShowWindow() ["
                        <<bbGetFullName()<<"]"<<std::endl);
-    bbtkDebugDecTab("Process",1);
+
   }
   //==================================================================
 
@@ -641,12 +629,12 @@ namespace bbtk
   //==================================================================
    void WxBlackBox::bbHideWindow()
   {
-    bbtkDebugMessageInc("Process",1,"=> WxBlackBox::bbHideWindow() ["
+    bbtkDebugMessageInc("wx",1,"=> WxBlackBox::bbHideWindow() ["
                        <<bbGetFullName()<<"]"<<std::endl);
 
     if (bbGetWindow()!=0) bbGetWindow()->bbHide();
 
-    bbtkDebugMessageDec("Process",1,"<= WxBlackBox::bbHideWindow() ["
+    bbtkDebugMessageDec("wx",1,"<= WxBlackBox::bbHideWindow() ["
                        <<bbGetFullName()<<"]"<<std::endl);
   }
   //==================================================================
index 9b22db3c6d65bb079b2c3b77f21fb9d7526ef2ff..f369b8b427b7826203495a1d42d6614a8d9f13bd 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxBlackBox.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/22 14:30:25 $
-  Version:   $Revision: 1.13 $
+  Date:      $Date: 2008/04/24 10:11:28 $
+  Version:   $Revision: 1.14 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -203,10 +203,10 @@ namespace bbtk
   public:                                                              \
   inline void bbUserCreateWidget()                                     \
   {                                                                    \
-    bbtkDebugMessageInc("Process",1,"=> "<<bbGetTypeName()<<"::bbUserCreateWidget() [" \
+    bbtkDebugMessageInc("process",1,"**> Creating widget for ["                \
                        <<bbGetFullName()<<"]"<<std::endl);             \
     CALLBACK();                                                                \
-    bbtkDebugMessageDec("Process",1,"<= "<<bbGetTypeName()<<"::bbUserCreateWidget() [" \
+    bbtkDebugMessageInc("process",1,"<** Creating widget for ["                \
                        <<bbGetFullName()<<"]"<<std::endl);             \
   }
   
index e70ca40295ec3f4c36c90a5a01408c2ebed0d9dd..69a17d61087e0392b3cb1091f96c9cec839845ec 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIConsole.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/23 14:49:28 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2008/04/24 10:11:28 $
+  Version:   $Revision: 1.9 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -151,13 +151,11 @@ namespace bbtk
     cmdsizer->Add (mWxGUICommand, 0, wxALL | wxGROW, 5);
 
         
-    // Creates and sets the parent window of all bbtk windows
-    /*
-    wxWindow* top = new wxPanel(this,-1);//,_T("top"));
-    top->Hide();
-    Wx::SetTopWindow(top);
-    */
-    Wx::CreateInvisibleTopWindow(this);
+    // Creates the parent window of all bbtk windows as a child of this
+    Wx::CreateTopWindow(this,true);
+    // Add the method OnWxSignal as a Wx::Signal observer 
+    bbtkAddWxSignalObserver(WxGUIConsole::OnWxSignal);
+
 
     // Layout
 //EED    SetSizer(sizer);
@@ -181,6 +179,16 @@ namespace bbtk
   }
   //================================================================
 
+  //================================================================
+  void WxGUIConsole::OnWxSignal()
+  {
+    if ((!Wx::TopWindowExists())&&(!IsShown())) 
+      {
+       bbtkDebugMessage("wx",2,"  --> bbtk top window destroyed and WxGUIConsole not shown => destructing"<<std::endl);
+       Close();
+      }
+  }
+  //================================================================
 
   //================================================================
   void WxGUIConsole::WxGUICommandEnter(const std::string& command)
@@ -376,7 +384,15 @@ namespace bbtk
   } 
   //================================================================  
   
-    
+  //================================================================  
+  // Overloaded Show method to handle bbtk::Wx::TopWindow auto-destruction
+  bool WxGUIConsole::Show(bool show)
+  {
+    Wx::AutoDestroyTopWindow(!show);
+    wxFrame::Show(show);
+  }
+  //================================================================  
+   
   //================================================================  
   BEGIN_EVENT_TABLE(WxGUIConsole, wxFrame)
     EVT_MENU(ID_Menu_Quit, WxGUIConsole::OnMenuQuit)
index 6a4b17d007b2a68c649d247267659c7d77408377..0efab2be2e81af619d6b2334a21f2dda7bd3be4d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIConsole.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/18 12:59:16 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2008/04/24 10:11:28 $
+  Version:   $Revision: 1.4 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -102,6 +102,11 @@ namespace bbtk
     // WxGUICommand callbacks
     void WxGUICommandEnter(const std::string&);
 
+
+    // Overloaded Show method to handle bbtk::Wx::TopWindow auto-destruction
+    virtual bool Show(bool show = true);
+
+
   private:
     wxAuiManager m_mgr;
     Interpreter::Pointer mInterpreter;
@@ -118,8 +123,9 @@ namespace bbtk
     wxButton* mwxButtonRun;
 
   public:
-         
+    
+    // Callback invoked by bbtk top window when something changes
+    void OnWxSignal();
     DECLARE_EVENT_TABLE()
        
   };
index 4f7a84dd6359633668994851dce06f9a858b1a36..9ab9e50f563cb10b471f93d595dcfe73fb549c86 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIPackageBrowser.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/18 12:59:16 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2008/04/24 10:11:28 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -423,12 +423,12 @@ namespace bbtk
     
     SetSizer(sizer);
 
-    // Creates and sets the parent window of all bbtk windows
-    wxWindow* top = new wxPanel(this,-1);
-    top->Hide();
-    
-    Wx::SetTopWindow(top);
-   
+
+    // Creates the parent window of all bbtk windows as a child of this
+    Wx::CreateTopWindow(this);
+    //    bbtkAddWxObserver(WxGUIConsole::OnWxSignal);
+
+
     SetAutoLayout(true);
     Layout();
   }
index b6c2730df74e26724d783e9814f53c5cfee8d186..16edeb4ad2ee3277d6f44a0188b9bbebb96a009c 100644 (file)
@@ -3,8 +3,8 @@
 Program:   bbtk
 Module:    $RCSfile: bbtkWxGUIPackageBrowser2.cxx,v $
 Language:  C++
-Date:      $Date: 2008/04/23 09:31:23 $
-Version:   $Revision: 1.6 $
+Date:      $Date: 2008/04/24 10:11:28 $
+Version:   $Revision: 1.7 $
                                                                                 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
 l'Image). All rights reserved. See Doc/License.txt or
@@ -1137,12 +1137,11 @@ namespace bbtk
     
     SetSizer(sizer);
 
-    // Creates and sets the parent window of all bbtk windows
-    wxWindow* top = new wxPanel(this,-1);
-    top->Hide();
-    
-    Wx::SetTopWindow(top);
-   
+     // Creates the parent window of all bbtk windows as a child of this
+    Wx::CreateTopWindow(this);
+    // Add the method OnWxSignal as a Wx::Signal observer 
+    //bbtkAddWxSignalObserver(WxGUIPackageBrowser2Window::OnWxSignal);
     SetAutoLayout(true);
     Layout();
   }
index fb9c681cdf8217fcdcf8d360ae809a229c395d62..da5431039ff3ca26cf629765b63525afa28396c0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/22 14:30:25 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2008/04/24 10:11:28 $
+  Version:   $Revision: 1.7 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -137,10 +137,6 @@ namespace bbtk
    
     mWxGUICommand->SetFocus();
 
-    // Creates and sets the parent window of all bbtk windows
-    wxWindow* top = new wxPanel(this,-1);//,_T("top"));
-    top->Hide();
-    Wx::SetTopWindow(top);
     
 
     //
@@ -180,6 +176,10 @@ namespace bbtk
     //    m_mgr.AddPane(mwxButtonRun,
     //           wxAuiPaneInfo().Name(wxT("button_run_content")));     
 
+    // Creates the parent window of all bbtk windows as a child of this
+    Wx::CreateTopWindow(this);
+    // Add the method OnWxSignal as a Wx::Signal observer 
+    //bbtkAddWxSignalObserver(WxGUIPackageBrowser2Window::OnWxSignal);
 
 //.PaneBorder(false)); 
     m_mgr.Update();
index 2d309d5c3ca5aa851f8cbe3bc0b64219a5e049af..4f3d99e83ecb167f8bf2755e1862139f31255d3a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUITextEditor.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/22 14:30:25 $
-  Version:   $Revision: 1.9 $
+  Date:      $Date: 2008/04/24 10:11:28 $
+  Version:   $Revision: 1.10 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -661,11 +661,11 @@ namespace bbtk
     
     SetSizer(sizer);
 
-    // Creates and sets the parent window of all bbtk windows
-    wxWindow* top = new wxPanel(this,-1);
-    top->Hide();
+    // Creates the parent window of all bbtk windows as a child of this
+    Wx::CreateTopWindow(this);
+    // Add the method OnWxSignal as a Wx::Signal observer 
+    //bbtkAddWxSignalObserver(WxGUITextEditorWindow::OnWxSignal);
     
-    Wx::SetTopWindow(top);
    
     SetAutoLayout(true);
     Layout();