#include <PanelBullEyeOptions.h>
Public Member Functions | |
PanelBullEyeOptions (wxWindow *parent, wxSize size) | |
~PanelBullEyeOptions () | |
void | onRefreshPanel (wxCommandEvent &event) |
int | GetNumberOfCrowns () |
int | GetNumberOfSections (int nCrown) |
int | GetRadioOfCrown (int nCrown) |
double | GetAngOfCrownSection (int nCrown, int section) |
double | GetAngDeltaOfCrownSection (int nCrown) |
Private Member Functions | |
void | RefreshPanel () |
Private Attributes | |
int | _maxLevels |
int | _maxSections |
wxRadioBox * | _radioboxBullEyeGenOpt |
wxSpinCtrl * | _spinctrlBullEyeNumOfCrowns |
wxSpinCtrl * | _spinctrlBullEyeNumOfSec |
wxSlider * | _sliderBullEyeAngle |
std::vector< wxSpinCtrl * > | _lstBullEyeDetailNumOfSec |
std::vector< wxSlider * > | _lstBullEyeDetailRadio |
std::vector< wxSlider * > | _lstBullEyeDetailAngle |
Definition at line 29 of file PanelBullEyeOptions.h.
PanelBullEyeOptions::PanelBullEyeOptions | ( | wxWindow * | parent, | |
wxSize | size | |||
) |
Definition at line 12 of file PanelBullEyeOptions.cxx.
References _lstBullEyeDetailAngle, _lstBullEyeDetailNumOfSec, _lstBullEyeDetailRadio, _maxLevels, _maxSections, _radioboxBullEyeGenOpt, _sliderBullEyeAngle, _spinctrlBullEyeNumOfCrowns, _spinctrlBullEyeNumOfSec, onRefreshPanel(), and RefreshPanel().
00012 : 00013 wxPanel(parent, -1, wxDefaultPosition, size) 00014 { 00015 00016 _maxLevels = 5; 00017 _maxSections = 10; 00018 wxSize sizepanel(190,300); 00019 wxPanel *panel = this; 00020 00021 00022 wxString lstOptions[2]; 00023 lstOptions[0]= wxString("General options",wxConvUTF8); 00024 lstOptions[1]= wxString("Detail options",wxConvUTF8); 00025 _radioboxBullEyeGenOpt = new wxRadioBox(panel, -1, wxString("General/Detail options",wxConvUTF8), wxDefaultPosition, wxSize(200,45), 2 , lstOptions, 2, wxRA_SPECIFY_COLS); 00026 _radioboxBullEyeGenOpt->SetSelection(0); 00027 00028 _spinctrlBullEyeNumOfCrowns = new wxSpinCtrl( panel , -1,_T("B"),wxDefaultPosition, wxSize(40,20) ); 00029 _spinctrlBullEyeNumOfCrowns->SetRange(1,_maxLevels); 00030 _spinctrlBullEyeNumOfCrowns->SetValue(3); 00031 00032 _spinctrlBullEyeNumOfSec = new wxSpinCtrl( panel , -1,_T("A"),wxDefaultPosition, wxSize(40,20) ); 00033 _spinctrlBullEyeNumOfSec->SetRange(1,_maxSections); 00034 _spinctrlBullEyeNumOfSec->SetValue(5); 00035 00036 00037 _sliderBullEyeAngle = new wxSlider( panel , -1 ,0,0,180, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); 00038 00039 wxFlexGridSizer * sizerGeneralOptions = new wxFlexGridSizer(10); 00040 00041 wxFlexGridSizer * sizerGeneralOptionsA = new wxFlexGridSizer(1); 00042 wxFlexGridSizer * sizerGeneralOptionsB = new wxFlexGridSizer(1); 00043 wxFlexGridSizer * sizerGeneralOptionsC = new wxFlexGridSizer(1); 00044 sizerGeneralOptionsA -> Add( new wxStaticText(panel,-1,_T("Crowns")) , 1, wxGROW ); 00045 sizerGeneralOptionsA -> Add( _spinctrlBullEyeNumOfCrowns , 1/*, wxGROW*/ ); 00046 sizerGeneralOptionsB -> Add( new wxStaticText(panel,-1,_T("Sections")) , 1, wxGROW ); 00047 sizerGeneralOptionsB -> Add( _spinctrlBullEyeNumOfSec , 1/*, wxGROW*/ ); 00048 sizerGeneralOptionsC -> Add( new wxStaticText(panel,-1,_T(" Angle")) , 1, wxGROW ); 00049 sizerGeneralOptionsC -> Add( _sliderBullEyeAngle , 1/*, wxGROW*/ ); 00050 00051 sizerGeneralOptions -> Add( sizerGeneralOptionsA , 1/*, wxGROW*/ ); 00052 sizerGeneralOptions -> Add( new wxStaticText(panel,-1,_T(" ")) , 1, wxGROW ); 00053 sizerGeneralOptions -> Add( sizerGeneralOptionsB , 1/*, wxGROW*/ ); 00054 sizerGeneralOptions -> Add( new wxStaticText(panel,-1,_T(" ")) , 1, wxGROW ); 00055 sizerGeneralOptions -> Add( sizerGeneralOptionsC , 1/*, wxGROW*/ ); 00056 00057 00058 wxSpinCtrl *tmpSpinSection; 00059 wxSlider *tmpSliderRadio; 00060 wxSlider *tmpSliderAng; 00061 00062 wxFlexGridSizer * sizerDetailOptions = new wxFlexGridSizer(6); 00063 00064 sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("Crown ")) , 1, wxGROW ); 00065 sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" Sections ")) , 1, wxGROW ); 00066 sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" ")) , 1, wxGROW ); 00067 sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" Radio %")) , 1, wxGROW ); 00068 sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" ")) , 1, wxGROW ); 00069 sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" Angle")) , 1, wxGROW ); 00070 00071 wxString tmpwxstring; 00072 int i; 00073 for (i=0;i<_maxLevels;i++){ 00074 tmpSpinSection = new wxSpinCtrl( panel , -1,_T(""),wxDefaultPosition, wxSize(40,20) ); 00075 tmpSliderRadio = new wxSlider( panel , -1 ,0,0,100, wxDefaultPosition, wxSize(110,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); 00076 tmpSliderAng = new wxSlider( panel , -1 ,0,0,180, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); 00077 00078 tmpSpinSection ->SetRange(1,_maxSections); 00079 00080 tmpwxstring.Printf(_T(" %d. "),i+1); 00081 sizerDetailOptions -> Add( new wxStaticText(panel,-1,tmpwxstring) , 1, wxGROW ); 00082 sizerDetailOptions -> Add( tmpSpinSection, 1 ); 00083 sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" ")) , 1, wxGROW ); 00084 sizerDetailOptions -> Add( tmpSliderRadio, 1, wxGROW ); 00085 sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" ")) , 1, wxGROW ); 00086 sizerDetailOptions -> Add( tmpSliderAng, 1, wxGROW ); 00087 00088 tmpSpinSection -> SetValue(5); 00089 tmpSliderRadio -> SetValue( 100-(double)((i)*100.0/_maxLevels) ); 00090 tmpSliderAng -> SetValue(0); 00091 00092 Connect( tmpSliderRadio->GetId(), wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel ); 00093 Connect( tmpSliderRadio->GetId(), wxEVT_SCROLL_CHANGED , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel ); 00094 00095 _lstBullEyeDetailNumOfSec.push_back( tmpSpinSection ); 00096 _lstBullEyeDetailRadio.push_back( tmpSliderRadio ); 00097 _lstBullEyeDetailAngle.push_back( tmpSliderAng ); 00098 00099 } //for 00100 00101 wxFlexGridSizer * sizer = new wxFlexGridSizer(1); 00102 sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW ); 00103 sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW ); 00104 sizer -> Add( _radioboxBullEyeGenOpt , 1, wxGROW ); 00105 sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW ); 00106 sizer -> Add( new wxStaticText(panel,-1,_T(" -- Bull Eye general options --")) , 1, wxGROW ); 00107 sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW ); 00108 sizer -> Add( sizerGeneralOptions , 1, wxGROW ); 00109 sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW ); 00110 sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW ); 00111 sizer -> Add( new wxStaticText(panel,-1,_T(" -- Bull Eye detail options --")) , 1, wxGROW ); 00112 sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW ); 00113 sizer -> Add( sizerDetailOptions , 1, wxGROW ); 00114 00115 Connect( _radioboxBullEyeGenOpt->GetId(), wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel ); 00116 Connect( _spinctrlBullEyeNumOfCrowns->GetId(), wxEVT_COMMAND_TEXT_UPDATED , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel ); 00117 00118 panel->SetSizer( sizer ); 00119 panel->SetSize( sizepanel ); 00120 panel->SetAutoLayout( true ); 00121 panel->Layout(); 00122 00123 RefreshPanel(); 00124 00125 }
PanelBullEyeOptions::~PanelBullEyeOptions | ( | ) |
double PanelBullEyeOptions::GetAngDeltaOfCrownSection | ( | int | nCrown | ) |
Definition at line 219 of file PanelBullEyeOptions.cxx.
References GetNumberOfSections().
Referenced by GetAngOfCrownSection().
00220 { 00221 double numOfSec = (double)GetNumberOfSections(nCrown); 00222 return 360.0/numOfSec; 00223 }
double PanelBullEyeOptions::GetAngOfCrownSection | ( | int | nCrown, | |
int | section | |||
) |
Definition at line 204 of file PanelBullEyeOptions.cxx.
References _lstBullEyeDetailAngle, _radioboxBullEyeGenOpt, _sliderBullEyeAngle, and GetAngDeltaOfCrownSection().
00205 { 00206 double angle; 00207 if (this->_radioboxBullEyeGenOpt->GetSelection()==0) 00208 { 00209 angle = this->_sliderBullEyeAngle->GetValue(); 00210 } else { 00211 angle = this->_lstBullEyeDetailAngle[nCrown]->GetValue(); 00212 } 00213 // double numOfSec = (double)GetNumberOfSections(nCrown); 00214 double deltaSec = GetAngDeltaOfCrownSection(nCrown); 00215 return angle + section*deltaSec ; 00216 }
int PanelBullEyeOptions::GetNumberOfCrowns | ( | ) |
Definition at line 170 of file PanelBullEyeOptions.cxx.
References _spinctrlBullEyeNumOfCrowns.
00171 { 00172 return this->_spinctrlBullEyeNumOfCrowns->GetValue(); 00173 }
int PanelBullEyeOptions::GetNumberOfSections | ( | int | nCrown | ) |
Definition at line 176 of file PanelBullEyeOptions.cxx.
References _lstBullEyeDetailNumOfSec, _radioboxBullEyeGenOpt, and _spinctrlBullEyeNumOfSec.
Referenced by GetAngDeltaOfCrownSection().
00177 { 00178 int result; 00179 if (this->_radioboxBullEyeGenOpt->GetSelection()==0) 00180 { 00181 result = this->_spinctrlBullEyeNumOfSec->GetValue(); 00182 } else { 00183 result = this->_lstBullEyeDetailNumOfSec[nCrown]->GetValue(); 00184 } 00185 return result; 00186 }
int PanelBullEyeOptions::GetRadioOfCrown | ( | int | nCrown | ) |
Definition at line 189 of file PanelBullEyeOptions.cxx.
References _lstBullEyeDetailRadio, _radioboxBullEyeGenOpt, and _spinctrlBullEyeNumOfCrowns.
00190 { 00191 int result; 00192 double sizeCrowns; 00193 if (this->_radioboxBullEyeGenOpt->GetSelection()==0) 00194 { 00195 sizeCrowns = (double)( this->_spinctrlBullEyeNumOfCrowns->GetValue() ); 00196 result = 100.0 * (nCrown+1)/sizeCrowns ; 00197 } else { 00198 result = this->_lstBullEyeDetailRadio[nCrown]->GetValue(); 00199 } 00200 return result; 00201 }
void PanelBullEyeOptions::onRefreshPanel | ( | wxCommandEvent & | event | ) |
Definition at line 133 of file PanelBullEyeOptions.cxx.
References RefreshPanel().
Referenced by PanelBullEyeOptions().
00134 { 00135 RefreshPanel(); 00136 }
void PanelBullEyeOptions::RefreshPanel | ( | ) | [private] |
Definition at line 139 of file PanelBullEyeOptions.cxx.
References _lstBullEyeDetailAngle, _lstBullEyeDetailNumOfSec, _lstBullEyeDetailRadio, _maxLevels, _radioboxBullEyeGenOpt, and _spinctrlBullEyeNumOfCrowns.
Referenced by onRefreshPanel(), and PanelBullEyeOptions().
00140 { 00141 int i; 00142 bool ok; 00143 if (this->_radioboxBullEyeGenOpt->GetSelection()==0){ 00144 for (i=0; i<_maxLevels; i++) 00145 { 00146 _lstBullEyeDetailNumOfSec[i] -> Enable(false); 00147 _lstBullEyeDetailRadio[i] -> Enable(false); 00148 _lstBullEyeDetailAngle[i] -> Enable(false); 00149 } // for 00150 } else { 00151 int spinSelec = _spinctrlBullEyeNumOfCrowns->GetValue(); 00152 for (i=0; i<_maxLevels; i++) 00153 { 00154 ok = (i < spinSelec); 00155 _lstBullEyeDetailNumOfSec[i] -> Enable(ok); 00156 _lstBullEyeDetailRadio[i] -> Enable(ok); 00157 _lstBullEyeDetailAngle[i] -> Enable(ok); 00158 00159 if (i>0){ 00160 if (_lstBullEyeDetailRadio[i]->GetValue() > _lstBullEyeDetailRadio[i-1]->GetValue()) 00161 { 00162 _lstBullEyeDetailRadio[i]->SetValue( _lstBullEyeDetailRadio[i-1]->GetValue() ); 00163 } 00164 }// if i>0 00165 } // for 00166 } // if 00167 }
std::vector<wxSlider *> PanelBullEyeOptions::_lstBullEyeDetailAngle [private] |
Definition at line 50 of file PanelBullEyeOptions.h.
Referenced by GetAngOfCrownSection(), PanelBullEyeOptions(), and RefreshPanel().
std::vector<wxSpinCtrl *> PanelBullEyeOptions::_lstBullEyeDetailNumOfSec [private] |
Definition at line 48 of file PanelBullEyeOptions.h.
Referenced by GetNumberOfSections(), PanelBullEyeOptions(), and RefreshPanel().
std::vector<wxSlider *> PanelBullEyeOptions::_lstBullEyeDetailRadio [private] |
Definition at line 49 of file PanelBullEyeOptions.h.
Referenced by GetRadioOfCrown(), PanelBullEyeOptions(), and RefreshPanel().
int PanelBullEyeOptions::_maxLevels [private] |
Definition at line 42 of file PanelBullEyeOptions.h.
Referenced by PanelBullEyeOptions(), and RefreshPanel().
int PanelBullEyeOptions::_maxSections [private] |
wxRadioBox* PanelBullEyeOptions::_radioboxBullEyeGenOpt [private] |
Definition at line 44 of file PanelBullEyeOptions.h.
Referenced by GetAngOfCrownSection(), GetNumberOfSections(), GetRadioOfCrown(), PanelBullEyeOptions(), and RefreshPanel().
wxSlider* PanelBullEyeOptions::_sliderBullEyeAngle [private] |
Definition at line 47 of file PanelBullEyeOptions.h.
Referenced by GetAngOfCrownSection(), and PanelBullEyeOptions().
wxSpinCtrl* PanelBullEyeOptions::_spinctrlBullEyeNumOfCrowns [private] |
Definition at line 45 of file PanelBullEyeOptions.h.
Referenced by GetNumberOfCrowns(), GetRadioOfCrown(), PanelBullEyeOptions(), and RefreshPanel().
wxSpinCtrl* PanelBullEyeOptions::_spinctrlBullEyeNumOfSec [private] |
Definition at line 46 of file PanelBullEyeOptions.h.
Referenced by GetNumberOfSections(), and PanelBullEyeOptions().