void wxGUIEditorGraphicBBS::initToolbar()
{
wxBitmap bmp_new(new_xpm);
+ wxBitmap bmp_open(open_xpm);
wxBitmap bmp_save(save_xpm);
wxBitmap bmp_run(run_xpm);
wxBitmap bmp_delete(delete_xpm);
wxToolBar *_toolbar = new wxToolBar(this, wxID_ANY);
//Adds a tool btn to the toolbar
- _toolbar->AddTool(1000,_T("New"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New tab"), _T("Create a new panel tab"));
- _toolbar->AddTool(1001,_T("Save diagram"),bmp_save, wxNullBitmap, wxITEM_NORMAL,_T("Saves actual diagram"), _T("Saves actual diagram"));
- _toolbar->AddTool(1002,_T("Execute"),bmp_run, wxNullBitmap, wxITEM_NORMAL,_T("Execute actual diagram"), _T("Execute actual diagram"));
- _toolbar->AddTool(1003,_T("Delete all"),bmp_delete, wxNullBitmap, wxITEM_NORMAL,_T("Delete all boxes"), _T("Delete all boxes"));
- _toolbar->AddTool(1004,_T("Center view"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Center view"), _T("Center view"));
+ _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,_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"));
_toolbar->SetMargins( 2, 2 );
SetToolBar(_toolbar);
// connect command event handlers
- Connect(1000,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
- Connect(1001,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram));
- Connect(1002,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram));
- Connect(1003,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram));
- Connect(1004,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram));
+ Connect(ID_NEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
+ Connect(ID_OPEN,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenDiagram));
+ Connect(ID_SAVE,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));
}
//=========================================================================
/*****************************************************/
void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event)
{
+ wxFileDialog * openFileDialog = new wxFileDialog(this,wxT("Save actual diagram"),wxEmptyString,"NewDiagram","*.bbd",wxSAVE|wxOVERWRITE_PROMPT);
+ if (openFileDialog->ShowModal() == wxID_OK)
+ {
+ wxString fileName = openFileDialog->GetPath();
+
+ ofstream file;
+ file.open(fileName.c_str());
+
+ std::string content="";
+
+ // writing file header
+ content += "# ----------------------------------\n";
+ content += "# - BBTKGEditor v 1.0 Diagram file\n";
+ content += "# - ";
+ content += fileName;
+ content += "\n";
+ content += "# ----------------------------------\n";
+ content += "\n";
+
+ _tabsMgr->saveActualDiagram(content);
+ file << content;
+ file.close();
+ wxMessageDialog *dial = new wxMessageDialog(NULL, wxT(" Diagram successfully saved!! "), wxT("Saved!!"), wxOK);
+ dial->ShowModal();
+
+ }
+
}
//=========================================================================
//=========================================================================
+
+ void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event)
+ {
+ cout<<"RaC wxGUIEditorGraphicBBS::OnOpenDiagram "<<endl;
+ }
+
+ //=========================================================================
+
void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event)
{
Close(true);
}
-
+ //=========================================================================
} // EO namespace bbtk