1 #include <creaImageIOWxGimmickTools.h>
6 ** Begin of the threshold panel
8 WxGimmickTools::WxGimmickTools(wxWindow* parent)
9 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
11 wxButton *thresholdGoBtn = new wxButton(this,wxID_ANY,_T("Add Fake Color"), wxDefaultPosition, wxSize(200,30) );
12 wxButton *thresholdRemoveBtn = new wxButton(this,wxID_ANY,_T("Remove Fake Color"), wxDefaultPosition, wxSize(200,30) );
13 _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image interpolation") );
14 _interpolationCheckBox->SetValue(true);
15 _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
19 interfMainPanel::getInstance()->getImageRange(range);
21 int min = (int)floor (range[0]);
22 int max = (int)ceil (range[1]);
24 _mBarThreshold = new mBarRange(this,70,65);
25 _mBarThreshold->SetMin(0);
26 _mBarThreshold->SetStart(0);
27 _mBarThreshold-> SetOrientation( true );
28 _mBarThreshold-> setActiveStateTo(true);
29 _mBarThreshold-> setVisibleLabels( true );
30 _mBarThreshold-> setDeviceEndMargin(10);
31 _mBarThreshold-> setRepresentedValues( min , max );
32 _mBarThreshold-> setDeviceBlitStart(10,10);
33 _mBarThreshold-> setIfWithActualDrawed( false );
34 _mBarThreshold-> SetStart( min );
35 _mBarThreshold-> SetEnd( max );
37 Connect( thresholdGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxGimmickTools::onThresholdGo );
38 Connect( thresholdRemoveBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxGimmickTools::onThresholdRemove );
39 Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxGimmickTools::onThresholdInterpolation );
41 wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
42 sizer -> Add( new wxStaticText(this,-1,_T("Image Threshold")) , 1, wxGROW );
43 sizer -> Add( _mBarThreshold, 1, wxGROW );
44 sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
45 sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level")) , 1, wxGROW );
46 sizer -> Add( _opacity, 1, wxGROW );
47 sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
48 sizer -> Add( thresholdGoBtn, 1, wxGROW );
49 sizer -> Add( thresholdRemoveBtn, 1, wxGROW );
50 sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
51 sizer -> Add( _interpolationCheckBox, 1, wxGROW );
53 this->SetSizer( sizer );
54 this->SetAutoLayout( true );
58 WxGimmickTools::~WxGimmickTools(){
63 void WxGimmickTools::onThresholdChange(wxCommandEvent& event)
67 //interfMainPanel::getInstance()->onThresholdChange();
71 void WxGimmickTools::onThresholdGo(wxCommandEvent& event)
75 //interfMainPanel::getInstance()->onThreshold();
80 void WxGimmickTools::onThresholdRemove(wxCommandEvent& event)
84 //interfMainPanel::getInstance()->onThresholdRemove( );
89 void WxGimmickTools::onThresholdStop()
93 //interfMainPanel::getInstance()->onThresholdRemove( );
98 void WxGimmickTools::onThresholdInstantChange(double range[])
100 range[0] = _mBarThreshold->GetStart();
101 range[1] = _mBarThreshold->GetEnd();
104 void WxGimmickTools::onThresholdInterpolation(wxCommandEvent& event)
106 //interfMainPanel::getInstance()->onThresholdInterpolation(_interpolationCheckBox->GetValue());
109 void WxGimmickTools::onChangeOpacity(wxScrollEvent& event)
111 int opacity = _opacity->GetValue();
112 //interfMainPanel::getInstance()->onThresholdChangeOpacity(opacity);
115 BEGIN_EVENT_TABLE(WxGimmickTools, wxPanel)
116 EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_START, WxGimmickTools :: onThresholdChange)
117 EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_END, WxGimmickTools :: onThresholdChange)
118 EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_MOVED, WxGimmickTools :: onThresholdChange)
119 EVT_SCROLL(WxGimmickTools :: onChangeOpacity)
122 } // EO namespace creaImageIO