]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
Compilation problems corrections:
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
index 209007fc096074a549d862dc95c03921dcb5c862..5b0be798037c2b4f924af29e418ff00baedb7366 100644 (file)
@@ -69,8 +69,8 @@ wxGUIEditorGraphicBBS::wxGUIEditorGraphicBBS(wxFrame *parent) :
        initToolbar();
        initTabPanelsManager();
        initPackageBrowser();
-       initHelpHTMLBrowser();
-
+        // JGGR & CM  initHelpHTMLBrowser();
+        _helpHtmlBrowser = NULL;
        CreateStatusBar();
        _frameAUIMgr->Update();
        _actualPkgBrowserBoxName = "";
@@ -147,14 +147,15 @@ 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);
 
        
        // connect command event handlers
+
        Connect(ID_NEW, wxEVT_COMMAND_TOOL_CLICKED,
                        wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
        Connect(ID_OPEN, wxEVT_COMMAND_TOOL_CLICKED,
@@ -189,15 +190,15 @@ 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() {
-       //TO FIX THE PATH OF BBTK BIN  IN ORDER TO USE REGENERATE EXECUTABLES
-       //RegenerateAll();
+       // JGRR & CM 
        _helpHtmlBrowser = new WxGUIHtmlBrowser(this, wxSize(200, 0));
-       _frameAUIMgr->AddPane(_helpHtmlBrowser, wxAuiPaneInfo().Right().MinSize(
-                       200, 200));
+   
+       // EO JGRR & CM 
+       
 }
 
 //=========================================================================
@@ -482,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(wxString (name.c_str(), wxConvUTF8));
+       }
+
+       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) {
@@ -651,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(wxString (name.c_str(), wxConvUTF8));
        _tabsMgr->saveTempActualDiagram();
 }
 
@@ -695,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);
@@ -731,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 {
@@ -893,10 +915,21 @@ void wxGUIEditorGraphicBBS::OnPlugPackage(wxCommandEvent& event) {
 //=========================================================================
 void wxGUIEditorGraphicBBS::OnEditConfig(wxCommandEvent& event) {
        printf("EED wxGUIEditorGraphicBBS::OnEditConfig ... not implemented ..\n");
-}
-//=========================================================================
-void wxGUIEditorGraphicBBS::OnShowHTMLDoc(wxCommandEvent& event) {
-       printf("EED wxGUIEditorGraphicBBS::OnShowHTMLDoc ... not implemented ..\n");
+    }
+    //=========================================================================
+
+    void wxGUIEditorGraphicBBS::OnShowHTMLDoc(wxCommandEvent& event) {
+        // JGRR & CM WH
+        if (_helpHtmlBrowser != NULL){
+             _frameAUIMgr->DetachPane(_helpHtmlBrowser);
+            _helpHtmlBrowser->Destroy();   
+        }
+        initHelpHTMLBrowser();
+        _frameAUIMgr->AddPane(_helpHtmlBrowser, wxAuiPaneInfo().Right().MinSize(200, 200));
+        _frameAUIMgr->Update();
+        refreshGUIControls();
+        
+        // EO JGRR    & CM WH       
 }
 //=========================================================================
 void wxGUIEditorGraphicBBS::OnCreateIndex(wxCommandEvent& event) {
@@ -909,6 +942,8 @@ void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event) {
        Close(true);
 }
 
+
+
 //=========================================================================
 
 } // EO namespace bbtk