]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/wxManualPaintPanel.cpp
#3331 creaMaracasVisu Bug New Normal - Select contour with 2 points, HelpViewerNV
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualPaint / wxManualPaintPanel.cpp
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 #include "wxManualPaintPanel.h"
27 #include <wx/radiobox.h>
28
29 wxManualPaintPanel::wxManualPaintPanel( wxWindow * parent )
30                 : wxPanel( parent, -1 )
31 {
32         wxSizer *sizer = new wxFlexGridSizer( 1 );
33
34         // Widget interface
35         wxStaticText *tittleText = new wxStaticText( this, -1,
36                 _T("             Manual Paint") );
37         //Title
38         sizer->Add( tittleText );
39         //giving some blank spaces
40         sizer->Add( new wxStaticText( this, -1, _T("          key A : Enable/Disable   ") ) );
41
42         this->ConfigureActiveCBButton( );
43         this->ConfigureBrushToolRadioButton( );
44         this->Configure2D3DRadioButton( );
45         this->ConfigureBrushFormRadioButton( );
46         this->ConfigureRangeBar( );
47         this->ConfigureGrayLevelSld( );
48         this->ConfigureBrushSizeSld( );
49         this->ConfigureDistanceFillSld( );
50         this->ConfigureTolFillSld( );
51         this->ConfigureEditButtons( );
52
53         //Buttons
54         wxStaticText *editButtonsText = new wxStaticText( this, -1,
55                 _T("Edit Buttons") );
56         this->_buttonsSizer = new wxFlexGridSizer( 4 );
57         this->_buttonsSizer->Add( _btnUndo, 1, wxGROW );
58         this->_buttonsSizer->Add( _btnRedo, 1, wxGROW );
59         this->_buttonsSizer->Add( _btnCopy, 1, wxGROW );
60
61         this->_gConfigSizer = new wxFlexGridSizer( 1 );
62         //BrushTool Radio Button
63         //giving blank space
64         this->_gConfigSizer->Add(  new wxStaticText( this, -1, _T("             ") ) );
65         //end of blank space
66         this->_gConfigSizer->Add( _rbBrushTool, 1, wxGROW );
67         //2D/3D Radio Button
68         this->_gConfigSizer->Add( _rb2D3D, 1, wxGROW );
69         //RangeBar
70         this->_gConfigSizer->Add(
71                 new wxStaticText( this, -1, _T( "Select Range" ) ), 1, wxGROW );
72         this->_gConfigSizer->Add( _mBarSlices, 1, wxGROW );
73         //GrayLevel Slider
74         this->_gConfigSizer->Add( _txtGrayLevel );
75
76 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
77 #if wxMAJOR_VERSION <= 2
78         wxFlexGridSizer *sizerGrayLevel = new wxFlexGridSizer( 2, wxHORIZONTAL );
79 #else
80         wxFlexGridSizer *sizerGrayLevel = new wxFlexGridSizer( 2 );
81 #endif
82
83         sizerGrayLevel->Add( _sldGrayLevel, 1, wxGROW );
84         sizerGrayLevel->Add( _graylevelCtrl, 1,
85                 wxALIGN_BOTTOM | wxALIGN_LEFT | wxALL, 5 );
86         this->_gConfigSizer->Add( sizerGrayLevel, 1, wxGROW );
87
88         //Brush
89         this->_brushSizer = new wxFlexGridSizer( 1 );
90         //giving blank space
91         this->_brushSizer->Add( new wxStaticText( this, -1, _T("             ") ) );
92         //end of blank space
93         this->_brushSizer->Add(
94                 new wxStaticText( this, -1, _T("Brush Settings") ) );
95         //BrushSize Slider
96         this->_brushSizer->Add( _txtBrushSize );
97
98 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
99 #if wxMAJOR_VERSION <= 2
100         wxFlexGridSizer *sizersdlBrushSize = new wxFlexGridSizer( 2, wxHORIZONTAL );
101 #else
102         wxFlexGridSizer *sizersdlBrushSize = new wxFlexGridSizer( 2 );
103 #endif
104
105         sizersdlBrushSize->Add( _sldBrushSize, 1, wxGROW );
106         sizersdlBrushSize->Add( _BrushSizeCtrl, 1,
107                 wxALIGN_BOTTOM | wxALIGN_LEFT | wxALL, 5 );
108         this->_brushSizer->Add( sizersdlBrushSize );
109         //BrushForm RadioButton
110         this->_brushSizer->Add( _rbBrushForm, 1, wxGROW );
111         //Fill
112         this->_FillSizer = new wxFlexGridSizer( 1 );
113         //giving blank space
114         this->_FillSizer->Add( new wxStaticText( this, -1, _T("             ") ) );
115         //end of blank space
116         this->_FillSizer->Add( new wxStaticText( this, -1, _T("Fill Settings") ) );
117         //ToleranceFill
118         this->_FillSizer->Add( _txtToleranceFill );
119         wxFlexGridSizer *sizerTolerance = new wxFlexGridSizer( 2 );
120         sizerTolerance->Add( _sldToleranceFill, 1, wxGROW );
121         sizerTolerance->Add( _tolerancefillCtrl, 1,
122                 wxALIGN_BOTTOM | wxALIGN_LEFT | wxALL, 5 );
123         this->_FillSizer->Add( sizerTolerance, 1, wxGROW );
124         //Distance Fill
125         this->_FillSizer->Add( _txtDistanceFill );
126         wxFlexGridSizer *sizerDistance = new wxFlexGridSizer( 2 );
127         sizerDistance->Add( _sldDistanceFill, 1, wxGROW );
128         sizerDistance->Add( _distancefillCtrl, 1,
129                 wxALIGN_BOTTOM | wxALIGN_LEFT | wxALL, 5 );
130         this->_FillSizer->Add( sizerDistance );
131
132         sizer->Add( _activeCB );
133         sizer->Add( editButtonsText );
134         sizer->Add( _buttonsSizer );
135         sizer->Add( _gConfigSizer );
136         sizer->Add( _brushSizer );
137         sizer->Add( _FillSizer );
138
139         this->ConnectComponents( ); //DFCH
140         this->_FillSizer->Show( false );
141
142         this->SetSizer( sizer );
143         this->SetAutoLayout( true );
144         this->Layout( );
145
146 }
147
148 //---------------------------------------------------------------------------
149 wxManualPaintPanel::~wxManualPaintPanel( )
150 {
151 }
152
153 //--------------------------------------------------------------------------
154 void wxManualPaintPanel::ConfigureActiveCBButton( )
155 {
156    _activeCB = new wxCheckBox (this, -1, _T("Active") );
157    _activeCB->SetValue(true);
158    SetActive( _activeCB->GetValue() );
159 }
160
161
162 //Panel Config
163 //--------------------------------------------------------------------------
164 void wxManualPaintPanel::ConfigureBrushToolRadioButton( )
165 {
166         wxString lstBrushForm[ 2 ];
167         lstBrushForm[ 0 ] = _T("rectangle/cube");
168         lstBrushForm[ 1 ] = _T("circle/sphere");
169         _rbBrushForm = new wxRadioBox( this, -1, _T("Brush form"),
170                 wxDefaultPosition, wxSize( 270, 45 ), 2, lstBrushForm, 2,
171                 wxRA_SPECIFY_COLS );
172 }
173
174 //--------------------------------------------------------------------------
175 void wxManualPaintPanel::Configure2D3DRadioButton( )
176 {
177         wxString lst2D3D[ 2 ];
178         lst2D3D[ 0 ] = _T("2D");
179         lst2D3D[ 1 ] = _T("3D");
180         _rb2D3D = new wxRadioBox( this, -1, _T("2D / 3D"), wxDefaultPosition,
181                 wxSize( 270, 45 ), 2, lst2D3D, 2, wxRA_SPECIFY_COLS );
182         _rb2D3D->SetSelection( 1 );
183
184 }
185
186 //--------------------------------------------------------------------------
187 void wxManualPaintPanel::ConfigureBrushFormRadioButton( )
188 {
189         wxString lstBrushTool[ 2 ];
190         lstBrushTool[ 0 ] = _T("Brush");
191         lstBrushTool[ 1 ] = _T("Fill");
192         _rbBrushTool = new wxRadioBox( this, -1, _T("Brush tool"),
193                 wxDefaultPosition, wxSize( 270, 45 ), 2, lstBrushTool, 2,
194                 wxRA_SPECIFY_COLS );
195 }
196
197 //--------------------------------------------------------------------------
198 void wxManualPaintPanel::ConfigureRangeBar( )
199 {
200         //DFCH -- BarSlices
201         double range[ 2 ];
202         GetScalarRange( range );
203         int min = 0; //range[0];
204         int max = 6000; //range[1];
205         _mBarSlices = new mBarRange( this, 70, 65 );
206         _mBarSlices->SetMin( 0 );
207         _mBarSlices->SetStart( 0 );
208         _mBarSlices->SetOrientation( true );
209         _mBarSlices->setActiveStateTo( true );
210         _mBarSlices->setVisibleLabels( true );
211         _mBarSlices->setDeviceEndMargin( 10 );
212         _mBarSlices->setDeviceBlitStart( 10, 10 );
213         _mBarSlices->setIfWithActualDrawed( false );
214         _mBarSlices->setRepresentedValues( min, max );
215         _mBarSlices->SetStart( min );
216         _mBarSlices->SetEnd( max );
217         _mBarSlices->Update( );
218
219         SetRangeMin( min );
220         SetRangeMax( max );
221
222         //DFCH -- End BarSlices
223 }
224 //--------------------------------------------------------------------------
225 void wxManualPaintPanel::ConfigureGrayLevelSld( )
226 {
227         _txtGrayLevel = new wxStaticText( this, -1,
228         wxString( _T("  Gray Level  ") ) );
229         _sldGrayLevel = new wxSlider( this, -1, 0, 0, 255, wxDefaultPosition,
230         wxDefaultSize, wxSL_LABELS );
231         _sldGrayLevel->SetMinSize( wxSize( 200, -1 ) );
232         _sldGrayLevel->SetMaxSize( wxSize( 200, -1 ) );
233         _graylevelCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
234         wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
235 }
236 //--------------------------------------------------------------------------
237 void wxManualPaintPanel::ConfigureBrushSizeSld( )
238 {
239         _txtBrushSize = new wxStaticText( this, -1,
240         wxString( _T("  Brush size  ") ) );
241         _sldBrushSize = new wxSlider( this, -1, 1, 1, 50, wxDefaultPosition,
242         wxDefaultSize, wxSL_LABELS );
243         _BrushSizeCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
244         wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
245         _sldBrushSize->SetMinSize( wxSize( 200, -1 ) );
246         _sldBrushSize->SetMaxSize( wxSize( 200, -1 ) );
247 }
248 //--------------------------------------------------------------------------
249 void wxManualPaintPanel::ConfigureDistanceFillSld( )
250 {
251         _txtDistanceFill = new wxStaticText( this, -1,
252         wxString( _T("  Distance fill  ") ) );
253         _sldDistanceFill = new wxSlider( this, -1, 50, 1, 500, wxDefaultPosition,
254         wxDefaultSize, wxSL_LABELS );
255         _sldDistanceFill->SetMinSize( wxSize( 200, -1 ) );
256         _sldDistanceFill->SetMaxSize( wxSize( 200, -1 ) );
257         _distancefillCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
258         wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 500, 50 );
259         _txtDistanceFill->Disable( );
260         _sldDistanceFill->Disable( );
261         _distancefillCtrl->Disable( );
262 }
263 //--------------------------------------------------------------------------
264 void wxManualPaintPanel::ConfigureTolFillSld( )
265 {
266         _txtToleranceFill = new wxStaticText( this, -1,
267                 wxString( _T("  Tolerance fill  ") ) );
268         _sldToleranceFill = new wxSlider( this, -1, 125, 0, 255, wxDefaultPosition,
269                 wxDefaultSize, wxSL_LABELS );
270         _sldToleranceFill->SetMinSize( wxSize( 200, -1 ) );
271         _sldToleranceFill->SetMaxSize( wxSize( 200, -1 ) );
272         _tolerancefillCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
273                 wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 50 );
274         _txtToleranceFill->Disable( );
275         _sldToleranceFill->Disable( );
276         _tolerancefillCtrl->Disable( );
277
278 }
279 //--------------------------------------------------------------------------
280 void wxManualPaintPanel::ConfigureEditButtons( )
281 {
282         _btnCopy = new wxButton( this, -1, _T("Copy") );
283         _btnCopy->Disable( );
284         _btnUndo = new wxButton( this, -1, _T("Undo") );
285         _btnRedo = new wxButton( this, -1, _T("Redo") );
286         //btnUndo->Disable();
287 }
288 //--------------------------------------------------------------------------
289
290 /*
291  * The following function allows the management of the events
292  */
293 void wxManualPaintPanel::ConnectComponents( ) //DFCH
294 {
295         this->Connect(_sldBrushSize->GetId( ),
296                 wxEVT_SCROLL_THUMBRELEASE,
297                 (wxObjectEventFunction) (void(wxPanel::*)(
298                 wxScrollEvent& )) (&wxManualPaintPanel::OnBrushSize) );this ->Connect (_sldGrayLevel->GetId(),
299                 wxEVT_SCROLL_THUMBRELEASE,
300                 (wxObjectEventFunction) (void(wxPanel::*)( wxScrollEvent&)) &wxManualPaintPanel::OnSldGrayLevel);
301
302                 this->Connect(  _graylevelCtrl->GetId(),
303                                 wxEVT_COMMAND_TEXT_UPDATED,
304                                 (wxObjectEventFunction) (void(wxPanel::*)(
305                                                                 wxCommandEvent&)) &wxManualPaintPanel::OnCtrTxtGrayLevel);
306
307                 this->Connect (
308                                 _sldToleranceFill->GetId(),
309                                 wxEVT_SCROLL_THUMBRELEASE,
310                                 (wxObjectEventFunction) (void(wxPanel::*)(
311                                                                 wxScrollEvent&)) &wxManualPaintPanel::OnSldToleranceFill);this->Connect
312                 (
313                                 _tolerancefillCtrl->GetId(),
314                                 wxEVT_COMMAND_TEXT_UPDATED,
315                                 (wxObjectEventFunction) (void(wxPanel::*)(
316                                                                 wxCommandEvent&)) &wxManualPaintPanel::OnCtrTxtToleranceFill);
317
318                 this->Connect (
319                                 _sldDistanceFill->GetId(),
320                                 wxEVT_SCROLL_THUMBRELEASE,
321                                 (wxObjectEventFunction) (void(wxPanel::*)(
322                                                                 wxScrollEvent&)) &wxManualPaintPanel::OnSldDistanceFill);this->Connect
323                 (
324                                 _distancefillCtrl->GetId(),
325                                 wxEVT_COMMAND_TEXT_UPDATED,
326                                 (wxObjectEventFunction) (void(wxPanel::*)(
327                                                                 wxCommandEvent&)) &wxManualPaintPanel::OnCtrTxtDistanceFill);
328
329                 this->Connect (
330                                 _rb2D3D->GetId(),
331                                 wxEVT_COMMAND_RADIOBOX_SELECTED,
332                                 (wxObjectEventFunction) (void(wxPanel::*)(
333                                                                 wxCommandEvent&)) &wxManualPaintPanel::On2D3D);this->Connect
334                 (
335                                 _rbBrushForm->GetId(),
336                                 wxEVT_COMMAND_RADIOBOX_SELECTED,
337                                 (wxObjectEventFunction) (void(wxPanel::*)(
338                                                                 wxCommandEvent&)) &wxManualPaintPanel::OnBrushForm);this->Connect
339                 (
340                                 _rbBrushTool->GetId(),
341                                 wxEVT_COMMAND_RADIOBOX_SELECTED,
342                                 (wxObjectEventFunction) (void(wxPanel::*)(
343                                                                 wxCommandEvent&)) &wxManualPaintPanel::OnBrushTool);this->Connect
344                 (
345                                 _btnCopy->GetId(),
346                                 wxEVT_COMMAND_BUTTON_CLICKED,
347                                 (wxObjectEventFunction) (void(wxPanel::*)(
348                                                                 wxCommandEvent&)) &wxManualPaintPanel::OnCopy);
349
350                 this->Connect (
351                                 _btnUndo->GetId(),
352                                 wxEVT_COMMAND_BUTTON_CLICKED,
353                                 (wxObjectEventFunction) (void(wxPanel::*)(
354                                                                 wxCommandEvent&)) &wxManualPaintPanel::OnUndo);
355                 this->Connect(_btnRedo->GetId(),
356                                 wxEVT_COMMAND_BUTTON_CLICKED,
357                                 (wxObjectEventFunction) (void(wxPanel::*)(
358                                                                 wxCommandEvent&)) &wxManualPaintPanel::OnRedo); //DFCH
359
360                 this->Connect(
361                                 _mBarSlices->GetId(),
362                                 wxEVT_TSBAR,
363                                 (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onBarrange);
364                 //                      Connect(modBarRange->GetId(),98765,(wxObjectEventFunction) (wxCommandEventFunction)  &wxWidgetSliderMinMax::onActualChange_Bar );
365                 this->Connect(
366                                 _mBarSlices->GetId(),
367                                 wxEVT_TSBAR_ACTUAL,
368                                 (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onActualChange_Bar);
369                 this->Connect(
370                                 _mBarSlices->GetId(),
371                                 wxEVT_TSBAR_START,
372                                 (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onStartChange_Bar);
373                 this->Connect(
374                                 _mBarSlices->GetId(),
375                                 wxEVT_TSBAR_END,
376                                 (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onEndChange_Bar);
377                 this->Connect(
378                                 _mBarSlices->GetId(),
379                                 wxEVT_SELECTION_END,
380                                 (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onSelectionEnd);
381                 this->Connect(
382                                 _mBarSlices->GetId(),
383                                 wxEVT_TSBAR_MOVED,
384                                 (wxObjectEventFunction) (wxCommandEventFunction) &wxManualPaintPanel::onMovedBar);
385                 this->Connect
386                 (
387                                 _BrushSizeCtrl->GetId(),
388                                 wxEVT_COMMAND_TEXT_UPDATED,
389                                 (wxObjectEventFunction) (void(wxPanel::*)(
390                                                                 wxCommandEvent&)) &wxManualPaintPanel::OnCtrBrushSize);
391                 this->Connect
392                 (
393                         _activeCB->GetId(),
394                         wxEVT_COMMAND_CHECKBOX_CLICKED, 
395                         (wxObjectEventFunction) (void (wxPanel::*)(wxCommandEvent&))&wxManualPaintPanel::OnActive);
396
397         }
398
399
400   //-------------------------------------------------------------------------
401   void wxManualPaintPanel::OnActive(wxCommandEvent& event)
402   {
403         printf("EED wxManualPaintPanel::OnActive \n");
404         SetActive( _activeCB->GetValue() );
405   }
406
407
408 //---------------------------------------------------------------------------
409 void wxManualPaintPanel::OnBrushSize( wxScrollEvent& event )
410 {
411         SetBrushSize( this->_sldBrushSize->GetValue( ) );
412         wxString text;
413         text.Printf( wxT("%d"), this->_sldBrushSize->GetValue( ) );
414         _BrushSizeCtrl->SetValue( text );
415 }
416
417 //---------------------------------------------------------------------------
418 void wxManualPaintPanel::OnSldGrayLevel( wxScrollEvent& event )
419 {
420         SetGrayLevel( (double) ( _sldGrayLevel->GetValue( )) );
421
422         wxString text;
423         text.Printf( wxT("%d"), _sldGrayLevel->GetValue( ) );
424         _graylevelCtrl->SetValue( text );
425 }
426
427 //---------------------------------------------------------------------------
428 void wxManualPaintPanel::OnCtrTxtGrayLevel( wxCommandEvent &event )
429 {
430         int graylevel = this->_graylevelCtrl->GetValue( );
431         this->_sldGrayLevel->SetValue( graylevel );
432         SetGrayLevel( graylevel );
433 }
434
435 //---------------------------------------------------------------------------
436 void wxManualPaintPanel::OnSldDistanceFill( wxScrollEvent& event )
437 {
438         SetDistanceFill( (double) ( _sldDistanceFill->GetValue( )) );
439
440         wxString text;
441         text.Printf( wxT("%d"), _sldDistanceFill->GetValue( ) );
442         _distancefillCtrl->SetValue( text );
443 }
444
445 //---------------------------------------------------------------------------
446 void wxManualPaintPanel::OnCtrTxtDistanceFill( wxCommandEvent &event )
447 {
448         int distancefill = this->_distancefillCtrl->GetValue( );
449         this->_sldDistanceFill->SetValue( distancefill );
450         SetDistanceFill( distancefill );
451 }
452 //---------------------------------------------------------------------------
453 void wxManualPaintPanel::OnCtrBrushSize( wxCommandEvent &event )
454 {
455         int brushSize = _BrushSizeCtrl->GetValue( );
456         this->_sldBrushSize->SetValue( brushSize );
457         SetBrushSize( brushSize );
458 }
459
460 //---------------------------------------------------------------------------
461 void wxManualPaintPanel::OnSldToleranceFill( wxScrollEvent& event )
462 {
463         SetToleranceFill( (double) ( _sldToleranceFill->GetValue( )) );
464
465         wxString text;
466         text.Printf( wxT("%d"), _sldToleranceFill->GetValue( ) );
467         _tolerancefillCtrl->SetValue( text );
468 }
469
470 //---------------------------------------------------------------------------
471 void wxManualPaintPanel::OnCtrTxtToleranceFill( wxCommandEvent &event )
472 {
473         int tolerance = _tolerancefillCtrl->GetValue( );
474         this->_sldToleranceFill->SetValue( tolerance );
475         SetToleranceFill( tolerance );
476 }
477
478 //---------------------------------------------------------------------------
479 void wxManualPaintPanel::DisableControls( )
480 {
481         _txtBrushSize->Disable( );
482         _sldBrushSize->Disable( );
483         _rbBrushForm->Disable( );
484
485         _txtToleranceFill->Disable( );
486         _sldToleranceFill->Disable( );
487         _tolerancefillCtrl->Disable( );
488
489         _txtDistanceFill->Disable( );
490         _sldDistanceFill->Disable( );
491         _distancefillCtrl->Disable( );
492 }
493
494 //---------------------------------------------------------------------------
495 void wxManualPaintPanel::On2D3D( wxCommandEvent &event )
496 {
497         Set2D3D( _rb2D3D->GetSelection( ) );
498 }
499
500 //---------------------------------------------------------------------------
501 void wxManualPaintPanel::OnBrushForm( wxCommandEvent &event )
502 {
503         SetBrushForm( _rbBrushForm->GetSelection( ) );
504 }
505
506 //---------------------------------------------------------------------------
507 void wxManualPaintPanel::OnBrushTool( wxCommandEvent &event )
508 {
509         DisableControls( );
510         SetTool( _rbBrushTool->GetSelection( ) );
511
512         if( _rbBrushTool->GetSelection( ) == 0 ) //Brush tool
513         {
514                 _txtBrushSize->Enable( );
515                 _sldBrushSize->Enable( );
516                 _rbBrushForm->Enable( );
517                 _brushSizer->Show( true );
518                 _FillSizer->Show( false );
519                 this->Layout( );
520         }
521
522         if( _rbBrushTool->GetSelection( ) == 1 ) //Fill tool
523         {
524                 _txtToleranceFill->Enable( );
525                 _sldToleranceFill->Enable( );
526                 _tolerancefillCtrl->Enable( );
527
528                 _txtDistanceFill->Enable( );
529                 _sldDistanceFill->Enable( );
530                 _distancefillCtrl->Enable( );
531                 _FillSizer->Show( true );
532                 _brushSizer->Show( false );
533                 this->Layout( );
534         }
535 }
536
537 //---------------------------------------------------------------------------
538 void wxManualPaintPanel::OnCopy( wxCommandEvent &event )
539 {
540 }
541
542 //---------------------------------------------------------------------------
543 void wxManualPaintPanel::OnUndo( wxCommandEvent &event )
544 {
545         this->_manualPaintModel->Undo( );
546 }
547
548 //---------------------------------------------------------------------------
549 void wxManualPaintPanel::OnRedo( wxCommandEvent &event )
550 {
551         this->_manualPaintModel->Redo( );
552 }
553
554 //--------------------------------------------------------------------------------------------------------------------------------
555 // Min-Max Barrange received events
556 //--------------------------------------------------------------------------------------------------------------------------------
557 void wxManualPaintPanel::onBarrange( wxCommandEvent& event )
558 {
559 }
560 void wxManualPaintPanel::onActualChange_Bar( wxCommandEvent& event )
561 {
562         /*mbbtkSliderMinMax->bbSetOutputOutActual(modBarRange->GetActual());
563          mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutActual"));*/
564 }
565 void wxManualPaintPanel::onStartChange_Bar( wxCommandEvent& event )
566 {
567         SetRangeMin( _mBarSlices->GetStart( ) );
568 }
569
570 void wxManualPaintPanel::onEndChange_Bar( wxCommandEvent& event )
571 {
572         SetRangeMax( _mBarSlices->GetEnd( ) );
573 }
574
575 void wxManualPaintPanel::onSelectionEnd( wxCommandEvent& event )
576 {
577 }
578
579 void wxManualPaintPanel::onMovedBar( wxCommandEvent& event )
580 {
581 }
582 //-------------------------------------------------------------------------
583 //--------------------------------------------------------------------------
584 //--------------------------------------------------------------------------
585