]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
no message
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
index c0892ab522855bebcf1a574512b952a8ee03b38a..4acbbd84e0d2bbc3884d092a2b85c5c0c01803a3 100644 (file)
@@ -39,8 +39,6 @@ Version:   $Revision$
 
 #include <InterpreterBBS.h>
 
-
-
 namespace bbtk
 {
 
@@ -91,6 +89,10 @@ namespace bbtk
 //EED02JUIN2010                delete _tabsMgr;
 
            _frameAUIMgr->UnInit();
+               // FCY memory leaks
+               delete _frameAUIMgr;
+               delete _notebook;
+               delete _tabsMgr;
 
 
        }
@@ -105,6 +107,7 @@ namespace bbtk
                wxBitmap bmp_delete(delete_xpm);
                wxBitmap bmp_centerview(centerview_xpm);
                wxBitmap bmp_box(box_xpm);
+               wxBitmap bmp_executablebox(executablebox_xpm);
                wxBitmap bmp_complexbox(complexbox_xpm);
                wxBitmap bmp_complexinputport(complexinputport_xpm);
                wxBitmap bmp_complexoutputport(complexoutputport_xpm);
@@ -114,13 +117,16 @@ 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_AS_DIAGRAM,_T("Save diagram"),bmp_save, wxNullBitmap, wxITEM_NORMAL,_T("Saves actual diagram"), _T("Saves actual 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_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"));
                toolbar->AddSeparator();
                toolbar->AddTool(ID_BTNBOX,_T("New Box"),bmp_box, wxNullBitmap, wxITEM_NORMAL,_T("New Box"), _T("Nex Box"));
                toolbar->AddSeparator();
+               toolbar->AddTool(ID_BTEXECUTABLEBOX,_T("Select as executable Box"),bmp_executablebox, wxNullBitmap, wxITEM_NORMAL,_T("Select as executable Box"), _T("Select as executable Box"));
+               toolbar->AddSeparator();
                toolbar->AddTool(ID_BTNCOMPLEXBOX,_T("Complex box"),complexbox_xpm, wxNullBitmap, wxITEM_NORMAL,_T("Complex box"), _T("Complex box"));
                toolbar->SetToggle(ID_BTNCOMPLEXBOX,true);
                toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT,_T("Add input to Complex box"),bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,_T("Add input to Complex box"), _T("Add input to Complex box"));
@@ -135,11 +141,13 @@ 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_AS_DIAGRAM,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram));
+               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_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));
                Connect(ID_BTNBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnBox));
+               Connect(ID_BTEXECUTABLEBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnExecutableBox));
                Connect(ID_BTNCOMPLEXBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnComplexBox));
                Connect(ID_ADDCOMPLEXBOXINPUT,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxInput));
                Connect(ID_ADDCOMPLEXBOXOUTPUT,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxOutput));
@@ -160,14 +168,16 @@ 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_AS_DIAGRAM, _T("Save diagram"), _T("Save diagram"));
+               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_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_AS_DIAGRAM,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram));
+               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_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));
@@ -182,12 +192,31 @@ namespace bbtk
                // Create Help menu and its items
                wxMenu *helpMenu = new wxMenu;
                helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About"));
-
+               helpMenu->Append(ID_HELP_BBEDITOR, _T("&Help..."), _T("Help"));
+               Connect(ID_HELP_BBEDITOR,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnHelpBBeditor));
+
+               // Create Tool menu
+               wxMenu *menuTools = new wxMenu;
+               menuTools->Append( ID_bbEditor_Tool_Menu_CreatePackage, _T("Create &package") );
+               menuTools->Append( ID_bbEditor_Tool_Menu_CreateBlackBox, _T("Create &blackbox") );
+               menuTools->Append( ID_bbEditor_Tool_Menu_PlugPackage, _T("Plug package") );
+               menuTools->Append( ID_bbEditor_Tool_Menu_EditConfig, _T("&Edit bbtk config") );
+               menuTools->Append( ID_bbEditor_Tool_Menu_ShowHTMLDoc, _T("Show &HTML documentation") );
+               menuTools->Append( ID_bbEditor_Tool_Menu_CreateIndex, _T("&Generate index") );
+               
+               Connect(ID_bbEditor_Tool_Menu_CreatePackage,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreatePackage));
+               Connect(ID_bbEditor_Tool_Menu_CreateBlackBox,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateBlackBox));
+               Connect(ID_bbEditor_Tool_Menu_PlugPackage,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnPlugPackage));
+               Connect(ID_bbEditor_Tool_Menu_EditConfig,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditConfig));
+               Connect(ID_bbEditor_Tool_Menu_ShowHTMLDoc,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnShowHTMLDoc));
+               Connect(ID_bbEditor_Tool_Menu_CreateIndex,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateIndex));
+               
                // Append the created menu to the menu bar
                wxMenuBar *menuBar = new wxMenuBar();
-               menuBar->Append(fileMenu, _T("&File"));
-               menuBar->Append(editMenu, _T("&Edit"));
-               menuBar->Append(helpMenu, _T("&Help"));
+               menuBar->Append( fileMenu,      _T("&File") );
+               menuBar->Append( editMenu,      _T("&Edit") );
+               menuBar->Append( menuTools,     _T("&Tool") );
+               menuBar->Append( helpMenu,      _T("&Help") );
 
                // Attach this menu bar to the frame
                SetMenuBar(menuBar);
@@ -346,25 +375,27 @@ 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 = "\""+ crea::System::GetExecutablePath();
-
-
-#ifdef MACOSX
-               command += separator + "../../../bbi.app/Contents/MacOS";
+               std::string command = "";
+               
+#ifdef WIN32
+               command += "start /b ";
 #endif
+               
+               
+//             command += "\""+ crea::System::GetExecutablePath();
+//#ifdef MACOSX
+//             command += separator + "../../../bbi.app/Contents/MacOS";
+//#endif
 
-               #ifdef WIN32
-                       command += "\"";
-               #endif
 
                /*
 
@@ -380,13 +411,22 @@ namespace bbtk
                        command += separator + "bbi\" ";
                #endif
  */
-               command += separator + "bbi\" ";
+               
+//#ifndef WIN32
+//             command += separator;
+//#endif
+               
+               
+               command +=  "bbi ";
                command += "\""+filename + "\"";
-               #ifdef WIN32
-                       command += "\"";
-               #endif
+               
+//             #ifdef WIN32
+//                     command += "\"";
+//             #endif
 
-               command += " & ";
+        #ifndef WIN32
+            command += " & ";
+               #endif
 
                printf ("RaC wxGUIEditorGraphicBBS::executeScript %s \n" , command.c_str() );
                system( command.c_str() );
@@ -426,7 +466,7 @@ namespace bbtk
                        wxString fileName = openFileDialog->GetPath(  );
 
 
-                       _tabsMgr->addNewTab();
+                       _tabsMgr->addNewTab(  openFileDialog->GetFilename()  );
 
                        bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New( this->_tabsMgr->getActualTabPanel()->getSceneManager() , _pkgBrowser->GetFactory());
 
@@ -438,102 +478,184 @@ namespace bbtk
                refreshGUIControls();
        }
 
+
+
+    void wxGUIEditorGraphicBBS::SaveActualBBS(std::string filename)
+       {
+        ofstream file;
+
+//EED          file.open(fileName.c_str());
+        file.open( filename.c_str() );
+        std::string content="";
+        // writing file header
+        content += "# ----------------------------------\n";
+        content += "# - BBTKGEditor v 1.2 BBS BlackBox Script\n";
+        content += "# - ";
+        content += filename;
+        content += "\n";
+        content += "# ----------------------------------\n";
+        content += "\n";
+        content += _tabsMgr->getActualDiagramBBS();
+        file << content;
+        file.close();
+       }
+
+
        void wxGUIEditorGraphicBBS::OnSaveActualBBS(wxCommandEvent& event)
        {
                wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save  actual BBS"),wxEmptyString,wxT("NewBBS"),wxT("*.bbs"),wxSAVE|wxOVERWRITE_PROMPT);
                if (saveFileDialog->ShowModal() == wxID_OK)
                {
                        wxString fileName = saveFileDialog->GetPath(  );
+            SaveActualBBS( (const char*) (fileName.mb_str())  );
+               }
 
-                       ofstream file;
-
-//EED                  file.open(fileName.c_str());
-                       file.open( (const char*) (fileName.mb_str()) );
+       }
 
-                       std::string content="";
 
-                       // writing file header
-                       content += "# ----------------------------------\n";
-                       content += "# - BBTKGEditor v 1.1 BBS BlackBox Script\n";
-                       content += "# ----------------------------------\n";
-                       content += "\n";
-                       content += _tabsMgr->getActualDiagramBBS();
-                       file << content;
-                       file.close();
-               }
+    void wxGUIEditorGraphicBBS::AskComplexBoxConfiguration()
+    {
+               std::string cbName = _tabsMgr->GetCbName();
+               std::string paName = _tabsMgr->GetCbPackageName();
 
-       }
+               wxTextEntryDialog *cbNameDialog = new wxTextEntryDialog(this,wxT("Complex Box name"));
+               wxTextEntryDialog *paNameDialog = new wxTextEntryDialog(this,wxT("Package name"));
 
-       //=========================================================================
+               cbNameDialog->SetValue( wxString(cbName.c_str(),wxConvUTF8) );
+               paNameDialog->SetValue( wxString(paName.c_str(),wxConvUTF8) );
 
-       void wxGUIEditorGraphicBBS::OnSaveActualComplexBox(wxCommandEvent& event)
-       {
-               wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,wxT("Name of complex box"));
-               std::string cbName="";
-               if (nameDialog->ShowModal() == wxID_OK)
+               if (cbNameDialog->ShowModal() == wxID_OK)
                {
-                       wxString fileName = nameDialog->GetValue();
-                       cbName=(const char*) (fileName.mb_str());
+                       wxString complexboxname = cbNameDialog->GetValue();
+                       cbName=(const char*) (complexboxname.mb_str());
                }
 
-               if(!cbName.empty())
-               {
-                       wxFileDialog * saveFileDialog = new wxFileDialog(this ,wxT("Save Complex Box BBS") ,wxEmptyString, wxString( cbName.c_str(), wxConvUTF8),wxT("*.bbs"), wxSAVE | wxOVERWRITE_PROMPT);
-                       if (saveFileDialog->ShowModal() == wxID_OK)
-                       {
-                               wxString fileName = saveFileDialog->GetPath();
 
-                               ofstream file;
-                               file.open( (const char*) (fileName.mb_str()) );
+               if (paNameDialog->ShowModal() == wxID_OK)
+               {
+                       wxString packagename = paNameDialog->GetValue();
+                       paName=(const char*) (packagename.mb_str());
+               }
 
-                               std::string content="";
+        _tabsMgr->SetCbName(cbName);
+        _tabsMgr->SetCbPackageName(paName);
+    }
 
-                               // writing file header
-                               content += "# ----------------------------------\n";
-                               content += "# - BBTKGEditor v 1.1 BBS BlackBox Script (Complex Box)\n";
-                               content += "# ----------------------------------\n";
-                               content += "\n";
-                               content += _tabsMgr->getActualComplexBoxBBS(cbName);
-                               file << content;
-                               file.close();
-                       }
-               }
+       //=========================================================================
 
+       void wxGUIEditorGraphicBBS::SaveActualComplexBox(std::string filename)
+       {
+        ofstream file;
+        file.open( filename.c_str() );
+
+        std::string content="";
+
+        // writing file header
+        content += "# ----------------------------------\n";
+        content += "# - BBTKGEditor v 1.2 BBS BlackBox Script (Complex Box)\n";
+        content += "# - ";
+        content += filename;
+        content += "\n";
+        content += "# ----------------------------------\n";
+        content += "\n";
+        content += _tabsMgr->getActualComplexBoxBBS();
+        file << content;
+        file.close();
        }
 
        //=========================================================================
 
-       void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event)
+       void wxGUIEditorGraphicBBS::OnSaveActualComplexBox(wxCommandEvent& event)
        {
-               wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save  actual diagram"),wxEmptyString,wxT("NewDiagram"),wxT("*.bbg"),wxSAVE|wxOVERWRITE_PROMPT);
-               if (saveFileDialog->ShowModal() == wxID_OK)
-               {
-                       wxString fileName = saveFileDialog->GetPath();
+        wxFileDialog * saveFileDialog = new wxFileDialog(this ,wxT("Save Complex Box BBS") ,wxEmptyString, _T("ComplexBoxName") ,wxT("*.bbs"), wxSAVE | wxOVERWRITE_PROMPT);
+        if (saveFileDialog->ShowModal() == wxID_OK)
+        {
+            wxString fileName = saveFileDialog->GetPath();
+            SaveActualComplexBox( (const char*) (fileName.mb_str()) );
+        }
+       }
 
-                       ofstream file;
-                       file.open( (const char*) (fileName.mb_str()) );
+       //=========================================================================
+       void wxGUIEditorGraphicBBS::SaveActualDiagram(std::string filename)
+       {
+        ofstream file;
+        file.open( filename.c_str() );
 
-                       std::string content="";
+        std::string content="";
 
-                       // writing file header
-                       content += "# ----------------------------------\n";
-                       content += "# - BBTKGEditor v 1.1 BBG BlackBox Diagram file\n";
-                       content += "# - ";
+        // writing file header
+        content += "# ----------------------------------\n";
+        content += "# - BBTKGEditor v 1.2 BBG BlackBox Diagram file\n";
+        content += "# - ";
 
-                       content += (const char*) (fileName.mb_str());
+        content += filename;
 
-                       content += "\n";
-                       content += "# ----------------------------------\n";
-                       content += "\n";
-                       content += "APP_START\n";
-                       _tabsMgr->saveActualDiagram(content);
-                       content += "APP_END\n";
-                       file << content;
-                       file.close();
-               }
+        content += "\n";
+        content += "# ----------------------------------\n";
+        content += "\n";
+        content += "APP_START\n";
+        _tabsMgr->saveActualDiagram(content, filename); //DFCH
+        content += "APP_END\n";
+        file << content;
+        file.close();
+    }
 
+       //=========================================================================
+       
+       //The following method allows to save the current diagram asking the filename
+       //DFCH
+       void wxGUIEditorGraphicBBS::SaveCurrentDiagramAs( )
+       {
+               wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save current diagram"),wxEmptyString,wxT("NewDiagram"),wxT("*.bbg"),wxSAVE|wxOVERWRITE_PROMPT);
+               if (saveFileDialog->ShowModal() == wxID_OK)
+               {
+                       _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 );
+                SaveActualBBS(pathfilenamebbs);
+            } else {
+                AskComplexBoxConfiguration();
+                SaveActualDiagram( pathfilename );
+                SaveActualComplexBox(pathfilenamebbs);
+            } //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()
@@ -590,23 +712,18 @@ namespace bbtk
 
        //=========================================================================
 
-
        void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event)
        {
                wxFileDialog * openFileDialog = new wxFileDialog(this,wxT("Open diagram"),wxEmptyString,wxT(""),wxT("*.bbg"),wxOPEN|wxFILE_MUST_EXIST);
                if (openFileDialog->ShowModal() == wxID_OK)
                {
                        wxString fileName = openFileDialog->GetPath();
-
                        ifstream inputStream;
+                       std::string fName=(const char*) (fileName.mb_str());
+                       inputStream.open( fName.c_str() );
+                       _tabsMgr->addNewTab( openFileDialog->GetFilename() );
 
-//EED                  inputStream.open(fileName.c_str());
-                       inputStream.open( (const char*) (fileName.mb_str()) );
-
-
-
-                       _tabsMgr->addNewTab();
-                       _tabsMgr->loadDiagram(inputStream);
+                       _tabsMgr->loadDiagram(inputStream, fName);
 
                        inputStream.close();
                }
@@ -618,8 +735,7 @@ namespace bbtk
 
        void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event)
        {
-
-               BlackBoxDescriptor      *bbDes          = _pkgBrowser->GetActualSelected();
+               BlackBoxDescriptor      *bbDes = _pkgBrowser->GetActualSelected();
         if (bbDes!=NULL)
         {
             std::string                        typeName        = bbDes->GetTypeName();
@@ -639,6 +755,12 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxGUIEditorGraphicBBS::OnClickBtnExecutableBox(wxCommandEvent& event)
+       {
+               printf("EED  wxGUIEditorGraphicBBS::OnClickBtnExecutableBox  .... not implemented ...\n");
+       }
+       
+       //=========================================================================
 
        void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event)
        {
@@ -694,6 +816,49 @@ namespace bbtk
                _tabsMgr->copySelectedBBoxesToComplexDiagram();
        }
 
+
+       void wxGUIEditorGraphicBBS::OnHelpBBeditor(wxCommandEvent& event)
+       {
+               printf("wxGUIEditorGraphicBBS::OnHelpBBeditor ....not implemented..\n");
+       }
+
+
+       //=========================================================================     
+       void wxGUIEditorGraphicBBS::OnCreatePackage(wxCommandEvent& event)
+       {
+               printf("EED wxGUIEditorGraphicBBS::OnCreatePackag ... not implemented ..\n");
+       }
+       
+
+       //=========================================================================     
+       void wxGUIEditorGraphicBBS::OnCreateBlackBox(wxCommandEvent& event)
+       {
+               printf("EED wxGUIEditorGraphicBBS::OnCreateBlackBox ... not implemented ..\n");
+       }
+       //=========================================================================     
+       void wxGUIEditorGraphicBBS::OnPlugPackage(wxCommandEvent& event)
+       {
+               printf("EED wxGUIEditorGraphicBBS::OnPlugPackage ... not implemented ..\n");
+       }
+       //=========================================================================     
+       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::OnCreateIndex(wxCommandEvent& event)
+       {
+               printf("EED wxGUIEditorGraphicBBS::OnCreateIndex ... not implemented ..\n");
+       }
+       
+       
+       
+
        //=========================================================================
 
        void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event)
@@ -701,6 +866,8 @@ namespace bbtk
                Close(true);
        }
 
+
+
        //=========================================================================
 
 }  // EO namespace bbtk