]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
The actual version works with complex box automatic generated from selected boxes...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
index 376db524ed548aef9142b2164c4d26e68206d7b3..9ae550037204019836da7a6f13ac26f9719733de 100644 (file)
@@ -141,7 +141,7 @@ namespace bbtk
        //=========================================================================
        void wxGUIEditorGraphicBBS::initMenu()
        {
-               // create a menu bar
+               // 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"));
@@ -155,16 +155,23 @@ namespace bbtk
                Connect(ID_SAVE_AS_COMPLEXBOX,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualComplexBox));
                Connect(wxID_EXIT,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExit));
 
-               // the "About" item should be in the help menu
+               // Create Help menu and its items
+               wxMenu *editMenu = new wxMenu;
+               editMenu->Append(ID_COPY_TO_COMPLEXDIAGRAM, _T("Copy selected to complex box"), _T("Creates a new complex box diagram with selected boxes"));   
+
+               Connect(ID_COPY_TO_COMPLEXDIAGRAM,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram));
+
+               // Create Help menu and its items
                wxMenu *helpMenu = new wxMenu;
                helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About"));             
 
-               // now append the freshly created menu to the menu bar...
+               // 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"));
 
-               // attach this menu bar to the frame
+               // Attach this menu bar to the frame
                SetMenuBar(menuBar);            
        }
 
@@ -458,7 +465,7 @@ namespace bbtk
 
        void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event)
        {
-               wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save  actual diagram"),wxEmptyString,wxT("NewDiagram"),wxT("*.bbd"),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)
                {
                        wxString fileName = saveFileDialog->GetPath();
@@ -471,7 +478,7 @@ namespace bbtk
                        
                        // writing file header
                        content += "# ----------------------------------\n";
-                       content += "# - BBTKGEditor v 1.0 BBD BlackBox Diagram file\n";
+                       content += "# - BBTKGEditor v 1.0 BBG BlackBox Diagram file\n";
                        content += "# - ";
 
 //EED                  content += fileName;
@@ -512,6 +519,16 @@ namespace bbtk
                        GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX,false);
                        GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS,true);
                }
+               
+               if(_tabsMgr->getNumActualSelectedObjects()>0)
+               {
+                       GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM,true);
+               }
+               else
+               {
+                       ///TODO Fix the possibility to say from the SceneManager to the GUI to refresh the options
+                       GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM,true);
+               }
 
        }
 
@@ -538,7 +555,7 @@ namespace bbtk
        
        void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event)
        {
-               wxFileDialog * openFileDialog = new wxFileDialog(this,wxT("Open diagram"),wxEmptyString,wxT(""),wxT("*.bbd"),wxOPEN|wxFILE_MUST_EXIST);
+               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();
@@ -609,6 +626,13 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram(wxCommandEvent& event)
+       {
+               _tabsMgr->copySelectedBBoxesToComplexDiagram();
+       }
+
+       //=========================================================================
+
        void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event)
        {
                Close(true);