]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
This commit was manufactured by cvs2svn to create tag
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
index f24749f35c9ff1b69dd4bbe700c4696074c601bc..7addacf59c6dcee36929bfb443724a19933733fe 100644 (file)
@@ -39,6 +39,8 @@ Version:   $Revision$
 
 #include <InterpreterBBS.h>
 
+
+
 namespace bbtk
 {
 
@@ -89,10 +91,6 @@ namespace bbtk
 //EED02JUIN2010                delete _tabsMgr;
 
            _frameAUIMgr->UnInit();
-               // FCY memory leaks
-               delete _frameAUIMgr;
-               delete _notebook;
-               delete _tabsMgr;
 
 
        }
@@ -116,8 +114,7 @@ namespace bbtk
                //Adds a tool btn to the toolbar
                toolbar->AddTool(ID_NEW,_T("New"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New tab"), _T("Create a new panel tab"));
                toolbar->AddTool(ID_OPEN,_T("Open diagram"),bmp_open, wxNullBitmap, wxITEM_NORMAL,_T("Open a diagram"), _T("Open a diagram"));
-               toolbar->AddTool(ID_SAVE_DIAGRAM,_T("Save Diagram"),bmp_save, wxNullBitmap, wxITEM_NORMAL,_T("Saves the current diagram"), _T("Saves the current diagram")); //DFCH
-               //toolbar->AddTool(ID_SAVE_AS_DIAGRAM,_T("Save Diagram As"),bmp_save, wxNullBitmap, wxITEM_NORMAL,_T("Saves the current diagram"), _T("Saves the current diagram")); //DFCH
+               toolbar->AddTool(ID_SAVE_AS_DIAGRAM,_T("Save diagram"),bmp_save, wxNullBitmap, wxITEM_NORMAL,_T("Saves actual diagram"), _T("Saves actual diagram"));
                toolbar->AddTool(ID_RUN,_T("Run"),bmp_run, wxNullBitmap, wxITEM_NORMAL,_T("Execute actual diagram"), _T("Execute actual diagram"));
                toolbar->AddTool(ID_DELETEALL,_T("Delete all"),bmp_delete, wxNullBitmap, wxITEM_NORMAL,_T("Delete all boxes"), _T("Delete all boxes"));
                toolbar->AddTool(ID_CENTERVIEW,_T("Center view"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Center view"), _T("Center view"));
@@ -138,8 +135,7 @@ namespace bbtk
                // connect command event handlers
                Connect(ID_NEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
                Connect(ID_OPEN,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenDiagram));
-               Connect(ID_SAVE_DIAGRAM,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram)); //DFCH
-               Connect(ID_SAVE_AS_DIAGRAM,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveAsActualDiagram)); //DFCH
+               Connect(ID_SAVE_AS_DIAGRAM,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram));
                Connect(ID_RUN,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram));
                Connect(ID_DELETEALL,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram));
                Connect(ID_CENTERVIEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram));
@@ -164,16 +160,14 @@ namespace bbtk
                // Create File menu and its items
                wxMenu *fileMenu = new wxMenu();
                fileMenu->Append(ID_NEW, _T("New diagram"), _T("New"));
-               fileMenu->Append(ID_SAVE_DIAGRAM, _T("Save Diagram"), _T("Save Diagram")); //DFCH
-               fileMenu->Append(ID_SAVE_AS_DIAGRAM, _T("Save Diagram As"), _T("Save Diagram As")); //DFCH
+               fileMenu->Append(ID_SAVE_AS_DIAGRAM, _T("Save diagram"), _T("Save diagram"));
                fileMenu->Append(ID_OPEN_BBS, _T("Open BBS"), _T("Open BBS"));
                fileMenu->Append(ID_SAVE_AS_BBS, _T("Save BBS"), _T("Save BBS"));
                fileMenu->Append(ID_SAVE_AS_COMPLEXBOX, _T("Save complex box"), _T("Save complex box"));
                fileMenu->Append(wxID_EXIT, _T("E&xit"), _T("Exit"));
 
                Connect(ID_NEW,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
-               Connect(ID_SAVE_DIAGRAM,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram)); //DFCH
-               Connect(ID_SAVE_AS_DIAGRAM,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveAsActualDiagram));
+               Connect(ID_SAVE_AS_DIAGRAM,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram));
                Connect(ID_OPEN_BBS,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenBBS));
                Connect(ID_SAVE_AS_BBS,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualBBS));
                Connect(ID_SAVE_AS_COMPLEXBOX,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualComplexBox));
@@ -354,27 +348,25 @@ namespace bbtk
 
        void wxGUIEditorGraphicBBS::executeScript(std::string script)
        {
-               std::string separator   = ConfigurationFile::GetInstance().Get_file_separator ();
-               std::string dir                 = ConfigurationFile::GetInstance().Get_default_temp_dir();
-               std::string filename    = dir + separator + "tmp_bbtk.bbs";
+               std::string separator = ConfigurationFile::GetInstance().Get_file_separator ();
+               std::string dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
+               std::string filename = dir + separator + "tmp_bbtk.bbs";
 
                ofstream tempFile;
                tempFile.open(filename.c_str());
                tempFile << script;
                tempFile.close();
 
-               std::string command = "";
-
-               #ifdef WIN32
-                       command += "\"";
-               #endif
-               command += "\""+ crea::System::GetExecutablePath();
+               std::string command = "\""+ crea::System::GetExecutablePath();
 
 
 #ifdef MACOSX
                command += separator + "../../../bbi.app/Contents/MacOS";
 #endif
 
+               #ifdef WIN32
+                       command += "\"";
+               #endif
 
                /*
 
@@ -396,9 +388,7 @@ namespace bbtk
                        command += "\"";
                #endif
 
-        #ifndef WIN32
-            command += " & ";
-               #endif
+               command += " & ";
 
                printf ("RaC wxGUIEditorGraphicBBS::executeScript %s \n" , command.c_str() );
                system( command.c_str() );
@@ -572,20 +562,20 @@ namespace bbtk
         file.close();
     }
 
+
        //=========================================================================
-       
-       //The following method allows to save the current diagram asking the filename
-       //DFCH
-       void wxGUIEditorGraphicBBS::SaveCurrentDiagramAs( )
+       void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event)
        {
-               wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save current diagram"),wxEmptyString,wxT("NewDiagram"),wxT("*.bbg"),wxSAVE|wxOVERWRITE_PROMPT);
+               wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save  actual diagram"),wxEmptyString,wxT("NewDiagram"),wxT("*.bbg"),wxSAVE|wxOVERWRITE_PROMPT);
                if (saveFileDialog->ShowModal() == wxID_OK)
                {
-                       _tabsMgr->SetNameTabPanel( saveFileDialog->GetFilename() );
+            _tabsMgr->SetNameTabPanel( saveFileDialog->GetFilename() );
+
                        wxString pathfileName       = saveFileDialog->GetPath();
                        std::string pathfilename    = (const char*) (pathfileName.mb_str());
             std::string pathfilenamebbs = pathfilename;
             pathfilenamebbs[pathfilenamebbs.length()-1]='s';
+
             if (_tabsMgr->isActualDiagramComplexBox()==false)
             {
                 SaveActualDiagram( pathfilename );
@@ -597,37 +587,7 @@ namespace bbtk
             } //if isActualDiagramComplexBox
                } // if saveFileDialog
        }
-       //=========================================================================
-       //DFCH
-       void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event)
-       {
-               std::string pathfilename = _tabsMgr->GetCurrentTabPanelPath();
-               if( pathfilename.empty() )
-               {
-                       SaveCurrentDiagramAs();
-               }
-               else
-               {
-                       std::string pathfilenamebbs = pathfilename;
-            pathfilenamebbs[pathfilenamebbs.length()-1]='s';
 
-            if (_tabsMgr->isActualDiagramComplexBox()==false)
-            {
-                SaveActualDiagram( pathfilename );
-                SaveActualBBS(pathfilenamebbs);
-            } else {
-                AskComplexBoxConfiguration();
-                SaveActualDiagram( pathfilename );
-                SaveActualComplexBox(pathfilenamebbs);
-            } //if isActualDiagramComplexBox
-               }               
-       }
-       //=========================================================================
-       //DFCH
-       void wxGUIEditorGraphicBBS::OnSaveAsActualDiagram(wxCommandEvent& event)
-       {
-               SaveCurrentDiagramAs();
-       }
        //=========================================================================
 
        void wxGUIEditorGraphicBBS::refreshGUIControls()