X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=kernel%2Fsrc%2FbbtkWxGUITextEditor.cxx;h=a61de17e9a919d1610bd391a42414687c87ca537;hb=6d91f7afe800c870a482570e5b0243fc3f425777;hp=56a5a97d56cfea3d7f7dea82c6b76fc879d99c0d;hpb=6bfa05367895a6a7cdb78e708a080818c314e906;p=bbtk.git diff --git a/kernel/src/bbtkWxGUITextEditor.cxx b/kernel/src/bbtkWxGUITextEditor.cxx index 56a5a97..a61de17 100644 --- a/kernel/src/bbtkWxGUITextEditor.cxx +++ b/kernel/src/bbtkWxGUITextEditor.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkWxGUITextEditor.cxx,v $ Language: C++ - Date: $Date: 2008/03/25 15:47:54 $ - Version: $Revision: 1.4 $ + Date: $Date: 2008/04/24 12:56:40 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -36,6 +36,7 @@ #include "bbtkWxGUITextEditor.h" #include "bbtkWxBlackBox.h" #include "bbtkConfigurationFile.h" +#include "bbtkUtilities.h" #include "icons/cc_new.xpm" #include "icons/cc_open.xpm" @@ -170,8 +171,8 @@ namespace bbtk //================================================================ void WxGUITextEditorPage::Load(const std::string& filename) { - std::cout << "-------------- LOAD ---------------"<SaveFile(mName); + // std::cout << "file [" << mName << "]" <SaveFile(std2wx(mName)); mwxInputText->SetModified(false); } //================================================================ @@ -215,7 +216,7 @@ namespace bbtk mUser(user), mFileNameFilter("*.*") { - std::cout << "WxGUITextEditor::WxGUITextEditor"<SetWxGUITextEditor(this); // mInterpreter->SetCommandLine(true); @@ -244,7 +245,8 @@ namespace bbtk | wxNO_BORDER); sizer->Add(mwxNotebook,1,wxGROW); - + + // BUTTONS wxPanel *btnsCtrlPanel = new wxPanel(this,-1); wxBoxSizer *btnsSizer = new wxBoxSizer(wxHORIZONTAL); @@ -295,6 +297,9 @@ namespace bbtk btnsSizer->Add( mwxPosition ); btnsCtrlPanel->SetSizer(btnsSizer); + btnsCtrlPanel->SetAutoLayout(true); + btnsCtrlPanel->Layout(); + sizer->Add ( btnsCtrlPanel, 0, wxLEFT | wxRIGHT | wxBOTTOM //| wxGROW , 10 ); @@ -329,7 +334,8 @@ namespace bbtk page->Load(name); } page->SetPageName(name); - mwxNotebook->AddPage(page,name,true); + std::string fname = Utilities::get_file_name(name); + mwxNotebook->AddPage(page,std2wx(fname),true); FocusOnCurrentPage(); } //================================================================ @@ -358,7 +364,7 @@ namespace bbtk } void WxGUITextEditor::Open() { - std::cout << "-------------- OPEN ---------------"<GetPageCount()==0) return true; if (GetCurrentPage()->IsModified()) { @@ -450,7 +456,7 @@ namespace bbtk if (mwxNotebook->GetPageCount()==0) return; GetCurrentPage()->Save(mFileNameFilter); mwxNotebook->SetPageText(mwxNotebook->GetSelection(), - GetCurrentPage()->GetPageName()); + std2wx(GetCurrentPage()->GetPageName())); } //================================================================ @@ -466,7 +472,7 @@ namespace bbtk //================================================================ void WxGUITextEditor::OnPageClose(wxAuiNotebookEvent& evt) { - std::cout << "-------------- CLOSE ---------------"<GetValue().length())+1; - mwxPosition->SetLabel(wxString(mess)); + // mwxPosition->SetLabel(wxString(mess)); + mwxPosition->SetLabel(std2wx(mess)); mwxPosition->Show(); if (text->IsModified()) { std::string title("*"); title += GetCurrentPage()->GetPageName(); - mwxNotebook->SetPageText(mwxNotebook->GetSelection(),title); + mwxNotebook->SetPageText(mwxNotebook->GetSelection(),std2wx(title)); } } //================================================================ @@ -658,11 +665,11 @@ namespace bbtk SetSizer(sizer); - // Creates and sets the parent window of all bbtk windows - wxWindow* top = new wxPanel(this,-1); - top->Hide(); + // Creates the parent window of all bbtk windows as a child of this + Wx::CreateTopWindow(this); + // Add the method OnWxSignal as a Wx::Signal observer + //bbtkAddWxSignalObserver(WxGUITextEditorWindow::OnWxSignal); - Wx::SetTopWindow(top); SetAutoLayout(true); Layout();