]> Creatis software - creaContours.git/blobdiff - lib/Interface_Icons_NDimensions/interfToolsPanels.cxx
#3129 creaContours Feature New Normal - branch changeWx28to30 compilation with...
[creaContours.git] / lib / Interface_Icons_NDimensions / interfToolsPanels.cxx
index aebcf21a14bcd7027525bf77b3cc5d9fd73460d6..f59c2e20262870de974c22492878cc93331ad8df 100644 (file)
@@ -1,3 +1,28 @@
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
 #include "interfToolsPanels.h"
 #include "interfMainPanel.h"
 
@@ -170,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);
@@ -301,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 );
@@ -319,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 );
@@ -384,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 );
@@ -526,3 +574,55 @@ void interfCalibrationPanel::onCalibrate(wxCommandEvent& event)
 }
 //------------------------------------------------------------------------------------------------------------
 
+
+
+//////////////////////////////////////////////////////////////
+
+interfFlipPanel::interfFlipPanel(wxWindow* parent)
+: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
+{
+       wxButton *buttonFlipX = new wxButton(this,wxID_ANY,_T("Flip Horizontally"), wxDefaultPosition, wxSize(200,35) );
+       wxButton *buttonFlipY = new wxButton(this,wxID_ANY,_T("Flip Vertically"), wxDefaultPosition, wxSize(200,35) );
+
+       wxString lstOptions[3];
+       lstOptions[0]=_T("Flip selected contours");
+       lstOptions[1]=_T("Flip all contours of actual slice");
+       lstOptions[2]=_T("Flip all contours");
+       _wichContoursRadioBox = new wxRadioBox(this, -1, _T("Transform"), wxDefaultPosition, wxDefaultSize, 3 , lstOptions,  1, wxRA_SPECIFY_COLS);
+       _wichContoursRadioBox->SetSelection(2);
+
+       
+       Connect( buttonFlipX->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfFlipPanel::onFlipXPressed );
+       Connect( buttonFlipY->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfFlipPanel::onFlipYPressed ); 
+       
+       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
+       sizer -> Add( _wichContoursRadioBox, 1, wxGROW );
+       sizer -> Add( buttonFlipX, 1, wxGROW );
+       sizer -> Add( buttonFlipY, 1, wxGROW );
+
+       this->SetSizer( sizer );
+       this->SetAutoLayout( true );
+       this->Layout();
+}
+
+
+
+
+interfFlipPanel::~interfFlipPanel(){
+}
+
+void interfFlipPanel::onFlipXPressed(wxCommandEvent& event)
+{
+       std::cout << "interfToolsPanels.cxx  interfFlipPanel::onFlipXPressed     FlipX (btn)" << std::endl;
+       int typeContoursFlip = _wichContoursRadioBox->GetSelection(); 
+       interfMainPanel::getInstance()->FlipContours( typeContoursFlip , 0 );  // type, direction
+}
+
+void interfFlipPanel::onFlipYPressed(wxCommandEvent& event)
+{
+       std::cout << "interfToolsPanels.cxx   interfFlipPanel::onFlipYPressed FlipY  (btn)" << std::endl;
+       int typeContoursFlip = _wichContoursRadioBox->GetSelection(); 
+       interfMainPanel::getInstance()->FlipContours( typeContoursFlip , 1 );  // type, direction
+}
+
+