* Adapted wx::CommandButton to work without global factory (same as ExecBbiCommand)
* other minor changes
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);
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
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.
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);
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
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
WxTextCtrlStreamRedirector* mRedirect_cout;
WxTextCtrlStreamRedirector* mRedirect_cerr;
WxBrowser* mwxHtmlWindow;
- static WxConsole* mInstance;
+ // static WxConsole* mInstance;
wxPanel* CreateBtnsCtrlPanel(wxWindow *parent);
void CommandString(wxString line );
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
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;
}
}
bool insideComment = false; // for multiline comment
- bbtk::Interpreter::mGlobalInterpreter->InterpretLine( ccommand, insideComment );
+ I->InterpretLine( ccommand, insideComment );
pos1=pos2+1;
pos2 = commandstr.find(";",pos2+1);