From: guigues Date: Tue, 18 Mar 2008 15:31:51 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: r0.6.1~110 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=b28ab0adce098cc25dd4422761a225d7facd968c;p=bbtk.git *** empty log message *** --- diff --git a/kernel/src/bbtkWxEditor.cxx b/kernel/src/bbtkWxEditor.cxx index f36e5fa..ce66846 100644 --- a/kernel/src/bbtkWxEditor.cxx +++ b/kernel/src/bbtkWxEditor.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkWxEditor.cxx,v $ Language: C++ - Date: $Date: 2008/03/18 13:50:43 $ - Version: $Revision: 1.2 $ + Date: $Date: 2008/03/18 15:31:51 $ + 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 @@ -143,9 +143,15 @@ namespace bbtk // 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(this, + new WxTextCtrlGettingKeyEvents(mwxSplit, ID_InputText, _T(""), wxDefaultPosition, @@ -168,12 +174,12 @@ namespace bbtk mwxInputTextAttr->SetFont(*FixedFont); // sizer->AddGrowableCol(0); - sizer->Add(mwxInputText,1,wxGROW); + // sizer->Add(mwxInputText,1,wxGROW); mwxInputText->SetFocus(); mwxOutputText = - new WxTextCtrlGettingKeyEvents(this, + new WxTextCtrlGettingKeyEvents(mwxSplit, ID_OutputText, _T(""),wxDefaultPosition, wxDefaultSize, //HistorySize, @@ -184,9 +190,12 @@ namespace bbtk mwxOutputTextAttr = new wxTextAttr; mwxOutputTextAttr->SetFont(*FixedFont); + mwxOutputText->Hide(); + + // sizer->Add(mwxOutputText,1,wxGROW); + sizer->Add(mwxSplit,1,wxGROW); + mwxSplit->Initialize(mwxInputText); - sizer->Add(mwxOutputText,1,wxGROW); - // BUTTONS wxPanel *btnsCtrlPanel = new wxPanel(this,-1); wxBoxSizer *btnsSizer = new wxBoxSizer(wxHORIZONTAL); @@ -207,39 +216,10 @@ namespace bbtk mwxButtonQuit = new wxBitmapButton( btnsCtrlPanel,ID_ButtonQuit,bmp_quit);//_T("Quit") ); btnsSizer->Add( mwxButtonQuit ); - /* - toolBarBitmaps[Tool_##bmp] = wxBitmap(bmp##_xpm) -#else // !USE_XPM_BITMAPS - #define INIT_TOOL_BMP(bmp) \ - toolBarBitmaps[Tool_##bmp] = wxBITMAP(bmp) -#endif // USE_XPM_BITMAPS/!USE_XPM_BITMAPS - - INIT_TOOL_BMP(new); - INIT_TOOL_BMP(open); - INIT_TOOL_BMP(save); - INIT_TOOL_BMP(copy); - INIT_TOOL_BMP(cut); - INIT_TOOL_BMP(paste); - INIT_TOOL_BMP(print); - INIT_TOOL_BMP(help); - - int w = toolBarBitmaps[Tool_new].GetWidth(), - h = toolBarBitmaps[Tool_new].GetHeight(); - - if ( !m_smallToolbar ) - { - w *= 2; - h *= 2; - - for ( size_t n = Tool_new; n < WXSIZEOF(toolBarBitmaps); n++ ) - { - toolBarBitmaps[n] = - wxBitmap(toolBarBitmaps[n].ConvertToImage().Scale(w, h)); - - - - */ - + + mwxPosition = new wxStaticText ( btnsCtrlPanel, -1, _T("")); + btnsSizer->Add( mwxPosition ); + btnsCtrlPanel->SetSizer(btnsSizer); sizer->Add ( btnsCtrlPanel, 0, wxLEFT | wxRIGHT | wxBOTTOM //| wxGROW @@ -342,8 +322,17 @@ namespace bbtk 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())); - bool com; + bool com = false; mInterpreter->InterpretLine("reset",com); try { @@ -387,6 +376,20 @@ namespace bbtk //================================================================ void WxEditor::OnKeyPress(wxKeyEvent& event) { + long line, column, 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 (%ld char)", + line,column, + (long)mwxInputText->GetNumberOfLines(), + (long)mwxInputText->GetLineLength(line), + (long)mwxInputText->GetValue().length()); + + mwxPosition->SetLabel(wxString(mess)); // std::cout << "Key="< namespace bbtk { @@ -74,6 +75,7 @@ namespace bbtk private: Interpreter* mInterpreter; + wxSplitterWindow* mwxSplit; WxTextCtrlGettingKeyEvents* mwxInputText; wxTextAttr* mwxInputTextAttr; WxTextCtrlGettingKeyEvents* mwxOutputText; @@ -83,6 +85,7 @@ namespace bbtk wxButton * mwxButtonSave; wxButton * mwxButtonRun; wxButton * mwxButtonQuit; + wxStaticText* mwxPosition; WxStreamRedirector* mRedirect_cout; WxStreamRedirector* mRedirect_cerr; public: