From 432cb7a04affad5c64de082e2f9d11dfb708efb4 Mon Sep 17 00:00:00 2001 From: corredor <> Date: Thu, 6 May 2010 10:12:22 +0000 Subject: [PATCH] New icon to save the actual diagram and modal dialog to ask if the user want to delete all boxes --- data/icons/wxart_save.xpm | 42 +++++++++++++++++++ .../bbtkwxGUIEditorGraphicBBS.cxx | 29 +++++++++---- .../bbtkwxGUIEditorGraphicBBS.h | 2 + 3 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 data/icons/wxart_save.xpm diff --git a/data/icons/wxart_save.xpm b/data/icons/wxart_save.xpm new file mode 100644 index 0000000..5be12b2 --- /dev/null +++ b/data/icons/wxart_save.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static const char *save_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 21 1", +"O c #FFFFFF", +"> c #D5D6D8", +"; c #446A8C", +"1 c #CAD2DC", +": c #C0C7D1", +" c #5F666D", +"% c #A5B0BA", +"o c #65839D", +", c #DCE2EA", +"< c #C3C5C8", +"- c #E1E6EE", +"* c #C6CCD3", +". c None", +"$ c #305F81", +"2 c #D6DFE7", +"= c #D2D9E0", +"& c #B7BFC7", +"X c #1B4467", +"# c #BCBDBE", +"@ c #7A90AC", +"+ c #5D7C93", +/* pixels */ +" .", +" XoOOOOOOOOO+X .", +" @oO#######O+@ .", +" @oOOOOOOOOO+@ .", +" @oO#######O+@ .", +" @oOOOOOOOOO+@ .", +" @@+++++++++@@ .", +" @@@@@@@@@@@@@ .", +" @@@$$$$$$$$@@ .", +" @@$%%%&*=-O$@ .", +" @@$%X;;*=-O$@ .", +" @@$%X;;:>,O$@ .", +" @@$%X;;<12O$@ .", +" @@$<<2OOOOO$@ .", +". .." +}; diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index ed6f61f..327bbf1 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -86,6 +86,7 @@ namespace bbtk void wxGUIEditorGraphicBBS::initToolbar() { wxBitmap bmp_new(new_xpm); + wxBitmap bmp_save(save_xpm); wxBitmap bmp_run(run_xpm); wxBitmap bmp_delete(delete_xpm); wxBitmap bmp_centerview(centerview_xpm); @@ -94,9 +95,11 @@ namespace bbtk //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("Execute"),bmp_run, wxNullBitmap, wxITEM_NORMAL,_T("Execute actual diagram"), _T("Execute actual diagram")); - _toolbar->AddTool(1002,_T("Delete all"),bmp_delete, wxNullBitmap, wxITEM_NORMAL,_T("Delete all boxes"), _T("Delete all boxes")); - _toolbar->AddTool(1003,_T("Center view"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Center view"), _T("Center view")); + _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->SetMargins( 2, 2 ); _toolbar->Realize(); @@ -104,9 +107,10 @@ namespace bbtk // connect command event handlers Connect(1000,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab)); - Connect(1001,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram)); - Connect(1002,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram)); - Connect(1003,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram)); + 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)); } //========================================================================= @@ -358,9 +362,20 @@ namespace bbtk //========================================================================= + void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event) + { + + } + + //========================================================================= + void wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram(wxCommandEvent& event) { - _tabsMgr->deleteAllBoxesActualDiagram(); + wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Are you sure to delete all boxes of the diagram?"), wxT("Delete all boxes"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION); + if(dial->ShowModal() == wxID_YES) + { + _tabsMgr->deleteAllBoxesActualDiagram(); + } } //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h index 46dfd39..262aee6 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h @@ -49,6 +49,7 @@ #include "wxVtkSceneManager.h" //#include "C:\RaC\CREATIS\bbtkGEditor\data\icons\wxart_new.xpm" // JPR #include "wxart_new.xpm" // JPR +#include "wxart_save.xpm" #include "wxart_run.xpm" #include "wxart_delete.xpm" #include "wxart_centerview.xpm" @@ -109,6 +110,7 @@ namespace bbtk void DoRegenerateBoxesLists(); void OnCreateNewTab(wxCommandEvent& event); + void OnSaveActualDiagram(wxCommandEvent& event); void OnExecuteActualDiagram(wxCommandEvent& event); void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event); void OnCenterViewActualDiagram(wxCommandEvent& event); -- 2.47.1