]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
Feature #1380
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
index d3a0cd37e4ccc2833d33c4f930fcd0c83de47079..4fb42dbdafb20feab9362ca47ff96ae116f06d49 100644 (file)
@@ -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));
 }
 
 //=========================================================================
@@ -754,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);
@@ -771,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);
@@ -815,7 +834,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();
@@ -841,7 +860,7 @@ void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event) {
                        scn->refresh();
                }
 
-               SaveTempActualDiagram();
+               SaveTempActualDiagram("New Box");
                // if pnl
        }// if bbDes
 }
@@ -918,12 +937,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) {