]> Creatis software - creaMaracasVisu.git/commitdiff
DFCH: Changes in at GUI level - cleaning and mantaining code.
authorDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Mon, 21 Nov 2011 12:08:06 +0000 (12:08 +0000)
committerDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Mon, 21 Nov 2011 12:08:06 +0000 (12:08 +0000)
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/wxManualPaintPanel.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/wxManualPaintPanel.h

index ae063ce07ea340aeb4a085175a382c76ce89d8ac..58f644d0102170082bd5fed2b96d1b6031e96b30 100644 (file)
 #include "wxManualPaintPanel.h"
 #include <wx/radiobox.h>
 
-wxManualPaintPanel::wxManualPaintPanel(wxWindow * parent) :
-               wxPanel(parent, -1) {
+wxManualPaintPanel::wxManualPaintPanel( wxWindow * parent )
+               : wxPanel( parent, -1 )
+{
        wxPanel *panel = this;
        wxSizer *sizer = NULL;
 
        // Widget interface
-       wxStaticText *tittleText = new wxStaticText(panel, -1,
-                       _T("             Manual Paint"));
-       _txtBrushSize = new wxStaticText(panel, -1, wxString(_T("  Brush size  ")));
-       _sldBrushSize = new wxSlider(panel, -1, 1, 1, 20, wxDefaultPosition,
-                       wxDefaultSize, wxSL_LABELS);
-       wxStaticText *txtGrayLevel = new wxStaticText(panel, -1,
-                       wxString(_T("  Gray Level  ")));
-       _sldGrayLevel = new wxSlider(panel, -1, 0, 0, 50, wxDefaultPosition,
-                       wxDefaultSize, wxSL_LABELS);
-       _graylevelCtrl = new wxTextCtrl(panel, -1);
-       _txtToleranceFill = new wxStaticText(panel, -1,
-                       wxString(_T("  Tolerance fill  ")));
-       _sldToleranceFill = new wxSlider(panel, -1, 50, 0, 50, wxDefaultPosition,
-                       wxDefaultSize, wxSL_LABELS);
-       _tolerancefillCtrl = new wxTextCtrl(panel, -1, _T("50"));
-       _txtDistanceFill = new wxStaticText(panel, -1,
-                       wxString(_T("  Distance fill  ")));
-       _sldDistanceFill = new wxSlider(panel, -1, 500, 1, 500, wxDefaultPosition,
-                       wxDefaultSize, wxSL_LABELS);
-       _distancefillCtrl = new wxTextCtrl(panel, -1, _T("500"));
+       wxStaticText *tittleText = new wxStaticText( panel, -1,
+               _T("             Manual Paint") );
+       _txtBrushSize = new wxStaticText( panel, -1,
+               wxString( _T("  Brush size  ") ) );
+       _sldBrushSize = new wxSlider( panel, -1, 1, 1, 20, wxDefaultPosition,
+               wxDefaultSize, wxSL_LABELS );
+       wxStaticText *txtGrayLevel = new wxStaticText( panel, -1,
+               wxString( _T("  Gray Level  ") ) );
+       _sldGrayLevel = new wxSlider( panel, -1, 0, 0, 50, wxDefaultPosition,
+               wxDefaultSize, wxSL_LABELS );
+       _graylevelCtrl = new wxTextCtrl( panel, -1 );
+       _txtToleranceFill = new wxStaticText( panel, -1,
+               wxString( _T("  Tolerance fill  ") ) );
+       _sldToleranceFill = new wxSlider( panel, -1, 50, 0, 50, wxDefaultPosition,
+               wxDefaultSize, wxSL_LABELS );
+       _tolerancefillCtrl = new wxTextCtrl( panel, -1, _T("50") );
+       _txtDistanceFill = new wxStaticText( panel, -1,
+               wxString( _T("  Distance fill  ") ) );
+       _sldDistanceFill = new wxSlider( panel, -1, 500, 1, 500, wxDefaultPosition,
+               wxDefaultSize, wxSL_LABELS );
+       _distancefillCtrl = new wxTextCtrl( panel, -1, _T("500") );
        //DFCH -- BarSlices
-       double range[2];
-       GetScalarRange(range);
+       double range[ 2 ];
+       GetScalarRange( range );
        int min = 0; //range[0];
        int max = 6000; //range[1];
-       _mBarSlices = new mBarRange(panel, 70, 65);
-       _mBarSlices->SetMin(0);
-       _mBarSlices->SetStart(0);
-       _mBarSlices->SetOrientation(true);
-       _mBarSlices->setActiveStateTo(true);
-       _mBarSlices->setVisibleLabels(true);
-       _mBarSlices->setDeviceEndMargin(10);
-       _mBarSlices->setDeviceBlitStart(10, 10);
-       _mBarSlices->setIfWithActualDrawed(false);
-       _mBarSlices->setRepresentedValues(min, max);
-       _mBarSlices->SetStart(min);
-       _mBarSlices->SetEnd(max);
-       _mBarSlices->Update();
+       _mBarSlices = new mBarRange( panel, 70, 65 );
+       _mBarSlices->SetMin( 0 );
+       _mBarSlices->SetStart( 0 );
+       _mBarSlices->SetOrientation( true );
+       _mBarSlices->setActiveStateTo( true );
+       _mBarSlices->setVisibleLabels( true );
+       _mBarSlices->setDeviceEndMargin( 10 );
+       _mBarSlices->setDeviceBlitStart( 10, 10 );
+       _mBarSlices->setIfWithActualDrawed( false );
+       _mBarSlices->setRepresentedValues( min, max );
+       _mBarSlices->SetStart( min );
+       _mBarSlices->SetEnd( max );
+       _mBarSlices->Update( );
        //DFCH -- End BarSlices
 
-       wxString lst2D3D[2];
-       lst2D3D[0] = _T("2D");
-       lst2D3D[1] = _T("3D");
-       _rb2D3D = new wxRadioBox(panel, -1, _T("2D / 3D"), wxDefaultPosition,
-                       wxSize(270, 45), 2, lst2D3D, 2, wxRA_SPECIFY_COLS);
-       _rb2D3D->SetSelection(1);
-
-       wxString lstBrushForm[2];
-       lstBrushForm[0] = _T("rectangle/cube");
-       lstBrushForm[1] = _T("circle/sphere");
-       _rbBrushForm = new wxRadioBox(panel, -1, _T("Brush form"),
-                       wxDefaultPosition, wxSize(270, 45), 2, lstBrushForm, 2,
-                       wxRA_SPECIFY_COLS);
-
-       _txtToleranceFill->Disable();
-       _sldToleranceFill->Disable();
-       _tolerancefillCtrl->Disable();
-
-       _txtDistanceFill->Disable();
-       _sldDistanceFill->Disable();
-       _distancefillCtrl->Disable();
-
-       wxString lstBrushTool[2];
-       lstBrushTool[0] = _T("Brush");
-       lstBrushTool[1] = _T("Fill");
-       _rbBrushTool = new wxRadioBox(panel, -1, _T("Brush tool"),
-                       wxDefaultPosition, wxSize(270, 45), 2, lstBrushTool, 2,
-                       wxRA_SPECIFY_COLS);
-
-       wxButton *btnCopy = new wxButton(panel, -1, _T("Copy"));
-       btnCopy->Disable();
-       wxButton *btnUndo = new wxButton(panel, -1, _T("Undo"));
-       wxButton *btnRedo = new wxButton(panel, -1, _T("Redo"));
+       wxString lst2D3D[ 2 ];
+       lst2D3D[ 0 ] = _T("2D");
+       lst2D3D[ 1 ] = _T("3D");
+       _rb2D3D = new wxRadioBox( panel, -1, _T("2D / 3D"), wxDefaultPosition,
+               wxSize( 270, 45 ), 2, lst2D3D, 2, wxRA_SPECIFY_COLS );
+       _rb2D3D->SetSelection( 1 );
+
+       wxString lstBrushForm[ 2 ];
+       lstBrushForm[ 0 ] = _T("rectangle/cube");
+       lstBrushForm[ 1 ] = _T("circle/sphere");
+       _rbBrushForm = new wxRadioBox( panel, -1, _T("Brush form"),
+               wxDefaultPosition, wxSize( 270, 45 ), 2, lstBrushForm, 2,
+               wxRA_SPECIFY_COLS );
+
+       _txtToleranceFill->Disable( );
+       _sldToleranceFill->Disable( );
+       _tolerancefillCtrl->Disable( );
+
+       _txtDistanceFill->Disable( );
+       _sldDistanceFill->Disable( );
+       _distancefillCtrl->Disable( );
+
+       wxString lstBrushTool[ 2 ];
+       lstBrushTool[ 0 ] = _T("Brush");
+       lstBrushTool[ 1 ] = _T("Fill");
+       _rbBrushTool = new wxRadioBox( panel, -1, _T("Brush tool"),
+               wxDefaultPosition, wxSize( 270, 45 ), 2, lstBrushTool, 2,
+               wxRA_SPECIFY_COLS );
+
+       _btnCopy = new wxButton( panel, -1, _T("Copy") );
+       _btnCopy->Disable( );
+       _btnUndo = new wxButton( panel, -1, _T("Undo") );
+       _btnRedo = new wxButton( panel, -1, _T("Redo") );
        //btnUndo->Disable();
 
-       Connect(
-                       _sldBrushSize->GetId(),
-                       wxEVT_SCROLL_THUMBRELEASE,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                       wxScrollEvent&)) (&wxManualPaintPanel::OnBrushSize));
-
-Connect        (
-                       _sldGrayLevel->GetId(),
-                       wxEVT_SCROLL_THUMBRELEASE,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                       wxScrollEvent&)) &wxManualPaintPanel::OnSldGrayLevel);Connect
-       (
-                       _graylevelCtrl->GetId(),
-                       wxEVT_COMMAND_TEXT_UPDATED,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                       wxCommandEvent&)) &wxManualPaintPanel::OnCtrTxtGrayLevel);
-
-Connect        (
-                       _sldToleranceFill->GetId(),
-                       wxEVT_SCROLL_THUMBRELEASE,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                       wxScrollEvent&)) &wxManualPaintPanel::OnSldToleranceFill);Connect
-       (
-                       _tolerancefillCtrl->GetId(),
-                       wxEVT_COMMAND_TEXT_UPDATED,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                       wxCommandEvent&)) &wxManualPaintPanel::OnCtrTxtToleranceFill);
-
-Connect        (
-                       _sldDistanceFill->GetId(),
-                       wxEVT_SCROLL_THUMBRELEASE,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                       wxScrollEvent&)) &wxManualPaintPanel::OnSldDistanceFill);Connect
-       (
-                       _distancefillCtrl->GetId(),
-                       wxEVT_COMMAND_TEXT_UPDATED,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                       wxCommandEvent&)) &wxManualPaintPanel::OnCtrTxtDistanceFill);
-
-Connect        (
-                       _rb2D3D->GetId(),
-                       wxEVT_COMMAND_RADIOBOX_SELECTED,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                       wxCommandEvent&)) &wxManualPaintPanel::On2D3D);Connect
-       (
-                       _rbBrushForm->GetId(),
-                       wxEVT_COMMAND_RADIOBOX_SELECTED,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                       wxCommandEvent&)) &wxManualPaintPanel::OnBrushForm);Connect
-       (
-                       _rbBrushTool->GetId(),
-                       wxEVT_COMMAND_RADIOBOX_SELECTED,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                       wxCommandEvent&)) &wxManualPaintPanel::OnBrushTool);Connect
-       (
-                       btnCopy->GetId(),
-                       wxEVT_COMMAND_BUTTON_CLICKED,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                       wxCommandEvent&)) &wxManualPaintPanel::OnCopy);
-
-Connect        (
-                       btnUndo->GetId(),
-                       wxEVT_COMMAND_BUTTON_CLICKED,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                       wxCommandEvent&)) &wxManualPaintPanel::OnUndo);this
-       ->Connect(btnRedo->GetId(),
-                       wxEVT_COMMAND_BUTTON_CLICKED,
-                       (wxObjectEventFunction) (void(wxPanel::*)(
-                                                       wxCommandEvent&)) &wxManualPaintPanel::OnRedo); //DFCH
-
-       Connect(
-                       _mBarSlices->GetId(),
-                       wxEVT_TSBAR,
-                       (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onBarrange);
-//                     Connect(modBarRange->GetId(),98765,(wxObjectEventFunction) (wxCommandEventFunction)  &wxWidgetSliderMinMax::onActualChange_Bar );
-       Connect(
-                       _mBarSlices->GetId(),
-                       wxEVT_TSBAR_ACTUAL,
-                       (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onActualChange_Bar);
-       Connect(
-                       _mBarSlices->GetId(),
-                       wxEVT_TSBAR_START,
-                       (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onStartChange_Bar);
-       Connect(
-                       _mBarSlices->GetId(),
-                       wxEVT_TSBAR_END,
-                       (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onEndChange_Bar);
-       Connect(
-                       _mBarSlices->GetId(),
-                       wxEVT_SELECTION_END,
-                       (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onSelectionEnd);
-       Connect(
-                       _mBarSlices->GetId(),
-                       wxEVT_TSBAR_MOVED,
-                       (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onMovedBar);
-
-       wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
-
-       sizer1->Add(new wxStaticText(panel, -1, _T("  ")));
-       sizer1->Add(tittleText);
-
-       sizer1->Add(new wxStaticText(panel, -1, _T("  ")));
-       sizer1->Add(_rbBrushTool, 1, wxGROW);
-
-       wxFlexGridSizer *sizerGrayLevel = new wxFlexGridSizer(2);
-       sizerGrayLevel->Add(txtGrayLevel);
-       sizerGrayLevel->Add(_graylevelCtrl);
-       sizer1->Add(sizerGrayLevel, 1, wxGROW);
-       sizer1->Add(_sldGrayLevel, 1, wxGROW);
-
-       sizer1->Add(new wxStaticText(this, -1, _T( "Selected Range" )), 1, wxGROW);
-       sizer1->Add(_mBarSlices, 1, wxGROW);
-
-       sizer1->Add(new wxStaticText(panel, -1, _T("  ")));
-       sizer1->Add(_rb2D3D, 1, wxGROW);
-
-       sizer1->Add(new wxStaticText(panel, -1, _T("  ")));
-       sizer1->Add(_txtBrushSize);
-       sizer1->Add(_sldBrushSize, 1, wxGROW);
-
-       sizer1->Add(new wxStaticText(panel, -1, _T("  ")));
-       sizer1->Add(_rbBrushForm, 1, wxGROW);
-
-       wxFlexGridSizer *sizerTolerance = new wxFlexGridSizer(2);
-       sizerTolerance->Add(_txtToleranceFill);
-       sizerTolerance->Add(_tolerancefillCtrl);
-       sizer1->Add(sizerTolerance);
-       sizer1->Add(_sldToleranceFill, 1, wxGROW);
-
-       wxFlexGridSizer *sizerDistance = new wxFlexGridSizer(2);
-       sizerDistance->Add(_txtDistanceFill);
-       sizerDistance->Add(_distancefillCtrl);
-       sizer1->Add(sizerDistance);
-       sizer1->Add(_sldDistanceFill, 1, wxGROW);
-
-       sizer1->Add(new wxStaticText(panel, -1, _T("  ")));
-       sizer1->Add(btnCopy, 1, wxGROW);
-       sizer1->Add(new wxStaticText(panel, -1, _T("  ")));
-       sizer1->Add(btnUndo, 1, wxGROW);
-       sizer1->Add(btnRedo, 1, wxGROW);
+       wxFlexGridSizer *sizer1 = new wxFlexGridSizer( 1 );
+
+       sizer1->Add( new wxStaticText( panel, -1, _T("  ") ) );
+       sizer1->Add( tittleText );
+
+       sizer1->Add( new wxStaticText( panel, -1, _T("  ") ) );
+       sizer1->Add( _rbBrushTool, 1, wxGROW );
+
+       wxFlexGridSizer *sizerGrayLevel = new wxFlexGridSizer( 2 );
+       sizerGrayLevel->Add( txtGrayLevel );
+       sizerGrayLevel->Add( _graylevelCtrl );
+       sizer1->Add( sizerGrayLevel, 1, wxGROW );
+       sizer1->Add( _sldGrayLevel, 1, wxGROW );
+
+       sizer1->Add( new wxStaticText( this, -1, _T( "Select Range" ) ), 1,
+               wxGROW );
+       sizer1->Add( _mBarSlices, 1, wxGROW );
+
+       sizer1->Add( new wxStaticText( panel, -1, _T("  ") ) );
+       sizer1->Add( _rb2D3D, 1, wxGROW );
+
+       sizer1->Add( new wxStaticText( panel, -1, _T("  ") ) );
+       sizer1->Add( _txtBrushSize );
+       sizer1->Add( _sldBrushSize, 1, wxGROW );
+
+       sizer1->Add( new wxStaticText( panel, -1, _T("  ") ) );
+       sizer1->Add( _rbBrushForm, 1, wxGROW );
+
+       wxFlexGridSizer *sizerTolerance = new wxFlexGridSizer( 2 );
+       sizerTolerance->Add( _txtToleranceFill );
+       sizerTolerance->Add( _tolerancefillCtrl );
+       sizer1->Add( sizerTolerance );
+       sizer1->Add( _sldToleranceFill, 1, wxGROW );
+
+       wxFlexGridSizer *sizerDistance = new wxFlexGridSizer( 2 );
+       sizerDistance->Add( _txtDistanceFill );
+       sizerDistance->Add( _distancefillCtrl );
+       sizer1->Add( sizerDistance );
+       sizer1->Add( _sldDistanceFill, 1, wxGROW );
+
+       sizer1->Add( new wxStaticText( panel, -1, _T("  ") ) );
+       sizer1->Add( _btnCopy, 1, wxGROW );
+       sizer1->Add( new wxStaticText( panel, -1, _T("  ") ) );
+       sizer1->Add( _btnUndo, 1, wxGROW );
+       sizer1->Add( _btnRedo, 1, wxGROW );
 
        sizer = sizer1;
-       panel->SetSizer(sizer);
-       panel->SetAutoLayout(true);
-       panel->Layout();
+
+       this->ConnectComponents( ); //DFCH
+
+       panel->SetSizer( sizer );
+       panel->SetAutoLayout( true );
+       panel->Layout( );
+
 }
 
 //---------------------------------------------------------------------------
-wxManualPaintPanel::~wxManualPaintPanel() {
+wxManualPaintPanel::~wxManualPaintPanel( )
+{
 }
 
+//--------------------------------------------------------------------------
+/*
+ * The following function allows the management of the events
+ */
+void wxManualPaintPanel::ConnectComponents( ) //DFCH
+{
+       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(),
+                               wxEVT_COMMAND_TEXT_UPDATED,
+                               (wxObjectEventFunction) (void(wxPanel::*)(
+                                                               wxCommandEvent&)) &wxManualPaintPanel::OnCtrTxtGrayLevel);
+
+               this->Connect (
+                               _sldToleranceFill->GetId(),
+                               wxEVT_SCROLL_THUMBRELEASE,
+                               (wxObjectEventFunction) (void(wxPanel::*)(
+                                                               wxScrollEvent&)) &wxManualPaintPanel::OnSldToleranceFill);this->Connect
+               (
+                               _tolerancefillCtrl->GetId(),
+                               wxEVT_COMMAND_TEXT_UPDATED,
+                               (wxObjectEventFunction) (void(wxPanel::*)(
+                                                               wxCommandEvent&)) &wxManualPaintPanel::OnCtrTxtToleranceFill);
+
+               this->Connect (
+                               _sldDistanceFill->GetId(),
+                               wxEVT_SCROLL_THUMBRELEASE,
+                               (wxObjectEventFunction) (void(wxPanel::*)(
+                                                               wxScrollEvent&)) &wxManualPaintPanel::OnSldDistanceFill);this->Connect
+               (
+                               _distancefillCtrl->GetId(),
+                               wxEVT_COMMAND_TEXT_UPDATED,
+                               (wxObjectEventFunction) (void(wxPanel::*)(
+                                                               wxCommandEvent&)) &wxManualPaintPanel::OnCtrTxtDistanceFill);
+
+               this->Connect (
+                               _rb2D3D->GetId(),
+                               wxEVT_COMMAND_RADIOBOX_SELECTED,
+                               (wxObjectEventFunction) (void(wxPanel::*)(
+                                                               wxCommandEvent&)) &wxManualPaintPanel::On2D3D);this->Connect
+               (
+                               _rbBrushForm->GetId(),
+                               wxEVT_COMMAND_RADIOBOX_SELECTED,
+                               (wxObjectEventFunction) (void(wxPanel::*)(
+                                                               wxCommandEvent&)) &wxManualPaintPanel::OnBrushForm);this->Connect
+               (
+                               _rbBrushTool->GetId(),
+                               wxEVT_COMMAND_RADIOBOX_SELECTED,
+                               (wxObjectEventFunction) (void(wxPanel::*)(
+                                                               wxCommandEvent&)) &wxManualPaintPanel::OnBrushTool);this->Connect
+               (
+                               _btnCopy->GetId(),
+                               wxEVT_COMMAND_BUTTON_CLICKED,
+                               (wxObjectEventFunction) (void(wxPanel::*)(
+                                                               wxCommandEvent&)) &wxManualPaintPanel::OnCopy);
+
+               this->Connect (
+                               _btnUndo->GetId(),
+                               wxEVT_COMMAND_BUTTON_CLICKED,
+                               (wxObjectEventFunction) (void(wxPanel::*)(
+                                                               wxCommandEvent&)) &wxManualPaintPanel::OnUndo);
+               this->Connect(_btnRedo->GetId(),
+                               wxEVT_COMMAND_BUTTON_CLICKED,
+                               (wxObjectEventFunction) (void(wxPanel::*)(
+                                                               wxCommandEvent&)) &wxManualPaintPanel::OnRedo); //DFCH
+
+               this->Connect(
+                               _mBarSlices->GetId(),
+                               wxEVT_TSBAR,
+                               (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onBarrange);
+               //                      Connect(modBarRange->GetId(),98765,(wxObjectEventFunction) (wxCommandEventFunction)  &wxWidgetSliderMinMax::onActualChange_Bar );
+               this->Connect(
+                               _mBarSlices->GetId(),
+                               wxEVT_TSBAR_ACTUAL,
+                               (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onActualChange_Bar);
+               this->Connect(
+                               _mBarSlices->GetId(),
+                               wxEVT_TSBAR_START,
+                               (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onStartChange_Bar);
+               this->Connect(
+                               _mBarSlices->GetId(),
+                               wxEVT_TSBAR_END,
+                               (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onEndChange_Bar);
+               this->Connect(
+                               _mBarSlices->GetId(),
+                               wxEVT_SELECTION_END,
+                               (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onSelectionEnd);
+               this->Connect(
+                               _mBarSlices->GetId(),
+                               wxEVT_TSBAR_MOVED,
+                               (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onMovedBar);
+       }
+
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::OnBrushSize(wxScrollEvent& event) {
-       SetBrushSize(_sldBrushSize->GetValue());
+void wxManualPaintPanel::OnBrushSize( wxScrollEvent& event )
+{
+       SetBrushSize( _sldBrushSize->GetValue( ) );
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::OnSldGrayLevel(wxScrollEvent& event) {
-       SetGrayLevel((double) (_sldGrayLevel->GetValue()));
+void wxManualPaintPanel::OnSldGrayLevel( wxScrollEvent& event )
+{
+       SetGrayLevel( (double) ( _sldGrayLevel->GetValue( )) );
 
        wxString text;
-       text.Printf(wxT("%d"), _sldGrayLevel->GetValue());
-       _graylevelCtrl->SetValue(text);
+       text.Printf( wxT("%d"), _sldGrayLevel->GetValue( ) );
+       _graylevelCtrl->SetValue( text );
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::OnCtrTxtGrayLevel(wxCommandEvent &event) {
+void wxManualPaintPanel::OnCtrTxtGrayLevel( wxCommandEvent &event )
+{
        double graylevel;
-       wxString text = _graylevelCtrl->GetValue();
-       if (text.ToDouble(&graylevel)) {
-               SetGrayLevel(graylevel);
+       wxString text = _graylevelCtrl->GetValue( );
+       if( text.ToDouble( &graylevel ) )
+       {
+               SetGrayLevel( graylevel );
        }
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::OnSldDistanceFill(wxScrollEvent& event) {
-       SetDistanceFill((double) (_sldDistanceFill->GetValue()));
+void wxManualPaintPanel::OnSldDistanceFill( wxScrollEvent& event )
+{
+       SetDistanceFill( (double) ( _sldDistanceFill->GetValue( )) );
 
        wxString text;
-       text.Printf(wxT("%d"), _sldDistanceFill->GetValue());
-       _distancefillCtrl->SetValue(text);
+       text.Printf( wxT("%d"), _sldDistanceFill->GetValue( ) );
+       _distancefillCtrl->SetValue( text );
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::OnCtrTxtDistanceFill(wxCommandEvent &event) {
+void wxManualPaintPanel::OnCtrTxtDistanceFill( wxCommandEvent &event )
+{
        double distancefill;
-       wxString text = _distancefillCtrl->GetValue();
-       if (text.ToDouble(&distancefill)) {
-               SetDistanceFill(distancefill);
+       wxString text = _distancefillCtrl->GetValue( );
+       if( text.ToDouble( &distancefill ) )
+       {
+               SetDistanceFill( distancefill );
        }
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::OnSldToleranceFill(wxScrollEvent& event) {
-       SetToleranceFill((double) (_sldToleranceFill->GetValue()));
+void wxManualPaintPanel::OnSldToleranceFill( wxScrollEvent& event )
+{
+       SetToleranceFill( (double) ( _sldToleranceFill->GetValue( )) );
 
        wxString text;
-       text.Printf(wxT("%d"), _sldToleranceFill->GetValue());
-       _tolerancefillCtrl->SetValue(text);
+       text.Printf( wxT("%d"), _sldToleranceFill->GetValue( ) );
+       _tolerancefillCtrl->SetValue( text );
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::OnCtrTxtToleranceFill(wxCommandEvent &event) {
+void wxManualPaintPanel::OnCtrTxtToleranceFill( wxCommandEvent &event )
+{
        double tolerance;
-       wxString text = _tolerancefillCtrl->GetValue();
-       if (text.ToDouble(&tolerance)) {
-               SetToleranceFill(tolerance);
+       wxString text = _tolerancefillCtrl->GetValue( );
+       if( text.ToDouble( &tolerance ) )
+       {
+               SetToleranceFill( tolerance );
        }
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::DisableControls() {
-       _txtBrushSize->Disable();
-       _sldBrushSize->Disable();
-       _rbBrushForm->Disable();
-
-       _txtToleranceFill->Disable();
-       _sldToleranceFill->Disable();
-       _tolerancefillCtrl->Disable();
-
-       _txtDistanceFill->Disable();
-       _sldDistanceFill->Disable();
-       _distancefillCtrl->Disable();
+void wxManualPaintPanel::DisableControls( )
+{
+       _txtBrushSize->Disable( );
+       _sldBrushSize->Disable( );
+       _rbBrushForm->Disable( );
+
+       _txtToleranceFill->Disable( );
+       _sldToleranceFill->Disable( );
+       _tolerancefillCtrl->Disable( );
+
+       _txtDistanceFill->Disable( );
+       _sldDistanceFill->Disable( );
+       _distancefillCtrl->Disable( );
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::On2D3D(wxCommandEvent &event) {
-       Set2D3D(_rb2D3D->GetSelection());
+void wxManualPaintPanel::On2D3D( wxCommandEvent &event )
+{
+       Set2D3D( _rb2D3D->GetSelection( ) );
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::OnBrushForm(wxCommandEvent &event) {
-       SetBrushForm(_rbBrushForm->GetSelection());
+void wxManualPaintPanel::OnBrushForm( wxCommandEvent &event )
+{
+       SetBrushForm( _rbBrushForm->GetSelection( ) );
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::OnBrushTool(wxCommandEvent &event) {
-       DisableControls();
-       SetTool(_rbBrushTool->GetSelection());
-
-       if (_rbBrushTool->GetSelection() == 0) //Brush tool
-                       {
-               _txtBrushSize->Enable();
-               _sldBrushSize->Enable();
-               _rbBrushForm->Enable();
+void wxManualPaintPanel::OnBrushTool( wxCommandEvent &event )
+{
+       DisableControls( );
+       SetTool( _rbBrushTool->GetSelection( ) );
+
+       if( _rbBrushTool->GetSelection( ) == 0 ) //Brush tool
+       {
+               _txtBrushSize->Enable( );
+               _sldBrushSize->Enable( );
+               _rbBrushForm->Enable( );
        }
 
-       if (_rbBrushTool->GetSelection() == 1) //Fill tool
-                       {
-               _txtToleranceFill->Enable();
-               _sldToleranceFill->Enable();
-               _tolerancefillCtrl->Enable();
+       if( _rbBrushTool->GetSelection( ) == 1 ) //Fill tool
+       {
+               _txtToleranceFill->Enable( );
+               _sldToleranceFill->Enable( );
+               _tolerancefillCtrl->Enable( );
 
-               _txtDistanceFill->Enable();
-               _sldDistanceFill->Enable();
-               _distancefillCtrl->Enable();
+               _txtDistanceFill->Enable( );
+               _sldDistanceFill->Enable( );
+               _distancefillCtrl->Enable( );
        }
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::OnCopy(wxCommandEvent &event) {
+void wxManualPaintPanel::OnCopy( wxCommandEvent &event )
+{
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::OnUndo(wxCommandEvent &event) {
-       this->_manualPaintModel->Undo();
+void wxManualPaintPanel::OnUndo( wxCommandEvent &event )
+{
+       this->_manualPaintModel->Undo( );
 }
 
 //---------------------------------------------------------------------------
-void wxManualPaintPanel::OnRedo(wxCommandEvent &event) {
-       this->_manualPaintModel->Redo();
+void wxManualPaintPanel::OnRedo( wxCommandEvent &event )
+{
+       this->_manualPaintModel->Redo( );
 }
 
 //--------------------------------------------------------------------------------------------------------------------------------
 // Min-Max Barrange received events
 //--------------------------------------------------------------------------------------------------------------------------------
-void wxManualPaintPanel::onBarrange(wxCommandEvent& event) {
+void wxManualPaintPanel::onBarrange( wxCommandEvent& event )
+{
 }
-void wxManualPaintPanel::onActualChange_Bar(wxCommandEvent& event) {
+void wxManualPaintPanel::onActualChange_Bar( wxCommandEvent& event )
+{
        /*mbbtkSliderMinMax->bbSetOutputOutActual(modBarRange->GetActual());
         mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutActual"));*/
 }
-void wxManualPaintPanel::onStartChange_Bar(wxCommandEvent& event) {
-       SetRangeMin(_mBarSlices->GetStart());
+void wxManualPaintPanel::onStartChange_Bar( wxCommandEvent& event )
+{
+       SetRangeMin( _mBarSlices->GetStart( ) );
 }
 
-void wxManualPaintPanel::onEndChange_Bar(wxCommandEvent& event) {
-       SetRangeMax(_mBarSlices->GetEnd());
+void wxManualPaintPanel::onEndChange_Bar( wxCommandEvent& event )
+{
+       SetRangeMax( _mBarSlices->GetEnd( ) );
 }
 
-void wxManualPaintPanel::onSelectionEnd(wxCommandEvent& event) {
+void wxManualPaintPanel::onSelectionEnd( wxCommandEvent& event )
+{
 }
 
-void wxManualPaintPanel::onMovedBar(wxCommandEvent& event) {
+void wxManualPaintPanel::onMovedBar( wxCommandEvent& event )
+{
 }
-//--------------------------------------------------------------------------
 //-------------------------------------------------------------------------
 //--------------------------------------------------------------------------
 //--------------------------------------------------------------------------
index f31216e8973760f6bc4cbc6896deea9b5e3fb2a3..230f9aba1241b4892fe97c042bb13ac9d2473b6a 100644 (file)
@@ -12,6 +12,8 @@ class wxManualPaintPanel: public wxPanel, public ManualPaintPanel {
 public:
        wxManualPaintPanel(wxWindow * parent);
        virtual ~wxManualPaintPanel();
+       //Events
+       void ConnectComponents(); //DFCH
        void OnBrushSize(wxScrollEvent& event);
        void OnSldGrayLevel(wxScrollEvent& event);
        void OnCtrTxtGrayLevel(wxCommandEvent &event);
@@ -56,6 +58,9 @@ private:
        wxTextCtrl *_distancefillCtrl;
 
        mBarRange * _mBarSlices; //DFCH
+       wxButton *_btnCopy; //DFCH
+       wxButton *_btnUndo; //DFCH
+       wxButton *_btnRedo; //DFCH
 
 protected: