From: guigues Date: Fri, 7 Mar 2008 11:37:48 +0000 (+0000) Subject: * Created an invisible frame child of WxConsole to be temporary parent of all widgets... X-Git-Tag: r0.6.1~136 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=6c61e1295d4bedbd7b5abdb256173a2d6df80423;p=bbtk.git * Created an invisible frame child of WxConsole to be temporary parent of all widgets (before Reparent by containing frame) * Adapted wx::CommandButton to work without global factory (same as ExecBbiCommand) * other minor changes --- diff --git a/kernel/appli/bbi/bbi.cxx b/kernel/appli/bbi/bbi.cxx index 56417d9..5404d6e 100644 --- a/kernel/appli/bbi/bbi.cxx +++ b/kernel/appli/bbi/bbi.cxx @@ -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); diff --git a/kernel/src/bbtkWxConsole.cxx b/kernel/src/bbtkWxConsole.cxx index c988e33..00267a9 100644 --- a/kernel/src/bbtkWxConsole.cxx +++ b/kernel/src/bbtkWxConsole.cxx @@ -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 diff --git a/kernel/src/bbtkWxConsole.h b/kernel/src/bbtkWxConsole.h index 7649c22..183c907 100644 --- a/kernel/src/bbtkWxConsole.h +++ b/kernel/src/bbtkWxConsole.h @@ -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 ); diff --git a/packages/wx/src/bbwxCommandButton.cxx b/packages/wx/src/bbwxCommandButton.cxx index b13d242..5c34cd5 100644 --- a/packages/wx/src/bbwxCommandButton.cxx +++ b/packages/wx/src/bbwxCommandButton.cxx @@ -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);