]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
#3259 Export Format Python and JavaScript
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
index 02c8c3f1d0e70f91667a081101e9430018bc82e3..48f80b994cc648b58a4aade2a10a3e91a570c30a 100644 (file)
@@ -107,7 +107,7 @@ wxGUIEditorGraphicBBS::wxGUIEditorGraphicBBS(wxFrame *parent)
        /////////////////////////////////
        /// IMPORTANT!! FOR SAVE&LOAD PROCESSES THE VERSION IS VERY IMPORTANT.
        /// RaC 2012 2nd Hackfest
-       _currentBBGversion="1.5";
+       _currentBBGversion="1.6";
 }
 
 //=========================================================================
@@ -948,7 +948,6 @@ void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event) {
        } else {
                std::string pathfilenamebbs = pathfilename;
                pathfilenamebbs[pathfilenamebbs.length() - 1] = 's';
-               
                if (_tabsMgr->isActualDiagramComplexBox() == false) {
                        std::string name = _tabsMgr->GetNameTabPanel();
                        if(name[name.length() - 1] == '*')
@@ -963,17 +962,23 @@ void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event) {
                        SaveActualDiagram(pathfilename);
                        SaveActualComplexBox(pathfilenamebbs);
                } //if isActualDiagramComplexBox
-        std::string pathfilenamepy = pathfilenamebbs;
-        pathfilenamepy.replace( pathfilenamepy.length()-3, 3 , "py");
-        std::string cmdPy("source ~/.bashrc;  bbs2 "+pathfilenamebbs+" "+pathfilenamepy);
-        printf("EED wxGUIEditorGraphicBBS::OnSaveActualDiagram cmd:%s\n", cmdPy.c_str() );
-        system( cmdPy.c_str() );
-        std::string pathfilenamejs = pathfilenamebbs;
-        pathfilenamejs.replace( pathfilenamejs.length()-3, 3 , "js");
-        std::string cmdjs("source ~/.bashrc;  bbs2 "+pathfilenamebbs+" "+pathfilenamejs);
-        printf("EED wxGUIEditorGraphicBBS::OnSaveActualDiagram cmd:%s\n", cmdjs.c_str() );
-        system( cmdjs.c_str() );
-       }
+        if ((getCurrentDiagramExportFormat()==1) || (getCurrentDiagramExportFormat()==2) ) // 1:All 2:bbs,Python
+        {
+            std::string pathfilenamepy = pathfilenamebbs;
+            pathfilenamepy.replace( pathfilenamepy.length()-3, 3 , "py");
+            std::string cmdPy("source ~/.bashrc;  bbs2 "+pathfilenamebbs+" "+pathfilenamepy);
+            printf("EED wxGUIEditorGraphicBBS::OnSaveActualDiagram cmd:%s\n", cmdPy.c_str() );
+            system( cmdPy.c_str() );
+        } // ExportFormat 1 or 2  All and Python
+        if ((getCurrentDiagramExportFormat()==1) || (getCurrentDiagramExportFormat()==3) ) // 1:All 3:bbs,JavaScript
+        {
+            std::string pathfilenamejs = pathfilenamebbs;
+            pathfilenamejs.replace( pathfilenamejs.length()-3, 3 , "js");
+            std::string cmdjs("source ~/.bashrc;  bbs2 "+pathfilenamebbs+" "+pathfilenamejs);
+            printf("EED wxGUIEditorGraphicBBS::OnSaveActualDiagram cmd:%s\n", cmdjs.c_str() );
+            system( cmdjs.c_str() );
+        } // ExportFormat 1 or 3  All and JavaScript
+       } // if pathfilename empty
 }
 //=========================================================================
 //DFCH
@@ -1481,6 +1486,12 @@ void wxGUIEditorGraphicBBS::setCurrentDiagramAuthor(std::string author)
        _tabsMgr->SetAuthor(author);
 }
 
+//=========================================================================
+void wxGUIEditorGraphicBBS::setCurrentDiagramExportFormat(int exportformat)
+{
+    _tabsMgr->SetExportFormat( exportformat );
+}
+
 //=========================================================================
 void wxGUIEditorGraphicBBS::setCurrentDiagramCategory(std::string category)
 {
@@ -1509,6 +1520,12 @@ std::string wxGUIEditorGraphicBBS::getCurrentDiagramAuthor()
        return _tabsMgr->GetAuthor();
 }
 
+//=========================================================================
+int wxGUIEditorGraphicBBS::getCurrentDiagramExportFormat()
+{
+    return _tabsMgr->GetExportFormat();
+}
+
 //=========================================================================
 std::string wxGUIEditorGraphicBBS::getCurrentDiagramCategory()
 {