From fd2eb66b52adaa711fc4a2875865be5fc2b2ba7e Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 4 Oct 2017 14:15:52 +0200 Subject: [PATCH] #3129 creaContours Feature New Normal - branch changeWx28to30 compilation with wxWidgets3 --- .../interfMainPanel.cxx | 12 ++++++ .../interfToolsPanels.cxx | 23 ++++++++++ .../wxContourMainFrame.cxx | 43 +++++++++++++------ .../wxVtkBaseView_SceneManager.cxx | 8 ++-- 4 files changed, 67 insertions(+), 19 deletions(-) diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index 7d77c93..dac24f6 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -330,7 +330,13 @@ void interfMainPanel::showPanel(wxWindow* panel) if(currentWindow != NULL){ currentWindow->Hide(); /// \TODO fix warning: virtual bool wxSizer::Remove(wxWindow*) is deprecated +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 sizer->Remove(currentWindow); +#else + sizer->Detach(currentWindow); +#endif + } sizer->Add(panel); currentWindow = panel; @@ -356,7 +362,13 @@ void interfMainPanel::hidePanel( ) if(currentWindow != NULL){ currentWindow->Hide(); /// \TODO fix warning: virtual bool wxSizer::Remove(wxWindow*) is deprecated +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 sizer->Remove(currentWindow); +#else + sizer->Detach(currentWindow); +#endif + } wxPanel * emptyPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T(""))); sizer->Add(emptyPanel); diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx index baa8cd8..f59c2e2 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx @@ -195,7 +195,15 @@ void interfSpreadPanel::appendStringSpread(std::string val){ /* // if */ wxString newstring; //newstring.Printf("%s %d -",_wxtextctrlSpread->GetValue(), actualSlice ); + +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 newstring.append(wxString(_wxtextctrlSpread->GetValue(),wxConvUTF8)); +#else + newstring.append( _wxtextctrlSpread->GetValue() ); +#endif + + newstring.append(wxString(" ",wxConvUTF8)); newstring.append(wxString(val.c_str(),wxConvUTF8)); _wxtextctrlSpread->SetValue(newstring); @@ -326,7 +334,12 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent) FillGridWithContoursInformation(); +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFlexGridSizer * sizerSave = new wxFlexGridSizer(2,2); +#else + wxFlexGridSizer * sizerSave = new wxFlexGridSizer(2); +#endif sizerSave -> Add( new wxStaticText(this,-1,_T("Save Options: ")) , 1, wxGROW ); sizerSave->Add( _XYZValues, 1, wxALL, 2 ); sizerSave->Add( _statistics, 1, wxALL, 2 ); @@ -344,7 +357,12 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent) sizerB->Add( showResultImagesBtn, 1, wxALL, 2 ); sizerB->Add( saveResultsBtn, 1, wxALL, 2 ); +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFlexGridSizer * sizer = new wxFlexGridSizer(1,8); +#else + wxFlexGridSizer * sizer = new wxFlexGridSizer(8); +#endif sizer->Add( sizerA , 1, wxALL , 0 ); sizer->Add( new wxStaticText(this ,-1,_T("Slice Range")) , 1, wxALL , 0 ); sizer->Add( _mbarrangeSliceInformation , 1, wxALL|wxGROW , 2 ); @@ -409,7 +427,12 @@ void interfInformationPanel::onExtractInformation(wxCommandEvent& event){ void interfInformationPanel::onSaveResults(wxCommandEvent& event) { +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog dialog(this, _T("Choose a filename"), _T(""), _T(""), wxFileSelectorDefaultWildcardStr, wxSAVE ); +#else + wxFileDialog dialog(this, _T("Choose a filename"), _T(""), _T(""), wxFileSelectorDefaultWildcardStr, wxFD_SAVE ); +#endif if (dialog.ShowModal() == wxID_OK) { onExtractInformation( event ); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 3d4413b..8aaa0bb 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -961,7 +961,12 @@ void wxContourMainFrame::onLoad() if(GetFileLocation().empty()) { //------------------------------------------------------------------------------------------------------------ +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxOPEN ); +#else + wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxFD_OPEN ); +#endif if (dialog.ShowModal() == wxID_OK) { fileNameContourROI = (const char *)(dialog.GetPath().mb_str()); @@ -1010,16 +1015,11 @@ printf("EED wxContourMainFrame::SetZForAllContours contour=%d \n", i ); }// for i list of static things } - - void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool interactiveInterface) { char tmp[255]; char tmpD[255]; - FILE *pFile =fopen(fileNameContourROI.c_str(),"r+"); - - //CMRU 03-09-09- ---------------------------------------------------------------------------------------------- if(pFile != NULL) { @@ -1086,18 +1086,22 @@ printf("EED wxContourMainFrame::onLoadContours version%s \n", version.c_str() ) if(pFileData != NULL) { fclose(pFileData); - } + } // if } _theViewPanel->getSceneManager()->removeSceneContours(); changeInstant(); } - -void wxContourMainFrame::onImport(){ +void wxContourMainFrame::onImport() +{ std::string filename, filenamecontours; +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog dialog(NULL, _T("Choose a XML Osirix File"), _T(""), _T(""), _T("*.xml"), wxOPEN ); - +#else + wxFileDialog dialog(NULL, _T("Choose a XML Osirix File"), _T(""), _T(""), _T("*.xml"), wxFD_OPEN ); +#endif if (dialog.ShowModal() == wxID_OK) { filename = dialog.GetPath().mb_str(); @@ -1105,19 +1109,25 @@ void wxContourMainFrame::onImport(){ if(filenamecontours.compare("") != 0){ onLoadContours(filenamecontours,true); - } - - } + } // if + } // if } -void wxContourMainFrame::onTest(){ + +void wxContourMainFrame::onTest() +{ std::string filename, filenamecontours; +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxOPEN ); +#else + wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxFD_OPEN ); +#endif if (dialog.ShowModal() == wxID_OK) { filename = dialog.GetPath().mb_str(); std::cout << "This is the filename: " << filename << std::endl; - } + } // if } @@ -1127,7 +1137,12 @@ void wxContourMainFrame::onSave(){ if(GetFileLocation().empty()) { //------------------------------------------------------------------------------------------------------------ +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxSAVE ); +#else + wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxFD_SAVE ); +#endif if (dialog.ShowModal() == wxID_OK) { std::string fileNameContourROI = (const char *)(dialog.GetPath().mb_str()); diff --git a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx index aac92df..166f8ed 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx @@ -751,7 +751,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) bool condition = true; int X,Y; - wxVTKRenderWindowInteractor *_wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor(); + crea::wxVTKRenderWindowInteractor *_wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor(); _wxVTKiren->GetEventPosition( X , Y ); bool ctrlKey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey() == 1; @@ -809,9 +809,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) size = selectionSize; iter = _workingGroup->begin(); } - } - else - { + } else { _toIncludeAtInteractionGroup = false; } @@ -1120,7 +1118,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) double sg = (double)(start) / CLOCKS_PER_SEC; #endif int tmpPx,tmpPy; - wxVTKRenderWindowInteractor *wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor(); + crea::wxVTKRenderWindowInteractor *wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition( tmpPx , tmpPy ); fprintf(ff,"::%s (x,y) = (%i, %i) t(sg): %f\n \n",method.c_str(), tmpPx, tmpPy, sg); fclose(ff); -- 2.47.1