26 #include "wx/canvas/pathsettings.h"
30 #define ID_WIDTH 10002
31 #define ID_UNITS 10005
32 #define ID_Rounded 10001
33 #define ID_Rectangle 10003
34 #define ID_RectangleExt 10004
36 #define ID_APPLY 10007
55 EVT_TEXT_ENTER( ID_WIDTH, a2dPathSettings::OnWidthEnter )
56 EVT_CHOICE( ID_UNITS, a2dPathSettings::OnUnitsSelected )
57 EVT_RADIOBUTTON( ID_Rounded, a2dPathSettings::OnRoundedSelected )
58 EVT_RADIOBUTTON( ID_Rectangle, a2dPathSettings::OnRectangleSelected )
59 EVT_RADIOBUTTON( ID_RectangleExt, a2dPathSettings::OnRectangleExtSelected )
60 EVT_BUTTON( ID_HIDE, a2dPathSettings::OnHideClick )
61 EVT_BUTTON( ID_APPLY, a2dPathSettings::OnApplyClick )
69 a2dPathSettings::a2dPathSettings()
78 Create( parent,
id, caption, pos, size, style );
86 bool a2dPathSettings::Create( wxWindow* parent, wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
89 SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
90 wxDialog::Create( parent,
id, caption, pos, size, style );
95 GetSizer()->SetSizeHints(
this );
121 m_rectangular = NULL;
122 m_extRectangular = NULL;
138 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer( wxVERTICAL );
139 itemDialog1->SetSizer( itemBoxSizer2 );
141 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer( wxHORIZONTAL );
142 itemBoxSizer2->Add( itemBoxSizer3, 1, wxGROW | wxALL, 2 );
144 wxStaticText* itemStaticText4 =
new wxStaticText( itemDialog1, wxID_STATIC, _(
"Width" ), wxDefaultPosition, wxDefaultSize, 0 );
145 itemStaticText4->SetHelpText( _(
"width of polylines and lines" ) );
147 itemStaticText4->SetToolTip( _(
"width of polylines and lines" ) );
148 itemBoxSizer3->Add( itemStaticText4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
150 m_width =
new wxTextCtrl( itemDialog1, ID_WIDTH, _(
"0" ), wxDefaultPosition, wxSize( 100, -1 ), wxTE_PROCESS_ENTER );
151 m_width->SetHelpText( _(
"Width of polyline" ) );
153 m_width->SetToolTip( _(
"Width of polyline" ) );
154 m_width->SetName( _T(
"width" ) );
155 itemBoxSizer3->Add( m_width, 2, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
157 m_unitsStrings.Add( wxT(
"pm" ) );
158 m_unitsStrings.Add( wxT(
"nm" ) );
159 m_unitsStrings.Add( wxT(
"um" ) );
160 m_unitsStrings.Add( wxT(
"mm" ) );
161 m_unitsStrings.Add( wxT(
"cm" ) );
162 m_unitsStrings.Add( wxT(
"dm" ) );
163 m_unitsStrings.Add( wxT(
"m" ) );
164 m_unitsStrings.Add( wxT(
"mil" ) );
165 m_unitsStrings.Add( wxT(
"inch" ) );
166 m_unitsStrings.Add( wxT(
"foot" ) );
168 m_units =
new wxChoice( itemDialog1, ID_UNITS, wxDefaultPosition, wxSize( 40, -1 ), m_unitsStrings, 0 );
169 m_units->SetStringSelection( _(
"um" ) );
170 m_units->SetHelpText( _(
"Units in which width is given" ) );
172 m_units->SetToolTip( _(
"Units in which width is given" ) );
173 m_units->SetName( _T(
"Units" ) );
174 itemBoxSizer3->Add( m_units, 1, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
176 m_rounded =
new wxRadioButton( itemDialog1, ID_Rounded, _(
"Rounded" ), wxDefaultPosition, wxDefaultSize, 0 );
177 m_rounded->SetValue(
true );
178 m_rounded->SetHelpText( _(
"end of lines will be rounded" ) );
180 m_rounded->SetToolTip( _(
"end of lines will be rounded" ) );
181 m_rounded->SetName( _T(
"rounded" ) );
182 itemBoxSizer2->Add( m_rounded, 0, wxALIGN_LEFT | wxALL, 2 );
184 m_rectangular =
new wxRadioButton( itemDialog1, ID_Rectangle, _(
"Rectangular" ), wxDefaultPosition, wxDefaultSize, 0 );
185 m_rectangular->SetValue(
false );
186 m_rectangular->SetHelpText( _(
"end of lines will be rectangular" ) );
188 m_rectangular->SetToolTip( _(
"end of lines will be rectangular" ) );
189 m_rectangular->SetName( _T(
"rectangular" ) );
190 itemBoxSizer2->Add( m_rectangular, 0, wxALIGN_LEFT | wxALL, 2 );
192 m_extRectangular =
new wxRadioButton( itemDialog1, ID_RectangleExt, _(
"Extended Rectangular" ), wxDefaultPosition, wxDefaultSize, 0 );
193 m_extRectangular->SetValue(
false );
194 m_extRectangular->SetHelpText( _(
"end of lines will be extended rectangular" ) );
196 m_extRectangular->SetToolTip( _(
"end of lines will be extended rectangular" ) );
197 m_extRectangular->SetName( _T(
"extended" ) );
198 itemBoxSizer2->Add( m_extRectangular, 0, wxALIGN_LEFT | wxALL, 2 );
200 wxBoxSizer* itemBoxSizer10 =
new wxBoxSizer( wxHORIZONTAL );
201 itemBoxSizer2->Add( itemBoxSizer10, 1, wxGROW | wxALL, 2 );
203 m_hide =
new wxButton( itemDialog1, ID_HIDE, _(
"Hide" ), wxDefaultPosition, wxDefaultSize, 0 );
204 m_hide->SetHelpText( _(
"hide and NOT execute commands" ) );
206 m_hide->SetToolTip( _(
"hide and NOT execute commands" ) );
207 m_hide->SetName( _T(
"hide" ) );
208 itemBoxSizer10->Add( m_hide, 0, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
210 m_apply =
new wxButton( itemDialog1, ID_APPLY, _(
"Apply" ), wxDefaultPosition, wxDefaultSize, 0 );
211 m_apply->SetHelpText( _(
"execute commands" ) );
213 m_apply->SetToolTip( _(
"execute commands" ) );
214 m_apply->SetName( _T(
"apply" ) );
215 itemBoxSizer10->Add( m_apply, 0, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
233 void a2dPathSettings::OnWidthEnter( wxCommandEvent& event )
236 m_width->GetValue().ToDouble( &value );
237 m_contourWidth =
a2dDoMu( value, m_unitsStrings[m_units->GetSelection()] );
244 void a2dPathSettings::OnUnitsSelected( wxCommandEvent& event )
253 void a2dPathSettings::OnRoundedSelected( wxCommandEvent& event )
255 m_pathtype = a2dPATH_END_ROUND;
263 void a2dPathSettings::OnRectangleSelected( wxCommandEvent& event )
265 m_pathtype = a2dPATH_END_SQAURE;
273 void a2dPathSettings::OnRectangleExtSelected( wxCommandEvent& event )
275 m_pathtype = a2dPATH_END_SQAURE_EXT;
283 void a2dPathSettings::OnHideClick( wxCommandEvent& event )
293 void a2dPathSettings::OnApplyClick( wxCommandEvent& event )
296 m_width->GetValue().ToDouble( &value );
297 m_contourWidth =
a2dDoMu( value, m_unitsStrings[m_units->GetSelection()] );
303 void a2dPathSettings::OnComEvent(
a2dComEvent& event )
305 bool baseContinue =
true;
322 switch ( m_pathtype )
324 case a2dPATH_END_ROUND : m_rounded->SetValue(
true );
break;
325 case a2dPATH_END_SQAURE : m_rectangular->SetValue(
true );
break;
326 case a2dPATH_END_SQAURE_EXT : m_extRectangular->SetValue(
true );
break;
void SetContourWidth(const a2dDoMu ¤tContourWidth)
set the Contour width of shapes
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
const a2dDoMu & GetContourWidth() const
get the Contour width of shapes in meters
a2dPATH_END_TYPE GetPathType()
get when m_contourwidth != 0 what is the end of the line looks like.
bool Create(wxWindow *parent, wxWindowID id=SYMBOL_a2dPathSettings_IDNAME, const wxString &caption=SYMBOL_a2dPathSettings_TITLE, const wxPoint &pos=SYMBOL_a2dPathSettings_POSITION, const wxSize &size=SYMBOL_a2dPathSettings_SIZE, long style=SYMBOL_a2dPathSettings_STYLE)
Creation.
store and convert number to number with unit and visa versa. e.g. 1.23e-6 => 1.23 * 1e-6 ...
a2dPATH_END_TYPE GetPathType()
get when m_contourwidth != 0 what is the end of the line looks like.
a2dPathSettings()
Constructors.
polyline defined with list of points.
#define EVT_COM_EVENT(func)
static wxEvtHandler for communication event
void Init()
Initialises member variables.
defines common settinsg for a habitat for a set of a2dCameleons.
void SetPathType(a2dPATH_END_TYPE pathtype)
Set when m_contourwidth != 0 what is the end of the line should be.
~a2dPathSettings()
Destructor.
void CreateControls()
Creates the controls and sizers.
editing tool for a2dCanvasObject's
wxString GetMultiplierString() const
get the number 1.1 um -> "um"
all headers of the canvas module
wxString GetNumberString() const
get the number 1.1 um -> "1.1"
static bool ShowToolTips()
Should we show tooltips?
a2dPATH_END_TYPE GetPathType()
get when m_contourwidth != 0 what is the end of the line looks like.