]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/wxManualPaintPanel.cpp
#2864 creaMaracasVisu Feature New Normal - Manual Paint , modifies external image...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualPaint / wxManualPaintPanel.cpp
index 58054eaf30b9a3776e0d865dc05d8508c5bcb669..ab311ae392aaa469c0c690c4ff9dbfe323cd7c26 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 "wxManualPaintPanel.h"
 #include <wx/radiobox.h>
 
@@ -12,8 +37,9 @@ wxManualPaintPanel::wxManualPaintPanel( wxWindow * parent )
        //Title
        sizer->Add( tittleText );
        //giving some blank spaces
-       sizer->Add( new wxStaticText( this, -1, _T("             ") ) );
+       sizer->Add( new wxStaticText( this, -1, _T("          key A : Enable/Disable   ") ) );
 
+       this->ConfigureActiveCBButton( );
        this->ConfigureBrushToolRadioButton( );
        this->Configure2D3DRadioButton( );
        this->ConfigureBrushFormRadioButton( );
@@ -27,7 +53,6 @@ wxManualPaintPanel::wxManualPaintPanel( wxWindow * parent )
        //Buttons
        wxStaticText *editButtonsText = new wxStaticText( this, -1,
                _T("Edit Buttons") );
-       sizer->Add( editButtonsText );
        this->_buttonsSizer = new wxFlexGridSizer( 4 );
        this->_buttonsSizer->Add( _btnUndo, 1, wxGROW );
        this->_buttonsSizer->Add( _btnRedo, 1, wxGROW );
@@ -36,8 +61,7 @@ wxManualPaintPanel::wxManualPaintPanel( wxWindow * parent )
        this->_gConfigSizer = new wxFlexGridSizer( 1 );
        //BrushTool Radio Button
        //giving blank space
-       this->_gConfigSizer->Add(
-               new wxStaticText( this, -1, _T("             ") ) );
+       this->_gConfigSizer->Add(  new wxStaticText( this, -1, _T("             ") ) );
        //end of blank space
        this->_gConfigSizer->Add( _rbBrushTool, 1, wxGROW );
        //2D/3D Radio Button
@@ -91,6 +115,8 @@ wxManualPaintPanel::wxManualPaintPanel( wxWindow * parent )
                wxALIGN_BOTTOM | wxALIGN_LEFT | wxALL, 5 );
        this->_FillSizer->Add( sizerDistance );
 
+       sizer->Add( _activeCB );
+       sizer->Add( editButtonsText );
        sizer->Add( _buttonsSizer );
        sizer->Add( _gConfigSizer );
        sizer->Add( _brushSizer );
@@ -111,8 +137,16 @@ wxManualPaintPanel::~wxManualPaintPanel( )
 }
 
 //--------------------------------------------------------------------------
+void wxManualPaintPanel::ConfigureActiveCBButton( )
+{
+   _activeCB = new wxCheckBox (this, -1, _T("Active") );
+   _activeCB->SetValue(true);
+   SetActive( _activeCB->GetValue() );
+}
+
 
 //Panel Config
+//--------------------------------------------------------------------------
 void wxManualPaintPanel::ConfigureBrushToolRadioButton( )
 {
        wxString lstBrushForm[ 2 ];
@@ -122,6 +156,7 @@ void wxManualPaintPanel::ConfigureBrushToolRadioButton( )
                wxDefaultPosition, wxSize( 270, 45 ), 2, lstBrushForm, 2,
                wxRA_SPECIFY_COLS );
 }
+
 //--------------------------------------------------------------------------
 void wxManualPaintPanel::Configure2D3DRadioButton( )
 {
@@ -166,29 +201,33 @@ void wxManualPaintPanel::ConfigureRangeBar( )
        _mBarSlices->SetStart( min );
        _mBarSlices->SetEnd( max );
        _mBarSlices->Update( );
+
+       SetRangeMin( min );
+       SetRangeMax( max );
+
        //DFCH -- End BarSlices
 }
 //--------------------------------------------------------------------------
 void wxManualPaintPanel::ConfigureGrayLevelSld( )
 {
        _txtGrayLevel = new wxStaticText( this, -1,
-               wxString( _T("  Gray Level  ") ) );
+       wxString( _T("  Gray Level  ") ) );
        _sldGrayLevel = new wxSlider( this, -1, 0, 0, 255, wxDefaultPosition,
-               wxDefaultSize, wxSL_LABELS );
+       wxDefaultSize, wxSL_LABELS );
        _sldGrayLevel->SetMinSize( wxSize( 200, -1 ) );
        _sldGrayLevel->SetMaxSize( wxSize( 200, -1 ) );
        _graylevelCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
-               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
+       wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
 }
 //--------------------------------------------------------------------------
 void wxManualPaintPanel::ConfigureBrushSizeSld( )
 {
        _txtBrushSize = new wxStaticText( this, -1,
-               wxString( _T("  Brush size  ") ) );
+       wxString( _T("  Brush size  ") ) );
        _sldBrushSize = new wxSlider( this, -1, 1, 1, 50, wxDefaultPosition,
-               wxDefaultSize, wxSL_LABELS );
+       wxDefaultSize, wxSL_LABELS );
        _BrushSizeCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
-               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
+       wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
        _sldBrushSize->SetMinSize( wxSize( 200, -1 ) );
        _sldBrushSize->SetMaxSize( wxSize( 200, -1 ) );
 }
@@ -196,13 +235,13 @@ void wxManualPaintPanel::ConfigureBrushSizeSld( )
 void wxManualPaintPanel::ConfigureDistanceFillSld( )
 {
        _txtDistanceFill = new wxStaticText( this, -1,
-               wxString( _T("  Distance fill  ") ) );
+       wxString( _T("  Distance fill  ") ) );
        _sldDistanceFill = new wxSlider( this, -1, 50, 1, 500, wxDefaultPosition,
-               wxDefaultSize, wxSL_LABELS );
+       wxDefaultSize, wxSL_LABELS );
        _sldDistanceFill->SetMinSize( wxSize( 200, -1 ) );
        _sldDistanceFill->SetMaxSize( wxSize( 200, -1 ) );
        _distancefillCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
-               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 500, 50 );
+       wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 500, 50 );
        _txtDistanceFill->Disable( );
        _sldDistanceFill->Disable( );
        _distancefillCtrl->Disable( );
@@ -239,17 +278,14 @@ void wxManualPaintPanel::ConfigureEditButtons( )
  */
 void wxManualPaintPanel::ConnectComponents( ) //DFCH
 {
-       this->Connect(
-               _sldBrushSize->GetId( ),
+       this->Connect(_sldBrushSize->GetId( ),
                wxEVT_SCROLL_THUMBRELEASE,
                (wxObjectEventFunction) (void(wxPanel::*)(
-                       wxScrollEvent& )) (&wxManualPaintPanel::OnBrushSize) );this ->Connect (_sldGrayLevel->GetId(),
-                               wxEVT_SCROLL_THUMBRELEASE,
-                               (wxObjectEventFunction) (void(wxPanel::*)(
-                                                               wxScrollEvent&)) &wxManualPaintPanel::OnSldGrayLevel);
-               this->Connect
-               (
-                               _graylevelCtrl->GetId(),
+               wxScrollEvent& )) (&wxManualPaintPanel::OnBrushSize) );this ->Connect (_sldGrayLevel->GetId(),
+               wxEVT_SCROLL_THUMBRELEASE,
+                (wxObjectEventFunction) (void(wxPanel::*)( wxScrollEvent&)) &wxManualPaintPanel::OnSldGrayLevel);
+
+               this->Connect(  _graylevelCtrl->GetId(),
                                wxEVT_COMMAND_TEXT_UPDATED,
                                (wxObjectEventFunction) (void(wxPanel::*)(
                                                                wxCommandEvent&)) &wxManualPaintPanel::OnCtrTxtGrayLevel);
@@ -338,9 +374,23 @@ void wxManualPaintPanel::ConnectComponents( ) //DFCH
                                wxEVT_COMMAND_TEXT_UPDATED,
                                (wxObjectEventFunction) (void(wxPanel::*)(
                                                                wxCommandEvent&)) &wxManualPaintPanel::OnCtrBrushSize);
+               this->Connect
+               (
+                       _activeCB->GetId(),
+                       wxEVT_COMMAND_CHECKBOX_CLICKED, 
+                       (wxObjectEventFunction) (void (wxPanel::*)(wxCommandEvent&))&wxManualPaintPanel::OnActive);
 
        }
 
+
+  //-------------------------------------------------------------------------
+  void wxManualPaintPanel::OnActive(wxCommandEvent& event)
+  {
+       printf("EED wxManualPaintPanel::OnActive \n");
+       SetActive( _activeCB->GetValue() );
+  }
+
+
 //---------------------------------------------------------------------------
 void wxManualPaintPanel::OnBrushSize( wxScrollEvent& event )
 {