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
// 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,
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,
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);
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
void WxEditor::Run()
{
std::cout << "-------------- RUN ---------------"<<std::endl;
+
+ if (!mwxSplit->IsSplit())
+ {
+ int size = -100;
+ int minsize = - (int)(mwxInputText->GetSize().GetHeight() / 2.);
+ if (size<minsize) size = minsize;
+ mwxSplit->SplitHorizontally( mwxInputText, mwxOutputText, size);
+ }
+
std::stringstream* buffer = new std::stringstream(bbtk::wx2std(mwxInputText->GetValue()));
- bool com;
+ bool com = false;
mInterpreter->InterpretLine("reset",com);
try
{
//================================================================
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="<<event.GetKeyCode()<<std::endl;
if ( event.ControlDown() )
{
Program: bbtk
Module: $RCSfile: bbtkWxEditor.h,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
#include "bbtkWx.h"
#include "bbtkInterpreter.h"
+#include <wx/splitter.h>
namespace bbtk
{
private:
Interpreter* mInterpreter;
+ wxSplitterWindow* mwxSplit;
WxTextCtrlGettingKeyEvents* mwxInputText;
wxTextAttr* mwxInputTextAttr;
WxTextCtrlGettingKeyEvents* mwxOutputText;
wxButton * mwxButtonSave;
wxButton * mwxButtonRun;
wxButton * mwxButtonQuit;
+ wxStaticText* mwxPosition;
WxStreamRedirector* mRedirect_cout;
WxStreamRedirector* mRedirect_cerr;
public: