]> Creatis software - bbtk.git/blobdiff - packages/wx/src/bbwxCommandButton.cxx
BUG static dll windows
[bbtk.git] / packages / wx / src / bbwxCommandButton.cxx
index b13d2426e5998f829cca4e09725336780dc62374..a52fd202adca0fa41b7f8c1842f24d75c0a16113 100644 (file)
@@ -3,14 +3,14 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxCommandButton.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/15 12:47:17 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/03/10 06:24:13 $
+  Version:   $Revision: 1.3 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 
   l'Image). All rights reserved. See Doc/License.txt or
   http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
                                                                                 
-     This software is distributed WITHOUT ANY WARRANTY; without even
+     This software is distributed WITHOUT ANY WARRANTY; without even 
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
      PURPOSE.  See the above copyright notices for more information.
                                                                                 
@@ -66,7 +66,26 @@ namespace bbwx
   
   void CommandButtonWidget::OnCommandButton( wxEvent& )
   {
-    std::string commandstr(mBox->bbGetInputIn());
+    // Look for the interpreter
+      bbtk::Interpreter* I = 0;
+      if (mBox->bbGetParent() != 0) 
+       {
+         bbtk::Factory* f = 
+           ((bbtk::ComplexBlackBoxDescriptor*)mBox->bbGetParent()
+            ->bbGetDescriptor())->GetFactory();
+         if ((f != 0)&&
+             (f->GetExecuter()))
+           {
+             I = f->GetExecuter()->GetInterpreter();
+           }
+       }
+      if (I==0) 
+       {
+         //      bbtkError("ExecBbiCommand::DoProcess() : could not find interpreter");
+         I = new bbtk::Interpreter();
+       }
+      
+      std::string commandstr(mBox->bbGetInputIn());
     
     // bbtk::Interpreter::mGlobalInterpreter->InterpretLine( commandstr );
     int i;
@@ -93,7 +112,7 @@ namespace bbwx
              }
          }             
        bool insideComment = false; // for multiline comment
-       bbtk::Interpreter::mGlobalInterpreter->InterpretLine( ccommand, insideComment );
+       I->InterpretLine( ccommand, insideComment );
        pos1=pos2+1;
        pos2 = commandstr.find(";",pos2+1);