X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FbbtkwxGUIEditorGraphicBBS.cxx;h=eeb3afced317a52b9aed8cc4608850f5598873fa;hb=713c6f1f54a2114c6e495aa6974d33b5718b46b5;hp=9f68cef04367407fe1f72d64ecfc9a647ca45233;hpb=fb950461b1d139c1ec6ab2ac7a33570c0c63fd61;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index 9f68cef..eeb3afc 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -147,6 +147,7 @@ void wxGUIEditorGraphicBBS::initToolbar() { toolbar->AddSeparator(); toolbar->AddTool(ID_UNDO, _T("Undo"),bmp_undo, wxNullBitmap, wxITEM_NORMAL, _T("Undo"), _T("Undo")); toolbar->AddTool(ID_REDO, _T("Redo"),bmp_redo, wxNullBitmap, wxITEM_NORMAL, _T("Redo"), _T("Redo")); + toolbar->EnableTool(ID_UNDO, false); toolbar->EnableTool(ID_REDO, false); toolbar->SetMargins(2, 2); @@ -304,7 +305,7 @@ void wxGUIEditorGraphicBBS::initPackageBrowser() { _pkgBrowser = new WxGUIPackageBrowser2(this); _pkgBrowser->IncludeAll(); _frameAUIMgr->AddPane(_pkgBrowser, - wxAuiPaneInfo().Left().MinSize(200, 200).CloseButton(false)); + wxAuiPaneInfo().Left().MinSize(480, 400).CloseButton(false)); } //================================================================ @@ -492,8 +493,11 @@ void wxGUIEditorGraphicBBS::OnCreateNewTab(wxCommandEvent& event) { void wxGUIEditorGraphicBBS::OnUndo(wxCommandEvent& event) { unsigned short disable; + std::string stundo; + std::string stredo; + _tabsMgr->loadTempDiagram(0); - disable = _tabsMgr->getUndoState(); + disable = _tabsMgr->getUndoState(stundo); if(disable == 0) { std::string name = _tabsMgr->GetNameTabPanel(); @@ -505,19 +509,26 @@ void wxGUIEditorGraphicBBS::OnUndo(wxCommandEvent& event) { } GetToolBar()->EnableTool(ID_UNDO,disable); - GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState()); + GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo)); + GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo)); + GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo)); refreshGUIControls(); } void wxGUIEditorGraphicBBS::OnRedo(wxCommandEvent& event) { unsigned short disable; + std::string stundo; + std::string stredo; + _tabsMgr->loadTempDiagram(1); std::string name = _tabsMgr->GetNameTabPanel(); if(name[name.length() - 1] != '*') name +="*"; _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8)); - GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState()); - GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState()); + GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo)); + GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo)); + GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo)); + GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo)); refreshGUIControls(); } @@ -677,15 +688,19 @@ void wxGUIEditorGraphicBBS::SaveActualDiagram(std::string filename) { } //========================================================================= -void wxGUIEditorGraphicBBS::SaveTempActualDiagram() +void wxGUIEditorGraphicBBS::SaveTempActualDiagram(const std::string &action) { + std::string stundo; + std::string stredo; std::string name = _tabsMgr->GetNameTabPanel(); if(name[name.length() - 1] != '*') name +="*"; _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8)); - _tabsMgr->saveTempActualDiagram(); - GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState()); - GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState()); + _tabsMgr->saveTempActualDiagram(action); + GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo)); + GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo)); + GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo)); + GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo)); } //========================================================================= @@ -731,6 +746,12 @@ void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event) { pathfilenamebbs[pathfilenamebbs.length() - 1] = 's'; if (_tabsMgr->isActualDiagramComplexBox() == false) { + std::string name = _tabsMgr->GetNameTabPanel(); + if(name[name.length() - 1] == '*') + { + name =name.substr(0,name.length()-1); + } + _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8)); SaveActualDiagram(pathfilename); SaveActualBBS(pathfilenamebbs); } else { @@ -748,6 +769,8 @@ void wxGUIEditorGraphicBBS::OnSaveAsActualDiagram(wxCommandEvent& event) { //========================================================================= void wxGUIEditorGraphicBBS::refreshGUIControls() { + std::string stundo; + std::string stredo; wxToolBar* toolbar = GetToolBar(); if (_tabsMgr->isActualDiagramComplexBox()) { toolbar->ToggleTool(ID_BTNCOMPLEXBOX, true); @@ -765,8 +788,10 @@ void wxGUIEditorGraphicBBS::refreshGUIControls() { GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS, true); } - GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState()); - GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState()); + GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo)); + GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo)); + GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo)); + GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo)); if (_tabsMgr->getNumActualSelectedObjects() > 0) { GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM, true); @@ -800,6 +825,7 @@ void wxGUIEditorGraphicBBS::OnCenterViewActualDiagram(wxCommandEvent& event) { void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event) { wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open diagram"), wxEmptyString, wxT(""), wxT("*.bbg"), wxOPEN | wxFILE_MUST_EXIST); + printf("SCP: wxGUIEditorGraphicBBS::OnOpenDiagram \n"); if (openFileDialog->ShowModal() == wxID_OK) { wxString fileName = openFileDialog->GetPath(); ifstream inputStream; @@ -809,7 +835,7 @@ void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event) { assert(inputStream.good()); // fails _tabsMgr->addNewTab(openFileDialog->GetFilename()); _tabsMgr->loadDiagram(inputStream, fName); - _tabsMgr->saveTempActualDiagram(); + _tabsMgr->saveTempActualDiagram("load diagram"); GetToolBar()->EnableTool(ID_UNDO, false); GetToolBar()->EnableTool(ID_UNDO, false); inputStream.close(); @@ -835,7 +861,7 @@ void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event) { scn->refresh(); } - SaveTempActualDiagram(); + SaveTempActualDiagram("New Box"); // if pnl }// if bbDes } @@ -912,12 +938,12 @@ void wxGUIEditorGraphicBBS::OnHelpBBeditor(wxCommandEvent& event) { //========================================================================= void wxGUIEditorGraphicBBS::OnCreatePackage(wxCommandEvent& event) { - //bbtkSystemTools::CreatePackage(); + bbtkSystemTools::CreatePackage(); } //========================================================================= void wxGUIEditorGraphicBBS::OnCreateBlackBox(wxCommandEvent& event) { - //bbtkSystemTools::CreateBlackBox(); + bbtkSystemTools::CreateBlackBox(); } //========================================================================= void wxGUIEditorGraphicBBS::OnPlugPackage(wxCommandEvent& event) {