]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Sat, 29 Nov 2008 21:41:29 +0000 (21:41 +0000)
committerguigues <guigues>
Sat, 29 Nov 2008 21:41:29 +0000 (21:41 +0000)
33 files changed:
kernel/cmake/BBTKDefineOptions.cmake
kernel/cmake/BBTKFindLibraries.cmake
kernel/src/CMakeLists.txt
kernel/src/bbtkKW.cxx [new file with mode: 0644]
kernel/src/bbtkKW.h [new file with mode: 0644]
kernel/src/bbtkKWBlackBox.cxx [new file with mode: 0644]
kernel/src/bbtkKWBlackBox.h [new file with mode: 0644]
kernel/src/bbtkMessageManager.cxx
kernel/src/bbtkMessageManager.h
packages/CMakeLists.txt
packages/kw/CMakeLists.txt [new file with mode: 0644]
packages/kw/Configure.cmake [new file with mode: 0644]
packages/kw/PackageConfig.cmake.in [new file with mode: 0644]
packages/kw/UsePackage.cmake.in [new file with mode: 0644]
packages/kw/bbs/CMakeLists.txt [new file with mode: 0644]
packages/kw/bbs/appli/exampleSlider.bbs [new file with mode: 0644]
packages/kw/data/CMakeLists.txt [new file with mode: 0644]
packages/kw/doc/CMakeLists.txt [new file with mode: 0644]
packages/kw/doc/bbdoc/CMakeLists.txt [new file with mode: 0644]
packages/kw/doc/bbdoc/header.html.in [new file with mode: 0644]
packages/kw/doc/doxygen/CMakeLists.txt [new file with mode: 0644]
packages/kw/doc/doxygen/DoxyMainPage.txt.in [new file with mode: 0644]
packages/kw/doc/doxygen/Doxyfile.txt.in [new file with mode: 0644]
packages/kw/src/CMakeLists.txt [new file with mode: 0644]
packages/kw/src/bbkwLayoutSplit.cxx [new file with mode: 0644]
packages/kw/src/bbkwLayoutSplit.h [new file with mode: 0644]
packages/kw/src/bbkwSlicer.cxx [new file with mode: 0644]
packages/kw/src/bbkwSlicer.h [new file with mode: 0644]
packages/kw/src/bbkwSlider.cxx [new file with mode: 0644]
packages/kw/src/bbkwSlider.h [new file with mode: 0644]
packages/kw/src/vtkKWSlicer.cxx [new file with mode: 0644]
packages/kw/src/vtkKWSlicer.h [new file with mode: 0644]
packages/wxvtk/src/bbwxvtkViewer2D.cxx

index 25b0efa44f733bd0f58adb3d73055f4a0af3313d..6a7966a64257b7cc66a190d2f297b45162b6f5fb 100644 (file)
@@ -58,3 +58,20 @@ OPTION(BBTK_USE_SHIPPED_BOOST
   "Use the shipped boost C++ library (${BBTK_SHIPPED_BOOST})" ON)
 #-----------------------------------------------------------------------------
 
+OPTION(BBTK_USE_WXWIDGETS "Build bbtk with wxWidgets ?" OFF)
+IF(BBTK_USE_WXWIDGETS)
+  SET(USE_WXWIDGETS ON CACHE BOOL "Use WxWidgets" FORCE)
+ELSE(BBTK_USE_WXWIDGETS)
+  SET(USE_WXWIDGETS OFF CACHE BOOL "Use WxWidgets" FORCE)
+ENDIF(BBTK_USE_WXWIDGETS)
+
+#-----------------------------------------------------------------------------
+OPTION(BBTK_USE_KWWIDGETS "Build bbtk with KWWidgets ?" OFF)
+
+IF (BBTK_USE_KWWIDGETS)
+  SET(USE_KW ON CACHE BOOL "Use KWWidgets" FORCE)
+ELSE (BBTK_USE_KWWIDGETS)
+  SET(USE_KW OFF CACHE BOOL "Use KWWidgets" FORCE)
+ENDIF (BBTK_USE_KWWIDGETS)
+
+#SWITCH_ON_IF_BUILD_ALL(BUILD_KWWIDGETS)
index e781d61838ad78bdbe6e77d2ab1f1d0a5fafc4f5..084fa2970fa01137e08470a10751a2d70d16c81d 100644 (file)
@@ -1,5 +1,27 @@
 
 
+#-----------------------------------------------------------------------------
+IF(USE_KW)
+  # Search KWWidgets
+  FIND_PACKAGE(KWWidgets)
+  # If found
+  IF(KWWidgets_FOUND)
+    MESSAGE ( STATUS "=======================================")
+    MESSAGE ( STATUS "Looking for KWWidgets... found")
+    MESSAGE ( STATUS "* Dir     = ${KWWidgets_DIR}")
+    MESSAGE ( STATUS "* Version = ${KWWidgets_MAJOR_VERSION}.${KWWidgets_MINOR_VERSION}.${KWWidgets_BUILD_VERSION}")
+    INCLUDE(${KWWidgets_USE_FILE})
+    ADD_DEF( USE_KWWIDGETS )
+    SET(BBTK_KWWIDGETS_LIBRARIES
+      ${KWWidgets_LIBRARIES}
+     ) 
+    MARK_AS_ADVANCED(KWWidgets_DIR)
+  ELSE(KWWidgets_FOUND)
+     message(FATAL_ERROR "KWWidgets_DIR not found")
+  ENDIF(KWWidgets_FOUND)
+ENDIF(USE_KW)
+#-----------------------------------------------------------------------------
+
 #-----------------------------------------------------------------------------
 #OPTION(USE_VTK "Build VTK-based black boxes" OFF)
 IF(USE_VTK)
@@ -7,6 +29,7 @@ IF(USE_VTK)
   FIND_PACKAGE(VTK)
   # If vtk found
   IF(VTK_FOUND)
+    MESSAGE ( STATUS "=======================================")
     MESSAGE ( STATUS "Looking for VTK... found")
     MESSAGE ( STATUS "* Dir     = ${VTK_DIR}")
     MESSAGE ( STATUS "* Version = ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")
@@ -38,6 +61,7 @@ IF(USE_ITK)
   FIND_PACKAGE(ITK)
   # If itk found
   IF(ITK_FOUND)
+    MESSAGE ( STATUS "=======================================")
     MESSAGE ( STATUS "Looking for ITK... found")
     MESSAGE ( STATUS "* Dir     = ${ITK_DIR}")
     MESSAGE ( STATUS "* Version = ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}")
@@ -119,7 +143,7 @@ IF(USE_GDCM)
   IF(GDCM_FOUND)
     INCLUDE(${GDCM_USE_FILE})
     ADD_DEF( _USE_GDCM_ )
-
+    MESSAGE ( STATUS "=======================================")
     MESSAGE ( STATUS "Looking for GDCM... found")
     MESSAGE ( STATUS "* Dir       = ${GDCM_DIR}")
     MESSAGE ( STATUS "* Version   = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
@@ -155,6 +179,7 @@ ENDIF(USE_GDCM)
 
 #-----------------------------------------------------------------------------
 IF(USE_WXWIDGETS)
+  MESSAGE ( STATUS "=======================================")
   INCLUDE(${BBTK_CMAKE_DIR}/BBTKWxWidgets.cmake)
   BBTK_FIND_WXWIDGETS()
   BBTK_USE_WXWIDGETS()
@@ -165,6 +190,7 @@ ENDIF(USE_WXWIDGETS)
 
 #-----------------------------------------------------------------------------
 IF(USE_DOXYGEN) 
+  MESSAGE ( STATUS "=======================================")
   FIND_PACKAGE(Doxygen REQUIRED)
 #  MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN}")
   IF(DOXYGEN)
@@ -179,6 +205,7 @@ ENDIF(USE_DOXYGEN)
 #-----------------------------------------------------------------------------
 IF(USE_LATEX) 
   FIND_PACKAGE(LATEX REQUIRED)
+    MESSAGE ( STATUS "=======================================")
   MESSAGE(STATUS "Looking for latex... - found ${LATEX_COMPILER}")
 ENDIF(USE_LATEX) 
 #-----------------------------------------------------------------------------
@@ -189,6 +216,7 @@ IF(USE_TTH)
   IF (NOT LATEX_tth_CONVERTER)
     MESSAGE(FATAL_ERROR "TTH not found (LATEX_tth_CONVERTER). Required to build the HTML documentation from tex source")
   ELSE (NOT LATEX_tth_CONVERTER)
+    MESSAGE ( STATUS "=======================================")
     MESSAGE(STATUS "Looking for tth... - found ${LATEX_tth_CONVERTER}")
   ENDIF(NOT LATEX_tth_CONVERTER)
   MARK_AS_ADVANCED(LATEX_tth_CONVERTER)
@@ -198,6 +226,7 @@ ENDIF(USE_TTH)
 #-----------------------------------------------------------------------------
 IF(USE_BOOST)
   IF(BBTK_USE_SHIPPED_BOOST)
+    MESSAGE ( STATUS "=======================================")
     MESSAGE(STATUS "bbtk uses shipped boost C++ library (${BBTK_SHIPPED_BOOST})")
     INCLUDE_DIRECTORIES( 
       ${PROJECT_SOURCE_DIR}/kernel/src/ThirdParty/${BBTK_SHIPPED_BOOST})
@@ -212,6 +241,7 @@ IF(USE_BOOST)
     FIND_PACKAGE(Boost REQUIRED)
     MARK_AS_ADVANCED(Boost_INCLUDE_DIR)
     IF(Boost_FOUND)
+      MESSAGE ( STATUS "=======================================")
       MESSAGE(STATUS "Looking for boost C++ library... - found in ${Boost_INCLUDE_DIR}")
       INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
       LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} )
@@ -219,7 +249,7 @@ IF(USE_BOOST)
        boost_signals
        )
     ELSE(Boost_FOUND)
-      MESSAGE(FATAL_ERRO "boost C++ library not found - either set Boost_INCLUDE_DIR or set BBTK_USE_SHIPPED_BOOST to ON to use shipped ${BBTK_SHIPPED_BOOST}")
+      MESSAGE(FATAL_ERROR "boost C++ library not found - either set Boost_INCLUDE_DIR or set BBTK_USE_SHIPPED_BOOST to ON to use shipped ${BBTK_SHIPPED_BOOST}")
     ENDIF(Boost_FOUND)
   ENDIF(BBTK_USE_SHIPPED_BOOST)
 ENDIF(USE_BOOST)
index 2543518e70e7e0749ff3bba2b75510d4a7b3bcf0..03e8354e48b6fb26b5bcd301cc5ebab8e875c58a 100644 (file)
@@ -76,8 +76,6 @@ CHECK_INCLUDE_FILE("sys/timeb.h"    CMAKE_HAVE_SYS_TIMEB_H)
 
 #-----------------------------------------------------------------------------
 # WXWIDGETS
-OPTION(BBTK_USE_WXWIDGETS "Build bbtk library and applications in graphical mode using the wxWidgets library" OFF)
-
 IF(BBTK_USE_WXWIDGETS)
   SET(USE_WXWIDGETS ON CACHE BOOL "Use WxWidgets" FORCE)
 
@@ -91,6 +89,21 @@ IF(BBTK_USE_WXWIDGETS)
 ENDIF(BBTK_USE_WXWIDGETS)
 #-----------------------------------------------------------------------------
 
+#-----------------------------------------------------------------------------
+# KWWIDGETS
+IF(BBTK_USE_KWWIDGETS)
+  SET(USE_KWWIDGETS ON CACHE BOOL "Use KWWidgets" FORCE)
+
+#  INCLUDE(cmake/FIND_AND_USE_WXWIDGETS.cmake)
+#  FIND_AND_USE_WXWIDGETS()
+#  ADD_DEF( _USE_WXWIDGETS_ )
+  SET(BBTK_LINK_LIBRARIES
+    ${BBTK_LINK_LIBRARIES}
+    ${BBTK_KWWIDGETS_LIBRARIES} 
+    )
+ENDIF(BBTK_USE_KWWIDGETS)
+#-----------------------------------------------------------------------------
+
 #-----------------------------------------------------------------------------
 # BOOST 
 SET(BBTK_USE_BOOST TRUE)
diff --git a/kernel/src/bbtkKW.cxx b/kernel/src/bbtkKW.cxx
new file mode 100644 (file)
index 0000000..f4eb6fc
--- /dev/null
@@ -0,0 +1,401 @@
+/*=========================================================================                                                                               
+  Program:   bbtk
+  Module:    $RCSfile: bbtkKW.cxx,v $
+  Language:  C++
+  Date:      $Date: 2008/11/29 21:41:32 $
+  Version:   $Revision: 1.1 $
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+#ifdef USE_KWWIDGETS
+
+#include "bbtkKW.h"
+#include "bbtkMessageManager.h"
+#include "vtkKWApplication.h"
+
+
+//#include "vtkConditionVariable.h"
+#include "vtkMultiThreader.h"
+
+#include <ctime>
+namespace bbtk
+{
+
+  bool _dummy_rmt = 
+    bbtk::MessageManager::RegisterMessageType("kw",
+                                             "KWWidgets related messages",0);
+
+
+
+  //=========================================================================
+  static vtkKWApplication* mgKWApp = 0;
+  static vtkMultiThreader* mgMultiThreader = 0;  /*
+  static vtkKWWindowBase* mgKWTopWindow = 0;
+  static vtkKWWindowBase* mgKWTopWindowParent = 0;
+  static bool mgKWAutoDestroyTopWindow = true;
+  */
+  static int mgKWNbWindowsAlive  = 0;
+  static int mgKWNbWindowsShown  = 0;
+  //=========================================================================
+
+  
+  // static vtkMutexLock* mgKWAppLock;
+
+  //=========================================================================
+  VTK_THREAD_RETURN_TYPE vtkKWApplicationStart( void* arg )
+  {  
+    bbtkDebugMessage("kw",1,"  --> Starting KWApplication in separate thread"
+                    <<std::endl);
+
+    mgKWApp->Start();
+    
+    return VTK_THREAD_RETURN_VALUE;
+  }
+
+
+  //=========================================================================
+
+  //=========================================================================
+  // BBTKKWSIG
+  static KW::Signal_type mgKWSignal;
+  // \BBTKKWSIG
+  //=========================================================================
+
+  //=========================================================================
+  vtkKWApplication* KW::GetApplication()
+  {
+    CreateKWAppIfNeeded();
+    return mgKWApp;
+  }
+  //=========================================================================
+
+
+  //=========================================================================
+  void KW::CreateKWAppIfNeeded()
+  {
+    if (mgKWApp == 0) 
+      {
+       bbtkDebugMessage("kw",1,"  --> Initializing Tcl"<<std::endl);
+       int argc = 1;
+       char bbtk[5] = "bbtk";
+       char* argv[1];
+       argv[0] = bbtk;
+       Tcl_Interp *interp = vtkKWApplication::InitializeTcl(argc, 
+                                                            argv, &std::cerr);
+       if (!interp)
+         {
+           bbtkGlobalError("KW::CreateKWAppIfNeeded() : InitializeTcl failed");
+         }
+
+       bbtkDebugMessage("kw",1,"  --> Creating bbtk KWApplication"
+                        <<std::endl);
+       mgKWApp = vtkKWApplication::New();
+       mgKWApp->SetName("bbtk");
+
+       /*
+       if (mgMultiThreader == 0)
+         {
+           bbtkDebugMessage("kw",1,"  --> Creating MultiThreader"<<std::endl);
+           mgMultiThreader = vtkMultiThreader::New();
+         }
+           bbtkDebugMessage("kw",1,"  --> Spawning KWApplication"<<std::endl);
+       mgMultiThreader->SetNumberOfThreads( 1 );
+       int t = mgMultiThreader->SpawnThread    (  vtkKWApplicationStart, 0);
+       bbtkDebugMessage("kw",1,"  --> Spawned in thread "<<t<<std::endl);
+       */
+
+       // Dies as soon as it starts because no window at this point !!!
+       mgKWApp->Start();
+
+       /*
+       clock_t endwait;
+       endwait = clock () + (100 * CLOCKS_PER_SEC )/ 1000;
+       while (clock() < endwait) {}
+       */
+       bbtkDebugMessage("kw",1,"  --> KWApplication running ..."
+                        <<std::endl);
+     } 
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void KW::DestroyKWAppIfNeeded()
+  {
+    if (mgKWApp!= 0) 
+      {
+       bbtkDebugMessage("kw",1,"  --> Destructing bbtk KWApplication"<<std::endl);
+       mgKWApp->Delete();
+      }
+  }
+  //=========================================================================
+
+  //========================================================================= 
+  /* 
+  void KW::SetTopWindowParent(vtkKWWidget* w)
+  {
+    if (mgTopWindowParent != 0)
+      {
+       bbtkGlobalError("KW::SetTopWindowParent : top window parent != 0");
+      }
+    mgKWTopWindowParent = w;
+  }
+  //=========================================================================
+  */
+  /*
+  //=========================================================================
+  void KW::CreateTopWindowIfNeeded()
+  {
+    if (mgKWTopWindow!=0) return;
+    bbtkDebugMessage("kw",1,"  --> Creating bbtk top KW window"<<std::endl);
+
+    CreateKWAppIfNeeded();
+
+    mgKWTopWindow = vtkKWWindowBase::New();
+    mgKWTopWindow->SupportHelpOff();
+    mgKWApp->AddWindow(mgKWTopWindow);
+    mgKWTopWindow->Create();
+    //    mgKWTopWindow->Withdraw()
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void KW::DestroyTopWindowIfNeeded()
+  {
+    if ( (mgKWNbWindowsAlive==0) && 
+        (mgKWAutoDestroyTopWindow) )
+      {
+       bbtkDebugMessage("kw",1,"  --> Destructing bbtk top KW window"<<std::endl);
+       mgKWTopWindow->Close();
+       mgKWTopWindow->Delete();
+       mgKWTopWindow = 0;
+       
+       DestroyKWAppIfNeeded();
+      }
+  } 
+  //=========================================================================
+  */
+  /*
+  //=========================================================================
+  void KW::LoopUntilAllWindowsClose()
+  {
+    int i = 0;
+    while (mgTopWindow != 0)
+      {
+       if (i % 100 == 0) 
+         {
+           bbtkDebugMessage("kw",2,"KW::Loop "<<i << std::endl);
+         }
+       i++;
+       kwMilliSleep(10);
+
+      }
+  }
+  //=========================================================================
+  */
+
+  /*
+  //=========================================================================
+  vtkKWWindowBase* KW::GetTopWindow() 
+  { 
+    KW::CreateTopWindowIfNeeded();
+    return mgKWTopWindow; 
+  }
+  //=========================================================================
+  
+  //=========================================================================
+  bool KW::TopWindowExists()
+  {
+    return (mgKWTopWindow!=0);
+  }
+  //=========================================================================
+  */
+
+  // BBTKKWSIG
+  //=========================================================================
+  void KW::AddSignalObserver(Slot_function_type f)
+  {
+    mgKWSignal.connect(f);
+  }
+  //=========================================================================
+  // \BBTKKWSIG
+
+  /*
+  //=========================================================================
+  void KW::SetAutoDestroyTopWindow(bool b)
+  {
+    mgKWAutoDestroyTopWindow = b;
+  }
+  //=========================================================================
+  */  
+
+  /*
+  //=========================================================================
+  void KW::SetTopWindow(vtkKWWindowBase* w) 
+  {
+    if ( mgKWTopWindow ) 
+      {
+       bbtkGlobalError("KW::SetTopWindow : top window already set !");
+      } 
+    mgKWTopWindow = w;
+  }
+  //=========================================================================
+  */
+
+  //=========================================================================
+  void KW::IncNbWindowsAlive() 
+  { 
+    mgKWNbWindowsAlive++; 
+    bbtkDebugMessage("kw",2,"* Number of KW windows alive = "
+                    <<mgKWNbWindowsAlive
+                    <<std::endl);
+    // BBTKKWSIG
+    mgKWSignal();
+    // \BBTKKWSIG
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void KW::DecNbWindowsAlive()
+  { 
+    mgKWNbWindowsAlive--; 
+    bbtkDebugMessage("kw",2,"* Number of KW windows alive = "
+                    <<mgKWNbWindowsAlive
+                    <<std::endl);
+
+    //    DestroyTopWindowIfNeeded();
+     // BBTKKWSIG
+    mgKWSignal();
+    // \BBTKKWSIG
+  }
+  //=========================================================================
+  
+  //=========================================================================
+  void KW::IncNbWindowsShown() 
+  { 
+    mgKWNbWindowsShown++; 
+    bbtkDebugMessage("kw",2,"* Number of KW windows shown = "
+                    <<mgKWNbWindowsShown
+                    <<std::endl);
+    // BBTKKWSIG
+    mgKWSignal();
+    // \BBTKKWSIG
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void KW::DecNbWindowsShown()
+  { 
+    mgKWNbWindowsShown--; 
+    bbtkDebugMessage("kw",2,"* Number of KW windows shown = "
+                    <<mgKWNbWindowsShown
+                    <<std::endl);
+
+    //   DestroyTopWindowIfNeeded();
+
+    // BBTKKWSIG
+    mgKWSignal();
+    // \BBTKKWSIG
+  }
+  //=========================================================================
+
+
+  //=========================================================================
+  int  KW::GetNbWindowsAlive() 
+  { 
+    return mgKWNbWindowsAlive; 
+  }
+  //=========================================================================
+  
+  //=========================================================================
+  bool KW::IsSomeWindowAlive() 
+  { 
+    return (mgKWNbWindowsAlive>0);
+  }
+  //=========================================================================
+  
+  
+  //=========================================================================
+  int  KW::GetNbWindowsShown() 
+  { 
+    return mgKWNbWindowsShown; 
+  }
+  //=========================================================================
+  
+  //=========================================================================
+  bool KW::IsSomeWindowShown() 
+  { 
+    return (mgKWNbWindowsShown>0);
+  }
+  //=========================================================================
+  
+  /*
+  //=========================================================================
+  KW::BusyCursor::BusyCursor()
+  {
+    mCursor = 0;
+    if (TopWindowExists()) 
+      {        
+       bbtkDebugMessage("kw",2,
+                        "KW::BusyCursor::BusyCursor()"<<std::endl);
+          mCursor = new kwBusyCursor; 
+       //::kwBeginBusyCursor(); 
+    }
+  }
+  KW::BusyCursor::~BusyCursor()
+  {
+    if (mCursor) delete mCursor;
+  }
+  //=========================================================================
+  */
+  /*
+  //=========================================================================
+  void KW::ResetCursor() 
+  {
+    if (!TopWindowExists()) return;
+    bbtkDebugMessage("kw",9,"KW::ResetCursor()"<<std::endl);
+    while (kwIsBusy()) ::kwEndBusyCursor();
+  }
+  //=========================================================================
+  //=========================================================================
+  void KW::BeginBusyCursor() 
+  {
+    if (!TopWindowExists()) return;
+    bbtkDebugMessage("kw",9,"KW::BeginBusyCursor()"<<std::endl);
+    ::kwBeginBusyCursor();
+  }
+  //=========================================================================
+  //=========================================================================
+  void KW::EndBusyCursor()
+  {
+    if (!TopWindowExists()) return;
+    bbtkDebugMessage("kw",9,"KW::EndBusyCursor()"<<std::endl);
+    ::kwEndBusyCursor();
+  }
+  //=========================================================================
+  */
+
+}
+
+#endif
diff --git a/kernel/src/bbtkKW.h b/kernel/src/bbtkKW.h
new file mode 100644 (file)
index 0000000..7bde8ac
--- /dev/null
@@ -0,0 +1,143 @@
+/*=========================================================================                                                                               
+  Program:   bbtk
+  Module:    $RCSfile: bbtkKW.h,v $
+  Language:  C++
+  Date:      $Date: 2008/11/29 21:41:33 $
+  Version:   $Revision: 1.1 $
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */
+
+#ifndef __bbtkKW_h_INCLUDED__
+#define __bbtkKW_h_INCLUDED__
+
+//===========================================================================
+#ifdef USE_KWWIDGETS
+
+
+// KW headers
+//#include <vtkKWWidget.h>
+//#include <vtkKWWindowBase.h>
+
+
+
+//===========================================================================
+
+//===========================================================================
+#include "bbtkSystem.h"
+#include "vtkKWApplication.h"
+//===========================================================================
+
+//===========================================================================
+// SIGNAL/SLOT MECHANISM 
+// FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION 
+// BBTKKWSIG
+#include <boost/signal.hpp>
+#include <boost/bind.hpp>
+// \BBTKKWSIG
+//===========================================================================
+
+namespace bbtk
+{
+
+  //==================================================================
+  /// Global KWWidgets handlers (application, cursor...)
+  
+// BBTKKWSIG
+#define bbtkAddKWSignalObserver(METHOD)                \
+  KW::AddSignalObserver(boost::bind(&METHOD, this))
+// \BBTKKWSIG
+
+#define BBTK_KW_BUSY_CURSOR bbtk::KW::BusyCursor __bbtk_dummy_busy_cursor;
+
+  struct BBTK_EXPORT KW
+  {    
+  public:
+    // BBTKKWSIG
+    typedef boost::signals::trackable SignalObserver;
+    typedef boost::signal<void ()>  Signal_type;
+    typedef Signal_type::slot_function_type Slot_function_type;
+    // \BBTKKWSIG
+    
+    static vtkKWApplication* GetApplication();
+    
+    /*
+    static void ResetCursor();
+    static void BeginBusyCursor(); 
+    static void EndBusyCursor();
+    */
+
+    //    static void LoopUntilAllWindowsClose();
+
+    class BusyCursor
+    {
+    public:
+      BusyCursor();
+      ~BusyCursor();
+      //      wxBusyCursor* mCursor;
+    };
+
+    //    static void SetTopWindowParent(vtkKWWidget*);
+    static void SetAutoDestroyTopWindow(bool);
+
+    /// Returns the creation time parent of all bbtk windows 
+    /// (window can be reparented after creation)
+    //    static vtkKWWindowBase* GetTopWindow();
+    //    static bool TopWindowExists();
+    
+    static void IncNbWindowsAlive();
+    static void DecNbWindowsAlive();
+    static int  GetNbWindowsAlive();
+    static bool IsSomeWindowAlive();
+    
+    static void IncNbWindowsShown();
+    static void DecNbWindowsShown();
+    static int  GetNbWindowsShown();
+    static bool IsSomeWindowShown();
+
+    // BBTKKWSIG
+    static void AddSignalObserver(Slot_function_type);
+    // \BBTKKWSIG
+    
+  private:
+    
+    static void CreateKWAppIfNeeded();
+    static void DestroyKWAppIfNeeded();
+    
+    //    static void CreateTopWindowIfNeeded();
+    //    static void DestroyTopWindowIfNeeded();
+    
+    /// Sets the creation time parent of all bbtk windows
+    //    static void SetTopWindow(vtkKWWindowBase*);
+    
+  }; 
+  // struct KW
+  //==================================================================
+  
+
+
+  
+} // namespace bbtk
+  
+#endif // EO USE_KWWIDGETS
+#endif // EO __bbtkKW_h_INCLUDED__
diff --git a/kernel/src/bbtkKWBlackBox.cxx b/kernel/src/bbtkKWBlackBox.cxx
new file mode 100644 (file)
index 0000000..f1de79e
--- /dev/null
@@ -0,0 +1,845 @@
+/*=========================================================================                                                                               
+  Program:   bbtk
+  Module:    $RCSfile: bbtkKWBlackBox.cxx,v $
+  Language:  C++
+  Date:      $Date: 2008/11/29 21:41:33 $
+  Version:   $Revision: 1.1 $
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+/**
+ *  \file 
+ *  \brief 
+ */
+
+#ifdef USE_KWWIDGETS
+
+
+
+
+#include "bbtkKWBlackBox.h"
+#include "vtkObjectFactory.h"
+
+
+namespace bbtk
+{
+
+
+  //=========================================================================
+  // vtkKWBlackBoxWindow
+  //=========================================================================
+
+
+
+  //=========================================================================
+  vtkKWBlackBoxWindow::vtkKWBlackBoxWindow()
+    : mShown(false)
+  {
+    bbtkDebugMessage("kw",9,"vtkKWBlackBoxWindow::vtkKWBlackBoxWindow()"
+                    <<std::endl);
+    KW::IncNbWindowsAlive();
+  }
+  //=========================================================================
+
+
+
+  //=========================================================================
+  vtkKWBlackBoxWindow::~vtkKWBlackBoxWindow()
+  {
+    bbtkDebugMessage("kw",9,"vtkKWBlackBoxWindow::~vtkKWBlackBoxWindow() "
+                    <<this<<std::endl);
+    bbHide();
+    KW::DecNbWindowsAlive();
+    if (!mBox.expired())
+      {
+       mBox.lock()->bbSetWindow(0);
+      }
+  }
+  //========================================================================= 
+
+
+  //=========================================================================
+  void vtkKWBlackBoxWindow::bbShow()
+  {
+    if (bbIsShown()) return;
+    bbtkDebugMessage("kw",9,"vtkKWBlackBoxWindow::bbShow()"<<std::endl);
+    KW::IncNbWindowsShown();
+    mShown = true;
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void vtkKWBlackBoxWindow::bbHide()
+  {
+    if (!bbIsShown()) return;
+    bbtkDebugMessage("kw",9,"vtkKWBlackBoxWindow::bbHide()"<<std::endl);
+    KW::DecNbWindowsShown();
+    mShown = false;
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void vtkKWBlackBoxWindow::bbClose()
+  {
+  }
+  //=========================================================================
+
+
+  //=========================================================================
+  // vtkKWBlackBoxDialog
+  //=========================================================================
+  
+  //-------------------------------------------------------------------------
+  vtkStandardNewMacro( vtkKWBlackBoxDialog );
+  vtkCxxRevisionMacro(vtkKWBlackBoxDialog, "$Revision: 1.1 $");
+  //-------------------------------------------------------------------------
+
+  //=========================================================================
+  vtkKWBlackBoxDialog::vtkKWBlackBoxDialog()
+  {
+    bbtkDebugMessage("kw",9,"vtkKWBlackBoxDialog::vtkKWBlackBoxDialog()"
+                    <<std::endl);
+  }
+  //=========================================================================
+  
+  //=========================================================================
+  void vtkKWBlackBoxDialog::bbShow()
+  { 
+    if (bbIsShown()) return;
+    bbtkDebugMessage("kw",5,"vtkKWBlackBoxDialog::bbShow() ["
+                    <<bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
+    vtkKWBlackBoxWindow::bbShow();
+    //SetReturnCode( kwDialog::ShowModal() ); 
+    this->Display();
+    bbClose();
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void vtkKWBlackBoxDialog::bbHide()
+  {
+    bbtkDebugMessage("kw",9,"vtkKWBlackBoxDialog::bbHide()"<<std::endl);
+    vtkKWBlackBoxWindow::bbHide();
+    //    Hide();
+    this->Withdraw();
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void vtkKWBlackBoxDialog::bbClose()
+  {
+    bbtkDebugMessage("kw",9,"vtkKWBlackBoxDialog::bbClose()"<<std::endl);
+    this->Done = vtkKWDialog::StatusCanceled;
+    //   this->Delete();
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void vtkKWBlackBoxDialog::Cancel()
+  {
+    bbtkDebugMessage("kw",9,"vtkKWBlackBoxDialog::Cancel()"<<std::endl);
+    this->Delete();
+  }
+  //=========================================================================
+  //=========================================================================
+  vtkKWBlackBoxDialog::~vtkKWBlackBoxDialog()
+  {
+  }
+  //=========================================================================
+
+
+
+
+
+  //=========================================================================
+  // vtkKWBlackBoxFrame
+  //=========================================================================
+
+  //-------------------------------------------------------------------------
+  vtkStandardNewMacro( vtkKWBlackBoxFrame );
+  vtkCxxRevisionMacro(vtkKWBlackBoxFrame, "$Revision: 1.1 $");
+  //-------------------------------------------------------------------------
+  //=========================================================================
+  vtkKWBlackBoxFrame::vtkKWBlackBoxFrame()
+  {
+    bbtkDebugMessage("kw",9,"vtkKWBlackBoxFrame::vtkKWBlackBoxFrame()"<<std::endl);
+  }
+  //=========================================================================
+  
+  //=========================================================================
+  vtkKWBlackBoxFrame::~vtkKWBlackBoxFrame()
+  {
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void vtkKWBlackBoxFrame::bbShow() 
+  { 
+    if (bbIsShown()) return;
+    bbtkDebugMessage("kw",5,"vtkKWBlackBoxFrame::bbShow("
+                    <<bbGetBlackBox()->bbGetFullName()<<")"<<std::endl);
+    vtkKWBlackBoxWindow::bbShow();
+    // vtkKWFrame::Show();
+    this->Display();
+    // This Update is ** MANDATORY ** 
+    // to synchronize kwvtkRenderWindowInteractor objects
+    // (force kw objects creation **NOW**)
+    /*
+
+#if defined(_WIN32)
+      kwFrame::Refresh();
+#endif
+
+      kwFrame::Update();
+      kwFrame::SetFocus();
+    */
+    if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnShow();
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void vtkKWBlackBoxFrame::bbHide()
+  {
+    bbtkDebugMessage("kw",9,"vtkKWBlackBoxFrame::bbHide()"<<std::endl);
+    vtkKWBlackBoxWindow::bbHide();
+    //  vtkKWFrame::Hide();
+    this->Withdraw();
+    if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnHide();
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void vtkKWBlackBoxFrame::bbClose()
+  {
+    bbtkDebugMessage("kw",9,"vtkKWBlackBoxFrame::bbClose()"<<std::endl);
+    //    vtkKWFrame::Close();
+    this->Delete();
+  }
+  //=========================================================================
+
+
+  /*
+  //=========================================================================
+  // KWBlackBoxWidgetEventHandler
+  //=========================================================================
+
+  //=========================================================================
+  KWBlackBoxWidgetEventHandler::
+  KWBlackBoxWidgetEventHandler( KWBlackBox::Pointer box, 
+                               vtkKWWidget *widget )
+    :
+    mBox(box),
+    mWindow(widget)
+  { 
+    bbtkDebugMessage("kw",9,"KWBlackBoxWidgetEventHandler::KWBlackBoxWidgetEventHandler("<<mBox.lock()->bbGetFullName()<<")"<<std::endl);
+
+    mBox.lock()->bbSetWidgetEventHandler(this);
+
+    Connect (  mWindow->GetId(),
+              kwEVT_DESTROY,
+              (kwObjectEventFunction) 
+              (void (kwEvtHandler::*)(kwWindowDestroyEvent& c))
+               &KWBlackBoxWidgetEventHandler::OnWindowDestroy );
+    
+    mWindow->PushEventHandler(this);
+    
+  }
+  //=========================================================================
+
+  //=========================================================================
+  KWBlackBoxWidgetEventHandler::~KWBlackBoxWidgetEventHandler()
+  {
+    if (mBox.expired()) return;
+    bbtkDebugMessage("kw",9,
+                    "KWBlackBoxWidgetEventHandler::~KWBlackBoxWidgetEventHandler() ["
+                    <<mBox.lock()->bbGetFullName()<<"]"<<std::endl);
+     mBox.lock()->bbSetWidgetEventHandler(0);   
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void KWBlackBoxWidgetEventHandler::OnWindowDestroy(kwWindowDestroyEvent&)
+  {
+    if (mBox.expired()) return;
+    bbtkDebugMessage("kw",9,"KWBlackBoxWidgetEventHandler::OnWindowDestroy() ["
+                    <<mBox.lock()->bbGetFullName()<<"]"<<std::endl);
+    mBox.lock()->bbSetOutputWidget(0);
+    mBox.lock()->bbSetModifiedStatus();
+  }
+  //=========================================================================
+
+
+  */
+
+
+
+
+  //=========================================================================
+  // KWBlackBox
+  //=========================================================================
+
+  //=========================================================================
+  //=========================================================================
+  //=========================================================================
+  //=========================================================================
+  BBTK_BLACK_BOX_IMPLEMENTATION(KWBlackBox,AtomicBlackBox);
+  //=========================================================================
+  
+  //=========================================================================
+  void KWBlackBox::bbUserConstructor()
+  {
+    bbtkDebugMessage("Kernel",9,"KWBlackBox::bbUserConstructor()"<<std::endl);
+    bbInitAttributes();
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void KWBlackBox::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
+  {
+    bbtkDebugMessage("Kernel",9,"KWBlackBox::bbUserCopyConstructor()"
+                    <<std::endl);
+    bbInitAttributes();
+  }
+  //=========================================================================
+
+
+  //=========================================================================
+  void KWBlackBox::bbUserDestructor()
+  {
+    bbtkDebugMessage("kw",9,"==> KWBlackBox::bbUserDestructor() ["<<bbGetFullName()<<"]"<<std::endl);
+    if (bbGetWindow()) {
+      bbGetWindow()->bbClose();
+      bbSetWindow(0);
+    }
+    bbtkDebugMessage("kw",9,"<== KWBlackBox::bbUserDestructor() ["<<bbGetFullName()<<"]"<<std::endl);
+  }
+  //=========================================================================
+  
+
+
+  //=========================================================================
+  /**
+   * \brief Initialize the attributes of the class
+   *
+   */
+  void KWBlackBox::bbInitAttributes()
+  {
+    bbmWindow = 0;
+    //    bbmWidget = 0;
+    //    bbSetInputWinParent(0);
+    bbSetInputWinTitle(bbGetName());
+    bbSetInputWinWidth(800);
+    bbSetInputWinHeight(800);
+    bbSetInputWinDialog(false);
+    bbSetOutputWidget(0);
+
+    //    bbSetWidgetEventHandler(0);
+    bbSetUpdateTransferedToParent(false);
+  }
+  //=========================================================================
+
+  //=========================================================================
+  /// Main processing method of the box.
+  void KWBlackBox::bbExecute(bool force)
+  {
+    bbtkDebugMessageInc("process",2,
+                       "=> KWBlackBox::bbExecute("<<(int)force<<") ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+
+    // If the output 'Widget' is connected then 
+    // we must execute the parent box
+    BlackBox::OutputConnectorMapType::const_iterator i 
+      = bbGetOutputConnectorMap().find("Widget");
+
+    if ( i->second->GetConnectionVector().size() != 0 ) 
+      {
+       bbtkDebugMessage("process",3,
+                        "-> Output 'Widget' connected : transfering execution to parent"
+                        <<std::endl);
+       
+       i->second->GetConnectionVector().front() //.lock()
+         ->GetBlackBoxTo()->bbExecute(force);
+
+      }
+    // else call 'standard' BlackBox execution method
+    else 
+      {
+       BlackBox::bbExecute(force);
+      }
+    //
+
+    bbtkDebugMessageDec("process",2,
+                       "<= KWBlackBox::bbExecute() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+  }
+  //=========================================================================
+
+
+  //=========================================================================
+  /// Main processing method of the box.
+  IOStatus KWBlackBox::bbBackwardUpdate( Connection::Pointer caller )
+  {
+    bbtkDebugMessage("process",3,
+                    "=> KWBlackBox::bbBackwardUpdate("
+                    <<(caller?caller->GetFullName():"0")<<") ["
+                    <<bbGetFullName()<<"]"<<std::endl);
+
+    if ( ! (( bbGetStatus() == MODIFIED ) ||
+           ( bbBoxProcessModeIsAlways() )) )
+      {
+       bbtkDebugMessage("process",3,"Up-to-date : nothing to do"<<std::endl);
+       bbtkDebugMessage("process",3,
+                        "<= KWBlackBox::bbBackwardUpdate("
+                        <<(caller?caller->GetFullName():"0")<<") ["
+                        <<bbGetFullName()<<"]"<<std::endl);
+       return bbGetStatus();
+      }
+    // If the caller's box to is not the box to connected to the 
+    // output 'Widget'
+
+    BlackBox::OutputConnectorMapType::const_iterator i 
+      = bbGetOutputConnectorMap().find("Widget") ;
+    if ( i->second->GetConnectionVector().size() != 0 )
+      
+      {
+       BlackBox::Pointer to = 
+         i->second->GetConnectionVector()[0]->GetBlackBoxTo();
+               
+       if (caller) 
+         {
+           bbtkDebugMessage("process",3,
+                            "-> Output 'Widget' connected to '"
+                            <<to->bbGetFullName()<<"' - caller->to = '"
+                            <<caller->GetBlackBoxTo()->bbGetFullName()
+                            <<"'"
+                            <<std::endl);
+         }
+       else
+         {
+           bbtkDebugMessage("process",3,
+                            "-> Output 'Widget' connected to '"
+                            <<to->bbGetFullName()<<"'"
+                            <<std::endl);
+         }
+       if ((caller==0) ||
+           ( (caller!=0) && 
+             (caller->GetBlackBoxTo() != to)&&
+             (!bbGetUpdateTransferedToParent())&&
+             (!to->bbGetExecuting()) 
+             )
+           )
+         {
+           bbtkDebugMessage("process",3,
+                            "   ... Transfering update order to parent"
+                            <<std::endl);
+           
+           bbSetUpdateTransferedToParent(true);
+           i->second->GetConnectionVector().front() //.lock()
+             ->GetBlackBoxTo()->bbExecute(false);
+         }
+       else
+         {
+           bbSetUpdateTransferedToParent(false);
+           bbtkDebugMessage("process",3,
+                            "   ... No need to transfer to parent"
+                            <<std::endl);
+         }
+      }
+    /*    
+
+    // If the caller is not the connection to the output widget
+    // and the output 'Widget' is connected then 
+    // we must execute the parent box 
+    // but only one time 
+    // (this is the role of the flag UpdateTransferedToParent)
+    if ( (caller==0) ||
+        ((caller!=0)&&(caller->GetBlackBoxFromOutput()!="Widget"))
+        )
+      {
+      }
+    */
+    // call 'standard' BlackBox execution method
+    if (!bbGetUpdateTransferedToParent()) 
+      { 
+         AtomicBlackBox::bbBackwardUpdate(caller);
+      }
+    
+    bbtkDebugMessageDec("process",3,
+                       "<= KWBlackBox::bbBackwardUpdate() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+    
+   return bbGetStatus();
+     
+
+  }
+
+  //=========================================================================
+  void KWBlackBox::bbProcess()
+  { 
+/*
+         if (bbGetOutputWidget()==0) this->bbUserCreateWidget();
+    this->bbUserProcess(); 
+    bbShowWindow();
+    //    this->bbUserOnShow();
+*/
+    this->bbUserProcess(); 
+
+    // If output widget not connected create the window 
+    if ( (*bbGetOutputConnectorMap().find("Widget")).second
+        ->GetConnectionVector().size() == 0 ) 
+      {
+       Window* show = 0;
+       // If the window already exists : no need creating it
+       if (bbGetWindow()!=0)
+         {
+           bbtkDebugMessage("kw",2,
+                            "-> Window already exists"
+                            <<std::endl);
+           show = bbGetWindow();
+         }
+       // Else create window 
+       else 
+         {
+           bbtkDebugMessage("kw",2,
+                            "-> Creating the window"
+                            <<std::endl);
+           KW::GetApplication();
+           
+           // Input WinDialog set to true : creating a Dialog
+           /*
+           if (bbGetInputWinDialog()) 
+             {
+               bbtkDebugMessage("kw",2,
+                                "   Input WinDialog set to true : creating a Dialog"
+                                <<std::endl);
+           */
+               vtkKWBlackBoxDialog* win = vtkKWBlackBoxDialog::New();
+               show = (Window*) win;
+               win->bbSetBlackBox( GetThisPointer<KWBlackBox>());
+               //bbGetOutputWidget()->GetWidgetName());
+                            // win->SetName( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN" );
+               //              win->SetWidth( bbGetInputWinWidth() );
+               //              win->SetHeight( bbGetInputWinHeight() );
+               KW::GetApplication()->AddWindow((vtkKWWindowBase*)win);
+               win->Create();
+               std::cout << "TclName='"<<win->GetTclName()<<"'"<<std::endl;
+               
+               bbUserCreateWidget(win);
+               KW::GetApplication()->Script("pack %s -side left -anchor c -expand y",
+                                            bbGetOutputWidget()->GetWidgetName());
+               /*
+               bbGetOutputWidget()->SetParent(win);
+               bbGetOutputWidget()->Create();
+               KW::GetApplication()->Script("pack %s -side left -anchor c -expand y",
+                       
+                                    //"pack %s -side top -anchor nw -expand y -fill none -padx 2 -pady 2", 
+                                            bbGetOutputWidget()->GetWidgetName());
+               */                           
+               /*      
+                 }
+       
+           // Input WinDialog set to false : creating a Frame
+           else 
+             {
+               bbtkDebugMessage("process",2,
+                                "   Input WinDialog set to false : creating a Frame"
+                                <<std::endl);
+               vtkKWBlackBoxFrame* win = vtkKWBlackBoxFrame::New();
+               show = (Window*) win;
+               win->bbSetBlackBox( GetThisPointer<KWBlackBox>());
+               //              win->SetName( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN" );
+               //              win->SetWidth( bbGetInputWinWidth() );
+               //              win->SetHeight( bbGetInputWinHeight() );
+               KW::GetApplication()->AddWindow((vtkKWWindowBase*)win);
+               win->Create();
+               
+               bbGetOutputWidget()->SetParent(win);
+               bbGetOutputWidget()->Create();
+               KW::GetApplication()->Script("pack %s -side top -anchor nw -expand y -fill none -padx 2 -pady 2", 
+                                            bbGetOutputWidget()->GetWidgetName());           }
+       */
+       
+               //      win->Invoke();
+         }
+       
+       // Show the window
+
+       show->bbShow(); 
+       KW::GetApplication()->Start();
+       
+      }                  
+    //   
+    
+  }
+  //=========================================================================
+  
+  
+  /*
+  // LG 24/11/08 : New widget pipeline
+  void KWBlackBox::bbCreateWidgetAndEventHandler(vtkKWWidget* parent)
+  {
+    if (bbGetOutputWidget()==0)
+      {
+       this->bbUserCreateWidget(parent);
+      }        
+    
+    // If Event Handler for the widget does not exist or is obsolete : create it 
+    
+      if (bbGetOutputWidget()!=0)
+      {
+       if (bbGetWidgetEventHandler()==0)
+         {
+           bbtkDebugMessage("kw",3,
+                            "-> No widget event handler : creating one"
+                            <<std::endl);
+           new KWBlackBoxWidgetEventHandler(GetThisPointer<KWBlackBox>(),
+                                            bbGetOutputWidget());
+         }
+       else if ( ! bbGetWidgetEventHandler()->IsHandlerOf 
+                 ( bbGetOutputWidget() ) )
+         {
+           bbtkDebugMessage("kw",3,
+                            "-> Obsolete widget event handler : re-creating one"
+                            <<std::endl);
+           delete bbGetWidgetEventHandler();
+           new KWBlackBoxWidgetEventHandler(GetThisPointer<KWBlackBox>(),
+                                            bbGetOutputWidget());
+         }
+       // Sets the name of the vtkKWWidget to the input WinTitle
+       bbGetOutputWidget()->SetName(bbtk::std2kw(bbGetInputWinTitle()));
+      }
+   
+  }
+    
+  */
+  
+  vtkKWWidget*  KWBlackBox::bbCreateWidgetOfInput(const std::string& in, vtkKWWidget* parent)
+  {
+    vtkKWWidget* w = 0;
+    // If input is connected 
+    BlackBoxInputConnector* c = bbGetInputConnectorMap().find(in)->second ;
+    if ( c->IsConnected() )                    
+      {
+       // Get black box from 
+       BlackBox::Pointer from = 
+         c->GetConnection()->GetBlackBoxFrom();
+       // Cast it into a KWBlackBox
+       KWBlackBox::Pointer wfrom = boost::dynamic_pointer_cast<KWBlackBox>(from);
+       // Call bbCreateWidget
+       wfrom->bbUserCreateWidget(parent);
+       // Get the widget created
+       w = wfrom->bbGetOutputWidget();
+      }
+    return w;
+  }
+  
+  
+/*
+  //==================================================================
+  /// Specific methods for window creation during pipeline execution
+  /// Shows the window associated to the box 
+  /// (called after bbProcess during bbExecute)
+  void KWBlackBox::bbShowWindow()
+  {
+    bbtkDebugMessageInc("kw",1,"=> KWBlackBox::bbShowWindow() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+    // If Event Handler for the widget does not exist or is obsolete : create it 
+    if (bbGetOutputWidget()!=0)
+      {
+       if (bbGetWidgetEventHandler()==0)
+         {
+           bbtkDebugMessage("kw",3,
+                            "-> No widget event handler : creating one"
+                            <<std::endl);
+           new KWBlackBoxWidgetEventHandler(GetThisPointer<KWBlackBox>(),
+                                            bbGetOutputWidget());
+         }
+       else if ( ! bbGetWidgetEventHandler()->IsHandlerOf 
+                 ( bbGetOutputWidget() ) )
+         {
+           bbtkDebugMessage("kw",3,
+                            "-> Obsolete widget event handler : re-creating one"
+                            <<std::endl);
+           delete bbGetWidgetEventHandler();
+           new KWBlackBoxWidgetEventHandler(GetThisPointer<KWBlackBox>(),
+                                            bbGetOutputWidget());
+         }
+       // Sets the name of the vtkKWWidget to the input WinTitle
+       bbGetOutputWidget()->SetName(bbtk::std2kw(bbGetInputWinTitle()));
+      }
+
+    // If the output 'Widget' is connected then it's gonna 
+    // be captured by its parent window : nothing to do 
+    if ( (*bbGetOutputConnectorMap().find("Widget")).second
+        ->GetConnectionVector().size() != 0 ) 
+      {
+       
+       bbtkDebugMessage("kw",2,
+                        "-> Output 'Widget' connected : nothing to do"
+                        <<std::endl);
+       return;
+      }
+
+
+    Window* show = 0;
+    // If the window already exists : no need creating it
+    if (bbGetWindow()!=0)
+      {
+       bbtkDebugMessage("kw",2,
+                        "-> Window already exists"
+                        <<std::endl);
+       show = bbGetWindow();
+      }
+    // Else if the widget exists : create window 
+    else if (bbGetOutputWidget()!=0) 
+      {
+       bbtkDebugMessage("kw",2,
+                        "-> Widget exists : creating the window"
+                        <<std::endl);
+
+
+       // Input WinDialog set to true : creating a Dialog
+       if (bbGetInputWinDialog()) 
+         {
+           bbtkDebugMessage("kw",2,
+                            "   Input WinDialog set to true : creating a Dialog"
+                            <<std::endl);
+           show = (Window*) new KWBlackBoxDialog( GetThisPointer<KWBlackBox>(),
+                                                 // bbGetKWParent(), 
+                                                                                         // LG 24/11/08 : New widget pipeline
+                                                                                         KW::GetTopWindow(),
+                                                  std2kw( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"),
+                                                  kwSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) );
+         }
+       // Input WinDialog set to false : creating a Frame
+       else 
+         {
+           bbtkDebugMessage("process",2,
+                            "   Input WinDialog set to false : creating a Frame"
+                            <<std::endl);
+           show = (Window*) new KWBlackBoxFrame( GetThisPointer<KWBlackBox>(),
+                                                 // bbGetKWParent(), 
+                                                                                        // LG 24/11/08 : New widget pipeline
+                                                                                        KW::GetTopWindow(),
+                                                 std2kw( bbGetInputWinTitle()  + " - bbtk (c) CREATIS LRMN"),
+                                                 kwSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) );
+         }
+
+      }
+    // No window nor widget : error
+    else
+      {
+       bbtkError("KWBlackBox::bbShowWindow() ["
+                 <<bbGetFullName()
+                 <<"] : No widget. Did you set the box output 'Widget' in the processing method of the box ?");
+      }
+    
+    // Show the window
+    if (true) //!show->IsShown())
+      {
+       show->bbShow(); 
+      }
+    else 
+      {
+       bbtkDebugMessage("kw",2,"-> Already shown : nothing to do"<<std::endl);
+      }
+  
+
+    bbtkDebugMessage("kw",2,"<= KWBlackBox::bbShowWindow() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+
+  }
+  //==================================================================
+*/
+
+
+
+  //==================================================================
+   void KWBlackBox::bbHideWindow()
+  {
+    bbtkDebugMessageInc("kw",1,"=> KWBlackBox::bbHideWindow() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+
+    if (bbGetWindow()!=0) bbGetWindow()->bbHide();
+
+    bbtkDebugMessageDec("kw",2,"<= KWBlackBox::bbHideWindow() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+  }
+  //==================================================================
+
+
+  //==================================================================
+   void KWBlackBox::bbCloseWindow()
+  {
+    bbtkDebugMessageInc("kw",1,"=> KWBlackBox::bbCloseWindow() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+
+    if (bbGetWindow()!=0) bbGetWindow()->bbClose();
+
+    bbtkDebugMessageDec("kw",2,"<= KWBlackBox::bbCloseWindow() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+  }
+  //==================================================================
+
+  //==================================================================
+  KWBlackBox::Window* KWBlackBox::bbGetContainingWindow()
+  {
+    if (bbGetWindow()!=0) return bbGetWindow();
+    BlackBox::OutputConnectorMapType::const_iterator i 
+      = bbGetOutputConnectorMap().find("Widget");
+    if ( i->second->GetConnectionVector().size() != 0 ) 
+      {
+       return boost::static_pointer_cast<KWBlackBox>
+         (i->second->GetConnectionVector().front() //.lock()
+          ->GetBlackBoxTo())->bbGetContainingWindow();
+      }
+    return 0;
+  }
+  //==================================================================
+
+
+  //==================================================================
+       // LG 24/11/08 : New widget pipeline
+       //  vtkKWWidget* KWBlackBox::bbGetKWParent() { return KW::GetTopWindow(); }
+  //==================================================================
+  
+  
+  //==================================================================
+  bool KWBlackBox::bbIsShown()
+  {
+    if (bbGetContainingWindow()!=0)
+      return bbGetContainingWindow()->bbIsShown();
+    return false;
+  }
+  //==================================================================
+
+
+}//namespace bbtk
+
+
+#endif
+
diff --git a/kernel/src/bbtkKWBlackBox.h b/kernel/src/bbtkKWBlackBox.h
new file mode 100644 (file)
index 0000000..dec705f
--- /dev/null
@@ -0,0 +1,389 @@
+/*=========================================================================                                                                               
+  Program:   bbtk
+  Module:    $RCSfile: bbtkKWBlackBox.h,v $
+  Language:  C++
+  Date:      $Date: 2008/11/29 21:41:34 $
+  Version:   $Revision: 1.1 $
+========================================================================*/
+
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+/**
+ * \brief Short description in one line
+ * 
+ * Long description which 
+ * can span multiple lines
+ */
+/**
+ * \file 
+ * \brief 
+ */
+/**
+ * \class bbtk::
+ * \brief 
+ */
+#ifndef __bbtkKWBlackBox_h_INCLUDED__
+#define __bbtkKWBlackBox_h_INCLUDED__
+
+
+#ifdef USE_KWWIDGETS
+
+#include "bbtkAtomicBlackBox.h"
+
+
+#include "bbtkKW.h"
+#include "vtkKWWidget.h"
+#include "vtkKWWindowBase.h"
+#include "vtkKWFrame.h"
+#include "vtkKWDialog.h"
+
+namespace bbtk
+{
+
+
+
+
+  //==================================================================
+  // Forward declaration of the class of window associated to a KWBlackBox
+  class vtkKWBlackBoxWindow;
+  //==================================================================
+
+  //==================================================================
+  // Forward declaration of the widget event handler class
+  //  class KWBlackBoxWidgetEventHandler;
+  //==================================================================
+
+
+  //==================================================================
+  /// Widget black boxes
+  class BBTK_EXPORT KWBlackBox : public bbtk::AtomicBlackBox  
+  { 
+    BBTK_BLACK_BOX_INTERFACE(KWBlackBox,bbtk::AtomicBlackBox);
+    BBTK_DECLARE_INPUT(WinTitle,std::string);
+    BBTK_DECLARE_INPUT(WinWidth,int);
+    BBTK_DECLARE_INPUT(WinHeight,int);
+    BBTK_DECLARE_INPUT(WinDialog,bool);
+    BBTK_DECLARE_INPUT(WinHide,Void);
+    BBTK_DECLARE_INPUT(WinClose,Void);
+    BBTK_DECLARE_OUTPUT(Widget, vtkKWWidget*);
+
+  public:
+    /// Main processing method of the box. Overloaded to handle windows inclusion : if the output Widget is connected then the execution is transfered to the box to which it is connected (as the container window must be created and displayed - this box will be executed by the normal pipeline recursion mechanism)
+    virtual void bbExecute(bool force = false);
+
+
+    typedef vtkKWBlackBoxWindow Window;
+    
+    /// Returns the **OWN** window associated to the box
+    /// If 0 returned = no window
+    Window* bbGetWindow() { return bbmWindow; }
+
+    /// Returns the window containing the widget associated to the box
+    /// Which can be the own window of **ANOTHER** box in case of 
+    /// a hierarchy of widgets.
+    /// More precisely :
+    /// If bbGetWindow() != 0 then returns bbGetWindow()
+    /// Else if the output 'Widget' is connected 
+    ///  then returns bbGetContainingWindow() of the box connected to 'Widget'
+    /// Else returns 0;
+    Window* bbGetContainingWindow();
+
+    /// Returns the parent wxWindow that must be used to create the widget 
+         //
+         // LG 24/11/08 : New widget pipeline
+         //    wxWindow* bbGetKWParent();
+
+    /// Returns true iff the 'containing window' exists and is shown 
+    /// (see bbGetContainingWindow).
+    bool bbIsShown();
+
+    //==================================================================    
+    /// User callback invoked when the containing window is shown
+    virtual void bbUserOnShow() {}
+    //==================================================================    
+    //==================================================================    
+    /// User callback invoked when the containing window is hidden
+    virtual void bbUserOnHide() {}
+    //==================================================================    
+
+    // LG 24/11/08 : New widget pipeline
+    //    void bbCreateWidgetAndEventHandler(vtkKWWidget* parent); 
+
+         
+  protected:
+    
+  
+    //==================================================================
+    /// User callback called in the box contructor
+    virtual void bbUserConstructor();
+    /// User callback called in the box copy constructor
+    virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer);
+    /// User callback called in the box destructor
+    virtual void bbUserDestructor();
+    //==================================================================    
+
+    //==================================================================    
+    /// User callback for creating the widget associated to the box
+    /// ** Must be defined **
+    // LG 24/11/08 : New widget pipeline
+    virtual void bbUserCreateWidget(vtkKWWidget* parent) 
+    {
+      bbtkError(bbGetTypeName()<<" is a KWBlackBox whose bbUserCreateWidget methods is not overloaded : is it a feature or a bug ?!?");
+    }
+    //==================================================================    
+
+
+    vtkKWWidget* bbCreateWidgetOfInput(const std::string& in, 
+                                      vtkKWWidget* parent);
+
+
+    //==================================================================
+    /// Main processing method of the box.
+    virtual IOStatus bbBackwardUpdate( Connection::Pointer caller );
+    //==================================================================
+
+
+
+    //==================================================================
+    /// Overloaded processing method for KWBlackBoxes
+    virtual void bbProcess();
+    //==================================================================
+
+    //==================================================================
+    /// If necessary creates the KWBlackBoxWindow associated to the box
+    /// and shows it 
+    /// (does nothing if the box output 'Widget' is connected which 
+    /// means that the box does not have its own window but is contained 
+    /// into another window)
+    void bbShowWindow();
+    /// Hides the KWBlackBoxWindow associated to the box (if exists)
+    void bbHideWindow();
+    /// Closes (destroys) the KWBlackBoxWindow associated to the box (if exists)
+    void bbCloseWindow();
+    //==================================================================
+
+  private:
+    /// friendship
+    friend class vtkKWBlackBoxWindow;
+    //    friend class KWBlackBoxWidgetEventHandler;
+
+    /// Sets the window
+    inline void bbSetWindow(Window* w) { bbmWindow=w; }
+
+    /*
+    /// Sets the Widget Event Handler
+    inline void bbSetWidgetEventHandler(KWBlackBoxWidgetEventHandler* w) 
+    { bbmWidgetEventHandler = w; }
+    /// Gets the Widget Event Handler
+    inline KWBlackBoxWidgetEventHandler* bbGetWidgetEventHandler()
+    { return bbmWidgetEventHandler; }
+    */
+
+    /// The KWBlackBoxWindow associated to the box
+    Window* bbmWindow;
+    /// The KWBlackBoxWidgetEventHandler associated to the box
+    //    KWBlackBoxWidgetEventHandler* bbmWidgetEventHandler;
+
+
+    void bbInitAttributes();
+
+  protected :
+
+
+    /// For Forward update mechanism when execution is called 
+    /// on a contained window
+    /// Is set to true before transfering update to parent 
+    /// in order to not re-transfer a second time...
+    bool bbmUpdateTransferedToParent;
+
+    bool bbGetUpdateTransferedToParent() const { return bbmUpdateTransferedToParent; }
+    void bbSetUpdateTransferedToParent(bool b) 
+    { bbmUpdateTransferedToParent = b; }
+
+  };
+  //=================================================================
+
+  //======================================================================
+  /// Defines the bbUserCreateWidget method
+#define BBTK_CREATE_KWWIDGET(CALLBACK)                                 \
+  public:                                                              \
+  inline void bbUserCreateWidget(vtkKWWidget* parent)                  \
+  {                                                                    \
+    bbtkDebugMessageInc("kw",1,"**> Creating widget for ["             \
+                       <<bbGetFullName()<<"]"<<std::endl);             \
+    CALLBACK(parent);                                                  \
+    bbtkDebugMessageInc("kw",1,"<** Creating widget for ["             \
+                       <<bbGetFullName()<<"]"<<std::endl);             \
+  }
+  
+  //======================================================================
+
+  //======================================================================
+  /// Defines the bbUserOnShow method
+#define BBTK_ON_SHOW_WIDGET(CALLBACK)                                  \
+  public:                                                              \
+  inline void bbUserOnShow()                                   \
+  {                                                                    \
+    bbtkDebugMessageInc("wx",1,"**> Showing ["         \
+                       <<bbGetFullName()<<"]"<<std::endl);             \
+    CALLBACK();                                                                \
+    bbtkDebugMessageInc("wx",1,"<** Showing ["         \
+                       <<bbGetFullName()<<"]"<<std::endl);             \
+  }
+  
+  //======================================================================
+
+  //=================================================================
+  // KWBlackBoxDescriptor declaration
+  BBTK_BEGIN_DESCRIBE_BLACK_BOX(KWBlackBox,bbtk::AtomicBlackBox);
+  BBTK_NAME("KWBlackBox");
+  // BBTK_DESCRIPTION("Widget box. The inputs marked with (*) are only used if the widget is not inserted in another widget.\n");
+  BBTK_CATEGORY("widget");
+  BBTK_INPUT(KWBlackBox,WinTitle,
+            "Title of the window (*)",
+            std::string,"");
+  BBTK_INPUT(KWBlackBox,WinWidth,
+            "Width of the window (* : only used if the widget is not connected to a Layout box)",int,"");
+  BBTK_INPUT(KWBlackBox,WinHeight,
+            "Height of the window (*)",int,"");
+  BBTK_INPUT(KWBlackBox,WinDialog,
+            "Set to 'true' to create a dialog window, i.e. which blocks the pipeline until it is closed (modal) (*)",bool,"");
+  BBTK_INPUT(KWBlackBox,WinHide,
+            "Any signal received hides the window (*)",Void,"signal");
+  BBTK_INPUT(KWBlackBox,WinClose,
+            "Any signal received closes the window (*)",Void,"signal");
+  BBTK_OUTPUT(KWBlackBox,Widget,"Output widget",vtkKWWidget*,"");
+  BBTK_END_DESCRIBE_BLACK_BOX(KWBlackBox);
+  //=================================================================
+
+
+
+
+
+
+
+
+
+  //==================================================================
+  // The base of the hierarchy of windows associated to a KWBlackBox
+  class BBTK_EXPORT vtkKWBlackBoxWindow 
+  {
+  public:
+    vtkKWBlackBoxWindow();
+    virtual ~vtkKWBlackBoxWindow();
+    virtual void bbShow();
+    virtual void bbHide();
+    virtual void bbClose();
+    bool bbIsShown() { return mShown; }
+    void bbSetBlackBox(KWBlackBox::Pointer box) 
+    { 
+      mBox = box; 
+      mBox.lock()->bbSetWindow(this);
+    }
+    virtual KWBlackBox::Pointer bbGetBlackBox() { return mBox.lock(); }
+  private:
+    KWBlackBox::WeakPointer mBox;
+    bool mShown;
+  };
+  //==================================================================
+
+
+  //==================================================================
+  // Dialog window which is modal
+  // Name of window must not begin with uppercase letter 
+  class BBTK_EXPORT  vtkKWBlackBoxDialog : public vtkKWDialog, 
+                                       public vtkKWBlackBoxWindow
+  {
+  public:
+    static vtkKWBlackBoxDialog* New();
+    vtkTypeRevisionMacro(vtkKWBlackBoxDialog,vtkKWDialog);
+    void bbShow();  
+    void bbHide();
+    void bbClose();
+    void Cancel();
+  protected:
+    vtkKWBlackBoxDialog();
+    ~vtkKWBlackBoxDialog();
+  private:
+    vtkKWBlackBoxDialog(const vtkKWBlackBoxDialog&);   // Not implemented.
+    void operator=(const vtkKWBlackBoxDialog&);  // Not implemented.
+  };
+  //==================================================================
+
+  //==================================================================
+  // Frame window which is not modal
+  class BBTK_EXPORT  vtkKWBlackBoxFrame : public vtkKWWindowBase,
+                                      public vtkKWBlackBoxWindow
+  {
+  public:
+    static vtkKWBlackBoxFrame* New();
+    vtkTypeRevisionMacro(vtkKWBlackBoxFrame,vtkKWWindowBase);
+    void bbShow();  
+    void bbHide();
+    void bbClose();
+  protected:
+    vtkKWBlackBoxFrame();
+    ~vtkKWBlackBoxFrame();
+  private:
+    vtkKWBlackBoxFrame(const vtkKWBlackBoxFrame&);   // Not implemented.
+    void operator=(const vtkKWBlackBoxFrame&);  // Not implemented.
+  };
+  //==================================================================
+
+
+  /*
+  //=================================================================
+  // Handles the destroy events of a widget associated to a KWBlackBox 
+  // in order to signal the widget death to its associated box
+  class BBTK_EXPORT KWBlackBoxWidgetEventHandler : public wxEvtHandler
+  {
+  public:
+    /// Ctor with the box and widget 
+    KWBlackBoxWidgetEventHandler( KWBlackBox::Pointer box, wxWindow *widget );
+    /// Dtor
+    ~KWBlackBoxWidgetEventHandler();
+    /// Returns true iff is the handler for that window  
+    bool IsHandlerOf( wxWindow* w ) { return mWindow == w; }
+    // wxWindow* GetKWWindow() { return mWindow; }
+    /// Method processing the destroy event of the widget
+    void OnWindowDestroy(wxWindowDestroyEvent&);
+    //
+    //bool IsDead() { return mDead; }
+
+  private:
+    KWBlackBox::WeakPointer mBox;
+    wxWindow* mWindow;
+    //bool mDead;
+  };  
+  //=================================================================
+  */
+
+
+} //namespace bbtk
+
+
+
+#endif  // USE_KWWIDGETS
+#endif  //__bbtkKWBlackBox_h__
index bfed13a58aaedc77471dd869cd49f0011ed5af0d..d3333d947ac1eb80209fbd176d5fde157baa957e 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkMessageManager.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/10/17 08:18:13 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2008/11/29 21:41:34 $
+  Version:   $Revision: 1.13 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -129,7 +129,7 @@ namespace bbtk
     return m; 
   }
 
-  void MessageManager::RegisterMessageType(std::string key, 
+  bool MessageManager::RegisterMessageType(std::string key, 
                                                  std::string help,
                                                  unsigned char default_level) 
   {
@@ -137,7 +137,9 @@ namespace bbtk
     GetInstance()->mMessageHelp[key] = help;
     if (GetInstance()->mMaxMessageLength<key.length()) 
       GetInstance()->mMaxMessageLength = key.length();
+    return true;
   }
+  
 
 
 
index 73468feb25f84246e4c947832fb85654551601be..289f9ebbbdf9718f0662a3a3f7abe81aabc4199c 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkMessageManager.h,v $
   Language:  C++
-  Date:      $Date: 2008/10/17 08:18:13 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2008/11/29 21:41:34 $
+  Version:   $Revision: 1.8 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -418,7 +418,7 @@ namespace bbtk
     ///
     static MessageManager* GetInstance();
     ///
-    static void RegisterMessageType(std::string key, 
+    static bool RegisterMessageType(std::string key, 
                                     std::string help,
                                     unsigned char default_level = 9);
     ///
index 29fb2ea2d688668ca2983a6ef7ec097ecbb1409b..9acfe1b7babf4c6a960a601b1ac110a55efba04d 100644 (file)
@@ -8,7 +8,9 @@ SUBDIRS(toolsbbtk)
 SUBDIRS(wxvtk)
 SUBDIRS(itkvtk)
 SUBDIRS(demo)
-#SUBDIRS(creaReaders)
+IF(BBTK_USE_KWWIDGETS)
+  SUBDIRS(kw)
+ENDIF(BBTK_USE_KWWIDGETS)
 #-----------------------------------------------------------------------------
 
 
diff --git a/packages/kw/CMakeLists.txt b/packages/kw/CMakeLists.txt
new file mode 100644 (file)
index 0000000..35ded51
--- /dev/null
@@ -0,0 +1,152 @@
+#===========================================================================
+# CMAKE SETTINGS FOR BUILDING A BBTK PACKAGE
+#===========================================================================
+
+#===========================================================================
+# THE NAME OF THE BBTK PACKAGE
+SET(BBTK_PACKAGE_NAME kw)
+#===========================================================================
+
+
+
+#===========================================================================
+# IF IT IS A STANDALONE PROJECT UNCOMMENT NEXT LINE TO DECLARE YOUR PROJECT
+# PROJECT(bb${BBTK_PACKAGE_NAME})
+#===========================================================================
+
+#===========================================================================
+# PACKAGE AUTHOR
+# !!! NO COMMA ALLOWED !!!
+SET(${BBTK_PACKAGE_NAME}_AUTHOR "laurent.guigues@creatis.insa-lyon")
+#===========================================================================
+
+#===========================================================================
+# PACKAGE DESCRIPTION
+SET(${BBTK_PACKAGE_NAME}_DESCRIPTION "KWWidgets")
+#===========================================================================
+
+#===========================================================================
+# PACKAGE VERSION NUMBER 
+SET(${BBTK_PACKAGE_NAME}_MAJOR_VERSION 1)
+SET(${BBTK_PACKAGE_NAME}_MINOR_VERSION 0)
+SET(${BBTK_PACKAGE_NAME}_BUILD_VERSION 0)
+#===========================================================================
+
+
+#===========================================================================
+# UNCOMMENT EACH LIBRARY NEEDED (WILL BE FOUND AND USED AUTOMATICALLY)
+# SET(${BBTK_PACKAGE_NAME}_USE_VTK  ON)
+# SET(${BBTK_PACKAGE_NAME}_USE_ITK  ON)
+# SET(${BBTK_PACKAGE_NAME}_USE_GDCM ON)
+# SET(${BBTK_PACKAGE_NAME}_USE_GSMIS ON)
+# SET(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS ON)
+#===========================================================================
+
+#===========================================================================
+# LIST HERE THE OTHER bbtk PACKAGES NEEDED
+# (WILL BE FOUND AND USED AUTOMATICALLY)
+SET(${BBTK_PACKAGE_NAME}_USE_PACKAGES 
+  # std
+  # wx
+  # itk
+  # vtk
+  # ...
+  )
+#===========================================================================
+
+#===========================================================================
+# THE SOURCES OF THE PACKAGE
+# EITHER UNCOMMENT NEXT LINE TO COMPILE ALL .cxx OF THE src DIRECTORY :
+SET(${BBTK_PACKAGE_NAME}_COMPILE_ALL_CXX ON)
+# ... OR LIST THE FILES TO COMPILE MANUALLY :
+#SET(${BBTK_PACKAGE_NAME}_SOURCES
+# LIST HERE THE FILES TO COMPILE TO BUILD THE LIB
+# E.G. TO COMPILE "toto.cxx" ADD "toto" (NO EXTENSION)
+# THE PATH MUST BE RELATIVE TO THE src FOLDER
+#    )
+#===========================================================================
+
+#===========================================================================
+# THE xml SOURCES OF THE PACKAGE
+# EITHER UNCOMMENT NEXT LINE TO bbfy ALL .xml OF THE src DIRECTORY :
+SET(${BBTK_PACKAGE_NAME}_COMPILE_ALL_XML ON)
+# ... OR LIST THE FILES TO COMPILE MANUALLY :
+#SET(${BBTK_PACKAGE_NAME}_XML_SOURCES
+# LIST HERE THE FILES TO bbfy TO BUILD THE LIB
+# E.G. TO bbfy "toto.xml" ADD "toto" (NO EXTENSION)
+# THE PATH MUST BE RELATIVE TO THE src FOLDER
+#    )
+#===========================================================================
+
+#===========================================================================
+# THE SCRIPT-DEFINED BOXES OF THE PACKAGE (bbs)
+# EITHER UNCOMMENT NEXT LINE TO INCLUDE ALL .bbs OF THE bbs/boxes DIRECTORY :
+SET(${BBTK_PACKAGE_NAME}_INCLUDE_ALL_BBS_BOXES ON)
+# ... OR LIST THE FILES TO INCLUDE MANUALLY :
+# SET(${BBTK_PACKAGE_NAME}_BBS_BOXES
+# LIST HERE THE bbs FILES TO INCLUDE 
+# E.G. TO INCLUDE "boxes/bbtoto.bbs" ADD "boxes/bbtoto" (NO EXTENSION)
+# !! THE PATH MUST BE RELATIVE TO THE bbs FOLDER !!
+#)
+#===========================================================================
+
+#===========================================================================
+# THE SCRIPT-DEFINED APPLICATIONS OF THE PACKAGE (bbs)
+# EITHER UNCOMMENT NEXT LINE TO INCLUDE ALL .bbs OF THE bbs/appli DIRECTORY :
+SET(${BBTK_PACKAGE_NAME}_INCLUDE_ALL_BBS_APPLI ON)
+# ... OR LIST THE FILES TO INCLUDE MANUALLY :
+# SET(${BBTK_PACKAGE_NAME}_BBS_APPLI
+# LIST HERE THE bbs FILES TO INCLUDE 
+# E.G. TO INCLUDE "appli/testToto.bbs" ADD "appli/testToto" (NO EXTENSION)
+# !! THE PATH MUST BE RELATIVE TO THE bbs FOLDER !!
+#)
+#===========================================================================
+
+#===========================================================================
+SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS
+  # LIST HERE YOUR ADDITIONAL INCLUDE DIRECTORIES 
+  # EXCEPT :
+  #  - src
+  #  - bbtk dirs
+  #  - automatically handled libraries or packages : wx, vtk... (see above)
+  #  - the dirs automatically set by other libraries found by FIND_PACKAGE
+  )
+#===========================================================================
+
+#===========================================================================
+SET(${BBTK_PACKAGE_NAME}_LIBS 
+  # LIST HERE THE ADDITIONAL LIBS TO LINK AGAINST
+  # EXCEPT : the same libs than for INCLUDE_DIRS 
+  )
+#===========================================================================
+
+
+#===========================================================================
+# IF NEEDED : UNCOMMENT NEXT LINE 
+# AND LIST ADDITIONNAL DIRECTORIES 
+# IN WHICH TO LOOK FOR LIBRARIES TO LINK AGAINST
+# LINK_DIRECTORIES()
+#===========================================================================
+
+#===========================================================================
+# SET TO TRUE TO HAVE INFORMATION ON LIBRARIES FOUND DURING CMAKE CONFIGURE
+SET(FIND_PACKAGE_VERBOSE TRUE)
+#===========================================================================
+
+#===========================================================================
+# END OF USER SECTION
+#===========================================================================
+
+
+
+
+
+#===========================================================================
+# Include configuration script
+INCLUDE(Configure.cmake)
+#===========================================================================
+
+#===========================================================================
+# EOF
+#===========================================================================
+
diff --git a/packages/kw/Configure.cmake b/packages/kw/Configure.cmake
new file mode 100644 (file)
index 0000000..946aaf6
--- /dev/null
@@ -0,0 +1,73 @@
+#-----------------------------------------------------------------------------
+# DOES THE USER WANT TO BUILD THE PACKAGE ?
+OPTION(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME} 
+  "Build the bbtk package ${BBTK_PACKAGE_NAME} ?" OFF)
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+IF(BBTK_CORE_PACKAGE)
+  IF(NOT ${BBTK_PACKAGE_NAME}_EXCLUDE_FROM_BUILD_ALL)
+    SWITCH_ON_IF_BUILD_ALL(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
+  ENDIF(NOT ${BBTK_PACKAGE_NAME}_EXCLUDE_FROM_BUILD_ALL)
+ENDIF(BBTK_CORE_PACKAGE)
+#-----------------------------------------------------------------------------
+
+
+#-----------------------------------------------------------------------------
+# IF THE USER HAS CHOSEN TO BUILD THE PACKAGE
+IF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
+  #---------------------------------------------------------------------------
+  
+  #===========================================================================
+  # If the package is not a "core" bbtk package (included into the toolkit)
+  # then we have to find (and use) bbtk 
+  IF(NOT BBTK_CORE_PACKAGE)
+    #-------------------------------------------------------------------------
+    # Find and use the Black Box Toolkit
+    # Search BBTK
+    FIND_PACKAGE(BBTK)
+    # If bbtk found
+    IF(BBTK_FOUND)
+      INCLUDE(${BBTK_USE_FILE})
+      SET(BBTK_PACKAGE_LIBS 
+       ${BBTK_PACKAGE_LIBS}
+       ${BBTK_LIBRARIES})
+      MARK_AS_ADVANCED(BBTK_DIR)
+    ENDIF(BBTK_FOUND)
+  ENDIF(NOT BBTK_CORE_PACKAGE)
+    
+  #===========================================================================
+  # Include package configuration cmake script from bbtk dir
+  INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage.cmake)
+  #===========================================================================
+  
+  
+  #---------------------------------------------------------------------------
+ELSE(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
+  #-------------------------------------------------------------------------
+  
+  #-----------------------------------------------------------------------
+  IF(BBTK_CORE_PACKAGE)
+    #-----------------------------------------------------------------------
+    # If package deps in global deps : reset global deps
+    IF(${BBTK_PACKAGE_NAME}_IN_DEPS)
+      SET(BBTK_PACKAGES_DEPS "" CACHE INTERNAL 
+       "bbtk packages dependencies" FORCE)
+      #    STRING(REPLACE "${${BBTK_PACKAGE_NAME}_DEPS};"
+      #      "" TEMP
+      #      ${BBTK_PACKAGES_DEPS})
+      #    
+      #    SET(BBTK_PACKAGES_DEPS ${TEMP}
+      #      CACHE INTERNAL "bbtk packages dependencies" FORCE)
+    ENDIF(${BBTK_PACKAGE_NAME}_IN_DEPS)
+    #-----------------------------------------------------------------------
+    
+    #-----------------------------------------------------------------------
+    # Remove the package include scripts to avoid loading it by include * 
+    FILE(REMOVE ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}.bbs)
+    FILE(REMOVE ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}-appli.bbs)
+    #-----------------------------------------------------------------------
+  ENDIF(BBTK_CORE_PACKAGE)
+  
+  #-------------------------------------------------------------------------
+ENDIF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
diff --git a/packages/kw/PackageConfig.cmake.in b/packages/kw/PackageConfig.cmake.in
new file mode 100644 (file)
index 0000000..0ade94b
--- /dev/null
@@ -0,0 +1,27 @@
+#========================================================================
+# BBTK package configuration 
+# ** DO NOT REMOVE **
+SET(BBTK_PACKAGE_NAME                 @BBTK_PACKAGE_NAME@)
+SET(@BBTK_PACKAGE_NAME@_USE_VTK       @BBTK_PACKAGE_USE_VTK@)
+SET(@BBTK_PACKAGE_NAME@_USE_ITK       @BBTK_PACKAGE_USE_ITK@)
+SET(@BBTK_PACKAGE_NAME@_USE_GDCM      @BBTK_PACKAGE_USE_GDCM@)
+SET(@BBTK_PACKAGE_NAME@_USE_GSMIS     @BBTK_PACKAGE_USE_GSMIS@)
+SET(@BBTK_PACKAGE_NAME@_USE_WXWIDGETS @BBTK_PACKAGE_USE_WXWIDGETS@)
+SET(@BBTK_PACKAGE_NAME@_USE_PACKAGES  @BBTK_PACKAGE_USE_PACKAGES@)
+SET(@BBTK_PACKAGE_NAME@_AUTHOR        "@BBTK_PACKAGE_AUTHOR@") 
+SET(@BBTK_PACKAGE_NAME@_DESCRIPTION   "@BBTK_PACKAGE_DESCRIPTION@")
+SET(@BBTK_PACKAGE_NAME@_MAJOR_VERSION @BBTK_PACKAGE_MAJOR_VERSION@)
+SET(@BBTK_PACKAGE_NAME@_MINOR_VERSION @BBTK_PACKAGE_MINOR_VERSION@) 
+SET(@BBTK_PACKAGE_NAME@_BUILD_VERSION @BBTK_PACKAGE_BUILD_VERSION@)
+SET(@BBTK_PACKAGE_NAME@_INCLUDE_DIRS  @BBTK_PACKAGE_INCLUDE_DIRS@)
+SET(@BBTK_PACKAGE_NAME@_LIBS          @BBTK_PACKAGE_LIBS@)
+# A BBTK PACKAGE NEEDS BBTK
+FIND_PACKAGE(BBTK REQUIRED)
+# BBTK Package configuration file inclusion
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_PackageConfig.cmake)
+# End of BBTK package configuration 
+#========================================================================
+
+#========================================================================
+# INSERT YOUR CUSTOM CONFIG HERE 
+#========================================================================
diff --git a/packages/kw/UsePackage.cmake.in b/packages/kw/UsePackage.cmake.in
new file mode 100644 (file)
index 0000000..2ecb206
--- /dev/null
@@ -0,0 +1,4 @@
+# DO NOT REMOVE :
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_UsePackage.cmake)
+
+# INSERT YOUR CUSTOM USE HERE 
diff --git a/packages/kw/bbs/CMakeLists.txt b/packages/kw/bbs/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2c0eb7c
--- /dev/null
@@ -0,0 +1,4 @@
+
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_bbs.cmake)
+
+
diff --git a/packages/kw/bbs/appli/exampleSlider.bbs b/packages/kw/bbs/appli/exampleSlider.bbs
new file mode 100644 (file)
index 0000000..11ea4ed
--- /dev/null
@@ -0,0 +1,4 @@
+load kw
+new Slider s
+exec s
+unload kw
diff --git a/packages/kw/data/CMakeLists.txt b/packages/kw/data/CMakeLists.txt
new file mode 100644 (file)
index 0000000..eb2556d
--- /dev/null
@@ -0,0 +1,4 @@
+#===========================================================================
+# Include package data configuration cmake script from bbtk dir
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_data.cmake)
+#===========================================================================
diff --git a/packages/kw/doc/CMakeLists.txt b/packages/kw/doc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..033496e
--- /dev/null
@@ -0,0 +1,5 @@
+#===========================================================================
+# Include package doc configuration cmake script
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_doc.cmake)
+#===========================================================================
+
diff --git a/packages/kw/doc/bbdoc/CMakeLists.txt b/packages/kw/doc/bbdoc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..86ca574
--- /dev/null
@@ -0,0 +1,2 @@
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_doc_bbdoc.cmake)
+
diff --git a/packages/kw/doc/bbdoc/header.html.in b/packages/kw/doc/bbdoc/header.html.in
new file mode 100644 (file)
index 0000000..28c72c2
--- /dev/null
@@ -0,0 +1,12 @@
+
+<h1>bbtk package <b>@BBTK_PACKAGE_NAME@</b></h1>
+
+<p>
+Version <b>@BBTK_PACKAGE_MAJOR_VERSION@.@BBTK_PACKAGE_MINOR_VERSION@.@BBTK_PACKAGE_BUILD_VERSION@</b> - 
+by <b>@BBTK_PACKAGE_AUTHOR@</b>
+
+<p>
+@BBTK_PACKAGE_DESCRIPTION@
+
+<p>
+ <a href="../../doxygen/@BBTK_PACKAGE_NAME@/index.html">Doxygen documentation</a> of the source code
diff --git a/packages/kw/doc/doxygen/CMakeLists.txt b/packages/kw/doc/doxygen/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0194111
--- /dev/null
@@ -0,0 +1 @@
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_doc_doxygen.cmake)
diff --git a/packages/kw/doc/doxygen/DoxyMainPage.txt.in b/packages/kw/doc/doxygen/DoxyMainPage.txt.in
new file mode 100644 (file)
index 0000000..9909a5c
--- /dev/null
@@ -0,0 +1,14 @@
+/**
+ * \mainpage bbtk package @BBTK_PACKAGE_NAME@
+
+\htmlonly 
+
+<p>Version 
+<b>@BBTK_PACKAGE_MAJOR_VERSION@.@BBTK_PACKAGE_MINOR_VERSION@.@BBTK_PACKAGE_BUILD_VERSION@</b> - 
+by <b>@BBTK_PACKAGE_AUTHOR@</b>
+<p>
+@BBTK_PACKAGE_DESCRIPTION@
+
+\endhtmlonly
+
+ */
diff --git a/packages/kw/doc/doxygen/Doxyfile.txt.in b/packages/kw/doc/doxygen/Doxyfile.txt.in
new file mode 100644 (file)
index 0000000..6b4211a
--- /dev/null
@@ -0,0 +1,764 @@
+# Doxyfile 1.2.14
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+PROJECT_NAME           = @DOXYGEN_PROJECT_NAME@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+PROJECT_NUMBER         = @PROJECT_VERSION@
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+OUTPUT_DIRECTORY       = @DOXYGEN_OUTPUT@
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, 
+# German, Greek, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, 
+# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish.
+OUTPUT_LANGUAGE        = English
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+EXTRACT_LOCAL_CLASSES  = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these class will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+HIDE_UNDOC_CLASSES     = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+REPEAT_BRIEF           = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited 
+# members of a class in the documentation of that class as if those members were 
+# ordinary class members. Constructors, destructors and assignment operators of 
+# the base classes will not be shown.
+INLINE_INHERITED_MEMB  = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. It is allowed to use relative paths in the argument list.
+STRIP_FROM_PATH        = 
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+INTERNAL_DOCS          = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+STRIP_CODE_COMMENTS    = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower case letters. If set to YES upper case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# users are adviced to set this option to NO.
+CASE_SENSE_NAMES       = YES
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+SHORT_NAMES            = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+HIDE_SCOPE_NAMES       = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+VERBATIM_HEADERS       = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put list of the files that are included by a file in the documentation 
+# of that file.
+SHOW_INCLUDE_FILES     = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments  will behave just like the Qt-style comments (thus requiring an 
+# explict @brief command for a brief description.
+JAVADOC_AUTOBRIEF      = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# reimplements.
+INHERIT_DOCS           = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+SORT_MEMBER_DOCS       = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+DISTRIBUTE_GROUP_DOC   = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+TAB_SIZE               = 8
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+GENERATE_BUGLIST       = YES
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+ALIASES                = 
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consist of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+MAX_INITIALIZER_LINES  = 30
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources 
+# only. Doxygen will then generate output that is more tailored for C. 
+# For instance some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+SHOW_USED_FILES        = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+QUIET                  = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, then doxygen will generate warnings 
+# for error documented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+WARN_IF_DOC_ERROR      = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text.
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+WARN_LOGFILE           = @DOXYGEN_LOGFILE@
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+INPUT                  = @DOXYGEN_INPUT@
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp 
+# *.h++ *.idl *.odl
+FILE_PATTERNS          = *.h *.cxx *.txx
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+EXCLUDE                = @DOXYGEN_EXCLUDE@
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories 
+# that are symbolic links (a Unix filesystem feature) are excluded from the input.
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories.
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+EXAMPLE_PATTERNS       = *.cxx
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.
+INPUT_FILTER           = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse.
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources.
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+INLINE_SOURCES         = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+REFERENCES_RELATION    = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+COLS_IN_ALPHA_INDEX    = 3
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+HTML_OUTPUT            = @DOXYGEN_HTML_OUTPUT@
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the Html help documentation and to the tree view.
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+, 
+# or Internet explorer 4.0+). Note that for large projects the tree generation 
+# can take a very long time. In such cases it is better to disable this feature. 
+# Windows users are probably better off using the HTML help feature.
+GENERATE_TREEVIEW      = YES
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+LATEX_OUTPUT           = latex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+LATEX_BATCHMODE        = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimised for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assigments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+GENERATE_XML           = NO
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+MACRO_EXPANSION        = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed.
+PREDEFINED             = @DOXYGEN_DOC_PREDEFINED@
+                        
+
+# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line and do not end with a semicolon. Such function macros are typically 
+# used for boiler-plate code, and will confuse the parser if not removed.
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles.
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or 
+# super classes. Setting the tag to NO turns the diagrams off. Note that this 
+# option is superceded by the HAVE_DOT option below. This is only a fallback. It is 
+# recommended to install and use dot, since it yield more powerful graphs.
+CLASS_DIAGRAMS         = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+HAVE_DOT               = @DOXYGEN_HAVE_DOT@
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+COLLABORATION_GRAPH    = YES
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+TEMPLATE_RELATIONS     = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+HIDE_UNDOC_RELATIONS   = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+INCLUDED_BY_GRAPH      = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+GRAPHICAL_HIERARCHY    = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are gif, jpg, and png
+# If left blank gif will be used.
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found on the path.
+DOT_PATH               = "@DOXYGEN_DOT_PATH@"
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermedate dot files that are used to generate 
+# the various graphs.
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+SEARCHENGINE           = NO
diff --git a/packages/kw/src/CMakeLists.txt b/packages/kw/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e2d2a11
--- /dev/null
@@ -0,0 +1,5 @@
+#---------------------------------------------------------------------------
+# Include src configuration cmake script
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_src.cmake)
+#---------------------------------------------------------------------------
+
diff --git a/packages/kw/src/bbkwLayoutSplit.cxx b/packages/kw/src/bbkwLayoutSplit.cxx
new file mode 100644 (file)
index 0000000..243b53e
--- /dev/null
@@ -0,0 +1,158 @@
+/*=========================================================================                                                                               
+  Program:   bbtk
+  Module:    $RCSfile: bbkwLayoutSplit.cxx,v $
+  Language:  C++
+  Date:      $Date: 2008/11/29 21:41:58 $
+  Version:   $Revision: 1.1 $
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+/**
+ *  \file
+ *  \brief
+ */
+
+
+#ifdef USE_KWWIDGETS
+
+#include "bbkwLayoutSplit.h"
+#include "bbkwPackage.h"
+#include "bbtkUtilities.h"
+
+#include <vtkKWSplitFrame.h>
+
+namespace bbkw
+{
+  BBTK_ADD_BLACK_BOX_TO_PACKAGE(kw,LayoutSplit);
+  BBTK_BLACK_BOX_IMPLEMENTATION(LayoutSplit,bbtk::KWBlackBox);
+
+  void LayoutSplit::bbUserConstructor()
+  {
+    bbSetInputOrientation("VERTICAL");
+    bbSetInputProportion(50);
+    bbSetInputWidget1(NULL);
+    bbSetInputWidget2(NULL);
+  }
+
+  void LayoutSplit::Process()
+  {
+  }
+
+
+  void LayoutSplit::CreateWidget(vtkKWWidget* parent) 
+  {
+    vtkKWSplitFrame *splitframe = vtkKWSplitFrame::New();
+    bbSetOutputWidget(splitframe);
+    splitframe->SetParent(parent);
+    splitframe->Create();
+
+    splitframe->SetFrame1MinimumSize(5);
+    splitframe->SetFrame2MinimumSize(5);
+
+    splitframe->GetApplication()->Script("pack %s -side left -anchor c -expand y",
+                                        splitframe->GetWidgetName());
+    /*
+    splitframe->SetParent(parent);
+    splitframe->Create();
+    splitframe->SetWidth(400);
+    splitframe->SetHeight(200);
+    splitframe->SetReliefToGroove();
+    splitframe->SetBorderWidth(2);
+    splitframe->SetExpandableFrameToBothFrames();
+
+    w->SetName( bbtk::std2kw( bbGetInputWinTitle() ) );
+    */
+    bbCreateWidgetOfInput("Widget1",splitframe);
+    bbCreateWidgetOfInput("Widget2",splitframe);
+    /*
+    vtkKWWidget* w1 = bbGetInputWidget1();
+    if (w1) 
+      { 
+       w1->SetParent(splitframe);
+       w1->Create();
+      }
+    vtkKWWidget* w2 = bbGetInputWidget2();
+    if (w2) 
+      {
+       w2->SetParent(splitframe);
+       w2->Create();
+      }
+    */
+
+    /*   
+         int orientation=0;
+    if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)  { orientation=0; }
+    if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)       { orientation=1; }
+    
+
+         if (orientation==1) { w->SplitHorizontally( w1, w2, 100); }
+    else                { w->SplitVertically( w1, w2, 100);   }
+  
+    bbSetOutputWidget( w );
+    */
+  }
+
+
+  // This callback is necessary to get actual processing of the view 
+  // when window is shown
+  /*
+  void  LayoutSplit::OnShowWidget()
+  {
+    if (bbGetOutputWidget()==0)
+      {
+       return;
+       //bbtkError("LayoutSplit::OnShowWidget() : Output Widget == 0 !");
+      }
+    kwSplitterWindow* win = (kwSplitterWindow*)bbGetOutputWidget();
+    int w,h;
+    if (win==0)
+      {
+       return;
+       //      bbtkError("LayoutSplit::OnShowWidget() : win == 0 !");
+      }
+    win->GetClientSize(&w,&h);
+    int pos = 100;
+    if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
+                                   "0|H|HORIZONTAL")==true)  
+      { 
+       pos = (int)(w * bbGetInputProportion() * 0.01);
+      }
+    else 
+      {
+       pos = (int)(h * bbGetInputProportion() * 0.01);
+      } 
+    //    std::cout << "pos = "<<pos<<std::endl;
+  
+    win->SetSashPosition(pos,true);
+    bbUserOnShowWidget("Widget1");
+    bbUserOnShowWidget("Widget2");
+  }
+  */
+
+
+
+}//namespace bbkw
+
+#endif // _USE_KWWIDGETS_
+
diff --git a/packages/kw/src/bbkwLayoutSplit.h b/packages/kw/src/bbkwLayoutSplit.h
new file mode 100644 (file)
index 0000000..234afb0
--- /dev/null
@@ -0,0 +1,95 @@
+/*=========================================================================                                                                               
+  Program:   bbtk
+  Module:    $RCSfile: bbkwLayoutSplit.h,v $
+  Language:  C++
+  Date:      $Date: 2008/11/29 21:41:58 $
+  Version:   $Revision: 1.1 $
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+
+/**
+ */
+/**
+ * \file 
+ * \brief Widget which splits a window into two parts 
+ */
+/**
+ * \class bbkw::LayoutSplit
+ * \brief Widget which splits a window into two parts 
+ */
+
+
+#ifdef USE_KWWIDGETS
+
+
+#ifndef __bbKwLayoutSplit_h__
+#define __bbKwLayoutSplit_h__
+
+#include "bbtkKWBlackBox.h"
+
+namespace bbkw
+{
+  
+  
+  
+  
+  class LayoutSplit : public bbtk::KWBlackBox
+  {
+    
+    BBTK_BLACK_BOX_INTERFACE(LayoutSplit,bbtk::KWBlackBox);
+    BBTK_DECLARE_INPUT(Widget1,vtkKWWidget*);
+    BBTK_DECLARE_INPUT(Widget2,vtkKWWidget*);
+    BBTK_DECLARE_INPUT(Orientation,std::string);
+    BBTK_DECLARE_INPUT(Proportion,int);
+    BBTK_PROCESS(Process);
+    BBTK_CREATE_KWWIDGET(CreateWidget);
+   void CreateWidget(vtkKWWidget*);
+
+    void Process();
+  protected:
+    virtual void bbUserConstructor();
+
+  };
+  
+//=================================================================
+// BlackBox description
+  BBTK_BEGIN_DESCRIBE_BLACK_BOX(LayoutSplit,bbtk::KWBlackBox);
+  BBTK_NAME("LayoutSplit");
+  BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
+  BBTK_DESCRIPTION("Widget which splits a window in two fixed size parts (vtkKWSplitFrame)");
+  // Already inserted for any KwBlackBox  BBTK_CATEGORY("widget");
+  BBTK_INPUT(LayoutSplit,Widget1,"Upper or left widget",vtkKWWidget*,"");
+  BBTK_INPUT(LayoutSplit,Widget2,"Lower or right widget",vtkKWWidget*,"");
+  BBTK_INPUT(LayoutSplit,Orientation,"Orientation (default H), 0=H=HORIZONTAL , 1=V=VERTICAL",std::string,"");
+   BBTK_INPUT(LayoutSplit,Proportion,"Proportion (in percent) of the first children in the window",int,"");
+  BBTK_END_DESCRIBE_BLACK_BOX(LayoutSplit);
+  //=================================================================
+}
+
+//namespace bbtk
+#endif  //__bbtkKwLayoutSplit_h__
+
+#endif //_USE_KWWIDGETS_
diff --git a/packages/kw/src/bbkwSlicer.cxx b/packages/kw/src/bbkwSlicer.cxx
new file mode 100644 (file)
index 0000000..d570549
--- /dev/null
@@ -0,0 +1,100 @@
+/*=========================================================================                                                                               
+  Program:   bbtk
+  Module:    $RCSfile: bbkwSlicer.cxx,v $
+  Language:  C++
+  Date:      $Date: 2008/11/29 21:41:58 $
+  Version:   $Revision: 1.1 $
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+/**
+ * \file 
+ * \brief Short description in one line
+ *
+ * Long 
+ * description
+ *  
+ */
+
+#ifdef USE_KWWIDGETS
+
+#include "bbkwSlicer.h"
+#include "bbkwPackage.h"
+#include "bbtkUtilities.h"
+
+#include "vtkKWSlicer.h"
+#include "vtkImageData.h"
+
+namespace bbkw
+{
+  
+  //--------------------------------------------------------------------------
+  //-------------------------------------------------------------------------
+  // KwBlackBox implementation
+  //--------------------------------------------------------------------------
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  BBTK_BLACK_BOX_IMPLEMENTATION(Slicer,bbtk::KWBlackBox);
+  BBTK_ADD_BLACK_BOX_TO_PACKAGE(kw,Slicer);
+  
+  //--------------------------------------------------------------------------
+  void Slicer::bbUserConstructor() 
+  { 
+    bbSetInputIn(0);
+    bbSetOutputWidget(0);
+  }
+  
+ //--------------------------------------------------------------------------
+  void Slicer::Process() 
+  {
+    vtkKWSlicer* s = (vtkKWSlicer*)bbGetOutputWidget();
+    if (s && bbGetInputIn()) 
+      {
+       s->SetImage(bbGetInputIn());
+      }
+  }
+  //--------------------------------------------------------------------------
+  void Slicer::CreateWidget(vtkKWWidget* parent) 
+  {
+    vtkKWSlicer* s = vtkKWSlicer::New();
+    bbSetOutputWidget(s);
+    s->SetParent(parent);
+    s->Create();
+    s->GetApplication()->Script("pack %s -side left -anchor c -expand y",
+                               s->GetWidgetName());
+
+    if (bbGetInputIn()) 
+      {
+       s->SetImage(bbGetInputIn());
+      }
+
+  }
+
+} //namespace bbkw
+
+#endif // USE_KWWIDGETS
+
+
diff --git a/packages/kw/src/bbkwSlicer.h b/packages/kw/src/bbkwSlicer.h
new file mode 100644 (file)
index 0000000..32fc4e9
--- /dev/null
@@ -0,0 +1,100 @@
+/*=========================================================================                                                                               
+  Program:   bbtk
+  Module:    $RCSfile: bbkwSlicer.h,v $
+  Language:  C++
+  Date:      $Date: 2008/11/29 21:41:58 $
+  Version:   $Revision: 1.1 $
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+/**
+ * \file 
+ * \brief Short description in one line
+ * 
+ * Long description which 
+ * can span multiple lines
+*/
+
+/**
+ * \class bbkw::Slicer
+ * \brief 
+
+ * \class bbkw::SlicerWidget
+ * \brief 
+ */
+
+#ifdef USE_KWWIDGETS
+
+// Prevents multiple inclusions : use symbols of the form
+// __FILENAME_INCLUDED__ 
+// where FILENAME must be replaced by the actual file name
+#ifndef __bbkwSlicer_h_INCLUDED__
+#define __bbkwSlicer_h_INCLUDED__
+
+// Include KWBlackBox definition
+#include "bbtkKWBlackBox.h"
+
+class vtkImageData;
+
+// Namespace of the package "kw" is "bbkw" 
+// Namespace associated to packages should be of the form :
+// bbPACKAGENAME
+namespace bbkw
+{
+  
+  
+  //------------------------------------------------------------------------
+  class /*BBTK_EXPORT*/ Slicer : public bbtk::KWBlackBox
+  {
+    
+    BBTK_BLACK_BOX_INTERFACE(Slicer,bbtk::KWBlackBox);
+    BBTK_DECLARE_INPUT(In,vtkImageData*);
+    BBTK_PROCESS(Process);
+    BBTK_CREATE_KWWIDGET(CreateWidget);
+    void Process();
+    void CreateWidget(vtkKWWidget*);
+
+  protected:
+    virtual void bbUserConstructor();
+  };
+  //=================================================================
+  //=================================================================
+  // the black box description
+  BBTK_BEGIN_DESCRIBE_BLACK_BOX(Slicer,bbtk::KWBlackBox);
+  BBTK_NAME("Slicer");
+  BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
+  // Already inserted for any KWBlackBox  BBTK_CATEGORY("widget");
+  BBTK_DESCRIPTION("Slicer widget (vtkKWSlicer)");
+  BBTK_INPUT(Slicer,In,"Image to display",vtkImageData*,"");
+  BBTK_END_DESCRIBE_BLACK_BOX(Slicer);
+  //=================================================================
+  
+
+
+} //namespace bbkw
+
+#endif  //__bbtkkwSlicer_h_INCLUDED__
+
+#endif // USE_KWWIDGETS
diff --git a/packages/kw/src/bbkwSlider.cxx b/packages/kw/src/bbkwSlider.cxx
new file mode 100644 (file)
index 0000000..41a8008
--- /dev/null
@@ -0,0 +1,408 @@
+/*=========================================================================                                                                               
+  Program:   bbtk
+  Module:    $RCSfile: bbkwSlider.cxx,v $
+  Language:  C++
+  Date:      $Date: 2008/11/29 21:41:58 $
+  Version:   $Revision: 1.1 $
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+/**
+ * \file 
+ * \brief Short description in one line
+ *
+ * Long 
+ * description
+ *  
+ */
+
+#ifdef USE_KWWIDGETS
+
+#include "bbkwSlider.h"
+#include "bbkwPackage.h"
+#include "bbtkUtilities.h"
+
+#include "vtkKWScale.h"
+
+namespace bbkw
+{
+  
+  /*
+  //-------------------------------------------------------------------------
+  SliderWidget::SliderWidget(Slider* box, kwWindow *parent,
+                            int orientation,
+                            bool changeresolution,
+                            bool labels,
+                            kwString title,
+                            int vmin,
+                            int vmax,
+                            int value,
+                             int reactiveontrack)
+    :  
+    kwPanel( parent, -1, kwDefaultPosition, kwDefaultSize, kwTAB_TRAVERSAL),
+    mBox(box),
+    min(vmin),
+    max(vmax),
+    reactiveOnTrack(reactiveontrack)
+  {
+    kwPanel * panel = this;
+    
+    label_min           = NULL;
+    label_max           = NULL;
+    label_vertical      = NULL;
+    mResolutionOfSlider        = NULL;
+
+    int sizeX,sizeY;
+    long kwlabels=0;
+    long kworientation=0;
+    if (orientation==0) 
+      {
+       sizeX                   = 2;
+       sizeY                   = 40;
+       kworientation   = kwSL_HORIZONTAL;
+       if (labels==true)
+         {
+           kwlabels = kwSL_LABELS;
+         }
+      } 
+    else 
+      {
+       sizeX                   = 20;
+       sizeY                   = 2;
+       kworientation   = kwSL_VERTICAL;
+      }
+    
+    //---------------------------------------------------------------------
+    // 1) Creation of the components of the widget
+    // Any top level sub-widget must have the panel returned by panel
+    // for parent
+    mkwSlider = new kwSlider( panel, 
+                             -1, 0 , 0, 500 , 
+                             kwDefaultPosition, 
+                             kwSize(sizeX,sizeY), 
+                             kworientation  | kwlabels );
+
+    //    mkwSlider->SetInitialSize(kwSize(sizeX,sizeY));
+
+    // mkwSlider->SetTickFreq(100,0);
+    mkwSlider->SetRange(min,max);
+    mkwSlider->SetValue(value);
+
+    //    RefreshLabels();
+
+    // Connecting events to callbacks
+    Connect( mkwSlider->GetId(), 
+            kwEVT_SCROLL_THUMBRELEASE, 
+
+            (kwObjectEventFunction) 
+            (void (kwPanel::*)(kwScrollEvent&))
+            &SliderWidget::OnSliderRelease ); 
+
+    Connect( mkwSlider->GetId(),  
+            kwEVT_SCROLL_THUMBTRACK, 
+
+            (kwObjectEventFunction) 
+            (void (kwPanel::*)(kwScrollEvent&))
+             &SliderWidget::OnSliderTrack ); 
+    
+    Connect( mkwSlider->GetId(),  
+            kwEVT_SCROLL_CHANGED, 
+
+            (kwObjectEventFunction) 
+            (void (kwPanel::*)(kwScrollEvent&))
+             &SliderWidget::OnSliderTrack );
+              
+    // If asked : creation of the other little slider which allows to change 
+    // the resolution of the main slider
+    if (changeresolution==true){
+      // has panel for parent too
+      mResolutionOfSlider = new kwSlider(panel,
+                                        -1,5,1,10,
+                                        kwDefaultPosition,
+                                        kwSize(25,45),
+                                        kwSL_VERTICAL | 
+                                        kwSL_AUTOTICKS |
+                                        kwSL_LEFT  );
+   
+
+      mResolutionOfSlider->SetRange(1,8);
+      mResolutionOfSlider->SetValue(5);
+      // Is kwEVT_COMMAND_SLIDER_UPDATED event 
+      // is connected to the method OnResolutionOfSlider
+      Connect(mResolutionOfSlider->GetId(),
+             kwEVT_COMMAND_SLIDER_UPDATED,
+             (kwObjectEventFunction) 
+             (void (kwPanel::*)(kwScrollEvent&))
+             &SliderWidget::OnResolutionOfSlider ); 
+    }
+    //---------------------------------------------------------------------
+
+    //---------------------------------------------------------------------
+    // 2) Insertion of the components in the window
+    
+    // We use a FlexGridSizer
+    kwFlexGridSizer *sizer;
+
+
+    if (orientation==0) 
+      {
+       // HORIZONTAL
+       if (mResolutionOfSlider!=NULL) 
+         {
+           sizer       = new kwFlexGridSizer(2);
+           if (title!=_T(""))
+             {
+               sizer   -> Add( new kwStaticText(panel,-1, title ) ); 
+               sizer   -> Add( new kwStaticText(panel,-1, _T("") ) ); 
+             }
+         } 
+       else 
+         {
+           sizer       = new kwFlexGridSizer(1);
+           if (title!=_T(""))
+             {
+               sizer   -> Add( new kwStaticText(panel,-1, title ) ); 
+             }
+         }
+       sizer   -> Add( mkwSlider,1,kwGROW ); 
+       sizer   -> AddGrowableCol(0);
+       if (mResolutionOfSlider!=NULL) 
+         {
+           sizer       -> Add( mResolutionOfSlider ); 
+         }
+      } 
+    else 
+      {
+       // VERTICAL 
+       sizer   = new kwFlexGridSizer(1);
+       if (labels==true)  // with lable
+         {
+           label_vertical = new kwStaticText(panel,-1,_T(""));
+           label_min = new kwStaticText(panel,-1,_T(""));
+           label_max = new kwStaticText(panel,-1,_T(""));
+           if (title!=_T(""))
+             {
+               sizer   -> Add( new kwStaticText(panel,-1, title ) );
+               sizer   -> AddGrowableRow(3);
+             } 
+           else 
+             {
+               sizer   -> AddGrowableRow(2);
+             }
+           sizer       -> Add( label_vertical );
+           sizer       -> Add( label_min );
+           sizer       -> Add( mkwSlider,1,kwGROW );
+           sizer       -> Add( label_max );
+           if (mResolutionOfSlider!=NULL) 
+             {
+               sizer   -> Add( mResolutionOfSlider ); 
+             }
+         } 
+       else 
+         {
+           if (title!=_T(""))
+             {
+               sizer   -> Add( new kwStaticText(panel,-1, title ) );
+               sizer   -> AddGrowableRow(1);
+             } 
+           else 
+             {
+               sizer   -> AddGrowableRow(0);
+             }
+           sizer       -> Add( mkwSlider,1,kwGROW );
+           if (mResolutionOfSlider!=NULL) 
+             {
+               sizer   -> Add( mResolutionOfSlider ); 
+             }
+         }
+      }
+    // Initialize the labels 
+    RefreshLabels();  
+    // Insert the sizer in the main panel and refresh the layout
+    panel->SetSizer(sizer);
+  }
+  //-------------------------------------------------------------------------
+  
+
+  //-------------------------------------------------------------------------
+  SliderWidget::~SliderWidget()
+  {
+  }
+  //-------------------------------------------------------------------------
+
+
+  //-------------------------------------------------------------------------
+  void SliderWidget::OnResolutionOfSlider(kwScrollEvent& event)
+  {
+    int value = mkwSlider->GetValue();
+    int delta = (int) (pow( 4 , mResolutionOfSlider->GetValue() ));
+    int minTmp   = value - delta/2;
+    int maxTmp   = value + delta/2;
+    if (minTmp<min)
+      {
+       minTmp = min;
+       //              maxTmp = delta;
+      }
+    if (maxTmp>max)
+      {
+       maxTmp = max;
+      }
+    mkwSlider->SetRange(minTmp,maxTmp);
+    RefreshLabels();
+  }
+  //-------------------------------------------------------------------------
+
+
+
+  //-------------------------------------------------------------------------
+  void SliderWidget::OnSliderTrack(kwScrollEvent& event)
+  {
+    if(reactiveOnTrack)
+    {
+    // When user releases the slider 
+    // we update the output of the box
+    
+    mBox->bbSetOutputOut( mkwSlider->GetValue() );
+    mBox->bbSetInputIn( mkwSlider->GetValue() );
+    // and signal that the output has changed
+    mBox->bbSignalOutputModification("Out");    
+    }
+    RefreshLabels();
+  }
+  //-------------------------------------------------------------------------
+
+
+  //-------------------------------------------------------------------------
+  void SliderWidget::OnSliderRelease(kwScrollEvent& event)
+  {
+    // When user releases the slider 
+    // we update the output of the box
+    mBox->bbSetOutputOut( mkwSlider->GetValue() );
+    mBox->bbSetInputIn( mkwSlider->GetValue() );
+    // and signal that the output has changed
+    mBox->bbSignalOutputModification("Out");
+  }
+  //-------------------------------------------------------------------------
+  
+
+  //-------------------------------------------------------------------------
+  void SliderWidget::RefreshLabels()
+  {
+    kwString strValue;
+    if (label_vertical!=NULL)
+      {
+       strValue.Printf( _T("%d"), mkwSlider->GetValue() );
+       label_vertical->SetLabel(strValue);
+      }
+    if (label_min!=NULL)
+      {
+       strValue.Printf( _T("%d"), mkwSlider->GetMin() );
+       label_min->SetLabel(strValue);
+      }
+    if (label_max!=NULL)
+      {
+       strValue.Printf( _T("%d"), mkwSlider->GetMax() );
+       label_max->SetLabel(strValue);
+      }  
+  }
+  //-------------------------------------------------------------------------
+  
+
+  //-------------------------------------------------------------------------
+  void SliderWidget::SetRange(int min, int max)
+  {
+    this->min = min;
+    this->max = max;
+    mkwSlider->SetRange(min,max);
+    RefreshLabels();
+  }
+  //-------------------------------------------------------------------------
+
+ */
+
+
+  //--------------------------------------------------------------------------
+  //-------------------------------------------------------------------------
+  // KwBlackBox implementation
+  //--------------------------------------------------------------------------
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  BBTK_BLACK_BOX_IMPLEMENTATION(Slider,bbtk::KWBlackBox);
+  BBTK_ADD_BLACK_BOX_TO_PACKAGE(kw,Slider);
+  
+  //--------------------------------------------------------------------------
+  void Slider::bbUserConstructor() 
+  { 
+    bbSetInputIn(0);
+    bbSetInputMin(0);
+    bbSetInputMax(500);
+    bbSetOutputOut(0);
+    bbSetOutputWidget(0);
+    bbSetInputOrientation("HORIZONTAL");
+    bbSetInputChangeResolution(false);
+    bbSetInputLabel(true);
+    bbSetInputReactiveOnTrack(0);    
+  }
+  
+ //--------------------------------------------------------------------------
+  void Slider::Process() 
+  {
+  }
+  //--------------------------------------------------------------------------
+  void Slider::CreateWidget(vtkKWWidget* parent) 
+  {
+    vtkKWScale* s = vtkKWScale::New();
+    bbSetOutputWidget(s);
+    s->SetParent(parent);
+    s->Create();
+
+    s->SetRange(bbGetInputMin(),bbGetInputMax());
+    // s->SetResolution(1.0);
+    // s->SetLength(150);
+    s->SetLabelText("A simple scale:");
+    if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true) 
+      {
+       s->SetOrientationToHorizontal();
+      }
+    else if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)  
+      {
+       s->SetOrientationToVertical();
+      }
+    else 
+      {
+       bbtkWarning("Unrecognized value for input 'Orientation' of "<<bbGetFullName());
+      }
+   
+    s->GetApplication()->Script("pack %s -side left -anchor c -expand y",
+                               s->GetWidgetName());
+
+    bbSetOutputOut( bbGetInputIn() );
+  }
+
+} //namespace bbkw
+
+#endif // USE_KWWIDGETS
+
+
diff --git a/packages/kw/src/bbkwSlider.h b/packages/kw/src/bbkwSlider.h
new file mode 100644 (file)
index 0000000..33f40f9
--- /dev/null
@@ -0,0 +1,173 @@
+/*=========================================================================                                                                               
+  Program:   bbtk
+  Module:    $RCSfile: bbkwSlider.h,v $
+  Language:  C++
+  Date:      $Date: 2008/11/29 21:41:58 $
+  Version:   $Revision: 1.1 $
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+/**
+ * \file 
+ * \brief Short description in one line
+ * 
+ * Long description which 
+ * can span multiple lines
+*/
+
+/**
+ * \class bbkw::Slider
+ * \brief 
+
+ * \class bbkw::SliderWidget
+ * \brief 
+ */
+
+#ifdef USE_KWWIDGETS
+
+// Prevents multiple inclusions : use symbols of the form
+// __FILENAME_INCLUDED__ 
+// where FILENAME must be replaced by the actual file name
+#ifndef __bbkwSlider_h_INCLUDED__
+#define __bbkwSlider_h_INCLUDED__
+
+// Include KWBlackBox definition
+#include "bbtkKWBlackBox.h"
+
+
+
+// Namespace of the package "kw" is "bbkw" 
+// Namespace associated to packages should be of the form :
+// bbPACKAGENAME
+namespace bbkw
+{
+  
+
+  /*  //--------------------------------------------------------------------------
+  // Forward declaration of the box
+  class Slider;
+  
+  //--------------------------------------------------------------------------
+  // The widget created by the box 
+  class SliderWidget : public kwPanel 
+  {
+  public:
+    /// Ctor with the two first params the parent window and the creator box
+    /// which must be passed to the KwBlackBoxWidget constructor.
+    /// The other params initialize the widget 
+    SliderWidget(Slider* box, kwWindow *parent,
+                int orientation,
+                bool changeresolution,
+                bool label, 
+                kwString title,
+                int vmin,
+                int vmax,
+                int value,
+       int track);
+    /// Dtor
+    ~SliderWidget();
+    /// Events callbacks
+    /// Called when the slider is moved
+    void OnSliderTrack(kwScrollEvent& event);
+    /// Called when the slider is released
+    void OnSliderRelease(kwScrollEvent& event);
+    /// Called when the little slider which controls the resolution
+    /// of the main slider is moved (if activated)
+    void OnResolutionOfSlider(kwScrollEvent& event);
+
+    // Accessors
+    int  GetValue() { return mkwSlider->GetValue(); }
+    void SetRange(int min, int max);
+    // Update the texts which display the min/max/current values of the slider
+    void RefreshLabels();
+       
+  private:
+    Slider*    mBox;
+    kwSlider   *mkwSlider;
+    kwSlider   *mResolutionOfSlider;
+    int        min;
+    int        max;
+    int        reactiveOnTrack;
+    kwStaticText       *label_vertical;
+    kwStaticText       *label_min;
+    kwStaticText       *label_max;
+  };
+  //------------------------------------------------------------------------
+  //------------------------------------------------------------------------
+  //------------------------------------------------------------------------
+
+  */
+  
+  
+  //------------------------------------------------------------------------
+  // The black box
+  class /*BBTK_EXPORT*/ Slider : public bbtk::KWBlackBox
+  {
+    
+    BBTK_BLACK_BOX_INTERFACE(Slider,bbtk::KWBlackBox);
+    BBTK_DECLARE_INPUT(In,int);
+    BBTK_DECLARE_INPUT(Min,int);
+    BBTK_DECLARE_INPUT(Max,int);
+    BBTK_DECLARE_INPUT(Label,bool);
+    BBTK_DECLARE_INPUT(Title,std::string);
+    BBTK_DECLARE_INPUT(Orientation,std::string);
+    BBTK_DECLARE_INPUT(ChangeResolution,bool);
+    BBTK_DECLARE_INPUT(ReactiveOnTrack,int);    
+    BBTK_DECLARE_OUTPUT(Out,int);
+    BBTK_PROCESS(Process);
+    BBTK_CREATE_KWWIDGET(CreateWidget);
+    void Process();
+    void CreateWidget(vtkKWWidget*);
+
+  protected:
+    virtual void bbUserConstructor();
+  };
+  //=================================================================
+  //=================================================================
+  // the black box description
+  BBTK_BEGIN_DESCRIBE_BLACK_BOX(Slider,bbtk::KWBlackBox);
+  BBTK_NAME("Slider");
+  BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
+  // Already inserted for any KWBlackBox  BBTK_CATEGORY("widget");
+  BBTK_DESCRIPTION("Slider widget (vtkKWScale)");
+  BBTK_INPUT(Slider,In,"Initial position of the slider (default 0)",int,"");
+  BBTK_INPUT(Slider,Min,"Minimum value of the slider (default 0)",int,"");
+  BBTK_INPUT(Slider,Max,"Maximum value of the slider (default 500)",int,"");
+  BBTK_INPUT(Slider,Label,"Show slider labels ? (default FALSE) ",bool,"");
+  BBTK_INPUT(Slider,Title,"Title shown above the slider (default '') ", std::string,"");
+  BBTK_INPUT(Slider,Orientation, "Orientation : (default H)  0=H=HORIZONTAL, 1=V=VERTICAL ",std::string,"");
+  BBTK_INPUT(Slider,ChangeResolution, "Can the user change the resolution of the slider ? (default FALSE) ",bool,"");
+  BBTK_INPUT(Slider,ReactiveOnTrack, "Slider sends info when track moves (default 0 = no)",int,"");  
+  BBTK_OUTPUT(Slider,Out,"Current position of the slider",int,"");
+  BBTK_END_DESCRIBE_BLACK_BOX(Slider);
+  //=================================================================
+  
+
+
+} //namespace bbkw
+
+#endif  //__bbtkkwSlider_h_INCLUDED__
+
+#endif // USE_KWWIDGETS
diff --git a/packages/kw/src/vtkKWSlicer.cxx b/packages/kw/src/vtkKWSlicer.cxx
new file mode 100644 (file)
index 0000000..0c9cd47
--- /dev/null
@@ -0,0 +1,371 @@
+#ifdef USE_KWWIDGETS
+
+#include "vtkKWSlicer.h"
+
+#include "vtkCornerAnnotation.h"
+#include "vtkImageData.h"
+#include "vtkImageViewer2.h"
+#include "vtkKWApplication.h"
+#include "vtkKWFrame.h"
+#include "vtkKWFrameWithLabel.h"
+#include "vtkKWMenu.h"
+#include "vtkKWMenuButton.h"
+#include "vtkKWMenuButtonWithSpinButtons.h"
+#include "vtkKWMenuButtonWithSpinButtonsWithLabel.h"
+#include "vtkKWNotebook.h"
+#include "vtkKWRenderWidget.h"
+#include "vtkKWScale.h"
+#include "vtkKWSimpleAnimationWidget.h"
+#include "vtkKWWindow.h"
+#include "vtkKWWindowLevelPresetSelector.h"
+#include "vtkObjectFactory.h"
+#include "vtkRenderWindow.h"
+#include "vtkRenderWindowInteractor.h"
+#include "vtkXMLImageDataReader.h"
+
+//#include "vtkKWWidgetsPaths.h"
+#include "vtkToolkits.h"
+
+#include <vtksys/SystemTools.hxx>
+
+namespace bbkw
+{
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro( vtkKWSlicer );
+vtkCxxRevisionMacro(vtkKWSlicer, "$Revision: 1.1 $");
+
+//----------------------------------------------------------------------------
+vtkKWSlicer::vtkKWSlicer()
+{
+  this->RenderWidget = NULL;
+  this->ImageViewer = NULL;
+  this->SliceScale = NULL;
+  this->WindowLevelPresetSelector = NULL;
+  this->AnimationWidget = NULL;
+}
+
+//----------------------------------------------------------------------------
+vtkKWSlicer::~vtkKWSlicer()
+{
+  if (this->SliceScale)
+    {
+    this->SliceScale->Delete();
+    }
+  if (this->ImageViewer)
+    {
+    this->ImageViewer->Delete();
+    }
+  if (this->RenderWidget)
+    {
+    this->RenderWidget->Delete();
+    }
+  if (this->WindowLevelPresetSelector)
+    {
+    this->WindowLevelPresetSelector->Delete();
+    }
+  if (this->AnimationWidget)
+    {
+    this->AnimationWidget->Delete();
+    }
+}
+
+//----------------------------------------------------------------------------
+void vtkKWSlicer::CreateWidget()
+{
+  // Check if already created
+
+  if (this->IsCreated())
+    {
+    vtkErrorMacro("class already created");
+    return;
+    }
+
+  // Call the superclass to create the whole widget
+
+  this->Superclass::CreateWidget();
+
+  vtkKWApplication *app = this->GetApplication();
+
+  // Add a render widget, attach it to the view frame, and pack
+
+  if (!this->RenderWidget)
+    {
+    this->RenderWidget = vtkKWRenderWidget::New();
+    }
+  this->RenderWidget->SetParent(this); //->GetViewFrame());
+  this->RenderWidget->Create();
+  this->RenderWidget->CornerAnnotationVisibilityOn();
+
+  app->Script("pack %s -expand y -fill both -anchor c -expand y", 
+              this->RenderWidget->GetWidgetName());
+
+  // Create a volume reader
+  /*
+  vtkXMLImageDataReader *reader = vtkXMLImageDataReader::New();
+
+  char data_path[2048];
+  sprintf(data_path, "%s/Data/head100x100x47.vti", KWWidgets_EXAMPLES_DIR);
+  if (!vtksys::SystemTools::FileExists(data_path))
+    {
+    sprintf(data_path,
+            "%s/..%s/Examples/Data/head100x100x47.vti",
+            app->GetInstallationDirectory(), KWWidgets_INSTALL_DATA_DIR);
+    }
+  reader->SetFileName(data_path);
+  */
+  // Create an image viewer
+  // Use the render window and renderer of the renderwidget
+
+  if (!this->ImageViewer)
+    {
+    this->ImageViewer = vtkImageViewer2::New();
+    }
+  this->ImageViewer->SetRenderWindow(this->RenderWidget->GetRenderWindow());
+  this->ImageViewer->SetRenderer(this->RenderWidget->GetRenderer());
+  //  this->ImageViewer->SetInput(reader->GetOutput());
+  this->ImageViewer->SetupInteractor(
+    this->RenderWidget->GetRenderWindow()->GetInteractor());
+
+  // Reset the window/level and the camera
+  /*
+  reader->Update();
+  double *range = reader->GetOutput()->GetScalarRange();
+  this->ImageViewer->SetColorWindow(range[1] - range[0]);
+  this->ImageViewer->SetColorLevel(0.5 * (range[1] + range[0]));
+
+  this->RenderWidget->ResetCamera();
+  */
+  // The corner annotation has the ability to parse "tags" and fill
+  // them with information gathered from other objects.
+  // For example, let's display the slice and window/level in one corner
+  // by connecting the corner annotation to our image actor and
+  // image mapper
+
+  vtkCornerAnnotation *ca = this->RenderWidget->GetCornerAnnotation();
+  ca->SetImageActor(this->ImageViewer->GetImageActor());
+  ca->SetWindowLevel(this->ImageViewer->GetWindowLevel());
+  ca->SetText(2, "<slice>");
+  ca->SetText(3, "<window>\n<level>");
+
+  // Create a scale to control the slice
+
+  if (!this->SliceScale)
+    {
+    this->SliceScale = vtkKWScale::New();
+    }
+  this->SliceScale->SetParent(this); //->GetViewPanelFrame());
+  this->SliceScale->Create();
+  this->SliceScale->SetCommand(this, "SetSliceFromScaleCallback");
+
+  app->Script("pack %s -side top -expand n -fill x -padx 2 -pady 2",
+              this->SliceScale->GetWidgetName());
+
+  // Create a menu button to control the orientation
+
+  vtkKWMenuButtonWithSpinButtonsWithLabel *orientation_menubutton =
+    vtkKWMenuButtonWithSpinButtonsWithLabel::New();
+
+  orientation_menubutton->SetParent(this); //->GetMainPanelFrame());
+  orientation_menubutton->Create();
+  orientation_menubutton->SetLabelText("Orientation:");
+  orientation_menubutton->SetPadX(2);
+  orientation_menubutton->SetPadY(2);
+  orientation_menubutton->SetBorderWidth(2);
+  orientation_menubutton->SetReliefToGroove();
+
+  app->Script("pack %s -side top -anchor nw -expand n -fill x",
+              orientation_menubutton->GetWidgetName());
+
+  vtkKWMenuButton *mb = orientation_menubutton->GetWidget()->GetWidget();
+  vtkKWMenu *menu = mb->GetMenu();
+
+  menu->AddRadioButton("X-Y", this, "SetSliceOrientationToXYCallback");
+  menu->AddRadioButton("X-Z", this, "SetSliceOrientationToXZCallback");
+  menu->AddRadioButton("Y-Z", this, "SetSliceOrientationToYZCallback");
+
+  mb->SetValue("X-Y");
+
+  // Create a window/level preset selector
+
+  vtkKWFrameWithLabel *wl_frame = vtkKWFrameWithLabel::New();
+  wl_frame->SetParent(this); //->GetMainPanelFrame());
+  wl_frame->Create();
+  wl_frame->SetLabelText("Window/Level Presets");
+
+  app->Script("pack %s -side top -anchor nw -expand n -fill x -pady 2",
+              wl_frame->GetWidgetName());
+
+  if (!this->WindowLevelPresetSelector)
+    {
+    this->WindowLevelPresetSelector = vtkKWWindowLevelPresetSelector::New();
+    }
+  this->WindowLevelPresetSelector->SetParent(wl_frame->GetFrame());
+  this->WindowLevelPresetSelector->Create();
+  this->WindowLevelPresetSelector->ThumbnailColumnVisibilityOn();
+  this->WindowLevelPresetSelector->SetPresetAddCommand(
+    this, "WindowLevelPresetAddCallback");
+  this->WindowLevelPresetSelector->SetPresetApplyCommand(
+    this, "WindowLevelPresetApplyCallback");
+  this->WindowLevelPresetSelector->SetPresetUpdateCommand(
+    this, "WindowLevelPresetUpdateCallback");
+  this->WindowLevelPresetSelector->SetPresetHasChangedCommand(
+    this, "WindowLevelPresetHasChangedCallback");
+
+  app->Script("pack %s -side top -anchor nw -expand n -fill x",
+              this->WindowLevelPresetSelector->GetWidgetName());
+
+  // Create a simple animation widget
+
+  vtkKWFrameWithLabel *animation_frame = vtkKWFrameWithLabel::New();
+  animation_frame->SetParent(this); //->GetMainPanelFrame());
+  animation_frame->Create();
+  animation_frame->SetLabelText("Movie Creator");
+
+  app->Script("pack %s -side top -anchor nw -expand n -fill x -pady 2",
+              animation_frame->GetWidgetName());
+
+  if (!this->AnimationWidget)
+    {
+    this->AnimationWidget = vtkKWSimpleAnimationWidget::New();
+    }
+  this->AnimationWidget->SetParent(animation_frame->GetFrame());
+  this->AnimationWidget->Create();
+  this->AnimationWidget->SetRenderWidget(this->RenderWidget);
+  this->AnimationWidget->SetAnimationTypeToSlice();
+  this->AnimationWidget->SetSliceSetCommand(this, "SetSliceCallback");
+  this->AnimationWidget->SetSliceGetCommand(this, "GetSliceCallback");
+
+  app->Script("pack %s -side top -anchor nw -expand n -fill x",
+              this->AnimationWidget->GetWidgetName());
+
+  this->UpdateSliceRanges();
+
+  // Deallocate local objects
+
+  //  reader->Delete();
+  orientation_menubutton->Delete();
+  wl_frame->Delete();
+  animation_frame->Delete();
+}
+
+
+//----------------------------------------------------------------------------
+void vtkKWSlicer::SetImage(vtkImageData* image)
+{
+  vtkImageData* i = vtkImageData::New();
+  i->ShallowCopy(image);
+  this->ImageViewer->SetInput(i);
+  double *range = i->GetScalarRange();
+  this->ImageViewer->SetColorWindow(range[1] - range[0]);
+  this->ImageViewer->SetColorLevel(0.5 * (range[1] + range[0]));
+  this->RenderWidget->ResetCamera(); 
+  i->Delete();
+  this->UpdateSliceRanges();
+}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+void vtkKWSlicer::SetSliceFromScaleCallback(double value)
+{
+  this->ImageViewer->SetSlice((int)value);
+}
+
+//----------------------------------------------------------------------------
+void vtkKWSlicer::SetSliceCallback(int slice)
+{
+  this->ImageViewer->SetSlice(slice);
+}
+
+//----------------------------------------------------------------------------
+int vtkKWSlicer::GetSliceCallback()
+{
+  return this->ImageViewer->GetSlice();
+}
+
+//----------------------------------------------------------------------------
+int vtkKWSlicer::GetSliceMinCallback()
+{
+  return this->ImageViewer->GetSliceMin();
+}
+
+//----------------------------------------------------------------------------
+int vtkKWSlicer::GetSliceMaxCallback()
+{
+  return this->ImageViewer->GetSliceMax();
+}
+
+//----------------------------------------------------------------------------
+void vtkKWSlicer::UpdateSliceRanges()
+{
+  this->SliceScale->SetRange(
+    this->ImageViewer->GetSliceMin(), this->ImageViewer->GetSliceMax());
+  this->SliceScale->SetValue(this->ImageViewer->GetSlice());
+
+  this->AnimationWidget->SetSliceRange(
+    this->ImageViewer->GetSliceMin(), this->ImageViewer->GetSliceMax());
+}
+
+//----------------------------------------------------------------------------
+void vtkKWSlicer::SetSliceOrientationToXYCallback()
+{
+  this->ImageViewer->SetSliceOrientationToXY();
+  this->UpdateSliceRanges();
+}
+
+//----------------------------------------------------------------------------
+void vtkKWSlicer::SetSliceOrientationToXZCallback()
+{
+  this->ImageViewer->SetSliceOrientationToXZ();
+  this->UpdateSliceRanges();
+}
+
+//----------------------------------------------------------------------------
+void vtkKWSlicer::SetSliceOrientationToYZCallback()
+{
+  this->ImageViewer->SetSliceOrientationToYZ();
+  this->UpdateSliceRanges();
+}
+
+//----------------------------------------------------------------------------
+void vtkKWSlicer::WindowLevelPresetApplyCallback(int id)
+{
+  if (this->WindowLevelPresetSelector->HasPreset(id))
+    {
+    this->ImageViewer->SetColorWindow(
+      this->WindowLevelPresetSelector->GetPresetWindow(id));
+    this->ImageViewer->SetColorLevel(
+      this->WindowLevelPresetSelector->GetPresetLevel(id));
+    this->ImageViewer->Render();
+    }
+}
+//----------------------------------------------------------------------------
+int vtkKWSlicer::WindowLevelPresetAddCallback()
+{
+  int id = this->WindowLevelPresetSelector->AddPreset();
+  this->WindowLevelPresetUpdateCallback(id);
+  this->WindowLevelPresetSelector->SelectPreset(id);
+  return id;
+}
+
+//----------------------------------------------------------------------------
+void vtkKWSlicer::WindowLevelPresetUpdateCallback(int id)
+{
+  this->WindowLevelPresetSelector->SetPresetWindow(
+    id, this->ImageViewer->GetColorWindow());
+  this->WindowLevelPresetSelector->SetPresetLevel(
+    id, this->ImageViewer->GetColorLevel());
+  this->WindowLevelPresetHasChangedCallback(id);
+}
+
+//----------------------------------------------------------------------------
+void vtkKWSlicer::WindowLevelPresetHasChangedCallback(int id)
+{
+  this->WindowLevelPresetSelector->
+    BuildPresetThumbnailAndScreenshotFromRenderWindow(
+      id, this->RenderWidget->GetRenderWindow());
+}
+
+
+} // namespace kw
+#endif // USE_KWWIDGETS
diff --git a/packages/kw/src/vtkKWSlicer.h b/packages/kw/src/vtkKWSlicer.h
new file mode 100644 (file)
index 0000000..431eb6d
--- /dev/null
@@ -0,0 +1,65 @@
+#ifdef USE_KWWIDGETS
+
+#ifndef __vtkKWSlicer_h
+#define __vtkKWSlicer_h
+
+
+#include "vtkKWFrame.h"
+
+class vtkImageData;
+class vtkKWRenderWidget;
+class vtkImageViewer2;
+class vtkKWScale;
+class vtkKWWindowLevelPresetSelector;
+class vtkKWSimpleAnimationWidget;
+
+namespace bbkw
+{
+
+class vtkKWSlicer : public vtkKWFrame
+{
+public:
+  static vtkKWSlicer* New();
+  vtkTypeRevisionMacro(vtkKWSlicer,vtkKWFrame);
+
+  void SetImage(vtkImageData*);
+
+  // Description:
+  // Callbacks
+  virtual void SetSliceFromScaleCallback(double value);
+  virtual void SetSliceCallback(int slice);
+  virtual int  GetSliceCallback();
+  virtual int  GetSliceMinCallback();
+  virtual int  GetSliceMaxCallback();
+  virtual void SetSliceOrientationToXYCallback();
+  virtual void SetSliceOrientationToXZCallback();
+  virtual void SetSliceOrientationToYZCallback();
+  virtual void WindowLevelPresetApplyCallback(int id);
+  virtual int  WindowLevelPresetAddCallback();
+  virtual void WindowLevelPresetUpdateCallback(int id);
+  virtual void WindowLevelPresetHasChangedCallback(int id);
+
+protected:
+  vtkKWSlicer();
+  ~vtkKWSlicer();
+
+  // Description:
+  // Create the widget.
+  virtual void CreateWidget();
+
+  vtkImageViewer2                *ImageViewer; 
+  vtkKWScale                     *SliceScale;
+  vtkKWWindowLevelPresetSelector *WindowLevelPresetSelector;
+  vtkKWRenderWidget              *RenderWidget;
+  vtkKWSimpleAnimationWidget     *AnimationWidget;
+
+  virtual void UpdateSliceRanges();
+
+private:
+  vtkKWSlicer(const vtkKWSlicer&);   // Not implemented.
+  void operator=(const vtkKWSlicer&);  // Not implemented.
+};
+
+}
+#endif
+#endif
index 8e9908f02402945d5ab89d0782cae1834d7c8aa1..d9d310e22c856fff7766d5facd60f5ab15e46c8e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxvtkViewer2D.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/11/25 13:18:38 $
-  Version:   $Revision: 1.24 $
+  Date:      $Date: 2008/11/29 21:42:01 $
+  Version:   $Revision: 1.25 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -302,12 +302,13 @@ namespace bbwxvtk
   }
 
 
-  // This callback is necessary to get actual processing of the view 
+  // This callback is *no more*
+  // necessary to get actual processing of the view 
   // when window is shown
   void  Viewer2D::OnShowWidget()
   {
-    //((Viewer2DWidget*)bbGetOutputWidget())->Update();
-    //((Viewer2DWidget*)bbGetOutputWidget())->UpdateView();
+    // ((Viewer2DWidget*)bbGetOutputWidget())->Update();
+    // ((Viewer2DWidget*)bbGetOutputWidget())->UpdateView();
   }