//=========================================================================
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"));
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);
}
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();
// 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;
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);
+ }
}
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();
//=========================================================================
+ void wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram(wxCommandEvent& event)
+ {
+ _tabsMgr->copySelectedBBoxesToComplexDiagram();
+ }
+
+ //=========================================================================
+
void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event)
{
Close(true);