136 wxPGProperty* ret =
nullptr;
138 switch( aParam->
type )
140 case kiapi::common::types::WPDT_DISTANCE:
145 case kiapi::common::types::WPDT_AREA:
150 case kiapi::common::types::WPDT_VOLUME:
151 wxASSERT_MSG(
false,
"Volume properties are not currently implemented" );
154 case kiapi::common::types::WPDT_TIME:
155 ret =
new wxFloatProperty();
158 case kiapi::common::types::WPDT_ANGLE:
163 case kiapi::common::types::WPDT_STRING:
167 case kiapi::common::types::WPDT_INTEGER:
168 ret =
new wxIntProperty();
171 case kiapi::common::types::WPDT_REAL:
172 ret =
new wxFloatProperty();
175 case kiapi::common::types::WPDT_BOOL:
179 case kiapi::common::types::WPDT_ENUM:
183 wxPGChoices pgChoices;
185 for(
size_t i = 0; i < param->choices.size(); ++i )
186 pgChoices.Add( wxGetTranslation( param->choices[i].second ),
static_cast<int>( i ) );
188 ret =
new wxEnumProperty( wxPG_LABEL, wxPG_LABEL, pgChoices );
194 case kiapi::common::types::WPDT_UNKNOWN:
201 ret->SetLabel( wxGetTranslation( aParam->
name ) );
203 ret->SetHelpString( wxGetTranslation( aParam->
description ) );
204 ret->SetClientData( aParam );
207 ret->SetValue( ip->value );
209 ret->SetValue( rp->value );
211 ret->SetValue( bp->value );
213 ret->SetValue( sp->value );
215 ret->SetValue( ep->value );
268 wxAny newValue = aEvent.GetPropertyValue();
272 int value = newValue.As<
int>();
274 if( ip->min && value < *ip->min )
276 m_frame->SetBuildMessage( wxString::Format(
_(
"%s must be at least %s." ),
277 wxGetTranslation( ip->name ),
283 if( ip->max && value > *ip->max )
285 m_frame->SetBuildMessage( wxString::Format(
_(
"%s must be at most %s." ),
286 wxGetTranslation( ip->name ),
292 if( ip->multiple && ( value % *ip->multiple ) != 0 )
294 m_frame->SetBuildMessage( wxString::Format(
_(
"%s must be a multiple of %s." ),
295 wxGetTranslation( ip->name ),
303 double value = newValue.As<
double>();
305 if( rp->min && value < *rp->min )
307 m_frame->SetBuildMessage( wxString::Format(
_(
"%s must be at least %s." ),
308 wxGetTranslation( rp->name ),
314 if( rp->max && value > *rp->max )
316 m_frame->SetBuildMessage( wxString::Format(
_(
"%s must be at most %s." ),
317 wxGetTranslation( rp->name ),
325 if( sp->validation_regex )
327 if( wxRegEx re( *sp->validation_regex, wxRE_ADVANCED ); re.IsValid() )
329 if( wxString value = newValue.As<wxString>(); !re.Matches( value ) )
331 m_frame->SetBuildMessage( wxString::Format(
_(
"%s does not match the required format '%s'." ),
332 wxGetTranslation( sp->name ), *sp->validation_regex ) );