]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
Documentation panel on the right of bbEditor as a menu option, for lake of use.
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
index d9a00b955053d7412eef47ef55078cc77b84f2e2..bf26a19399977d21321a5aa5325c7d5a6000586a 100644 (file)
@@ -69,8 +69,8 @@ wxGUIEditorGraphicBBS::wxGUIEditorGraphicBBS(wxFrame *parent) :
        initToolbar();
        initTabPanelsManager();
        initPackageBrowser();
-       initHelpHTMLBrowser();
-
+        // JGGR & CM  initHelpHTMLBrowser();
+        _helpHtmlBrowser = NULL;
        CreateStatusBar();
        _frameAUIMgr->Update();
        _actualPkgBrowserBoxName = "";
@@ -155,6 +155,7 @@ void wxGUIEditorGraphicBBS::initToolbar() {
 
        
        // connect command event handlers
+
        Connect(ID_NEW, wxEVT_COMMAND_TOOL_CLICKED,
                        wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
        Connect(ID_OPEN, wxEVT_COMMAND_TOOL_CLICKED,
@@ -193,11 +194,11 @@ void wxGUIEditorGraphicBBS::initToolbar() {
 }
 //=========================================================================
 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 
+       
 }
 
 //=========================================================================
@@ -462,16 +463,12 @@ void wxGUIEditorGraphicBBS::executeScript(std::string script) {
 
 //=========================================================================
 std::string wxGUIEditorGraphicBBS::CheckExtension(std::string filename, std::string extension) {
-        if(extension.size() != 4){
-                printf("CheckExtension Warning! Extension size != 4\n");
-        }else{
-                if(filename.size() > 4){
-                        if( (filename.compare(filename.size()-4,4,extension)) !=0 ){
-                                filename.append(extension);
-                        }
-                }else{
-                                filename.append(extension);
+        if(filename.size() > extension.size() ){
+                if( (filename.compare(filename.size()-extension.size(), extension.size(),extension)) !=0 ){
+                        filename.append(extension);
                 }
+        }else{
+                filename.append(extension);
         }
        return filename;
 }
@@ -771,9 +768,10 @@ void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event) {
                wxString fileName = openFileDialog->GetPath();
                ifstream inputStream;
                std::string fName = (const char*) (fileName.mb_str());
+
                inputStream.open(fName.c_str());
+               assert(inputStream.good()); // fails
                _tabsMgr->addNewTab(openFileDialog->GetFilename());
-
                _tabsMgr->loadDiagram(inputStream, fName);
 
                inputStream.close();
@@ -896,10 +894,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) {
@@ -912,6 +921,8 @@ void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event) {
        Close(true);
 }
 
+
+
 //=========================================================================
 
 } // EO namespace bbtk