]> Creatis software - bbtk.git/commitdiff
Merge branch 'wt-version'
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 6 Oct 2015 09:08:44 +0000 (11:08 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 6 Oct 2015 09:08:44 +0000 (11:08 +0200)
37 files changed:
CMakeLists.txt
kernel/appli/bbi/CMakeLists.txt
kernel/appli/bbi/bbi.cxx
kernel/appli/bbi/bbiWeb.cxx [new file with mode: 0644]
kernel/cmake/BBTKConfigurePackage_src.cmake
kernel/src/CMakeLists.txt
kernel/src/bbtkBlackBox.cxx
kernel/src/bbtkBlackBoxDescriptor.cxx
kernel/src/bbtkBlackBoxOutputConnector.cxx
kernel/src/bbtkConfigurationFile.cxx
kernel/src/bbtkConnection.cxx
kernel/src/bbtkExecuter.cxx
kernel/src/bbtkFactory.cxx
kernel/src/bbtkFactory.h
kernel/src/bbtkInterpreter.cxx
kernel/src/bbtkInterpreterVirtual.cxx
kernel/src/bbtkPackage.cxx
kernel/src/bbtkUtilities.cxx
kernel/src/bbtkUtilities.h
kernel/src/bbtkWt.cxx [new file with mode: 0644]
kernel/src/bbtkWt.h [new file with mode: 0644]
kernel/src/bbtkWtBlackBox.cxx [new file with mode: 0644]
kernel/src/bbtkWtBlackBox.h [new file with mode: 0644]
kernel/src/bbtkWx.cxx
kernel/src/bbtkWxBlackBox.cxx
packages/CMakeLists.txt
packages/itk/src/bbitkImageWriter.cxx
packages/std/src/bbstdGetBBTKinfo.cxx [new file with mode: 0644]
packages/std/src/bbstdGetBBTKinfo.h [new file with mode: 0644]
packages/std/src/bbstdRandomString.cxx [new file with mode: 0644]
packages/std/src/bbstdRandomString.h [new file with mode: 0644]
packages/vtk/src/bbvtkPolyDataWriter.xml
packages/vtk/src/bbvtkPolyDataWriterPlus.cxx
packages/wx/src/bbwxCheckBox.cxx
packages/wx/src/bbwxCheckBox.h
packages/wx/src/bbwxComboBox.cxx
packages/wx/src/bbwxStaticBox.cxx

index bd3c0792fb39f0cc065d4929faecca07947da0ba..5ced062b2e308f24e41b48cd6f1b2548f90118b4 100644 (file)
@@ -82,6 +82,11 @@ ADD_SUBDIRECTORY(packages)
 #-----------------------------------------------------------------------------
 # The samples
 
+
+#----JFGA ---- Por default.
+SET(USE_WT OFF)
+
+
 # WARNING
 # Install the creaTools first
 # then build the 'samples' as a separate project
index 71b16c16dfef389ec05658bc56c7e815afefe60c..bfe73d59342910f3d9026f9249d3b94d0c64a295 100644 (file)
@@ -45,3 +45,15 @@ ENDIF(BBTK_USE_WXWIDGETS AND WIN32)
 
 TARGET_LINK_LIBRARIES(bbi bbtk)
 INSTALL_TARGETS(/bin/ bbi)
+
+SET(SOURCES
+  bbiWeb
+  )
+
+ADD_EXECUTABLE(bbiWeb.wt MACOSX_BUNDLE ${SOURCES})  
+TARGET_LINK_LIBRARIES(bbiWeb.wt bbtk)
+INSTALL_TARGETS(/bin/ bbiWeb.wt)
+
+
+
+
index af2b7fe15e7f67a6484f399b65520c58371a07d3..89a3daa305de477cb5ad38f819a1875e7758de05 100644 (file)
@@ -91,7 +91,7 @@ void WxProcessCmdLine::Process(wxCmdLineParser& parser)
   debug = ( parser.Found(_T("d")) );  
   quiet = ( parser.Found(_T("q")) );
   help = ( parser.Found(_T("h")) );
-  graphical_dialog = ( parser.Found(_T("g")) );
+  graphical_dialog = ( parser.Found(_T("wxcommandlineg")) );
   text_dialog = ( parser.Found(_T("t")) );
   no_console = ( parser.Found(_T("N")) );
   
@@ -178,6 +178,9 @@ bool wxBBIApp::OnCmdLineParsed(wxCmdLineParser& parser)
 // main frame
 bool wxBBIApp::OnInit( )
 {
+//Borrame
+//FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED wxBBIApp::OnInit\n"); fclose(ff);
+
   //      std::cout << "OnInit"<<std::endl;
   wxApp::OnInit();
 #ifdef __WXGTK__
@@ -190,6 +193,11 @@ bool wxBBIApp::OnInit( )
   if (cmd.debug) bbtk::MessageManager::SetMessageLevel("all",9);
   
 
+//Borrame
+//printf ("EED bbi wxBBIApp::OnInit .....................\n");
+//cmd.input_file.push_back("/home/davila/Borrame/testwt.bbs");
+
+
   bbtk::WxGUIConsole *I = new bbtk::WxGUIConsole(0,_T("bbi"),wxSize(800,600));
   SetTopWindow(I);  
   if (cmd.console) I->Show(true);
@@ -198,9 +206,9 @@ bool wxBBIApp::OnInit( )
   I->SetInputs(cmd.param_map);
 
   bool help_on_script = cmd.help && (cmd.input_file.size() > 0);
-  if (help_on_script)     I->SetNoExecMode(true);
-  if (cmd.graphical_dialog)     I->SetDialogMode(bbtk::VirtualExec::GraphicalDialog);
-  if (cmd.text_dialog)     I->SetDialogMode(bbtk::VirtualExec::TextDialog);
+  if (help_on_script)         I->SetNoExecMode(true);
+  if (cmd.graphical_dialog)   I->SetDialogMode(bbtk::VirtualExec::GraphicalDialog);
+  if (cmd.text_dialog)        I->SetDialogMode(bbtk::VirtualExec::TextDialog);
 
   std::vector<std::string>::const_iterator i;
   bool error = false;
@@ -257,6 +265,10 @@ IMPLEMENT_APP(wxBBIApp);
 //  you need to use the linker option "/subsystem:console" and the following code:
 int main(int argc, char* argv[])
 {
+
+//Borrame
+//FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED main C\n"); fclose(ff);
+
     return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
 }
 
@@ -270,6 +282,10 @@ IMPLEMENT_APP_NO_MAIN(wxBBIApp);
 
 int main(int argc, char* argv[])
 {      
+
+//Borrame
+//FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED main A\n"); fclose(ff);
+
   wxMessageOutput::Set( new wxMessageOutputBest );
 
   wxCmdLineParser parser(cmdLineDesc,argc,argv);
@@ -448,6 +464,8 @@ int main(int argc, char* argv[])
   std::cout << "BBI (Black Box Interpreter) - bbtk "
             << bbtk::GetVersion()<< " - (c) Creatis 2007"
             << std::endl;
+//Borrame
+//FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED main B\n"); fclose(ff);
 
   bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
   if (argc==1) 
diff --git a/kernel/appli/bbi/bbiWeb.cxx b/kernel/appli/bbi/bbiWeb.cxx
new file mode 100644 (file)
index 0000000..55ce986
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
+#                        pour la Santé)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  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.
+# ------------------------------------------------------------------------ 
+*/ 
+
+
+#include <stdio.h>
+
+
+//=========================================================================
+#include <bbtkInterpreter.h>
+#include <wx/cmdline.h>
+#include "bbtkWtBlackBox.h"
+
+int main(int argc, char* argv[])
+{
+
+ printf("bbiWeb...A argc=%d \n",argc);
+
+//bbtk::MessageManager::SetMessageLevel("all",9);
+printf("bbiWeb: [0]: %s \n",argv[0]);
+printf("bbiWeb: [1]: %s \n",argv[1]);
+printf("bbiWeb: [2]: %s \n",argv[2]);
+printf("bbiWeb: [3]: %s \n",argv[3]);
+printf("bbiWeb: [4]: %s \n",argv[4]);
+ printf("bbiWeb...B\n");
+
+
+  bbtk::WtBlackBox::wtServerData::argc = argc;
+  bbtk::WtBlackBox::wtServerData::argv = argv;
+
+
+
+//Borrame
+//FILE *ff; ff = fopen ("/tmp/bbi.wt.log","a+"); fprintf(ff,"EED main bbiWeb\n"); fclose(ff);
+
+  bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
+ printf("bbiWeb...C\n");
+
+  std::string fileName = argv[0];
+  std::size_t pos      = fileName.find("_");     
+  fileName             = fileName.substr (pos+1);      
+  pos                  = fileName.find(".wt");
+  fileName             = fileName.erase (pos);  
+  fileName             = "bbs/"+fileName;
+
+printf("bbiWeb fileName %s\n", fileName.c_str() );
+//  std::string fileName("/var/www/testwtdbg/docroot/.bbtk/tmp/demoPresentacion1Boton02.bbs");
+
+
+
+
+ printf("bbiWeb...D\n");
+  I->InterpretFile(fileName);
+ printf("bbiWeb...E\n");
+
+  return 0;
+}
index dc6700bf3b34a80ede1f8f4f1cedced5ca46de19..eab078afa44f902f6be720483e20e881acedd5cc 100644 (file)
@@ -132,7 +132,7 @@ FOREACH(xmlfile ${${BBTK_PACKAGE_NAME}_XML_SOURCES})
     ADD_CUSTOM_COMMAND(
       OUTPUT ${BBFY_CXX_OUT}
       COMMAND
-      export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} && ${BBTK_BBFY} ${xmlfile} ${BBTK_PACKAGE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/ -q
+      export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} && echo $ENV{LD_LIBRARY_PATH} && ${BBTK_BBFY} ${xmlfile} ${BBTK_PACKAGE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/ -q
       DEPENDS ${xmlfile}
       ${BBTK_BBFY_DEPENDENCY} 
       )
index 449e133436b75f0e3befe4c62b993f7063e62fba..44e3b2c8e411f44021be62f35f67272b1014c838 100644 (file)
@@ -180,6 +180,16 @@ IF(BBTK_USE_QT)
       )
     SET(SOURCES ${SOURCES} ${MOC_SOURCES} ${UI_SOURCES})
   ENDIF(QT_FOUND)
+
+# JFGA 03/12/2014 --  Temporal configuration of WT 
+# *********Missing if conditional Wt********
+   #find_package(Boost COMPONENTS system thread signals)
+   #find_library(wt wt)
+   #find_library(wtext wtext)
+   #find_library(wthttp wthttp)
+   INCLUDE_DIRECTORIES(/usr/local/lib/)
+
+
 ENDIF(BBTK_USE_QT)
 #-----------------------------------------------------------------------------
 
@@ -188,7 +198,7 @@ ENDIF(BBTK_USE_QT)
 # lib definition
 ADD_LIBRARY(bbtk SHARED ${SOURCES} ${SOURCES_H})
 #-----------------------------------------------------------------------------
-TARGET_LINK_LIBRARIES(bbtk ${BBTK_LINK_LIBRARIES} ${BOOST_LIBRARIES}  ${crea_LIBRARIES})
+TARGET_LINK_LIBRARIES(bbtk ${BBTK_LINK_LIBRARIES} ${BOOST_LIBRARIES}  ${crea_LIBRARIES} ${WT_LIBRARIES})
 #-----------------------------------------------------------------------------
 IF(UNIX)
 SET_TARGET_PROPERTIES(bbtk PROPERTIES COMPILE_FLAGS -Wall)
index e2dae01bcc2cd42401bc53469cb8106bf3c17005..6fb1fb83a9c749dfce3cc545269c3f0773ad71bf 100644 (file)
@@ -463,17 +463,32 @@ namespace bbtk
       }
     */
 
+
     OutputConnectorMapType::const_iterator o;  
     for ( o = bbGetOutputConnectorMap().begin(); 
          o != bbGetOutputConnectorMap().end(); ++o )                   
-      {                                                                        
-       if (o->second->GetStatus()==UPTODATE) 
+      {
+
+
+       if (o->first=="BoxChange")
+       {
+               o->second->SetStatus(UPTODATE);
+       }
+
+
+
+//EED 24/08/2015
+// EED CASPITAS 2
+       if (o->second->GetStatus()==UPTODATE)
+//     if ((o->second->GetStatus()==UPTODATE) || (o->second->GetStatus()==OUTOFDATE))
+//     if ((o->second->GetStatus()==UPTODATE) || (o->second->GetStatus()==MODIFIED))
          {
            o->second->SetStatus(OUTOFDATE);
            o->second->SignalChange(GetThisPointer<BlackBox>(),o->first); 
-         }
-       }                                                               
+         } // if
+       } // for                                                        
     
+
     if (  ( bbBoxProcessModeIsReactive()
           || (c==bbGetInputConnectorMap().find("BoxExecute")->second))
           && (bbCanReact() ) )
@@ -481,7 +496,7 @@ namespace bbtk
        bbtkBlackBoxDebugMessage("change",2,
                         "-> Execution triggered by Reactive mode or BoxExecute input change"<<std::endl);
         bbGlobalAddToExecutionList( GetThisPointer<BlackBox>() );
-      }    
+      } // if
     bbtkBlackBoxDebugMessage("change",5,
                             "<= BlackBox::bbSetStatusAndPropagate(input)"
                             <<std::endl);
@@ -692,6 +707,7 @@ namespace bbtk
   //=========================================================================
   void BlackBox::bbRecursiveExecute( Connection::Pointer caller )
   {
+
     bbtkBlackBoxDebugMessage("process",3,
                        "=> BlackBox::bbRecursiveExecute("
                        <<(caller?caller->GetFullName():"0")<<")"
@@ -721,8 +737,8 @@ namespace bbtk
          IOStatus s=UPTODATE;
 //       IOStatus s=OUTOFDATE;
 //       IOStatus s=MODIFIED;
-         
-         
+                 
+
          if ( ( bbBoxProcessModeIsManual()==false )  || 
                   ( (bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==true) ) )
          {
@@ -781,6 +797,7 @@ namespace bbtk
     bbSetExecuting(false);
     bbGlobalSetSomeBoxExecuting(wasExecuting);
 
+
     return;
   }
   //=========================================================================
@@ -1468,6 +1485,7 @@ namespace bbtk
                         <<std::endl);     
      
      bbmgGlobalProcessingExecutionList = false;
+
      
    }
   //=========================================================================
index 24e7024ff3820166bcc1494dcadbdf263cf75515..6a2c7bc67156f33f3625187d5761851bb241c2c9 100644 (file)
@@ -45,6 +45,8 @@
 #include "bbtkUtilities.h"
 #include "bbtkAtomicBlackBoxDescriptor.h"
 #include "bbtkWxBlackBox.h"
+// JFGA 12/12/2014 Adding libraries for Wt
+//#include "bbtkWtBlackBox.h"
 
 namespace bbtk
 {
@@ -381,7 +383,8 @@ namespace bbtk
     std::string usercol("#FFFFFF");
     std::string ubbcol("#DDFFFF");
     std::string wxbbcol("#EEFFFF");
-
+// JFGA 12/12/2014 Adding new variable 
+//    std::string wtbbcol("#CCFFFF");
 
     // (s) << "<h3 class=\"subsection\">Inputs</h3>\n";
     (s) << "<p><TABLE border=1 cellspacing=0 cellpadding=3>\n";
index f350f89d49b1839ae77502d4df8295bf7b7905b3..ca794920622ae758b2bc3cda7de70815cfb98962 100644 (file)
@@ -62,8 +62,6 @@ namespace bbtk
     IOStatus mStatus;
     /// The output changed signal 
     BlackBox::OutputChangeSignalType mChangeSignal;
-
-
   };
   //========================================================================
 
index c79747c0378f512cd63f36182cab6a074831618e..770608440abde5f91c223b2e011f26b41724cce0 100644 (file)
@@ -64,6 +64,7 @@ namespace bbtk
     // ==> Set system paths
     mBin_path = Utilities::GetExecutablePath();
 
+
 /*     EED 23 Mars 2009
 #ifdef MACOSX
     mInstall_path = mBin_path + "/../../../..";
@@ -81,6 +82,7 @@ namespace bbtk
          }
 #endif
 
+
 ///\TODO : better use ??
          mInstall_path = mBin_path + "/..";
 
@@ -230,6 +232,7 @@ namespace bbtk
     if (!Utilities::FileExists(mDot_bbtk_path)) mDot_bbtk_is_new = true;
     Utilities::CreateDirectoryIfNeeded(mDot_bbtk_path);
 
+
     mDoc_path = Utilities::MakeUserSettingsFullFileName("doc");
     Utilities::CreateDirectoryIfNeeded(mDoc_path);
 
@@ -293,6 +296,7 @@ namespace bbtk
     mTemp_path = Utilities::MakeUserSettingsFullFileName("tmp");
     Utilities::CreateDirectoryIfNeeded(mTemp_path);
 
+
   }
   //=========================================================================
 
@@ -346,9 +350,13 @@ namespace bbtk
     strcpy(bbtk_path, Utilities::GetExecutablePath().c_str());  // JPR
     //strcpy(bbtk_path, "/usr/local/bin");
 
+
+    std::string str_home=Utilities::GetEnvHome();
+
+
     // rootDirectory
     char rootDirectory[200];
-    sprintf( rootDirectory,  "%s/.bbtk", getenv("HOME"));
+    sprintf( rootDirectory,  "%s/.bbtk", str_home.c_str());
 
     // configPath
     char configPath[200];
index d3d73a924bd21658dbc7db86e325c9f2915280ce..e6ee23851e7288d08e4cfc37a460528bb797867d 100644 (file)
@@ -166,12 +166,12 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output,
       }
 
 
-    mFrom = from;
-    mOriginalFrom = from;
-    mTo = to;
-    mOriginalTo = to;
-    mInput = mOriginalInput = input;
-    mOutput = mOriginalOutput = output;
+    mFrom                      = from;
+    mOriginalFrom      = from;
+    mTo                        = to;
+    mOriginalTo        = to;
+    mInput                     = mOriginalInput        = input;
+    mOutput            = mOriginalOutput       = output;
 
      // Lock this pointer !!!
     //Pointer p = MakePointer(this,true);
index d20ed655310e3b8dece8b01ec28ca197c055d5c1..bf51fe564d3a1b644ee850f9bbc044d9b3abfa08 100644 (file)
@@ -132,6 +132,7 @@ namespace bbtk
 #if(USE_WXWIDGETS)
     Wx::ProcessPendingEvents();
 #endif
+
  
     // Create user package
     Package::Pointer p =
index 669a9fbc7cfe05bc69a60627b554cec70568a28e..d541db35b9203e89b984a63daa7c2dd1a7760eb5 100644 (file)
@@ -548,23 +548,47 @@ namespace bbtk
 
     bbtkDebugDecTab("kernel",9);
   }
-  //===================================================================
   
 
-//     ups3 EED borrame        
+  //===================================================================
        std::string Factory::GetPackageNameOfaBlackBox(std::string boxType)
        {
-               std::string result="<void bbtk package name>";
+               std::string packageName="<void bbtk package name>";
                PackageMapType::const_iterator i;
-               for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
-               {
-                       if ( i->second->ifBoxExist( boxType ) == true)
+
+               std::size_t found = boxType.find(":");
+               if (found!=std::string::npos)
+               {
+                       packageName     = boxType.substr(0,found);
+               } else {
+                       for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
                        {
-                               result = i->first;
-                       }
-               }
-               return result;
+                               if ( i->second->ifBoxExist( boxType ) == true)
+                               {
+                                       packageName = i->first;
+                               } // if ifBoxExist
+                       } // for i
+
+               } // if found
+               return packageName;
        }
+
+  //===================================================================
+       std::string Factory::GetTypeNameOfaBlackBox(std::string boxType)
+       {
+               std::string typeName="<void bbtk type name>";
+
+               std::size_t found = boxType.find(":");
+               if (found!=std::string::npos)
+               {
+                       typeName                = boxType.substr(found+1);
+               } else {
+                       typeName=boxType;
+               } // if found
+               return typeName;
+       }
+
+
        
        
   //===================================================================
@@ -572,20 +596,52 @@ namespace bbtk
   BlackBox::Pointer Factory::NewBlackBox(const std::string& type, 
                                  const std::string& name) const
   {
-    bbtkDebugMessageInc("kernel",7,"Factory::NewBlackBox(\""
+       bbtkDebugMessageInc("kernel",7,"Factory::NewBlackBox(\""
                         <<type<<"\",\""<<name<<"\")"<<std::endl);
 
     BlackBox::Pointer b; 
     PackageMapType::const_iterator i;
-    for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
-      {
-      b = i->second->NewBlackBox(type,name);
-      if (b) break; 
-      }
+
+       std::string tmp = type;
+       std::string packageName = ((bbtk::Factory*)this)->GetPackageNameOfaBlackBox(tmp);
+       std::string type2               = ((bbtk::Factory*)this)->GetTypeNameOfaBlackBox(tmp);
+       i = mPackageMap.find(packageName);
+       if (i != mPackageMap.end())
+       {
+               b = i->second->NewBlackBox(type2,name);
+       } else {
+               b =BlackBox::Pointer();
+       }
+
+/*
+       std::size_t found = type.find(":");
+       if (found!=std::string::npos)
+       {
+               std::string packageName = type.substr(0,found);
+               std::string type2               = type.substr(found+1);
+               i = mPackageMap.find(packageName);
+               if (i != mPackageMap.end())
+               {
+               b = i->second->NewBlackBox(type2,name);
+               } else {
+                       b =BlackBox::Pointer();
+               }
+       } else {
+       for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+       {
+               b = i->second->NewBlackBox(type,name);
+               if (b) break; 
+       } // for i
+
+       } // if found :
+*/
+
+
     if (!b) 
-      {
-       bbtkError("black box type \""<<type<<"\" unknown");
-      } 
+    {
+       bbtkError("black box type \""<<type<<"\" unknown");
+    }  // if !b
+
 
     bbtkDebugDecTab("kernel",7);
     return b;
index 8c80ec78da1043d48fe1d645e23b2dea5c109d4d..aab5c9494e433ef7f7ea191034bf7ccba1a4019f 100644 (file)
@@ -161,12 +161,14 @@ namespace bbtk
     /// Gets the executer who created the factory (if any) - const
     //    const Executer::Pointer GetExecuter() const { return mExecuter.lock(); }
 
-         std::string GetPackageNameOfaBlackBox(std::string boxType);
+       std::string GetPackageNameOfaBlackBox(std::string boxType);
+       std::string GetTypeNameOfaBlackBox(std::string boxType);
 
 
   private:
 
 
+
     /// The map of packages
     PackageMapType mPackageMap;
 
@@ -179,6 +181,8 @@ namespace bbtk
     void CloseAllPackages();
     void ClosePackage(PackageMapType::iterator& i);
 
+
+
   };
   // class Factory
 
index 04dcfdf1403a55048857b5f9e3a3cc05d1f233d4..e57717e08a78c3297dd7d34992603ee6cb47ae38 100644 (file)
@@ -2020,8 +2020,21 @@ void  Interpreter::commandNewGUI(const std::string& boxname,
           ( d->GetCreatorTypeInfo() == typeid(WxBlackBoxDescriptor)) )
        continue;
 #else
+// JFGA 12/12/2014 Adding WT options for compile with it.
+
+/*#if USE_WT
+
+       if ( ( d->GetCreatorTypeInfo() == typeid(AtomicBlackBoxDescriptor)) ||
+          ( d->GetCreatorTypeInfo() == typeid(WtBlackBoxDescriptor)) )
+       continue;
+       
+
+#else
+*/
       if ( ( d->GetCreatorTypeInfo() == typeid(AtomicBlackBoxDescriptor)) )
        continue;
+//#endif
+
 #endif
       bool widok = true;
       std::string widget,adaptor;
index c1a6fac6a6a6a1b7bb4ee0998d08822244b7e431..8d27b3290dd51134d6cbe9c578ca4d5805942d3a 100644 (file)
@@ -346,7 +346,6 @@ namespace bbtk
     */
 
 
-
   } 
   //=======================================================================
   
@@ -804,8 +803,7 @@ namespace bbtk
        
   //=======================================================================  
   void InterpreterVirtual::DoInterpretLine( const std::string& line )
-  {
-         
+  {  
     bbtkDebugMessage("interpreter",6,"==> InterpreterVirtual::DoInterpretLine(\""
                     <<line<<"\")"<<std::endl);
     std::vector<std::string> words;
@@ -1128,7 +1126,7 @@ namespace bbtk
 
     bbtkDebugMessage("interpreter",6,"<== InterpreterVirtual::DoInterpretLine(\""
                     <<line<<"\")"<<std::endl);
-         
+
   }
   //=======================================================================  
 
@@ -1370,7 +1368,7 @@ printf("EED InterpreterVirtual::SwitchToFile 1. >>%s\n", full_path.c_str() );
        for (i=script_paths.begin();i!=script_paths.end();i++)
          {
 
-printf("EED InterpreterVirtual::SwitchToFile jaja >>  %s\n", (*i).c_str() );
+printf("EED InterpreterVirtual::SwitchToFile (1) >>  %s\n", (*i).c_str() );
                  
            bbtkMessage("interpreter",1,
                        "--> Looking in '" << *i << "'" << std::endl);
@@ -1404,7 +1402,7 @@ printf("EED InterpreterVirtual::SwitchToFile jaja >>  %s\n", (*i).c_str() );
                 j!= Filenames.end(); ++j)
              {
                          
-printf("EED InterpreterVirtual::SwitchToFile kkkkk     >>  %s\n", (*j).c_str() );
+printf("EED InterpreterVirtual::SwitchToFile (2)     >>  %s\n", (*j).c_str() );
                          
                int lgr = (*j).size();
                if (lgr < 5) continue;  
index f2929573f4a53cca6312bf340632f68da3b59935..91cdb518372b220f124b1de33af8dc5c22c8912a 100644 (file)
@@ -85,8 +85,10 @@ namespace bbtk
     mDescription(description),
     mVersion(version)
   {
+
     bbtkDebugMessage("object",2,"==> Package('"<<name<<"',...)"
                     <<bbtkendl);
+
     std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
     char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1];
     std::string url = default_doc_dir; 
index 747f772fdcf67fa7fa0f94c593f39c95b752df68..7e85dc76787497b9e350fc332188b4283f88304b 100644 (file)
@@ -332,12 +332,8 @@ namespace bbtk
   /// Returns the user settings dir, e.g. /home/username/.bbtk
   std::string Utilities::GetUserSettingsDir()
   {
-#if defined(__GNUC__)
-    std::string str_home(getenv("HOME"));
-#elif defined(_WIN32)
-    std::string str_home(getenv("USERPROFILE"));
-#endif
-    std::string fullname = str_home + "/.bbtk";
+    std::string str_Home=Utilities::GetEnvHome();
+    std::string fullname = str_Home + "/.bbtk";
     MakeValidFileName(fullname);
     return fullname;
   }
@@ -348,11 +344,7 @@ namespace bbtk
   /// in user settings dir, e.g. /home/username/.bbtk/
   std::string Utilities::MakeUserSettingsFullFileName(const std::string& name)
   {
-#if defined(__GNUC__)
-    std::string str_home(getenv("HOME"));
-#elif defined(_WIN32)
-    std::string str_home(getenv("USERPROFILE"));
-#endif
+    std::string str_home=Utilities::GetEnvHome();
     std::string fullname = str_home + "/.bbtk/" + name;
     MakeValidFileName(fullname);
     return fullname;
@@ -767,6 +759,26 @@ namespace bbtk
   }
   //=========================================================================
 
+
+std::string Utilities::GetEnvHome()
+{
+#if defined(__GNUC__)
+       std::string strHome;
+    char *envHome=getenv("HOME");
+    if (envHome!=NULL)  
+       { 
+               strHome=envHome; 
+       } else {
+               strHome = "/var/www/testwtdbg/docroot";
+       } // if
+#elif defined(_WIN32)
+       std::string strHome( getenv("USERPROFILE") );
+#endif
+       return strHome;
+}   
+
+
+
 //TAD Arbol CFT
 
 
index fa2db5bec4a5fc9652174b05da5ae2094ea73b0f..90bb34099c6ab2e10788795647f0626122cdb6ce 100644 (file)
@@ -197,7 +197,8 @@ namespace bbtk
     
     static bool loosematch(std::string stdLine,std::string stdOptions);
     
-   
+
+    static std::string GetEnvHome();
     
     
   };
diff --git a/kernel/src/bbtkWt.cxx b/kernel/src/bbtkWt.cxx
new file mode 100644 (file)
index 0000000..6712389
--- /dev/null
@@ -0,0 +1,282 @@
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  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.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+  Program:   bbtk
+  Module:    $RCSfile: bbtkQt.cxx,v $
+  Language:  C++
+  Date:      $Date: 2012/11/16 08:49:01 $
+  Version:   $Revision: 1.4 $
+=========================================================================*/
+
+
+#include "bbtkWt.h"
+#include "bbtkMessageManager.h"
+
+#ifdef USE_WT
+
+
+
+
+namespace bbtk
+{
+  //=========================================================================
+  class WtApp;
+  Wt::WApplication *createApplication(const Wt::WEnvironment& env);
+  //=========================================================================
+
+  //=========================================================================
+  static WtApp* mgWtApp = 0;
+  static Wt::WContainerWidget* mgTopWindow = 0;
+  static int mgNbWindowsAlive  = 0;
+  //=========================================================================
+  
+  //=========================================================================
+  // BBTKWXSIG
+  static WWt::Signal_type mgWtSignal;
+  // \BBTKWXSIG
+  //=========================================================================
+
+  //=========================================================================
+  // The wxApp class which is used when no user wxApp was created
+ // The application creates itself completly empty.
+// The default values for the port and address are port:8080 address 0.0.0.0
+  class WtApp : public Wt::WApplication
+  {
+  public:
+    WtApp(const Wt::WEnvironment& env);
+    ~WtApp();
+    static int WtWRun();
+               //WtWApplication *createApplication(const WtWEnvironment& env);
+    
+  };
+
+       WtApp::WtApp(const Wt::WEnvironment& env):
+               Wt::WApplication(env)
+       {
+               //root()->addWidget(WWt::GetTopWindow());
+               // There is not additional configuration. The new WtApp must have the same behavior that one Wt::WApplication.
+               
+       }
+
+       WtApp::~WtApp()
+       {
+
+       }
+/*
+       int WtApp::WtWRun()
+       {
+               char  *argv[7] =  {"./WtTest","--docroot",".","--http-address","0.0.0.0","--http-port","8080"};
+               int argc = 7;
+               return Wt::WRun(argc,argv,&createApplication);  
+       }
+
+
+       Wt::WApplication *createApplication(const Wt::WEnvironment& env)
+       {
+               return new WtApp(env);
+       }
+*/
+
+
+
+  //=========================================================================
+
+  //=========================================================================
+  void WWt::CreateWtAppIfNeeded()
+  {
+               std::cout<<"CREATING APP IF NEEDED --------- DELETE ME ------- bbtkWt.cxx"<<std::endl;
+               if(Wt::WApplication::instance()==0)
+               {
+                       if (mgWtApp != 0) 
+               {
+               bbtkGlobalError("Wt::CreateWtAppIfNeeded() : INTERNAL ERROR ! (Wt::WApplication::instance()==0) && (mgWtApp != 0)");
+                       }
+                       bbtkDebugMessage("wt",1,"  --> Creating bbtk WtApp"<<std::endl);  
+                       //WtApp::WtWRun();
+               }               
+               bbtkDebugMessage("process",2,"Create WtApp If needed debuging");
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void WWt::DestroyWtAppIfNeeded()
+  {
+    if (mgWtApp!= 0) 
+      {
+       //      bbtkDebugMessage("wx",1,"  --> Destructing bbtk WxApp"<<std::endl);
+       //delete mgWxApp;
+       //      mgWxApp = 0;
+       // Uninit wx
+       //      wxUninitialize();
+      }
+  }
+  //=========================================================================
+
+
+  //=========================================================================
+  void WWt::ProcessPendingEvents()
+  {
+    /*
+    if (Wx::GetTopWindow() != 0)
+      {
+       Wx::GetTopWindow()->DestroyChildren();
+      }
+    */
+
+    /*
+    wxApp* a = (wxApp*)wxApp::GetInstance();
+    if (a==0) return;
+    
+    std::cout << "$$$$$$$$$$$$$$ PROCESS PENDING "<<std::endl;
+    while (a->Pending())
+      a->Dispatch();
+    std::cout << "$$$$$$$$$$$$$$ PROCESS PENDING DONE"<<std::endl;
+    */
+  }
+
+
+  //=========================================================================
+  Wt::WContainerWidget* WWt::GetTopWindow() 
+  { 
+    return mgTopWindow; 
+  }
+  //=========================================================================
+  
+
+  // BBTKWXSIG
+  //=========================================================================
+  void WWt::AddSignalObserver(Slot_function_type f)
+  {
+    mgWtSignal.connect(f);
+  }
+  //=========================================================================
+  // \BBTKWXSIG
+
+  
+  //=========================================================================
+  void WWt::SetTopWindow(Wt::WContainerWidget* w) 
+  {
+    if ( mgTopWindow ) 
+      {
+       bbtkGlobalError("Wt::SetTopWindow : top window already set !");
+      } 
+    //mgTopWindow = w;
+  }
+  //=========================================================================
+
+
+  //=========================================================================
+  void WWt::IncNbWindowsAlive() 
+  { 
+    mgNbWindowsAlive++; 
+    bbtkDebugMessage("wt",2,"* Number of windows alive = "<<mgNbWindowsAlive
+                    <<std::endl);
+    // BBTKWXSIG
+    mgWtSignal();
+    // \BBTKWXSIG
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void WWt::DecNbWindowsAlive()
+  { 
+    mgNbWindowsAlive--; 
+    bbtkDebugMessage("wt",2,"* Number of windows alive = "<<mgNbWindowsAlive
+                    <<std::endl);
+
+    // BBTKWXSIG
+    mgWtSignal();
+    // \BBTKWXSIG
+  }
+  //=========================================================================
+
+  //=========================================================================
+  int  WWt::GetNbWindowsAlive() 
+  { 
+    return mgNbWindowsAlive; 
+  }
+  //=========================================================================
+  
+  //=========================================================================
+  bool WWt::IsSomeWindowAlive() 
+  { 
+    return (mgNbWindowsAlive!=0);
+  }
+  //=========================================================================
+  
+
+  //=========================================================================
+  WWt::BusyCursor::BusyCursor()
+  {
+   // mCursor = 0;
+    if (Wt::WApplication::instance()!=0) 
+      {        
+       bbtkDebugMessage("wt",2,
+                        "Wt::BusyCursor::BusyCursor() : creating new cursor"
+                        <<std::endl);
+       //mCursor = new wxBusyCursor; 
+    }
+  }
+  //=========================================================================
+  //=========================================================================
+  WWt::BusyCursor::~BusyCursor()
+  {
+   // if (mCursor)
+     // { 
+       //delete mCursor;
+       //bbtkDebugMessage("wt",2,
+       //               "Wt::BusyCursor::~BusyCursor() : deleting cursor"<<std::endl);
+      //}
+  }
+  //=========================================================================
+
+
+
+} // namespace bbtk
+
+#else
+//=======================================================================
+// WITHOUT WX
+//=========================================================================
+namespace bbtk
+{
+   //=========================================================================
+  WWt::BusyCursor::BusyCursor()
+  {
+  }
+  WWt::BusyCursor::~BusyCursor()
+  {
+  }
+  //=========================================================================
+
+} // namespace bbtk
+#endif
+
+
diff --git a/kernel/src/bbtkWt.h b/kernel/src/bbtkWt.h
new file mode 100644 (file)
index 0000000..0828d0b
--- /dev/null
@@ -0,0 +1,252 @@
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  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.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+  Program:   bbtk
+  Module:    $RCSfile: bbtkQt.h,v $
+  Language:  C++
+  Date:      $Date: 2012/11/16 08:49:01 $
+  Version:   $Revision: 1.3 $
+=========================================================================*/
+
+
+
+#ifndef __bbtkWt_h_INCLUDED__
+#define __bbtkWt_h_INCLUDED__
+
+//===========================================================================
+// SIGNAL/SLOT MECHANISM 
+// FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION 
+// BBTKWXSIG
+#include <boost/signal.hpp>
+#include <boost/bind.hpp>
+
+
+//TODO Include libs in the CMake escription
+#include <Wt/WApplication>
+#include <Wt/WEnvironment>
+#include <Wt/WContainerWidget>
+#include <Wt/WWidget>
+#include <Wt/WCheckBox>
+#include <Wt/WServer>
+#include <Wt/WText>
+#include <Wt/WPushButton>
+#include <Wt/WSlider>
+#include <Wt/WHBoxLayout>
+#include <Wt/WVBoxLayout>
+#include <Wt/WBorderLayout>
+#include <Wt/WLineEdit>
+#include <Wt/WComboBox>
+#include <Wt/WSelectionBox>
+#include <Wt/WGroupBox>
+#include <Wt/WRadioButton>
+#include <Wt/WButtonGroup>
+#include <Wt/WLayout>
+#include <Wt/WHBoxLayout>
+#include <Wt/WVBoxLayout>
+#include <Wt/WRadioButton>
+#include <Wt/Ext/Splitter>
+#include <Wt/WTabWidget>
+#include <Wt/WFileUpload>
+#include <Wt/WLength>
+
+//typedef boost::signals::trackable SignalObserver;
+// \BBTKWXSIG
+//===========================================================================
+
+
+//===========================================================================
+// Qt headers
+// DEFINIR LOS HEADERS Wt que se necesitan  *-*-*-*-*-*-*-*-*-*
+/*
+#ifdef USE_WT
+#include "qwidget.h"
+// EO Qt headers
+
+#else //USE_QT
+
+// define QWidget
+typedef void QWidget;
+typedef void QBusyCursor;
+
+#endif // EO USE_WXWIDGETS
+
+//-*-*-*-* JFGA 
+
+*/
+#ifdef USE_WT
+
+
+// Definition of some classes used in tehe code
+typedef Wt::WEnvironment WtWEnvironment;
+typedef Wt::WWidget WtWWidget;
+//typedef Wt::WContainerWidget WtWContainerWidget;
+typedef Wt::WApplication WtWApplication;
+typedef Wt::WString WtWString;
+
+
+
+#else // EO_USE_WT
+
+
+typedef void WtWidget;
+typedef void WtWContainerWidget;
+typedef void WtWApplication;
+typedef void WtBusyCursor;
+
+#endif // EO USE_WT
+
+
+//==========================================================================
+
+//===========================================================================
+#include "bbtkSystem.h"
+//===========================================================================
+
+
+
+
+
+namespace bbtk
+{
+
+  //==================================================================
+  /// Global wt handlers (cursor...)
+
+
+// BBTKWXSIG BBTK_ADD_BLACK_BOX_TO_PACKAGE(MyProjectWT,Testing)
+
+#define bbtkAddWtSignalObserver(METHOD)                \
+  WWt::AddSignalObserver(boost::bind(&METHOD, this))
+// \BBTKWXSIG
+
+#define BBTK_BUSY_CURSOR bbtk::WWt::BusyCursor __bbtk_dummy_busy_cursor;
+
+  struct BBTK_EXPORT WWt
+  {    
+  public:
+    // BBTKWXSIG
+    // The keyword 'signals' is also a macro in qt
+    //    typedef boost::signals::trackable SignalObserver;
+    typedef boost::signals::trackable SignalObserver;
+    typedef boost::signal<void ()>  Signal_type;
+    typedef Signal_type::slot_function_type Slot_function_type;
+    // \BBTKWXSIG
+               
+    /*
+    static void ResetCursor();
+    static void BeginBusyCursor(); 
+    static void EndBusyCursor();
+    */
+
+    static void LoopUntilAllWindowsClose();
+
+    class BusyCursor
+    {
+    public:
+      BusyCursor();
+      ~BusyCursor();
+      //wxBusyCursor* mCursor; The wxBusyCursor is only for comunicate to the client/user that the program is busy. 
+    };
+
+
+    static void ProcessPendingEvents();
+    /// Sets the parent of all bbtk windows
+    static void SetTopWindow(Wt::WContainerWidget*);
+    /// Returns the parent of all bbtk windows 
+    static Wt::WContainerWidget* GetTopWindow();
+
+    
+    static void IncNbWindowsAlive();
+    static void DecNbWindowsAlive();
+    static int  GetNbWindowsAlive();
+    static bool IsSomeWindowAlive();
+    
+
+    // BBTKWXSIG
+    static void AddSignalObserver(Slot_function_type);
+    // \BBTKWXSIG
+
+
+
+
+  //private:
+    static void CreateWtAppIfNeeded();
+    static void DestroyWtAppIfNeeded();
+
+  }; // struct Wt
+  //==================================================================
+  
+#ifdef USE_WT
+
+
+       static std::string jScript;
+  //==================================================================
+  /// Conversion std::string to wxString 
+  inline Wt::WString std2wt(const std::string& s)
+  {
+  //  Wt::WString wt;
+/*
+    const char* my_string=s.c_str();
+    wxMBConvUTF8 *wxconv= new wxMBConvUTF8();
+    wx=wxString(wxconv->cMB2WC(my_string),wxConvUTF8);
+    delete wxconv;
+    // test if conversion works of not. In case it fails convert from Ascii
+    if(wx.length()==0)
+      wx=wxString(wxString::FromAscii(s.c_str()));
+*/     
+    return Wt::WString::fromUTF8(s,false);
+    //return new Wt::WString(s);//wt;
+  }
+  //==================================================================
+
+  //==================================================================
+  /// Conversion wxString to std::string
+  inline  std::string wt2std(const Wt::WString& s){
+   /* std::string s2;
+    if(s.wxString::IsAscii()) {
+      s2=s.wxString::ToAscii();
+    } else {
+      const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(s);
+      const char *tmp_str = (const char*) tmp_buf;
+      s2=std::string(tmp_str, strlen(tmp_str));
+    }
+
+    return s2;*/
+       return s.toUTF8();
+  }
+  //==================================================================
+#endif // EO _USE_WXWIDGETS
+
+
+
+
+  
+} // namespace bbtk
+  
+
+#endif // EO __bbtkWt_h_INCLUDED__
diff --git a/kernel/src/bbtkWtBlackBox.cxx b/kernel/src/bbtkWtBlackBox.cxx
new file mode 100644 (file)
index 0000000..a3cb0db
--- /dev/null
@@ -0,0 +1,473 @@
+
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  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.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+  Program:   bbtk
+  Module:    $RCSfile: bbtkWxBlackBox.cxx,v $
+  Language:  C++
+  Date:      $Date: 2012/11/16 08:49:01 $
+  Version:   $Revision: 1.45 $
+=========================================================================*/
+
+
+
+#ifdef _USE_WT_
+
+/**
+ *  \file 
+ *  \brief 
+ */
+#include "bbtkWtBlackBox.h"
+#include "bbtkBlackBoxOutputConnector.h"
+
+
+//#include "bbtkWxContainerBlackBox.h"
+//#include <wx/dialog.h>
+
+//#include "bbtkData.h"
+//#include "bbtkFactory.h"
+
+
+
+
+namespace bbtk
+{
+
+/*     
+       class jScript
+       {
+               public:
+                       jScript();
+                       std::string jScriptLine;
+       };
+*/
+  //=========================================================================
+  // wtData structure
+  //=========================================================================
+
+       // For the very first contruction of the application
+/*     struct wtServerData
+       {
+         std::string docRoot;
+         std::string port;
+         std::string address;
+       
+       };
+       */
+       struct wtData
+       {
+               Wt::WContainerWidget *parent;
+               WtBlackBox::Pointer b;
+               WtBlackBox *pbox;       
+               Wt::WString title;      
+       };
+
+/*     jScript::jScript()
+       {
+               jScriptLine = "";
+       }
+*/
+//     static bbtk::jScript* js  = new bbtk::jScript();
+       static wtData myWtData;
+//     static wtServerData loadedJS;
+       //static std::string* jss;
+       
+       
+
+  //=========================================================================
+  // javaScript Line
+  //=========================================================================
+       //Contains all the JS statements needed for the bbwt.
+               
+  //=========================================================================
+  // WxFrame
+  //=========================================================================
+       // Application WT deployed
+  //==================================================================
+ class WtWFrame : public Wt::WApplication
+  {
+  public:
+    WtWFrame( const Wt::WEnvironment& env );
+    ~WtWFrame();       
+    WtBlackBox::WeakPointer mBox; 
+  };   
+       
+
+       WtWFrame::WtWFrame( const Wt::WEnvironment& env ):Wt::WApplication(env)
+       {  
+               //std::cout<<"Adding JavaScript --  DELETE ME -- bbtkWtBlackBox.cxx"<<std::endl;
+               //this->require("/home/gonzalez/Documents/CREATOOLS/wt_library/wt/bbtk_wt_PKG/src/js/xtk.js");
+
+               //this->require("http://get.goXTK.com/xtk.js");
+               //this->useStyleSheet("css/demo.css");
+
+       //this->require("http://get.goXTK.com/xtk.js");
+       this->require( "resourcesXTK/xtk.js" );
+               
+       //      this->require("http://get.goXTK.com/xtk_edge.js");
+//     this->require("http://get.goXTK.com/xtk_xdat.gui.js");
+       this->require( "resourcesXTK/xtk_xdat.gui.js" );
+
+  this->useStyleSheet("resourcesXTK/styleWT.css"); 
+       //      std::cout<<"Cargado------------           "<<loadedJS<<std::endl;
+               mBox = myWtData.b;
+
+//EED -->
+               if(!myWtData.parent)
+               {
+                       std::cout<<"        SIN PADRE "<<std::endl;
+                       if(myWtData.parent == 0){std::cout<<"        PARENT 0 "<<std::endl;}
+                       if(myWtData.parent == NULL){std::cout<<"        PARENT NULL "<<std::endl;}
+                       myWtData.parent = new Wt::WContainerWidget();
+                       std::cout<<"Parent created --  DELETE ME -- bbtkWtBlackBox.cxx"<<std::endl;
+               }
+
+               Wt::WContainerWidget *myContainer = new Wt::WContainerWidget(myWtData.parent);
+               myContainer->setMinimumSize(800,500);
+               std::cout<<"Creando WebWIDGET DELETE ME ---- bbtkWtBlackBox.cxx.......50%"<<std::endl;
+               myWtData.b->bbUserCreateWidget(myContainer);
+
+               root()->addWidget(myWtData.parent);
+               //bbmWindow = myCont;
+               this->refresh();
+               //jss = WtBlackBox::jScript;
+               std::cout<<"Creando WebWIDGET DELETE ME ---- bbtkWtBlackBox.cxx........80%"<<std::endl;
+               std::cout<<"Creando WebWIDGET DELETE ME SCRIPT : ---"<<bbtk::jScript<<"......80%"<<std::endl;
+               //this->doJavaScript(bbtk::jScript); 
+
+//EED
+       myWtData.pbox->bbwtUpdateInputs();
+//       myWtData.pbox->bbwtProcess();
+
+
+  }
+  //==================================================================
+  //==================================================================
+  WtWFrame::~WtWFrame() 
+    { 
+      if (mBox.lock())
+       bbtkDebugMessage("widget",9,"["<<mBox.lock()->bbGetName()
+                        <<"] $$$$$$$$$$$$$$$$$$$ ~W()"
+                        <<std::endl);
+      else 
+       bbtkDebugMessage("widget",9,"[DEAD] $$$$$$$$$$$$$$$$$$$$$ ~WtContainer()"<<std::endl);
+      bbtkDebugMessage("widget",9,"WtWFrame::~WtWFrame()"<<std::endl);
+      if (mBox.lock()) mBox.lock()->bbSetWindow(0); 
+      WWt::DecNbWindowsAlive();
+    }
+
+
+   
+       Wt::WApplication *createApplication(const Wt::WEnvironment& env)
+       {
+                       return new WtWFrame(env);                       
+       }
+
+
+  //=========================================================================
+  // WxDialogWxBlackBox::Pointer box
+  //=========================================================================
+
+   //==================================================================
+  // Dialog window which is modal
+ /* class BBTK_EXPORT  WxDialog : public wxDialog
+  {
+  public:
+    WxDialog(WxBlackBox::Pointer box, 
+                    wxWindow *parent, 
+                    wxString title, 
+                    wxSize size);
+    ~WxDialog();Wt::GetTopWindow()
+    void OnCloseWindow(wxCloseEvent& event);
+
+
+    WxBlackBox::WeakPointer mBox;      
+    DECLARE_EVENT_TABLE();
+    
+  };
+  
+  BEGIN_EVENT_TABLE(WxDialog, wxDialog)
+    EVT_CLOSE(WxDialog::OnCloseWindow)
+    END_EVENT_TABLE();
+  //=========================================================================
+
+  //=========================================================================
+  WxDialog::WxDialog(WxBlackBox::Pointer b,
+                    wxWindow *parent,
+                    wxString title,
+                    wxSize size)
+    :
+    wxDialog( parent, 
+               -1, 
+               title,
+               wxDefaultPosition,
+               size,
+               wxRESIZE_BORDER | 
+               wxSYSTEM_MENU  |
+               wxCLOSE_BOX |
+               wxMAXIMIZE_BOX | 
+               wxMINIMIZE_BOX | 
+               wxCAPTION  
+             ),
+    mBox(b)
+  {
+    bbtkDebugMessage("widget",9,"WxDialog::WxDialog ["<<b->bbGetName()<<"]"
+                    <<std::endl);WxBlackBox::Pointer box
+    Wx::IncNbWindowsAlive();
+    b->bbSetWindow(this);
+    // Insert the widget into the window
+    wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+    b->bbUserCreateWidget(this);
+    wxWindow* widget = b->bbGetOutputWidget();
+    sizer->Add( widget, 1, wxALL|wxGROW, 2);
+    SetSizer(sizer);
+    Layout();
+  }
+  //==================================================================
+  //===========================organise=======================================
+  WxDialog::~WxDialog() 
+    { 
+      bbtkDebugMessage("widget",9,"WxDialog::~WxDialog()"<<std::endl);
+      //bbtkDebugMessage("widget",9,"WxFrame::~WxFrame()"<<std::endl);
+      //      if (mBox.lock()) mBox.lock()->bbSetWindow(0); 
+      //      Wx::DecNbWindowsAlive();
+    }
+   //==================================================================
+   //==================================================================
+  void WxDialog::OnCloseWindow(wxCloseEvent& event)
+    {
+      bbtkDebugMessage("widget",9,"WxDialog::OnCloseWindow()"<<wxGUIEditorGraphicBBS:std::endl);
+      if (mBox.lock()) mBox.lock()->bbSetWindow(0); http://doodle.com/qx65tfxismf7d6ku5vxykghs/admin#table
+      Wx::DecNbWindowsAlive();
+      this->Destroy();
+    }
+   //==================================================================
+
+*/
+ //=========================================================================
+  // WxBlackBox
+  //=========================================================================
+
+  //=========================================================================
+  //=========================================================================
+  //=========================================================================
+  //=========================================================================
+  BBTK_BLACK_BOX_IMPLEMENTATION(WtBlackBox,WidgetBlackBox<Wt::WContainerWidget>);
+       
+       //std::string WtBlackBox::wtServerData::docRoot = "/home/gonzalez/Documents/pruebaResources";
+       //std::string WtBlackBox::wtServerData::docRoot = "/usr/local/share/wtResources";
+  //std::string WtBlackBox::wtServerData::port    = "8081";
+
+       std::string WtBlackBox::wtServerData::docRoot   = "<void>";
+       std::string WtBlackBox::wtServerData::port      = "<void>";
+       std::string WtBlackBox::wtServerData::address   = "0.0.0.0";
+       int WtBlackBox::wtServerData::argc                              = 0;
+       char **WtBlackBox::wtServerData::argv                   = NULL;
+
+  //=========================================================================
+  //=========================================================================
+  void WtBlackBox::bbUserSetDefaultValues()
+  {
+    bbtkBlackBoxDebugMessage("widget",5,"WtBlackBox::bbUserSetDefaultValues()"<<std::endl);
+    bbmWindow = 0;
+  }
+  //=========================================================================
+
+  //=========================================================================
+  void WtBlackBox::bbUserInitializeProcessing()
+  {
+
+  }
+  //================================================================http://intranet-if.insa-lyon.fr/temps/5IF39.html==    
+
+  //=========================================================================
+  void WtBlackBox::bbUserFinalizeProcessing()
+  {
+    bbtkBlackBoxDebugMessage("widget",5,"==> WtBlackBox::bbUserFinalizeProcessing()"<<std::endl);
+    bbDestroyWindow();
+    bbtkBlackBoxDebugMessage("widget",5,"<== WtBlackBox::bbUserFinalizeProcessing()"<<std::endl);
+  }
+  //==================================================================    
+
+  //==================================================================    
+  /// Callback for creating a Dialog window (modal)
+  void WtBlackBox::bbCreateDialogWindow()
+  {
+         bbtkBlackBoxDebugMessage("widget",3,
+                    "==> WtBlackBox::bbCreateDialogWindow() - No Dialog must be created, it is a web app"
+                    <<std::endl);
+
+  } 
+  //=========================================================================
+
+  //==================================================================    
+
+  //==================================================================    
+  /// Callback for creating a Frame window 
+       void WtBlackBox::bbCreateFrameWindow()
+       {
+
+               bbtkBlackBoxDebugMessage("widget",3,
+                       "==> WtBlackBox::bbCreateFrameWindow() - parent = "
+                       <<WWt::GetTopWindow()
+                       <<std::endl);
+
+               //Setting necessary data for Wt server deployment
+               myWtData.parent = WWt::GetTopWindow();
+               myWtData.b      = GetThisPointer<WtBlackBox>();
+               myWtData.title  = std2wt( bbGetInputWinTitle() + " - bbtk (c) CREATIS");
+               myWtData.pbox   = this;
+               
+               //char  *argv[7] =  {"./WtTest","--docroot","/home/gonzalez/Documents/pruebaResources","--http-address","0.0.0.0","--http-port","8080"};
+               //int argc = 7;
+               
+/*             
+                       char  *argv[7] =  {"./WtTest"
+,"--docroot",(char*)WtBlackBox::wtServerData::docRoot.c_str()
+,"--http-address",(char*)WtBlackBox::wtServerData::address.c_str()
+,"--http-port",(char*)WtBlackBox::wtServerData::port.c_str()
+};
+               int argc = 3;
+               std::cout<<" ---  PUERTO  :"<<WtBlackBox::wtServerData::port<<std::endl;
+*/
+
+/*             
+char  *argv[2] =  {"./bbiWeb.wt","client"};
+int argc=2;
+*/
+
+
+       /*      if(Wt::WServer::instance()->isRunning())
+               {
+                       std::cout<<"Checking the existence of a Server deployed  -DELETE THIS MESSAGE bbtkWTBlackBox.cxx"<<std::endl;
+                       Wt::WServer::instance()->stop();
+               }
+       */
+
+
+               std::cout<<"EED WtBlackBox::bbCreateFrameWindow  Deploying Server -- Definition of server parameters by default  -DELETE THIS MESSAGE bbtkWTBlackBox.cxx"<<std::endl;
+
+
+//             Wt::WRun(argc,argv,&createApplication); 
+
+               Wt::WRun(WtBlackBox::wtServerData::argc,
+                         WtBlackBox::wtServerData::argv,
+                         &createApplication);  
+
+
+   }
+
+  //==================================================================    
+
+  //==================================================================    
+  void WtBlackBox::bbSetWindow(Wt::WContainerWidget* w) 
+  {
+    bbtkBlackBoxDebugMessage("widget",9,"==> WtBlackBox::bbSetWindow("<<w<<")"<<std::endl);
+    if ((bbmWindow != 0)&&(w!=0)) 
+      { 
+       std::cout << "ERRRRRRRROOOOR"<<std::endl; 
+      }
+    bbmWindow = w;
+  }
+
+       
+
+    //==================================================================    
+
+  //==================================================================
+  void WtBlackBox::bbShowWindow()
+  {
+    if ((bbmWindow) && (!bbIsShown()))
+      {
+       bbtkBlackBoxDebugMessage("widget",3,"==> WtBlackBox::bbShowWindow()"
+                        <<std::endl);
+       if (bbGetInputWinDialog()) 
+         {
+         //  ((WxDialog*)bbmWindow)->ShowModal();
+         }
+       else
+         {
+               // There is not such a thing like show becouse it is a webapp
+          // bbGetWindow()->Show();
+         //  WWt::CreateWtAppIfNeeded();
+
+
+               Wt::WRun(WtBlackBox::wtServerData::argc,
+                         WtBlackBox::wtServerData::argv,
+                         &createApplication);  
+
+
+           bbSetShown(true);
+         } 
+      }
+  }
+  //==================================================================    
+
+  //==================================================================    
+  void WtBlackBox::bbDestroyWindow()
+  {
+    bbtkBlackBoxDebugMessage("widget",3,"==> WtBlackBox::bbDestroyWindow("<<bbmWindow<<")"<<std::endl);
+    if (bbGetWindow()!=NULL) 
+      {
+       //       wxWindow* w = bbGetWindow();
+       //bbSetWindow(0);
+       // WE SHOULD DESTROY THE WINDOW WITH THE Close METHOD
+       // HOWEVER I
+       //w->Close(true);
+       //
+       delete bbGetWindow();
+       bbSetShown(false);
+      }
+    bbtkBlackBoxDebugMessage("widget",3,"<== WtBlackBox::bbDestroyWindow("<<bbmWindow<<")"<<std::endl);
+
+  }
+
+
+//==================================================================    
+       void WtBlackBox::bbwtUpdateInputs()
+       {
+               BlackBox::bbUpdateInputs();
+       }
+
+//==================================================================    
+       void WtBlackBox::bbwtProcess()
+       {
+               BlackBox::bbProcess();
+       }
+
+
+
+}//namespace bbtk
+
+#endif
+
+
diff --git a/kernel/src/bbtkWtBlackBox.h b/kernel/src/bbtkWtBlackBox.h
new file mode 100644 (file)
index 0000000..1df5570
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  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.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+  Program:   bbtk
+  Module:    $RCSfile: bbtkWxBlackBox.h,v $
+  Language:  C++
+  Date:      $Date: 2012/11/16 08:49:01 $
+  Version:   $Revision: 1.33 $
+========================================================================*/
+
+
+
+/**
+ * \brief Short description in one line
+ * 
+ * Long description which 
+ * can span multiple lines
+ */
+/**
+ * \file 
+ * \brief 
+ */
+/**
+ * \class bbtk::
+ * \brief 
+ */
+
+
+#ifdef USE_WT
+
+
+#ifndef __bbtkWtBlackBox_h__
+#define __bbtkWtBlackBox_h__
+
+
+
+#include "bbtkWidgetBlackBox.h"
+#include "bbtkWt.h"
+
+
+namespace bbtk
+{
+
+
+  //==================================================================
+  /// Widget black boxes
+//EED 10/06/2009 /*BBTK_EXPORT*/
+  class BBTK_EXPORT WtBlackBox : public bbtk::WidgetBlackBox<Wt::WContainerWidget>
+  { 
+  
+
+  
+  
+  
+  public:
+    BBTK_BLACK_BOX_INTERFACE(WtBlackBox,bbtk::WidgetBlackBox<Wt::WContainerWidget>);
+    
+         
+    //  protected:
+    
+  public:
+  
+     struct wtServerData
+          {
+             /*std::string docRoot;
+             std::string port;
+             std::string address;
+           */
+             static std::string docRoot  ;
+             static std::string port     ;
+             static std::string address  ;
+             
+              static int argc;
+              static char **argv;
+           };
+  
+  /*   static std::string* jScript;
+    static void changeJScript(std::string newJScript){jScript=newJScript;};
+    static std::string getJScript(){return jScript;};*/
+   //==================================================================    
+    /// Callback for creating a Dialog window (modal)
+    /// ** Must be defined ** in toolkit specific descendants 
+    virtual void bbCreateDialogWindow();
+    //==================================================================    
+
+    //==================================================================    
+    /// Callback for creating a Frame window 
+    /// ** Must be defined ** in toolkit specific descendants 
+    virtual void bbCreateFrameWindow();
+    //==================================================================    
+    //staticwtServerData serData;
+   // static void setServerInformation(std::string nDocRoot, std::string nPort, std::string nAddress);
+    //==================================================================    
+    Wt::WContainerWidget* bbGetWindow() { return bbmWindow; }
+    void bbSetWindow(Wt::WContainerWidget*) ;
+    bool bbWindowIsCreated() { return (bbGetWindow() != 0); }
+   // Wt::WApplication *createApplication(const Wt::WEnvironment& env);
+    //==================================================================    
+
+
+    //==================================================================    
+    virtual void bbShowWindow();
+    //==================================================================   
+    //==================================================================    
+    virtual void bbDestroyWindow();
+    //==================================================================    
+
+   void bbwtUpdateInputs();
+   void bbwtProcess();
+
+  private:
+    
+    Wt::WApplication* bbApp;
+    Wt::WContainerWidget* bbmWindow;
+  };
+  //=================================================================
+
+  //=================================================================
+  // WxBlackBoxDescriptor declaration
+  class WtBlackBoxDescriptor : public WidgetBlackBoxDescriptor<Wt::WContainerWidget>
+  BBTK_BEGIN_DESCRIBE_BLACK_BOX_BODY(WtBlackBox);
+  BBTK_NAME("WtBlackBox");
+  BBTK_END_DESCRIBE_BLACK_BOX(WtBlackBox);
+  //=================================================================
+
+
+} //namespace bbtk
+
+#endif  //__bbtkWxBlackBox_h__
+
+#endif  //USE_WXWIDGETS
index 69cfc4db3e24dbb42ec2a50c40046a7869d573b7..78848c1cef825e7d66fad5a5c6da2cbc90a38712 100644 (file)
@@ -71,7 +71,8 @@ namespace bbtk
   IMPLEMENT_APP_NO_MAIN(WxApp);
   //=========================================================================
   bool WxApp::OnInit( )
-  {     
+  {
+       std::cout<<"Testing OnINIT Wx ---- JFGA !!!DELETE ME!!! bbtkWx"<<std::endl;      
     wxApp::OnInit();
 #ifdef __WXGTK__
     //See http://www.wxwindows.org/faqgtk.htm#locale
@@ -84,6 +85,8 @@ namespace bbtk
   //=========================================================================
   void Wx::CreateWxAppIfNeeded()
   {
+
+               std::cout<<"Testing CreateWxAppIfNeeded --- DELETE ME ----"<<std::endl;
     if (wxApp::GetInstance()==0)
       {
        if (mgWxApp != 0) 
index b436a6a7fbbd1ddff8ca356e7e8ff3f3a6420a29..22f0a6baf910f7859f156803d2afe8857cc7c934 100644 (file)
@@ -77,7 +77,7 @@ namespace bbtk
   BEGIN_EVENT_TABLE(WxFrame, wxFrame)
   //  EVT_CLOSE(WxFrame::OnCloseWindow)
     END_EVENT_TABLE();
-     //==================================================================
+     //==========================================Window  ========================
   
      //==================================================================
   WxFrame::WxFrame(WxBlackBox::Pointer b,
@@ -144,7 +144,7 @@ namespace bbtk
     }
    //==================================================================
 
-  //=========================================================================
+  //====================================================SetWin=====================
   // WxDialog
   //=========================================================================
 
@@ -191,6 +191,7 @@ namespace bbtk
              ),
     mBox(b)
   {
+               
     bbtkDebugMessage("widget",9,"WxDialog::WxDialog ["<<b->bbGetName()<<"]"
                     <<std::endl);
     Wx::IncNbWindowsAlive();
@@ -239,7 +240,7 @@ namespace bbtk
   void WxBlackBox::bbUserSetDefaultValues()
   {
     bbtkBlackBoxDebugMessage("widget",5,"WxBlackBox::bbUserSetDefaultValues()"<<std::endl);
-    bbmWindow = 0;
+    bbmWindow = 0;  
   }
   //=========================================================================
 
@@ -296,6 +297,8 @@ namespace bbtk
                     wxSize( bbGetInputWinWidth() , 
                             bbGetInputWinHeight() ) );
     w->Show();
+
+
    }
 
   //==================================================================    
@@ -305,9 +308,9 @@ namespace bbtk
   {
     bbtkBlackBoxDebugMessage("widget",9,"==> WxBlackBox::bbSetWindow("<<w<<")"<<std::endl);
     if ((bbmWindow != 0)&&(w!=0)) 
-      { 
-       std::cout << "ERRRRRRRROOOOR"<<std::endl; 
-      }
+       
+               std::cout << "WxBlackBox::bbSetWindow   ?? EED ?? ERRRRRRRROOOOR"<<std::endl; 
+       }
     bbmWindow = w;
   }
   //==================================================================    
@@ -323,12 +326,14 @@ namespace bbtk
          {
            ((WxDialog*)bbmWindow)->ShowModal();
          }
-       else
+       else    
          {
            bbGetWindow()->Show();
            bbSetShown(true);
          } 
-      }
+      } // if
+
+
   }
   //==================================================================    
 
index 2b86b393e8982102555756ec590573b6a9cf817d..07e15f40ecbc91fa49132fb7b9f6abdca880b25c 100644 (file)
@@ -39,6 +39,13 @@ ADD_SUBDIRECTORY(appli)
 ADD_SUBDIRECTORY(gdcmvtk)
 
 
+
+
+
+IF(BBTK_USE_WT)
+  ADD_SUBDIRECTORY(wt)
+ENDIF(BBTK_USE_WT)
+
 IF(BBTK_USE_KWWIDGETS)
   ADD_SUBDIRECTORY(kw)
 ENDIF(BBTK_USE_KWWIDGETS)
index f5536350f170c2b0b4b717ebd422d960ce29ed98..f8d3b5c10766b0cb645d05b0401ebfe89c058979 100644 (file)
@@ -83,6 +83,10 @@ namespace bbitk
                        <<bbtk::TypeName<itkImageType>()
                        <<">()"<<std::endl);
 
+    std::cout<<"bbitk::ImageWriter::Write<"
+                       <<bbtk::TypeName<itkImageType>()
+                       <<">()"<<std::endl;
+
     typedef itk::ImageFileWriter< itkImageType > itkWriterType;
     typename itkWriterType::Pointer writer = itkWriterType::New();
     writer->SetInput(bbGetInputIn().unsafe_get<const itkImageType*>());
diff --git a/packages/std/src/bbstdGetBBTKinfo.cxx b/packages/std/src/bbstdGetBBTKinfo.cxx
new file mode 100644 (file)
index 0000000..ff99d44
--- /dev/null
@@ -0,0 +1,72 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#include "bbstdGetBBTKinfo.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,GetBBTKinfo)
+BBTK_BLACK_BOX_IMPLEMENTATION(GetBBTKinfo,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void GetBBTKinfo::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+//    bbSetOutputOut( bbGetInputIn() );
+//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+     bbSetOutputExecPath( bbtk::Utilities::GetExecutablePath() );
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void GetBBTKinfo::bbUserSetDefaultValues()
+{
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+//   bbSetInputIn(0);
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void GetBBTKinfo::bbUserInitializeProcessing()
+{
+
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void GetBBTKinfo::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbstd
+
+
diff --git a/packages/std/src/bbstdGetBBTKinfo.h b/packages/std/src/bbstdGetBBTKinfo.h
new file mode 100644 (file)
index 0000000..252dcc2
--- /dev/null
@@ -0,0 +1,45 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbstdGetBBTKinfo_h_INCLUDED__
+#define __bbstdGetBBTKinfo_h_INCLUDED__
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT GetBBTKinfo
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(GetBBTKinfo,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+//  BBTK_DECLARE_INPUT(In,double);
+  BBTK_DECLARE_OUTPUT(ExecPath,std::string);
+  BBTK_PROCESS(Process);
+  void Process();
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(GetBBTKinfo,bbtk::AtomicBlackBox);
+  BBTK_NAME("GetBBTKinfo");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("No Description.");
+  BBTK_CATEGORY("empty");
+//  BBTK_INPUT(GetBBTKinfo,In,"First input",double,"");
+  BBTK_OUTPUT(GetBBTKinfo,ExecPath,"Executable path",std::string,"");
+BBTK_END_DESCRIBE_BLACK_BOX(GetBBTKinfo);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+}
+// EO namespace bbstd
+
+#endif // __bbstdGetBBTKinfo_h_INCLUDED__
+
diff --git a/packages/std/src/bbstdRandomString.cxx b/packages/std/src/bbstdRandomString.cxx
new file mode 100644 (file)
index 0000000..c9d9ac3
--- /dev/null
@@ -0,0 +1,95 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#include "bbstdRandomString.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,RandomString)
+BBTK_BLACK_BOX_IMPLEMENTATION(RandomString,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+
+
+static const char alphanum[] =
+"0123456789"
+//"!@#$%^&*"
+"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+"abcdefghijklmnopqrstuvwxyz";
+
+
+char genRandom()
+{
+}
+
+
+void RandomString::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+//    bbSetOutputOut( bbGetInputIn() );
+//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+    int stringLength = sizeof(alphanum) - 1;
+    srand(time(0));
+    std::string STR;
+    for(unsigned int i = 0; i < 8; ++i)
+    {
+           STR += alphanum[rand() % stringLength];
+    }
+        bbSetOutputOut( STR );
+printf("EED RandomString::Process randomString=%s\n",STR.c_str());
+}
+
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void RandomString::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+//   bbSetInputIn(0);
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void RandomString::bbUserInitializeProcessing()
+{
+
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void RandomString::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbstd
+
+
diff --git a/packages/std/src/bbstdRandomString.h b/packages/std/src/bbstdRandomString.h
new file mode 100644 (file)
index 0000000..ec81a6b
--- /dev/null
@@ -0,0 +1,45 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbstdRandomString_h_INCLUDED__
+#define __bbstdRandomString_h_INCLUDED__
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT RandomString
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(RandomString,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+//  BBTK_DECLARE_INPUT(In,double);
+  BBTK_DECLARE_OUTPUT(Out,std::string);
+  BBTK_PROCESS(Process);
+  void Process();
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(RandomString,bbtk::AtomicBlackBox);
+  BBTK_NAME("RandomString");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("No Description.");
+  BBTK_CATEGORY("empty");
+//  BBTK_INPUT(RandomString,In,"First input",double,"");
+  BBTK_OUTPUT(RandomString,Out,"Output random string [8]",std::string,"");
+BBTK_END_DESCRIBE_BLACK_BOX(RandomString);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+}
+// EO namespace bbstd
+
+#endif // __bbstdRandomString_h_INCLUDED__
+
index 71e0a5d686a118276c6723aa24ba4a2ccd2472c5..43787670b45d8cfbb570b2a61eb15979502f8b95 100644 (file)
@@ -14,6 +14,9 @@
 <input name="In" type="vtkPolyData*" description="Input mesh" />
  
  <process><PRE>
+
+     printf("EED PolyDataWriter::Process() %s\n", bbGetInputFilename().c_str());
+
    vtkPolyDataWriter* w = vtkPolyDataWriter::New();
    bbGetInputIn()->Update();
    w->SetInput(bbGetInputIn());
index 5181d61aa705ca6895498b606af0bf4d36f76cff..bca2a1cd037694130ae608e99478bf6a796f67ce 100755 (executable)
@@ -120,7 +120,6 @@ void PolyDataWriterPlus::Process()
                writer->Delete();
        }
 
-
        std::cout << "Saving Ok!" << std::endl;
 
        InvokeEvent(OBS_POST_WRITER_1);
index 0b7297e9db95571338e3538e589d0809f08cb907..e681ab8c01fa737e45f38c588c273ca6efff7c0e 100644 (file)
@@ -242,6 +242,7 @@ namespace bbwx
                                        bbGetInputReactiveOnKeystroke()
                                        );
     bbSetOutputWidget( w );
+
   }
   
 
index e66a06a432836e787a2b724a35d94186747d312e..e600f89ef99e174dfddc30d98250bab711a094fe 100644 (file)
@@ -99,7 +99,7 @@ namespace bbwx
     BBTK_BLACK_BOX_INTERFACE(CheckBox,bbtk::WxBlackBox);
     BBTK_DECLARE_INPUT(In,bool);
     BBTK_DECLARE_INPUT(Title,std::string);
-       BBTK_DECLARE_INPUT(ReactiveOnKeystroke,int);
+    BBTK_DECLARE_INPUT(ReactiveOnKeystroke,int);
     BBTK_DECLARE_OUTPUT(Out,bool);
     BBTK_PROCESS(Process);
     BBTK_CREATE_WIDGET(CreateWidget);
index e76d44f4d54443769211b03cf167c709b15d7eae..234a0e6c2444949c38f7fa14a22ec1b3207661f0 100644 (file)
@@ -28,6 +28,8 @@ namespace bbwx
        ~ComboBoxWidget();
 
        void OnComboBox(wxEvent& event);
+       void FillItems( int iSelection, std::vector< std::string > lstIn);
+
 
   private:
     int                                mTypeForm;
@@ -84,7 +86,7 @@ namespace bbwx
                        Connect( wxlistbox->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox ); 
                for (i=0;i<lstIn.size(); i++)
                {
-                       wxlistbox->Append(  bbtk::std2wx( lstIn[i] )  ); 
+                               wxlistbox->Append(  bbtk::std2wx( lstIn[i] )  ); 
                        } // for i
                wxlistbox->SetSelection(iSelection);
                   sizer->Add( wxlistbox,1,wxGROW ); 
@@ -95,7 +97,7 @@ namespace bbwx
                        Connect( wxchoice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox ); 
                for (i=0;i<lstIn.size(); i++)
                {
-                       wxchoice->Append(  bbtk::std2wx( lstIn[i] )  ); 
+                               wxchoice->Append(  bbtk::std2wx( lstIn[i] )  ); 
                        } // for i
                wxchoice->SetSelection(iSelection);
                   sizer->Add( wxchoice,1,wxGROW ); 
@@ -130,6 +132,30 @@ namespace bbwx
     mBox->bbSignalOutputModification("OutString");
   }
 
+//--------------------------------------------------------------------------
+  void ComboBoxWidget::FillItems(
+               int iSelection,
+               std::vector< std::string > lstIn
+       )
+       {
+               int i;
+               if (mTypeForm==1)
+               {
+                       wxlistbox->Clear();
+               for (i=0;i<lstIn.size(); i++)
+               {
+                               wxlistbox->Append(  bbtk::std2wx( lstIn[i] )  ); 
+                       } // for i
+               wxlistbox->SetSelection(iSelection);
+               } else {
+                       wxchoice->Clear();
+               for (i=0;i<lstIn.size(); i++)
+               {
+                               wxchoice->Append(  bbtk::std2wx( lstIn[i] )  ); 
+                       } // for i
+               wxchoice->SetSelection(iSelection);
+               } // if
+       } 
 
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ComboBox)
 BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,bbtk::WxBlackBox);
@@ -138,7 +164,10 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,bbtk::WxBlackBox);
 //===== 
 void ComboBox::Process()
 {
+               ComboBoxWidget *w = (ComboBoxWidget*)bbGetOutputWidget();
+               w->FillItems( bbGetInputSelection(),bbGetInputIn() );
 }
+
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
index 2809ed26a64d386b824291554ecf56a3e86bcaa4..69a8b1f608ee29170f6694b9b98d9c82dfebfcb3 100644 (file)
@@ -23,7 +23,6 @@ namespace bbwx
 //===== 
   void StaticBox::CreateWidget(wxWindow* parent)
   {
-    std::cout << "creating..." << std::endl;
     wxPanel *w=new wxPanel(
       parent, //bbGetWxParent(),
       -1
@@ -56,7 +55,6 @@ namespace bbwx
   {
     bbSetInputBoxTitle("");
     bbSetInputBoxContent(NULL);
-    std::cout << "initialized"<<std::endl;
   }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)