]> Creatis software - bbtk.git/commitdiff
* Created an invisible frame child of WxConsole to be temporary parent of all widgets...
authorguigues <guigues>
Fri, 7 Mar 2008 11:37:48 +0000 (11:37 +0000)
committerguigues <guigues>
Fri, 7 Mar 2008 11:37:48 +0000 (11:37 +0000)
* Adapted wx::CommandButton to work without global factory (same as ExecBbiCommand)
* other minor changes

kernel/appli/bbi/bbi.cxx
kernel/src/bbtkWxConsole.cxx
kernel/src/bbtkWxConsole.h
packages/wx/src/bbwxCommandButton.cxx

index 56417d9f5458215456e7b6fcdfd8dae3e869fdbd..5404d6ed728a4ba44742118a2cb544df780288f8 100644 (file)
@@ -128,7 +128,7 @@ bool wxBBIApp::OnInit( )
   if (debug) bbtk::MessageManager::SetMessageLevel("All",9);
   
 
-  bbtk::WxConsole *I = new bbtk::WxConsole(0,_T("bbi"),wxSize(600,400));
+  bbtk::WxConsole *I = new bbtk::WxConsole(0,_T("bbi"),wxSize(800,600));
   SetTopWindow(I);  
   if (!no_command) I->Show(true);
 
index c988e33380d4eef8d10883dee5a0a7f6d03d3ab4..00267a92dff8b0f3d0f29f332a2d1f104ad26745 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxConsole.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/03/07 08:40:14 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2008/03/07 11:37:48 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -40,7 +40,7 @@
 namespace bbtk
 {
 
-  WxConsole* WxConsole::mInstance = 0;
+
 // On Windows when compiling a dll, wx prevents the compilation
 // of the class wxStreamToTextRedirector (why ? it is a nightmare...)
 // The blocking symbol is wxHAS_TEXT_WINDOW_STREAM.
@@ -159,7 +159,7 @@ namespace bbtk
   WxConsole::WxConsole( wxWindow *parent, wxString title, wxSize size)
     : wxFrame((wxFrame *)parent, -1, title, wxDefaultPosition, size)
   {    
-    mInstance = this;
+   
     mInterpreter = new bbtk::Interpreter();
     mInterpreter->SetWxConsole(this);
     mInterpreter->SetCommandLine(true);
@@ -330,7 +330,8 @@ namespace bbtk
       new WxTextCtrlStreamRedirector(std::cerr,mwxTextHistory,*wxGREEN,true); 
         
     // Sets the console as the parent window of all bbtk windows
-    Wx::SetTopWindow(this);
+    wxFrame* top = new wxFrame(this,-1,_T("invisible"));
+    Wx::SetTopWindow(top);
 
 
     // Layout
index 7649c2205a549db2e8ed072660c3e0711578099d..183c9073e20709ae213d5d2c3c9d8bb226e60e71 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxConsole.h,v $
   Language:  C++
-  Date:      $Date: 2008/03/07 08:40:14 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2008/03/07 11:37:48 $
+  Version:   $Revision: 1.7 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -115,7 +115,7 @@ namespace bbtk
     WxTextCtrlStreamRedirector* mRedirect_cout;
     WxTextCtrlStreamRedirector* mRedirect_cerr;
     WxBrowser* mwxHtmlWindow;
-    static WxConsole* mInstance;
+    // static WxConsole* mInstance;
     
     wxPanel*   CreateBtnsCtrlPanel(wxWindow *parent);
     void               CommandString(wxString line );
index b13d2426e5998f829cca4e09725336780dc62374..5c34cd5d140154c7f819001c750832345d833744 100644 (file)
@@ -3,8 +3,8 @@
   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/07 11:37:48 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 
   l'Image). All rights reserved. See Doc/License.txt or
@@ -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);