]> Creatis software - bbtkGEditor.git/commitdiff
This commit was manufactured by cvs2svn to create tag 'CREATOOLS_2-0-3'. CREATOOLS_2-0-3
authorcvs2git <>
Tue, 24 Apr 2012 12:45:16 +0000 (12:45 +0000)
committercvs2git <>
Tue, 24 Apr 2012 12:45:16 +0000 (12:45 +0000)
Sprout from v1_0_0_t1 2012-04-24 12:45:15 UTC cvs2git 'This commit was manufactured by cvs2svn to create branch 'v1_0_0_t1'.'
Cherrypick from master 2010-10-05 21:58:09 UTC davila '*** empty log message ***':
    CMakeLists.txt
    appli/CMakeLists.txt
    appli/bbEditor/CMakeLists.txt
    appli/bbEditor/bbEditor.cxx
    data/icons/wxart_box.xpm
    doc/CMakeLists.txt
    install/CMakeLists.txt
    lib/CMakeLists.txt
    lib/EditorGraphicBBS/CMakeLists.txt
    lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx
    lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
    lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx
    lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h
    lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/GObjectsMVCFactory.cxx
    lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx
    lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
    lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
    lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx
    lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx
    lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h
    lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
    lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h
    lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx
    lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h
Delete:
    .project
    data/icons/wxart_executablebox.xpm

26 files changed:
.project [deleted file]
CMakeLists.txt
appli/CMakeLists.txt
appli/bbEditor/CMakeLists.txt
appli/bbEditor/bbEditor.cxx
data/icons/wxart_box.xpm
data/icons/wxart_executablebox.xpm [deleted file]
doc/CMakeLists.txt
install/CMakeLists.txt
lib/CMakeLists.txt
lib/EditorGraphicBBS/CMakeLists.txt
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/GObjectsMVCFactory.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h

diff --git a/.project b/.project
deleted file mode 100644 (file)
index a584654..0000000
--- a/.project
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>bbtkGEditor</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-       </buildSpec>
-       <natures>
-       </natures>
-</projectDescription>
index 0ca78e894d8c213732c5fa6ec64e66535e901972..fed56e695b6f73581f3efd4fc3a2b0964f976fd9 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Unless you are an experimented cmake user,
 # have a look at :
-# http://www.creatis.insa-lyon.fr/site/fr/CreatoosGettingStarted-v2.0.X
+# http://www.creatis.insa-lyon.fr/creatools/GettingStarted_creaTools
 # before starting.
 #
 # ---------------------------------
@@ -25,9 +25,6 @@ SET(PROJECT_VERSION_DATE "30/09/2009")
 
 #==================================
 
-# JPR 4 mars 2011
-set (CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake/Module)
-
 #==================================
 # Find crea (mandatory, to use macros)
 SET(CREA_VERBOSE_CMAKE TRUE)
@@ -37,6 +34,27 @@ IF (crea_FOUND)
 ENDIF(crea_FOUND)
 #==================================
 
+#==================================
+FIND_PACKAGE(creaMaracasVisu REQUIRED)
+IF (creaMaracasVisu_FOUND)
+  INCLUDE(${creaMaracasVisu_USE_FILE})
+ENDIF(creaMaracasVisu_FOUND)
+#==================================
+
+
+#==================================
+# Find and use the Black Box Toolkit
+# Search BBTK
+FIND_PACKAGE(BBTK REQUIRED)
+MARK_AS_ADVANCED(BBTK_DIR)
+# If bbtk found
+IF(BBTK_FOUND)
+  INCLUDE(${BBTK_USE_FILE})
+ENDIF(BBTK_FOUND)
+#==================================
+
+
+
 
 #==================================
 # Do not allow to build inside the source tree
@@ -74,26 +92,6 @@ SET(USE_BOOST     ON)
 CREA_FIND_AND_USE_LIBRARIES()
 #==================================
 
-
-#==================================
-FIND_PACKAGE(creaMaracasVisu REQUIRED)
-IF (creaMaracasVisu_FOUND)
-  INCLUDE(${creaMaracasVisu_USE_FILE})
-ENDIF(creaMaracasVisu_FOUND)
-#==================================
-
-#==================================
-# Find and use the Black Box Toolkit
-# Search BBTK
-FIND_PACKAGE(BBTK REQUIRED)
-MARK_AS_ADVANCED(BBTK_DIR)
-# If bbtk found
-IF(BBTK_FOUND)
-  INCLUDE(${BBTK_USE_FILE})
-ENDIF(BBTK_FOUND)
-#==================================
-
-
 #==================================
 # Where to put executables and libs
 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
@@ -110,7 +108,8 @@ MARK_AS_ADVANCED(
   INCLUDE_DIRECTORIES(
     ${PROJECT_BINARY_DIR}
 
- # USER! : Add here the directories holding the .h you need  
+ # // if the previous one is not enough :  (JPRx)
+ #   Add here the directories holding the .h you need
     
  #   ${PROJECT_SOURCE_DIR}/lib/_YOUR_OWN_LIBRARY_SOURCE_DIRECTORY_
  
@@ -130,10 +129,10 @@ SET(BBTK_DOC_BUILD_PATH
    )
 #==================================
 
-# ADD_SUBDIRECTORY
-ADD_SUBDIRECTORY(lib)
-ADD_SUBDIRECTORY(appli)
-ADD_SUBDIRECTORY(doc)
-ADD_SUBDIRECTORY(data)
-ADD_SUBDIRECTORY(install)
+# Subdirs
+SUBDIRS(lib)
+SUBDIRS(appli)
+SUBDIRS(doc)
+SUBDIRS(data)
+SUBDIRS(install)
 #==================================
index 1e300a1eafa8269f041013d7e97118e236d4f782..3c34554deb639345138f1a78580f408a27d93582 100644 (file)
@@ -1,3 +1,3 @@
-# Add a ADD_SUBDIRECTORY command for each of your applications
-# ADD_SUBDIRECTORY(MyApp1)
-ADD_SUBDIRECTORY(bbEditor)
+# Add a SUBDIRS command for each of your applications
+# SUBDIRS(MyApp1)
+SUBDIRS(bbEditor)
index d4966aa249a1d9ef5f39c33fad466025cf6734f4..06762ffbee034399a274f47bcc84994f17569191 100644 (file)
@@ -23,15 +23,14 @@ ENDIF(BBTK_USE_WXWIDGETS AND WIN32)
 
  
 TARGET_LINK_LIBRARIES(bbEditor 
-                               ${WXWIDGETS_LIBRARIES}
-                               ${VTK_LIBRARIES} 
                                crea
-                               ${creaMaracasVisu_LIBRARIES} 
                                bbsWxGUIEditorGraphic
                                bbsKernelEditorGraphic
                                bbsVtkGUIEditorGraphic
-                               ${BBTK_LIBRARIES}
+                               ${VTK_LIBRARIES} 
                                ${WXWIDGETS_LIBRARIES}
+                               ${creaMaracasVisu_LIBRARIES} 
+                               ${BBTK_LIBRARIES}
                        )
 
 INSTALL_TARGETS(/bin/ bbEditor)
index efd01236d554b0d38a8b086e62f5bc19479c45b4..ca584671744db6168b083f3fcbedb16c6a29912b 100644 (file)
@@ -6,20 +6,21 @@
 
 #include "bbtkwxGUIEditorGraphicBBS.h"
 
-#include <wx/cmdline.h>
+#include <wx/cmdline.h> 
 #include <wx/app.h>
 #include <wx/sysopt.h>
-
 class wxBBEditorApp : public wxApp
 {
 public:
-  bool OnInit( );
+  bool OnInit( ); 
   int  OnExit() { return true; }
-};
 
+};
+  
 IMPLEMENT_APP(wxBBEditorApp);
-
-
 
 // ----------------------------------------------------------------------------
 // The `main program' equivalent, creating the windows and returning the
@@ -37,31 +38,28 @@ bool wxBBEditorApp::OnInit( )
   setlocale(LC_NUMERIC, "C");
 #endif
 
-       bbtk::wxGUIEditorGraphicBBS *iegbbs;
-printf("EED wxBBEditorApp::OnInit 0\n");
+       bbtk::wxGUIEditorGraphicBBS *iegbbs; 
        iegbbs = new bbtk::wxGUIEditorGraphicBBS(NULL);
-printf("EED wxBBEditorApp::OnInit 1\n");
-       SetTopWindow(iegbbs);
+       SetTopWindow(iegbbs);  
        iegbbs->Show(true);
-printf("EED wxBBEditorApp::OnInit 2\n");
 
        return true;
 }
 
 
-#if defined(_WIN32)
+#if defined(_WIN32) 
 
 //  How to have a Console and wxWidgets
 //  http://www.wxwidgets.org/wiki/index.php/MSVC_Setup_Guide
-//   In Visual C++ 6 (7 should be similar), to create an application that is both a console application
-//  (cout's to the console are visible) and has a wxWidgets GUI,
+//   In Visual C++ 6 (7 should be similar), to create an application that is both a console application 
+//  (cout's to the console are visible) and has a wxWidgets GUI, 
 //  you need to use the linker option "/subsystem:console" and the following code:
 int main(int argc, char* argv[])
 {
        return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
 }
 
-#endif // defined(_WIN32)
+#endif // defined(_WIN32) 
 
 
 #else
@@ -70,7 +68,7 @@ int main(int argc, char* argv[])
 //==========================================================================
 #include <iostream>
 int main(int argc, char* argv[])
-{
+{  
   std::cout << "bbStudio was not compiled with wxWidgets : ciao !" <<std::endl;
   return 0;
 }
index 7097f1b43d440518307f31fe375b7ba87e399164..ee55287e791b0efb15576bc35f4c0d23b097c216 100644 (file)
@@ -1,5 +1,5 @@
 /* XPM */
-static const char * box_xpm[] = {
+static char * box_xpm[] = {
 "17 15 14 1",
 "      c None",
 ".     c #101010",
diff --git a/data/icons/wxart_executablebox.xpm b/data/icons/wxart_executablebox.xpm
deleted file mode 100644 (file)
index 12e36fa..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static const char *executablebox_xpm[] = {
-"17 15 2 1",
-"      c None",
-".     c #000000",
-"                 ",
-"        .....    ",
-"       ......    ",
-"      ..         ",
-"      ..         ",
-"     ..          ",
-"    .......      ",
-"    ..      .. . ",
-"   ..        ..  ",
-"   ........  ..  ",
-"   ........ .... ",
-"                 ",
-"                 ",
-"                 ",
-"                 "};
index 7becfcfd811fefa746e79306972af1ee99ff71f3..2f9447ea5898557344e63cf5fcd95c48f1fc44dc 100644 (file)
@@ -3,7 +3,7 @@
 #-----------------------------------------------------------------------------
 IF(BUILD_${PROJECT_NAME}_DOC AND BUILD_${PROJECT_NAME}_DOC_DOXYGEN)
   INCLUDE(../cmake/UserBuildDoxygenDoc.cmake)
-  ADD_SUBDIRECTORY(UserDoxygen)
+  SUBDIRS(UserDoxygen)
 ENDIF(BUILD_${PROJECT_NAME}_DOC AND BUILD_${PROJECT_NAME}_DOC_DOXYGEN)
 #-----------------------------------------------------------------------------
 
@@ -29,7 +29,7 @@ ENDIF(BUILD_${PROJECT_NAME}_DOC AND BUILD_${PROJECT_NAME}_DOC_GUIDES_HTML)
 
 #-----------------------------------------------------------------------------
 IF(BUILD_${PROJECT_NAME}_DOC AND BUILD_${PROJECT_NAME}_DOC_GUIDES_PDF OR BUILD_${PROJECT_NAME}_DOC_GUIDES_HTML)  
-  ADD_SUBDIRECTORY(UserDocumentation)  
+  SUBDIRS(UserDocumentation)  
 ENDIF(BUILD_${PROJECT_NAME}_DOC AND BUILD_${PROJECT_NAME}_DOC_GUIDES_PDF OR BUILD_${PROJECT_NAME}_DOC_GUIDES_HTML)
 #-----------------------------------------------------------------------------
 # Web site 
@@ -69,7 +69,7 @@ IF(BUILD_${PROJECT_NAME}_DOC)
     ) 
 
   # Recurse it bbtkWebSite dir
-  ADD_SUBDIRECTORY(template_WebSite)
+  SUBDIRS(template_WebSite)
 
 
 
index 3607f0b17150df0d53d55a6c55b24a397ae5a110..6a9c435ac5e02ab29a3a0865f1d35f85e547628f 100644 (file)
@@ -1,29 +1,22 @@
-
-
 #-----------------------------------------------------------------------------
 # INSTALL FILES
 #-----------------------------------------------------------------------------
-
-## EED ...files not needed and installen in the wrong place...
-
-#SET(DATA_DIR ${PROJECT_SOURCE_DIR}/data )
-#FILE(GLOB DATA_FILES "${DATA_DIR}/*.*")
-#FOREACH( iLST  ${DATA_FILES} )
-#   INSTALL( 
-#       FILES ${iLST}
-#       DESTINATION bin/data
-#   )
-#ENDFOREACH(iLST)
-#SET(DATA_DIR ${PROJECT_SOURCE_DIR}/data/icons )
-#FILE(GLOB DATA_FILES "${DATA_DIR}/*.*")
-#FOREACH( iLST  ${DATA_FILES} )
-#   INSTALL( 
-#       FILES ${iLST}
-#       DESTINATION bin/data/icons
-#   )
-#ENDFOREACH(iLST)
-
-
+SET(DATA_DIR ${PROJECT_SOURCE_DIR}/data )
+FILE(GLOB DATA_FILES "${DATA_DIR}/*.*")
+FOREACH( iLST  ${DATA_FILES} )
+   INSTALL( 
+        FILES ${iLST}
+        DESTINATION bin/data
+   )
+ENDFOREACH(iLST)
+SET(DATA_DIR ${PROJECT_SOURCE_DIR}/data/icons )
+FILE(GLOB DATA_FILES "${DATA_DIR}/*.*")
+FOREACH( iLST  ${DATA_FILES} )
+   INSTALL( 
+        FILES ${iLST}
+        DESTINATION bin/data/icons
+   )
+ENDFOREACH(iLST)
 
 #-----------------------------------------------------------------------------
 
index 336110bde0d8af1330fa37ff78e38f1bf338fb94..246edf00961847070fd947a84028ee47231ea832 100644 (file)
@@ -1,4 +1,4 @@
-# Add a ADD_SUBDIRECTORY command for each of your libraries
-# ADD_SUBDIRECTORY(MyLib1)
-ADD_SUBDIRECTORY(EditorGraphicBBS)
+# Add a SUBDIRS command for each of your libraries
+# SUBDIRS(MyLib1)
+SUBDIRS(EditorGraphicBBS)
 
index 2af29d3f953f47ce7f5b8b0b0b95cf779ae92780..98f92c16a99c535eefbda00fb15340567004552d 100644 (file)
@@ -1,3 +1,3 @@
-ADD_SUBDIRECTORY(bbsKernelEditorGraphic)
-ADD_SUBDIRECTORY(bbsVtkGUIEditorGraphic)
-ADD_SUBDIRECTORY(bbsWxGUIEditorGraphic)
\ No newline at end of file
+SUBDIRS(bbsKernelEditorGraphic)
+SUBDIRS(bbsVtkGUIEditorGraphic)
+SUBDIRS(bbsWxGUIEditorGraphic)
\ No newline at end of file
index eebe523673a7c8bde7c15cf3693c9e640f811e1e..1d16dc16988d41150d7a499e7217cb98458cb364 100644 (file)
@@ -1,4 +1,4 @@
-/*=========================================================================
+/*=========================================================================                                                                               
 Program:   bbtk
 Module:    $RCSfile$
 Language:  C++
@@ -11,26 +11,26 @@ Version:   $Revision$
 * 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
+*  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.
+*  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 Class bbtk::GPortModel
+*  \file 
+*  \brief Class bbtk::GPortModel 
 */
 
 /****
@@ -46,7 +46,7 @@ namespace bbtk
 
        //=========================================================================
        GPortModel::GPortModel()
-       {
+       {               
                _parentBox = NULL;
                _portType=-1;
                _posInBox=0;
@@ -90,15 +90,15 @@ namespace bbtk
                }
 
                //Attribute '_posInBox' starts with value 0 and it represents the position of the port in the box from left to right
-               posX = xInic + (PORT_WIDTH/2) + _posInBox*1.1*PORT_WIDTH;
-
+               posX = xInic + (PORT_WIDTH/2) + _posInBox*1.6*PORT_WIDTH;
+               
                setInicPoint(posX,posY,posZ);
 
                posX=posX+PORT_WIDTH;
                posY=posY-PORT_HEIGHT;
 
-               setFinalPoint(posX,posY,posZ);
-
+               setFinalPoint(posX,posY,posZ);          
+               
        }
 
        //=========================================================================
@@ -116,11 +116,11 @@ namespace bbtk
        }
 
        //=========================================================================
-
+       
        std::string GPortModel::getStatusText()
        {
                std::string temp = "";
-
+               
                temp+=_bbtkName;
                if(isValueSet())
                {
@@ -149,7 +149,7 @@ namespace bbtk
        }
 
        //=========================================================================
-
+       
        void GPortModel::setConnected(bool value)
        {
                _isConnected=value;
@@ -173,7 +173,7 @@ namespace bbtk
        }
 
        //=========================================================================
-
+       
        std::string GPortModel::getValue()
        {
                return _value;
index a63a81397ff02ad47d4fdc286d813dc9b3c0dba6..a475fd4764f982a8ba60e2394af637476f0e6365 100644 (file)
@@ -61,10 +61,10 @@ namespace bbtk
        // Object dimensions
        const double BOX_HEIGHT                         =       10;
        const double BOX_WIDTH                          =       100;
-       const double PORT_HEIGHT                        =       1.8;
-       const double PORT_WIDTH                         =       2.8;
-       const double COMPLEXPORT_HEIGHT         =       8;
-       const double COMPLEXPORT_WIDTH          =       8;
+       const double PORT_HEIGHT                        =       3.8;
+       const double PORT_WIDTH                         =       3.8;
+       const double COMPLEXPORT_HEIGHT         =       6;
+       const double COMPLEXPORT_WIDTH          =       6;
 
        // Commands
        const int NO_COMMAND                            =       201;
@@ -162,7 +162,6 @@ namespace bbtk
        // GUI Id's
        const int ID_NEW                                                =       1000;
        const int ID_SAVE_AS_DIAGRAM                    =       1001;
-       const int ID_SAVE_DIAGRAM                               =       1015; //last DFCH
        const int ID_OPEN                                               =       1002;
        const int ID_RUN                                                =       1003;
        const int ID_DELETEALL                                  =       1004;
@@ -176,17 +175,9 @@ namespace bbtk
        const int ID_COPY_TO_COMPLEXDIAGRAM             =       1012;
        const int ID_BTNBOX                                             =       1013;
        const int ID_HELP_BBEDITOR                              =       1014;
-       const int ID_BTEXECUTABLEBOX                    =       1016; // EED
-       
-       const int wxID_NOTEBOOK                                 =       1017;  // EED updated
-       
-       const int ID_bbEditor_Tool_Menu_CreatePackage   =       1018;  // EED
-       const int ID_bbEditor_Tool_Menu_CreateBlackBox          =       1019;  // EED
-       const int ID_bbEditor_Tool_Menu_PlugPackage                     =       1020;  // EED
-       const int ID_bbEditor_Tool_Menu_EditConfig                      =       1021;  // EED
-       const int ID_bbEditor_Tool_Menu_ShowHTMLDoc                     =       1022;  // EED
-       const int ID_bbEditor_Tool_Menu_CreateIndex                     =       1023;  // EED
-       
+
+
+       const int wxID_NOTEBOOK                                 =       1013;
 }
 // namespace bbtk
 #endif
index ea07a9ae76c6fbdd76ad9e8d33246b338c27a35b..4dbbbedae0756badc45b963c919ec550c757dc85 100644 (file)
@@ -1,4 +1,4 @@
-/*=========================================================================
+/*=========================================================================                                                                               
 Program:   bbtk
 Module:    $RCSfile$
 Language:  C++
@@ -11,26 +11,26 @@ Version:   $Revision$
 * 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
+*  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.
+*  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 Class bbtk::vtkGBlackBoxView
+*  \file 
+*  \brief Class bbtk::vtkGBlackBoxView 
 */
 
 
@@ -42,7 +42,7 @@ namespace bbtk
 
        //=========================================================================
        vtkGBlackBoxView::vtkGBlackBoxView()
-       {
+       {                       
        }
 
        //=========================================================================
@@ -50,52 +50,13 @@ namespace bbtk
        {
        }
 
-       //=========================================================================
-    void vtkGBlackBoxView::update_X_Fin()
-    {
-               double xInic, yInic,zInic,xFin, yFin,zFin;
-               _model->getInicPoint(xInic,yInic,zInic);
-        double *bounds = _boxTextActor->GetBounds();
-               _model->getFinalPoint(xFin, yFin,zFin);
-
-               double xFin1,xFin2,xFin3;
-               // position referens from box name
-               xFin1 = xInic+(bounds[1]-bounds[0])/2 + 20;
-        xFin2=xFin1;
-        xFin3=xFin1;
-        // position referens from input ports
-        GBoxModel* gbm=(GBoxModel*)_model;
-               if ( gbm->getNumInputPorts()>0 )
-               {
-            GPortModel* gpm = gbm->getInputPort( gbm->getNumInputPorts()-1 );
-            double xpFin, ypFin, zpFin;
-            gpm->getFinalPoint(xpFin, ypFin, zpFin);
-            xFin2 = xpFin+1;
-        }
-        // position referens from output ports
-               if ( gbm->getNumOutputPorts()>0 )
-               {
-            GPortModel* gpm = gbm->getOutputPort( gbm->getNumOutputPorts()-1 );
-            double xpFin, ypFin, zpFin;
-            gpm->getFinalPoint(xpFin, ypFin, zpFin);
-            xFin3 = xpFin+2;
-        }
-        xFin=xFin1;
-        if (xFin2>xFin) xFin=xFin2;
-        if (xFin3>xFin) xFin=xFin3;
-               _model->setFinalPoint( xFin , yFin , zFin  );
-    }
-
        //=========================================================================
        void vtkGBlackBoxView::update(int idController,int command)
        {
                updateColors();
-
+               
                double xInic, yInic,zInic,xFin, yFin,zFin;
                _model->getInicPoint(xInic,yInic,zInic);
-
-               updatePositionTextActor(xInic, yInic,zInic);
-        update_X_Fin();
                _model->getFinalPoint(xFin, yFin,zFin);
 
                // RaC In the actual version, zInic=zFin=900
@@ -111,6 +72,8 @@ namespace bbtk
                _fillPolyMapper->Modified();
                //-----------
 
+               updatePositionTextActor(xInic, yInic,zInic);
+
                //-----------
                setRefreshWaiting();
        }
@@ -121,12 +84,12 @@ namespace bbtk
        {
 
                //------------
-               _pts                            = vtkPoints::New();
+               _pts                            = vtkPoints::New();     
                vtkCellArray *lines = vtkCellArray::New();
                vtkPolyData *_pd        = vtkPolyData::New();
                _borderPolyMapper       = vtkPolyDataMapper::New();
                _borderObjectActor      = vtkActor::New();
-
+                               
                _pts->SetNumberOfPoints(4);
 
                double xInic, yInic,zInic,xFin, yFin,zFin;
@@ -144,16 +107,16 @@ namespace bbtk
                _pts->SetPoint(1, xInic, yFin, zInic );
                _pts->SetPoint(2, 1000, 1000, 1000 );
                _pts->SetPoint(3, xFin, yInic, zFin );
-
-
-
+               
+               
+               
                lines->InsertNextCell(5);
                lines->InsertCellPoint(0);
                lines->InsertCellPoint(1);
                lines->InsertCellPoint(2);
                lines->InsertCellPoint(3);
                lines->InsertCellPoint(0);
-
+                       
                _pd->SetPoints( _pts );
                _pd->SetLines( lines );
 
@@ -161,7 +124,7 @@ namespace bbtk
                _borderObjectActor->SetMapper(_borderPolyMapper);
                _borderPolyMapper->Modified();
 
-
+               
                ///************************* FILL *************************
 
                vtkCellArray *strip = vtkCellArray::New();
@@ -177,7 +140,7 @@ namespace bbtk
                strip->InsertCellPoint(2);
                strip->InsertCellPoint(0);
                strip->InsertCellPoint(3);
-
+                       
                pdFill->SetPoints( _pts );
                pdFill->SetStrips( strip );
 
@@ -247,12 +210,12 @@ namespace bbtk
                                _borderObjectActor->GetProperty()->SetColor(BOXBORDER_NH_R,0.9,BOXBORDER_HIGHLIGHTED_B);
                                _fillObjectActor->GetProperty()->SetColor(BOXFILL_NH_R,0.9,BOXFILL_HIGHLIGHTED_B);
                        }
-
+                       
                }
                else if(_state==HIGHLIGHTED)
                {
                        _borderObjectActor->GetProperty()->SetLineWidth(2);
-
+                       
                        _borderObjectActor->GetProperty()->SetColor(BOXBORDER_HIGHLIGHTED_R,BOXBORDER_HIGHLIGHTED_G,BOXBORDER_HIGHLIGHTED_B);
                        _fillObjectActor->GetProperty()->SetColor(BOXFILL_HIGHLIGHTED_R,BOXFILL_HIGHLIGHTED_G,BOXFILL_HIGHLIGHTED_B);
                        _boxTextActor->GetTextProperty()->SetColor(BOXTEXT_HIGHLIGHTED_R,BOXTEXT_HIGHLIGHTED_G,BOXTEXT_HIGHLIGHTED_B);
index dcdbae7df602745aed541188abd66e0753e7e138..b17f19dbeca1e6274d8734885ef7f15d41f3a7ab 100644 (file)
@@ -1,4 +1,4 @@
-/*=========================================================================
+/*=========================================================================                                                                               
 Program:   bbtk
 Module:    $RCSfile$
 Language:  C++
@@ -11,28 +11,28 @@ Version:   $Revision$
 * 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
+*  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.
+*  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 Class bbtk::vtkGBlackBoxView : abstract black-box interface.
+*  \file 
+*  \brief Class bbtk::vtkGBlackBoxView : abstract black-box interface. 
 */
 
 /****
@@ -75,13 +75,13 @@ namespace bbtk
        class vtkGBlackBoxView : public vtkGBoxView
        {
 
-       public:
+       public: 
 
                //Constructors
                vtkGBlackBoxView();
                ~vtkGBlackBoxView();
-
-               //Public methods
+               
+               //Public methods                
 
        private:
 
@@ -94,7 +94,7 @@ namespace bbtk
        protected:
 
                //Protected Attributes
-
+               
                //Protected Methods
                virtual void addVtkActors();
                virtual void removeVtkActors();
@@ -102,8 +102,6 @@ namespace bbtk
 
                virtual void update(int idController,int command);
                virtual void updateColors();
-               virtual void update_X_Fin();
-
        };
 
 
index 0b299b8e9922f2559565e82451d45c7bd841f5f6..d495b72ea90ae4649dabc3d18b5465c5500b9ad6 100644 (file)
@@ -82,8 +82,6 @@ namespace bbtk
 
        void GObjectsMVCFactory :: destroyInstance()
        {
-               //FCY memory leaks
-               delete instance;
                instance=NULL;
        }
 
index 9604f1800fa3decb048f247f5ab29f3d3605bae4..c90562674f26061179807e75be2b6fc2fca652ee 100644 (file)
@@ -1,4 +1,4 @@
-/*=========================================================================
+/*=========================================================================                                                                               
 Program:   bbtk
 Module:    $RCSfile$
 Language:  C++
@@ -11,26 +11,26 @@ Version:   $Revision$
 * 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
+*  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.
+*  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 Class bbtk::InterpreterBBS
+*  \file 
+*  \brief Class bbtk::InterpreterBBS 
 */
 
 
@@ -53,14 +53,14 @@ namespace bbtk
        }
        //=========================================================================
 
-
-
+       
+       
        //=========================================================================
        InterpreterBBS::InterpreterBBS( wxVtkSceneManager* sceneManager, Factory::Pointer factory )
-       {
+       {               
                _factory                = factory;
                _sceneManager   = sceneManager;
-
+               
                _xGeneral               = -100;
                _yGeneral               = 100;
                _zGeneral               = 900;   //  ?????
@@ -71,34 +71,34 @@ printf("EED  InterpreterBBS::createGBlackBox 900-450\n");
                _countOutputs   = 0;
 
                bbtk::InterpreterVirtual::Init();
-
+               
        }
        //=========================================================================
 
-
+       
        //=========================================================================
        InterpreterBBS::~InterpreterBBS()
        {
        }
        //=========================================================================
-
-
+       
+       
        //=========================================================================
        /// Creates a new black box in current complex box
     void InterpreterBBS::commandNew( const std::string& boxType, const std::string& boxName) // virtual
        {
-               _yGeneral                               = _yGeneral - 30;
+               _yGeneral                               = _yGeneral - 30;               
                std::string packagename = _factory->GetPackageNameOfaBlackBox(boxType);
                int idBox                               = _sceneManager->createGBlackBox( 0,0, packagename ,boxType);
                _countBoxes++;
                double px                               = _xGeneral + (_countBoxes%2)*100;
                double py                               = _yGeneral;
-
-               _sceneManager->configGBlackBox(idBox, px,py,_zGeneral,boxName, false , px+100, py-10 , _zGeneral );
+               
+               _sceneManager->configGBlackBox(idBox, px,py,_zGeneral,boxName, false , px+100, py-10 , _zGeneral );             
        }
        //=========================================================================
 
-
+       
        //=========================================================================
        /// Connects the output boxOutput to the input boxInput
     void InterpreterBBS::commandConnection (const std::string &boxfrom,
@@ -109,99 +109,98 @@ printf("EED  InterpreterBBS::createGBlackBox 900-450\n");
                _sceneManager->configGConnetion( boxfrom,output,boxto,input);
        }
        //=========================================================================
-
-
+       
+       
        //=========================================================================
        void InterpreterBBS::commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string  &help)
        {
                double xIn      = -100+50+_countInputs*50;
-               double yIn      = 100;
-               double zIn      = 900;
+               double yIn      = 100; 
+               double zIn      = 900; 
                _sceneManager->configGComBoxInputOutputPort(true,name,xIn,yIn,zIn);
                _sceneManager->configGConnetion( name,name,box,input);
                _countInputs++;
-
-               printf("EED InterpreterBBS::commandInput  what to do with help information ..???? \n  ");
+               
+               printf("EED InterpreterBBS::commandInput  what to do with help information ..???? \n  ");               
        }
        //=========================================================================
-
+       
        //=========================================================================
        void InterpreterBBS::commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string  &help)
        {
-               _yGeneral       = _yGeneral - 30;
+               _yGeneral       = _yGeneral - 30;               
                double xIn      = -100+_countOutputs*30;
-               double yIn      = _yGeneral;
-               double zIn      = 900;
+               double yIn      = _yGeneral; 
+               double zIn      = 900; 
                _sceneManager->configGComBoxInputOutputPort(false,name,xIn,yIn,zIn);
                _sceneManager->configGConnetion( box,output,name,name);
                _countOutputs++;
-
-               printf("EED InterpreterBBS::commandInput  what to do with help information ..???? \n  ");
+               
+               printf("EED InterpreterBBS::commandInput  what to do with help information ..???? \n  ");               
        }
        //=========================================================================
-
-
+       
+       
        //=========================================================================
        /// sets the input of the box with the value
        void InterpreterBBS::commandSet(const std::string &box,const std::string &input,const std::string &value) // virtual
        {
                GBlackBoxModel *bbMod = (GBlackBoxModel *)_sceneManager->findGBox(box);
-               bbMod->setValueToInput(input,"\""+value+"\"");
+               bbMod->setValueToInput(input,"\""+value+"\"");                                  
        }
        //=========================================================================
+       
 
-
-       //=========================================================================
+       //=========================================================================     
        void InterpreterBBS::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual
        {
                _sceneManager->setComplexBox(true);
-               _sceneManager->SetCbName(name);
-               _sceneManager->SetCbPackageName(pack);
+
        }
        //=========================================================================
 
-
+       
        //=========================================================================
        void InterpreterBBS::commandEndDefine() // virtual
        {
        }
        //=========================================================================
-
-
+       
+       
        //=========================================================================
-       void InterpreterBBS::commandExec(const std::string &word) // virtual
+       void InterpreterBBS::commandExec(const std::string &word) // virtual 
        {
                GBlackBoxModel *bbMod = (GBlackBoxModel *)_sceneManager->findGBox(word);
-               bbMod->setExecutable(true);
+               bbMod->setExecutable(true);                             
        }
        //=========================================================================
-
+       
 
        //=========================================================================
-       void InterpreterBBS::commandAuthor(const std::string &author)  // virtual
+       void InterpreterBBS::commandAuthor(const std::string &author)  // virtual 
        {
-        _sceneManager->SetAuthor(author);
+               printf("EED InterpreterBBS::commandAuthor   Warning !!!!!  method not implemented.. \n");
        }
        //=========================================================================
-
+       
        //=========================================================================
        void InterpreterBBS::commandCategory(const std::string &categorytype)  // virtual
        {
-        _sceneManager->SetCategory(categorytype);
+               printf("EED InterpreterBBS::commandCategory   Warning !!!!!  method not implemented.. \n");
        }
        //=========================================================================
-
+       
        //=========================================================================
        void InterpreterBBS::commandDescription(const std::string &description)  // virtual
        {
-        _sceneManager->SetDescription(description);
+               printf("EED InterpreterBBS::commandDescription   Warning !!!!!  method not implemented.. \n");
        }
        //=========================================================================
-
-
-
-
-
+       
+       
+       
+       
+       
 }  // EO namespace bbtk
 
 // EOF
index e76f8bcecb98b8bf41302e20bafa3bc4df48d14c..f3f6a04d7e6e8624a984ff3240e38ea3541f9940 100644 (file)
@@ -1,37 +1,37 @@
 /*=========================================================================
- Program:   bbtk
- Module:    $RCSfile$
- Language:  C++
- Date:      $Date$
- Version:   $Revision$
- =========================================================================*/
+Program:   bbtk
+Module:    $RCSfile$
+Language:  C++
+Date:      $Date$
+Version:   $Revision$
+=========================================================================*/
 
 /* ---------------------------------------------------------------------
 
- * 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.
- * ------------------------------------------------------------------------ */
+* 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 Class bbtk::WxInterfaceEditorGraphicBBS .
- */
+*  \file
+*  \brief Class bbtk::WxInterfaceEditorGraphicBBS .
+*/
 
 #include "bbtkwxGUIEditorGraphicBBS.h"
 #include "creaWx.h"
 
 #include <InterpreterBBS.h>
 
-namespace bbtk {
-
-//=========================================================================
-wxGUIEditorGraphicBBS::wxGUIEditorGraphicBBS(wxFrame *parent) :
-                       wxFrame(parent, -1, _T("bbtkGEditor"), wxDefaultPosition, wxSize(
-                                       1200, 800)) {
-
-       _frameAUIMgr = new wxAuiManager(this);
-
-       /*std::string datadir( crea::System::GetExecutablePath() );
-        std::string datadir (".");
-        cout<<"RaC //------------------"<<endl;
-        cout<<"RaC //TODO wxGUIEditorGraphicBBS constructor.Initialize datadir with  crea::System::GetExecutablePath() ."<<endl;
-        cout<<"RaC //------------------"<<endl;
-
-        #ifdef LINUX // assume this is OSX
-        datadir=datadir+"/../share/creaContours";
-        #endif // MACOSX
-
-        #ifdef MACOSX // assume this is OSX
-        datadir=datadir+"/../../../../share/creaContours";
-        #endif // MACOSX
-
-        _dataDir = datadir;*/
-
-       initMenu();
-       initToolbar();
-       initTabPanelsManager();
-       initPackageBrowser();
-       initHelpHTMLBrowser();
-
-       CreateStatusBar();
-       _frameAUIMgr->Update();
-       _actualPkgBrowserBoxName = "";
-       _actualPkgBrowserPkgName = "";
-       refreshGUIControls();
-}
-
-//=========================================================================
-wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS() {
-       printf("EED %p ~wxGUIEditorGraphicBBS()\n", this);
-
-       //EED02JUIN2010         delete _tabsMgr;
-
-       _frameAUIMgr->UnInit();
-       // FCY memory leaks
-       delete _frameAUIMgr;
-       delete _notebook;
-       delete _tabsMgr;
-
-}
-
-//=========================================================================
-void wxGUIEditorGraphicBBS::initToolbar() {
-       wxBitmap bmp_new(new_xpm);
-       wxBitmap bmp_open(open_xpm);
-       wxBitmap bmp_save(save_xpm);
-       wxBitmap bmp_run(run_xpm);
-       wxBitmap bmp_delete(delete_xpm);
-       wxBitmap bmp_centerview(centerview_xpm);
-       wxBitmap bmp_box(box_xpm);
-       wxBitmap bmp_executablebox(executablebox_xpm);
-       wxBitmap bmp_complexbox(complexbox_xpm);
-       wxBitmap bmp_complexinputport(complexinputport_xpm);
-       wxBitmap bmp_complexoutputport(complexoutputport_xpm);
-
-       wxToolBar *toolbar = new wxToolBar(this, wxID_ANY);
-
-       //Adds a tool btn to the toolbar
-       toolbar->AddTool(ID_NEW, _T("New"), bmp_new, wxNullBitmap, wxITEM_NORMAL,
-                       _T("New tab"), _T("Create a new panel tab"));
-       toolbar->AddTool(ID_OPEN, _T("Open diagram"), bmp_open, wxNullBitmap,
-                       wxITEM_NORMAL, _T("Open a diagram"), _T("Open a diagram"));
-       toolbar->AddTool(ID_SAVE_DIAGRAM, _T("Save Diagram"), bmp_save,
-                       wxNullBitmap, wxITEM_NORMAL, _T("Saves the current diagram"),
-                       _T("Saves the current diagram")); //DFCH
-       //toolbar->AddTool(ID_SAVE_AS_DIAGRAM,_T("Save Diagram As"),bmp_save, wxNullBitmap, wxITEM_NORMAL,_T("Saves the current diagram"), _T("Saves the current diagram")); //DFCH
-       toolbar->AddTool(ID_RUN, _T("Run"), bmp_run, wxNullBitmap, wxITEM_NORMAL,
-                       _T("Execute actual diagram"), _T("Execute actual diagram"));
-       toolbar->AddTool(ID_DELETEALL, _T("Delete all"), bmp_delete, wxNullBitmap,
-                       wxITEM_NORMAL, _T("Delete all boxes"), _T("Delete all boxes"));
-       toolbar->AddTool(ID_CENTERVIEW, _T("Center view"), bmp_centerview,
-                       wxNullBitmap, wxITEM_NORMAL, _T("Center view"), _T("Center view"));
-       toolbar->AddSeparator();
-       toolbar->AddTool(ID_BTNBOX, _T("New Box"), bmp_box, wxNullBitmap,
-                       wxITEM_NORMAL, _T("New Box"), _T("Nex Box"));
-       toolbar->AddSeparator();
-       toolbar->AddTool(ID_BTEXECUTABLEBOX, _T("Select as executable Box"),
-                       bmp_executablebox, wxNullBitmap, wxITEM_NORMAL,
-                       _T("Select as executable Box"), _T("Select as executable Box"));
-       toolbar->AddSeparator();
-       toolbar->AddTool(ID_BTNCOMPLEXBOX, _T("Complex box"), complexbox_xpm,
-                       wxNullBitmap, wxITEM_NORMAL, _T("Complex box"), _T("Complex box"));
-       toolbar->SetToggle(ID_BTNCOMPLEXBOX, true);
-       toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT, _T("Add input to Complex box"),
-                       bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,
-                       _T("Add input to Complex box"), _T("Add input to Complex box"));
-       toolbar->AddTool(ID_ADDCOMPLEXBOXOUTPUT, _T("Add output to Complex box"),
-                       bmp_complexoutputport, wxNullBitmap, wxITEM_NORMAL,
-                       _T("Add output Complex box"), _T("Add output Complex box"));
-       toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT, false);
-       toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT, false);
-
-       toolbar->SetMargins(2, 2);
-       toolbar->Realize();
-       SetToolBar(toolbar);
-
-       // connect command event handlers
-       Connect(ID_NEW, wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
-       Connect(ID_OPEN, wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenDiagram));
-       Connect(ID_SAVE_DIAGRAM, wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram)); //DFCH
-       Connect(ID_SAVE_AS_DIAGRAM, wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveAsActualDiagram)); //DFCH
-       Connect(
-                       ID_RUN,
-                       wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram));
-       Connect(
-                       ID_DELETEALL,
-                       wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram));
-       Connect(
-                       ID_CENTERVIEW,
-                       wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram));
-       Connect(ID_BTNBOX, wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnBox));
-       Connect(
-                       ID_BTEXECUTABLEBOX,
-                       wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnExecutableBox));
-       Connect(ID_BTNCOMPLEXBOX, wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnComplexBox));
-       Connect(ID_ADDCOMPLEXBOXINPUT, wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxInput));
-       Connect(ID_ADDCOMPLEXBOXOUTPUT, wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxOutput));
-
-}
-//=========================================================================
-void wxGUIEditorGraphicBBS::initHelpHTMLBrowser() {
-       //TO FIX THE PATH OF BBTK BIN  IN ORDER TO USE REGENERATE EXECUTABLES
-       //RegenerateAll();
-       _helpHtmlBrowser = new WxGUIHtmlBrowser(this, wxSize(200, 0));
-       _frameAUIMgr->AddPane(_helpHtmlBrowser, wxAuiPaneInfo().Right().MinSize(
-                       200, 200));
-}
-
-//=========================================================================
-void wxGUIEditorGraphicBBS::initMenu() {
-       // Create File menu and its items
-       wxMenu *fileMenu = new wxMenu();
-       fileMenu->Append(ID_NEW, _T("New diagram"), _T("New"));
-       fileMenu->Append(ID_SAVE_DIAGRAM, _T("Save Diagram"), _T("Save Diagram")); //DFCH
-       fileMenu->Append(ID_SAVE_AS_DIAGRAM, _T("Save Diagram As"),
-                       _T("Save Diagram As")); //DFCH
-       fileMenu->Append(ID_OPEN_BBS, _T("Open BBS"), _T("Open BBS"));
-       fileMenu->Append(ID_SAVE_AS_BBS, _T("Save BBS"), _T("Save BBS"));
-       fileMenu->Append(ID_SAVE_AS_COMPLEXBOX, _T("Save complex box"),
-                       _T("Save complex box"));
-       fileMenu->Append(wxID_EXIT, _T("E&xit"), _T("Exit"));
-
-       Connect(ID_NEW, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
-       Connect(ID_SAVE_DIAGRAM, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram)); //DFCH
-       Connect(ID_SAVE_AS_DIAGRAM, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveAsActualDiagram));
-       Connect(ID_OPEN_BBS, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenBBS));
-       Connect(ID_SAVE_AS_BBS, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualBBS));
-       Connect(
-                       ID_SAVE_AS_COMPLEXBOX,
-                       wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualComplexBox));
-       Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExit));
-
-       // Create Help menu and its items
-       wxMenu *editMenu = new wxMenu;
-       editMenu->Append(ID_COPY_TO_COMPLEXDIAGRAM,
-                       _T("Copy selected to complex box"),
-                       _T("Creates a new complex box diagram with selected boxes"));
-
-       Connect(
-                       ID_COPY_TO_COMPLEXDIAGRAM,
-                       wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram));
-
-       // Create Help menu and its items
-       wxMenu *helpMenu = new wxMenu;
-       helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About"));
-       helpMenu->Append(ID_HELP_BBEDITOR, _T("&Help..."), _T("Help"));
-       Connect(ID_HELP_BBEDITOR, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnHelpBBeditor));
-
-       // Create Tool menu
-       wxMenu *menuTools = new wxMenu;
-       menuTools->Append(ID_bbEditor_Tool_Menu_CreatePackage,
-                       _T("Create &package") );
-       menuTools->Append(ID_bbEditor_Tool_Menu_CreateBlackBox,
-                       _T("Create &blackbox") );
-       menuTools->Append(ID_bbEditor_Tool_Menu_PlugPackage, _T("Plug package") );
-       menuTools->Append(ID_bbEditor_Tool_Menu_EditConfig, _T("&Edit bbtk config") );
-       menuTools->Append(ID_bbEditor_Tool_Menu_ShowHTMLDoc,
-                       _T("Show &HTML documentation") );
-       menuTools->Append(ID_bbEditor_Tool_Menu_CreateIndex, _T("&Generate index") );
-
-       Connect(ID_bbEditor_Tool_Menu_CreatePackage, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreatePackage));
-       Connect(ID_bbEditor_Tool_Menu_CreateBlackBox, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateBlackBox));
-       Connect(ID_bbEditor_Tool_Menu_PlugPackage, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnPlugPackage));
-       Connect(ID_bbEditor_Tool_Menu_EditConfig, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditConfig));
-       Connect(ID_bbEditor_Tool_Menu_ShowHTMLDoc, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnShowHTMLDoc));
-       Connect(ID_bbEditor_Tool_Menu_CreateIndex, wxEVT_COMMAND_MENU_SELECTED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateIndex));
-
-       // Append the created menu to the menu bar
-       wxMenuBar *menuBar = new wxMenuBar();
-       menuBar->Append(fileMenu, _T("&File") );
-       menuBar->Append(editMenu, _T("&Edit") );
-       menuBar->Append(menuTools, _T("&Tool") );
-       menuBar->Append(helpMenu, _T("&Help") );
-
-       // Attach this menu bar to the frame
-       SetMenuBar(menuBar);
-}
-
-//=========================================================================
-void wxGUIEditorGraphicBBS::initTabPanelsManager() {
-       _notebook = new wxAuiNotebook(this, wxID_NOTEBOOK, wxDefaultPosition,
-                       wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_MOVE
-                                       | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_FIXED_WIDTH
-                                       | wxAUI_NB_WINDOWLIST_BUTTON);
-       _tabsMgr = new wxTabPanelsManager(this);
-       _frameAUIMgr->AddPane(_notebook, wxAuiPaneInfo().CenterPane());
-
-}
-
-//=========================================================================
-void wxGUIEditorGraphicBBS::initPackageBrowser() {
-       _pkgBrowser = new WxGUIPackageBrowser2(this);
-       _pkgBrowser->IncludeAll();
-       _frameAUIMgr->AddPane(_pkgBrowser,
-                       wxAuiPaneInfo().Left().MinSize(200, 200).CloseButton(false));
-}
-
-//================================================================
-
-void wxGUIEditorGraphicBBS::DoRegeneratePackageDoc(const std::string& pack) {
-       std::string mess("Regenerating doc for package '");
-       if (pack != "-a") {
-               mess += pack + "'";
-       } else {
-               mess = "Regenerating doc for all packages";
-       }
-
-       mess += " ... please wait";
-
-       SetStatusText(std2wx(mess));
-
-       //BBTK_BUSY_CURSOR;
-
-       std::string command;
-#if defined(WIN32)
-       command = "\"";
-#endif
-       command += ConfigurationFile::GetInstance().Get_bin_path();
-       command += ConfigurationFile::GetInstance().Get_file_separator();
-       command += "bbRegeneratePackageDoc";
-#if defined(WIN32)
-       command += "\"";
-#endif
 
-       command += " " + pack + " -q";
-       bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
 
-       if (!system(command.c_str())) {
-               SetStatusText(_T("Done !"));
-               /*
-                wxMessageBox(_T("Done !"),_T("Regenerate package '")
-                +std2wx(pack)+_T("' doc"),
-                wxOK | wxICON_INFORMATION);
-                */
-       } else {
-               SetStatusText(_T("Done !"));
-               wxString err(_T("An error occured while running '"));
-               err += bbtk::std2wx(command) + _T("'");
-               wxMessageBox(err, _T("Regenerate package doc"), wxOK | wxICON_ERROR);
-       }
-}
-
-//================================================================
-void wxGUIEditorGraphicBBS::DoRegenerateBoxesLists() {
-       SetStatusText(_T("Regenerating boxes lists ... please wait"));
-       //BBTK_BUSY_CURSOR ;
-
-       std::string command;
-#if defined(WIN32)
-       command = "\"";
-#endif
-       command += ConfigurationFile::GetInstance().Get_bin_path();
-       command += ConfigurationFile::GetInstance().Get_file_separator();
-       command += "bbRegenerateBoxesLists";
+namespace bbtk
+{
+
+
+       //=========================================================================
+       wxGUIEditorGraphicBBS::wxGUIEditorGraphicBBS(wxFrame *parent)
+               : wxFrame(parent, -1, _T("bbtkGEditor"),wxDefaultPosition, wxSize(1200,800))
+       {
+
+               _frameAUIMgr = new wxAuiManager(this);
+
+
+               /*std::string datadir( crea::System::GetExecutablePath() );
+               std::string datadir (".");
+               cout<<"RaC //------------------"<<endl;
+               cout<<"RaC //TODO wxGUIEditorGraphicBBS constructor.Initialize datadir with  crea::System::GetExecutablePath() ."<<endl;
+               cout<<"RaC //------------------"<<endl;
+
+           #ifdef LINUX // assume this is OSX
+                  datadir=datadir+"/../share/creaContours";
+           #endif // MACOSX
+
+               #ifdef MACOSX // assume this is OSX
+                       datadir=datadir+"/../../../../share/creaContours";
+               #endif // MACOSX
+
+               _dataDir = datadir;*/
+
+               initMenu();
+               initToolbar();
+               initTabPanelsManager();
+               initPackageBrowser();
+               initHelpHTMLBrowser();
+
+               CreateStatusBar();
+               _frameAUIMgr->Update();
+               _actualPkgBrowserBoxName="";
+               _actualPkgBrowserPkgName="";
+               refreshGUIControls();
+       }
+
+
+       //=========================================================================
+       wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS()
+       {
+               printf ("EED %p ~wxGUIEditorGraphicBBS()\n" , this );
+
+//EED02JUIN2010                delete _tabsMgr;
+
+           _frameAUIMgr->UnInit();
+
+
+       }
+
+       //=========================================================================
+       void wxGUIEditorGraphicBBS::initToolbar()
+       {
+               wxBitmap bmp_new(new_xpm);
+               wxBitmap bmp_open(open_xpm);
+               wxBitmap bmp_save(save_xpm);
+               wxBitmap bmp_run(run_xpm);
+               wxBitmap bmp_delete(delete_xpm);
+               wxBitmap bmp_centerview(centerview_xpm);
+               wxBitmap bmp_box(box_xpm);
+               wxBitmap bmp_complexbox(complexbox_xpm);
+               wxBitmap bmp_complexinputport(complexinputport_xpm);
+               wxBitmap bmp_complexoutputport(complexoutputport_xpm);
+
+               wxToolBar  *toolbar = new wxToolBar(this, wxID_ANY);
+
+               //Adds a tool btn to the toolbar
+               toolbar->AddTool(ID_NEW,_T("New"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New tab"), _T("Create a new panel tab"));
+               toolbar->AddTool(ID_OPEN,_T("Open diagram"),bmp_open, wxNullBitmap, wxITEM_NORMAL,_T("Open a diagram"), _T("Open a diagram"));
+               toolbar->AddTool(ID_SAVE_AS_DIAGRAM,_T("Save diagram"),bmp_save, wxNullBitmap, wxITEM_NORMAL,_T("Saves actual diagram"), _T("Saves actual diagram"));
+               toolbar->AddTool(ID_RUN,_T("Run"),bmp_run, wxNullBitmap, wxITEM_NORMAL,_T("Execute actual diagram"), _T("Execute actual diagram"));
+               toolbar->AddTool(ID_DELETEALL,_T("Delete all"),bmp_delete, wxNullBitmap, wxITEM_NORMAL,_T("Delete all boxes"), _T("Delete all boxes"));
+               toolbar->AddTool(ID_CENTERVIEW,_T("Center view"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Center view"), _T("Center view"));
+               toolbar->AddSeparator();
+               toolbar->AddTool(ID_BTNBOX,_T("New Box"),bmp_box, wxNullBitmap, wxITEM_NORMAL,_T("New Box"), _T("Nex Box"));
+               toolbar->AddSeparator();
+               toolbar->AddTool(ID_BTNCOMPLEXBOX,_T("Complex box"),complexbox_xpm, wxNullBitmap, wxITEM_NORMAL,_T("Complex box"), _T("Complex box"));
+               toolbar->SetToggle(ID_BTNCOMPLEXBOX,true);
+               toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT,_T("Add input to Complex box"),bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,_T("Add input to Complex box"), _T("Add input to Complex box"));
+               toolbar->AddTool(ID_ADDCOMPLEXBOXOUTPUT,_T("Add output to Complex box"),bmp_complexoutputport, wxNullBitmap, wxITEM_NORMAL,_T("Add output Complex box"), _T("Add output Complex box"));
+               toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,false);
+               toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,false);
+
+               toolbar->SetMargins( 2, 2 );
+               toolbar->Realize();
+               SetToolBar(toolbar);
+
+               // connect command event handlers
+               Connect(ID_NEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
+               Connect(ID_OPEN,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenDiagram));
+               Connect(ID_SAVE_AS_DIAGRAM,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram));
+               Connect(ID_RUN,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram));
+               Connect(ID_DELETEALL,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram));
+               Connect(ID_CENTERVIEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram));
+               Connect(ID_BTNBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnBox));
+               Connect(ID_BTNCOMPLEXBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnComplexBox));
+               Connect(ID_ADDCOMPLEXBOXINPUT,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxInput));
+               Connect(ID_ADDCOMPLEXBOXOUTPUT,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxOutput));
+
+       }
+       //=========================================================================
+       void wxGUIEditorGraphicBBS::initHelpHTMLBrowser()
+       {
+               //TO FIX THE PATH OF BBTK BIN  IN ORDER TO USE REGENERATE EXECUTABLES
+               //RegenerateAll();
+               _helpHtmlBrowser = new WxGUIHtmlBrowser(this,wxSize(200,0));
+               _frameAUIMgr->AddPane(_helpHtmlBrowser,wxAuiPaneInfo().Right().MinSize(200,200));
+       }
+
+       //=========================================================================
+       void wxGUIEditorGraphicBBS::initMenu()
+       {
+               // Create File menu and its items
+               wxMenu *fileMenu = new wxMenu();
+               fileMenu->Append(ID_NEW, _T("New diagram"), _T("New"));
+               fileMenu->Append(ID_SAVE_AS_DIAGRAM, _T("Save diagram"), _T("Save diagram"));
+               fileMenu->Append(ID_OPEN_BBS, _T("Open BBS"), _T("Open BBS"));
+               fileMenu->Append(ID_SAVE_AS_BBS, _T("Save BBS"), _T("Save BBS"));
+               fileMenu->Append(ID_SAVE_AS_COMPLEXBOX, _T("Save complex box"), _T("Save complex box"));
+               fileMenu->Append(wxID_EXIT, _T("E&xit"), _T("Exit"));
+
+               Connect(ID_NEW,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
+               Connect(ID_SAVE_AS_DIAGRAM,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram));
+               Connect(ID_OPEN_BBS,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenBBS));
+               Connect(ID_SAVE_AS_BBS,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualBBS));
+               Connect(ID_SAVE_AS_COMPLEXBOX,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualComplexBox));
+               Connect(wxID_EXIT,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExit));
+
+               // Create Help menu and its items
+               wxMenu *editMenu = new wxMenu;
+               editMenu->Append(ID_COPY_TO_COMPLEXDIAGRAM, _T("Copy selected to complex box"), _T("Creates a new complex box diagram with selected boxes"));
+
+               Connect(ID_COPY_TO_COMPLEXDIAGRAM,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram));
+
+               // Create Help menu and its items
+               wxMenu *helpMenu = new wxMenu;
+               helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About"));
+               helpMenu->Append(ID_HELP_BBEDITOR, _T("&Help..."), _T("Help"));
+               Connect(ID_HELP_BBEDITOR,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnHelpBBeditor));
+
+               // Append the created menu to the menu bar
+               wxMenuBar *menuBar = new wxMenuBar();
+               menuBar->Append(fileMenu, _T("&File"));
+               menuBar->Append(editMenu, _T("&Edit"));
+               menuBar->Append(helpMenu, _T("&Help"));
+
+               // Attach this menu bar to the frame
+               SetMenuBar(menuBar);
+       }
+
+       //=========================================================================
+       void wxGUIEditorGraphicBBS::initTabPanelsManager()
+       {
+               _notebook = new wxAuiNotebook(this,wxID_NOTEBOOK,wxDefaultPosition,wxDefaultSize,wxAUI_NB_TOP|wxAUI_NB_TAB_MOVE|wxAUI_NB_CLOSE_ON_ACTIVE_TAB|wxAUI_NB_TAB_FIXED_WIDTH|wxAUI_NB_WINDOWLIST_BUTTON);
+               _tabsMgr = new wxTabPanelsManager(this);
+               _frameAUIMgr->AddPane(_notebook,wxAuiPaneInfo().CenterPane());
+
+       }
+
+       //=========================================================================
+       void wxGUIEditorGraphicBBS::initPackageBrowser()
+       {
+               _pkgBrowser = new WxGUIPackageBrowser2(this);
+               _pkgBrowser->IncludeAll();
+               _frameAUIMgr->AddPane(_pkgBrowser,wxAuiPaneInfo().Left().MinSize(200,200).CloseButton(false));
+       }
+
+       //================================================================
+
+       void wxGUIEditorGraphicBBS::DoRegeneratePackageDoc( const std::string& pack )
+       {
+               std::string mess("Regenerating doc for package '");
+               if (pack!="-a"){
+                       mess += pack + "'";
+               }
+               else
+               {
+                       mess = "Regenerating doc for all packages";
+               }
+
+               mess += " ... please wait";
+
+               SetStatusText( std2wx(mess) );
+
+               //BBTK_BUSY_CURSOR;
+
+               std::string command;
+               #if defined(WIN32)
+                       command = "\"";
+               #endif
+                       command += ConfigurationFile::GetInstance().Get_bin_path();
+                       command += ConfigurationFile::GetInstance().Get_file_separator();
+                       command += "bbRegeneratePackageDoc";
+               #if defined(WIN32)
+                       command += "\"";
+               #endif
+
+               command += " " + pack + " -q";
+           bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
+
+               if ( ! system ( command.c_str() ) )
+               {
+                       SetStatusText( _T("Done !"));
+                       /*
+                       wxMessageBox(_T("Done !"),_T("Regenerate package '")
+                                        +std2wx(pack)+_T("' doc"),
+                                        wxOK | wxICON_INFORMATION);
+                       */
+               }
+               else
+               {
+                       SetStatusText( _T("Done !"));
+                       wxString err(_T("An error occured while running '"));
+                       err +=  bbtk::std2wx(command) + _T("'");
+                       wxMessageBox(err,_T("Regenerate package doc"),wxOK | wxICON_ERROR);
+           }
+       }
+
+       //================================================================
+       void wxGUIEditorGraphicBBS::DoRegenerateBoxesLists()
+       {
+               SetStatusText( _T("Regenerating boxes lists ... please wait") );
+               //BBTK_BUSY_CURSOR ;
+
+               std::string command;
+               #if defined(WIN32)
+                       command = "\"";
+               #endif
+                       command += ConfigurationFile::GetInstance().Get_bin_path();
+                       command += ConfigurationFile::GetInstance().Get_file_separator();
+                       command += "bbRegenerateBoxesLists";
+
+               #if defined(WIN32)
+                       command += "\"";
+               #endif
+                       command += " -q";
+
+               bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
+
+               if ( ! system ( command.c_str() ) )
+               {
+                       SetStatusText( _T("Done !"));
+                       /*
+                       wxMessageBox(_T("Done !"),_T("Regenerate boxes lists"),
+                                        wxOK | wxICON_INFORMATION);
+                       */
+               }
+               else
+               {
+                       SetStatusText( _T("Done !"));
+                       wxString err(_T("An error occured while running '"));
+                       err +=  bbtk::std2wx(command) + _T("'");
+                       wxMessageBox(err,_T("Regenerate boxes lists"),wxOK | wxICON_ERROR);
+               }
+       }
+
+  //================================================================
+       void wxGUIEditorGraphicBBS::RegenerateAll()
+       {
+               DoRegeneratePackageDoc("-a");
+               DoRegenerateBoxesLists();
+       }
+
+       //================================================================
+
+       wxAuiNotebook* wxGUIEditorGraphicBBS::getAuiNotebook()
+       {
+               return _notebook;
+       }
+
+       //================================================================
+
+       void wxGUIEditorGraphicBBS::displayBlackBoxInfo(std::string packageName, std::string boxName)
+       {
+               if(_actualPkgBrowserPkgName != packageName || _actualPkgBrowserBoxName != boxName )
+               {
+                       _actualPkgBrowserPkgName = packageName;
+                       _actualPkgBrowserBoxName = boxName;
+
+                       BlackBoxDescriptor::Pointer descriptor = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxName);
+                       _pkgBrowser->WxGUIBlackBoxListUserOnSelected(descriptor.get());
+               }
+       }
+
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::editBlackBox(GBlackBoxModel *bbmodel)
+       {
+               wxBlackBoxEditionDialog* dialog = new wxBlackBoxEditionDialog(this,bbmodel);
+               dialog->Show();
+       }
+
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::updateStatusBar(std::string textStatus)
+       {
+               SetStatusText(crea::std2wx(textStatus));
+       }
+
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::executeScript(std::string script)
+       {
+               std::string separator = ConfigurationFile::GetInstance().Get_file_separator ();
+               std::string dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
+               std::string filename = dir + separator + "tmp_bbtk.bbs";
+
+               ofstream tempFile;
+               tempFile.open(filename.c_str());
+               tempFile << script;
+               tempFile.close();
+
+               std::string command = "\""+ crea::System::GetExecutablePath();
 
-#if defined(WIN32)
-       command += "\"";
+
+#ifdef MACOSX
+               command += separator + "../../../bbi.app/Contents/MacOS";
 #endif
-       command += " -q";
 
-       bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
+               #ifdef WIN32
+                       command += "\"";
+               #endif
 
-       if (!system(command.c_str())) {
-               SetStatusText(_T("Done !"));
                /*
-                wxMessageBox(_T("Done !"),_T("Regenerate boxes lists"),
-                wxOK | wxICON_INFORMATION);
-                */
-       } else {
-               SetStatusText(_T("Done !"));
-               wxString err(_T("An error occured while running '"));
-               err += bbtk::std2wx(command) + _T("'");
-               wxMessageBox(err, _T("Regenerate boxes lists"), wxOK | wxICON_ERROR);
+
+               //command += ConfigurationFile::GetInstance().Get_bin_path();
+//EED          command +="C:/temp/bbtkBIN/RelWithDebInfo//";
+//EED          command +="C:/Program Files/CreaTools/bbtk-0.9.5/bin";
+
+
+               #ifdef MACOSX
+                       command += separator + "usr/local/bin/bbi.app/Contents/MacOS/bbi\" ";
+               #else
+                   command +=".";
+                       command += separator + "bbi\" ";
+               #endif
+ */
+               command += separator + "bbi\" ";
+               command += "\""+filename + "\"";
+               #ifdef WIN32
+                       command += "\"";
+               #endif
+
+               command += " & ";
+
+               printf ("RaC wxGUIEditorGraphicBBS::executeScript %s \n" , command.c_str() );
+               system( command.c_str() );
        }
-}
 
-//================================================================
-void wxGUIEditorGraphicBBS::RegenerateAll() {
-       DoRegeneratePackageDoc("-a");
-       DoRegenerateBoxesLists();
-}
+       //=========================================================================
+       // EVENT HANDLERS
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::OnCreateNewTab(wxCommandEvent& event)
+       {
+               _tabsMgr->addNewTab();
+               refreshGUIControls();
+       }
+
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::OnExecuteActualDiagram(wxCommandEvent& event)
+       {
+               std::string script1 = _tabsMgr->getActualDiagramBBS(true);
+               cout<<endl<<"RaC wxGUIEditorGraphicBBS::executeActualDiagram SCRIPT"<<endl<<endl;
+               cout<<script1<<endl;
+
+               std::string script2 = _tabsMgr->getActualDiagramBBS(false);
+               executeScript(script2);
+       }
+
+
+       //=========================================================================
+       // HANDLERS
+       //=========================================================================
+       void wxGUIEditorGraphicBBS::OnOpenBBS(wxCommandEvent& event)
+       {
+               wxFileDialog * openFileDialog = new wxFileDialog(this,wxT("Open BBS"),wxEmptyString,wxT("NewBBS"),wxT("*.bbs"),wxOPEN);
+               if (openFileDialog->ShowModal() == wxID_OK)
+               {
+                       wxString fileName = openFileDialog->GetPath(  );
+
+
+                       _tabsMgr->addNewTab();
 
-//================================================================
+                       bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New( this->_tabsMgr->getActualTabPanel()->getSceneManager() , _pkgBrowser->GetFactory());
 
-wxAuiNotebook* wxGUIEditorGraphicBBS::getAuiNotebook() {
-       return _notebook;
-}
+                       // We tell the interpreter to throw exceptions on error
+                       I->SetThrow(true);
+                       // Interpret the file supposed to define a box called 'Processing'
+                       I->InterpretFile( (const char*) (fileName.mb_str()) );
+               }
+               refreshGUIControls();
+       }
 
-//================================================================
 
-void wxGUIEditorGraphicBBS::displayBlackBoxInfo(std::string packageName,
-               std::string boxName) {
-       if (_actualPkgBrowserPkgName != packageName || _actualPkgBrowserBoxName
-                       != boxName) {
-               _actualPkgBrowserPkgName = packageName;
-               _actualPkgBrowserBoxName = boxName;
 
-               BlackBoxDescriptor::Pointer descriptor =
-                               GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(
-                                               packageName, boxName);
-               _pkgBrowser->WxGUIBlackBoxListUserOnSelected(descriptor.get());
+    void wxGUIEditorGraphicBBS::SaveActualBBS(std::string filename)
+       {
+        ofstream file;
+
+//EED          file.open(fileName.c_str());
+        file.open( filename.c_str() );
+        std::string content="";
+        // writing file header
+        content += "# ----------------------------------\n";
+        content += "# - BBTKGEditor v 1.1 BBS BlackBox Script\n";
+        content += "# - ";
+        content += filename;
+        content += "\n";
+        content += "# ----------------------------------\n";
+        content += "\n";
+        content += _tabsMgr->getActualDiagramBBS();
+        file << content;
+        file.close();
        }
-}
 
-//=========================================================================
 
-void wxGUIEditorGraphicBBS::editBlackBox(GBlackBoxModel *bbmodel) {
-       wxBlackBoxEditionDialog* dialog =
-                       new wxBlackBoxEditionDialog(this, bbmodel);
-       dialog->Show();
-}
+       void wxGUIEditorGraphicBBS::OnSaveActualBBS(wxCommandEvent& event)
+       {
+               wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save  actual BBS"),wxEmptyString,wxT("NewBBS"),wxT("*.bbs"),wxSAVE|wxOVERWRITE_PROMPT);
+               if (saveFileDialog->ShowModal() == wxID_OK)
+               {
+                       wxString fileName = saveFileDialog->GetPath(  );
+            SaveActualBBS( (const char*) (fileName.mb_str())  );
+               }
 
-//=========================================================================
+       }
 
-void wxGUIEditorGraphicBBS::updateStatusBar(std::string textStatus) {
-       SetStatusText(crea::std2wx(textStatus));
-}
 
-//=========================================================================
+       //=========================================================================
 
-void wxGUIEditorGraphicBBS::executeScript(std::string script) {
-       std::string separator =
-                       ConfigurationFile::GetInstance().Get_file_separator();
-       std::string dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
-       std::string filename = dir + separator + "tmp_bbtk.bbs";
+       void wxGUIEditorGraphicBBS::SaveActualComplexBox(std::string filename)
+       {
+               wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,wxT("Name of complex box"));
+               std::string cbName="";
+               if (nameDialog->ShowModal() == wxID_OK)
+               {
+                       wxString complexboxname = nameDialog->GetValue();
+                       cbName=(const char*) (complexboxname.mb_str());
+               }
 
-       ofstream tempFile;
-       tempFile.open(filename.c_str());
-       tempFile << script;
-       tempFile.close();
+               if(!cbName.empty())
+               {
+
+                               ofstream file;
+                               file.open( filename.c_str() );
+
+                               std::string content="";
+
+                               // writing file header
+                               content += "# ----------------------------------\n";
+                               content += "# - BBTKGEditor v 1.1 BBS BlackBox Script (Complex Box)\n";
+                content += "# - ";
+                content += filename;
+                content += "\n";
+                               content += "# ----------------------------------\n";
+                               content += "\n";
+                               content += _tabsMgr->getActualComplexBoxBBS(cbName);
+                               file << content;
+                               file.close();
+               }
 
-       std::string command = "";
 
-#ifdef WIN32
-       command += "start /b ";
-#endif
+       }
 
-       //              command += "\""+ crea::System::GetExecutablePath();
-       //#ifdef MACOSX
-       //              command += separator + "../../../bbi.app/Contents/MacOS";
-       //#endif
+       //=========================================================================
 
-       command += "bbi ";
-       command += "\"" + filename + "\"";
+       void wxGUIEditorGraphicBBS::OnSaveActualComplexBox(wxCommandEvent& event)
+       {
+        wxFileDialog * saveFileDialog = new wxFileDialog(this ,wxT("Save Complex Box BBS") ,wxEmptyString, _T("ComplexBoxName") ,wxT("*.bbs"), wxSAVE | wxOVERWRITE_PROMPT);
+        if (saveFileDialog->ShowModal() == wxID_OK)
+        {
+            wxString fileName = saveFileDialog->GetPath();
+            SaveActualComplexBox( (const char*) (fileName.mb_str()) );
+        }
+       }
 
-#ifndef WIN32
-       command += " & ";
-#endif
+       //=========================================================================
+       void wxGUIEditorGraphicBBS::SaveActualDiagram(std::string filename)
+       {
+        ofstream file;
+        file.open( filename.c_str() );
+
+        std::string content="";
+
+        // writing file header
+        content += "# ----------------------------------\n";
+        content += "# - BBTKGEditor v 1.1 BBG BlackBox Diagram file\n";
+        content += "# - ";
+
+        content += filename;
+
+        content += "\n";
+        content += "# ----------------------------------\n";
+        content += "\n";
+        content += "APP_START\n";
+        _tabsMgr->saveActualDiagram(content);
+        content += "APP_END\n";
+        file << content;
+        file.close();
+    }
+
+
+       //=========================================================================
+       void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event)
+       {
+               wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save  actual diagram"),wxEmptyString,wxT("NewDiagram"),wxT("*.bbg"),wxSAVE|wxOVERWRITE_PROMPT);
+               if (saveFileDialog->ShowModal() == wxID_OK)
+               {
+                       wxString fileName       = saveFileDialog->GetPath();
+                       std::string filename    = (const char*) (fileName.mb_str());
+            std::string filenamebbs = filename+"s";
+
+            SaveActualDiagram( filename );
+            if (_tabsMgr->isActualDiagramComplexBox()==false)
+            {
+                SaveActualBBS(filenamebbs);
+            } else {
+                SaveActualComplexBox(filenamebbs);
+            } //if isActualDiagramComplexBox
+               } // if saveFileDialog
+       }
 
-       printf("RaC wxGUIEditorGraphicBBS::executeScript %s \n", command.c_str());
-       system(command.c_str());
-}
-
-//=========================================================================
-// EVENT HANDLERS
-//=========================================================================
-
-void wxGUIEditorGraphicBBS::OnCreateNewTab(wxCommandEvent& event) {
-       _tabsMgr->addNewTab();
-       refreshGUIControls();
-}
+       //=========================================================================
 
-//=========================================================================
-
-void wxGUIEditorGraphicBBS::OnExecuteActualDiagram(wxCommandEvent& event) {
-       std::string script1 = _tabsMgr->getActualDiagramBBS(true);
-       cout << endl << "RaC wxGUIEditorGraphicBBS::executeActualDiagram SCRIPT"
-                       << endl << endl;
-       cout << script1 << endl;
-
-       std::string script2 = _tabsMgr->getActualDiagramBBS(false);
-       executeScript(script2);
-}
-
-//=========================================================================
-// HANDLERS
-//=========================================================================
-void wxGUIEditorGraphicBBS::OnOpenBBS(wxCommandEvent& event) {
-       wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open BBS"),
-                       wxEmptyString, wxT("NewBBS"), wxT("*.bbs"), wxOPEN);
-       if (openFileDialog->ShowModal() == wxID_OK) {
-               wxString fileName = openFileDialog->GetPath();
-
-               _tabsMgr->addNewTab(openFileDialog->GetFilename());
-
-               bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New(
-                               this->_tabsMgr->getActualTabPanel()->getSceneManager(),
-                               _pkgBrowser->GetFactory());
-
-               // We tell the interpreter to throw exceptions on error
-               I->SetThrow(true);
-               // Interpret the file supposed to define a box called 'Processing'
-               I->InterpretFile((const char*) (fileName.mb_str()));
-       }
-       refreshGUIControls();
-}
-
-void wxGUIEditorGraphicBBS::SaveActualBBS(std::string filename) {
-       ofstream file;
-
-       //EED           file.open(fileName.c_str());
-       file.open(filename.c_str());
-       std::string content = "";
-       // writing file header
-       content += "# ----------------------------------\n";
-       content += "# - BBTKGEditor v 1.2 BBS BlackBox Script\n";
-       content += "# - ";
-       content += filename;
-       content += "\n";
-       content += "# ----------------------------------\n";
-       content += "\n";
-       content += _tabsMgr->getActualDiagramBBS();
-       file << content;
-       file.close();
-}
-
-void wxGUIEditorGraphicBBS::OnSaveActualBBS(wxCommandEvent& event) {
-       wxFileDialog * saveFileDialog = new wxFileDialog(this,
-                       wxT("Save  actual BBS"), wxEmptyString, wxT("NewBBS"),
-                       wxT("*.bbs"), wxSAVE | wxOVERWRITE_PROMPT);
-       if (saveFileDialog->ShowModal() == wxID_OK) {
-               wxString fileName = saveFileDialog->GetPath();
-               SaveActualBBS((const char*) (fileName.mb_str()));
-       }
-
-}
-
-void wxGUIEditorGraphicBBS::AskComplexBoxConfiguration() {
-       std::string cbName = _tabsMgr->GetCbName();
-       std::string paName = _tabsMgr->GetCbPackageName();
-
-       wxTextEntryDialog *cbNameDialog = new wxTextEntryDialog(this,
-                       wxT("Complex Box name"));
-       wxTextEntryDialog *paNameDialog = new wxTextEntryDialog(this,
-                       wxT("Package name"));
-
-       cbNameDialog->SetValue(wxString(cbName.c_str(), wxConvUTF8));
-       paNameDialog->SetValue(wxString(paName.c_str(), wxConvUTF8));
-
-       if (cbNameDialog->ShowModal() == wxID_OK) {
-               wxString complexboxname = cbNameDialog->GetValue();
-               cbName = (const char*) (complexboxname.mb_str());
-       }
-
-       if (paNameDialog->ShowModal() == wxID_OK) {
-               wxString packagename = paNameDialog->GetValue();
-               paName = (const char*) (packagename.mb_str());
-       }
-
-       _tabsMgr->SetCbName(cbName);
-       _tabsMgr->SetCbPackageName(paName);
-}
-
-//=========================================================================
-
-void wxGUIEditorGraphicBBS::SaveActualComplexBox(std::string filename) {
-       ofstream file;
-       file.open(filename.c_str());
-
-       std::string content = "";
-
-       // writing file header
-       content += "# ----------------------------------\n";
-       content += "# - BBTKGEditor v 1.2 BBS BlackBox Script (Complex Box)\n";
-       content += "# - ";
-       content += filename;
-       content += "\n";
-       content += "# ----------------------------------\n";
-       content += "\n";
-       content += _tabsMgr->getActualComplexBoxBBS();
-       file << content;
-       file.close();
-}
-
-//=========================================================================
-
-void wxGUIEditorGraphicBBS::OnSaveActualComplexBox(wxCommandEvent& event) {
-       wxFileDialog * saveFileDialog = new wxFileDialog(this,
-                       wxT("Save Complex Box BBS"), wxEmptyString,
-                       _T("ComplexBoxName"), wxT("*.bbs"), wxSAVE
-                                       | wxOVERWRITE_PROMPT);
-       if (saveFileDialog->ShowModal() == wxID_OK) {
-               wxString fileName = saveFileDialog->GetPath();
-               SaveActualComplexBox((const char*) (fileName.mb_str()));
-       }
-}
-
-//=========================================================================
-void wxGUIEditorGraphicBBS::SaveActualDiagram(std::string filename) {
-       ofstream file;
-       file.open(filename.c_str());
-
-       std::string content = "";
-
-       // writing file header
-       content += "# ----------------------------------\n";
-       content += "# - BBTKGEditor v 1.2 BBG BlackBox Diagram file\n";
-       content += "# - ";
-
-       content += filename;
-
-       content += "\n";
-       content += "# ----------------------------------\n";
-       content += "\n";
-       content += "APP_START\n";
-       _tabsMgr->saveActualDiagram(content, filename); //DFCH
-       content += "APP_END\n";
-       file << content;
-       file.close();
-}
-
-//=========================================================================
-
-//The following method allows to save the current diagram asking the filename
-//DFCH
-void wxGUIEditorGraphicBBS::SaveCurrentDiagramAs() {
-       wxFileDialog * saveFileDialog = new wxFileDialog(this,
-                       wxT("Save current diagram"), wxEmptyString, wxT("NewDiagram"),
-                       wxT("*.bbg"), wxSAVE | wxOVERWRITE_PROMPT);
-       if (saveFileDialog->ShowModal() == wxID_OK) {
-               _tabsMgr->SetNameTabPanel(saveFileDialog->GetFilename());
-               wxString pathfileName = saveFileDialog->GetPath();
-               std::string pathfilename = (const char*) (pathfileName.mb_str());
-               std::string pathfilenamebbs = pathfilename;
-               pathfilenamebbs[pathfilenamebbs.length() - 1] = 's';
-               if (_tabsMgr->isActualDiagramComplexBox() == false) {
-                       SaveActualDiagram(pathfilename);
-                       SaveActualBBS(pathfilenamebbs);
-               } else {
-                       AskComplexBoxConfiguration();
-                       SaveActualDiagram(pathfilename);
-                       SaveActualComplexBox(pathfilenamebbs);
-               } //if isActualDiagramComplexBox
-       } // if saveFileDialog
-}
-//=========================================================================
-//DFCH
-void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event) {
-       std::string pathfilename = _tabsMgr->GetCurrentTabPanelPath();
-       if (pathfilename.empty()) {
-               SaveCurrentDiagramAs();
-       } else {
-               std::string pathfilenamebbs = pathfilename;
-               pathfilenamebbs[pathfilenamebbs.length() - 1] = 's';
-
-               if (_tabsMgr->isActualDiagramComplexBox() == false) {
-                       SaveActualDiagram(pathfilename);
-                       SaveActualBBS(pathfilenamebbs);
-               } else {
-                       AskComplexBoxConfiguration();
-                       SaveActualDiagram(pathfilename);
-                       SaveActualComplexBox(pathfilenamebbs);
-               } //if isActualDiagramComplexBox
-       }
-}
-//=========================================================================
-//DFCH
-void wxGUIEditorGraphicBBS::OnSaveAsActualDiagram(wxCommandEvent& event) {
-       SaveCurrentDiagramAs();
-}
-//=========================================================================
-
-void wxGUIEditorGraphicBBS::refreshGUIControls() {
-       wxToolBar* toolbar = GetToolBar();
-       if (_tabsMgr->isActualDiagramComplexBox()) {
-               toolbar->ToggleTool(ID_BTNCOMPLEXBOX, true);
-               toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT, true);
-               toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT, true);
-
-               GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX, true);
-               GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS, false);
-       } else {
-               toolbar->ToggleTool(ID_BTNCOMPLEXBOX, false);
-               toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT, false);
-               toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT, false);
-
-               GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX, false);
-               GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS, true);
-       }
-
-       if (_tabsMgr->getNumActualSelectedObjects() > 0) {
-               GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM, true);
-       } else {
-               ///TODO Fix the possibility to say from the SceneManager to the GUI to refresh the options
-               GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM, true);
-       }
-
-}
-
-//=========================================================================
-
-void wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram(wxCommandEvent& event) {
-       wxMessageDialog *dial = new wxMessageDialog(NULL,
-                       wxT("Are you sure to delete all boxes of the diagram?"),
-                       wxT("Delete all boxes"), wxYES_NO | wxNO_DEFAULT
-                                       | wxICON_QUESTION);
-       if (dial->ShowModal() == wxID_YES) {
-               _tabsMgr->deleteAllBoxesActualDiagram();
-       }
-}
-
-//=========================================================================
-
-void wxGUIEditorGraphicBBS::OnCenterViewActualDiagram(wxCommandEvent& event) {
-       _tabsMgr->centerViewActualDiagram();
-}
-
-//=========================================================================
-
-void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event) {
-       wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open diagram"),
-                       wxEmptyString, wxT(""), wxT("*.bbg"), wxOPEN | wxFILE_MUST_EXIST);
-       if (openFileDialog->ShowModal() == wxID_OK) {
-               wxString fileName = openFileDialog->GetPath();
-               ifstream inputStream;
-               std::string fName = (const char*) (fileName.mb_str());
-               inputStream.open(fName.c_str());
-               _tabsMgr->addNewTab(openFileDialog->GetFilename());
-
-               _tabsMgr->loadDiagram(inputStream, fName);
-
-               inputStream.close();
-       }
-       refreshGUIControls();
-}
-
-//=========================================================================
-
-
-void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event) {
-       BlackBoxDescriptor *bbDes = _pkgBrowser->GetActualSelected();
-       if (bbDes != NULL) {
-               std::string typeName = bbDes->GetTypeName();
-               std::string packageName = bbDes->GetPackage()->GetName();
-
-               wxGEditorTabPanel *pnl = this->_tabsMgr->getActualTabPanel();
-
-               if (pnl != NULL) {
-                       wxVtkSceneManager *scn = pnl->getSceneManager();
-                       scn->createGBlackBox(50, 50, packageName, typeName);
-                       scn->refresh();
-               } // if pnl
-       }// if bbDes
-}
+       void wxGUIEditorGraphicBBS::refreshGUIControls()
+       {
+               wxToolBar* toolbar = GetToolBar();
+               if(_tabsMgr->isActualDiagramComplexBox())
+               {
+                       toolbar->ToggleTool(ID_BTNCOMPLEXBOX,true);
+                       toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,true);
+                       toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,true);
+
+                       GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX,true);
+                       GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS,false);
+               }
+               else
+               {
+                       toolbar->ToggleTool(ID_BTNCOMPLEXBOX,false);
+                       toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,false);
+                       toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,false);
 
-//=========================================================================
-
-void wxGUIEditorGraphicBBS::OnClickBtnExecutableBox(wxCommandEvent& event) {
-       //DFCH
-       wxGEditorTabPanel *pnl = this->_tabsMgr->getActualTabPanel();
+                       GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX,false);
+                       GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS,true);
+               }
 
-       if (pnl != NULL) {
-               wxVtkSceneManager *scn = pnl->getSceneManager();
-               if( scn->MakeBoxExecutable() )
-                       std::cout<<"DFCH: wxGUIEditorGraphicBBS::OnClickBtnExecutableBox...successful"<<std::endl;
+               if(_tabsMgr->getNumActualSelectedObjects()>0)
+               {
+                       GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM,true);
+               }
                else
-                       std::cout<<"DFCH: wxGUIEditorGraphicBBS::OnClickBtnExecutableBox...Error!!"<<std::endl;
+               {
+                       ///TODO Fix the possibility to say from the SceneManager to the GUI to refresh the options
+                       GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM,true);
+               }
+
        }
-       //DFCH
 
-}
+       //=========================================================================
 
-//=========================================================================
+       void wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram(wxCommandEvent& event)
+       {
+               wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Are you sure to delete all boxes of the diagram?"), wxT("Delete all boxes"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
+               if(dial->ShowModal() == wxID_YES)
+               {
+                       _tabsMgr->deleteAllBoxesActualDiagram();
+               }
+       }
 
-void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event) {
-       wxToolBar* toolbar = GetToolBar();
-       bool temp = toolbar->GetToolState(ID_BTNCOMPLEXBOX);
-       if (temp) {
-               _tabsMgr->setActualDiagramComplexBox(true);
-       } else {
-               _tabsMgr->setActualDiagramComplexBox(false);
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::OnCenterViewActualDiagram(wxCommandEvent& event)
+       {
+               _tabsMgr->centerViewActualDiagram();
        }
-       refreshGUIControls();
-}
 
-//=========================================================================
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event)
+       {
+               wxFileDialog * openFileDialog = new wxFileDialog(this,wxT("Open diagram"),wxEmptyString,wxT(""),wxT("*.bbg"),wxOPEN|wxFILE_MUST_EXIST);
+               if (openFileDialog->ShowModal() == wxID_OK)
+               {
+                       wxString fileName = openFileDialog->GetPath();
+                       ifstream inputStream;
+//EED                  inputStream.open(fileName.c_str());
+                       inputStream.open( (const char*) (fileName.mb_str()) );
+                       _tabsMgr->addNewTab();
+                       _tabsMgr->loadDiagram(inputStream);
+
+                       inputStream.close();
+               }
+               refreshGUIControls();
+       }
+
+       //=========================================================================
+
+
+       void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event)
+       {
+               BlackBoxDescriptor      *bbDes = _pkgBrowser->GetActualSelected();
+        if (bbDes!=NULL)
+        {
+            std::string                        typeName        = bbDes->GetTypeName();
+            std::string                        packageName = bbDes->GetPackage()->GetName();
 
-void wxGUIEditorGraphicBBS::OnAddComplexBoxInput(wxCommandEvent& event) {
-       wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,
-                       wxT("Name of input port"));
-       if (nameDialog->ShowModal() == wxID_OK) {
-               wxString fileName = nameDialog->GetValue();
-               if (!fileName.IsEmpty()) {
-                       std::string portName = (const char*) (fileName.mb_str());
-                       _tabsMgr->addActualDiagramComplexInputPort(portName);
+
+            wxGEditorTabPanel *pnl = this->_tabsMgr->getActualTabPanel();
+
+            if (pnl!=NULL)
+            {
+                wxVtkSceneManager *scn = pnl->getSceneManager();
+                scn->createGBlackBox(50,50,packageName, typeName);
+                scn->refresh();
+            } // if pnl
+        }// if bbDes
+       }
+
+       //=========================================================================
+
+
+       void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event)
+       {
+               wxToolBar* toolbar = GetToolBar();
+               bool temp = toolbar->GetToolState(ID_BTNCOMPLEXBOX);
+               if(temp)
+               {
+                       _tabsMgr->setActualDiagramComplexBox(true);
+               }
+               else
+               {
+                       _tabsMgr->setActualDiagramComplexBox(false);
                }
+               refreshGUIControls();
        }
-}
 
-//=========================================================================
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::OnAddComplexBoxInput(wxCommandEvent& event)
+       {
+               wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,wxT("Name of input port"));
+               if (nameDialog->ShowModal() == wxID_OK)
+               {
+                       wxString fileName = nameDialog->GetValue();
+                       if(!fileName.IsEmpty())
+                       {
+                               std::string portName=(const char*) (fileName.mb_str());
+                               _tabsMgr->addActualDiagramComplexInputPort(portName);
+                       }
+               }
+       }
 
-void wxGUIEditorGraphicBBS::OnAddComplexBoxOutput(wxCommandEvent& event) {
-       wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,
-                       wxT("Name of output port"));
-       if (nameDialog->ShowModal() == wxID_OK) {
-               wxString fileName = nameDialog->GetValue();
-               if (!fileName.IsEmpty()) {
-                       std::string portName = (const char*) (fileName.mb_str());
-                       _tabsMgr->addActualDiagramComplexOutputPort(portName);
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::OnAddComplexBoxOutput(wxCommandEvent& event)
+       {
+               wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,wxT("Name of output port"));
+               if (nameDialog->ShowModal() == wxID_OK)
+               {
+                       wxString fileName = nameDialog->GetValue();
+                       if(!fileName.IsEmpty())
+                       {
+                               std::string portName=(const char*) (fileName.mb_str());
+                               _tabsMgr->addActualDiagramComplexOutputPort(portName);
+                       }
                }
        }
-}
-
-//=========================================================================
-
-void wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram(
-               wxCommandEvent& event) {
-       _tabsMgr->copySelectedBBoxesToComplexDiagram();
-}
-
-void wxGUIEditorGraphicBBS::OnHelpBBeditor(wxCommandEvent& event) {
-       printf("wxGUIEditorGraphicBBS::OnHelpBBeditor ....not implemented..\n");
-}
-
-//=========================================================================
-void wxGUIEditorGraphicBBS::OnCreatePackage(wxCommandEvent& event) {
-
-       bbtkSystemTools::CreatePackage();
-}
-
-//=========================================================================
-void wxGUIEditorGraphicBBS::OnCreateBlackBox(wxCommandEvent& event) {
-       bbtkSystemTools::CreateBlackBox();
-}
-//=========================================================================
-void wxGUIEditorGraphicBBS::OnPlugPackage(wxCommandEvent& event) {
-       printf("EED wxGUIEditorGraphicBBS::OnPlugPackage ... not implemented ..\n");
-}
-//=========================================================================
-void wxGUIEditorGraphicBBS::OnEditConfig(wxCommandEvent& event) {
-       printf("EED wxGUIEditorGraphicBBS::OnEditConfig ... not implemented ..\n");
-}
-//=========================================================================
-void wxGUIEditorGraphicBBS::OnShowHTMLDoc(wxCommandEvent& event) {
-       printf("EED wxGUIEditorGraphicBBS::OnShowHTMLDoc ... not implemented ..\n");
-}
-//=========================================================================
-void wxGUIEditorGraphicBBS::OnCreateIndex(wxCommandEvent& event) {
-       printf("EED wxGUIEditorGraphicBBS::OnCreateIndex ... not implemented ..\n");
-}
-
-//=========================================================================
-
-void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event) {
-       Close(true);
-}
-
-//=========================================================================
-
-} // EO namespace bbtk
+
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram(wxCommandEvent& event)
+       {
+               _tabsMgr->copySelectedBBoxesToComplexDiagram();
+       }
+
+
+       void wxGUIEditorGraphicBBS::OnHelpBBeditor(wxCommandEvent& event)
+       {
+               printf("wxGUIEditorGraphicBBS::OnHelpBBeditor ......\n");
+       }
+
+
+
+       //=========================================================================
+
+       void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event)
+       {
+               Close(true);
+       }
+
+
+
+       //=========================================================================
+
+}  // EO namespace bbtk
 
 // EOF
 
index 3a4df85f8ef3e05efa48c18994b4b38564296da6..c93405fc4ca7e5afd57a4df8dc12dec932ae6b41 100644 (file)
@@ -57,7 +57,6 @@
 #include "wxart_delete.xpm"
 #include "wxart_centerview.xpm"
 #include "wxart_box.xpm"
-#include "wxart_executablebox.xpm"
 #include "wxart_complexbox.xpm"
 #include "wxart_complexinputport.xpm"
 #include "wxart_complexoutputport.xpm"
@@ -69,7 +68,6 @@
 #include <bbtkWxGUIHtmlBrowser.h>
 #include <bbtkBlackBoxDescriptor.h>
 #include <bbtkConfigurationFile.h>
-#include <bbtkSystemTools.h>
 
 //Includes vtk
 
@@ -106,6 +104,7 @@ namespace bbtk
                        void initTabPanelsManager();
                        void initPackageBrowser();
                        void initHelpHTMLBrowser();
+
                        wxAuiNotebook* getAuiNotebook();
 
                        // Display the info of the black box highlighted in the PackageBrowser
@@ -128,24 +127,21 @@ namespace bbtk
 
                        // Refresh the state of buttons and menus when changing for example the mode to edit complex box
                        void refreshGUIControls();
-                       
+
             void SaveActualBBS(std::string filename);
-            void AskComplexBoxConfiguration();
             void SaveActualComplexBox(std::string filename);
             void SaveActualDiagram(std::string filename);
-                       void SaveCurrentDiagramAs( ); //DFCH
+
 
 
                        // File menu and toolbar events
                        void OnCreateNewTab(wxCommandEvent& event);
                        void OnOpenDiagram(wxCommandEvent& event);
-                       void OnSaveActualDiagram(wxCommandEvent& event); //DFCH
-                       void OnSaveAsActualDiagram(wxCommandEvent& event); //DFCH
+                       void OnSaveActualDiagram(wxCommandEvent& event);
                        void OnOpenBBS(wxCommandEvent& event);
                        void OnSaveActualBBS(wxCommandEvent& event);
                        void OnSaveActualComplexBox(wxCommandEvent& event);
                        void OnExecuteActualDiagram(wxCommandEvent& event);
-                       void OnClickBtnExecutableBox(wxCommandEvent& event);
                        void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
                        void OnCenterViewActualDiagram(wxCommandEvent& event);
                        void OnClickBtnBox(wxCommandEvent& event);
@@ -158,17 +154,7 @@ namespace bbtk
                        // Edit menu events
                        void OnCopySelectedToComplexDiagram(wxCommandEvent& event);
 
-                       // Tool menu events
-                       void OnCreatePackage(wxCommandEvent& event);
-                       void OnCreateBlackBox(wxCommandEvent& event);
-                       void OnPlugPackage(wxCommandEvent& event);
-                       void OnEditConfig(wxCommandEvent& event);
-                       void OnShowHTMLDoc(wxCommandEvent& event);
-                       void OnCreateIndex(wxCommandEvent& event);
-               
-               
-               
-               
+
                private:
 
                        //AuiManager for the wxWindow
index f72d05bb8a8066f5503747c6ac5e8f0ee7bd5944..b6e28501bc2324bb8432fd7367c8b370f2e71f63 100644 (file)
@@ -78,13 +78,8 @@ namespace bbtk
 
                std::vector<GPortModel*> lstInputs = _model->getInputPorts();
                wxFlexGridSizer *sizer = new wxFlexGridSizer(lstInputs.size(),3,5,5);
-               sizer->AddGrowableCol(0);
-               sizer->AddGrowableCol(1);
-               sizer->AddGrowableCol(2);
-               
                for(int i = 0;i<(int)lstInputs.size();i++)
                {
-                       sizer->AddGrowableRow(i);
                        GPortModel* port        = lstInputs[i];
                        std::string type        = port->getBBTKType();
                        wxStaticText *lblName   = new wxStaticText(scrollWin, -1, std2wx(port->getBBTKName()),wxDefaultPosition,wxSize(100,25));
@@ -135,7 +130,7 @@ namespace bbtk
                sizerDialog->AddSpacer(10);
                sizerDialog->Add(text,0,wxALIGN_TOP|wxALIGN_CENTER);
                sizerDialog->AddSpacer(15);
-               sizerDialog->Add(sizer,0,wxALIGN_CENTER| wxEXPAND);
+               sizerDialog->Add(sizer,0,wxALIGN_CENTER);
                sizerDialog->AddSpacer(15);
                sizerDialog->Add(buts,0,wxALIGN_CENTER | wxTOP | wxBOTTOM);
 
index cd591b16d36a18a543dc1a82928c583aa0ebd911..4291597df0cc6b00e2caf375424b6f908adfd1c3 100644 (file)
@@ -49,13 +49,11 @@ namespace bbtk
        //=========================================================================
        wxGEditorTabPanel::wxGEditorTabPanel(wxWindow *parent,int id):wxPanel(parent),wxTextDropTarget()
        {
-printf("EED wxGEditorTabPanel::wxGEditorTabPanel 0\n");
                printf ("EED %p wxGEditorTabPanel 2 ()\n" , this );
                _id=id;
                _panelAUIMgr = new wxAuiManager(this);
                _sceneManager = NULL;
                initWxVtkCanvas();
-printf("EED wxGEditorTabPanel::wxGEditorTabPanel 1\n");
        }
 
        //=========================================================================
@@ -65,16 +63,12 @@ printf ("EED %p ~wxGEditorTabPanel()\n" , this );
 //ED02JUIN2010         _sceneManager->disconnectDrop();
 
         _panelsManager->VerifyLastTabPanel();
-               //FCY memory leaks
-               delete _panelAUIMgr;
-               delete _sceneManager;
 
        }
 
        //=========================================================================
        void wxGEditorTabPanel::initWxVtkCanvas()
        {
-printf("EED wxGEditorTabPanel::initWxVtkCanvas 0\n");
                wxVtk3DBaseView *baseview = new wxVtk3DBaseView(this);
                baseview->Configure();
                _sceneManager=new wxVtkSceneManager(this,baseview,_id);
@@ -85,7 +79,6 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 0\n");
                _panelAUIMgr->AddPane((wxWindow*)baseview->GetWxVTKRenderWindowInteractor(),wxAuiPaneInfo().Fixed().CenterPane());
 
                _panelAUIMgr->Update();
-printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n");
        }
 
        //=========================================================================
@@ -142,9 +135,9 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n");
 
        //=========================================================================
 
-       std::string wxGEditorTabPanel::saveComplexBoxBBS()
+       std::string wxGEditorTabPanel::saveComplexBoxBBS(std::string cbName,std::string cbAuthor,std::string cbCategory,std::string cbDescription)
        {
-               return _sceneManager->saveComplexBoxBBS();
+               return _sceneManager->saveComplexBoxBBS(cbName,cbAuthor,cbCategory,cbDescription);
        }
 
        //=========================================================================
@@ -165,25 +158,20 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n");
 
        void wxGEditorTabPanel::centerView()
        {
-               if(_sceneManager)
-               {
-                       _sceneManager->centerView();
-               }
+               _sceneManager->centerView();
        }
 
        //=========================================================================
 
-       void wxGEditorTabPanel::saveDiagram(std::string &content, const std::string &path) //DFCH
+       void wxGEditorTabPanel::saveDiagram(std::string &content)
        {
-               this->SetFullPath(path);
                _sceneManager->saveDiagram(content);
        }
 
        //=========================================================================
 
-       void wxGEditorTabPanel::loadDiagram(ifstream &inputStream, const std::string &path) //DFCH
+       void wxGEditorTabPanel::loadDiagram(ifstream &inputStream)
        {
-               this->SetFullPath(path);
                _sceneManager->loadDiagram(inputStream);
        }
 
@@ -251,96 +239,6 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n");
                return _sceneManager;
        }
 
-       //=========================================================================
-    std::string wxGEditorTabPanel::GetCbName()
-       {
-           return _sceneManager->GetCbName();
-       }
-
-
-       //=========================================================================
-    std::string wxGEditorTabPanel::GetCbPackageName()
-       {
-           return _sceneManager->GetCbPackageName();
-       }
-
-       //=========================================================================
-    std::string wxGEditorTabPanel::GetAuthor()
-       {
-           return _sceneManager->GetAuthor();
-       }
-
-       //=========================================================================
-    std::string wxGEditorTabPanel::GetDescription()
-       {
-           return _sceneManager->GetDescription();
-       }
-
-       //=========================================================================
-    std::string wxGEditorTabPanel::GetCategory()
-       {
-           return _sceneManager->GetCategory();
-       }
-
-       //=========================================================================
-    void wxGEditorTabPanel::SetCbName(std::string cbName)
-    {
-        _sceneManager->SetCbName( cbName );
-    }
-
-       //=========================================================================
-    void wxGEditorTabPanel::SetCbPackageName(std::string packagename)
-    {
-        _sceneManager->SetCbPackageName( packagename );
-    }
-
-
-       //=========================================================================
-    void wxGEditorTabPanel::SetAuthor(std::string author)
-    {
-        _sceneManager->SetAuthor( author );
-    }
-
-
-       //=========================================================================
-    void wxGEditorTabPanel::SetCategory(std::string category)
-    {
-        _sceneManager->SetCategory( category );
-    }
-
-
-       //=========================================================================
-    void wxGEditorTabPanel::SetDescription(std::string description)
-    {
-        _sceneManager->SetDescription( description );
-    }
-    //=========================================================================
-       //DFCH
-       void wxGEditorTabPanel::SetFullPath( const std::string& fullpath )
-       {
-               this->_fullPath = fullpath;
-       }
-       //=========================================================================
-       //DFCH
-       void wxGEditorTabPanel::SetFileName( const std::string& filename )
-       {
-               this->_fileName = filename;
-       }
-       //=========================================================================
-       //DFCH
-       std::string wxGEditorTabPanel::GetFullPath( )
-       {
-               return( this->_fullPath );
-       }
-       //=========================================================================
-       //DFCH
-    std::string wxGEditorTabPanel::GetFileName( )
-    {
-               return( this->_fileName );
-       }
-
-
-
 
 }  // EO namespace bbtk
 
index 402e2a7c0e43e30648f037739c85039046a2e1a6..28ba74dc5c1a7f8030b620417b1038f20a288279 100644 (file)
@@ -59,6 +59,9 @@ Version:   $Revision$
 //Includes std
 #include <iostream>
 
+
+
+
 namespace bbtk
 {
 
@@ -92,16 +95,16 @@ namespace bbtk
 
                // Saves the actual BBS as complex box
                // RaC TOFIX It must be included the package of the complex box
-               std::string saveComplexBoxBBS();
+               std::string saveComplexBoxBBS(std::string cbName,std::string cbAuthor="",std::string cbCategory="",std::string cbDescription="");
 
                // Shows the dialog to edit black box parameters
                void editBlackBox(GBlackBoxModel *bbmodel);
 
                // Save diagram as BBG
-               void saveDiagram(std::string &content, const std::string &path); //DFCH
+               void saveDiagram(std::string &content);
 
                // Load BBG diagram
-               void loadDiagram(ifstream &inputStream, const std::string &path); //DFCH
+               void loadDiagram(ifstream &inputStream);
 
                // Add a new complex input object to the scene
                void addComplexInputPort(std::string portName);
@@ -132,27 +135,8 @@ namespace bbtk
                // Receives the string from a drag and drop source as for example the BBTK Package Browser
                virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& data);
 
-               wxVtkSceneManager* getSceneManager();
-
-               void SetFullPath( const std::string& );
-               void SetFileName( const std::string& );
-               void SetCbName(std::string cbName);
-        void SetCbPackageName(std::string packagename);
-        void SetAuthor(std::string author);
-        void SetCategory(std::string category);
-        void SetDescription(std::string description);
-        //Getters
-        std::string GetFullPath( );
-        std::string GetFileName( );
-        
-        std::string GetCbName();
-        std::string GetCbPackageName();
-        std::string GetAuthor();
-        std::string GetDescription();
-        std::string GetCategory();
-
-
 
+               wxVtkSceneManager* getSceneManager();
        //=========================================================================
 
        private:
@@ -161,8 +145,6 @@ namespace bbtk
                wxAuiManager                    *_panelAUIMgr;
                wxVtkSceneManager               *_sceneManager;
                wxTabPanelsManager              *_panelsManager;
-               std::string                             _fullPath;
-               std::string                             _fileName;
 
        protected:
 
index f2aa6b03d9f5b89221ca481d073811c77598ec97..bca6b0b81f8396454147308d43ea481cb2b284e4 100644 (file)
@@ -36,6 +36,7 @@ Version:   $Revision$
 
 #include "wxTabPanelsManager.h"
 
+
 namespace bbtk
 {
 
@@ -56,17 +57,14 @@ namespace bbtk
        }
 
        //=========================================================================
-       void wxTabPanelsManager::addNewTab(wxString tabName)
+       void wxTabPanelsManager::addNewTab()
        {
-printf("EED wxTabPanelsManager::addNewTab 0\n");
-
                _lastId++;
                wxGEditorTabPanel *newPanel         = new wxGEditorTabPanel(_notebook,_lastId);
                newPanel->setPanelsManager(this);
                _panels[_lastId]                    = newPanel;
                _actual                             = newPanel;
-               _notebook->AddPage(newPanel, tabName  ,true);
-printf("EED wxTabPanelsManager::addNewTab 1\n");
+               _notebook->AddPage(newPanel,_T("Diagram"),true);
        }
 
        //=========================================================================
@@ -104,9 +102,9 @@ printf("EED wxTabPanelsManager::addNewTab 1\n");
 
        //=========================================================================
 
-       std::string wxTabPanelsManager::getActualComplexBoxBBS()
+       std::string wxTabPanelsManager::getActualComplexBoxBBS(std::string cbName,std::string cbAuthor,std::string cbCategory,std::string cbDescription)
        {
-               return _actual->saveComplexBoxBBS();
+               return _actual->saveComplexBoxBBS(cbName,cbAuthor,cbCategory,cbDescription);
        }
 
        //=========================================================================
@@ -132,16 +130,16 @@ printf("EED wxTabPanelsManager::addNewTab 1\n");
 
        //=========================================================================
 
-       void wxTabPanelsManager::saveActualDiagram(std::string &content, const std::string &path) //DFCH
+       void wxTabPanelsManager::saveActualDiagram(std::string &content)
        {
-               _actual->saveDiagram(content, path);
+               _actual->saveDiagram(content);
        }
 
        //=========================================================================
 
-       void wxTabPanelsManager::loadDiagram(ifstream &inputStream, const std::string &path) //DFCH
+       void wxTabPanelsManager::loadDiagram(ifstream &inputStream)
        {
-               _actual->loadDiagram(inputStream, path);
+               _actual->loadDiagram(inputStream);
        }
 
        //=========================================================================
@@ -205,6 +203,7 @@ printf("wxTabPanelsManager::VerifyActualTabPanel  %d \n", this->_notebook->GetPa
 
        void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
        {
+printf("wxTabPanelsManager::OnTabChanged \n");
                int index                   = event.GetSelection();
                wxGEditorTabPanel* tab      = (wxGEditorTabPanel*)_notebook->GetPage(index);
                int id                      = tab->getPanelId();
@@ -213,92 +212,6 @@ printf("wxTabPanelsManager::VerifyActualTabPanel  %d \n", this->_notebook->GetPa
        }
 
        //=========================================================================
-    std::string wxTabPanelsManager::GetCbName()
-       {
-           return _actual->GetCbName();
-       }
-       
-       //=========================================================================
-       void wxTabPanelsManager::SetNameTabPanel(wxString tabpanelname)
-       {
-           int id          = _notebook->GetSelection();
-           _notebook->SetPageText( id , tabpanelname );
-       }
-
-       //=========================================================================
-       //DFCH
-       std::string wxTabPanelsManager::GetCurrentTabPanelPath( )
-       {
-               int id          = _notebook->GetSelection();
-               wxGEditorTabPanel* auxPanel = (wxGEditorTabPanel*) _notebook->GetPage(id);
-               return( auxPanel->GetFullPath( ) );
-           //return ( (wxGEditorTabPanel) _notebook->GetPage(id)->GetFullPath( ) );
-       }
-
-
-       //=========================================================================
-    std::string wxTabPanelsManager::GetCbPackageName()
-       {
-           return _actual->GetCbPackageName();
-       }
-
-       //=========================================================================
-    std::string wxTabPanelsManager::GetAuthor()
-       {
-           return _actual->GetAuthor();
-       }
-
-       //=========================================================================
-    std::string wxTabPanelsManager::GetDescription()
-       {
-           return _actual->GetDescription();
-       }
-
-       //=========================================================================
-    std::string wxTabPanelsManager::GetCategory()
-       {
-           return _actual->GetCategory();
-       }
-
-       //=========================================================================
-    void wxTabPanelsManager::SetCbName(std::string cbName)
-    {
-        _actual->SetCbName( cbName );
-    }
-
-       //=========================================================================
-    void wxTabPanelsManager::SetCbPackageName(std::string packagename)
-    {
-        _actual->SetCbPackageName( packagename );
-    }
-
-
-       //=========================================================================
-    void wxTabPanelsManager::SetAuthor(std::string author)
-    {
-        _actual->SetAuthor( author );
-    }
-
-
-       //=========================================================================
-    void wxTabPanelsManager::SetCategory(std::string category)
-    {
-        _actual->SetCategory( category );
-    }
-
-
-       //=========================================================================
-    void wxTabPanelsManager::SetDescription(std::string description)
-    {
-        _actual->SetDescription( description );
-    }
-
-
-
-
-
-
-
 
 
 
index 35618a7cec9c0fe0b79654d3ae27c95e9bc5cbd8..ec6cfdf804c9d472167645f43faf9b83e874f673 100644 (file)
@@ -71,7 +71,7 @@ namespace bbtk
                wxTabPanelsManager(wxGUIEditorGraphicBBS *parent);
                ~wxTabPanelsManager();
 
-               void addNewTab(wxString tabName=_T("<void>"));
+               void addNewTab();
                wxAuiNotebook* getAuiNotebook();
                wxGEditorTabPanel* getActualTabPanel();
 
@@ -79,13 +79,13 @@ namespace bbtk
                void updateStatusBar(std::string textStatus);
 
                std::string getActualDiagramBBS(bool wln=false);
-               std::string getActualComplexBoxBBS();
+               std::string getActualComplexBoxBBS(std::string cbName,std::string cbAuthor="",std::string cbCategory="",std::string cbDescription="");
 
                void editBlackBox(GBlackBoxModel *bbmodel);
                void deleteAllBoxesActualDiagram();
                void centerViewActualDiagram();
-               void saveActualDiagram(std::string &content, const std::string &path); //DFCH
-               void loadDiagram(ifstream &inputStream, const std::string &path); //DFCH
+               void saveActualDiagram(std::string &content);
+               void loadDiagram(ifstream &inputStream);
                bool isActualDiagramComplexBox();
                void setActualDiagramComplexBox(bool val);
                void addActualDiagramComplexInputPort(std::string portName);
@@ -96,22 +96,6 @@ namespace bbtk
                void OnTabChanged(wxAuiNotebookEvent& event);
         void VerifyLastTabPanel();
 
-        void SetCbName(std::string cbName);
-        void SetCbPackageName(std::string packagename);
-        void SetAuthor(std::string author);
-        void SetCategory(std::string category);
-        void SetDescription(std::string description);
-        std::string GetCbName();
-        std::string GetCbPackageName();
-        std::string GetAuthor();
-        std::string GetDescription();
-        std::string GetCategory();
-
-           void SetNameTabPanel(wxString tabpanelname);
-           std::string GetCurrentTabPanelPath( ); //DFCH
-
-
-
        private:
 
        // Private Attributes
index b080d31f1933b9544d03025e4e07760b8579206f..3cb95f86f21e22778fb95e3f97f47a42029d7e57 100644 (file)
 /*=========================================================================
- Program:   bbtk
- Module:    $RCSfile$
- Language:  C++
- Date:      $Date$
- Version:   $Revision$
- =========================================================================*/
+Program:   bbtk
+Module:    $RCSfile$
+Language:  C++
+Date:      $Date$
+Version:   $Revision$
+=========================================================================*/
 
 /* ---------------------------------------------------------------------
 
- * 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.
- * ------------------------------------------------------------------------ */
+* 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 Class bbtk::wxVtkSceneManager .
- */
+*  \file
+*  \brief Class bbtk::wxVtkSceneManager .
+*/
+
 
 #include "wxVtkSceneManager.h"
 
-#include <vtkPolygon.h>
-#include <vtkUnstructuredGrid.h>
-
-namespace bbtk {
-
-//=========================================================================
-wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent,
-               wxVtk3DBaseView *baseView, int idManager) {
-       _cbName = "ComplexBoxName";
-       _cbPackageName = "PackageName";
-       _Author = "Author ??";
-       _Category = "<VOID>";
-       _Description = "Description ??";
-
-       _parent = parent;
-       _numBoxes = 0;
-       _idManager = idManager;
-       _baseView = baseView;
-       _startDragging = false;
-       _isComplexBox = false;
-
-       if (_baseView != NULL) {
-               //EED02JUIN2010
-               printf(
-                               "RaC-EED 21-06-2010 %p wxVtkSceneManager::wxVtkSceneManager If you comment this line, the drag and drop functionnality is not initialized.\n",
-                               this);
+ #include <vtkPolygon.h>
+ #include <vtkUnstructuredGrid.h>
+
+
+namespace bbtk
+{
+
+
+       //=========================================================================
+       wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView,int idManager)
+       {
+               _parent                 = parent;
+               _numBoxes               = 0;
+               _idManager              = idManager;
+               _baseView               = baseView;
+               _startDragging  = false;
+               _isComplexBox   = false;
+
+               if( _baseView!=NULL )
+               {
+//EED02JUIN2010
+                       printf ("RaC-EED 21-06-2010 %p wxVtkSceneManager::wxVtkSceneManager If you comment this line, the drag and drop functionnality is not initialized.\n" , this );
 #ifdef __APPLE__
-               _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget((wxDropTarget*)parent);
+                       _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget((wxDropTarget*)parent);
 #endif
 
-               configureBaseView();
-               _worldState = NOTHING_HAPPENS;
-               registerController(this);
+                       configureBaseView();
+                       _worldState=NOTHING_HAPPENS;
+                       registerController(this);
+
+               }
+               _idConnectionInCreation = -1;
+               _contLastId                             = 0;
 
        }
-       _idConnectionInCreation = -1;
-       _contLastId = 0;
-
-}
-
-//=========================================================================
-
-void wxVtkSceneManager::disconnectDrop() {
-       printf("EED %p ~wxVtkSceneManager::disconnectDrop()\n", this);
-       //EED02JUIN2010         _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(NULL);
-       //      _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget( new tmpClasswxTextDropTarget() );
-}
-
-//=========================================================================
-
-wxVtkSceneManager::~wxVtkSceneManager() {
-       //FCY memory leaks
-       printf("EED %p ~wxVtkSceneManager()\n", this);
-       disconnectDrop();
-       delete _baseView;
-}
-
-//=========================================================================
-
-void wxVtkSceneManager::configureBaseView() {
-       printf("EED wxVtkSceneManager::configureBaseView 0\n");
-       vtkInteractorStyleBaseView2D *interactorstylebaseview =
-                       vtkInteractorStyleBaseView2D::New();
-
-       _baseView->SetInteractorStyleBaseView(interactorstylebaseview);
-
-       // Important to activate the 2D interaction system
-       wxVTKRenderWindowInteractor *iren =
-                       _baseView->GetWxVTKRenderWindowInteractor();
-       interactorstylebaseview->SetInteractor(iren);
-       iren->SetInteractorStyle(interactorstylebaseview);
-       interactorstylebaseview->SetwxVtkBaseView(_baseView);
-
-       _baseView->GetRenderer()->GetActiveCamera()->ParallelProjectionOn();
-       _baseView->GetRenderer()->ResetCamera(-100, 100, -100, 100, 800, 1100);
-
-       _baseView->GetRenderer()->SetBackground(0.9, 0.9, 0.9);
-       _baseView->GetRenderer()->GradientBackgroundOn();
-       _baseView->Refresh();
-
-       // Actos Port_Text
-       _textActor = vtkTextActor3D::New();
-       _textActor->SetPosition(-9999, -9999, 900);
-       _textActor->SetInput("<void>");
-       _textActor->GetTextProperty()->SetFontSize(60);
-       _textActor->GetTextProperty()->BoldOn();
-       _textActor->GetTextProperty()->SetColor(PORTTEXT_NH_R, PORTTEXT_NH_G,
-                       PORTTEXT_NH_B);
-
-       _baseView->GetRenderer()->AddActor(_textActor);
-
-       // Actor  Fill_Port_Text
-
-       //------------
-       double xInic = 0;
-       double yInic = 0;
-       double zInic = 900;
-
-       vtkPolygon *aPolygon = vtkPolygon::New();
-       _fillObjectActor = vtkActor::New();
-
-       _pts = vtkPoints::New();
-
-       double w = 100, h = 10, b = h / 15, t = 3;
-       _pts->SetNumberOfPoints(21);
-       _pts->InsertPoint(0, xInic + w * 0.33 - t / 2, yInic, zInic);
-       _pts->InsertPoint(1, xInic + w * 0.33, yInic - t, zInic);
-       _pts->InsertPoint(2, xInic + w * 0.33 + t / 2, yInic, zInic);
-       _pts->InsertPoint(3, xInic + w * 0.33 + t / 2, yInic, zInic);
-       _pts->InsertPoint(4, xInic + w - b * 4, yInic + b * 0, zInic);
-
-       _pts->InsertPoint(5, xInic + w - b * 4, yInic + b * 0, zInic);
-       _pts->InsertPoint(6, xInic + w - b * 2, yInic + b * 1, zInic);
-       _pts->InsertPoint(7, xInic + w - b * 1, yInic + b * 2, zInic);
-       _pts->InsertPoint(8, xInic + w - b * 0, yInic + b * 4, zInic);
-
-       _pts->InsertPoint(9, xInic + w - b * 0, yInic + h - b * 4, zInic);
-       _pts->InsertPoint(10, xInic + w - b * 1, yInic + h - b * 2, zInic);
-       _pts->InsertPoint(11, xInic + w - b * 2, yInic + h - b * 1, zInic);
-       _pts->InsertPoint(12, xInic + w - b * 4, yInic + h - b * 0, zInic);
-
-       _pts->InsertPoint(13, xInic + b * 4, yInic + h - b * 0, zInic);
-       _pts->InsertPoint(14, xInic + b * 2, yInic + h - b * 1, zInic);
-       _pts->InsertPoint(15, xInic + b * 1, yInic + h - b * 2, zInic);
-       _pts->InsertPoint(16, xInic + b * 0, yInic + h - b * 4, zInic);
-
-       _pts->InsertPoint(17, xInic + b * 0, yInic + b * 4, zInic);
-       _pts->InsertPoint(18, xInic + b * 1, yInic + b * 2, zInic);
-       _pts->InsertPoint(19, xInic + b * 2, yInic + b * 1, zInic);
-       _pts->InsertPoint(20, xInic + b * 4, yInic + b * 0, zInic);
-
-       aPolygon->GetPointIds()->SetNumberOfIds(21);
-       for (int i = 0; i < 21; i++) {
-               aPolygon->GetPointIds()->SetId(i, i);
-       }
 
-       vtkUnstructuredGrid *aPolygonGrid = vtkUnstructuredGrid::New();
-       aPolygonGrid->Allocate(1, 1);
-       aPolygonGrid->InsertNextCell(aPolygon->GetCellType(),
-                       aPolygon->GetPointIds());
-       aPolygonGrid->SetPoints(_pts);
-       _aPolygonMapper = vtkDataSetMapper::New();
-       _aPolygonMapper->SetInput(aPolygonGrid);
-       _fillObjectActor->SetMapper(_aPolygonMapper);
-       _fillObjectActor->GetProperty()->SetColor(PORTFILL_NH_R, PORTFILL_NH_G,
-                       PORTFILL_NH_B);
-       _fillObjectActor->GetProperty()->SetOpacity(0);
-       _aPolygonMapper->Modified();
-
-       _baseView->GetRenderer()->AddActor(_fillObjectActor);
-       printf("EED wxVtkSceneManager::configureBaseView 1\n");
-}
-
-//=========================================================================
-
-std::string wxVtkSceneManager::generateANewNameForABox() {
-       std::stringstream boxname;
-       if (_numBoxes < 10) {
-               boxname << "Box0" << _numBoxes;
-       } else {
-               boxname << "Box" << _numBoxes;
+       //=========================================================================
+
+       void wxVtkSceneManager::disconnectDrop()
+       {
+               printf ("EED %p ~wxVtkSceneManager::disconnectDrop()\n" , this );
+//EED02JUIN2010                _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(NULL);
+//     _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget( new tmpClasswxTextDropTarget() );
+       }
+
+       //=========================================================================
+
+       wxVtkSceneManager::~wxVtkSceneManager()
+       {
+               printf ("EED %p ~wxVtkSceneManager()\n" , this );
+               disconnectDrop();
        }
-       _numBoxes++;
-       return boxname.str();
-}
 
-//=========================================================================
+       //=========================================================================
 
-std::string wxVtkSceneManager::findANewNameForABox() {
-       std::string boxname = generateANewNameForABox();
+       void wxVtkSceneManager::configureBaseView()
+       {
+               vtkInteractorStyleBaseView2D *interactorstylebaseview = vtkInteractorStyleBaseView2D::New();
 
-       while (boxExist(boxname) == true) {
-               boxname = generateANewNameForABox();
-       } // while
+               _baseView->SetInteractorStyleBaseView(interactorstylebaseview);
 
-       return boxname;
-}
+               // Important to activate the 2D interaction system
+               wxVTKRenderWindowInteractor *iren = _baseView->GetWxVTKRenderWindowInteractor();
+               interactorstylebaseview->SetInteractor ( iren );
+               iren->SetInteractorStyle(interactorstylebaseview);
+               interactorstylebaseview->SetwxVtkBaseView(_baseView);
 
-//=========================================================================
-void wxVtkSceneManager::configGBlackBox(int idBox, double xIn, double yIn,
-               double zIn, std::string name, bool boxExecutable, double xEn,
-               double yEn, double zEn) {
-       GObjectController *cont = _controllers[idBox];
-       GBlackBoxModel *bbmod = (GBlackBoxModel*) cont->getModel();
-       bbmod->setBBTKName(name);
-       bbmod->setInicPoint(xIn, yIn, zIn);
-       bbmod->setFinalPoint(xEn, yEn, zEn);
-       bbmod->setExecutable(boxExecutable);
+               _baseView->GetRenderer()->GetActiveCamera()->ParallelProjectionOn();
+               _baseView->GetRenderer()->ResetCamera(-100,100,-100,100,800,1100);
 
-       bbmod->notifyObservers(_idManager);
+               _baseView->GetRenderer()->SetBackground(0.9,0.9,0.9);
+               _baseView->GetRenderer()->GradientBackgroundOn();
+               _baseView->Refresh();
 
-}
+               // Actos Port_Text
+               _textActor = vtkTextActor3D::New();
+               _textActor->SetPosition(  -9999 , -9999 , 900 );
+               _textActor->SetInput( "<void>" );
+               _textActor->GetTextProperty()->SetFontSize(60);
+               _textActor->GetTextProperty()->BoldOn();
+               _textActor->GetTextProperty()->SetColor(PORTTEXT_NH_R,PORTTEXT_NH_G,PORTTEXT_NH_B);
 
-//=========================================================================
+               _baseView->GetRenderer()->AddActor( _textActor );
 
-int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName,
-               std::string boxType) {
-       _worldState = NOTHING_HAPPENS;
-       //EED           int windowWidth                                                 = _baseView->GetRenWin()->GetSize()[0];
-       int windowHeight = _baseView->GetRenWin()->GetSize()[1];
 
-       int type = GBLACKBOX;
+               // Actor  Fill_Port_Text
 
-       //Create the MVC Objects
+               //------------
+               double                          xInic                           = 0;
+               double                          yInic                           = 0;
+               double                          zInic                           = 900;
 
-       GBlackBoxModel
-                       *model =
-                                       (GBlackBoxModel*) GObjectsMVCFactory::getInstance()->createGObjectModel(
-                                                       type);
-       vtkGObjectView *view =
-                       GObjectsMVCFactory::getInstance()->createGObjectView(type);
-       GObjectController* controller =
-                       GObjectsMVCFactory::getInstance()->createGObjectController(type);
+               vtkPolygon *aPolygon = vtkPolygon::New();
+               _fillObjectActor                                                = vtkActor::New();
 
-       BlackBoxDescriptor::Pointer descriptor =
-                       GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(
-                                       packageName, boxType);
+                                                       _pts                            = vtkPoints::New();
 
-       //Prepares the initial model
-       //The coordinates obtained are the following. Top-Left:x=0,y=0 Bottom-Right:x=width,y=height
+               double w=100,h=10,b=h/15,t=3;
+               _pts->SetNumberOfPoints(21);
+               _pts->InsertPoint(0, xInic+w*0.33-t/2   , yInic                 , zInic );
+               _pts->InsertPoint(1, xInic+w*0.33               , yInic-t               , zInic );
+               _pts->InsertPoint(2, xInic+w*0.33+t/2   , yInic                 , zInic );
+               _pts->InsertPoint(3, xInic+w*0.33+t/2   , yInic                 , zInic );
+               _pts->InsertPoint(4, xInic+w-b*4                , yInic+b*0             , zInic );
 
-       double xx = x;
-       double yy = windowHeight - y;
+               _pts->InsertPoint( 5, xInic+w-b*4       , yInic+b*0             , zInic );
+               _pts->InsertPoint( 6, xInic+w-b*2       , yInic+b*1             , zInic );
+               _pts->InsertPoint( 7, xInic+w-b*1       , yInic+b*2             , zInic );
+               _pts->InsertPoint( 8, xInic+w-b*0       , yInic+b*4             , zInic );
 
-       //z value is not important yet, because it is only used a parallel projection
-       double zz = 900;
-       _baseView->TransCoordScreenToWorld(xx, yy, zz);
-       model->setInicPoint(xx, yy, zz);
+               _pts->InsertPoint( 9, xInic+w-b*0       , yInic+h-b*4   , zInic );
+               _pts->InsertPoint(10, xInic+w-b*1       , yInic+h-b*2   , zInic );
+               _pts->InsertPoint(11, xInic+w-b*2       , yInic+h-b*1   , zInic );
+               _pts->InsertPoint(12, xInic+w-b*4       , yInic+h-b*0   , zInic );
 
-       std::stringstream stream;
+               _pts->InsertPoint(13, xInic+b*4         , yInic+h-b*0   , zInic );
+               _pts->InsertPoint(14, xInic+b*2         , yInic+h-b*1   , zInic );
+               _pts->InsertPoint(15, xInic+b*1         , yInic+h-b*2   , zInic );
+               _pts->InsertPoint(16, xInic+b*0         , yInic+h-b*4   , zInic );
 
-       std::string newBoxName;
-       newBoxName = findANewNameForABox();
+               _pts->InsertPoint(17, xInic+b*0         , yInic+b*4             , zInic );
+               _pts->InsertPoint(18, xInic+b*1         , yInic+b*2             , zInic );
+               _pts->InsertPoint(19, xInic+b*2         , yInic+b*1             , zInic );
+               _pts->InsertPoint(20, xInic+b*4         , yInic+b*0             , zInic );
 
-       stream << newBoxName;
+               aPolygon->GetPointIds()->SetNumberOfIds(21);
+               for (int i=0;i<21; i++)
+               {
+                       aPolygon->GetPointIds()->SetId(i, i);
+               }
+
+               vtkUnstructuredGrid *aPolygonGrid = vtkUnstructuredGrid::New();
+               aPolygonGrid->Allocate(1, 1);
+               aPolygonGrid->InsertNextCell(aPolygon->GetCellType(), aPolygon->GetPointIds());
+               aPolygonGrid->SetPoints(_pts);
+               _aPolygonMapper = vtkDataSetMapper::New();
+               _aPolygonMapper->SetInput(aPolygonGrid);
+               _fillObjectActor->SetMapper(_aPolygonMapper);
+               _fillObjectActor->GetProperty()->SetColor(PORTFILL_NH_R,PORTFILL_NH_G,PORTFILL_NH_B);
+               _fillObjectActor->GetProperty()->SetOpacity(0);
+               _aPolygonMapper->Modified();
+
+               _baseView->GetRenderer()->AddActor( _fillObjectActor );
+       }
 
-       std::string arraystring = stream.str();
+       //=========================================================================
+
+       std::string wxVtkSceneManager::generateANewNameForABox()
+       {
+               std::stringstream boxname;
+               if(_numBoxes<10)
+               {
+                       boxname << "Box0" << _numBoxes;
+               }else{
+                       boxname << "Box" << _numBoxes;
+               }
+               _numBoxes++;
+               return boxname.str();
+       }
 
-       model->setBBTKName(arraystring);
-       model->setBBTKType(boxType);
-       model->setBBTKPackage(packageName);
+       //=========================================================================
 
-       model->addObserver(view);
-       model->addObserver(this);
+       std::string wxVtkSceneManager::findANewNameForABox()
+       {
+               std::string boxname=generateANewNameForABox();
 
-       //Iterate and create the input ports
-       std::map<std::string, BlackBoxInputDescriptor*> descriptorInMap =
-                       descriptor->GetInputDescriptorMap();
-       std::map<std::string, BlackBoxInputDescriptor*>::iterator itInput;
+               while (boxExist(boxname)==true)
+               {
+                       boxname=generateANewNameForABox();
+               } // while
 
-       int i = 0;
-       for (itInput = descriptorInMap.begin(); itInput != descriptorInMap.end(); ++itInput) {
-               BlackBoxInputDescriptor *desc = itInput->second;
-               createGInputPort(GINPUTPORT, i, model, desc);
-               i++;
+               return boxname;
        }
 
-       //Iterate and create the output ports
-       std::map<std::string, BlackBoxOutputDescriptor*> descriptorOutMap =
-                       descriptor->GetOutputDescriptorMap();
-       std::map<std::string, BlackBoxOutputDescriptor*>::iterator itOutput;
-
-       i = 0;
-       for (itOutput = descriptorOutMap.begin(); itOutput
-                       != descriptorOutMap.end(); ++itOutput) {
-               BlackBoxOutputDescriptor *desc = itOutput->second;
-               createGOutputPort(GOUTPUTPORT, i, model, desc);
-               i++;
+       //=========================================================================
+       void wxVtkSceneManager::configGBlackBox(int idBox, double xIn, double yIn, double zIn, std::string name, bool boxExecutable,double xEn,double yEn,double zEn)
+       {
+               GObjectController *cont = _controllers[idBox];
+               GBlackBoxModel *bbmod   = (GBlackBoxModel*)cont->getModel();
+               bbmod->setBBTKName(name);
+               bbmod->setInicPoint(xIn,yIn,zIn);
+               bbmod->setFinalPoint(xEn,yEn,zEn);
+               bbmod->setExecutable(boxExecutable);
+
+               bbmod->notifyObservers(_idManager);
+
        }
 
-       //Associates the view with the correspondent renderer and the  model.
-       //(NOTE: Refresh is only made by the view)
-       view->setModel(model);
-       view->setBaseView(_baseView);
-       view->initVtkObjects();
 
-       //Associates the controller with the correspondent model and view
-       controller->setModelAndView(model, view);
+       //=========================================================================
+
+       int wxVtkSceneManager::createGBlackBox(int x, int y,  std::string packageName, std::string boxType)
+       {
+               _worldState                                                             = NOTHING_HAPPENS;
+//EED          int windowWidth                                                 = _baseView->GetRenWin()->GetSize()[0];
+               int windowHeight                                                = _baseView->GetRenWin()->GetSize()[1];
+
+               int type                                                                = GBLACKBOX;
+
+               //Create the MVC Objects
+
+               GBlackBoxModel *model                                   = (GBlackBoxModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type);
+               vtkGObjectView *view                                    = GObjectsMVCFactory::getInstance()->createGObjectView(type);
+               GObjectController* controller                   = GObjectsMVCFactory::getInstance()->createGObjectController(type);
 
-       //Resgiter change to the observers of the actual model
-       model->notifyObservers(_idManager);
+               BlackBoxDescriptor::Pointer descriptor  = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxType);
 
-       int newId = addObjectController(controller);
+               //Prepares the initial model
+               //The coordinates obtained are the following. Top-Left:x=0,y=0 Bottom-Right:x=width,y=height
 
-       return newId;
+               double xx = x;
+               double yy = windowHeight-y;
 
-}
+               //z value is not important yet, because it is only used a parallel projection
+               double zz = 900;
+               _baseView->TransCoordScreenToWorld(xx,yy,zz);
+               model->setInicPoint(xx,yy,zz);
 
-//=========================================================================
+               std::stringstream stream;
 
-int wxVtkSceneManager::createGComplexBoxInputPort(std::string inputName) {
-       //EED           int windowWidth=_baseView->GetRenWin()->GetSize()[0];
-       int windowHeight = _baseView->GetRenWin()->GetSize()[1];
+               std::string newBoxName;
+               newBoxName = findANewNameForABox();
 
-       int type = GCOMPLEXINPUTPORT;
 
-       //Create the MVC Objects
+               stream << newBoxName;
 
-       GComplexBoxPortModel
-                       *model =
-                                       (GComplexBoxPortModel*) GObjectsMVCFactory::getInstance()->createGObjectModel(
-                                                       type);
-       vtkGObjectView *view =
-                       GObjectsMVCFactory::getInstance()->createGObjectView(type);
-       GObjectController* controller =
-                       GObjectsMVCFactory::getInstance()->createGObjectController(type);
+               std::string arraystring = stream.str();
 
-       //Prepares the initial model
+               model->setBBTKName(arraystring);
+               model->setBBTKType(boxType);
+               model->setBBTKPackage(packageName);
 
-       double xx = 5;
-       double yy = windowHeight - 5;
+               model->addObserver(view);
+               model->addObserver(this);
 
-       //z value is not important yet, because it is only used a parallel projection
-       double zz = 900;
-       printf("EED  wxVtkSceneManager::createGComplexBoxInputPort 900-450\n");
+               //Iterate and create the input ports
+               std::map<std::string, BlackBoxInputDescriptor*> descriptorInMap = descriptor->GetInputDescriptorMap();
+               std::map<std::string, BlackBoxInputDescriptor*>::iterator itInput;
+
+               int i=0;
+               for(itInput = descriptorInMap.begin(); itInput != descriptorInMap.end(); ++itInput)
+               {
+                       BlackBoxInputDescriptor *desc = itInput->second;
+                       createGInputPort(GINPUTPORT,i,model,desc);
+                       i++;
+               }
+
+               //Iterate and create the output ports
+               std::map<std::string, BlackBoxOutputDescriptor*> descriptorOutMap = descriptor->GetOutputDescriptorMap();
+               std::map<std::string, BlackBoxOutputDescriptor*>::iterator itOutput;
+
+               i=0;
+               for(itOutput = descriptorOutMap.begin();itOutput != descriptorOutMap.end(); ++itOutput)
+               {
+                       BlackBoxOutputDescriptor *desc = itOutput->second;
+                       createGOutputPort(GOUTPUTPORT,i,model,desc);
+                       i++;
+               }
 
-       _baseView->TransCoordScreenToWorld(xx, yy, zz);
-       model->setInicPoint(xx, yy, zz);
 
-       model->setBBTKName(inputName);
-       model->setBBTKType("ComplexInputPort");
-       model->setComplexPortType(type);
+               //Associates the view with the correspondent renderer and the  model.
+               //(NOTE: Refresh is only made by the view)
+               view->setModel(model);
+               view->setBaseView(_baseView);
+               view->initVtkObjects();
 
-       model->addObserver(view);
-       model->addObserver(this);
+               //Associates the controller with the correspondent model and view
+               controller->setModelAndView(model,view);
 
-       //create the output port
-       GPortController* portController = createGPort(GOUTPUTPORT, inputName,
-                       "ComplexInputPort", 0, model);
-       model->addOutputPort((GPortModel*) portController->getModel());
+               //Resgiter change to the observers of the actual model
+               model->notifyObservers(_idManager);
 
-       //Associates the view with the correspondent renderer and the  model.
-       //(NOTE: Refresh is only made by the view)
-       view->setModel(model);
-       view->setBaseView(_baseView);
-       view->initVtkObjects();
+               int newId = addObjectController(controller);
 
-       //Associates the controller with the correspondent model and view
-       controller->setModelAndView(model, view);
+               return newId;
 
-       //Resgiter change to the observers of the actual model
-       model->notifyObservers(_idManager);
+       }
 
-       int newId = addObjectController(controller);
-       return newId;
-}
+       //=========================================================================
 
-//=========================================================================
+       int wxVtkSceneManager::createGComplexBoxInputPort(std::string inputName)
+       {
+//EED          int windowWidth=_baseView->GetRenWin()->GetSize()[0];
+               int windowHeight=_baseView->GetRenWin()->GetSize()[1];
 
-int wxVtkSceneManager::createGComplexBoxOutputPort(std::string outputName) {
-       //EED           int windowWidth=_baseView->GetRenWin()->GetSize()[0];
-       int windowHeight = _baseView->GetRenWin()->GetSize()[1];
+               int type                                                = GCOMPLEXINPUTPORT;
 
-       int type = GCOMPLEXOUTPUTPORT;
+               //Create the MVC Objects
 
-       //Create the MVC Objects
+               GComplexBoxPortModel *model             = (GComplexBoxPortModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type);
+               vtkGObjectView *view                    = GObjectsMVCFactory::getInstance()->createGObjectView(type);
+               GObjectController* controller   = GObjectsMVCFactory::getInstance()->createGObjectController(type);
 
-       GComplexBoxPortModel
-                       *model =
-                                       (GComplexBoxPortModel*) GObjectsMVCFactory::getInstance()->createGObjectModel(
-                                                       type);
-       vtkGObjectView *view =
-                       GObjectsMVCFactory::getInstance()->createGObjectView(type);
-       GObjectController *controller =
-                       GObjectsMVCFactory::getInstance()->createGObjectController(type);
+               //Prepares the initial model
 
-       //Prepares the initial model
+               double xx                                               = 5;
+               double yy                                               = windowHeight-5;
 
-       double xx = 5;
-       double yy = windowHeight - 5;
+               //z value is not important yet, because it is only used a parallel projection
+               double zz                                               = 900;
+printf("EED  wxVtkSceneManager::createGComplexBoxInputPort 900-450\n");
 
-       //z value is not important yet, because it is only used a parallel projection
-       double zz = 900;
+               _baseView->TransCoordScreenToWorld(xx,yy,zz);
+               model->setInicPoint(xx,yy,zz);
 
-       printf("EED  wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n");
+               model->setBBTKName(inputName);
+               model->setBBTKType("ComplexInputPort");
+               model->setComplexPortType(type);
 
-       _baseView->TransCoordScreenToWorld(xx, yy, zz);
-       model->setInicPoint(xx, yy, zz);
+               model->addObserver(view);
+               model->addObserver(this);
 
-       model->setBBTKName(outputName);
-       model->setBBTKType("ComplexOutputPort");
-       model->setComplexPortType(type);
+               //create the output port
+               GPortController* portController = createGPort(GOUTPUTPORT,inputName,"ComplexInputPort",0,model);
+               model->addOutputPort((GPortModel*)portController->getModel());
 
-       model->addObserver(view);
-       model->addObserver(this);
+               //Associates the view with the correspondent renderer and the  model.
+               //(NOTE: Refresh is only made by the view)
+               view->setModel(model);
+               view->setBaseView(_baseView);
+               view->initVtkObjects();
 
-       //create the output port
-       GPortController* portController = createGPort(GINPUTPORT, outputName,
-                       "ComplexInputPort", 0, model);
-       model->addInputPort((GPortModel*) portController->getModel());
+               //Associates the controller with the correspondent model and view
+               controller->setModelAndView(model,view);
 
-       //Associates the view with the correspondent renderer and the  model.
-       //(NOTE: Refresh is only made by the view)
-       view->setModel(model);
-       view->setBaseView(_baseView);
-       view->initVtkObjects();
+               //Resgiter change to the observers of the actual model
+               model->notifyObservers(_idManager);
 
-       //Associates the controller with the correspondent model and view
-       controller->setModelAndView(model, view);
+               int newId = addObjectController(controller);
+               return newId;
+       }
 
-       //Resgiter change to the observers of the actual model
-       model->notifyObservers(_idManager);
+       //=========================================================================
 
-       int newId = addObjectController(controller);
-       return newId;
-}
+       int wxVtkSceneManager::createGComplexBoxOutputPort(std::string outputName)
+       {
+//EED          int windowWidth=_baseView->GetRenWin()->GetSize()[0];
+               int windowHeight=_baseView->GetRenWin()->GetSize()[1];
 
-//=========================================================================
+               int type                                                = GCOMPLEXOUTPUTPORT;
 
-int wxVtkSceneManager::createGInputPort(int portType, int posinBox,
-               GBoxModel *blackBox, BlackBoxInputDescriptor *desc) {
-       GPortController* portController = createGPort(portType, desc->GetName(),
-                       desc->GetTypeName(), posinBox, blackBox);
-       blackBox->addInputPort((GPortModel*) portController->getModel());
-       return portController->getId();
-}
+               //Create the MVC Objects
 
-//=========================================================================
+               GComplexBoxPortModel    *model          = (GComplexBoxPortModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type);
+               vtkGObjectView                  *view           = GObjectsMVCFactory::getInstance()->createGObjectView(type);
+               GObjectController               *controller     = GObjectsMVCFactory::getInstance()->createGObjectController(type);
 
-int wxVtkSceneManager::createGOutputPort(int portType, int posinBox,
-               GBoxModel *blackBox, BlackBoxOutputDescriptor *desc) {
-       GPortController* portController = createGPort(portType, desc->GetName(),
-                       desc->GetTypeName(), posinBox, blackBox);
-       blackBox->addOutputPort((GPortModel*) portController->getModel());
-       return portController->getId();
-}
+               //Prepares the initial model
 
-//=========================================================================
+               double xx                                               = 5;
+               double yy                                               = windowHeight-5;
 
-GPortController* wxVtkSceneManager::createGPort(int portType,
-               std::string bbtkName, std::string bbtkType, int posInBox,
-               GBoxModel *blackBox) {
-       int type = GPORT;
+               //z value is not important yet, because it is only used a parallel projection
+               double zz                                               = 900;
 
-       //Create the MVC Objects
-       GPortModel
-                       *model =
-                                       (GPortModel*) GObjectsMVCFactory::getInstance()->createGObjectModel(
-                                                       type);
-       vtkGObjectView *view =
-                       GObjectsMVCFactory::getInstance()->createGObjectView(type);
-       GObjectController* controller =
-                       GObjectsMVCFactory::getInstance()->createGObjectController(type);
+printf("EED  wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n");
 
-       model->registerInBox(blackBox, portType, posInBox);
+               _baseView->TransCoordScreenToWorld(xx,yy,zz);
+               model->setInicPoint(xx,yy,zz);
 
-       model->setBBTKType(bbtkType);
-       model->setBBTKName(bbtkName);
+               model->setBBTKName(outputName);
+               model->setBBTKType("ComplexOutputPort");
+               model->setComplexPortType(type);
 
-       model->addObserver(view);
-       model->addObserver(this);
+               model->addObserver(view);
+               model->addObserver(this);
 
-       //Associates the view with the correspondent renderer and the  model.
-       //(NOTE: Refresh is only made by the view)
-       view->setModel(model);
-       view->setBaseView(_baseView);
-       view->initVtkObjects();
+               //create the output port
+               GPortController* portController = createGPort(GINPUTPORT,outputName,"ComplexInputPort",0,model);
+               model->addInputPort((GPortModel*)portController->getModel());
 
-       //Associates the controller with the correspondent model and view
-       controller->setModelAndView(model, view);
+               //Associates the view with the correspondent renderer and the  model.
+               //(NOTE: Refresh is only made by the view)
+               view->setModel(model);
+               view->setBaseView(_baseView);
+               view->initVtkObjects();
 
-       model->notifyObservers(_idManager);
+               //Associates the controller with the correspondent model and view
+               controller->setModelAndView(model,view);
 
-       addObjectController(controller);
+               //Resgiter change to the observers of the actual model
+               model->notifyObservers(_idManager);
 
-       return (GPortController*) controller;
-}
+               int newId = addObjectController(controller);
+               return newId;
+       }
 
-//=========================================================================
+       //=========================================================================
 
-int wxVtkSceneManager::createGConnector(GPortModel* startPort) {
-       int type = GCONNECTOR;
+       int wxVtkSceneManager::createGInputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxInputDescriptor *desc)
+       {
+               GPortController* portController = createGPort(portType,desc->GetName(),desc->GetTypeName(),posinBox,blackBox);
+               blackBox->addInputPort((GPortModel*)portController->getModel());
+               return portController->getId();
+       }
 
-       manualConnectorContourController* manContourControl =
-                       new manualConnectorContourController();
-       manualConnectorContourView* manContourView =
-                       new manualConnectorContourView();
-       manualContourModel* manContourModel = new manualContourModel();
+       //=========================================================================
 
-       GConnectorController* connectorcontroller = new GConnectorController();
-       GConnectorModel* connectorModel = new GConnectorModel();
-       vtkGConnectorView* connectorView = new vtkGConnectorView();
-       connectorModel->setGObjectType(type);
+       int wxVtkSceneManager::createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc)
+       {
+               GPortController* portController = createGPort(portType,desc->GetName(),desc->GetTypeName(),posinBox,blackBox);
+               blackBox->addOutputPort((GPortModel*)portController->getModel());
+               return portController->getId();
+       }
 
-       manContourModel->SetCloseContour(false);
-       connectorModel->setStartPort(startPort);
+       //=========================================================================
 
-       manContourView->SetModel(manContourModel);
-       manContourView->SetWxVtkBaseView(_baseView);
-       manContourView->SetRange(0.5);
-       manContourView->SetZ(900);
+       GPortController* wxVtkSceneManager::createGPort(int portType,std::string bbtkName, std::string bbtkType, int posInBox,GBoxModel *blackBox)
+       {
+               int type = GPORT;
 
-       manContourView->SetColorNormalContour(0, 0, 1);
-       manContourView->SetColorEditContour(0.5, 0.5, 0.5);
-       manContourView->SetColorSelectContour(1, 0.8, 0);
-       manContourView->SetWidthLine(1);
-       manContourView->SetShowText(false);
+               //Create the MVC Objects
+               GPortModel *model                               = (GPortModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type);
+               vtkGObjectView *view                    = GObjectsMVCFactory::getInstance()->createGObjectView(type);
+               GObjectController* controller   = GObjectsMVCFactory::getInstance()->createGObjectController(type);
 
-       manContourControl->SetModelView(manContourModel, manContourView);
+               model->registerInBox(blackBox,portType, posInBox);
 
-       manContourControl->CreateNewManualContour();
+               model->setBBTKType(bbtkType);
+               model->setBBTKName(bbtkName);
 
-       manContourView->RefreshContour();
+               model->addObserver(view);
+               model->addObserver(this);
 
-       double x, y, z;
-       connectorModel->getInicPoint(x, y, z);
+               //Associates the view with the correspondent renderer and the  model.
+               //(NOTE: Refresh is only made by the view)
+               view->setModel(model);
+               view->setBaseView(_baseView);
+               view->initVtkObjects();
 
-       manContourControl->SetState(1);
-       manContourModel->SetCloseContour(false);
+               //Associates the controller with the correspondent model and view
+               controller->setModelAndView(model,view);
 
-       manContourModel->AddPoint(x, y, z);
-       manContourView->AddPoint();
+               model->notifyObservers(_idManager);
 
-       manContourModel->AddPoint(x, y, z);
-       manContourView->AddPoint();
+               addObjectController(controller);
 
-       int bak = manContourControl->GetNumberOfPointsManualContour() - 1;
-       manContourControl->_bakIdPoint = bak;
-       manContourView->Refresh();
+               return (GPortController*)controller;
+       }
 
-       manContourControl->SetMoving(false);
+       //=========================================================================
 
-       connectorcontroller->setModelAndView(connectorModel, connectorView);
+       int wxVtkSceneManager::createGConnector(GPortModel* startPort)
+       {
+               int type = GCONNECTOR;
 
-       int newId = addObjectController(connectorcontroller);
+               manualConnectorContourController* manContourControl     = new manualConnectorContourController();
+               manualConnectorContourView* manContourView                      = new manualConnectorContourView();
+               manualContourModel* manContourModel                                     = new manualContourModel();
 
-       connectorcontroller->setManualContourController(manContourControl);
-       connectorModel->setManualContourModel(manContourModel);
-       connectorView->setManualContourView(manContourView);
-       connectorView->setModel(connectorModel);
-       connectorView->setBaseView(_baseView);
+               GConnectorController* connectorcontroller                       = new GConnectorController();
+               GConnectorModel* connectorModel                                         = new GConnectorModel();
+               vtkGConnectorView* connectorView                                        = new vtkGConnectorView();
+               connectorModel->setGObjectType(type);
 
-       connectorModel->addObserver(connectorView);
-       connectorModel->addObserver(this);
+               manContourModel->SetCloseContour(false);
+               connectorModel->setStartPort(startPort);
 
-       return newId;
-}
+               manContourView->SetModel( manContourModel );
+               manContourView->SetWxVtkBaseView( _baseView );
+               manContourView->SetRange( 0.5 );
+               manContourView->SetZ( 900 );
 
-//=========================================================================
+               manContourView->SetColorNormalContour(0, 0, 1);
+               manContourView->SetColorEditContour(0.5, 0.5, 0.5);
+               manContourView->SetColorSelectContour(1, 0.8, 0);
+               manContourView->SetWidthLine(1);
+               manContourView->SetShowText(false);
 
-void wxVtkSceneManager::registerController(InteractorStyleMaracas *param) {
-       vtkInteractorStyleBaseView
-                       * baseViewControlManager =
-                                       (vtkInteractorStyleBaseView*) _baseView->GetInteractorStyleBaseView();
-       baseViewControlManager->AddInteractorStyleMaracas(param);
-}
+               manContourControl->SetModelView( manContourModel , manContourView );
 
-//=========================================================================
+               manContourControl->CreateNewManualContour();
 
-void wxVtkSceneManager::unregisterController(InteractorStyleMaracas *param) {
-       vtkInteractorStyleBaseView
-                       * baseViewControlManager =
-                                       (vtkInteractorStyleBaseView*) _baseView->GetInteractorStyleBaseView();
-       baseViewControlManager->RemoveInteractorStyleMaracas(param);
-}
+               manContourView->RefreshContour();
 
-//=========================================================================
 
-vtkRenderer* wxVtkSceneManager::getRenderer() {
-       return _baseView->GetRenderer();
-}
+               double x,y,z;
+               connectorModel->getInicPoint(x,y,z);
 
-//=========================================================================
+               manContourControl->SetState(1);
+               manContourModel->SetCloseContour(false);
 
-vtkRenderWindow* wxVtkSceneManager::getRenderWindow() {
-       return _baseView->GetRenWin();
-}
-//=========================================================================
+               manContourModel->AddPoint(x,y,z);
+               manContourView->AddPoint();
 
+               manContourModel->AddPoint(x,y,z);
+               manContourView->AddPoint();
 
-//=========================================================================
-int wxVtkSceneManager::GetIndexInSelected(int idControler) {
-       int index = -1;
-       for (int i = 0; i < (int) _selectedObjects.size(); i++) {
-               if (_selectedObjects[i] == idControler) {
-                       index = i;
-                       break;
-               }
+               int bak= manContourControl->GetNumberOfPointsManualContour() - 1;
+               manContourControl->_bakIdPoint=bak;
+               manContourView->Refresh();
+
+               manContourControl->SetMoving( false );
+
+               connectorcontroller->setModelAndView(connectorModel,connectorView);
+
+               int newId = addObjectController(connectorcontroller);
+
+               connectorcontroller->setManualContourController(manContourControl);
+               connectorModel->setManualContourModel(manContourModel);
+               connectorView->setManualContourView(manContourView);
+               connectorView->setModel(connectorModel);
+               connectorView->setBaseView(_baseView);
+
+
+               connectorModel->addObserver(connectorView);
+               connectorModel->addObserver(this);
+
+               return newId;
        }
-       return index;
-}
-//=========================================================================
 
-void wxVtkSceneManager::update(int idController, int command) {
+       //=========================================================================
 
-       if (command != NO_COMMAND) {
-               if (command == ADD_TO_SELECTED) {
-                       //EEDBorrame                            GObjectController* cont = _controllers[idController];
+       void wxVtkSceneManager::registerController(InteractorStyleMaracas *param)
+       {
+               vtkInteractorStyleBaseView* baseViewControlManager = (vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView();
+               baseViewControlManager->AddInteractorStyleMaracas( param );
+       }
 
-                       if (GetIndexInSelected(idController) == -1) {
-                               _selectedObjects.push_back(idController);
-                       }
+       //=========================================================================
 
-                       //EEDBorrame
-                       //                              bool foundID=false;
-                       //                              for (int i=0; i<(int)_selectedObjects.size() && foundID==false; i++)
-                       //                              {
-                       //                                      if(_selectedObjects[i]==idController)
-                       //                                      {
-                       //                                              foundID = true;
-                       //                                      }
-                       //                              }
-                       //                              if(!foundID)
-                       //                              {
-                       //                                      _selectedObjects.push_back(idController);
-                       //                              }
-
-               } else if (command == REMOVE_FROM_SELECTED) {
-                       int index = GetIndexInSelected(idController);
-                       if (index >= 0) {
-                               _selectedObjects.erase(_selectedObjects.begin() + index);
-                       }
-               } else if (command == INIT_CREATION_CONTOUR) {
-                       _worldState = INIT_CREATION_CONTOUR;
-                       GObjectController* cont = _controllers[idController];
-                       GPortModel* startOutputPort = (GPortModel*) cont->getModel();
-
-                       // The last one is the controller of the connector
-                       std::map<int, GObjectController*>::iterator it2;
-
-                       for (it2 = _controllers.begin(); it2 != _controllers.end(); ++it2) {
-                               GObjectController *cont = it2->second;
-                               if (cont->getGObjectType() == GPORT) {
-                                       GPortModel* port = (GPortModel*) cont->getModel();
-                                       if (port->getPortType() == GINPUTPORT) {
-                                               cont->SetActive(true);
-                                       } else {
+       void wxVtkSceneManager::unregisterController(InteractorStyleMaracas *param)
+       {
+               vtkInteractorStyleBaseView* baseViewControlManager = (vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView();
+               baseViewControlManager->RemoveInteractorStyleMaracas( param );
+       }
+
+       //=========================================================================
+
+       vtkRenderer* wxVtkSceneManager::getRenderer()
+       {
+               return _baseView->GetRenderer();
+       }
+
+       //=========================================================================
+
+       vtkRenderWindow* wxVtkSceneManager::getRenderWindow()
+       {
+               return _baseView->GetRenWin();
+       }
+       //=========================================================================
+
+
+       //=========================================================================
+    int wxVtkSceneManager::GetIndexInSelected(int idControler)
+    {
+        int index=-1;
+        for (int i=0; i<(int)_selectedObjects.size(); i++)
+        {
+            if(_selectedObjects[i]==idControler)
+            {
+                index=i;
+                break;
+            }
+        }
+        return index;
+    }
+       //=========================================================================
+
+       void wxVtkSceneManager::update(int idController,int command)
+       {
+
+               if(command != NO_COMMAND)
+               {
+                       if(command == ADD_TO_SELECTED)
+                       {
+//EEDBorrame                           GObjectController* cont = _controllers[idController];
+
+                if (GetIndexInSelected(idController)==-1)
+                               {
+                                       _selectedObjects.push_back(idController);
+                               }
+
+//EEDBorrame
+//                             bool foundID=false;
+//                             for (int i=0; i<(int)_selectedObjects.size() && foundID==false; i++)
+//                             {
+//                                     if(_selectedObjects[i]==idController)
+//                                     {
+//                                             foundID = true;
+//                                     }
+//                             }
+//                             if(!foundID)
+//                             {
+//                                     _selectedObjects.push_back(idController);
+//                             }
+
+                       }else if(command == REMOVE_FROM_SELECTED)
+            {
+                int index=GetIndexInSelected(idController);
+                if (index>=0)
+                {
+                    _selectedObjects.erase( _selectedObjects.begin()+index );
+                }
+            }
+                       else if(command == INIT_CREATION_CONTOUR)
+                       {
+                               _worldState                 = INIT_CREATION_CONTOUR;
+                               GObjectController* cont     = _controllers[idController];
+                               GPortModel* startOutputPort = (GPortModel*)cont->getModel();
+
+
+                               // The last one is the controller of the connector
+                               std::map<int, GObjectController*>::iterator it2;
+
+                               for(it2 = _controllers.begin(); it2 != _controllers.end(); ++it2)
+                               {
+                                       GObjectController *cont = it2->second;
+                                       if(cont->getGObjectType() == GPORT )
+                                       {
+                                               GPortModel* port = (GPortModel*)cont->getModel();
+                                               if(port->getPortType()==GINPUTPORT)
+                                               {
+                                                       cont->SetActive(true);
+                                               }
+                                               else
+                                               {
+                                                       cont->getView()->setState(NOTHING_HAPPENS);
+                                                       cont->getModel()->notifyObservers(_idManager);
+                                                       cont->SetActive(false);
+                                               }
+                                       }
+                                       else
+                                       {
                                                cont->getView()->setState(NOTHING_HAPPENS);
                                                cont->getModel()->notifyObservers(_idManager);
                                                cont->SetActive(false);
                                        }
-                               } else {
-                                       cont->getView()->setState(NOTHING_HAPPENS);
-                                       cont->getModel()->notifyObservers(_idManager);
-                                       cont->SetActive(false);
                                }
+                               _selectedObjects.clear();
+                               _idConnectionInCreation=createGConnector(startOutputPort);
                        }
-                       _selectedObjects.clear();
-                       _idConnectionInCreation = createGConnector(startOutputPort);
-               } else if (command == FIN_CREATION_CONTOUR && _worldState
-                               == INIT_CREATION_CONTOUR) {
-                       _worldState = NOTHING_HAPPENS;
-                       //int id = _controllers.size()-1;
-                       GObjectController *cont = _controllers[_idConnectionInCreation];
-                       GConnectorModel *modelContour = (GConnectorModel*) cont->getModel();
-                       GObjectController *finPort = _controllers[idController];
-
-                       if (finPort->getGObjectType() == GPORT) {
-                               GPortModel* modelPort = (GPortModel*) finPort->getModel();
-                               modelContour->setEndPort(modelPort);
-                       }
+                       else if(command == FIN_CREATION_CONTOUR && _worldState == INIT_CREATION_CONTOUR)
+                       {
+                               _worldState                                             =       NOTHING_HAPPENS;
+                               //int id = _controllers.size()-1;
+                               GObjectController       *cont                   = _controllers[_idConnectionInCreation];
+                               GConnectorModel         *modelContour   = (GConnectorModel*)cont->getModel();
+                               GObjectController       *finPort                = _controllers[idController];
+
+                               if(finPort->getGObjectType() == GPORT)
+                               {
+                                       GPortModel* modelPort = (GPortModel*)finPort->getModel();
+                                       modelContour->setEndPort(modelPort);
+                               }
+
+                               manualConnectorContourController* manCont = ((GConnectorController*)cont)->getManualContourController();
+                               manualConnectorContourView* connView = (manualConnectorContourView*)manCont->GetManualViewBaseContour();
+                               connView->Refresh();
 
-                       manualConnectorContourController
-                                       * manCont =
-                                                       ((GConnectorController*) cont)->getManualContourController();
-                       manualConnectorContourView
-                                       * connView =
-                                                       (manualConnectorContourView*) manCont->GetManualViewBaseContour();
-                       connView->Refresh();
-
-                       std::map<int, GObjectController*>::iterator it2;
-
-                       for (it2 = _controllers.begin(); it2 != _controllers.end(); ++it2) {
-                               GObjectController *cont = it2->second;
-                               if (cont->getView() != NULL) {
-                                       cont->getView()->setState(NOTHING_HAPPENS);
-                                       cont->getModel()->notifyObservers(_idManager);
+                               std::map<int, GObjectController*>::iterator it2;
+
+                               for(it2 = _controllers.begin(); it2 != _controllers.end(); ++it2)
+                               {
+                                       GObjectController *cont = it2->second;
+                                       if(cont->getView()!=NULL)
+                                       {
+                                               cont->getView()->setState(NOTHING_HAPPENS);
+                                               cont->getModel()->notifyObservers(_idManager);
+                                       }
+                                       cont->SetActive(true);
                                }
-                               cont->SetActive(true);
                        }
+
                }
 
        }
 
-}
-
-//=========================================================================
-
-bool wxVtkSceneManager::OnMouseMove() {
-       int X, Y;
-       bool okStatusMessage = false;
-       bool okPortMessage = false;
-       wxVTKRenderWindowInteractor *wxVTKiren;
-       wxVTKiren
-                       = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
-       wxVTKiren->GetEventPosition(X, Y);
-
-       if (_worldState == DRAG_OBJECTS) {
-               for (int i = 0; i < (int) _selectedObjects.size(); i++) {
-                       int id = _selectedObjects[i];
-                       GObjectController* cont = _controllers[id];
-                       if (_startDragging) {
-                               cont->getView()->setStartDragging(true);
+       //=========================================================================
+
+       bool wxVtkSceneManager::OnMouseMove()
+       {
+               int X,Y;
+               bool okStatusMessage    = false;
+               bool okPortMessage              = false;
+               wxVTKRenderWindowInteractor *wxVTKiren;
+               wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+               wxVTKiren->GetEventPosition(X,Y);
+
+
+               if(_worldState == DRAG_OBJECTS)
+               {
+                       for (int i=0; i<(int)_selectedObjects.size(); i++)
+                       {
+                               int id = _selectedObjects[i];
+                               GObjectController* cont = _controllers[id];
+                               if(_startDragging)
+                               {
+                                       cont->getView()->setStartDragging(true);
+                               }
+                               cont->getView()->moveObject(X,Y);
+                               cont->getView()->setState(DRAG);
+                               cont->getModel()->notifyObservers(_idManager);
                        }
-                       cont->getView()->moveObject(X, Y);
-                       cont->getView()->setState(DRAG);
-                       cont->getModel()->notifyObservers(_idManager);
-               }
 
-               std::map<int, GObjectController*>::iterator it;
+                       std::map<int, GObjectController*>::iterator it;
 
-               for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-                       GObjectController *desc = it->second;
-                       if (desc->getGObjectType() == GCONNECTOR) {
-                               vtkGConnectorView* vconn = (vtkGConnectorView*) desc->getView();
-                               vconn->updateStartEndPoints();
+
+                       for(it = _controllers.begin(); it != _controllers.end(); ++it)
+                       {
+                               GObjectController *desc = it->second;
+                               if(desc->getGObjectType()==GCONNECTOR)
+                               {
+                                       vtkGConnectorView* vconn = (vtkGConnectorView*)desc->getView();
+                                       vconn->updateStartEndPoints();
+                               }
                        }
-               }
 
-               _startDragging = false;
+                       _startDragging=false;
 
-       } else if (_worldState == NOTHING_HAPPENS || _worldState
-                       == INIT_CREATION_CONTOUR) {
-               std::map<int, GObjectController*>::iterator it;
-               double px, py, pz;
-               for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-                       GObjectController *desc = it->second;
-                       int type = desc->getGObjectType();
-                       int state = desc->getView()->getState();
-                       desc->getModel()->getCenter(px, py, pz);
-
-                       if (state == HIGHLIGHTED) {
-                               okStatusMessage = true;
-                               updateStatusBar(desc->getStatusText());
-                               if (type == GBLACKBOX) {
-                                       GBlackBoxModel *mod = (GBlackBoxModel*) desc->getModel();
-                                       _parent->displayBlackBoxInfo(mod->getBBTKPackage(),
-                                                       mod->getBBTKType());
-                               } // if GBLACKBOX
-                               if (type == GPORT) {
-                                       // PortText
-                                       okPortMessage = true;
-                                       py = py + 5;
-                                       _textActor->SetInput(desc->getStatusText().c_str());
-                                       _textActor->SetScale(0.1);
-                                       _textActor->SetPosition(px - 25, py + 1, pz + 2);
-
-                                       // FillPortText
-                                       px = px - 33;
-                                       py = py;
-                                       _fillObjectActor->SetScale(1);
-                                       _fillObjectActor->GetProperty()->SetOpacity(0.50);
-                                       _fillObjectActor->SetPosition(px, py, 1);
-                                       _aPolygonMapper->Modified();
-                               } // if GPORT
-
-                       } // for controllers it
                }
-       }
-       if (okStatusMessage == false) {
-               updateStatusBar("");
-       }
+               else if(_worldState == NOTHING_HAPPENS || _worldState == INIT_CREATION_CONTOUR)
+               {
+                       std::map<int, GObjectController*>::iterator it;
+                       double px, py, pz;
+                       for(it = _controllers.begin(); it != _controllers.end(); ++it)
+                       {
+                               GObjectController *desc = it->second;
+                               int type                                = desc->getGObjectType();
+                               int state                               = desc->getView()->getState();
+                               desc->getModel()->getCenter(px,py,pz);
+
+                               if(state == HIGHLIGHTED){
+                                       okStatusMessage = true;
+                                       updateStatusBar(desc->getStatusText());
+                                       if(type==GBLACKBOX)
+                                       {
+                                               GBlackBoxModel *mod = (GBlackBoxModel*)desc->getModel();
+                                               _parent->displayBlackBoxInfo(mod->getBBTKPackage(),mod->getBBTKType());
+                                       } // if GBLACKBOX
+                                       if(type==GPORT)
+                                       {
+                                               // PortText
+                                               okPortMessage   =       true;
+                                               py=py+5;
+                                               _textActor->SetInput( desc->getStatusText().c_str() );
+                                               _textActor->SetScale(0.1);
+                                               _textActor->SetPosition(  px-25 ,py+1 , pz+2 );
+
+                                               // FillPortText
+                                               px=px-33;
+                                               py=py;
+                                               _fillObjectActor->SetScale(1);
+                                               _fillObjectActor->GetProperty()->SetOpacity(0.50);
+                                               _fillObjectActor->SetPosition(px,py,1);
+                                               _aPolygonMapper->Modified();
+                                       } // if GPORT
+
+                               } // for controllers it
+                       }
+               }
+               if (okStatusMessage==false)
+               {
+                       updateStatusBar("");
+               }
 
-       if (okPortMessage == false) {
-               _textActor->SetScale(0.0001);
-               _fillObjectActor->SetScale(0.0001);
+               if (okPortMessage==false)
+               {
+                       _textActor->SetScale(0.0001);
+                       _fillObjectActor->SetScale(0.0001);
+               }
+               return true;
        }
-       return true;
-}
-
-//=========================================================================
-
-bool wxVtkSceneManager::OnLeftButtonDown() {
 
-       if (_worldState == INIT_CREATION_CONTOUR) {
-               bool isOverPort = false;
-               std::map<int, GObjectController*>::iterator it;
-               for (it = _controllers.begin(); it != _controllers.end() && isOverPort
-                               == false; ++it) {
-                       GObjectController *desc = it->second;
-                       if (desc->getGObjectType() == GPORT) {
-                               GPortModel *portmod = (GPortModel*) desc->getModel();
-                               vtkGObjectView *portView = desc->getView();
-                               if (portmod->getPortType() == GINPUTPORT
-                                               && portView->getState() == HIGHLIGHTED) {
-                                       isOverPort = true;
+       //=========================================================================
+
+       bool wxVtkSceneManager::OnLeftButtonDown()
+       {
+
+               if(_worldState==INIT_CREATION_CONTOUR)
+               {
+                       bool isOverPort=false;
+                       std::map<int, GObjectController*>::iterator it;
+                       for(it = _controllers.begin(); it != _controllers.end() && isOverPort==false; ++it)
+                       {
+                               GObjectController *desc = it->second;
+                               if(desc->getGObjectType()==GPORT)
+                               {
+                                       GPortModel              *portmod        = (GPortModel*)desc->getModel();
+                                       vtkGObjectView  *portView       = desc->getView();
+                                       if(portmod->getPortType()==GINPUTPORT && portView->getState()==HIGHLIGHTED)
+                                       {
+                                               isOverPort=true;
+                                       } // if
                                } // if
-                       } // if
-               } // for
+                       } // for
 
-               if (isOverPort == false) {
-                       CancelConnection();
-                       UnSelectBlackBoxes();
-               } // isOverPort
+                       if(isOverPort==false)
+                       {
+                               CancelConnection();
+                               UnSelectBlackBoxes();
+                       } // isOverPort
+
+               } else {  //_worldState
+                       
+                       _worldState                             = DRAG_OBJECTS;
+                       _startDragging                  = true;
+                       
+                       int shiftkey            = _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey();
+                       int ctrlkey             = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey();
+                       ctrlkey = ctrlkey + shiftkey;
+                       
+                       GObjectController *cont = GetGBlackBoxControlerPointedByMouse();
+
+                       
+                       if (GetGBlackBoxControlerPointedByMouse()!=NULL)
+                       {
+                               int state=cont->getView()->getState() ;
+                               if(  (ctrlkey==0) && (state==HIGHLIGHTED) )
+                               {
+                                       UnSelectBlackBoxes();
+                               }
+                       }
+                       for (int i = 0; i < (int)_selectedObjects.size(); i++)
+                       {
+                               int id = _selectedObjects[i];
+                               GObjectController* cont = _controllers[id];
+                               cont->getView()->setState(DRAG);
+                               cont->getModel()->notifyObservers(_idManager);
+                       } // for
 
-       } else { //_worldState
+               } // if _selectedObjects.size
 
-               _worldState = DRAG_OBJECTS;
-               _startDragging = true;
+               
+               return true;
+       }
 
-               int shiftkey =
-                               _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey();
-               int ctrlkey =
-                               _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey();
-               ctrlkey = ctrlkey + shiftkey;
+       //=========================================================================
 
-               GObjectController *cont = GetGBlackBoxControlerPointedByMouse();
+       bool wxVtkSceneManager::OnLeftButtonUp()
+       {
+               if(_worldState == DRAG_OBJECTS)
+               {
+                       _worldState = NOTHING_HAPPENS;
 
-               if (GetGBlackBoxControlerPointedByMouse() != NULL) {
-                       int state = cont->getView()->getState();
-                       if ((ctrlkey == 0) && (state == HIGHLIGHTED)) {
-                               UnSelectBlackBoxes();
+                       for (int i = 0; i < (int)_selectedObjects.size(); i++)
+                       {
+                               int id = _selectedObjects[i];
+                               GObjectController* cont = _controllers[id];
+                               cont->getView()->setState(SELECTED);
+                               cont->getModel()->notifyObservers(_idManager);
                        }
                }
-               for (int i = 0; i < (int) _selectedObjects.size(); i++) {
-                       int id = _selectedObjects[i];
-                       GObjectController* cont = _controllers[id];
-                       cont->getView()->setState(DRAG);
-                       cont->getModel()->notifyObservers(_idManager);
-               } // for
+               return true;
+       }
 
-       } // if _selectedObjects.size
+       //=========================================================================
+       void wxVtkSceneManager::CancelConnection()
+       {
+               if(_worldState==INIT_CREATION_CONTOUR)
+               {
+                       _worldState=NOTHING_HAPPENS;
+                       //int lastId = _controllers.size()-1;
+                       
+                       GConnectorController *connector = (GConnectorController*)_controllers[_idConnectionInCreation];
+                       connector->removeFromScene();
+                       unregisterController(connector);
+                       _controllers.erase(_idConnectionInCreation);
+                       
+                       std::map<int, GObjectController*>::iterator it;
+                       for(it = _controllers.begin(); it != _controllers.end(); ++it)
+                       {
+                               GObjectController *desc = it->second;
+                               desc->SetActive(true);
+                               desc->getView()->setState(NOTHING_HAPPENS);
+                               desc->getModel()->notifyObservers(_idManager);
+                       } // for
+               }// if          
+       }
+       
+       
+       //=========================================================================
+
+       bool wxVtkSceneManager::OnRightButtonUp()
+       {
+               if(_worldState==INIT_CREATION_CONTOUR)
+               {
+                       CancelConnection();
+               }
+               UnSelectBlackBoxes();
+               return true;
+       }
 
+       //=========================================================================
 
-       return true;
-}
+    GObjectController *wxVtkSceneManager::GetGBlackBoxControlerPointedByMouse()
+    {
+        GObjectController *result=NULL;
+               int X,Y;
+               wxVTKRenderWindowInteractor *wxVTKiren;
+               wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+               wxVTKiren->GetEventPosition(X,Y);
 
-//=========================================================================
+               std::map<int, GObjectController*>::iterator it;
 
-bool wxVtkSceneManager::OnLeftButtonUp() {
-       if (_worldState == DRAG_OBJECTS) {
-               _worldState = NOTHING_HAPPENS;
+               for(it = _controllers.begin(); it != _controllers.end() ; ++it)
+               {
+                       GObjectController *cont = it->second;
+                       int type = cont->getGObjectType();
 
-               for (int i = 0; i < (int) _selectedObjects.size(); i++) {
-                       int id = _selectedObjects[i];
-                       GObjectController* cont = _controllers[id];
-                       cont->getView()->setState(SELECTED);
-                       cont->getModel()->notifyObservers(_idManager);
-               }
-       }
-       return true;
-}
+                       if( cont->getView()->isPointInside(X,Y)==true )
+                       {
+                               if(type==GBLACKBOX)
+                               {
+                                   result=cont;
+                               } // if type
+                       } // if isPointInside
+               } // for it
+               return result;
+    }
+
+       //=========================================================================
+       void wxVtkSceneManager::UnSelectBlackBoxes()
+       {
+        for (int i=0; i< (int)_selectedObjects.size(); i++)
+               {
+            int id = _selectedObjects[i];
+                       GObjectController* control = _controllers[id];
+                       control->getView()->setState(NOTHING_HAPPENS);
+        }// for _selectedObjects
+               _selectedObjects.clear();
+    }
+
+       //=========================================================================
+       bool wxVtkSceneManager::OnLeftDClick()
+       {
+           GObjectController *cont = GetGBlackBoxControlerPointedByMouse();
+           if (cont!=NULL)
+        {
+            UnSelectBlackBoxes();
+            _parent->editBlackBox( (GBlackBoxModel*)cont->getModel() );
+        }
+
+/*EED Borrame
+
+               int X,Y;
+               wxVTKRenderWindowInteractor *wxVTKiren;
+               wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+               wxVTKiren->GetEventPosition(X,Y);
 
-//=========================================================================
-void wxVtkSceneManager::CancelConnection() {
-       if (_worldState == INIT_CREATION_CONTOUR) {
-               _worldState = NOTHING_HAPPENS;
-               //int lastId = _controllers.size()-1;
+               std::map<int, GObjectController*>::iterator it;
 
-               GConnectorController *connector =
-                               (GConnectorController*) _controllers[_idConnectionInCreation];
-               connector->removeFromScene();
-               unregisterController(connector);
-               _controllers.erase(_idConnectionInCreation);
+               bool clickOnObject = false;
 
-               std::map<int, GObjectController*>::iterator it;
-               for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-                       GObjectController *desc = it->second;
-                       desc->SetActive(true);
-                       desc->getView()->setState(NOTHING_HAPPENS);
-                       desc->getModel()->notifyObservers(_idManager);
-               } // for
-       }// if
-}
+               for(it = _controllers.begin(); it != _controllers.end() && clickOnObject==false; ++it)
+               {
+                       GObjectController *cont = it->second;
+                       int type = cont->getGObjectType();
 
-//=========================================================================
+                       if(cont->getView()->isPointInside(X,Y))
+                       {
+                               if(type==GBLACKBOX)
+                               {
+                                       for (int i=0; i< (int)_selectedObjects.size(); i++)
+                                       {
+                                               int id = _selectedObjects[i];
+                                               GObjectController* control = _controllers[id];
+                                               control->getView()->setState(NOTHING_HAPPENS);
+                                       }
+                                       _selectedObjects.clear();
 
-bool wxVtkSceneManager::OnRightButtonUp() {
-       if (_worldState == INIT_CREATION_CONTOUR) {
-               CancelConnection();
-       }
-       UnSelectBlackBoxes();
-       return true;
-}
-
-//=========================================================================
-
-GObjectController *wxVtkSceneManager::GetGBlackBoxControlerPointedByMouse() {
-       GObjectController *result = NULL;
-       int X, Y;
-       wxVTKRenderWindowInteractor *wxVTKiren;
-       wxVTKiren
-                       = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
-       wxVTKiren->GetEventPosition(X, Y);
-
-       std::map<int, GObjectController*>::iterator it;
-
-       for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-               GObjectController *cont = it->second;
-               int type = cont->getGObjectType();
-
-               if (cont->getView()->isPointInside(X, Y) == true) {
-                       if (type == GBLACKBOX) {
-                               result = cont;
-                       } // if type
-               } // if isPointInside
-       } // for it
-       return result;
-}
-
-//=========================================================================
-void wxVtkSceneManager::UnSelectBlackBoxes() {
-       for (int i = 0; i < (int) _selectedObjects.size(); i++) {
-               int id = _selectedObjects[i];
-               GObjectController* control = _controllers[id];
-               control->getView()->setState(NOTHING_HAPPENS);
-       }// for _selectedObjects
-       _selectedObjects.clear();
-}
-
-//=========================================================================
-bool wxVtkSceneManager::OnLeftDClick() {
-       GObjectController *cont = GetGBlackBoxControlerPointedByMouse();
-       if (cont != NULL) {
-               UnSelectBlackBoxes();
-               _parent->editBlackBox((GBlackBoxModel*) cont->getModel());
+                                       GBlackBoxModel *bbmodel = (GBlackBoxModel*)cont->getModel();
+                                       _parent->editBlackBox(bbmodel);
+                               }
+                               clickOnObject = true;
+                       }
+               }
+
+               if(clickOnObject==false)
+               {
+                       //_parent->editDiagramParameters(this);
+               }
+*/
+               return true;
        }
 
-       /*EED Borrame
-
-        int X,Y;
-        wxVTKRenderWindowInteractor *wxVTKiren;
-        wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
-        wxVTKiren->GetEventPosition(X,Y);
-
-        std::map<int, GObjectController*>::iterator it;
-
-        bool clickOnObject = false;
-
-        for(it = _controllers.begin(); it != _controllers.end() && clickOnObject==false; ++it)
-        {
-        GObjectController *cont = it->second;
-        int type = cont->getGObjectType();
-
-        if(cont->getView()->isPointInside(X,Y))
-        {
-        if(type==GBLACKBOX)
-        {
-        for (int i=0; i< (int)_selectedObjects.size(); i++)
-        {
-        int id = _selectedObjects[i];
-        GObjectController* control = _controllers[id];
-        control->getView()->setState(NOTHING_HAPPENS);
-        }
-        _selectedObjects.clear();
-
-        GBlackBoxModel *bbmodel = (GBlackBoxModel*)cont->getModel();
-        _parent->editBlackBox(bbmodel);
-        }
-        clickOnObject = true;
-        }
-        }
-
-        if(clickOnObject==false)
-        {
-        //_parent->editDiagramParameters(this);
-        }
-        */
-       return true;
-}
-
-//=========================================================================
-
-bool wxVtkSceneManager::OnChar() {
-       char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
-
-       // KeyCode 127 : Delete Key
-       // KeyCode 8 : Backspace Key
-       if (keyCode == 8 || keyCode == 127) {
-               if (_selectedObjects.size() > 0) {
-                       for (int i = 0; i < (int) _selectedObjects.size(); i++) {
-                               int id = _selectedObjects[i];
-                               std::map<int, GObjectController*>::iterator it;
-                               it = _controllers.find(id);
-                               if (it != _controllers.end()) {
-                                       deleteObject(id);
+       //=========================================================================
+
+       bool wxVtkSceneManager::OnChar()
+       {
+               char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
+
+               // KeyCode 127 : Delete Key
+               // KeyCode 8 : Backspace Key
+               if(keyCode == 8 || keyCode == 127)
+               {
+                       if(_selectedObjects.size()>0)
+                       {
+                               for(int i=0;i<(int)_selectedObjects.size();i++)
+                               {
+                                       int id = _selectedObjects[i];
+                                       std::map<int,GObjectController*>::iterator it;
+                    it = _controllers.find(id);
+                                       if (it!=_controllers.end())
+                                       {
+                                               deleteObject(id);
+                                       }
                                }
+                               _selectedObjects.clear();
                        }
-                       _selectedObjects.clear();
                }
+
+               return true;
        }
 
-       return true;
-}
+       //=========================================================================
 
-//=========================================================================
+       void wxVtkSceneManager::AddControlerToBeRemove(std::vector<int> *controllersToRemove, int id)
+       {
 
-void wxVtkSceneManager::AddControlerToBeRemove(
-               std::vector<int> *controllersToRemove, int id) {
+               int i;
+               bool ok=true;
+               for(i=0 ; i < (int)controllersToRemove->size() ; i++ )
+               {
+                       if (id == (*controllersToRemove)[i] )
+                       {
+                               ok=false;
+                       }
+               }
 
-       int i;
-       bool ok = true;
-       for (i = 0; i < (int) controllersToRemove->size(); i++) {
-               if (id == (*controllersToRemove)[i]) {
-                       ok = false;
+               if (ok==true)
+               {
+                  controllersToRemove->push_back( id );
                }
-       }
 
-       if (ok == true) {
-               controllersToRemove->push_back(id);
        }
 
-}
-
-//=========================================================================
-
-void wxVtkSceneManager::deleteObject(int id) {
-       GObjectController *control = _controllers[id];
-       std::vector<int> controllersToRemove;
+       //=========================================================================
 
-       if (control->getGObjectType() == GBLACKBOX || control->getGObjectType()
-                       == GCOMPLEXINPUTPORT || control->getGObjectType()
-                       == GCOMPLEXOUTPUTPORT) {
-               GBoxModel *bbmod = (GBoxModel*) control->getModel();
-               std::vector<GPortModel*> inputs = bbmod->getInputPorts();
-
-               bool boxConnected = false;
-
-               // Add box input controllers to be removed
-               for (int i = 0; i < (int) inputs.size(); i++) {
-                       AddControlerToBeRemove(&controllersToRemove,
-                                       inputs[i]->getObjectId());
-                       if (inputs[i]->isConnected()) {
-                               boxConnected = true;
+       void wxVtkSceneManager::deleteObject(int id)
+       {
+               GObjectController *control = _controllers[id];
+               std::vector<int> controllersToRemove;
+
+               if(control->getGObjectType()==GBLACKBOX || control->getGObjectType()==GCOMPLEXINPUTPORT || control->getGObjectType()==GCOMPLEXOUTPUTPORT)
+               {
+                       GBoxModel *bbmod = (GBoxModel*)control->getModel();
+                       std::vector<GPortModel*> inputs = bbmod->getInputPorts();
+
+                       bool boxConnected = false;
+
+                       // Add box input controllers to be removed
+                       for(int i = 0;i< (int)inputs.size();i++)
+                       {
+                               AddControlerToBeRemove( &controllersToRemove, inputs[i]->getObjectId() );
+                               if(inputs[i]->isConnected())
+                               {
+                                       boxConnected = true;
+                               }
                        }
-               }
 
-               std::vector<GPortModel*> outputs = bbmod->getOutputPorts();
+                       std::vector<GPortModel*> outputs = bbmod->getOutputPorts();
 
-               // Add box output controllers to be removed
-               for (int i = 0; i < (int) outputs.size(); i++) {
-                       AddControlerToBeRemove(&controllersToRemove,
-                                       outputs[i]->getObjectId());
-                       if (outputs[i]->isConnected()) {
-                               boxConnected = true;
+                       // Add box output controllers to be removed
+                       for(int i = 0;i<(int)outputs.size();i++)
+                       {
+                               AddControlerToBeRemove( &controllersToRemove, outputs[i]->getObjectId() );
+                               if(outputs[i]->isConnected())
+                               {
+                                       boxConnected = true;
+                               }
                        }
-               }
 
-               // Add connection controllers to be removed
-               std::map<int, GObjectController*>::iterator it;
-               for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-                       GObjectController *cont = it->second;
-                       int type = cont->getGObjectType();
-                       if (type == GCONNECTOR) {
-                               GConnectorModel *conMod = (GConnectorModel*) cont->getModel();
-                               if (conMod->getStartPort() != NULL
-                                               && conMod->getStartPort()->getParentBox()->getObjectId()
-                                                               == bbmod->getObjectId()) {
-                                       AddControlerToBeRemove(&controllersToRemove,
-                                                       conMod->getObjectId());
-                               }
-                               if (conMod->getEndPort() != NULL
-                                               && conMod->getEndPort()->getParentBox()->getObjectId()
-                                                               == bbmod->getObjectId()) {
-                                       AddControlerToBeRemove(&controllersToRemove,
-                                                       conMod->getObjectId());
+                       // Add connection controllers to be removed
+                       std::map<int, GObjectController*>::iterator it;
+                       for(it = _controllers.begin(); it != _controllers.end(); ++it)
+                       {
+                               GObjectController *cont = it->second;
+                               int type = cont->getGObjectType();
+                               if(type==GCONNECTOR)
+                               {
+                                       GConnectorModel *conMod = (GConnectorModel*)cont->getModel();
+                                       if(conMod->getStartPort()!=NULL && conMod->getStartPort()->getParentBox()->getObjectId() == bbmod->getObjectId())
+                                       {
+                                               AddControlerToBeRemove( &controllersToRemove, conMod->getObjectId() );
+                                       }
+                                       if(conMod->getEndPort()!=NULL && conMod->getEndPort()->getParentBox()->getObjectId() == bbmod->getObjectId())
+                                       {
+                                               AddControlerToBeRemove( &controllersToRemove, conMod->getObjectId() );
+                                       }
                                }
                        }
+
+                       // Add box controller to be removed
+                       AddControlerToBeRemove( &controllersToRemove, bbmod->getObjectId() );
                }
+               else if(control->getGObjectType()==GCONNECTOR)
+               {
+                       GConnectorModel *conMod = (GConnectorModel*)control->getModel();
+                       AddControlerToBeRemove( &controllersToRemove, conMod->getObjectId() );
+               }
+
 
-               // Add box controller to be removed
-               AddControlerToBeRemove(&controllersToRemove, bbmod->getObjectId());
-       } else if (control->getGObjectType() == GCONNECTOR) {
-               GConnectorModel *conMod = (GConnectorModel*) control->getModel();
-               AddControlerToBeRemove(&controllersToRemove, conMod->getObjectId());
+               std::map<int,GObjectController*>::iterator it;
+
+               for(int i = 0;i<(int)controllersToRemove.size();i++)
+               {
+                       int key = controllersToRemove[i];
+                       it = _controllers.find( key );
+                       GObjectController *cont = _controllers[ key ];
+                       if(cont!=NULL)
+                       {
+                               cont->removeFromScene();
+                               unregisterController((InteractorStyleMaracas*)cont);
+                               _controllers.erase(it);
+                       }//if
+               }// for
        }
 
-       std::map<int, GObjectController*>::iterator it;
+       //=========================================================================
 
-       for (int i = 0; i < (int) controllersToRemove.size(); i++) {
-               int key = controllersToRemove[i];
-               it = _controllers.find(key);
-               GObjectController *cont = _controllers[key];
-               if (cont != NULL) {
-                       cont->removeFromScene();
-                       unregisterController((InteractorStyleMaracas*) cont);
-                       _controllers.erase(it);
-               }//if
-       }// for
-}
-
-//=========================================================================
-
-void wxVtkSceneManager::displayBlackBoxInfo(std::string packageName,
-               std::string boxName) {
-       _parent->displayBlackBoxInfo(packageName, boxName);
-}
-
-//=========================================================================
-
-void wxVtkSceneManager::updateStatusBar(std::string textStatus) {
-       _parent->updateStatusBar(textStatus);
-}
-
-//=========================================================================
-std::string wxVtkSceneManager::LineNumber(bool withLineNumber, int &value) {
-       std::string result = "";
-       if (withLineNumber == true) {
-               value++;
-               stringstream StrStream;
-               StrStream << value;
-               std::string strValue = StrStream.str();
-               if (value < 10) {
-                       result += "  ";
-               } else if (value < 100) {
-                       result += " ";
-               }
+       void wxVtkSceneManager::displayBlackBoxInfo(std::string packageName, std::string boxName)
+       {
+               _parent->displayBlackBoxInfo(packageName,boxName);
+       }
+
+       //=========================================================================
 
-               result += strValue + ": ";
+       void wxVtkSceneManager::updateStatusBar(std::string textStatus)
+       {
+               _parent->updateStatusBar(textStatus);
        }
-       return result;
-}
-//=========================================================================
-//DFCH
-bool wxVtkSceneManager::MakeBoxExecutable() {
-       std::map<int, GObjectController*> selected = getSelectedObjects();
-       if( selected.empty() )
-               return false;
-       bool ret = false;
-       std::map<int, GObjectController*>::iterator it;
-       for (it = selected.begin(); it != selected.end(); ++it) {
-               GObjectController* lastSelected = it->second;
-               if (lastSelected) {
-                       vtkGObjectView* view = (vtkGObjectView*) lastSelected->getView();
-                       GBlackBoxModel *bbmodel =
-                                       (GBlackBoxModel*) lastSelected->getModel();
-                       view->setState(HIGHLIGHTED);
-                       if (bbmodel->isExecutable()) {
-                               bbmodel->setExecutable(false);
-                       } else {
-                               bbmodel->setExecutable(true);
-                       }
-                       bbmodel->notifyObservers(lastSelected->getId());
-                       ret = true;
-               }
+
+
+       //=========================================================================
+    std::string wxVtkSceneManager::LineNumber(bool withLineNumber, int &value)
+    {
+        std::string result="";
+        if (withLineNumber==true)
+        {
+            value++;
+            stringstream StrStream;
+            StrStream << value;
+            std::string strValue=StrStream.str();
+            if (value<10)
+            {
+                result+="  ";
+            }else if (value<100)
+            {
+                result+=" ";
+            }
+
+            result+=strValue+": ";
+        }
+        return result;
        }
-       return ret;
-}
-//DFCH
+       //=========================================================================
 
-//=========================================================================
+       std::string wxVtkSceneManager::getDiagramBBS(bool wln)
+       {
+               bool existsExec=false;
 
-std::string wxVtkSceneManager::getDiagramBBS(bool wln) {
-       bool existsExec = false;
+               std::vector<std::string> packages;
+               std::vector<int> boxes;
+               std::vector<int> connections;
+               std::vector<int> execBoxes;
 
-       std::vector<std::string> packages;
-       std::vector<int> boxes;
-       std::vector<int> connections;
-       std::vector<int> execBoxes;
+               std::map<int, GObjectController*>::iterator it;
 
-       std::map<int, GObjectController*>::iterator it;
+               for(it = _controllers.begin(); it != _controllers.end(); ++it)
+               {
+                       GObjectController *desc = it->second;
+                       int type = desc->getGObjectType();
 
-       for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-               GObjectController *desc = it->second;
-               int type = desc->getGObjectType();
+                       if(type==GBLACKBOX)
+                       {
+                               GBlackBoxModel *mod = (GBlackBoxModel*)desc->getModel();
+
+                               std::string pkg = mod->getBBTKPackage();
+                               bool existsPkg = false;
+                               for(int t = 0;t< (int)packages.size() && existsPkg == false;t++)
+                               {
+                                       if(packages[t]==pkg)
+                                       {
+                                               existsPkg=true;
+                                       }
+                               }
+                               if(!existsPkg)
+                               {
+                                       packages.push_back(pkg);
+                               }
 
-               if (type == GBLACKBOX) {
-                       GBlackBoxModel *mod = (GBlackBoxModel*) desc->getModel();
 
-                       std::string pkg = mod->getBBTKPackage();
-                       bool existsPkg = false;
-                       for (int t = 0; t < (int) packages.size() && existsPkg == false; t++) {
-                               if (packages[t] == pkg) {
-                                       existsPkg = true;
+                               boxes.push_back(it->first);
+                               if(mod->isExecutable())
+                               {
+                                       execBoxes.push_back(it->first);
+                                       existsExec=true;
                                }
                        }
-                       if (!existsPkg) {
-                               packages.push_back(pkg);
+                       else if(type==GCONNECTOR)
+                       {
+                               connections.push_back(it->first);
                        }
+               }
 
-                       boxes.push_back(it->first);
-                       if (mod->isExecutable()) {
-                               execBoxes.push_back(it->first);
-                               existsExec = true;
+        int lnNmbr=0;
+               std::string script = "";
+               script+=LineNumber(wln,lnNmbr)+"# BBTK GEditor Script\n";
+               script+=LineNumber(wln,lnNmbr)+"# ----------------------\n";
+               script+=LineNumber(wln,lnNmbr)+"\n";
+               if(existsExec)
+               {
+                       script+=LineNumber(wln,lnNmbr)+"include std\n"; // EED
+                       script+=LineNumber(wln,lnNmbr)+"include itkvtk\n"; // EED
+                       int i;
+                       for(i = 0; i< (int)packages.size();i++)
+                       {
+                               script+=LineNumber(wln,lnNmbr);
+                               script+="include ";
+                               script+=packages[i];
+                               script+="\n";
                        }
-               } else if (type == GCONNECTOR) {
-                       connections.push_back(it->first);
-               }
-       }
 
-       int lnNmbr = 0;
-       std::string script = "";
-       script += LineNumber(wln, lnNmbr) + "# BBTK GEditor Script\n";
-       script += LineNumber(wln, lnNmbr) + "# ----------------------\n";
-       script += LineNumber(wln, lnNmbr) + "\n";
-       if (existsExec) {
-               script += LineNumber(wln, lnNmbr) + "include std\n"; // EED
-               script += LineNumber(wln, lnNmbr) + "include itkvtk\n"; // EED
-               int i;
-               for (i = 0; i < (int) packages.size(); i++) {
-                       script += LineNumber(wln, lnNmbr);
-                       script += "include ";
-                       script += packages[i];
-                       script += "\n";
-               }
+            script+=LineNumber(wln,lnNmbr);
+                       script+="\n";
+
+                       // script+="include std\n"; // JPR
+
+                       for(i = 0; i < (int)boxes.size();i++)
+                       {
+                               script+=LineNumber(wln,lnNmbr);
+                               script+="new ";
+                               int id = boxes[i];
+                               GObjectController *control = _controllers[id];
+                               GBlackBoxModel *model = (GBlackBoxModel*)control->getModel();
+
+                               script+=model->getBBTKType();
+                               script+=" ";
+                               script+=model->getBBTKName();
+                               script+="\n";
+
+                               std::vector<GPortModel*> inputs = model->getInputPorts();
+                               for(int j = 0; j < (int)inputs.size();j++)
+                               {
+                                       GPortModel* inputPort = inputs[j];
+                                       if(inputPort->isValueSet())
+                                       {
+                        script+=LineNumber(wln,lnNmbr);
+                                               script+="  set ";
+                                               script+=model->getBBTKName();
+                                               script+=".";
+                                               script+=inputPort->getBBTKName();
+                                               script+=" ";
+                                               script+=inputPort->getValue();
+                                               script+="\n";
+                                       }
+                               }
 
-               script += LineNumber(wln, lnNmbr);
-               script += "\n";
+                               script+=LineNumber(wln,lnNmbr);
+                               script+="\n";
 
-               //ups2
+                       }
 
-               script += LineNumber(wln, lnNmbr);
-               script += "author \"";
-               script += _Author;
-               script += "\"\n";
+            script+=LineNumber(wln,lnNmbr);
+                       script+="\n";
 
-               script += LineNumber(wln, lnNmbr);
-               script += "description \"";
-               script += _Description;
-               script += "\"\n";
+                       for(i = 0; i<(int)connections.size();i++)
+                       {
+                               script+=LineNumber(wln,lnNmbr);
+                               script+="connect ";
+                               int id = connections[i];
+                               GObjectController *control = _controllers[id];
+                               GConnectorModel *model = (GConnectorModel*)control->getModel();
 
-               script += LineNumber(wln, lnNmbr);
-               script += "category \"";
-               script += _Category;
-               script += "\"\n";
+                               //Start Connection info
+                               GPortModel *start = model->getStartPort();
+                               script+=start->getParentBox()->getBBTKName();
+                               script+=".";
+                               script+=start->getBBTKName();
 
-               script += LineNumber(wln, lnNmbr);
-               script += "\n";
+                               script+=" ";
 
-               // script+="include std\n"; // JPR
+                               //End Connection info
+                               GPortModel *end = model->getEndPort();
+                               script+=end->getParentBox()->getBBTKName();
+                               script+=".";
+                               script+=end->getBBTKName();
 
-               for (i = 0; i < (int) boxes.size(); i++) {
-                       script += LineNumber(wln, lnNmbr);
-                       script += "new ";
-                       int id = boxes[i];
-                       GObjectController *control = _controllers[id];
-                       GBlackBoxModel *model = (GBlackBoxModel*) control->getModel();
-
-                       script += model->getBBTKType();
-                       script += " ";
-                       script += model->getBBTKName();
-                       script += "\n";
-
-                       std::vector<GPortModel*> inputs = model->getInputPorts();
-                       for (int j = 0; j < (int) inputs.size(); j++) {
-                               GPortModel* inputPort = inputs[j];
-                               if (inputPort->isValueSet()) {
-                                       script += LineNumber(wln, lnNmbr);
-                                       script += "  set ";
-                                       script += model->getBBTKName();
-                                       script += ".";
-                                       script += inputPort->getBBTKName();
-                                       script += " ";
-                                       script += inputPort->getValue();
-                                       script += "\n";
-                               }
+                               script+="\n";
                        }
 
-                       script += LineNumber(wln, lnNmbr);
-                       script += "\n";
+            script+=LineNumber(wln,lnNmbr);
+                       script+="\n";
+                       for(i = 0; i<(int)execBoxes.size();i++)
+                       {
+                               script+=LineNumber(wln,lnNmbr);
+                               script+="exec ";
+                               int id = execBoxes[i];
+                               GObjectController *control = _controllers[id];
+                               GBlackBoxModel *model = (GBlackBoxModel*)control->getModel();
+
+                               script+=model->getBBTKName();
+                               script+="\n";
+                       }
 
                }
 
-               script += LineNumber(wln, lnNmbr);
-               script += "\n";
+               return script;
+       }
 
-               for (i = 0; i < (int) connections.size(); i++) {
-                       script += LineNumber(wln, lnNmbr);
-                       script += "connect ";
-                       int id = connections[i];
-                       GObjectController *control = _controllers[id];
-                       GConnectorModel *model = (GConnectorModel*) control->getModel();
+       //=========================================================================
 
-                       //Start Connection info
-                       GPortModel *start = model->getStartPort();
-                       script += start->getParentBox()->getBBTKName();
-                       script += ".";
-                       script += start->getBBTKName();
+       std::string wxVtkSceneManager::saveComplexBoxBBS(std::string cbName,std::string cbAuthor,std::string cbCategory,std::string cbDescription)
+       {
 
-                       script += " ";
+               std::vector<std::string> packages;
+               std::vector<int> boxes;
+               std::vector<int> connections;
+               std::vector<int> execBoxes;
 
-                       //End Connection info
-                       GPortModel *end = model->getEndPort();
-                       script += end->getParentBox()->getBBTKName();
-                       script += ".";
-                       script += end->getBBTKName();
+               std::map<int, GObjectController*>::iterator it;
 
-                       script += "\n";
-               }
+               for(it = _controllers.begin(); it != _controllers.end(); ++it)
+               {
+                       GObjectController *desc = it->second;
+                       int type = desc->getGObjectType();
 
-               script += LineNumber(wln, lnNmbr);
-               script += "\n";
-               for (i = 0; i < (int) execBoxes.size(); i++) {
-                       script += LineNumber(wln, lnNmbr);
-                       script += "exec ";
-                       int id = execBoxes[i];
-                       GObjectController *control = _controllers[id];
-                       GBlackBoxModel *model = (GBlackBoxModel*) control->getModel();
+                       if(type==GBLACKBOX)
+                       {
+                               GBlackBoxModel *mod = (GBlackBoxModel*)desc->getModel();
+
+                               std::string pkg = mod->getBBTKPackage();
+                               bool existsPkg = false;
+                               for(int t = 0;t<(int)packages.size() && existsPkg == false;t++)
+                               {
+                                       if(packages[t]==pkg)
+                                       {
+                                               existsPkg=true;
+                                       }
+                               }
+                               if(!existsPkg)
+                               {
+                                       packages.push_back(pkg);
+                               }
 
-                       script += model->getBBTKName();
-                       script += "\n";
+
+                               boxes.push_back(it->first);
+                               if(mod->isExecutable())
+                               {
+                                       execBoxes.push_back(it->first);
+                               }
+                       }
+                       else if(type==GCONNECTOR)
+                       {
+                               connections.push_back(it->first);
+                       }
                }
 
-       }
+               std::string script = "";
 
-       return script;
-}
+               script+="include std\n";    // EED
+               script+="include itkvtk\n"; // EED
+               int i;
+               for(i = 0; i<(int)packages.size();i++)
+               {
+                       script+="include ";
+                       script+=packages[i];
+                       script+="\n";
+               }
+               script+="\n";
+
+               // Definition of a complex box
+               script+="define ";
+               script+=cbName;
+               script+="\n";
+               script+="\n";
+
+               script+="author \" ";
+               script+=cbAuthor;
+               script+="\"\n";
+
+               script+="description \" ";
+               script+=cbDescription;
+               script+="\"\n";
+               script+="\n";
+
+               // Create boxes
+               for(i = 0; i<(int)boxes.size();i++)
+               {
+                       script+="new ";
+                       int id = boxes[i];
+                       GObjectController *control = _controllers[id];
+                       GBlackBoxModel *model = (GBlackBoxModel*)control->getModel();
+
+                       script+=model->getBBTKType();
+                       script+=" ";
+                       script+=model->getBBTKName();
+                       script+="\n";
+
+                               std::vector<GPortModel*> inputs = model->getInputPorts();
+                               for(int j = 0; j<(int)inputs.size();j++)
+                               {
+                                       GPortModel* inputPort = inputs[j];
+                                       if(inputPort->isValueSet())
+                                       {
+                                               script+="  set ";
+                                               script+=model->getBBTKName();
+                                               script+=".";
+                                               script+=inputPort->getBBTKName();
+                                               script+=" ";
+                                               script+=inputPort->getValue();
+                                               script+="\n";
+                                       }
+                               }
+                               script+="\n";
 
-//=========================================================================
+                       }
 
-std::string wxVtkSceneManager::saveComplexBoxBBS() {
-       std::vector<std::string> packages;
-       std::vector<int> boxes;
-       std::vector<int> connections;
-       std::vector<int> execBoxes;
+                       // Create connections in the script. If the connection is made with a complex port, it is created the input or output
 
-       std::map<int, GObjectController*>::iterator it;
+                       std::string complexInputs="";
+                       std::string complexOutputs="";
+                       script+="\n";
 
-       for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-               GObjectController *desc = it->second;
-               int type = desc->getGObjectType();
+                       for(i = 0; i<(int)connections.size();i++)
+                       {
+                               int id = connections[i];
+                               GObjectController *control = _controllers[id];
+                               GConnectorModel *model = (GConnectorModel*)control->getModel();
 
-               if (type == GBLACKBOX) {
-                       GBlackBoxModel *mod = (GBlackBoxModel*) desc->getModel();
+                               //Connection info
+                               GPortModel *start = model->getStartPort();
+                               GBoxModel *startBox =start->getParentBox();
 
-                       std::string pkg = mod->getBBTKPackage();
-                       bool existsPkg = false;
-                       for (int t = 0; t < (int) packages.size() && existsPkg == false; t++) {
-                               if (packages[t] == pkg) {
-                                       existsPkg = true;
-                               }
-                       }
-                       if (!existsPkg) {
-                               packages.push_back(pkg);
-                       }
+                               GPortModel *end = model->getEndPort();
+                               GBoxModel *endBox =end->getParentBox();
 
-                       boxes.push_back(it->first);
-                       if (mod->isExecutable()) {
-                               execBoxes.push_back(it->first);
-                       }
-               } else if (type == GCONNECTOR) {
-                       connections.push_back(it->first);
-               }
-       }
+                               if(startBox->getGObjectType()==GCOMPLEXINPUTPORT)
+                               {
+                                       complexInputs+="input ";
+                                       complexInputs+=startBox->getBBTKName();
 
-       std::string script = "";
+                                       complexInputs+=" ";
+                                       complexInputs+=endBox->getBBTKName();
+                                       complexInputs+=".";
+                                       complexInputs+=end->getBBTKName();
 
-       script += "include std\n"; // EED
-       script += "include itkvtk\n"; // EED
-       int i;
-       for (i = 0; i < (int) packages.size(); i++) {
-               script += "include ";
-               script += packages[i];
-               script += "\n";
-       }
-       script += "\n";
-
-       // Definition of a complex box
-       script += "define ";
-       script += _cbName + " " + _cbPackageName;
-       script += "\n";
-       script += "\n";
-
-       script += "author \"";
-       script += _Author;
-       script += "\"\n";
-
-       script += "description \"";
-       script += _Description;
-       script += "\"\n";
-       script += "\n";
-
-       script += "category \"";
-       script += _Category;
-       script += "\"\n";
-       script += "\n";
-
-       // Create boxes
-       for (i = 0; i < (int) boxes.size(); i++) {
-               script += "new ";
-               int id = boxes[i];
-               GObjectController *control = _controllers[id];
-               GBlackBoxModel *model = (GBlackBoxModel*) control->getModel();
-
-               script += model->getBBTKType();
-               script += " ";
-               script += model->getBBTKName();
-               script += "\n";
-
-               std::vector<GPortModel*> inputs = model->getInputPorts();
-               for (int j = 0; j < (int) inputs.size(); j++) {
-                       GPortModel* inputPort = inputs[j];
-                       if (inputPort->isValueSet()) {
-                               script += "  set ";
-                               script += model->getBBTKName();
-                               script += ".";
-                               script += inputPort->getBBTKName();
-                               script += " ";
-                               script += inputPort->getValue();
-                               script += "\n";
-                       }
-               }
-               script += "\n";
+                                       complexInputs+=" ";
+                                       complexInputs+="\" \"";
 
-       }
+                                       complexInputs+="\n";
+                               }
+                               else if(endBox->getGObjectType()==GCOMPLEXOUTPUTPORT)
+                               {
+                                       complexOutputs+="output ";
+                                       complexOutputs+=endBox->getBBTKName();
 
-       // Create connections in the script. If the connection is made with a complex port, it is created the input or output
+                                       complexOutputs+=" ";
+                                       complexOutputs+=startBox->getBBTKName();
+                                       complexOutputs+=".";
+                                       complexOutputs+=start->getBBTKName();
 
-       std::string complexInputs = "";
-       std::string complexOutputs = "";
-       script += "\n";
+                                       complexOutputs+=" ";
+                                       complexOutputs+="\" \"";
 
-       for (i = 0; i < (int) connections.size(); i++) {
-               int id = connections[i];
-               GObjectController *control = _controllers[id];
-               GConnectorModel *model = (GConnectorModel*) control->getModel();
+                                       complexOutputs+="\n";
+                               }
+                               else
+                               {
+                                       script+="connect ";
+                                       script+=startBox->getBBTKName();
+                                       script+=".";
+                                       script+=start->getBBTKName();
 
-               //Connection info
-               GPortModel *start = model->getStartPort();
-               GBoxModel *startBox = start->getParentBox();
+                                       script+=" ";
 
-               GPortModel *end = model->getEndPort();
-               GBoxModel *endBox = end->getParentBox();
+                                       //End Connection info
+                                       script+=endBox->getBBTKName();
+                                       script+=".";
+                                       script+=end->getBBTKName();
 
-               if (startBox->getGObjectType() == GCOMPLEXINPUTPORT) {
-                       complexInputs += "input ";
-                       complexInputs += startBox->getBBTKName();
+                                       script+="\n";
+                               }
+                       }
 
-                       complexInputs += " ";
-                       complexInputs += endBox->getBBTKName();
-                       complexInputs += ".";
-                       complexInputs += end->getBBTKName();
+                   script+="\n";
 
-                       complexInputs += " ";
-                       complexInputs += "\" \"";
+                       for(i = 0; i<(int)execBoxes.size();i++)
+                       {
+                               script+="exec ";
+                               int id = execBoxes[i];
+                               GObjectController *control = _controllers[id];
+                               GBlackBoxModel *model = (GBlackBoxModel*)control->getModel();
 
-                       complexInputs += "\n";
-               } else if (endBox->getGObjectType() == GCOMPLEXOUTPUTPORT) {
-                       complexOutputs += "output ";
-                       complexOutputs += endBox->getBBTKName();
+                               script+=model->getBBTKName();
+                               script+="\n";
+                       }
 
-                       complexOutputs += " ";
-                       complexOutputs += startBox->getBBTKName();
-                       complexOutputs += ".";
-                       complexOutputs += start->getBBTKName();
+                       script+="\n";
+                       script+="# Complex input ports\n";
+                       script+=complexInputs;
 
-                       complexOutputs += " ";
-                       complexOutputs += "\" \"";
+                       script+="\n";
+                       script+="# Complex output ports\n";
+                       script+=complexOutputs;
 
-                       complexOutputs += "\n";
-               } else {
-                       script += "connect ";
-                       script += startBox->getBBTKName();
-                       script += ".";
-                       script += start->getBBTKName();
+                       script+="\n";
+                       script+="endefine";
+                       script+="\n";
 
-                       script += " ";
+               return script;
+       }
 
-                       //End Connection info
-                       script += endBox->getBBTKName();
-                       script += ".";
-                       script += end->getBBTKName();
+       //=========================================================================
 
-                       script += "\n";
+       void wxVtkSceneManager::deleteAllBoxes()
+       {
+               std::map<int, GObjectController*>::iterator it;
+               for(it = _controllers.begin(); it != _controllers.end(); ++it)
+               {
+                       GObjectController *cont = it->second;
+                       cont->removeFromScene();
+                       unregisterController((InteractorStyleMaracas*)cont);
                }
+               _selectedObjects.clear();
+               _controllers.clear();
+               refreshScene();
        }
 
-       script += "\n";
+       //=========================================================================
 
-       for (i = 0; i < (int) execBoxes.size(); i++) {
-               script += "exec ";
-               int id = execBoxes[i];
-               GObjectController *control = _controllers[id];
-               GBlackBoxModel *model = (GBlackBoxModel*) control->getModel();
 
-               script += model->getBBTKName();
-               script += "\n";
+       void wxVtkSceneManager::refresh()
+       {
+               _baseView->Refresh();
        }
+       //=========================================================================
 
-       script += "\n";
-       script += "# Complex input ports\n";
-       script += complexInputs;
+       void wxVtkSceneManager::refreshScene()
+       {
+               _baseView->RefreshView();
+       }
 
-       script += "\n";
-       script += "# Complex output ports\n";
-       script += complexOutputs;
+       //=========================================================================
 
-       script += "\n";
-       script += "endefine";
-       script += "\n";
+       void wxVtkSceneManager::centerView()
+       {
+               double temp[3];
+               _baseView->GetRenderer()->GetActiveCamera()->GetFocalPoint(temp);
+               _baseView->GetRenderer()->GetActiveCamera()->SetFocalPoint(0,0,temp[2]);
+               _baseView->GetRenderer()->GetActiveCamera()->GetPosition(temp);
+               _baseView->GetRenderer()->GetActiveCamera()->SetPosition(0,0,temp[2]);
+               _baseView->RefreshView();
 
-       return script;
-}
+       }
 
-//=========================================================================
+       //=========================================================================
+
+       void wxVtkSceneManager::saveDiagram(std::string &content)
+       {
+               char buffer [50];
+
+               //Print info IF COMPLEX BOX
+               content+="COMPLEXBOX:";
+               if(_isComplexBox)
+               {
+                       content+="TRUE\n";
+
+                       //Print info complex input ports
+                       std::vector<int> inputs = getComplexInputPorts();
+                       int insize = inputs.size();
+                       content+="COMPLEXINPUTS:";
+                       sprintf (buffer, "%d", insize);
+                       content+=buffer;
+                       content+="\n";
+
+                       for(int i = 0;i<insize;i++)
+                       {
+                               int id = inputs[i];
+                               GObjectController *cont = _controllers[id];
+                               cont->getModel()->save(content);
+                       }
 
-void wxVtkSceneManager::deleteAllBoxes() {
-       std::map<int, GObjectController*>::iterator it;
-       for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-               GObjectController *cont = it->second;
-               cont->removeFromScene();
-               unregisterController((InteractorStyleMaracas*) cont);
-       }
-       _selectedObjects.clear();
-       _controllers.clear();
-       refreshScene();
-}
-
-//=========================================================================
-
-
-void wxVtkSceneManager::refresh() {
-       _baseView->Refresh();
-}
-//=========================================================================
-
-void wxVtkSceneManager::refreshScene() {
-       _baseView->RefreshView();
-}
-
-//=========================================================================
-
-void wxVtkSceneManager::centerView() {
-       double temp[3];
-       _baseView->GetRenderer()->GetActiveCamera()->GetFocalPoint(temp);
-       _baseView->GetRenderer()->GetActiveCamera()->SetFocalPoint(0, 0, temp[2]);
-       _baseView->GetRenderer()->GetActiveCamera()->GetPosition(temp);
-       _baseView->GetRenderer()->GetActiveCamera()->SetPosition(0, 0, temp[2]);
-       _baseView->RefreshView();
-
-}
-
-//=========================================================================
-
-void wxVtkSceneManager::saveDiagram(std::string &content) {
-       char buffer[50];
-
-       content += "CATEGORY:";
-       content += GetCategory();
-       content += "\n";
-
-       content += "DESCRIPTION:";
-       content += GetDescription();
-       content += "\n";
-
-       content += "AUTHOR:";
-       content += GetAuthor();
-       content += "\n";
-
-       //Print info IF COMPLEX BOX
-       content += "COMPLEXBOX:";
-       if (_isComplexBox) {
-               content += "TRUE\n";
-               //ups1
-               content += "COMPLEXBOXNAME:";
-               content += GetCbName();
-               content += "\n";
-
-               content += "PACKAGENAME:";
-               content += GetCbPackageName();
-               content += "\n";
-
-               //Print info complex input ports
-               std::vector<int> inputs = getComplexInputPorts();
-               int insize = inputs.size();
-               content += "COMPLEXINPUTS:";
-               sprintf(buffer, "%d", insize);
-               content += buffer;
-               content += "\n";
-
-               for (int i = 0; i < insize; i++) {
-                       int id = inputs[i];
+                       //Print info complex output ports
+                       std::vector<int> outputs = getComplexOutputPorts();
+                       int outsize = outputs.size();
+                       content+="COMPLEXOUTPUTS:";
+                       sprintf (buffer, "%d", outsize);
+                       content+=buffer;
+                       content+="\n";
+
+                       for(int i = 0;i<outsize;i++)
+                       {
+                               int id = outputs[i];
+                               GObjectController *cont = _controllers[id];
+                               cont->getModel()->save(content);
+                       }
+               } // _isComplexBox
+               else
+               {
+                       content+="FALSE\n";
+               }
+
+               //Print boxes
+               std::vector<int> boxes = getBlackBoxes();
+               int bsize = boxes.size();
+               content+="BOXES:";
+               sprintf (buffer, "%d", bsize);
+               content+=buffer;
+               content+="\n";
+
+               for(int i = 0;i<bsize;i++)
+               {
+                       int id = boxes[i];
                        GObjectController *cont = _controllers[id];
                        cont->getModel()->save(content);
                }
 
-               //Print info complex output ports
-               std::vector<int> outputs = getComplexOutputPorts();
-               int outsize = outputs.size();
-               content += "COMPLEXOUTPUTS:";
-               sprintf(buffer, "%d", outsize);
-               content += buffer;
-               content += "\n";
+               //Print connections
+               std::vector<int> connections = getConnections();
+               int csize = connections.size();
+               content+="CONNECTIONS:";
+               sprintf (buffer, "%d", csize);
+               content+=buffer;
+               content+="\n";
 
-               for (int i = 0; i < outsize; i++) {
-                       int id = outputs[i];
+               for(int i = 0;i<csize;i++)
+               {
+                       int id = connections[i];
                        GObjectController *cont = _controllers[id];
                        cont->getModel()->save(content);
                }
-       } // _isComplexBox
-       else {
-               content += "FALSE\n";
-       }
-
-       //Print boxes
-       std::vector<int> boxes = getBlackBoxes();
-       int bsize = boxes.size();
-       content += "BOXES:";
-       sprintf(buffer, "%d", bsize);
-       content += buffer;
-       content += "\n";
-
-       for (int i = 0; i < bsize; i++) {
-               int id = boxes[i];
-               GObjectController *cont = _controllers[id];
-               cont->getModel()->save(content);
-       }
 
-       //Print connections
-       std::vector<int> connections = getConnections();
-       int csize = connections.size();
-       content += "CONNECTIONS:";
-       sprintf(buffer, "%d", csize);
-       content += buffer;
-       content += "\n";
-
-       for (int i = 0; i < csize; i++) {
-               int id = connections[i];
-               GObjectController *cont = _controllers[id];
-               cont->getModel()->save(content);
        }
 
-}
-
-//=========================================================================
-
-void wxVtkSceneManager::loadDiagram(ifstream &inputStream) {
-
-       std::string version = "<void>";
-       std::string line = "";
-       char delims[] = ":";
-       char *result = NULL;
-       getline(inputStream, line);
+       //=========================================================================
+
+       void wxVtkSceneManager::loadDiagram(ifstream &inputStream)
+       {
+
+               std::string version;
+               std::string line="";
+               char delims[] = ":";
+               char *result = NULL;
+        getline(inputStream,line);
+
+               bool start = false;
+               while ( !inputStream.eof() )
+               {
+                       if(line=="" || line[0]=='#')
+                       {
+                               getline(inputStream,line);
+                               if (line=="# - BBTKGEditor v 1.0 BBG BlackBox Diagram file")
+                               {
+                                       version=line.substr(18,3);
+                                       printf("EED wxVtkSceneManager::loadDiagram  version=%s\n",version.c_str());
+                               }
 
-       bool start = false;
-       while (!inputStream.eof()) {
-               if (line == "" || line[0] == '#') {
-                       getline(inputStream, line);
-                       if (line == "# - BBTKGEditor v 1.0 BBG BlackBox Diagram file") {
-                               version = line.substr(18, 3);
-                       }
-                       if (line == "# - BBTKGEditor v 1.1 BBG BlackBox Diagram file") {
-                               version = line.substr(18, 3);
                        }
-                       if (line == "# - BBTKGEditor v 1.2 BBG BlackBox Diagram file") {
-                               version = line.substr(18, 3);
+                       else if(line=="APP_START")
+                       {
+                               start = true;
+                               break;
                        }
-               } else if (line == "APP_START") {
-                       start = true;
-                       break;
-               }
-       }
-
-       printf("EED wxVtkSceneManager::loadDiagram  version=%s\n", version.c_str());
-
-       if (start) {
-
-               if ((version != "1.0") && (version != "1.1")) {
-                       getline(inputStream, line);//CATEGORY:<category of the box>
-                       char categoryTmp[30];
-                       strcpy(categoryTmp, line.c_str());
-                       result = strtok(categoryTmp, delims);
-                       result = strtok(NULL, delims);
-                       SetCategory(result);
-
-                       getline(inputStream, line);//DESCRIPTION:<description of the box>
-                       char descriptionTmp[1024];
-                       strcpy(descriptionTmp, line.c_str());
-                       result = strtok(descriptionTmp, delims);
-                       result = strtok(NULL, delims);
-                       SetDescription(result);
-
-                       getline(inputStream, line);//AUTHOR:<author>
-                       char authorTmp[255];
-                       strcpy(authorTmp, line.c_str());
-                       result = strtok(authorTmp, delims);
-                       result = strtok(NULL, delims);
-                       SetAuthor(result);
                }
 
-               //----------
-               getline(inputStream, line);//COMPLEX_BOX:TRUE|FALSE
-               char complexTmp[30];
-               strcpy(complexTmp, line.c_str());
-               result = strtok(complexTmp, delims);
-               result = strtok(NULL, delims);
-               std::string isComplexBox(result);
-
-               if (isComplexBox == "TRUE") {
-                       _isComplexBox = true;
-
-                       if ((version != "1.0") && (version != "1.1")) {
-                               getline(inputStream, line);//COMPLEXNAME:<name of the complex box>
-                               char complexboxnameTmp[255];
-                               strcpy(complexboxnameTmp, line.c_str());
-                               result = strtok(complexboxnameTmp, delims);
-                               result = strtok(NULL, delims);
-                               SetCbName(result);
-
-                               getline(inputStream, line);//PACKAGENAME:<name of the package of the box>
-                               char packagenameTmp[255];
-                               strcpy(packagenameTmp, line.c_str());
-                               result = strtok(packagenameTmp, delims);
-                               result = strtok(NULL, delims);
-                               SetCbPackageName(result);
-                       }
-
-                       //-----------------------
-                       //- COMPLEX INPUT PORTS
-                       //-----------------------
-                       getline(inputStream, line);//COMPLEXINPUTS:num
-                       char inputs[30];
-                       strcpy(inputs, line.c_str());
-                       result = strtok(inputs, delims);
-                       result = strtok(NULL, delims);
+               if(start)
+               {
 
-                       int numInputs;
-                       std::istringstream inps(result);
-                       inps >> numInputs;
+                       //----------
+                       getline(inputStream,line);//COMPLEX_BOX:TRUE|FALSE
+                       char complex[30];
+                       strcpy( complex, line.c_str() );
+                       result = strtok( complex, delims );
+                       result = strtok( NULL, delims );
+                       std::string isComplexBox(result);
+
+                       if(isComplexBox=="TRUE")
+                       {
+                               _isComplexBox=true;
+
+                               //-----------------------
+                               //- COMPLEX INPUT PORTS
+                               //-----------------------
+                               getline(inputStream,line);//COMPLEXINPUTS:num
+                               char inputs[30];
+                               strcpy( inputs, line.c_str() );
+                               result = strtok( inputs, delims );
+                               result = strtok( NULL, delims );
+
+                               int numInputs;
+                               std::istringstream inps(result);
+                               inps >> numInputs;
+
+                               for(int i = 0;i<numInputs;i++)
+                               {
+                                       //----------
+                                       getline(inputStream,line);//COMPLEX_PORT
+                                       getline(inputStream,line);//name
+                                       std::string inputPortName(line);
+
+                                       //----------
+                                       getline(inputStream,line);//xInic:yInic:zInic
+                                       char coord[80];
+                                       strcpy( coord, line.c_str() );
+                                       result = strtok( coord, delims );//xInic
+                                       std::string xInic(result);
+                                       result = strtok( NULL, delims );//yInic
+                                       std::string yInic(result);
+                                       result = strtok( NULL, delims );//zInic
+                                       std::string zInic(result);
+
+                                       double xIn, yIn, zIn;
+                                       std::istringstream xSt(xInic);
+                                       xSt >> xIn;
+                                       std::istringstream ySt(yInic);
+                                       ySt >> yIn;
+                                       std::istringstream zSt(zInic);
+                                       zSt >> zIn;
+
+                                       getline(inputStream,line);//FIN_COMPLEX_PORT
+
+                                       configGComBoxInputOutputPort(true, inputPortName,xIn,yIn,zIn);
+
+
+                               } // for input complex box
+
+
+                               //-----------------------
+                               //- COMPLEX OUTPUT PORTS
+                               //-----------------------
+
+                               getline(inputStream,line);//COMPLEXOUTPUTS:num
+                               char outputs[30];
+                               strcpy( outputs, line.c_str() );
+                               result = strtok( outputs, delims );
+                               result = strtok( NULL, delims );
+
+                               int numOutputs;
+                               std::istringstream outps(result);
+                               outps >> numOutputs;
+
+                               for(int i = 0;i<numOutputs;i++)
+                               {
+                                       //----------
+                                       getline(inputStream,line);//COMPLEX_PORT
+                                       getline(inputStream,line);//name
+                                       std::string outputPortName(line);
+
+                                       //----------
+                                       getline(inputStream,line);//xInic:yInic:zInic
+                                       char coord[80];
+                                       strcpy( coord, line.c_str() );
+                                       result = strtok( coord, delims );//xInic
+                                       std::string xInic(result);
+                                       result = strtok( NULL, delims );//yInic
+                                       std::string yInic(result);
+                                       result = strtok( NULL, delims );//zInic
+                                       std::string zInic(result);
+
+                                       double xIn, yIn, zIn;
+                                       std::istringstream xSt(xInic);
+                                       xSt >> xIn;
+                                       std::istringstream ySt(yInic);
+                                       ySt >> yIn;
+                                       std::istringstream zSt(zInic);
+                                       zSt >> zIn;
+
+                                       getline(inputStream,line);//FIN_COMPLEX_PORT
+
+                                       configGComBoxInputOutputPort(false, outputPortName,xIn,yIn,zIn);
+
+                               } // for output complex box
+
+                       } // complex box
 
-                       for (int i = 0; i < numInputs; i++) {
+                       //----------
+                       getline(inputStream,line);//BOXES:num
+                       char boxes[9];
+                       strcpy( boxes, line.c_str() );
+                       result = strtok( boxes, delims );
+                       result = strtok( NULL, delims );
+
+                       int numBoxes;
+                       std::istringstream is(result);
+                       is >> numBoxes;
+
+                       for(int i = 0;i<numBoxes;i++)
+                       {
                                //----------
-                               getline(inputStream, line);//COMPLEX_PORT
-                               getline(inputStream, line);//name
-                               std::string inputPortName(line);
+                               getline(inputStream,line);//BOX
+                               getline(inputStream,line);//package:type:name
+                               char box[150];
+                               strcpy( box, line.c_str() );
+                               result = strtok( box, delims );//package
+                               std::string package(result);
+                               result = strtok( NULL, delims );//type
+                               std::string type(result);
+                               result = strtok( NULL, delims );//name
+                               std::string name(result);
+
+                               getline(inputStream,line);//ISEXEC:TRUE|FALSE
+                               char exec[15];
+                               strcpy( exec, line.c_str() );
+                               result = strtok( exec, delims );//ISEXEC
+                               result = strtok( NULL, delims );//TRUE|FALSE
+                               std::string isExec(result);
 
                                //----------
-                               getline(inputStream, line);//xInic:yInic:zInic
+                               getline(inputStream,line);//xInic:yInic:zInic
                                char coord[80];
-                               strcpy(coord, line.c_str());
-                               result = strtok(coord, delims);//xInic
+                               strcpy( coord, line.c_str() );
+                               result = strtok( coord, delims );//xInic
                                std::string xInic(result);
-                               result = strtok(NULL, delims);//yInic
+                               result = strtok( NULL, delims );//yInic
                                std::string yInic(result);
-                               result = strtok(NULL, delims);//zInic
+                               result = strtok( NULL, delims );//zInic
                                std::string zInic(result);
 
                                double xIn, yIn, zIn;
@@ -1760,714 +1854,581 @@ void wxVtkSceneManager::loadDiagram(ifstream &inputStream) {
                                std::istringstream zSt(zInic);
                                zSt >> zIn;
 
-                               getline(inputStream, line);//FIN_COMPLEX_PORT
-
-                               configGComBoxInputOutputPort(true, inputPortName, xIn, yIn, zIn);
-
-                       } // for input complex box
-
+                               //----------
+                               getline(inputStream,line);//xEnd:yEnd:zEnd
+                               strcpy( coord, line.c_str() );
+                               result = strtok( coord, delims );//xEnd
+                               std::string xEnd(result);
+                               result = strtok( NULL, delims );//yEnd
+                               std::string yEnd(result);
+                               result = strtok( NULL, delims );//zEnd
+                               std::string zEnd(result);
+
+                               double xEn, yEn, zEn;
+                               std::istringstream xEt(xEnd);
+                               xEt >> xEn;
+                               std::istringstream yEt(yEnd);
+                               yEt >> yEn;
+                               std::istringstream zEt(zEnd);
+                               zEt >> zEn;
+
+                               bool boxExecutable=false;
+                               if(isExec=="TRUE")
+                               {
+                                       boxExecutable= true;
+                               }
 
-                       //-----------------------
-                       //- COMPLEX OUTPUT PORTS
-                       //-----------------------
+                               int idBox                               = createGBlackBox(xIn,yIn,package,type);
+                               configGBlackBox(idBox, xIn,yIn,zIn,name, boxExecutable,xEn,yEn,zEn);
 
-                       getline(inputStream, line);//COMPLEXOUTPUTS:num
-                       char outputs[30];
-                       strcpy(outputs, line.c_str());
-                       result = strtok(outputs, delims);
-                       result = strtok(NULL, delims);
+                               GObjectController *cont = _controllers[idBox];
+                               GBlackBoxModel *bbmod   = (GBlackBoxModel*)cont->getModel();
 
-                       int numOutputs;
-                       std::istringstream outps(result);
-                       outps >> numOutputs;
 
-                       for (int i = 0; i < numOutputs; i++) {
                                //----------
-                               getline(inputStream, line);//COMPLEX_PORT
-                               getline(inputStream, line);//name
-                               std::string outputPortName(line);
-
+                               getline(inputStream,line);//PORT o FIN_BOX
+                               std::string port=line.substr(0,4);
+                               while(port=="PORT")
+                               {
+                                       getline(inputStream,line);//name:value
+                                       char poort[150];
+                                       strcpy( poort, line.c_str() );
+                                       result = strtok( poort, delims );//name
+                                       std::string name(result);
+                                       result = strtok( NULL, delims );//value
+                                       std::string value(result);
+
+                                       bbmod->setValueToInput(name,value);
+
+                                       getline(inputStream,line);//PORT o FIN_BOX
+                                       port=line.substr(0,4);
+                               } // while
+
+//EED                          bbmod->notifyObservers(_idManager);
+                       } // for boxes
+
+                       /// CONNECTIONS
+                       //----------
+                       getline(inputStream,line);//CONNECTIONS:num
+                       char conns[30];
+                       strcpy( conns, line.c_str() );
+                       result = strtok( conns, delims );
+                       result = strtok( NULL, delims );
+
+                       int numConns;
+                       std::istringstream isCons(result);
+                       isCons >> numConns;
+
+                       for(int i = 0;i<numConns;i++)
+                       {
                                //----------
-                               getline(inputStream, line);//xInic:yInic:zInic
-                               char coord[80];
-                               strcpy(coord, line.c_str());
-                               result = strtok(coord, delims);//xInic
-                               std::string xInic(result);
-                               result = strtok(NULL, delims);//yInic
-                               std::string yInic(result);
-                               result = strtok(NULL, delims);//zInic
-                               std::string zInic(result);
-
-                               double xIn, yIn, zIn;
-                               std::istringstream xSt(xInic);
-                               xSt >> xIn;
-                               std::istringstream ySt(yInic);
-                               ySt >> yIn;
-                               std::istringstream zSt(zInic);
-                               zSt >> zIn;
+                               getline(inputStream,line);//CONNECTION
+                               getline(inputStream,line);//Startbox.PortName:EndBox.PortName
+
+                               char connec[200];
+                               strcpy( connec, line.c_str() );
+                               result = strtok( connec, delims );
+                               std::string nameStartBox(result);
+                               result = strtok( NULL, delims );
+                               std::string nameStartPort(result);
+                               result = strtok( NULL, delims );
+                               std::string nameEndBox(result);
+                               result = strtok( NULL, delims );
+                               std::string nameEndPort(result);
+
+                               int idCon = configGConnetion(nameStartBox, nameStartPort, nameEndBox, nameEndPort);
+                               
+                               if (version!="1.0")
+                               {
+                                       //Readding control points of the manualContour 
+                                       //ups1
+                                       GConnectorController    *tempp  = (GConnectorController*)_controllers[idCon];                           
+                                       GConnectorModel                 *conMod = (GConnectorModel*)tempp->getModel();
+                                       vtkGConnectorView               *conView= (vtkGConnectorView*)tempp->getView();
+                                       getline(inputStream,line); //NumberOfControlPoints:##
+                                       strcpy( conns, line.c_str() );
+                                       result = strtok( conns, delims );
+                                       result = strtok( NULL, delims );
+                               
+                                       int numberOfControlPoints;
+                                       std::istringstream isCons(result);
+                                       isCons >> numberOfControlPoints;
+                               
+                                       for (int ii=0;ii<numberOfControlPoints;ii++)
+                                       {
+                                               getline(inputStream,line); //XX:YY:ZZ
+                                               char connec[200];
+                                               strcpy( connec, line.c_str() );
+                                       
+                                               double px,py,pz;
+                                               result = strtok( connec, delims );
+                                               std::istringstream isPointX(result);
+                                               isPointX >> px;
+                                               result = strtok( NULL, delims );
+                                               std::istringstream isPointY(result);
+                                               isPointY >> py;
+                                               result = strtok( NULL, delims );
+                                               std::istringstream isPointZ(result);
+                                               isPointZ >> pz;
+                                       
+                                               conMod->getManualContourModel()->InsertPoint_id(ii+1,px,py,pz);
+                                               conView->getManualContourView()->AddPoint();
+                                       }
+                               }// version !=1.0
+                               
+                       } // for numConns
 
-                               getline(inputStream, line);//FIN_COMPLEX_PORT
+        } // start
+               
+               refresh();
+       }
+       //=========================================================================
 
-                               configGComBoxInputOutputPort(false, outputPortName, xIn, yIn,
-                                               zIn);
 
-                       } // for output complex box
 
-               } // complex box
+       //=========================================================================
+       void wxVtkSceneManager::configGComBoxInputOutputPort(bool inputoutput, std::string portName, double xIn, double yIn,double zIn)
+       {
+               int idPort;
+               if (inputoutput==true)
+               {
+                       idPort = createGComplexBoxInputPort(portName);
+               } else  {
+                       idPort = createGComplexBoxOutputPort(portName);
+               }
+               GObjectController *cont = _controllers[idPort];
+               GBoxModel *cbmod                = (GBoxModel*)cont->getModel();
+               cbmod->setInicPoint(xIn,yIn,zIn);
+               cbmod->notifyObservers(_idManager);
+       }
+       //=========================================================================
+
+
+       //=========================================================================
+       GBoxModel* wxVtkSceneManager::findGBox(std::string boxname)
+       {
+               int j;
+               int idB;
+               GBoxModel *bMod;
+               GBoxModel *boxModel                     = NULL;
+               std::vector<int> lstB           = getBlackBoxes();
+               for(j = 0;j<(int)lstB.size();j++)
+               {
+                       idB             = lstB[j];
+                       bMod    = (GBoxModel*)_controllers[idB]->getModel();
+                       if(_controllers[idB]->getModel()->getBBTKName()==boxname)
+                       {
+                               boxModel = bMod;
+                       }
+               } // for
 
-               //----------
-               getline(inputStream, line);//BOXES:num
-               char boxes[9];
-               strcpy(boxes, line.c_str());
-               result = strtok(boxes, delims);
-               result = strtok(NULL, delims);
+               if((_isComplexBox) && (boxModel==NULL))
+               {
+                       std::vector<int> lstInputs = getComplexInputPorts();
+                       for(j = 0;j<(int)lstInputs.size();j++)
+                       {
+                               idB             = lstInputs[j];
+                               bMod    = (GBoxModel*)_controllers[idB]->getModel();
+                               if(_controllers[idB]->getModel()->getBBTKName()==boxname)
+                               {
+                                       boxModel = bMod;
+                               }
+                       } // for
+
+                       std::vector<int> lstOutputs = getComplexOutputPorts();
+                       for(j = 0;j<(int)lstOutputs.size();j++)
+                       {
+                               int idB = lstOutputs[j];
+                               bMod = (GBoxModel*)_controllers[idB]->getModel();
+                               if(_controllers[idB]->getModel()->getBBTKName()==boxname)
+                               {
+                                       boxModel = bMod;
+                               }
+                       } // for
 
-               int numBoxes;
-               std::istringstream is(result);
-               is >> numBoxes;
+               } // complex box
 
-               for (int i = 0; i < numBoxes; i++) {
-                       //----------
-                       getline(inputStream, line);//BOX
-                       getline(inputStream, line);//package:type:name
-                       char box[150];
-                       strcpy(box, line.c_str());
-                       result = strtok(box, delims);//package
-                       std::string package(result);
-                       result = strtok(NULL, delims);//type
-                       std::string type(result);
-                       result = strtok(NULL, delims);//name
-                       std::string name(result);
-
-                       getline(inputStream, line);//ISEXEC:TRUE|FALSE
-                       char exec[15];
-                       strcpy(exec, line.c_str());
-                       result = strtok(exec, delims);//ISEXEC
-                       result = strtok(NULL, delims);//TRUE|FALSE
-                       std::string isExec(result);
+               return boxModel;
+       }
 
-                       //----------
-                       getline(inputStream, line);//xInic:yInic:zInic
-                       char coord[80];
-                       strcpy(coord, line.c_str());
-                       result = strtok(coord, delims);//xInic
-                       std::string xInic(result);
-                       result = strtok(NULL, delims);//yInic
-                       std::string yInic(result);
-                       result = strtok(NULL, delims);//zInic
-                       std::string zInic(result);
-
-                       double xIn, yIn, zIn;
-                       std::istringstream xSt(xInic);
-                       xSt >> xIn;
-                       std::istringstream ySt(yInic);
-                       ySt >> yIn;
-                       std::istringstream zSt(zInic);
-                       zSt >> zIn;
+       //=========================================================================
 
-                       //----------
-                       getline(inputStream, line);//xEnd:yEnd:zEnd
-                       strcpy(coord, line.c_str());
-                       result = strtok(coord, delims);//xEnd
-                       std::string xEnd(result);
-                       result = strtok(NULL, delims);//yEnd
-                       std::string yEnd(result);
-                       result = strtok(NULL, delims);//zEnd
-                       std::string zEnd(result);
-
-                       double xEn, yEn, zEn;
-                       std::istringstream xEt(xEnd);
-                       xEt >> xEn;
-                       std::istringstream yEt(yEnd);
-                       yEt >> yEn;
-                       std::istringstream zEt(zEnd);
-                       zEt >> zEn;
-
-                       bool boxExecutable = false;
-                       if (isExec == "TRUE") {
-                               boxExecutable = true;
-                       }
 
-                       int idBox = createGBlackBox(xIn, yIn, package, type);
-                       configGBlackBox(idBox, xIn, yIn, zIn, name, boxExecutable, xEn,
-                                       yEn, zEn);
+       int wxVtkSceneManager::configGConnetion(std::string nameStartBox, std::string  nameStartPort, std::string
+                                                                                        nameEndBox, std::string  nameEndPort)
+       {
 
-                       GObjectController *cont = _controllers[idBox];
-                       GBlackBoxModel *bbmod = (GBlackBoxModel*) cont->getModel();
+               GBoxModel *boxModel;
+               GPortModel *startP      = NULL;
+               GPortModel *endP        = NULL;
 
-                       //----------
-                       getline(inputStream, line);//PORT o FIN_BOX
-                       std::string port = line.substr(0, 4);
-                       while (port == "PORT") {
-                               getline(inputStream, line);//name:value
-                               char poort[150];
-                               strcpy(poort, line.c_str());
-                               result = strtok(poort, delims);//name
-                               std::string name(result);
-                               result = strtok(NULL, delims);//value
-                               std::string value(result);
+               boxModel= findGBox(nameStartBox);
+               if (boxModel!=NULL)
+               {
+                       startP          = boxModel->getOutputPort(nameStartPort);
+               }
 
-                               bbmod->setValueToInput(name, value);
+               boxModel= findGBox(nameEndBox);
+               if (boxModel!=NULL)
+               {
+                       endP            = boxModel->getInputPort(nameEndPort);
+               }
 
-                               getline(inputStream, line);//PORT o FIN_BOX
-                               port = line.substr(0, 4);
-                       } // while
+//ups2
+               int idCon                                       = createGConnector(startP);
+               _worldState                                     = NOTHING_HAPPENS;
+               GConnectorController *tempp = (GConnectorController*)_controllers[idCon];
 
-                       //EED                           bbmod->notifyObservers(_idManager);
-               } // for boxes
+               GConnectorModel *conMod         = (GConnectorModel*)tempp->getModel();
+               vtkGConnectorView *conView      = (vtkGConnectorView*)tempp->getView();
+               tempp->endContourCreation();
+               conMod->setEndPort(endP);
+               conView->updateStartEndPoints();
+               return idCon;
+       }
 
-               /// CONNECTIONS
-               //----------
-               getline(inputStream, line);//CONNECTIONS:num
-               char conns[30];
-               strcpy(conns, line.c_str());
-               result = strtok(conns, delims);
-               result = strtok(NULL, delims);
+       //=========================================================================
 
-               int numConns;
-               std::istringstream isCons(result);
-               isCons >> numConns;
+       bool wxVtkSceneManager::boxExist(std::string boxname)
+       {
+               bool ok=false;
+               std::map<int, GObjectController*>::iterator it;
+               for(it = _controllers.begin(); it != _controllers.end(); ++it)
+               {
+                       GObjectController *cont = it->second;
+                       if(cont->getModel()->getBBTKName()==boxname)
+                       {
+                               ok=true;
+                       }
+               }
+               return ok;
+       }
 
-               for (int i = 0; i < numConns; i++) {
-                       //----------
-                       getline(inputStream, line);//CONNECTION
-                       getline(inputStream, line);//Startbox.PortName:EndBox.PortName
-
-                       char connec[200];
-                       strcpy(connec, line.c_str());
-                       result = strtok(connec, delims);
-                       std::string nameStartBox(result);
-                       result = strtok(NULL, delims);
-                       std::string nameStartPort(result);
-                       result = strtok(NULL, delims);
-                       std::string nameEndBox(result);
-                       result = strtok(NULL, delims);
-                       std::string nameEndPort(result);
-
-                       int idCon = configGConnetion(nameStartBox, nameStartPort,
-                                       nameEndBox, nameEndPort);
-
-                       if (version != "1.0") {
-                               //Readding control points of the manualContour
-                               //ups1
-                               GConnectorController *tempp =
-                                               (GConnectorController*) _controllers[idCon];
-                               GConnectorModel *conMod = (GConnectorModel*) tempp->getModel();
-                               vtkGConnectorView *conView =
-                                               (vtkGConnectorView*) tempp->getView();
-                               getline(inputStream, line); //NumberOfControlPoints:##
-                               strcpy(conns, line.c_str());
-                               result = strtok(conns, delims);
-                               result = strtok(NULL, delims);
-
-                               int numberOfControlPoints;
-                               std::istringstream isCons(result);
-                               isCons >> numberOfControlPoints;
-
-                               for (int ii = 0; ii < numberOfControlPoints; ii++) {
-                                       getline(inputStream, line); //XX:YY:ZZ
-                                       char connec[200];
-                                       strcpy(connec, line.c_str());
-
-                                       double px, py, pz;
-                                       result = strtok(connec, delims);
-                                       std::istringstream isPointX(result);
-                                       isPointX >> px;
-                                       result = strtok(NULL, delims);
-                                       std::istringstream isPointY(result);
-                                       isPointY >> py;
-                                       result = strtok(NULL, delims);
-                                       std::istringstream isPointZ(result);
-                                       isPointZ >> pz;
-
-                                       conMod->getManualContourModel()->InsertPoint_id(ii + 1, px,
-                                                       py, pz);
-                                       conView->getManualContourView()->AddPoint();
-                               }
-                       }// version !=1.0
+       //=========================================================================
 
-               } // for numConns
+       std::vector<int> wxVtkSceneManager::getBlackBoxes()
+       {
+               std::vector<int> vect;
+               std::map<int, GObjectController*>::iterator it;
+               for(it = _controllers.begin(); it != _controllers.end(); ++it)
+               {
+                       GObjectController *cont = it->second;
+                       if(cont->getGObjectType()==GBLACKBOX)
+                       {
+                               vect.push_back(cont->getId());
+                       }
+               }
+               return vect;
+       }
 
-       } // start
+       //=========================================================================
 
-       refresh();
-}
-//=========================================================================
+       std::vector<int> wxVtkSceneManager::getComplexInputPorts()
+       {
+               std::vector<int> vect;
+               std::map<int, GObjectController*>::iterator it;
+               for(it = _controllers.begin(); it != _controllers.end(); ++it)
+               {
+                       GObjectController *cont = it->second;
+                       if(cont->getGObjectType()==GCOMPLEXINPUTPORT)
+                       {
+                               vect.push_back(cont->getId());
+                       }
+               }
+               return vect;
+       }
 
+       //=========================================================================
 
-//=========================================================================
-void wxVtkSceneManager::configGComBoxInputOutputPort(bool inputoutput,
-               std::string portName, double xIn, double yIn, double zIn) {
-       int idPort;
-       if (inputoutput == true) {
-               idPort = createGComplexBoxInputPort(portName);
-       } else {
-               idPort = createGComplexBoxOutputPort(portName);
-       }
-       GObjectController *cont = _controllers[idPort];
-       GBoxModel *cbmod = (GBoxModel*) cont->getModel();
-       cbmod->setInicPoint(xIn, yIn, zIn);
-       cbmod->notifyObservers(_idManager);
-}
-//=========================================================================
-
-
-//=========================================================================
-GBoxModel* wxVtkSceneManager::findGBox(std::string boxname) {
-       int j;
-       int idB;
-       GBoxModel *bMod;
-       GBoxModel *boxModel = NULL;
-       std::vector<int> lstB = getBlackBoxes();
-       for (j = 0; j < (int) lstB.size(); j++) {
-               idB = lstB[j];
-               bMod = (GBoxModel*) _controllers[idB]->getModel();
-               if (_controllers[idB]->getModel()->getBBTKName() == boxname) {
-                       boxModel = bMod;
-               }
-       } // for
-
-       if ((_isComplexBox) && (boxModel == NULL)) {
-               std::vector<int> lstInputs = getComplexInputPorts();
-               for (j = 0; j < (int) lstInputs.size(); j++) {
-                       idB = lstInputs[j];
-                       bMod = (GBoxModel*) _controllers[idB]->getModel();
-                       if (_controllers[idB]->getModel()->getBBTKName() == boxname) {
-                               boxModel = bMod;
+       std::vector<int> wxVtkSceneManager::getComplexOutputPorts()
+       {
+               std::vector<int> vect;
+               std::map<int, GObjectController*>::iterator it;
+               for(it = _controllers.begin(); it != _controllers.end(); ++it)
+               {
+                       GObjectController *cont = it->second;
+                       if(cont->getGObjectType()==GCOMPLEXOUTPUTPORT)
+                       {
+                               vect.push_back(cont->getId());
                        }
-               } // for
+               }
+               return vect;
+       }
 
-               std::vector<int> lstOutputs = getComplexOutputPorts();
-               for (j = 0; j < (int) lstOutputs.size(); j++) {
-                       int idB = lstOutputs[j];
-                       bMod = (GBoxModel*) _controllers[idB]->getModel();
-                       if (_controllers[idB]->getModel()->getBBTKName() == boxname) {
-                               boxModel = bMod;
+       //=========================================================================
+
+       std::vector<int> wxVtkSceneManager::getConnections()
+       {
+               std::vector<int> vect;
+               std::map<int, GObjectController*>::iterator it;
+               for(it = _controllers.begin(); it != _controllers.end(); ++it)
+               {
+                       GObjectController *cont = it->second;
+                       if(cont->getGObjectType()==GCONNECTOR)
+                       {
+                               vect.push_back(cont->getId());
                        }
-               } // for
+               }
+               return vect;
+       }
 
-       } // complex box
+       //=========================================================================
 
-       return boxModel;
-}
+       bool wxVtkSceneManager::isComplexBox()
+       {
+               return _isComplexBox;
+       }
 
-//=========================================================================
+       //=========================================================================
 
+       void wxVtkSceneManager::setComplexBox(bool val)
+       {
+               _isComplexBox=val;
+       }
 
-int wxVtkSceneManager::configGConnetion(std::string nameStartBox,
-               std::string nameStartPort, std::string nameEndBox,
-               std::string nameEndPort) {
+       //=========================================================================
 
-       GBoxModel *boxModel;
-       GPortModel *startP = NULL;
-       GPortModel *endP = NULL;
+       int wxVtkSceneManager::addObjectController(GObjectController* objController)
+       {
+               //Register the controller of the new object
+               registerController((InteractorStyleMaracas*) objController);
 
-       boxModel = findGBox(nameStartBox);
-       if (boxModel != NULL) {
-               startP = boxModel->getOutputPort(nameStartPort);
+               //Add the object to the objects list
+               int newId = _contLastId;//_controllers.size();
+               objController->setId(newId);
+               _controllers[newId] = objController;
+               _contLastId++;
+               return newId;
        }
 
-       boxModel = findGBox(nameEndBox);
-       if (boxModel != NULL) {
-               endP = boxModel->getInputPort(nameEndPort);
-       }
+       //=========================================================================
 
-       //ups2
-       int idCon = createGConnector(startP);
-       _worldState = NOTHING_HAPPENS;
-       GConnectorController *tempp = (GConnectorController*) _controllers[idCon];
-
-       GConnectorModel *conMod = (GConnectorModel*) tempp->getModel();
-       vtkGConnectorView *conView = (vtkGConnectorView*) tempp->getView();
-       tempp->endContourCreation();
-       conMod->setEndPort(endP);
-       conView->updateStartEndPoints();
-       return idCon;
-}
-
-//=========================================================================
-
-bool wxVtkSceneManager::boxExist(std::string boxname) {
-       bool ok = false;
-       std::map<int, GObjectController*>::iterator it;
-       for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-               GObjectController *cont = it->second;
-               if (cont->getModel()->getBBTKName() == boxname) {
-                       ok = true;
-               }
-       }
-       return ok;
-}
-
-//=========================================================================
-
-std::vector<int> wxVtkSceneManager::getBlackBoxes() {
-       std::vector<int> vect;
-       std::map<int, GObjectController*>::iterator it;
-       for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-               GObjectController *cont = it->second;
-               if (cont->getGObjectType() == GBLACKBOX) {
-                       vect.push_back(cont->getId());
-               }
-       }
-       return vect;
-}
-
-//=========================================================================
-
-std::vector<int> wxVtkSceneManager::getComplexInputPorts() {
-       std::vector<int> vect;
-       std::map<int, GObjectController*>::iterator it;
-       for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-               GObjectController *cont = it->second;
-               if (cont->getGObjectType() == GCOMPLEXINPUTPORT) {
-                       vect.push_back(cont->getId());
-               }
-       }
-       return vect;
-}
-
-//=========================================================================
-
-std::vector<int> wxVtkSceneManager::getComplexOutputPorts() {
-       std::vector<int> vect;
-       std::map<int, GObjectController*>::iterator it;
-       for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-               GObjectController *cont = it->second;
-               if (cont->getGObjectType() == GCOMPLEXOUTPUTPORT) {
-                       vect.push_back(cont->getId());
-               }
-       }
-       return vect;
-}
-
-//=========================================================================
-
-std::vector<int> wxVtkSceneManager::getConnections() {
-       std::vector<int> vect;
-       std::map<int, GObjectController*>::iterator it;
-       for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-               GObjectController *cont = it->second;
-               if (cont->getGObjectType() == GCONNECTOR) {
-                       vect.push_back(cont->getId());
-               }
-       }
-       return vect;
-}
-
-//=========================================================================
-
-bool wxVtkSceneManager::isComplexBox() {
-       return _isComplexBox;
-}
-
-//=========================================================================
-
-void wxVtkSceneManager::setComplexBox(bool val) {
-       _isComplexBox = val;
-}
-
-//=========================================================================
-
-int wxVtkSceneManager::addObjectController(GObjectController* objController) {
-       //Register the controller of the new object
-       registerController((InteractorStyleMaracas*) objController);
-       //Add the object to the objects list
-       int newId = _contLastId;//_controllers.size();
-       objController->setId(newId);
-       _controllers[newId] = objController;
-       std::cout
-                       << "DFCH: int wxVtkSceneManager::addObjectController(GObjectController* objController) ---- _contLastId = "
-                       << _contLastId << std::endl;
-       _contLastId++;
-       return newId;
-}
-
-//=========================================================================
-
-int wxVtkSceneManager::getNumSelectedObjects() {
-       return _selectedObjects.size();
-}
-
-//=========================================================================
-
-std::map<int, GObjectController*> wxVtkSceneManager::getSelectedObjects() {
-       std::map<int, GObjectController*> mapSelected;
-
-       std::map<int, GObjectController*>::iterator it;
-       for (it = _controllers.begin(); it != _controllers.end(); ++it) {
-               GObjectController *cont = it->second;
-               if (cont->getGObjectType() == GBLACKBOX && cont->getView()->getState()
-                               == SELECTED) {
-                       mapSelected[cont->getId()] = cont;
-               }
+       int wxVtkSceneManager::getNumSelectedObjects()
+       {
+               return _selectedObjects.size();
        }
 
-       std::map<int, GObjectController*>::iterator it2;
-       for (it2 = _controllers.begin(); it2 != _controllers.end(); ++it2) {
-               GObjectController *cont = it2->second;
-               if (cont->getGObjectType() == GCONNECTOR) {
-                       GConnectorModel* cmod = (GConnectorModel*) cont->getModel();
-                       GBoxModel* endPortParentBox = cmod->getEndPort()->getParentBox();
-                       GBoxModel* startPortParentBox =
-                                       cmod->getStartPort()->getParentBox();
-
-                       std::map<int, GObjectController*>::iterator iterOBJ1 =
-                                       mapSelected.find(startPortParentBox->getObjectId());
-                       std::map<int, GObjectController*>::iterator iterOBJ2 =
-                                       mapSelected.find(endPortParentBox->getObjectId());
-
-                       if (iterOBJ1 != mapSelected.end() && iterOBJ2 != mapSelected.end()) {
-                               int ID = cont->getId();
-                               mapSelected[ID] = cont;
+       //=========================================================================
+
+       std::map<int,GObjectController*> wxVtkSceneManager::getSelectedObjects()
+       {
+               std::map<int,GObjectController*> mapSelected;
+
+               std::map<int, GObjectController*>::iterator it;
+               for(it = _controllers.begin(); it != _controllers.end(); ++it)
+               {
+                       GObjectController *cont = it->second;
+                       if(cont->getGObjectType()==GBLACKBOX && cont->getView()->getState()==SELECTED)
+                       {
+                               mapSelected[cont->getId()]=cont;
                        }
                }
-       }
-       return mapSelected;
-}
-
-//=========================================================================
-
-void wxVtkSceneManager::addObjects(std::map<int, GObjectController*> objectsMap) {
-
-       std::map<int, int> oldIdNewIdBoxes;
-       std::vector<int> connections;
-
-       std::map<int, GObjectController*>::iterator it;
-       for (it = objectsMap.begin(); it != objectsMap.end(); ++it) {
-               GObjectController *cont = it->second;
-               int type = cont->getGObjectType();
-
-               if (type == GBLACKBOX) {
-                       // Copy black box
-                       double xInic, yInic, zInic;
-                       GBlackBoxModel* copyBox = (GBlackBoxModel*) cont->getModel();
-                       copyBox->getInicPoint(xInic, yInic, zInic);
-                       int idBox = createGBlackBox(0, 0, copyBox->getBBTKPackage(),
-                                       copyBox->getBBTKType());
-
-                       int idcB = copyBox->getObjectId();
-                       oldIdNewIdBoxes[idcB] = idBox;
-                       cont = _controllers[idBox];
-                       GBlackBoxModel* newbox = (GBlackBoxModel*) cont->getModel();
-                       newbox->setInicPoint(xInic, yInic, zInic);
-                       int num = newbox->getNumInputPorts();
-                       for (int j = 0; j < num; j++) {
-                               newbox->setValueToInputPort(j, copyBox->getValueInputPort(j));
+
+               std::map<int, GObjectController*>::iterator it2;
+               for(it2 = _controllers.begin(); it2 != _controllers.end(); ++it2)
+               {
+                       GObjectController *cont = it2->second;
+                       if(cont->getGObjectType()==GCONNECTOR)
+                       {
+                               GConnectorModel* cmod = (GConnectorModel*)cont->getModel();
+                               GBoxModel* endPortParentBox = cmod->getEndPort()->getParentBox();
+                               GBoxModel* startPortParentBox = cmod->getStartPort()->getParentBox();
+
+                               std::map<int, GObjectController*>::iterator iterOBJ1 = mapSelected.find(startPortParentBox->getObjectId());
+                               std::map<int, GObjectController*>::iterator iterOBJ2 = mapSelected.find(endPortParentBox->getObjectId());
+
+                               if(iterOBJ1 != mapSelected.end() && iterOBJ2 != mapSelected.end())
+                               {
+                                       int ID = cont->getId();
+                                       mapSelected[ID]=cont;
+                               }
                        }
-                       newbox->notifyObservers(_idManager);
-               } else if (type == GCONNECTOR) {
-                       int idCon = cont->getId();
-                       connections.push_back(idCon);
                }
-
+               return mapSelected;
        }
 
-       for (int i = 0; i < (int) connections.size(); i++) {
-               int objId = connections[i];
-               GObjectController *cont = objectsMap[objId];
-               GConnectorModel* connectModel = (GConnectorModel*) cont->getModel();
-
-               GPortModel* startPort = connectModel->getStartPort();
-               int startPortIndex = startPort->getPosInBox();
-               GPortModel* endPort = connectModel->getEndPort();
-               int endPortIndex = endPort->getPosInBox();
-
-               GBlackBoxModel* startPortParentBox =
-                               (GBlackBoxModel*) startPort->getParentBox();
-               GBlackBoxModel* endPortParentBox =
-                               (GBlackBoxModel*) endPort->getParentBox();
-
-               int idNewStartBox = oldIdNewIdBoxes[startPortParentBox->getObjectId()];
-               int idNewEndBox = oldIdNewIdBoxes[endPortParentBox->getObjectId()];
-
-               GBlackBoxModel* newStartBox =
-                               (GBlackBoxModel*) _controllers[idNewStartBox]->getModel();
-               GBlackBoxModel* newEndBox =
-                               (GBlackBoxModel*) _controllers[idNewEndBox]->getModel();
-
-               GPortModel* newStartPort = newStartBox->getOutputPort(startPortIndex);
-               GPortModel* newEndPort = newEndBox->getInputPort(endPortIndex);
-
-               // Creates connection
-               int idCon = createGConnector(newStartPort);
-               GConnectorController *tempp =
-                               (GConnectorController*) _controllers[idCon];
-               GConnectorModel *conMod = (GConnectorModel*) tempp->getModel();
-               vtkGConnectorView *conView = (vtkGConnectorView*) tempp->getView();
-               tempp->endContourCreation();
-               conMod->setEndPort(newEndPort);
-               conView->updateStartEndPoints();
-       }
+       //=========================================================================
 
-       std::map<int, int>::iterator itIds;
-       for (itIds = oldIdNewIdBoxes.begin(); itIds != oldIdNewIdBoxes.end(); ++itIds) {
-               int idOld = itIds->first;
-               int idNew = itIds->second;
-
-               GBlackBoxModel* oldBox =
-                               (GBlackBoxModel*) objectsMap[idOld]->getModel();
-               GBlackBoxModel* newBox =
-                               (GBlackBoxModel*) _controllers[idNew]->getModel();
-
-               std::vector<int> oldInputConnections = oldBox->getConnectedInputs();
-               std::vector<int> oldOutputConnections = oldBox->getConnectedOutputs();
-               std::vector<int> newInputConnections = newBox->getConnectedInputs();
-               std::vector<int> newOutputConnections = newBox->getConnectedOutputs();
-
-               for (int k = 0; k < (int) oldInputConnections.size(); k++) {
-                       bool exist = false;
-                       //EED                           int toCreate=-1;
-                       for (int l = 0; l < (int) newInputConnections.size() && !exist; l++) {
-                               if (oldInputConnections[k] == newInputConnections[l]) {
-                                       exist = true;
-                               }
-                       }
+       void wxVtkSceneManager::addObjects(std::map<int,GObjectController*> objectsMap)
+       {
 
-                       if (exist == false) {
-                               //Create complex input
-                               int posInBox = oldInputConnections[k];
-                               GPortModel* inputPort = oldBox->getInputPort(posInBox);
-                               std::string inputPortName = inputPort->getBBTKName();
-                               int idInputPort = createGComplexBoxInputPort(inputPortName);
-                               GObjectController *cont = _controllers[idInputPort];
-                               GBoxModel *cbmod = (GBoxModel*) cont->getModel();
-                               double xIn, yIn, zIn;
-                               inputPort->getInicPoint(xIn, yIn, zIn);
-                               yIn += 20;
-                               cbmod->setInicPoint(xIn, yIn, zIn);
-                               cbmod->notifyObservers(_idManager);
-
-                               GPortModel* inputPortEnd = newBox->getInputPort(posInBox);
-
-                               // Creates connection
-                               int idCon = createGConnector(cbmod->getOutputPort(0));
-                               GConnectorController *tempp =
-                                               (GConnectorController*) _controllers[idCon];
-                               GConnectorModel *conMod = (GConnectorModel*) tempp->getModel();
-                               vtkGConnectorView *conView =
-                                               (vtkGConnectorView*) tempp->getView();
-                               tempp->endContourCreation();
-                               conMod->setEndPort(inputPortEnd);
-                               conView->updateStartEndPoints();
+               std::map<int,int> oldIdNewIdBoxes;
+               std::vector<int> connections;
+
+               std::map<int, GObjectController*>::iterator it;
+               for(it = objectsMap.begin(); it != objectsMap.end(); ++it)
+               {
+                       GObjectController *cont = it->second;
+                       int type = cont->getGObjectType();
 
+                       if(type==GBLACKBOX)
+                       {
+                               // Copy black box
+                               double xInic, yInic,zInic;
+                               GBlackBoxModel* copyBox = (GBlackBoxModel*)cont->getModel();
+                               copyBox->getInicPoint(xInic,yInic,zInic);
+                               int idBox = createGBlackBox(0,0,copyBox->getBBTKPackage(),copyBox->getBBTKType());
+
+                               int idcB = copyBox->getObjectId();
+                               oldIdNewIdBoxes[idcB]=idBox;
+                               cont = _controllers[idBox];
+                               GBlackBoxModel* newbox  = (GBlackBoxModel*)cont->getModel();
+                               newbox->setInicPoint(xInic,yInic,zInic);
+                               int num = newbox->getNumInputPorts();
+                               for(int j=0;j<num;j++)
+                               {
+                                       newbox->setValueToInputPort(j,copyBox->getValueInputPort(j));
+                               }
+                               newbox->notifyObservers(_idManager);
                        }
+                       else if(type==GCONNECTOR)
+                       {
+                               int idCon = cont->getId();
+                               connections.push_back(idCon);
+                       }
+
+               }
 
+               for(int i = 0 ;i<(int)connections.size();i++)
+               {
+                       int objId = connections[i];
+                       GObjectController *cont = objectsMap[objId];
+                       GConnectorModel* connectModel = (GConnectorModel*)cont->getModel();
+
+                       GPortModel* startPort = connectModel->getStartPort();
+                       int startPortIndex = startPort->getPosInBox();
+                       GPortModel* endPort = connectModel->getEndPort();
+                       int endPortIndex = endPort->getPosInBox();
+
+                       GBlackBoxModel* startPortParentBox = (GBlackBoxModel*)startPort->getParentBox();
+                       GBlackBoxModel* endPortParentBox = (GBlackBoxModel*)endPort->getParentBox();
+
+                       int idNewStartBox = oldIdNewIdBoxes[startPortParentBox->getObjectId()];
+                       int idNewEndBox = oldIdNewIdBoxes[endPortParentBox->getObjectId()];
+
+                       GBlackBoxModel* newStartBox = (GBlackBoxModel*)_controllers[idNewStartBox]->getModel();
+                       GBlackBoxModel* newEndBox = (GBlackBoxModel*)_controllers[idNewEndBox]->getModel();
+
+                       GPortModel* newStartPort = newStartBox->getOutputPort(startPortIndex);
+                       GPortModel* newEndPort = newEndBox->getInputPort(endPortIndex);
+
+                       // Creates connection
+                       int idCon = createGConnector(newStartPort);
+                       GConnectorController *tempp = (GConnectorController*)_controllers[idCon];
+                       GConnectorModel *conMod = (GConnectorModel*)tempp->getModel();
+                       vtkGConnectorView *conView = (vtkGConnectorView*)tempp->getView();
+                       tempp->endContourCreation();
+                       conMod->setEndPort(newEndPort);
+                       conView->updateStartEndPoints();
                }
 
-               for (int k = 0; k < (int) oldOutputConnections.size(); k++) {
-                       bool exist = false;
-                       //EED                           int toCreate=-1;
-                       for (int l = 0; l < (int) newOutputConnections.size() && !exist; l++) {
-                               if (oldOutputConnections[k] == newOutputConnections[l]) {
-                                       exist = true;
+               std::map<int, int>::iterator itIds;
+               for(itIds = oldIdNewIdBoxes.begin(); itIds != oldIdNewIdBoxes.end(); ++itIds)
+               {
+                       int idOld = itIds->first;
+                       int idNew = itIds->second;
+
+                       GBlackBoxModel* oldBox = (GBlackBoxModel*)objectsMap[idOld]->getModel();
+                       GBlackBoxModel* newBox = (GBlackBoxModel*)_controllers[idNew]->getModel();
+
+                       std::vector<int> oldInputConnections = oldBox->getConnectedInputs();
+                       std::vector<int> oldOutputConnections = oldBox->getConnectedOutputs();
+                       std::vector<int> newInputConnections = newBox->getConnectedInputs();
+                       std::vector<int> newOutputConnections = newBox->getConnectedOutputs();
+
+                       for(int k = 0; k<(int)oldInputConnections.size();k++)
+                       {
+                               bool exist=false;
+//EED                          int toCreate=-1;
+                               for(int l = 0; l<(int)newInputConnections.size() && !exist;l++)
+                               {
+                                       if(oldInputConnections[k]==newInputConnections[l])
+                                       {
+                                               exist=true;
+                                       }
                                }
-                       }
 
-                       if (exist == false) {
-                               //Create complex output
-                               int posInBox = oldOutputConnections[k];
-                               GPortModel* outputPort = oldBox->getOutputPort(posInBox);
-                               std::string outputPortName = outputPort->getBBTKName();
-                               int idOutputPort = createGComplexBoxOutputPort(outputPortName);
-                               GObjectController *cont = _controllers[idOutputPort];
-                               GBoxModel *cbmod = (GBoxModel*) cont->getModel();
-                               double xIn, yIn, zIn;
-                               outputPort->getInicPoint(xIn, yIn, zIn);
-                               yIn -= 20;
-                               cbmod->setInicPoint(xIn, yIn, zIn);
-                               cbmod->notifyObservers(_idManager);
-
-                               GPortModel* outputPortEnd = newBox->getOutputPort(posInBox);
-
-                               // Creates connection
-                               int idCon = createGConnector(outputPortEnd);
-                               GConnectorController *tempp =
-                                               (GConnectorController*) _controllers[idCon];
-                               GConnectorModel *conMod = (GConnectorModel*) tempp->getModel();
-                               vtkGConnectorView *conView =
-                                               (vtkGConnectorView*) tempp->getView();
-                               tempp->endContourCreation();
-                               conMod->setEndPort(cbmod->getInputPort(0));
-                               conView->updateStartEndPoints();
+                               if(exist==false)
+                               {
+                                       //Create complex input
+                                       int posInBox = oldInputConnections[k];
+                                       GPortModel* inputPort = oldBox->getInputPort(posInBox);
+                                       std::string inputPortName = inputPort->getBBTKName();
+                                       int idInputPort = createGComplexBoxInputPort(inputPortName);
+                                       GObjectController *cont = _controllers[idInputPort];
+                                       GBoxModel *cbmod = (GBoxModel*)cont->getModel();
+                                       double xIn,yIn,zIn;
+                                       inputPort->getInicPoint(xIn,yIn,zIn);
+                                       yIn+=20;
+                                       cbmod->setInicPoint(xIn,yIn,zIn);
+                                       cbmod->notifyObservers(_idManager);
+
+                                       GPortModel* inputPortEnd = newBox->getInputPort(posInBox);
+
+                                       // Creates connection
+                                       int idCon = createGConnector(cbmod->getOutputPort(0));
+                                       GConnectorController *tempp = (GConnectorController*)_controllers[idCon];
+                                       GConnectorModel *conMod = (GConnectorModel*)tempp->getModel();
+                                       vtkGConnectorView *conView = (vtkGConnectorView*)tempp->getView();
+                                       tempp->endContourCreation();
+                                       conMod->setEndPort(inputPortEnd);
+                                       conView->updateStartEndPoints();
+
+                               }
 
                        }
 
-               }
 
-       }
+                       for(int k = 0; k<(int)oldOutputConnections.size();k++)
+                       {
+                               bool exist=false;
+//EED                          int toCreate=-1;
+                               for(int l = 0; l<(int)newOutputConnections.size() && !exist;l++)
+                               {
+                                       if(oldOutputConnections[k]==newOutputConnections[l])
+                                       {
+                                               exist=true;
+                                       }
+                               }
 
-}
+                               if(exist==false)
+                               {
+                                       //Create complex output
+                                       int posInBox = oldOutputConnections[k];
+                                       GPortModel* outputPort = oldBox->getOutputPort(posInBox);
+                                       std::string outputPortName = outputPort->getBBTKName();
+                                       int idOutputPort = createGComplexBoxOutputPort(outputPortName);
+                                       GObjectController *cont = _controllers[idOutputPort];
+                                       GBoxModel *cbmod = (GBoxModel*)cont->getModel();
+                                       double xIn,yIn,zIn;
+                                       outputPort->getInicPoint(xIn,yIn,zIn);
+                                       yIn-=20;
+                                       cbmod->setInicPoint(xIn,yIn,zIn);
+                                       cbmod->notifyObservers(_idManager);
+
+                                       GPortModel* outputPortEnd = newBox->getOutputPort(posInBox);
+
+                                       // Creates connection
+                                       int idCon = createGConnector(outputPortEnd);
+                                       GConnectorController *tempp = (GConnectorController*)_controllers[idCon];
+                                       GConnectorModel *conMod = (GConnectorModel*)tempp->getModel();
+                                       vtkGConnectorView *conView = (vtkGConnectorView*)tempp->getView();
+                                       tempp->endContourCreation();
+                                       conMod->setEndPort(cbmod->getInputPort(0));
+                                       conView->updateStartEndPoints();
 
-//=========================================================================
-void wxVtkSceneManager::SetCbName(std::string cbName) {
-       _cbName = cbName;
-       if (_cbName == "") {
-               _cbName = "<complex box name>";
-       }
-}
-
-//=========================================================================
-std::string wxVtkSceneManager::GetCbName() {
-       return _cbName;
-}
-
-//=========================================================================
-void wxVtkSceneManager::SetCbPackageName(std::string packagename) {
-       _cbPackageName = packagename;
-       if (_cbPackageName == "") {
-               _cbPackageName = "<package name of the complex box>";
-       }
-}
-
-//=========================================================================
-std::string wxVtkSceneManager::GetCbPackageName() {
-       return _cbPackageName;
-}
-
-//=========================================================================
-void wxVtkSceneManager::SetAuthor(std::string author) {
-       _Author = author;
-       if (_Author == "") {
-               _Author = "<author of the box>";
-       }
-}
-
-//=========================================================================
-std::string wxVtkSceneManager::GetAuthor() {
-       return _Author;
-}
-
-//=========================================================================
-void wxVtkSceneManager::SetCategory(std::string category) {
-       _Category = category;
-       if (_Category == "") {
-               _Category = "<category of the box>";
-       }
-}
-
-//=========================================================================
-std::string wxVtkSceneManager::GetCategory() {
-       return _Category;
-}
-
-//=========================================================================
-void wxVtkSceneManager::SetDescription(std::string description) {
-       _Description = description;
-       if (_Description == "") {
-               _Description = "<description of the box>";
-       }
-}
+                               }
 
-//=========================================================================
-std::string wxVtkSceneManager::GetDescription() {
-       return _Description;
-}
+                       }
+
+               }
 
-//=========================================================================
 
+       }
+
+       //=========================================================================
 
-} // EO namespace bbtk
+}  // EO namespace bbtk
 
 // EOF
 
index 12c4fc4a31a3c9ff304dae64fc4b9709dbbd7808..3fd5a2764d053ae5691efd20171da84dadb392ee 100644 (file)
@@ -84,6 +84,7 @@ Version:   $Revision$
 #include <iostream>
 #include <map>
 
+
 namespace bbtk
 {
        class wxGEditorTabPanel;
@@ -160,15 +161,12 @@ namespace bbtk
                void addObjects(std::map<int,GObjectController*> objectsMap);
 
 
-               //-------
-               // Makes a BlackBox Executable
-               bool MakeBoxExecutable();//DFCH
                //-------
                //Returns a string with the BBS script of the current diagram.
                std::string getDiagramBBS(bool wln=false);
 
                //Returns a string with the BBS script of the complex box.
-               std::string saveComplexBoxBBS();
+               std::string saveComplexBoxBBS(std::string cbName,std::string cbAuthor="",std::string cbCategory="",std::string cbDescription="");
 
                //Delete the object in the list of controllers with the id given by parameter.
                void deleteObject(int id);
@@ -192,26 +190,9 @@ namespace bbtk
                std::string findANewNameForABox();
                //-------
 
-        void SetCbName(std::string cbNane);
-        void SetCbPackageName(std::string packagename);
-        void SetAuthor(std::string author);
-        void SetCategory(std::string category);
-        void SetDescription(std::string description);
-
-        std::string GetCbName();
-        std::string GetCbPackageName();
-        std::string GetAuthor();
-        std::string GetCategory();
-        std::string GetDescription();
 
        private:
 
-        std::string                         _cbName;
-        std::string                         _cbPackageName;
-        std::string                         _Author;
-        std::string                         _Category;
-        std::string                         _Description;
-
                //wxPanel that uses the manager
                wxGEditorTabPanel                                       *_parent;