From fb950461b1d139c1ec6ab2ac7a33570c0c63fd61 Mon Sep 17 00:00:00 2001 From: cervenansky <> Date: Thu, 24 May 2012 15:01:51 +0000 Subject: [PATCH] Bug #1375 --- data/icons/wxart_redo.xpm | 2 +- data/icons/wxart_undo.xpm | 2 +- .../bbtkwxGUIEditorGraphicBBS.cxx | 24 ++++++++++--------- .../wxGEditorTabPanel.cxx | 7 +++++- .../bbsWxGUIEditorGraphic/wxGEditorTabPanel.h | 3 +++ .../wxTabPanelsManager.cxx | 6 +++++ .../wxTabPanelsManager.h | 1 + .../wxVtkSceneManager.cxx | 3 +-- 8 files changed, 32 insertions(+), 16 deletions(-) diff --git a/data/icons/wxart_redo.xpm b/data/icons/wxart_redo.xpm index 1ce8803..f3e2f71 100644 --- a/data/icons/wxart_redo.xpm +++ b/data/icons/wxart_redo.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * redo_xpm[] = { +static const char * redo_xpm[] = { "17 17 84 1", " c None", ". c #4D78CE", diff --git a/data/icons/wxart_undo.xpm b/data/icons/wxart_undo.xpm index 35b01e7..c0148bd 100644 --- a/data/icons/wxart_undo.xpm +++ b/data/icons/wxart_undo.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * undo_xpm[] = { +static const char * undo_xpm[] = { "17 17 84 1", " c None", ". c #4B77CE", diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index 25c4298..9f68cef 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -512,6 +512,10 @@ void wxGUIEditorGraphicBBS::OnUndo(wxCommandEvent& event) { void wxGUIEditorGraphicBBS::OnRedo(wxCommandEvent& event) { unsigned short disable; _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()); refreshGUIControls(); @@ -680,6 +684,8 @@ void wxGUIEditorGraphicBBS::SaveTempActualDiagram() name +="*"; _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8)); _tabsMgr->saveTempActualDiagram(); + GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState()); + GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState()); } //========================================================================= @@ -803,7 +809,9 @@ void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event) { assert(inputStream.good()); // fails _tabsMgr->addNewTab(openFileDialog->GetFilename()); _tabsMgr->loadDiagram(inputStream, fName); - + _tabsMgr->saveTempActualDiagram(); + GetToolBar()->EnableTool(ID_UNDO, false); + GetToolBar()->EnableTool(ID_UNDO, false); inputStream.close(); } refreshGUIControls(); @@ -820,19 +828,13 @@ void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event) { wxGEditorTabPanel *pnl = this->_tabsMgr->getActualTabPanel(); - // save empty state!! - /* if (_tabsMgr->getNumActualSelectedObjects() == 0) - { - SaveTempActualDiagram(); - } - */ + if (pnl != NULL) { wxVtkSceneManager *scn = pnl->getSceneManager(); scn->createGBlackBox(50, 50, packageName, typeName); scn->refresh(); } - if (GetToolBar()->GetToolEnabled(ID_UNDO) == false) - GetToolBar()->EnableTool(ID_UNDO,true); + SaveTempActualDiagram(); // if pnl }// if bbDes @@ -910,12 +912,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) { diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index 682c119..10e10a0 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -111,10 +111,15 @@ printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n"); boxType += result; _sceneManager->createGBlackBox(x,y,packageName, boxType); - + saveTempandUpdate(); return true; } + //========================================================================= + void wxGEditorTabPanel::saveTempandUpdate() + { + _panelsManager->saveTempandUpdate(); + } //========================================================================= void wxGEditorTabPanel::setPanelsManager(wxTabPanelsManager* panelsManager) diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h index db615aa..dddf555 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h @@ -103,6 +103,9 @@ namespace bbtk // Save temporary diagram as BBG void saveTempDiagram(); + // Save temporary diagram as BBG and update buttons + void saveTempandUpdate(); + // Load BBG diagram void loadDiagram(ifstream &inputStream, const std::string &path); //DFCH diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx index 14f8531..a7a7052 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx @@ -151,6 +151,12 @@ printf("EED wxTabPanelsManager::addNewTab 1\n"); { _actual->loadDiagram(inputStream, path); } + + //========================================================================= + void wxTabPanelsManager::saveTempandUpdate() //FCY + { + _parent->SaveTempActualDiagram(); + } //========================================================================= void wxTabPanelsManager::saveTempActualDiagram() //FCY { diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h index a42f05e..e859022 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h @@ -90,6 +90,7 @@ namespace bbtk void loadDiagram(ifstream &inputStream, const std::string &path); //DFCH void saveTempActualDiagram(); //FCY + void saveTempandUpdate(); void loadTempDiagram(unsigned short un); //FCY unsigned short getUndoState(); unsigned short getRedoState(); diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index 2acf1d7..c8270fb 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -61,7 +61,6 @@ wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent, printf( "RaC-EED 21-06-2010 %p wxVtkSceneManager::wxVtkSceneManager If you comment this line, the drag and drop functionnality is not initialized.\n", this); - //#ifdef __APPLE__ _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget((wxDropTarget*)parent); //#endif @@ -1214,7 +1213,7 @@ void wxVtkSceneManager::deleteObject(int id) { _controllers.erase(it); }//if }// for - _parent->saveTempDiagram(); + _parent->saveTempandUpdate(); } //========================================================================= -- 2.47.1