X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FbbtkwxGUIEditorGraphicBBS.cxx;h=4b9c0e5f0abcaefa0877995d2aff861386b46297;hb=refs%2Fheads%2Fvtk7itk4wx3;hp=8d57977bdddad8338abfda8f21e5a1c845e0ad81;hpb=511369e67cf26244fc8768a727a03f42ff42865f;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index 8d57977..4b9c0e5 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -122,7 +122,8 @@ wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS() } //========================================================================= -void wxGUIEditorGraphicBBS::initToolbar() { +void wxGUIEditorGraphicBBS::initToolbar() +{ wxBitmap bmp_new(new_xpm); wxBitmap bmp_open(open_xpm); wxBitmap bmp_save(save_xpm); @@ -143,8 +144,10 @@ void wxGUIEditorGraphicBBS::initToolbar() { //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_DIAGRAM, _T("Save Diagram"), bmp_save, wxNullBitmap, wxITEM_NORMAL, _T("Saves the current diagram"), _T("Saves the current diagram")); //DFCH @@ -165,7 +168,14 @@ void wxGUIEditorGraphicBBS::initToolbar() { toolbar->AddSeparator(); toolbar->AddTool(ID_BTNCOMPLEXBOX, _T("Complex box"), complexbox_xpm, wxNullBitmap, wxITEM_NORMAL, _T("Complex box"), _T("Complex box")); + +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 toolbar->SetToggle(ID_BTNCOMPLEXBOX, true); +#else + printf ("EED Warnning. wxGUIEditorGraphicBBS::initToolbar >>> toolbar->SetToggle \n "); + // .. +#endif // RaC 2012 2nd HackFest - Now Complex inputs are any external input // toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT, _T("Add input to Complex box"), @@ -191,6 +201,7 @@ void wxGUIEditorGraphicBBS::initToolbar() { toolbar->EnableTool(ID_EDITPROPERTIES, false); toolbar->AddTool(ID_SHOWTREE, _T("Show tree"),bmp_showTree, wxNullBitmap, wxITEM_NORMAL, _T("Show tree"), _T("Show tree")); + toolbar->EnableTool(ID_UNDO, false); toolbar->EnableTool(ID_REDO, false); @@ -198,6 +209,7 @@ void wxGUIEditorGraphicBBS::initToolbar() { toolbar->Realize(); SetToolBar(toolbar); + // connect command event handlers @@ -239,6 +251,7 @@ void wxGUIEditorGraphicBBS::initToolbar() { Connect(ID_EDITPROPERTIES,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditDiagramProperties)); Connect(ID_SHOWTREE,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnShowTree)); + } //========================================================================= void wxGUIEditorGraphicBBS::initHelpHTMLBrowser() { @@ -691,7 +704,12 @@ void wxGUIEditorGraphicBBS::OpenBBS(std::string filePathName, std::string fileNa //========================================================================= void wxGUIEditorGraphicBBS::OnOpenBBS(wxCommandEvent& event) { +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open BBS"), wxEmptyString, wxT("NewBBS"), wxT("*.bbs"), wxOPEN); +#else + wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open BBS"), wxEmptyString, wxT("NewBBS"), wxT("*.bbs"), wxFD_OPEN); +#endif if (openFileDialog->ShowModal() == wxID_OK) { @@ -736,9 +754,18 @@ void wxGUIEditorGraphicBBS::SaveActualBBS(std::string filename) { } void wxGUIEditorGraphicBBS::OnSaveActualBBS(wxCommandEvent& event) { + +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog * saveFileDialog = new wxFileDialog(this, wxT("Save actual BBS"), wxEmptyString, wxT("NewBBS"), wxT("*.bbs"), wxSAVE | wxOVERWRITE_PROMPT); +#else + wxFileDialog * saveFileDialog = new wxFileDialog(this, + wxT("Save actual BBS"), wxEmptyString, wxT("NewBBS"), + wxT("*.bbs"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); +#endif + if (saveFileDialog->ShowModal() == wxID_OK) { wxString fileName = saveFileDialog->GetPath(); std::string filename = (const char*) (fileName.mb_str()); @@ -799,11 +826,21 @@ void wxGUIEditorGraphicBBS::SaveActualComplexBox(std::string filename) { //========================================================================= -void wxGUIEditorGraphicBBS::OnSaveActualComplexBox(wxCommandEvent& event) { +void wxGUIEditorGraphicBBS::OnSaveActualComplexBox(wxCommandEvent& event) +{ +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog * saveFileDialog = new wxFileDialog(this, wxT("Save Complex Box BBS"), wxEmptyString, _T("ComplexBoxName"), wxT("*.bbs"), wxSAVE | wxOVERWRITE_PROMPT); +#else + wxFileDialog * saveFileDialog = new wxFileDialog(this, + wxT("Save Complex Box BBS"), wxEmptyString, + _T("ComplexBoxName"), wxT("*.bbs"), wxFD_SAVE + | wxFD_OVERWRITE_PROMPT); +#endif + if (saveFileDialog->ShowModal() == wxID_OK) { wxString fileName = saveFileDialog->GetPath(); std::string filename = (const char*) (fileName.mb_str()); @@ -858,10 +895,20 @@ void wxGUIEditorGraphicBBS::SaveTempActualDiagram(const std::string &action) //The following method allows to save the current diagram asking the filename //DFCH -void wxGUIEditorGraphicBBS::SaveCurrentDiagramAs() { +void wxGUIEditorGraphicBBS::SaveCurrentDiagramAs() +{ + +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog * saveFileDialog = new wxFileDialog(this, wxT("Save current diagram"), wxEmptyString, wxT("NewDiagram"), wxT("*.bbg"), wxSAVE | wxOVERWRITE_PROMPT); +#else + wxFileDialog * saveFileDialog = new wxFileDialog(this, + wxT("Save current diagram"), wxEmptyString, wxT("NewDiagram"), + wxT("*.bbg"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); +#endif + if (saveFileDialog->ShowModal() == wxID_OK) { //_tabsMgr->SetNameTabPanel(saveFileDialog->GetFilename()); wxString pathfileName = saveFileDialog->GetPath(); @@ -921,9 +968,17 @@ void wxGUIEditorGraphicBBS::OnSaveAsActualDiagram(wxCommandEvent& event) { //========================================================================= void wxGUIEditorGraphicBBS::OnExportConsoleExecCommand(wxCommandEvent& event) { +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog * saveFileDialog = new wxFileDialog(this, wxT("Export console command"), wxEmptyString, wxT("ConsoleApp.txt"), wxT("*.txt;*.bbs;*.bbg;*.sh;*.bat"), wxSAVE | wxOVERWRITE_PROMPT); +#else + wxFileDialog * saveFileDialog = new wxFileDialog(this, + wxT("Export console command"), wxEmptyString, wxT("ConsoleApp.txt"), + wxT("*.txt;*.bbs;*.bbg;*.sh;*.bat"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); +#endif + if (saveFileDialog->ShowModal() == wxID_OK) { @@ -1100,7 +1155,14 @@ void wxGUIEditorGraphicBBS::OpenDiagram(std::string filePathName, std::string fi void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event) { + +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open diagram"), wxEmptyString, wxT(""), wxT("*.bbg"), wxOPEN | wxFILE_MUST_EXIST); +#else + wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open diagram"), wxEmptyString, wxT(""), wxT("*.bbg"), wxFD_OPEN | wxFD_FILE_MUST_EXIST); +#endif + if (openFileDialog->ShowModal() == wxID_OK) { wxString filePath = openFileDialog->GetPath();