]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Mon, 15 Dec 2008 09:04:46 +0000 (09:04 +0000)
committerguigues <guigues>
Mon, 15 Dec 2008 09:04:46 +0000 (09:04 +0000)
kernel/src/bbtkBlackBoxOutputConnector.h
kernel/src/bbtkInterpreter.cxx
kernel/src/bbtkInterpreter.h
kernel/src/bbtkWxGUIScriptingInterface.cxx
kernel/src/bbtkWxGUIScriptingInterface.h
packages/demo/bbs/appli/demoFiltering1.bbs
packages/wxvtk/bbs/appli/wxvtkTour.bbs [new file with mode: 0644]

index 58d1c21404ddabb4b507b5d3aa9d6522c44af550..80559c20101c9570fbdea8a04e565b9049ac24f3 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBoxOutputConnector.h,v $
   Language:  C++
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBoxOutputConnector.h,v $
   Language:  C++
-  Date:      $Date: 2008/12/10 09:33:18 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2008/12/15 09:04:46 $
+  Version:   $Revision: 1.8 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -127,11 +127,9 @@ namespace bbtk
     ConnectionVector mConnection;
     /// The status of the output 
     IOStatus mStatus;
     ConnectionVector mConnection;
     /// The status of the output 
     IOStatus mStatus;
-
+    /// The output changed signal 
     BlackBox::OutputChangeSignalType mChangeSignal;
 
     BlackBox::OutputChangeSignalType mChangeSignal;
 
-    // The change time
-//    ChangeTime mChangeTime;
   };
   
 }
   };
   
 }
index 7356fd22d9f09f9321a445d86bbbd799815156b5..0bb789483e372f35b596a5e87f28c034a660770c 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $
   Language:  C++
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/12/12 12:56:28 $
-  Version:   $Revision: 1.80 $
+  Date:      $Date: 2008/12/15 09:04:47 $
+  Version:   $Revision: 1.81 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -142,6 +142,14 @@ namespace bbtk
     info.help = "Clears the currently defined complex box (deletes all its boxes and connections)";
     mCommandDict[info.keyword] = info;
 
     info.help = "Clears the currently defined complex box (deletes all its boxes and connections)";
     mCommandDict[info.keyword] = info;
 
+    info.keyword = "break";
+    info.argmin = 0;
+    info.argmax = 0;
+    info.code = cBreak;
+    info.syntax = "break";
+    info.help = "Breaks the current execution";
+    mCommandDict[info.keyword] = info;
+
     info.keyword = "newgui";
     info.argmin = 2;
     info.argmax = 2;
     info.keyword = "newgui";
     info.argmin = 2;
     info.argmax = 2;
@@ -382,7 +390,8 @@ namespace bbtk
   //=======================================================================
 
 
   //=======================================================================
 
 
-  InterpreterError::InterpreterError( const std::string& message,
+  //=======================================================================
+  InterpreterException::InterpreterException( const std::string& message,
                                      bool in_script_file,
                                      const std::string& script_file,
                                      int script_line 
                                      bool in_script_file,
                                      const std::string& script_file,
                                      int script_line 
@@ -393,7 +402,9 @@ namespace bbtk
       mScriptLine(script_line)
   {
   }
       mScriptLine(script_line)
   {
   }
-  InterpreterError::InterpreterError( const Exception& excep,
+  //=======================================================================
+  //=======================================================================
+  InterpreterException::InterpreterException( const Exception& excep,
                      bool in_script_file,
                      const std::string& script_file,
                      int script_line 
                      bool in_script_file,
                      const std::string& script_file,
                      int script_line 
@@ -405,12 +416,19 @@ namespace bbtk
   {
   }
   //=======================================================================
   {
   }
   //=======================================================================
-  void Interpreter::CatchInterpreterException( const InterpreterError& e )
+
+
+  //=======================================================================
+  void Interpreter::CatchInterpreterException( const InterpreterException& e )
   {
     if (mThrow) 
       {
   {
     if (mThrow) 
       {
-       CloseAllFiles();
-       throw InterpreterError(e);
+       if (e.GetErrorMessage()!="break")
+         {
+           mStatus = Interpreter_ERROR;               
+           CloseAllFiles();
+         }
+       throw InterpreterException(e);
       }
     else
       {
       }
     else
       {
@@ -421,6 +439,7 @@ namespace bbtk
            mess << "* FILE  : \""<<e.GetScriptFile()<<"\""<<std::endl;
            mess << "* LINE  : "<<e.GetScriptLine()<<std::endl;
          }
            mess << "* FILE  : \""<<e.GetScriptFile()<<"\""<<std::endl;
            mess << "* LINE  : "<<e.GetScriptLine()<<std::endl;
          }
+       CloseAllFiles();
        std::cerr << mess.str();
       }
   }
        std::cerr << mess.str();
       }
   }
@@ -429,6 +448,7 @@ namespace bbtk
   //=======================================================================
   void Interpreter::CatchBbtkException( const bbtk::Exception& e )
   {
   //=======================================================================
   void Interpreter::CatchBbtkException( const bbtk::Exception& e )
   {
+    mStatus = Interpreter_ERROR;              
     if (mThrow) 
       {
        bool in_script = false;
     if (mThrow) 
       {
        bool in_script = false;
@@ -440,8 +460,9 @@ namespace bbtk
          file = mFileName.back();
          line = mLine.back();
        }   
          file = mFileName.back();
          line = mLine.back();
        }   
-       CloseAllFiles();
-       throw InterpreterError(e,in_script,file,line);
+       if (e.GetErrorMessage()!="break")
+         CloseAllFiles();
+       throw InterpreterException(e,in_script,file,line);
       }
     else
       {
       }
     else
       {
@@ -451,6 +472,7 @@ namespace bbtk
          mess << "* FILE  : \""<<mFileName.back()<<"\""<<std::endl;
          mess << "* LINE  : "<<mLine.back()<<std::endl;
        }    
          mess << "* FILE  : \""<<mFileName.back()<<"\""<<std::endl;
          mess << "* LINE  : "<<mLine.back()<<std::endl;
        }    
+       CloseAllFiles();
        std::cerr << mess.str();
       }
   }
        std::cerr << mess.str();
       }
   }
@@ -459,6 +481,7 @@ namespace bbtk
   //=======================================================================
   void Interpreter::CatchStdException( const std::exception& e )
   {  
   //=======================================================================
   void Interpreter::CatchStdException( const std::exception& e )
   {  
+    mStatus = Interpreter_ERROR;              
     if (mThrow) 
       {
        bool in_script = false;
     if (mThrow) 
       {
        bool in_script = false;
@@ -471,7 +494,7 @@ namespace bbtk
          line = mLine.back();
        }    
        CloseAllFiles();
          line = mLine.back();
        }    
        CloseAllFiles();
-       throw InterpreterError(e.what(),in_script,file,line);
+       throw InterpreterException(e.what(),in_script,file,line);
       }
     else
       {
       }
     else
       {
@@ -481,6 +504,7 @@ namespace bbtk
          mess << "* FILE  : \""<<mFileName.back()<<"\""<<std::endl;
          mess << "* LINE  : "<<mLine.back()<<std::endl;
        }    
          mess << "* FILE  : \""<<mFileName.back()<<"\""<<std::endl;
          mess << "* LINE  : "<<mLine.back()<<std::endl;
        }    
+       CloseAllFiles();
        std::cerr << mess.str();
       }
   }
        std::cerr << mess.str();
       }
   }
@@ -489,6 +513,7 @@ namespace bbtk
   //=======================================================================
   void Interpreter::CatchUnknownException()
   {
   //=======================================================================
   void Interpreter::CatchUnknownException()
   {
+    mStatus = Interpreter_ERROR;              
     if (mThrow) 
       {
        bool in_script = false;
     if (mThrow) 
       {
        bool in_script = false;
@@ -501,7 +526,7 @@ namespace bbtk
          line = mLine.back();
        }    
        CloseAllFiles();
          line = mLine.back();
        }    
        CloseAllFiles();
-       throw InterpreterError("Unknown exception caught",
+       throw InterpreterException("Unknown exception caught",
                                   in_script,file,line);
       }
     else
                                   in_script,file,line);
       }
     else
@@ -513,46 +538,35 @@ namespace bbtk
          mess << "* FILE  : \""<<mFileName.back()<<"\""<<std::endl;
          mess << "* LINE  : "<<mLine.back()<<std::endl;
        }    
          mess << "* FILE  : \""<<mFileName.back()<<"\""<<std::endl;
          mess << "* LINE  : "<<mLine.back()<<std::endl;
        }    
+       CloseAllFiles();
        std::cerr << mess.str();
       }
   }
   //=======================================================================
 
   //=======================================================================
        std::cerr << mess.str();
       }
   }
   //=======================================================================
 
   //=======================================================================
-
-#define CATCH_MACRO                            \
-  catch (QuitException e)                      \
-    {                                          \
-      status = Interpreter_QUIT;               \
-      if (mThrow) throw QuitException();       \
-    }                                          \
-  catch (InterpreterError e)                   \
-    {                                          \
-      status = Interpreter_ERROR;              \
+  
+#define CATCH_MACRO                                    \
+  catch (InterpreterException e)                       \
+    {                                                  \
       CatchInterpreterException(e);                    \
       CatchInterpreterException(e);                    \
-    }                                          \
-  catch (bbtk::Exception e)                    \
-    {                                          \
-      status = Interpreter_ERROR;              \
-      CatchBbtkException(e);                   \
-    }                                          \
-  catch (std::exception& e)                    \
-    {                                          \
-      status = Interpreter_ERROR;              \
-      CatchStdException(e);                    \
-    }                                          \
-  catch (...)                                  \
-    {                                          \
-      status = Interpreter_ERROR;              \
-      CatchUnknownException();                 \
+    }                                                  \
+  catch (bbtk::Exception e)                            \
+    {                                                  \
+      CatchBbtkException(e);                           \
+    }                                                  \
+  catch (std::exception& e)                            \
+    {                                                  \
+      CatchStdException(e);                            \
+    }                                                  \
+  catch (...)                                          \
+    {                                                  \
+      CatchUnknownException();                         \
     }                                          
   //=======================================================================
    
 
   //=======================================================================
     }                                          
   //=======================================================================
    
 
   //=======================================================================
-  /**
-   *  
-   */
   Interpreter::ExitStatus Interpreter::InterpretFile( const std::string& filename, bool source )
   {
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretFile(\""<<filename<<"\")"<<std::endl);
   Interpreter::ExitStatus Interpreter::InterpretFile( const std::string& filename, bool source )
   {
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretFile(\""<<filename<<"\")"<<std::endl);
@@ -560,52 +574,28 @@ namespace bbtk
     bool exm = mCommandLine;
     mCommandLine = false;
 
     bool exm = mCommandLine;
     mCommandLine = false;
 
-    ExitStatus status = Interpreter_OK;
-
     try 
     {
     try 
     {
+      mStatus = Interpreter_OK;
       SwitchToFile(filename,source);
       SwitchToFile(filename,source);
-
-      bool insideComment = false; // for multiline comment
-      while (mFile.size()>0) 
-      {
-       while (!mFile.back()->eof()) {
-         mLine.back()++;
-         char buf[500];
-         mFile.back()->getline(buf,500);
-         std::string str(buf);
-         int size=str.length();
-         if ( str[ size-1 ]==13  )
-            {
-             str.erase(size-1,1);
-            }
-         try
-           {
-             InterpretLine(str, insideComment);
-           }
-         CATCH_MACRO;
-         
-       }//while !eof
-       CloseCurrentFile();
-      }//while >0
-    } // try
+      mInsideComment = false;
+      InterpretCurrentStreams();
+    } 
     CATCH_MACRO;
     
     CATCH_MACRO;
     
-    CloseAllFiles();
-    bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretFile(\""<<filename<<"\")"<<std::endl);
+    bbtkDebugMessage("Interpreter",9,
+                    "EO Interpreter::InterpretFile(\""
+                    <<filename<<"\")"<<std::endl);
     bbtkDecTab("Interpreter",9);
 
     mCommandLine = exm;
     
     bbtkDecTab("Interpreter",9);
 
     mCommandLine = exm;
     
-    return status;
+    return mStatus;
   }
   //=======================================================================
 
 
   //=======================================================================
   }
   //=======================================================================
 
 
   //=======================================================================
-  /**
-   *  
-   */
   Interpreter::ExitStatus 
   Interpreter::InterpretBuffer( std::stringstream* buffer )
   {
   Interpreter::ExitStatus 
   Interpreter::InterpretBuffer( std::stringstream* buffer )
   {
@@ -614,13 +604,32 @@ namespace bbtk
     bool exm = mCommandLine;
     mCommandLine = false;
 
     bool exm = mCommandLine;
     mCommandLine = false;
 
-    ExitStatus status = Interpreter_OK;
-
     try 
     {
     try 
     {
+      mStatus = Interpreter_OK;
       SwitchToStream(buffer);
       SwitchToStream(buffer);
-      bool insideComment = false; // for multiline comment
-      while (mFile.size()>0) 
+      mInsideComment = false;
+      InterpretCurrentStreams();
+    }
+    CATCH_MACRO;
+    
+    //    CloseAllFiles();
+    bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretBuffer()"<<std::endl);
+    bbtkDecTab("Interpreter",9);
+    
+    mCommandLine = exm;
+    return mStatus;
+  }
+  //=======================================================================
+
+  //=======================================================================
+  /// Interprets the currently open streams
+  Interpreter::ExitStatus Interpreter::InterpretCurrentStreams()
+  {
+    bbtkDebugMessageInc("Interpreter",9,
+                       "Interpreter::InterpretCurrentStreams()"<<std::endl);
+
+    while (mFile.size()>0) 
       {
        while (!mFile.back()->eof()) {
          mLine.back()++;
       {
        while (!mFile.back()->eof()) {
          mLine.back()++;
@@ -635,21 +644,13 @@ namespace bbtk
             }
          try
            {
             }
          try
            {
-             InterpretLine(str, insideComment);
+             DoInterpretLine(str);
            }
          CATCH_MACRO;
            }
          CATCH_MACRO;
-       }//while
+       } 
        CloseCurrentFile();
       }
        CloseCurrentFile();
       }
-    }
-    CATCH_MACRO;
-    
-    CloseAllFiles();
-    bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretBuffer()"<<std::endl);
-    bbtkDecTab("Interpreter",9);
-    
-    mCommandLine = exm;
-    return status;
+    return mStatus;
   }
   //=======================================================================
 
   }
   //=======================================================================
 
@@ -659,32 +660,29 @@ namespace bbtk
   {
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretLine('"<<line<<"')"<<std::endl);
 
   {
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretLine('"<<line<<"')"<<std::endl);
 
-    ExitStatus status = Interpreter_OK;
-
     try 
     {
     try 
     {
-      bool insideComment = false;
-      InterpretLine(line, insideComment);
+      mStatus = Interpreter_OK;
+      mInsideComment = false;
+      DoInterpretLine(line );
     }
     CATCH_MACRO;
     }
     CATCH_MACRO;
-  
-
+    
+    
     bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretLine()"
                     <<std::endl);
     bbtkDecTab("Interpreter",9);
     
     bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretLine()"
                     <<std::endl);
     bbtkDecTab("Interpreter",9);
     
-    return status;
+    return mStatus;
   }
   }
+  //=======================================================================  
   
 
   //=======================================================================  
   
 
   //=======================================================================  
-  /**
-   *
-   */
-void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
-{
-    bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretLine(\""<<line<<"\")"<<std::endl);
-
+  void Interpreter::DoInterpretLine( const std::string& line )
+  {
+    bbtkDebugMessageInc("Interpreter",9,"Interpreter::DoInterpretLine(\""<<line<<"\")"<<std::endl);
+    
     std::vector<std::string> words;
     SplitLine(line,words);
 
     std::vector<std::string> words;
     SplitLine(line,words);
 
@@ -709,7 +707,7 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
     {  
        bbtkDebugDecTab("Interpreter",9);
        bbtkMessage("Interpreter",9,"In multiline comment"<<std::endl);
     {  
        bbtkDebugDecTab("Interpreter",9);
        bbtkMessage("Interpreter",9,"In multiline comment"<<std::endl);
-       insideComment = true;
+       mInsideComment = true;
        return;
     }
 
        return;
     }
 
@@ -717,15 +715,15 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
     {  
        bbtkDebugDecTab("Interpreter",9);
        bbtkMessage("Interpreter",9,"Out multiline comment"<<std::endl);
     {  
        bbtkDebugDecTab("Interpreter",9);
        bbtkMessage("Interpreter",9,"Out multiline comment"<<std::endl);
-       if ( !insideComment ) {
+       if ( !mInsideComment ) {
           bbtkDebugDecTab("Interpreter",9);
           bbtkMessage("Interpreter",9,"Comment mismatch : '*/' with no matching '/*'"<<std::endl);       
        }
           bbtkDebugDecTab("Interpreter",9);
           bbtkMessage("Interpreter",9,"Comment mismatch : '*/' with no matching '/*'"<<std::endl);       
        }
-       insideComment = false;
+       mInsideComment = false;
        return;
     }
 
        return;
     }
 
-    if (insideComment) 
+    if (mInsideComment) 
     {  
        bbtkDebugDecTab("Interpreter",9);
        bbtkMessage("Interpreter",9,"Multiline Comment"<<std::endl);
     {  
        bbtkDebugDecTab("Interpreter",9);
        bbtkMessage("Interpreter",9,"Multiline Comment"<<std::endl);
@@ -742,6 +740,8 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
     int level=0;
     std::string left,right,left2,right2;
     std::string filename;
     int level=0;
     std::string left,right,left2,right2;
     std::string filename;
+
+    // message command
     if (command.code==cMessage)
       {
        if (words.size()<3)
     if (command.code==cMessage)
       {
        if (words.size()<3)
@@ -753,17 +753,48 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
            sscanf(words[2].c_str(),"%d",&level);
            mVirtualExecuter->SetMessageLevel(words[1],level);
          }
            sscanf(words[2].c_str(),"%d",&level);
            mVirtualExecuter->SetMessageLevel(words[1],level);
          }
+       return;
       }
     else 
       {
        bbtkMessage("echo",2,line<<std::endl);
       }
 
       }
     else 
       {
        bbtkMessage("echo",2,line<<std::endl);
       }
 
+    // break and quit commands
+    if ((command.code==cBreak) || (command.code==cQuit))
+      {
+       bool in_script = false;
+       std::string file("");
+       int line = 0;
+       if (mFileName.size()) 
+         {
+           std::ifstream* fs = dynamic_cast<std::ifstream*>(mFile.back());
+           if (fs!=0) in_script = true;          
+           file = mFileName.back();
+           line = mLine.back();
+         } 
+       if (command.code==cBreak)
+         {
+           /*
+           std::cout << "BreakException(" 
+                     <<in_script<<","
+                     <<file<<","
+                     <<line<<")"<<std::endl;
+           */
+           bbtkError("break");//,in_script,file,line);
+           //      throw BreakException(in_script,file,line);
+         }       
+       else 
+         {
+           bbtkError("quit");//,in_script,file,line);
+             //throw QuitException(in_script,file,line);
+         }
+       return;
+      }   
+
+    // other cammands
     switch (command.code) 
     switch (command.code) 
-    {
-      case cMessage : 
-      
-        break;
+      {
       case cNew :
         mVirtualExecuter->Create(words[1],words[2]);
         break;
       case cNew :
         mVirtualExecuter->Create(words[1],words[2]);
         break;
@@ -892,8 +923,8 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
       case cReset :  
        Reset();
         break;
       case cReset :  
        Reset();
         break;
-
-     case cClear :  
+       
+      case cClear :  
        mVirtualExecuter->Clear();
         break;
 
        mVirtualExecuter->Clear();
         break;
 
@@ -918,10 +949,6 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
         GetExecuter()->UnLoadPackage(words[1]);
         break;
 
         GetExecuter()->UnLoadPackage(words[1]);
         break;
 
-      case cQuit :
-        throw QuitException();
-        break;
-
       case cDebug :
        if (words.size()==2) Debug(words[1]);
        else Debug("");
       case cDebug :
        if (words.size()==2) Debug(words[1]);
        else Debug("");
@@ -952,10 +979,7 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
 
 
   //=======================================================================
 
 
   //=======================================================================
-  /**
-   *
-   */
-void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>& tokens)
+  void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>& tokens)
 {
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::SplitLine(\""<<str<<"\")"<<std::endl);
 
 {
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::SplitLine(\""<<str<<"\")"<<std::endl);
 
@@ -992,7 +1016,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
   void Interpreter::Reset()
   {
     // Cannot close all files if the reset command is read from a file !
   void Interpreter::Reset()
   {
     // Cannot close all files if the reset command is read from a file !
-    //    CloseAllFiles();
+    CloseAllFiles();
     mFileNameHistory.clear();
     this->mVirtualExecuter->Reset();
   }
     mFileNameHistory.clear();
     this->mVirtualExecuter->Reset();
   }
@@ -1416,11 +1440,9 @@ void Interpreter::SwitchToStream( std::stringstream* stream )
 
        return;
   }
 
        return;
   }
+  //=======================================================================
 
   //=======================================================================
 
   //=======================================================================
-  /**
-   *  
-   */
   void Interpreter::CloseCurrentFile()
   {
     bbtkDebugMessage("Interpreter",9,"Interpreter::CloseCurrentFile()"
   void Interpreter::CloseCurrentFile()
   {
     bbtkDebugMessage("Interpreter",9,"Interpreter::CloseCurrentFile()"
@@ -1452,9 +1474,6 @@ void Interpreter::SwitchToStream( std::stringstream* stream )
   //=======================================================================
 
  //=======================================================================
   //=======================================================================
 
  //=======================================================================
-  /**
-   *  
-   */
   void Interpreter::CloseAllFiles()
   {
     bbtkDebugMessage("Interpreter",9,"Interpreter::CloseAllFiles()"
   void Interpreter::CloseAllFiles()
   {
     bbtkDebugMessage("Interpreter",9,"Interpreter::CloseAllFiles()"
@@ -1472,9 +1491,6 @@ void Interpreter::SwitchToStream( std::stringstream* stream )
 
 
   //=======================================================================
 
 
   //=======================================================================
-  /**
-   *  
-   */
   void Interpreter::InterpretCommand( const std::vector<std::string>& words,
                                       CommandInfoType& info )
   {
   void Interpreter::InterpretCommand( const std::vector<std::string>& words,
                                       CommandInfoType& info )
   {
@@ -1905,20 +1921,23 @@ void Interpreter::Help(const std::vector<std::string>& words)
     
     mCommandLine = true;
     bool again = true;
     
     mCommandLine = true;
     bool again = true;
-    bool insideComment = false; // for multiline comment  
+    // bool insideComment = false; // for multiline comment  
+    mInsideComment = false;
     do 
     {
       try
       {
         std::string line;
         GetLineFromPrompt(line);
     do 
     {
       try
       {
         std::string line;
         GetLineFromPrompt(line);
-        InterpretLine(line, insideComment);
+        DoInterpretLine(line); //, insideComment);
       }
       }
+      /*
       catch (QuitException e)
       {
        bbtkMessage("Interpreter",1,"Interpreter : Quit"<<std::endl);
         again = false;
       }
       catch (QuitException e)
       {
        bbtkMessage("Interpreter",1,"Interpreter : Quit"<<std::endl);
         again = false;
       }
+      */
       catch (bbtk::Exception e) 
       {
         e.Print();
       catch (bbtk::Exception e) 
       {
         e.Print();
@@ -2198,6 +2217,17 @@ void  Interpreter::NewGUI(const std::string& boxname,
       }
   }
  //==========================================================================
       }
   }
  //==========================================================================
+
+  /*
+  //==========================================================================
+  // Adds a callback when 'break' command issued
+  void Interpreter::AddBreakObserver( BreakCallbackType c )
+  {
+    mBreakSignal.connect(c);
+  }
+ //==========================================================================
+ */
+
  //==========================================================================
   std::string Interpreter::GetObjectName() const
   {
  //==========================================================================
   std::string Interpreter::GetObjectName() const
   {
index 490882733c83f4f9ac3b6ed7ac9f9123d4597ca4..96fe7dc56e41c58e48347e185891b1956753f96f 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.h,v $
   Language:  C++
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.h,v $
   Language:  C++
-  Date:      $Date: 2008/12/12 12:11:21 $
-  Version:   $Revision: 1.38 $
+  Date:      $Date: 2008/12/15 09:04:47 $
+  Version:   $Revision: 1.39 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
 #include <fstream>
 #include <deque>
 
 #include <fstream>
 #include <deque>
 
+// Signal/slot mechanism for 'break' commands
+//#include <boost/signal.hpp>
+//#include <boost/bind.hpp>
+
 namespace bbtk
 {
 
 namespace bbtk
 {
 
@@ -70,20 +74,20 @@ namespace bbtk
 
 
   //=======================================================================
 
 
   //=======================================================================
-  class BBTK_EXPORT InterpreterError : public Exception
+  class BBTK_EXPORT InterpreterException : public Exception
   {
   public:
   {
   public:
-    InterpreterError( const std::string& message,
+    InterpreterException( const std::string& message,
                      bool in_script_file,
                      const std::string& script_file,
                      int script_line 
                      );
                      bool in_script_file,
                      const std::string& script_file,
                      int script_line 
                      );
-    InterpreterError( const Exception& excep,
+    InterpreterException( const Exception& excep,
                      bool in_script_file,
                      const std::string& script_file,
                      int script_line 
                      );
                      bool in_script_file,
                      const std::string& script_file,
                      int script_line 
                      );
-    ~InterpreterError() throw() {}
+    ~InterpreterException() throw() {}
 
     bool IsInScriptFile() const { return mInScriptFile; }
     const std::string& GetScriptFile() const { return mScriptFile; }
 
     bool IsInScriptFile() const { return mInScriptFile; }
     const std::string& GetScriptFile() const { return mScriptFile; }
@@ -95,6 +99,37 @@ namespace bbtk
   };
   //=======================================================================
 
   };
   //=======================================================================
 
+  /*
+  //=======================================================================
+  // The "Quit" exception
+  class BBTK_EXPORT QuitException : public InterpreterError
+  {
+  public:
+    QuitException( bool in_script_file,
+                  const std::string& script_file,
+                  int script_line 
+                  )
+      : InterpreterError("QUIT",in_script_file,script_file,script_line) 
+    {}
+    ~QuitException() throw() {}
+  };
+  //=======================================================================
+  const std::string BREAK("BREAK");
+  //=======================================================================
+  // The "Break" exception
+  class BBTK_EXPORT BreakException : public InterpreterError
+  {
+  public:
+    BreakException( bool in_script_file,
+                   std::string script_file,
+                   int script_line 
+                   )
+      : InterpreterError(BREAK,in_script_file,script_file,script_line) 
+    { std::cout << "BUILDING BREAK"<<std::endl; }
+    ~BreakException() throw() {}
+  };
+  //=======================================================================
+  */
 
   //=======================================================================
   class BBTK_EXPORT Interpreter : public Object
 
   //=======================================================================
   class BBTK_EXPORT Interpreter : public Object
@@ -109,7 +144,8 @@ namespace bbtk
       {
        Interpreter_OK,
        Interpreter_ERROR,
       {
        Interpreter_OK,
        Interpreter_ERROR,
-       Interpreter_QUIT
+       Interpreter_QUIT,
+       Interpreter_BREAK,
       }
       ExitStatus;
 
       }
       ExitStatus;
 
@@ -122,6 +158,8 @@ namespace bbtk
     /// Runs the interpretation of a command
     ExitStatus InterpretLine( const std::string& line );
 
     /// Runs the interpretation of a command
     ExitStatus InterpretLine( const std::string& line );
 
+    /// Runs the interpretation of the currently open streams
+    ExitStatus InterpretCurrentStreams();
 
     /// Launches a command line interpreter (with a prompt)
     void CommandLineInterpreter();
 
     /// Launches a command line interpreter (with a prompt)
     void CommandLineInterpreter();
@@ -164,13 +202,23 @@ namespace bbtk
     /// Gets the Executer 
     VirtualExec::Pointer GetExecuter() const { return mVirtualExecuter; }
 
     /// Gets the Executer 
     VirtualExec::Pointer GetExecuter() const { return mVirtualExecuter; }
 
+    /*
+    // For 'break' commands observation
+    typedef boost::signals::trackable BreakObserverType;
+    typedef boost::signal<void ()>  BreakSignalType;
+    typedef BreakSignalType::slot_function_type BreakCallbackType;
+  
+    // Adds a callback when 'break' command issued
+    void AddBreakObserver( BreakCallbackType );
+    */
 
   protected:
 
     /// The enumeration of command codes == Command name
     typedef enum
     {
 
   protected:
 
     /// The enumeration of command codes == Command name
     typedef enum
     {
-      cClear,
+      cBreak, // LG 12/12/08 : Stops the current script execution (if not exec frozen) - used in tutorial + debugging 
+      cClear, // LG 12/12/08 : Clears the current complex black box (e.g. workspace) - used in tours
       cNew,
       cDelete,
       cConnect,
       cNew,
       cDelete,
       cConnect,
@@ -217,7 +265,7 @@ namespace bbtk
 
 
     /// Interprets a line 
 
 
     /// Interprets a line 
-    void InterpretLine( const std::string& line, bool &insideComment );
+    void DoInterpretLine( const std::string& line ); //, bool &insideComment );
 
     /// Reads a line from prompt
     void GetLineFromPrompt( std::string& line );
 
     /// Reads a line from prompt
     void GetLineFromPrompt( std::string& line );
@@ -279,6 +327,7 @@ namespace bbtk
 
     void Debug(const std::string& arg);
 
 
     void Debug(const std::string& arg);
 
   private:
 
     /// Constructor
   private:
 
     /// Constructor
@@ -294,7 +343,7 @@ namespace bbtk
                     std::string includeScriptName);
 
     /// 
                     std::string includeScriptName);
 
     /// 
-    void CatchInterpreterException( const InterpreterError& e );
+    void CatchInterpreterException( const InterpreterException& e );
     void CatchBbtkException( const bbtk::Exception& e );
     void CatchStdException( const std::exception& e );
     void CatchUnknownException();
     void CatchBbtkException( const bbtk::Exception& e );
     void CatchStdException( const std::exception& e );
     void CatchUnknownException();
@@ -334,25 +383,29 @@ namespace bbtk
     /// Are we in a command line context ?
     bool mCommandLine;
 
     /// Are we in a command line context ?
     bool mCommandLine;
 
+    /// Are we inside a commented-out zone ?
+    bool mInsideComment;
+    
+    /// The current interpreter status
+    ExitStatus mStatus;
+
     /// The history of commands
     std::deque< char* > mHistory;
 
     /// The history of commands
     std::deque< char* > mHistory;
 
-   int bufferNb;
+    int bufferNb;
     
     bool mThrow;
 
     
     bool mThrow;
 
-       protected:
-       ~Interpreter();
+    /// The break signal
+    //    BreakSignalType mBreakSignal;
+
+  protected:
+    ~Interpreter();
 
   };
   // EO class Interpreter
 
 
 
   };
   // EO class Interpreter
 
 
-  // The "Quit" exception
-  struct QuitException : public bbtk::Exception
-  {
-    QuitException() : bbtk::Exception("Interpreter","","Quit") {}
-  };
 
 }
 #endif
 
 }
 #endif
index 245e1f2a927ebfcb3258f1c350b2090e3b66b68f..966c1f70486f924d6c5f3eb88e6b00215d0f4322 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $
   Language:  C++
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/10/21 14:38:31 $
-  Version:   $Revision: 1.31 $
+  Date:      $Date: 2008/12/15 09:04:47 $
+  Version:   $Revision: 1.32 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -95,7 +95,8 @@ namespace bbtk
     mInterpreter->SetUser(this);
     mInterpreter->SetCommandLine(true);
     mInterpreter->SetThrow(true);
     mInterpreter->SetUser(this);
     mInterpreter->SetCommandLine(true);
     mInterpreter->SetThrow(true);
-    
+    //    mInterpreter->AddBreakObserver
+    //boost::bind( &WxGUIScriptingInterface::InterpreterUserOnBreak, this ));
     //==============
     // Menu
     wxInitAllImageHandlers();
     //==============
     // Menu
     wxInitAllImageHandlers();
@@ -260,7 +261,8 @@ namespace bbtk
     m_mgr.Update();
     //   LoadPerspective();
 
     m_mgr.Update();
     //   LoadPerspective();
 
-
+    mBreaked = false;  
+    
     wxTipWindow* tip = new wxTipWindow(this,
                                       _T("\n                  Welcome to bbStudio !\n\n   To run a demo or example:\n     1. click on the 'Demos' or 'Examples' link\n     2. select a demo or example\n     3. click on the '[source]' link : the source file is loaded in bbStudio\n     4. click on the 'Run' button (the arrow at the bottom right of the source file)   \n"),1000);
     tip->CenterOnParent();
     wxTipWindow* tip = new wxTipWindow(this,
                                       _T("\n                  Welcome to bbStudio !\n\n   To run a demo or example:\n     1. click on the 'Demos' or 'Examples' link\n     2. select a demo or example\n     3. click on the '[source]' link : the source file is loaded in bbStudio\n     4. click on the 'Run' button (the arrow at the bottom right of the source file)   \n"),1000);
     tip->CenterOnParent();
@@ -282,24 +284,54 @@ namespace bbtk
     mWxGUITextEditor->Open(filename);
   }
   //================================================================
     mWxGUITextEditor->Open(filename);
   }
   //================================================================
-  
-#define CATCH_MACRO                                                    \
-  catch (QuitException e)                                              \
+  /*
+  catch (BreakException e)                                             \
     {                                                                  \
     {                                                                  \
-      std::cout << "* quit exception caught"<<std::endl;               \
+      std::cout << "* BREAK"<<std::endl;                               \
+      if (e.IsInScriptFile())                                          \
+       std::cout << "* FILE   : '"<<e.GetScriptFile()<<"'"<<std::endl; \
+      std::cout << "* LINE   : "<<e.GetScriptLine()<<std::endl;                \
     }                                                                  \
     }                                                                  \
-  catch (InterpreterError e)                                           \
+  catch (QuitException e)                                              \
     {                                                                  \
     {                                                                  \
-      std::cerr << "* IERROR : "<<e.GetErrorMessage()<<std::endl;              \
+      std::cout << "* QUIT"<<std::endl;                                        \
       if (e.IsInScriptFile())                                          \
       if (e.IsInScriptFile())                                          \
-       std::cerr << "* FILE   : '"<<e.GetScriptFile()<<"'"<<std::endl; \
-      std::cerr << "* LINE   : "<<e.GetScriptLine()<<std::endl;                \
-      int lev = bbtk::MessageManager::GetMessageLevel("Error");                \
-      if (lev > 0) {                                                   \
-       std::cerr << "* Exception thrown : "<<std::endl;                \
-       std::cerr << "*  OBJECT : " <<e.GetObject()<<std::endl;         \
-       std::cerr << "*  FILE   : " <<e.GetSourceFile()<<std::endl;     \
-      }                                                                        \
+       std::cout << "* FILE   : '"<<e.GetScriptFile()<<"'"<<std::endl; \
+      std::cout << "* LINE   : "<<e.GetScriptLine()<<std::endl;                \
+    }                                                                  \
+*/
+  
+#define CATCH_MACRO                                                    \
+  catch (InterpreterException e)                                       \
+    {                                                                  \
+      if (e.GetErrorMessage()=="quit")                                 \
+       {                                                               \
+         std::cerr << "* QUIT ENCOUNTERED"<<std::endl;                 \
+         if (e.IsInScriptFile())                                       \
+           std::cerr << "* FILE   : '"<<e.GetScriptFile()<<"'"<<std::endl; \
+         std::cerr << "* LINE   : "<<e.GetScriptLine()<<std::endl;     \
+       }                                                               \
+      else if (e.GetErrorMessage()=="break")                           \
+       {                                                               \
+         mBreaked = true;                                              \
+         std::cerr << "* BREAK"<<std::endl;                            \
+         if (e.IsInScriptFile())                                       \
+           std::cerr << "* FILE   : '"<<e.GetScriptFile()<<"'"<<std::endl; \
+         std::cerr << "* LINE   : "<<e.GetScriptLine()<<std::endl;     \
+       }                                                               \
+      else                                                             \
+       {                                                               \
+         std::cerr << "* ERROR : "<<e.GetErrorMessage()<<std::endl;    \
+         if (e.IsInScriptFile())                                       \
+           std::cerr << "* FILE   : '"<<e.GetScriptFile()<<"'"<<std::endl; \
+         std::cerr << "* LINE   : "<<e.GetScriptLine()<<std::endl;     \
+         int lev = bbtk::MessageManager::GetMessageLevel("Error");     \
+         if (lev > 0) {                                                \
+           std::cerr << "* Exception thrown : "<<std::endl;            \
+           std::cerr << "*  OBJECT : " <<e.GetObject()<<std::endl;     \
+           std::cerr << "*  FILE   : " <<e.GetSourceFile()<<std::endl; \
+         }                                                             \
+       }                                                               \
     }
   
   //================================================================
     }
   
   //================================================================
@@ -338,9 +370,16 @@ namespace bbtk
     (*buf) << mWxGUITextEditor->GetCurrentPage()->GetText();
     try 
       {
     (*buf) << mWxGUITextEditor->GetCurrentPage()->GetText();
     try 
       {
-       //      std::cout << "RUN"<<std::endl;
-       if (mwxMenuItemReset->IsChecked()) WxGUICommandEnter("reset");
-       mInterpreter->InterpretBuffer(buf);
+       if (!mBreaked)
+         {
+           if (mwxMenuItemReset->IsChecked()) WxGUICommandEnter("reset");
+           mInterpreter->InterpretBuffer(buf);
+         }
+       else 
+         {
+           mBreaked = false;
+           mInterpreter->InterpretCurrentStreams();
+         }
        //      std::cout << "EO RUN"<<std::endl;
       }
     CATCH_MACRO;
        //      std::cout << "EO RUN"<<std::endl;
       }
     CATCH_MACRO;
@@ -609,6 +648,16 @@ namespace bbtk
   } 
   //================================================================  
   
   } 
   //================================================================  
   
+  /*
+  //================================================================
+  void WxGUIScriptingInterface::InterpreterUserOnBreak()
+  {
+    //    std::cout << "Break" << std::endl;
+    
+  }
+  //================================================================
+  */
+
   //================================================================  
   bool WxGUIScriptingInterface::WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target)
   {
   //================================================================  
   bool WxGUIScriptingInterface::WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target)
   {
index adb07731110be6b505884940aace96aed7662a3f..eae05453b058be794984701f0d86c2d1a7233fd4 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIScriptingInterface.h,v $
   Language:  C++
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIScriptingInterface.h,v $
   Language:  C++
-  Date:      $Date: 2008/10/17 08:18:15 $
-  Version:   $Revision: 1.14 $
+  Date:      $Date: 2008/12/15 09:04:47 $
+  Version:   $Revision: 1.15 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -130,6 +130,7 @@ namespace bbtk
     // Interpreter callbacks
     bool InterpreterUserHasOwnHtmlPageViewer() { return true; }
     void InterpreterUserViewHtmlPage(const std::string&);
     // Interpreter callbacks
     bool InterpreterUserHasOwnHtmlPageViewer() { return true; }
     void InterpreterUserViewHtmlPage(const std::string&);
+    //    void InterpreterUserOnBreak();
 
     // WxGUICommand callbacks
     void WxGUICommandEnter(const std::string&);
 
     // WxGUICommand callbacks
     void WxGUICommandEnter(const std::string&);
@@ -163,6 +164,8 @@ namespace bbtk
     wxMenuItem* mwxMenuItemReset;
     //    wxButton* mwxButtonRun;
 
     wxMenuItem* mwxMenuItemReset;
     //    wxButton* mwxButtonRun;
 
+    bool mBreaked;
+
   public:
          
  
   public:
          
  
index 3da9435a9ba1f759b32343b6093883ff98b21909..1be94e23bf1d2608ee6e6c422f347ec3867c482c 100644 (file)
@@ -43,7 +43,7 @@ new Div div2
 // ----------------------
 
 new LayoutSplit mainSplit
 // ----------------------
 
 new LayoutSplit mainSplit
-  set mainSplit.Proportion 50
+  set mainSplit.Proportion 60
   set mainSplit.WinHeight  1000
   set mainSplit.WinWidth   1400
   set mainSplit.WinTitle "Processing / Viewing example (demoFiltering1.bbs) "
   set mainSplit.WinHeight  1000
   set mainSplit.WinWidth   1400
   set mainSplit.WinTitle "Processing / Viewing example (demoFiltering1.bbs) "
@@ -63,45 +63,48 @@ new LayoutSplit mainSplit
 
                  new Slider sliceSlider
                     set sliceSlider.Title "Slice"
 
                  new Slider sliceSlider
                     set sliceSlider.Title "Slice"
+                    set sliceSlider.ReactiveOnTrack true
                    connect sliceSlider.Widget sliderLayout.Widget1
                    
                  new Slider lowerThresholdSlider
                     set lowerThresholdSlider.Title "LowerThreshold"
                    connect sliceSlider.Widget sliderLayout.Widget1
                    
                  new Slider lowerThresholdSlider
                     set lowerThresholdSlider.Title "LowerThreshold"
-                    set lowerThresholdSlider.Max       50
-                    set lowerThresholdSlider.In        20
+                    set lowerThresholdSlider.Max       200
+                    set lowerThresholdSlider.In        10
                     set lowerThresholdSlider.ChangeResolution 1
                    connect lowerThresholdSlider.Widget sliderLayout.Widget2
                
                  new Slider upperThresholdSlider
                     set upperThresholdSlider.Title "UpperThreshold"
                     set upperThresholdSlider.Max       500
                     set lowerThresholdSlider.ChangeResolution 1
                    connect lowerThresholdSlider.Widget sliderLayout.Widget2
                
                  new Slider upperThresholdSlider
                     set upperThresholdSlider.Title "UpperThreshold"
                     set upperThresholdSlider.Max       500
-                    set upperThresholdSlider.In        500
+                    set upperThresholdSlider.In        150
                     set upperThresholdSlider.ChangeResolution 1     
                    connect upperThresholdSlider.Widget sliderLayout.Widget3
 
                  new Slider smoothSlider
                     set smoothSlider.Title "Smooth"
                     set smoothSlider.Max       10
                     set upperThresholdSlider.ChangeResolution 1     
                    connect upperThresholdSlider.Widget sliderLayout.Widget3
 
                  new Slider smoothSlider
                     set smoothSlider.Title "Smooth"
                     set smoothSlider.Max       10
-                    set smoothSlider.In        1
+                    set smoothSlider.In        3
                     set smoothSlider.ChangeResolution 1
                    connect  smoothSlider.Widget sliderLayout.Widget4
                                                                              
            new LayoutLine buttonLayout
                     set smoothSlider.ChangeResolution 1
                    connect  smoothSlider.Widget sliderLayout.Widget4
                                                                              
            new LayoutLine buttonLayout
-              set buttonLayout.Orientation V         
+              set buttonLayout.Orientation H         
              connect buttonLayout.Widget toolLayout.Widget2
              
              connect buttonLayout.Widget toolLayout.Widget2
              
+              new ColourSelectorButton colourThreshold  
+                 set colourThreshold.In "1 0 0"              
+                connect colourThreshold.Widget buttonLayout.Widget1
+
               new ColourSelectorButton colourSmooth
                  set colourSmooth.In "1 1 0"
               new ColourSelectorButton colourSmooth
                  set colourSmooth.In "1 1 0"
-                connect colourSmooth.Widget buttonLayout.Widget1                
+                connect colourSmooth.Widget buttonLayout.Widget2                
    
    
-              new ColourSelectorButton colourThreshold  
-                 set colourThreshold.In "1 0 0"              
-                connect colourThreshold.Widget buttonLayout.Widget2
-                
+
+/*              
               new CommandButton refresh
                  set refresh.Label "Refresh (to be used once at start time)"
                 connect refresh.Widget buttonLayout.Widget3
               new CommandButton refresh
                  set refresh.Label "Refresh (to be used once at start time)"
                 connect refresh.Widget buttonLayout.Widget3
-                                               
+*/                                             
       new LayoutLine layout2D
          set layout2D.Orientation H
          connect layout2D.Widget splitUp.Widget2
       new LayoutLine layout2D
          set layout2D.Orientation H
          connect layout2D.Widget splitUp.Widget2
@@ -138,7 +141,7 @@ new LayoutSplit mainSplit
               set lowerOpacitySlider.Title "Opacity"
               set lowerOpacitySlider.Min       1  
               set lowerOpacitySlider.Max       100
               set lowerOpacitySlider.Title "Opacity"
               set lowerOpacitySlider.Min       1  
               set lowerOpacitySlider.Max       100
-              set lowerOpacitySlider.In        20
+              set lowerOpacitySlider.In        50
               set lowerOpacitySlider.Orientation V
              connect lowerOpacitySlider.Widget vSliderLayout.Widget1
 
               set lowerOpacitySlider.Orientation V
              connect lowerOpacitySlider.Widget vSliderLayout.Widget1
 
@@ -190,6 +193,13 @@ new ImageGaussianSmooth smooth
   connect smooth.Out            viewer2DImageSmooth.In
   connect sliceSlider.Out       viewer2DImageSmooth.Slice
  
   connect smooth.Out            viewer2DImageSmooth.In
   connect sliceSlider.Out       viewer2DImageSmooth.Slice
  
+
+// Planes
+new ImagePlanes planes
+  connect reader.Out planes.In
+  connect planes.PlaneX viewer3DSurfaceSmooth.Obs1
+  connect planes.PlaneY viewer3DSurfaceSmooth.Obs2
+  connect planes.PlaneZ viewer3DSurfaceSmooth.Obs3
  
 // Surfaces 3D 
  
  
 // Surfaces 3D 
  
@@ -215,27 +225,35 @@ new IsoSurfaceExtractor  isoextractorSmooth
 
  new MultipleInputs multInForImageOriginal
   connect sliceSlider.BoxChange multInForImageOriginal.In1  
 
  new MultipleInputs multInForImageOriginal
   connect sliceSlider.BoxChange multInForImageOriginal.In1  
-  connect refresh.BoxChange     multInForImageOriginal.In2
-  
+#  connect refresh.BoxChange     multInForImageOriginal.In2
+
+
  new MultipleInputs multInForImageSegmented
   connect lowerThresholdSlider.BoxChange multInForImageSegmented.In1
   connect upperThresholdSlider.BoxChange multInForImageSegmented.In2
  new MultipleInputs multInForImageSegmented
   connect lowerThresholdSlider.BoxChange multInForImageSegmented.In1
   connect upperThresholdSlider.BoxChange multInForImageSegmented.In2
-  connect refresh.BoxChange              multInForImageSegmented.In3
+#  connect refresh.BoxChange              multInForImageSegmented.In3
+  connect sliceSlider.BoxChange  multInForImageSegmented.In4    
     
  new MultipleInputs multInForImageSmooth
   connect lowerThresholdSlider.BoxChange multInForImageSmooth.In1
   connect upperThresholdSlider.BoxChange multInForImageSmooth.In2 
   connect smoothSlider.BoxChange         multInForImageSmooth.In3
     
  new MultipleInputs multInForImageSmooth
   connect lowerThresholdSlider.BoxChange multInForImageSmooth.In1
   connect upperThresholdSlider.BoxChange multInForImageSmooth.In2 
   connect smoothSlider.BoxChange         multInForImageSmooth.In3
-  connect lowerOpacitySlider.BoxChange   multInForImageSmooth.In4  
-  connect refresh.BoxChange              multInForImageSmooth.In5
+#  connect refresh.BoxChange              multInForImageSmooth.In4
+  connect sliceSlider.BoxChange multInForImageSmooth.In5
 
  new MultipleInputs multInForSurfaceThreshold
 
  new MultipleInputs multInForSurfaceThreshold
-  connect refresh.BoxChange multInForSurfaceThreshold.In1
+#  connect refresh.BoxChange multInForSurfaceThreshold.In1
   connect colourThreshold.BoxChange multInForSurfaceThreshold.In2
   connect colourThreshold.BoxChange multInForSurfaceThreshold.In2
+  connect lowerThresholdSlider.BoxChange multInForSurfaceThreshold.In3
+  connect upperThresholdSlider.BoxChange multInForSurfaceThreshold.In4 
 
  new MultipleInputs multInForSurfaceSmooth
 
  new MultipleInputs multInForSurfaceSmooth
-  connect refresh.BoxChange multInForSurfaceSmooth.In1  
+#  connect refresh.BoxChange multInForSurfaceSmooth.In1  
+  connect lowerOpacitySlider.BoxChange multInForSurfaceSmooth.In1  
   connect colourSmooth.BoxChange multInForSurfaceSmooth.In2
   connect colourSmooth.BoxChange multInForSurfaceSmooth.In2
+  connect lowerThresholdSlider.BoxChange multInForSurfaceSmooth.In3
+  connect upperThresholdSlider.BoxChange multInForSurfaceSmooth.In4 
+  connect smoothSlider.BoxChange         multInForSurfaceSmooth.In5
     
   connect multInForImageOriginal.BoxChange     viewer2DImageOriginal.BoxExecute  
   connect multInForImageSegmented.BoxChange    viewer2DImageSegmented.BoxExecute
     
   connect multInForImageOriginal.BoxChange     viewer2DImageOriginal.BoxExecute  
   connect multInForImageSegmented.BoxChange    viewer2DImageSegmented.BoxExecute
diff --git a/packages/wxvtk/bbs/appli/wxvtkTour.bbs b/packages/wxvtk/bbs/appli/wxvtkTour.bbs
new file mode 100644 (file)
index 0000000..a33286d
--- /dev/null
@@ -0,0 +1,65 @@
+description "A tour of wxvtk boxes"
+author "laurent.guigues@creatis.insa-lyon.fr"
+category "demo"
+
+# put all include before or will be within echo 2 and generate many messages...
+include wxvtk
+include vtk
+include std
+
+# To avoid getting textual help
+message Help 0
+
+#==================================================================
+print " "
+print "====================================="
+print "A simple 2D viewer"
+print "====================================="
+help Viewer2D
+message echo 2
+
+new LoadHola image
+new Viewer2D viewer
+connect image.Out viewer.In
+set viewer.Slice 20
+set viewer.WinDialog true
+exec viewer
+
+message echo 0
+clear
+print " "
+print "====================================="
+print "A simple 2D slicer"
+print "====================================="
+help SimpleSlicer
+message echo 2
+
+new LoadHola image
+new SimpleSlicer viewer
+connect image.Out viewer.In
+set viewer.WinDialog true
+exec viewer
+
+message echo 0
+clear
+print " "
+print "====================================="
+print "A double 2D slicer"
+print "====================================="
+help DoubleSlicer
+message echo 2
+
+new LoadHola image
+new DoubleSlicer viewer 
+connect image.Out viewer.In1
+connect image.Out viewer.In2
+set viewer.WinDialog true
+exec viewer
+
+
+message echo 0
+clear
+print " "
+print "====================================="
+print " END OF TOUR"
+print "====================================="