From 51a96595b724eba747e60bc98251886d049c68b6 Mon Sep 17 00:00:00 2001 From: guigues Date: Fri, 21 Mar 2008 11:46:41 +0000 Subject: [PATCH] *** empty log message *** --- kernel/src/bbtkWxEditor.cxx | 530 --------------- kernel/src/bbtkWxGUIScriptingInterface.cxx | 419 ++++++++++++ kernel/src/bbtkWxGUIScriptingInterface.h | 137 ++++ kernel/src/bbtkWxGUITextEditor.cxx | 604 ++++++++++++++++++ .../{bbtkWxEditor.h => bbtkWxGUITextEditor.h} | 82 +-- 5 files changed, 1205 insertions(+), 567 deletions(-) delete mode 100644 kernel/src/bbtkWxEditor.cxx create mode 100644 kernel/src/bbtkWxGUIScriptingInterface.cxx create mode 100644 kernel/src/bbtkWxGUIScriptingInterface.h create mode 100644 kernel/src/bbtkWxGUITextEditor.cxx rename kernel/src/{bbtkWxEditor.h => bbtkWxGUITextEditor.h} (59%) diff --git a/kernel/src/bbtkWxEditor.cxx b/kernel/src/bbtkWxEditor.cxx deleted file mode 100644 index 138155a..0000000 --- a/kernel/src/bbtkWxEditor.cxx +++ /dev/null @@ -1,530 +0,0 @@ -/*========================================================================= - - Program: bbtk - Module: $RCSfile: bbtkWxEditor.cxx,v $ - Language: C++ - Date: $Date: 2008/03/20 11:04:57 $ - 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 - http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details. - - 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. - -=========================================================================*//** - * \brief Short description in one line - * - * Long description which - * can span multiple lines - */ -/** - * \file - * \brief - */ -/** - * \class bbtk:: - * \brief - */ - - -#ifdef _USE_WXWIDGETS_ - -#include -#include "bbtkWxEditor.h" -#include "bbtkWxBlackBox.h" -#include "bbtkConfigurationFile.h" -#include "bbtkWxStreamRedirector.h" - - - #include "icons/cc_new.xpm" - #include "icons/cc_open.xpm" - #include "icons/cc_save.xpm" - #include "icons/cc_run.xpm" - #include "icons/cc_exit.xpm" -// #include "icons/copy.xpm" -// #include "icons/cut.xpm" -// #include "icons/preview.xpm" // paste XPM -// #include "icons/print.xpm" -// #include "icons/help.xpm" - - - -namespace bbtk -{ - - - //================================================================ - class WxTextCtrlGettingKeyEvents : public wxTextCtrl - { - public: - WxTextCtrlGettingKeyEvents(wxWindow *parent, wxWindowID id, const wxString &value, - const wxPoint &pos, const wxSize &size, int style = 0) - : wxTextCtrl(parent, id, value, pos, size, style) - { - } - - void SetWxEditor(WxEditor* e) { mWxEditor = e; } - - void OnKeyDown(wxKeyEvent& event); - void OnKeyUp(wxKeyEvent& event); - void OnChar(wxKeyEvent& event); - private : - WxEditor* mWxEditor; - - DECLARE_EVENT_TABLE() - }; - - BEGIN_EVENT_TABLE(WxTextCtrlGettingKeyEvents, wxTextCtrl) - EVT_KEY_DOWN(WxTextCtrlGettingKeyEvents::OnKeyDown) - EVT_KEY_UP(WxTextCtrlGettingKeyEvents::OnKeyUp) - EVT_CHAR(WxTextCtrlGettingKeyEvents::OnChar) - - END_EVENT_TABLE() - - - void WxTextCtrlGettingKeyEvents::OnChar(wxKeyEvent& event) - { - event.Skip(); - } - - void WxTextCtrlGettingKeyEvents::OnKeyUp(wxKeyEvent& event) - { - mWxEditor->OnKeyUp(event); - event.Skip(); - } - - void WxTextCtrlGettingKeyEvents::OnKeyDown(wxKeyEvent& event) - { - mWxEditor->OnKeyDown(event); - event.Skip(); - } - //================================================================ - - - - - //================================================================ - WxEditor::WxEditor( wxWindow *parent ) - : wxPanel(parent, -1) - { - mInterpreter = new bbtk::Interpreter(); - //mInterpreter->SetWxEditor(this); - mInterpreter->SetCommandLine(true); - - //============== - // Menu - wxInitAllImageHandlers(); - - /* - wxMenu *menuFile = new wxMenu; - menuFile->Append( ID_Menu_Quit, _T("&Quit") ); - - wxMenu *menuAbout = new wxMenu; - menuAbout->Append( ID_Menu_About, _T("&About...") ); - - wxMenu *menuTools = new wxMenu; - menuTools->Append( ID_Menu_EditConfig, _T("&Edit bbtk config") ); - menuTools->Append( ID_Menu_CreatePackage, _T("Create &package") ); - menuTools->Append( ID_Menu_CreateBlackBox, _T("Create &blackbox") ); - menuTools->Append( ID_Menu_ShowImageGraph, _T("&Show last image graph") ); - menuTools->Append( ID_Menu_CreateIndex, _T("&Generate index") ); - - - wxMenuBar *menuBar = new wxMenuBar; - menuBar->Append( menuFile, _T("&File") ); - menuBar->Append( menuTools, _T("&Tools") ); - menuBar->Append( menuAbout, _T("About") ); - - SetMenuBar( menuBar ); - - CreateStatusBar(); - SetStatusText( _T("Welcome to bbi !") ); - */ - - // wxFlexGridSizer *sizer= new wxFlexGridSizer(2); - wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - mwxSplit = new wxSplitterWindow(this, - -1, - wxDefaultPosition, - wxDefaultSize, - //wxSize(400,200), - wxSP_3D | - wxSP_LIVE_UPDATE ); - mwxInputText = - new WxTextCtrlGettingKeyEvents(mwxSplit, - ID_InputText, - _T(""), - wxDefaultPosition, - wxDefaultSize, - wxTE_MULTILINE - // |wxTE_PROCESS_ENTER - | wxTE_PROCESS_TAB - // | wxWANTS_CHARS - | wxTAB_TRAVERSAL - ); - mwxInputText->SetWxEditor(this); - - wxFont* FixedFont = new wxFont(10, - wxFONTFAMILY_MODERN, - wxFONTSTYLE_NORMAL, - wxFONTWEIGHT_NORMAL, - false); - - mwxInputTextAttr = new wxTextAttr; - mwxInputTextAttr->SetFont(*FixedFont); - - // sizer->AddGrowableCol(0); - // sizer->Add(mwxInputText,1,wxGROW); - - mwxOutputText = - new WxTextCtrlGettingKeyEvents(mwxSplit, - ID_OutputText, - _T(""),wxDefaultPosition, - wxDefaultSize, //HistorySize, - wxTE_READONLY | - wxTE_MULTILINE ); - - mwxOutputText->SetWxEditor(this); - - mwxOutputTextAttr = new wxTextAttr; - mwxOutputTextAttr->SetFont(*FixedFont); - mwxOutputText->Hide(); - - // sizer->Add(mwxOutputText,1,wxGROW); - sizer->Add(mwxSplit,1,wxGROW); - mwxSplit->Initialize(mwxInputText); - - // BUTTONS - wxPanel *btnsCtrlPanel = new wxPanel(this,-1); - wxBoxSizer *btnsSizer = new wxBoxSizer(wxHORIZONTAL); - - wxBitmap bmp_new(cc_new_xpm); - mwxButtonNew = new wxBitmapButton( btnsCtrlPanel,ID_ButtonNew,bmp_new);//_T("New") ); - btnsSizer->Add( mwxButtonNew ); - wxBitmap bmp_open(cc_open_xpm); - mwxButtonOpen = new wxBitmapButton( btnsCtrlPanel,ID_ButtonOpen,bmp_open);//,_T("Open") ); - btnsSizer->Add( mwxButtonOpen ); - wxBitmap bmp_save(cc_save_xpm); - mwxButtonSave = new wxBitmapButton( btnsCtrlPanel,ID_ButtonSave,bmp_save);//_T("Save") ); - btnsSizer->Add( mwxButtonSave ); - wxBitmap bmp_run(cc_run_xpm); - mwxButtonRun = new wxBitmapButton( btnsCtrlPanel,ID_ButtonRun,bmp_run);//_T("Run") ); - btnsSizer->Add( mwxButtonRun ); - wxBitmap bmp_quit(cc_exit_xpm); - mwxButtonQuit = new wxBitmapButton( btnsCtrlPanel,ID_ButtonQuit,bmp_quit);//_T("Quit") ); - btnsSizer->Add( mwxButtonQuit ); - - - mwxPosition = new wxStaticText ( btnsCtrlPanel, -1, _T("")); - btnsSizer->Add( mwxPosition ); - - - btnsCtrlPanel->SetSizer(btnsSizer); - sizer->Add ( btnsCtrlPanel, 0, wxLEFT | wxRIGHT | wxBOTTOM //| wxGROW - , 10 ); - - // Redirection of std::cout and std::cerr to mwxOutputText and printf - mRedirect_cout = - new WxStreamRedirector(std::cout,mwxOutputText,*wxBLACK,true); - mRedirect_cerr = - new WxStreamRedirector(std::cerr,mwxOutputText,*wxGREEN,true); - - UpdatePosition(); - mwxInputText->SetFocus(); - - SetSizer(sizer); - SetAutoLayout(true); - Layout(); - } - //================================================================ - - //================================================================ - WxEditor::~WxEditor() - { - delete mInterpreter; - delete mRedirect_cout; - delete mRedirect_cerr; - } - //================================================================ - - - //================================================================ - void WxEditor::OnButtonOpen(wxCommandEvent& event) - { - Open(); - mwxInputText->SetFocus(); - } - void WxEditor::Open() - { - std::cout << "-------------- OPEN ---------------"<ShowModal(); - - if (fd->GetReturnCode()==wxID_OK) - { - std::cout << "file [" << wx2std(fd->GetPath()) << "]" <LoadFile(fd->GetPath()); - } - else - { - std::cout << "-------------- CANCELLED ---------------"<LoadFile(std2wx(filename)); - mwxInputText->SetModified(false); - UpdatePosition(); - } - //================================================================ - - //================================================================ - void WxEditor::OnButtonSave(wxCommandEvent& event) - { - Save(); - mwxInputText->SetFocus(); - } - void WxEditor::Save() - { - std::cout << "-------------- SAVE ---------------"<ShowModal(); - - if (fd->GetReturnCode()==wxID_OK) - { - std::cout << "file [" << wx2std(fd->GetPath()) << "]" <SaveFile(fd->GetPath()); - mwxInputText->SetModified(false); - } - else - { - std::cout << "-------------- CANCELLED ---------------"<SetFocus(); - } - void WxEditor::Quit() - { - std::cout << "-------------- QUIT ---------------"<Close(); - } - //================================================================ - - - //================================================================ - void WxEditor::OnButtonRun(wxCommandEvent& event) - { - Run(); - mwxInputText->SetFocus(); - } - void WxEditor::Run() - { - std::cout << "-------------- RUN ---------------"<IsSplit()) - { - int size = -100; - int minsize = - (int)(mwxInputText->GetSize().GetHeight() / 2.); - if (sizeSplitHorizontally( mwxInputText, mwxOutputText, size); - } - - std::stringstream* buffer = new std::stringstream(bbtk::wx2std(mwxInputText->GetValue())); - mInterpreter->InterpretLine("reset"); - try - { - mInterpreter->InterpretBuffer(buffer); - } - catch (...) - { - } - } - //================================================================ - - //================================================================ - bool WxEditor::AskSave() - { - if (!mwxInputText->IsModified()) return true; - wxMessageDialog* d = new wxMessageDialog(this, - _T("Buffer modified. Save it ?"), - _T("Save buffer"), - wxYES_NO | wxCANCEL | wxICON_QUESTION); - switch (d->ShowModal()) - { - case wxID_YES : Save(); - case wxID_NO : return true; - case wxID_CANCEL : return false; - } - } - - - //================================================================ - - //================================================================ - void WxEditor::OnButtonNew(wxCommandEvent& event) - { - New(); - mwxInputText->SetFocus(); - } - void WxEditor::New() - { - std::cout << "-------------- NEW ---------------" << std::endl; - AskSave(); - mwxInputText->Clear(); - UpdatePosition(); - } - //================================================================ - - //================================================================ - void WxEditor::UpdatePosition() - { - - long line, column, pos; - pos = mwxInputText->GetInsertionPoint(); - mwxInputText->PositionToXY(pos, &column, &line); - - - // wxLogMessage(_T("Current position: %ld\nCurrent line, column: (%ld, %ld)\nNumber of lines: %ld\nCurrent line length: %ld\nTotal text length: %u (%ld)"), - - - char mess[200]; - sprintf(mess,"%ld:%ld/%ld:%ld", - line+1,column+1, - (long)mwxInputText->GetNumberOfLines(), - (long)mwxInputText->GetLineLength(line)+1); - // pos+1, - // (long)mwxInputText->GetValue().length())+1; - - mwxPosition->SetLabel(std2wx(mess)); - mwxPosition->Show(); - - } - //================================================================ - //================================================================ - void WxEditor::OnKeyUp(wxKeyEvent& event) - { - // std::cout << "U" << std::endl; - UpdatePosition(); - } - //================================================================ - - //================================================================ - void WxEditor::OnKeyDown(wxKeyEvent& event) - { - // std::cout << "D" << std::endl; - // std::cout << "Key="< commands; - wxString sline( wx2std ( mwxTextCommand->GetValue() ) ); - int ind = sline.size(); - mInterpreter->FindCommandsWithPrefix( sline.c_str(),ind,commands); - if (commands.size()==1) - { - std::string com = *commands.begin(); - for (; indTextAppend( std2wx ( com[ind]) ); - } - mwxTextCommand->TextAppend(_T(" ")); - } - else if (commands.size()>1) - { - std::vector::iterator i; - write(1,"\n",1); - for (i=commands.begin();i!=commands.end();++i) - { - write(STDOUT_FILENO,(*i).c_str(),strlen((*i).c_str())); - PrintChar(' '); - } - write(STDOUT_FILENO,"\n> ",3); - //for (int j=0;jAdd(mEditor,1,wxGROW); - - WxGUICommand* com = new WxGUICommand(this,this); - sizer->Add(com); - - SetSizer(sizer); - - // Creates and sets the parent window of all bbtk windows - wxWindow* top = new wxPanel(this,-1); - top->Hide(); - - Wx::SetTopWindow(top); - - SetAutoLayout(true); - Layout(); - } - - WxEditorWindow::~WxEditorWindow() - { - } -} // namespace bbtk - - -#endif //_USE_WXWIDGETS_ diff --git a/kernel/src/bbtkWxGUIScriptingInterface.cxx b/kernel/src/bbtkWxGUIScriptingInterface.cxx new file mode 100644 index 0000000..9952d89 --- /dev/null +++ b/kernel/src/bbtkWxGUIScriptingInterface.cxx @@ -0,0 +1,419 @@ +/*========================================================================= + + Program: bbtk + Module: $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $ + Language: C++ + Date: $Date: 2008/03/21 11:46:41 $ + Version: $Revision: 1.1 $ + + 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 + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*//** + * \brief Short description in one line + * + * Long description which + * can span multiple lines + */ +/** + * \file + * \brief + */ +/** + * \class bbtk:: + * \brief + */ + + +#ifdef _USE_WXWIDGETS_ + +#include +#include "bbtkWxGUIScriptingInterface.h" +#include "bbtkWxBlackBox.h" +#include "bbtkConfigurationFile.h" +#include "bbtkWxStreamRedirector.h" + + +#include "icons/cc_run.xpm" + +namespace bbtk +{ + + enum + { + ID_Menu_Quit = 1, + ID_Menu_About, + ID_Menu_EditConfig, + ID_Menu_CreatePackage, + ID_Menu_CreateBlackBox, + ID_Menu_ShowImageGraph, + ID_Menu_CreateIndex, + ID_Button_Run + }; + + + //================================================================ + WxGUIScriptingInterface::WxGUIScriptingInterface( wxWindow *parent, wxString title, wxSize size) + : wxFrame((wxFrame *)parent, -1, title, wxDefaultPosition, size) + { +// m_mgr = new wxAuiManager(this); + m_mgr.SetManagedWindow(this); + + mInterpreter = new bbtk::Interpreter(); + mInterpreter->SetUser(this); + mInterpreter->SetCommandLine(true); + //============== + // Menu + wxInitAllImageHandlers(); + + wxMenu *menuFile = new wxMenu; + menuFile->Append( ID_Menu_Quit, _T("&Quit") ); + + wxMenu *menuAbout = new wxMenu; + menuAbout->Append( ID_Menu_About, _T("&About...") ); + + wxMenu *menuTools = new wxMenu; + menuTools->Append( ID_Menu_EditConfig, _T("&Edit bbtk config") ); + menuTools->Append( ID_Menu_CreatePackage, _T("Create &package") ); + menuTools->Append( ID_Menu_CreateBlackBox, _T("Create &blackbox") ); + menuTools->Append( ID_Menu_ShowImageGraph, _T("&Show last image graph") ); + menuTools->Append( ID_Menu_CreateIndex, _T("&Generate index") ); + + + wxMenuBar *menuBar = new wxMenuBar; + menuBar->Append( menuFile, _T("&File") ); + menuBar->Append( menuTools, _T("&Tools") ); + menuBar->Append( menuAbout, _T("About") ); + + SetMenuBar( menuBar ); + + CreateStatusBar(); + SetStatusText( _T("Welcome to bbi !") ); + + + /* + m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). + Name(wxT("test4")).Caption(wxT("Pane Caption")). + Left()); + */ + + //============== + // Notebook + + // wxFlexGridSizer *sizer = new wxFlexGridSizer(1); + +//EED wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); +// mwxNotebook = new wxNotebook(this,-1,wxDefaultPosition, wxDefaultSize, 0); +/* + mwxNotebook = new wxAuiNotebook(this, + -1, + wxPoint(0, 0), + wxSize(500,500), + wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER); + + mwxPageCommand = new wxPanel(mwxNotebook,-1); + mwxPageHelp = new wxPanel(mwxNotebook,-1); + + + wxBoxSizer *cmdsizer = new wxBoxSizer(wxVERTICAL); + + mwxPageCommand->SetAutoLayout(true); + mwxPageCommand->SetSizer(cmdsizer); + cmdsizer->Fit(mwxPageCommand); + cmdsizer->SetSizeHints(mwxPageCommand); + + wxBoxSizer *helpsizer = new wxBoxSizer(wxVERTICAL); + + mwxPageHelp->SetAutoLayout(true); + mwxPageHelp->SetSizer(helpsizer); + helpsizer->Fit(mwxPageHelp); + helpsizer->SetSizeHints(mwxPageHelp); +*/ + mWxGUITextEditor = new WxGUITextEditor(this); + mWxGUITextEditor->SetFileNameFilter("*.bbs"); + + mWxGUIHtmlBrowser = new WxGUIHtmlBrowser(this, //mwxPageHelp, + //EED wxSize(1200,0)); + wxSize(200,0)); + + // mWxGUIHtmlBrowser->SetSize(wxSize(800,1000)); + // helpsizer->Add (mWxGUIHtmlBrowser,1, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5 ); + // helpsizer->Add ( new wxButton(mwxPageHelp,-1,"perro"), 0, wxEXPAND ); + + wxBitmap bmp_run(cc_run_xpm); + mwxButtonRun = new wxBitmapButton( this, ID_Button_Run,bmp_run);//_T("Run") ); + // helpsizer->Add( mwxButtonRun, 0, wxALL, 5 ); + + + //============== + // Command page + mWxGUIOutputMessages = new WxGUIOutputMessages(this); + + mWxGUICommand = new WxGUICommand(this,this); + + // mWxGUICommand->SetFocus(); + + // cmdsizer->Add (mWxGUIOutputMessages, 1, wxALL | wxGROW, 5); + // cmdsizer->Add (mWxGUICommand, 0, wxALL | wxGROW, 5); + + + // Creates and sets the parent window of all bbtk windows + wxWindow* top = new wxPanel(this,-1);//,_T("top")); + top->Hide(); + Wx::SetTopWindow(top); + + + // Layout +//EED SetSizer(sizer); +/* + mwxNotebook->AddPage( mwxPageCommand, _T("Command")); + mwxNotebook->AddPage( mwxPageHelp, _T("Help")); +*/ + + m_mgr.AddPane(mWxGUITextEditor, + wxAuiPaneInfo().Name(wxT("editor_content")) + .Top()); + m_mgr.AddPane(mWxGUIOutputMessages, + wxAuiPaneInfo().Name(wxT("messages_content")) + .Caption(wxT("Messages")) + .Center()); + m_mgr.AddPane(mWxGUIHtmlBrowser, + wxAuiPaneInfo().Name(wxT("browser_content")) + .Right()); + m_mgr.AddPane(mWxGUICommand, + wxAuiPaneInfo().Name(wxT("command_content")) + .Bottom()); + m_mgr.AddPane(mwxButtonRun, + wxAuiPaneInfo().Name(wxT("button_run_content"))); + + +//.PaneBorder(false)); + m_mgr.Update(); + + SetAutoLayout(true); + Layout(); +// Refresh(); +// m_mgr.Update(); + } + //================================================================ + + //================================================================ + WxGUIScriptingInterface::~WxGUIScriptingInterface() + { + m_mgr.UnInit(); + } + //================================================================ + + //================================================================ + void WxGUIScriptingInterface::Open(const std::string& filename) + { + mWxGUITextEditor->Open(filename); + } + //================================================================ + + //================================================================ + void WxGUIScriptingInterface::WxGUICommandEnter(const std::string& command) + { + std::string s("> "); + s += command + "\n"; + mWxGUIOutputMessages->Print(s,wxRED); + + if ( mInterpreter->InterpretLine( command ) == + Interpreter::QUIT ) + { + Close(true); + } + } + //================================================================ + + //================================================================ + /// Runs the interpretation of a file + bool WxGUIScriptingInterface::InterpretFile( const std::string& filename) + { + if ( mInterpreter->InterpretFile(filename) == + Interpreter::ERROR ) + { + return false; + } + return true; + } + //================================================================ + + //================================================================ + void WxGUIScriptingInterface::OnButtonRun(wxCommandEvent& WXUNUSED(event)) + { + wxString per = m_mgr.SavePerspective(); + std::cout << per<< std::endl; + +// wxString temp = mWxGUIHtmlBrowser->GetCurrentPage(); + std::string filename = mWxGUIHtmlBrowser->GetCurrentPage();//wx2std(temp); + size_t s = filename.length(); + + Interpreter* I = new Interpreter; + + if ((s>3) && (filename[s-1]=='s') + && (filename[s-2]=='b') + && (filename[s-3]=='b') + && (filename[s-4]=='.')) + { + std::string tmp("Executing "); + tmp += filename; + SetStatusText(std2wx(tmp)); + I->InterpretFile(filename); + } + else + { + SetStatusText(_T("The current page is not a bbs file : cannot execute it")); + } + + delete I; + } + //================================================================ + + //================================================================ + void WxGUIScriptingInterface::OnMenuQuit(wxCommandEvent& WXUNUSED(event)) + { + Close(true); + } + //================================================================ + + + //================================================================ + void WxGUIScriptingInterface::OnMenuAbout(wxCommandEvent& WXUNUSED(event)) + { + m_mgr.Update(); + Refresh(); + wxMessageBox(_T(" bbi\nThe Black Box Toolkit interpreter\n(c) CREATIS-LRMN 2008"), + _T("About ..."), wxOK | wxICON_INFORMATION, + this); + } + //================================================================ + + + //================================================================ + void WxGUIScriptingInterface::OnMenuEditConfig(wxCommandEvent& WXUNUSED(event)) + { + std::string commandStr; + std::string configFile = ConfigurationFile::GetInstance().Get_config_xml_full_path(); +#ifdef WIN32 + commandStr = "notepad.exe "; +#else + commandStr = "gedit "; +#endif + commandStr = commandStr + configFile; + std::cout << "system: " << commandStr << std::endl; + system ( commandStr.c_str() ); + } + //================================================================ + + + //================================================================ + void WxGUIScriptingInterface::OnMenuCreatePackage(wxCommandEvent& WXUNUSED(event)) + { +printf("EED WxGUIScriptingInterface::OnMenuCreatePackage 01 \n"); + std::string command("toolsbbtk/appli/CreatePackage"); +printf("EED WxGUIScriptingInterface::OnMenuCreatePackage 02 \n"); + + bbtkMessage("Debug",1,"Executing : '"<InterpretFile(command); +printf("EED WxGUIScriptingInterface::OnMenuCreatePackage 05 \n"); + delete I; +printf("EED WxGUIScriptingInterface::OnMenuCreatePackage 06 \n"); + } + //================================================================ + + + //================================================================ + void WxGUIScriptingInterface::OnMenuCreateBlackBox(wxCommandEvent& WXUNUSED(event)) + { + std::string command("toolsbbtk/appli/CreateBlackBox"); + bbtkMessage("Debug",1,"Executing : '"<InterpretFile(command); + delete I; + } + //================================================================ + + //================================================================ + void WxGUIScriptingInterface::OnMenuShowImageGraph(wxCommandEvent& WXUNUSED(event)) + { + std::string default_temp_dir = ConfigurationFile::GetInstance().Get_default_temp_dir(); + +#if defined(WIN32) + std::string strappli="start "; +#else + std::string strappli="gnome-open "; +#endif + std::string strcommand = strappli +default_temp_dir+"/temp_dir/workspace_workspacePrototype.png"; + std::cout << "system: " << strcommand << std::endl; + system ( strcommand.c_str() ); + + } + //================================================================ + + + //================================================================ + void WxGUIScriptingInterface::OnMenuCreateIndex(wxCommandEvent& WXUNUSED(event)) + { + std::string doc_path = ConfigurationFile::GetInstance().Get_doc_path(); + std::string filepath = doc_path+"/bbdoc/make-index.bbs"; + Interpreter* I = new Interpreter; + +//EED std::cout << "bbi: include "<InterpretFile( filepath ); + + I->InterpretLine( "exec freeze"); + I->InterpretLine( "include *"); + I->InterpretLine( "index "+doc_path+"/bbdoc/index-alpha.html Initials"); + I->InterpretLine( "index "+doc_path+"/bbdoc/index-package.html Packages"); + I->InterpretLine( "index "+doc_path+"/bbdoc/index-category.html Categories"); + I->InterpretLine( "index "+doc_path+"/bbdoc/index-adaptors.html Adaptors"); + + delete I; + } + //================================================================ + + + //================================================================ + void WxGUIScriptingInterface::InterpreterUserViewHtmlPage(const std::string& page) + { + std::string s(page); + // std::cout << "WxGUIScriptingInterface::ShowHtmlPage('"<GoTo(s)) + { +//EED mwxNotebook->ChangeSelection(1); + mwxNotebook->SetSelection(1); + } + else + { + // std::cout << "ERROR html"< +#include "bbtkWx.h" +#include +#include + + +#include "bbtkInterpreter.h" + +#include "bbtkWxGUITextEditor.h" +#include "bbtkWxGUICommand.h" +#include "bbtkWxGUIOutputMessages.h" +#include "bbtkWxGUIHtmlBrowser.h" + +namespace bbtk +{ + + /// A scripting interface window + class BBTK_EXPORT WxGUIScriptingInterface : public wxFrame, + public InterpreterUser, + public WxGUICommandUser + { + public: + WxGUIScriptingInterface( wxWindow *parent, wxString title, wxSize size); + ~WxGUIScriptingInterface(); + + /// Returns the Interpreter used + /// ONLY ONE FOR THE MOMENT BUT IN THE FUTURE CAN BE DIFFERENT + /// (DIFFERENT WORKSPACES) + Interpreter* GetInterpreter() { return mInterpreter; } + /// Returns the Interpreter used (const) + const Interpreter* GetInterpreter() const { return mInterpreter; } + + /// Sets the inputs of the workspace : + /// the map is passed as is to the Executer + void SetInputs(const std::map& m) + { mInterpreter->SetInputs(m); } + + /// Puts the executer in "no exec" mode, + /// which creates but does not execute pipelines. + void SetNoExecMode(bool b) { mInterpreter->SetNoExecMode(b); } + + void SetDialogMode(Interpreter::DialogModeType t) + { mInterpreter->SetDialogMode(t); } + + /// Runs the interpretation of a file + /// Returns false on error + bool InterpretFile( const std::string& filename); + + void Open(const std::string& filename); + + + void OnMenuQuit(wxCommandEvent& event); + void OnMenuAbout(wxCommandEvent& event); + void OnMenuEditConfig(wxCommandEvent& WXUNUSED(event)); + void OnMenuCreatePackage(wxCommandEvent& WXUNUSED(event)); + void OnMenuCreateBlackBox(wxCommandEvent& WXUNUSED(event)); + void OnMenuShowImageGraph(wxCommandEvent& WXUNUSED(event)); + void OnMenuCreateIndex(wxCommandEvent& WXUNUSED(event)); + + + void OnButtonRun(wxCommandEvent& WXUNUSED(event)); + + // Interpreter callbacks + bool InterpreterUserHasOwnHtmlPageViewer() { return true; } + void InterpreterUserViewHtmlPage(const std::string&); + + // WxGUICommand callbacks + void WxGUICommandEnter(const std::string&); + + private: + wxAuiManager m_mgr; + Interpreter* mInterpreter; + + +//EED wxNotebook* mwxNotebook; + wxAuiNotebook* mwxNotebook; + wxPanel *mwxPageCommand, *mwxPageHelp; + + WxGUICommand* mWxGUICommand; + WxGUIOutputMessages* mWxGUIOutputMessages; + WxGUIHtmlBrowser* mWxGUIHtmlBrowser; + WxGUITextEditor* mWxGUITextEditor; + + wxButton* mwxButtonRun; + + public: + + + DECLARE_EVENT_TABLE() + + }; + + +} // namespace bbtk + + +#endif // __bbtkWxGUIScriptingInterface_h__ + +#endif //_USE_WXWIDGETS_ diff --git a/kernel/src/bbtkWxGUITextEditor.cxx b/kernel/src/bbtkWxGUITextEditor.cxx new file mode 100644 index 0000000..7de7106 --- /dev/null +++ b/kernel/src/bbtkWxGUITextEditor.cxx @@ -0,0 +1,604 @@ +/*========================================================================= + + Program: bbtk + Module: $RCSfile: bbtkWxGUITextEditor.cxx,v $ + Language: C++ + Date: $Date: 2008/03/21 11:46:41 $ + Version: $Revision: 1.1 $ + + 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 + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*//** + * \brief Short description in one line + * + * Long description which + * can span multiple lines + */ +/** + * \file + * \brief + */ +/** + * \class bbtk:: + * \brief + */ + + +#ifdef _USE_WXWIDGETS_ + +#include +#include "bbtkWxGUITextEditor.h" +#include "bbtkWxBlackBox.h" +#include "bbtkConfigurationFile.h" + +#include "icons/cc_new.xpm" +#include "icons/cc_open.xpm" +#include "icons/cc_save.xpm" +#include "icons/cc_run.xpm" +#include "icons/cc_exit.xpm" + + +namespace bbtk +{ + + + //================================================================ + class WxTextCtrlGettingKeyEvents : public wxTextCtrl + { + public: + WxTextCtrlGettingKeyEvents(wxWindow *parent, wxWindowID id, const wxString &value, + const wxPoint &pos, const wxSize &size, int style = 0) + : wxTextCtrl(parent, id, value, pos, size, style) + { + } + + void SetWxGUITextEditor(WxGUITextEditor* e) + { mWxGUITextEditor = e; } + + void OnKeyDown(wxKeyEvent& event); + void OnKeyUp(wxKeyEvent& event); + void OnChar(wxKeyEvent& event); + private : + WxGUITextEditor* mWxGUITextEditor; + + DECLARE_EVENT_TABLE() + }; + + BEGIN_EVENT_TABLE(WxTextCtrlGettingKeyEvents, wxTextCtrl) + EVT_KEY_DOWN(WxTextCtrlGettingKeyEvents::OnKeyDown) + EVT_KEY_UP(WxTextCtrlGettingKeyEvents::OnKeyUp) + EVT_CHAR(WxTextCtrlGettingKeyEvents::OnChar) + END_EVENT_TABLE() + + + void WxTextCtrlGettingKeyEvents::OnChar(wxKeyEvent& event) + { + event.Skip(); + } + + void WxTextCtrlGettingKeyEvents::OnKeyUp(wxKeyEvent& event) + { + mWxGUITextEditor->OnKeyUp(event); + event.Skip(); + } + + void WxTextCtrlGettingKeyEvents::OnKeyDown(wxKeyEvent& event) + { + mWxGUITextEditor->OnKeyDown(event); + event.Skip(); + } + //================================================================ + + + //================================================================ + class WxGUITextEditorPage : public wxPanel + { + public: + WxGUITextEditorPage(wxWindow* parent, WxGUITextEditor* editor); + ~WxGUITextEditorPage(); + + void SetPageName(const std::string& name) { mName = name; } + const std::string& GetPageName() const { return mName; } + + bool AskFilename() const { return mAskFilename; } + + WxTextCtrlGettingKeyEvents* GetTextCtrl() { return mwxInputText; } + + void Load(const std::string& filename); + void Save(const std::string& filter); + + bool IsModified() { return mwxInputText->IsModified(); } + + private: + WxGUITextEditor* mEditor; + WxTextCtrlGettingKeyEvents* mwxInputText; + wxTextAttr* mwxInputTextAttr; + std::string mName; + bool mAskFilename; + + /* + enum + { + ID_InputText + }; + */ + //DECLARE_EVENT_TABLE(); + + } ; + //================================================================ + + //================================================================ + /* BEGIN_EVENT_TABLE(WxGUITextEditorPage, wxPanel) + EVT_CLOSE(WxGUITextEditorPage::OnClose) + END_EVENT_TABLE() + */ + + //================================================================ + WxGUITextEditorPage::WxGUITextEditorPage(wxWindow* parent, + WxGUITextEditor* editor) + : wxPanel(parent,-1), + mEditor(editor), + mName(""), + mAskFilename(true) + { + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + mwxInputText = + new WxTextCtrlGettingKeyEvents(this, + -1, //ID_InputText, + _T(""), + wxDefaultPosition, + wxDefaultSize, + wxTE_MULTILINE + // |wxTE_PROCESS_ENTER + | wxTE_PROCESS_TAB + // | wxWANTS_CHARS + | wxTAB_TRAVERSAL + ); + mwxInputText->SetWxGUITextEditor(mEditor); + + wxFont* FixedFont = new wxFont(10, + wxFONTFAMILY_MODERN, + wxFONTSTYLE_NORMAL, + wxFONTWEIGHT_NORMAL, + false); + + mwxInputTextAttr = new wxTextAttr; + mwxInputTextAttr->SetFont(*FixedFont); + + sizer->Add(mwxInputText,1,wxGROW); + SetSizer(sizer); + SetAutoLayout(true); + Layout(); + } + //================================================================ + + //================================================================ + WxGUITextEditorPage::~WxGUITextEditorPage() + { + } + //================================================================ + + + //================================================================ + void WxGUITextEditorPage::Load(const std::string& filename) + { + std::cout << "-------------- LOAD ---------------"<LoadFile(std2wx(mName)); + } + //================================================================ + + //================================================================ + void WxGUITextEditorPage::Save(const std::string& filter) + { + std::cout << "-------------- SAVE ---------------"<ShowModal(); + + if (fd->GetReturnCode()==wxID_OK) + { + mName = wx2std(fd->GetPath()); + mAskFilename = false; + } + else + { + std::cout << "-------------- CANCELLED ---------------" + <SaveFile(mName); + mwxInputText->SetModified(false); + } + //================================================================ + + //================================================================ + WxGUITextEditor::WxGUITextEditor( wxWindow *parent ) + : wxPanel(parent, -1), + mFileNameFilter("*.*") + { + std::cout << "WxGUITextEditor::WxGUITextEditor"<SetWxGUITextEditor(this); + // mInterpreter->SetCommandLine(true); + m_mgr.SetManagedWindow(this); + + //============== + // Menu + wxInitAllImageHandlers(); + + + // wxFlexGridSizer *sizer= new wxFlexGridSizer(2); + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + mwxNotebook = new wxAuiNotebook(this, + -1, + wxPoint(0, 0), + wxSize(500,500), + wxAUI_NB_TAB_SPLIT + | wxAUI_NB_TAB_MOVE + | wxAUI_NB_TAB_EXTERNAL_MOVE + | wxAUI_NB_WINDOWLIST_BUTTON + |wxAUI_NB_SCROLL_BUTTONS + // | wxAUI_NB_CLOSE_BUTTON + | wxAUI_NB_CLOSE_ON_ACTIVE_TAB + //| wxAUI_NB_CLOSE_ON_ALL_TABS + | wxNO_BORDER); + + sizer->Add(mwxNotebook,1,wxGROW); + + // BUTTONS + wxPanel *btnsCtrlPanel = new wxPanel(this,-1); + wxBoxSizer *btnsSizer = new wxBoxSizer(wxHORIZONTAL); + + wxBitmap bmp_new(cc_new_xpm); + mwxButtonNew = new wxBitmapButton( btnsCtrlPanel,ID_ButtonNew,bmp_new);//_T("New") ); + btnsSizer->Add( mwxButtonNew ); + wxBitmap bmp_open(cc_open_xpm); + mwxButtonOpen = new wxBitmapButton( btnsCtrlPanel,ID_ButtonOpen,bmp_open);//,_T("Open") ); + btnsSizer->Add( mwxButtonOpen ); + wxBitmap bmp_save(cc_save_xpm); + mwxButtonSave = new wxBitmapButton( btnsCtrlPanel,ID_ButtonSave,bmp_save);//_T("Save") ); + btnsSizer->Add( mwxButtonSave ); + + /* + wxBitmap bmp_run(cc_run_xpm); + mwxButtonRun = new wxBitmapButton( btnsCtrlPanel,ID_ButtonRun,bmp_run);//_T("Run") ); + btnsSizer->Add( mwxButtonRun ); + wxBitmap bmp_quit(cc_exit_xpm); + mwxButtonQuit = new wxBitmapButton( btnsCtrlPanel,ID_ButtonQuit,bmp_quit);//_T("Quit") ); + btnsSizer->Add( mwxButtonQuit ); + */ + + mwxPosition = new wxStaticText ( btnsCtrlPanel, -1, _T("")); + btnsSizer->Add( mwxPosition ); + + btnsCtrlPanel->SetSizer(btnsSizer); + sizer->Add ( btnsCtrlPanel, 0, wxLEFT | wxRIGHT | wxBOTTOM //| wxGROW + , 10 ); + + + NewPage(""); + UpdateInfo(); + + SetSizer(sizer); + SetAutoLayout(true); + Layout(); + } + //================================================================ + + //================================================================ + WxGUITextEditor::~WxGUITextEditor() + { + m_mgr.UnInit(); + // delete mInterpreter; + } + //================================================================ + + //================================================================ + void WxGUITextEditor::NewPage(const std::string& filename) + { + WxGUITextEditorPage* page = + new WxGUITextEditorPage(mwxNotebook,this); + std::string name("untitled"); + if (filename.size()!=0) + { + name = filename; + page->Load(name); + } + page->SetPageName(name); + mwxNotebook->AddPage(page,name,true); + FocusOnCurrentPage(); + } + //================================================================ + + //================================================================ + WxGUITextEditorPage* WxGUITextEditor::GetCurrentPage() + { + return (WxGUITextEditorPage*) + mwxNotebook->GetPage(mwxNotebook->GetSelection()); + } + //================================================================ + + //================================================================ + void WxGUITextEditor::FocusOnCurrentPage() + { + if (mwxNotebook->GetPageCount()==0) return; + GetCurrentPage()->SetFocus(); + } + //================================================================ + + //================================================================ + void WxGUITextEditor::OnButtonOpen(wxCommandEvent& event) + { + Open(); + FocusOnCurrentPage(); + } + void WxGUITextEditor::Open() + { + std::cout << "-------------- OPEN ---------------"<ShowModal(); + + if (fd->GetReturnCode()==wxID_OK) + { + std::string filename = wx2std(fd->GetPath()); + std::cout << "file [" << filename << "]" <GetPageCount()==0) return; + GetCurrentPage()->Save(mFileNameFilter); + mwxNotebook->SetPageText(mwxNotebook->GetSelection(), + GetCurrentPage()->GetPageName()); + } + //================================================================ + + //================================================================ + void WxGUITextEditor::OnPageClose(wxAuiNotebookEvent& evt) + { + std::cout << "-------------- CLOSE ---------------"<GetPageCount()==0) return; + if (GetCurrentPage()->IsModified()) + { + wxMessageDialog* d = + new wxMessageDialog(this, + _T("Buffer modified. Save it ?"), + _T("Save buffer"), + wxYES_NO | wxCANCEL | wxICON_QUESTION); + switch (d->ShowModal()) + { + case wxID_CANCEL : + evt.Veto(); + break; + case wxID_YES : + GetCurrentPage()->Save(mFileNameFilter); + break; + case wxID_NO : ; + } + } + + } + //================================================================ + + + /* + //================================================================ + void WxGUITextEditor::OnButtonQuit(wxCommandEvent& event) + { + Quit(); + FocusOnCurrentPage(); + } + void WxGUITextEditor::Quit() + { + std::cout << "-------------- QUIT ---------------"<Close(); + } + //================================================================ + + + //================================================================ + void WxGUITextEditor::OnButtonRun(wxCommandEvent& event) + { + Run(); + FocusOnCurrentPage(); + } + void WxGUITextEditor::Run() + { + std::cout << "-------------- RUN ---------------"<IsSplit()) + { + int size = -100; + int minsize = - (int)(mwxInputText->GetSize().GetHeight() / 2.); + if (sizeSplitHorizontally( mwxInputText, mwxOutputText, size); + } + + std::stringstream* buffer = new std::stringstream(bbtk::wx2std(mwxInputText->GetValue())); + mInterpreter->InterpretLine("reset"); + try + { + mInterpreter->InterpretBuffer(buffer); + } + catch (...) + { + } + } + //================================================================ +*/ + + + + //================================================================ + + //================================================================ + void WxGUITextEditor::OnButtonNew(wxCommandEvent& event) + { + New(); + FocusOnCurrentPage(); + } + void WxGUITextEditor::New() + { + std::cout << "-------------- NEW ---------------" << std::endl; + NewPage(""); + UpdateInfo(); + } + //================================================================ + + //================================================================ + void WxGUITextEditor::UpdateInfo() + { + if (mwxNotebook->GetPageCount()==0) return; + WxTextCtrlGettingKeyEvents* text = GetCurrentPage()->GetTextCtrl(); + + long line, column, pos; + pos = text->GetInsertionPoint(); + text->PositionToXY(pos, &column, &line); + + + // wxLogMessage(_T("Current position: %ld\nCurrent line, column: (%ld, %ld)\nNumber of lines: %ld\nCurrent line length: %ld\nTotal text length: %u (%ld)"), + + + char mess[200]; + sprintf(mess,"%ld:%ld/%ld:%ld", + line+1,column+1, + (long)text->GetNumberOfLines(), + (long)text->GetLineLength(line)+1); + // pos+1, + // (long)mwxInputText->GetValue().length())+1; + + mwxPosition->SetLabel(wxString(mess)); + mwxPosition->Show(); + + if (text->IsModified()) + { + std::string title("*"); + title += GetCurrentPage()->GetPageName(); + mwxNotebook->SetPageText(mwxNotebook->GetSelection(),title); + } + } + //================================================================ + //================================================================ + void WxGUITextEditor::OnKeyUp(wxKeyEvent& event) + { + // std::cout << "U" << std::endl; + UpdateInfo(); + } + //================================================================ + + //================================================================ + void WxGUITextEditor::OnKeyDown(wxKeyEvent& event) + { + // std::cout << "D" << std::endl; + // std::cout << "Key="<Add(mEditor,1,wxGROW); + + // WxGUICommand* com = new WxGUICommand(this,this); + // sizer->Add(com); + + SetSizer(sizer); + + // Creates and sets the parent window of all bbtk windows + wxWindow* top = new wxPanel(this,-1); + top->Hide(); + + Wx::SetTopWindow(top); + + SetAutoLayout(true); + Layout(); + } + //================================================================ + + //================================================================ + WxGUITextEditorWindow::~WxGUITextEditorWindow() + { + } + //================================================================ + + +} // namespace bbtk + + +#endif //_USE_WXWIDGETS_ diff --git a/kernel/src/bbtkWxEditor.h b/kernel/src/bbtkWxGUITextEditor.h similarity index 59% rename from kernel/src/bbtkWxEditor.h rename to kernel/src/bbtkWxGUITextEditor.h index 5ce7e1f..77f7126 100644 --- a/kernel/src/bbtkWxEditor.h +++ b/kernel/src/bbtkWxGUITextEditor.h @@ -1,10 +1,10 @@ /*========================================================================= Program: bbtk - Module: $RCSfile: bbtkWxEditor.h,v $ + Module: $RCSfile: bbtkWxGUITextEditor.h,v $ Language: C++ - Date: $Date: 2008/03/20 09:51:29 $ - Version: $Revision: 1.5 $ + Date: $Date: 2008/03/21 11:46:41 $ + Version: $Revision: 1.1 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -33,29 +33,30 @@ #ifdef _USE_WXWIDGETS_ -#ifndef __bbtkWxEditor_h__ -#define __bbtkWxEditor_h__ +#ifndef __bbtkWxGUITextEditor_h__ +#define __bbtkWxGUITextEditor_h__ #include "bbtkWx.h" #include "bbtkInterpreter.h" #include +#include #include "bbtkWxGUICommand.h" namespace bbtk { - class WxStreamRedirector; class WxTextCtrlGettingKeyEvents; + class WxGUITextEditorPage; /// A bbs editor panel - class BBTK_EXPORT WxEditor : public wxPanel + class BBTK_EXPORT WxGUITextEditor : public wxPanel { public: - WxEditor( wxWindow *parent ); - ~WxEditor(); + WxGUITextEditor( wxWindow *parent ); + ~WxGUITextEditor(); void OnKeyDown(wxKeyEvent& event); void OnKeyUp(wxKeyEvent& event); @@ -63,72 +64,79 @@ namespace bbtk void OnButtonNew(wxCommandEvent& event); void OnButtonOpen(wxCommandEvent& event); void OnButtonSave(wxCommandEvent& event); - void OnButtonRun(wxCommandEvent& event); - void OnButtonQuit(wxCommandEvent& event); + // void OnButtonRun(wxCommandEvent& event); + // void OnButtonQuit(wxCommandEvent& event); + void OnPageClose(wxAuiNotebookEvent& evt); void New(); void Open(); void Open(const std::string& filename); - bool AskSave(); void Save(); - void Run(); - void Quit(); + // void Run(); + // void Quit(); void HighlightSyntax(); - void UpdatePosition(); + void UpdateInfo(); + void NewPage(const std::string& filename); + WxGUITextEditorPage* GetCurrentPage(); + void FocusOnCurrentPage(); + + void SetFileNameFilter(const std::string& filter) + { mFileNameFilter = filter; } private: - Interpreter* mInterpreter; - wxSplitterWindow* mwxSplit; - WxTextCtrlGettingKeyEvents* mwxInputText; - wxTextAttr* mwxInputTextAttr; - WxTextCtrlGettingKeyEvents* mwxOutputText; - wxTextAttr* mwxOutputTextAttr; + wxAuiManager m_mgr; + wxAuiNotebook* mwxNotebook; + + // Interpreter* mInterpreter; + // wxSplitterWindow* mwxSplit; + wxButton * mwxButtonNew; wxButton * mwxButtonOpen; wxButton * mwxButtonSave; - wxButton * mwxButtonRun; - wxButton * mwxButtonQuit; + // wxButton * mwxButtonRun; + // wxButton * mwxButtonQuit; wxStaticText* mwxPosition; - WxStreamRedirector* mRedirect_cout; - WxStreamRedirector* mRedirect_cerr; + + std::string mFileNameFilter; + public: enum { - ID_InputText, - ID_OutputText, ID_ButtonNew, ID_ButtonOpen, - ID_ButtonSave, - ID_ButtonRun, - ID_ButtonQuit + ID_ButtonSave + // ID_ButtonRun, + // ID_ButtonQuit }; DECLARE_EVENT_TABLE() }; - + /// Editor in a frame - class BBTK_EXPORT WxEditorWindow : public wxFrame, public WxGUICommandUser + class BBTK_EXPORT WxGUITextEditorWindow : public wxFrame + //, public WxGUICommandUser { public: - WxEditorWindow( wxWindow *parent, wxString title, wxSize size); - ~WxEditorWindow(); + WxGUITextEditorWindow( wxWindow *parent, wxString title, wxSize size); + ~WxGUITextEditorWindow(); void Open(const std::string& filename) { mEditor->Open(filename); } - void WxGUICommandEnter(const std::string& s); + // void WxGUICommandEnter(const std::string& s); private : - WxEditor* mEditor; + WxGUITextEditor* mEditor; }; + } // namespace bbtk -#endif // __bbtkWxEditor_h__ +#endif // __bbtkWxGUITextEditor_h__ #endif //_USE_WXWIDGETS_ -- 2.45.1