X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FbbtkwxGUIEditorGraphicBBS.cxx;h=af24586bf94ea1e451900fdbf7e6a69b38b866c4;hb=04884fa171fe877e5c2ca53d11d6838bc1f8a8f7;hp=bf26a19399977d21321a5aa5325c7d5a6000586a;hpb=0846876a83badbcceaa83f3e1562ef1708e0d7e0;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index bf26a19..af24586 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -147,8 +147,8 @@ 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->EnableTool(ID_UNDO, false); + toolbar->EnableTool(ID_REDO, false); toolbar->SetMargins(2, 2); toolbar->Realize(); SetToolBar(toolbar); @@ -190,7 +190,7 @@ void wxGUIEditorGraphicBBS::initToolbar() { wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxOutput)); Connect(ID_UNDO,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnUndo)); Connect(ID_REDO,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnRedo)); - + Connect(ID_CHANGENAME, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnChangeName)); } //========================================================================= void wxGUIEditorGraphicBBS::initHelpHTMLBrowser() { @@ -483,19 +483,33 @@ void wxGUIEditorGraphicBBS::OnCreateNewTab(wxCommandEvent& event) { void wxGUIEditorGraphicBBS::OnUndo(wxCommandEvent& event) { unsigned short disable; - GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->loadTempDiagram(0)); - if (GetToolBar()->GetToolEnabled(ID_REDO) == false) - GetToolBar()->EnableTool(ID_REDO,true); + _tabsMgr->loadTempDiagram(0); + disable = _tabsMgr->getUndoState(); + if(disable == 0) + { + std::string name = _tabsMgr->GetNameTabPanel(); + if(name[name.length() - 1] == '*') + { + name =name.substr(0,name.length()-1); + } + _tabsMgr->SetNameTabPanel(name); + } + + GetToolBar()->EnableTool(ID_UNDO,disable); + GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState()); refreshGUIControls(); } void wxGUIEditorGraphicBBS::OnRedo(wxCommandEvent& event) { unsigned short disable; - GetToolBar()->EnableTool(ID_REDO, _tabsMgr->loadTempDiagram(1)); - if (GetToolBar()->GetToolEnabled(ID_UNDO) == false) - GetToolBar()->EnableTool(ID_UNDO,true); + _tabsMgr->loadTempDiagram(1); + GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState()); + GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState()); refreshGUIControls(); } + +void wxGUIEditorGraphicBBS::OnChangeName(wxCommandEvent& event){ +} //========================================================================= void wxGUIEditorGraphicBBS::OnExecuteActualDiagram(wxCommandEvent& event) { @@ -652,6 +666,10 @@ void wxGUIEditorGraphicBBS::SaveActualDiagram(std::string filename) { //========================================================================= void wxGUIEditorGraphicBBS::SaveTempActualDiagram() { + std::string name = _tabsMgr->GetNameTabPanel(); + if(name[name.length() - 1] != '*') + name +="*"; + _tabsMgr->SetNameTabPanel(name); _tabsMgr->saveTempActualDiagram(); } @@ -696,7 +714,7 @@ void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event) { } else { std::string pathfilenamebbs = pathfilename; pathfilenamebbs[pathfilenamebbs.length() - 1] = 's'; - + if (_tabsMgr->isActualDiagramComplexBox() == false) { SaveActualDiagram(pathfilename); SaveActualBBS(pathfilenamebbs); @@ -732,6 +750,9 @@ void wxGUIEditorGraphicBBS::refreshGUIControls() { GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS, true); } + GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState()); + GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState()); + if (_tabsMgr->getNumActualSelectedObjects() > 0) { GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM, true); } else {