43 const struct lconv* lc = localeconv();
44 wxChar decimal_point = lc->decimal_point[0];
45 wxString buf( TextValue.Strip( wxString::both ) );
48 buf.Replace( wxT(
"." ), wxString( decimal_point, 1 ) );
52 buf.Replace( wxT(
"," ), wxString( decimal_point, 1 ) );
57 unsigned brk_point = 0;
59 while( brk_point < buf.Len() )
61 wxChar ch = buf[brk_point];
62 if( !( ( ch >=
'0' && ch <=
'9' ) || ( ch == decimal_point ) || ( ch ==
'-' )
63 || ( ch ==
'+' ) || ( ch ==
'e' ) || ( ch ==
'E' ) ) )
72 return std::nan(
"" );
75 if( !buf.Left( brk_point ).ToDouble( &value ) )
76 return std::nan(
"" );
88 wxASSERT( transline );
112 wxString msg = wxString::FromUTF8( aText );
122 wxString msg = wxString::FromUTF8( aText );
124 fullmsg.Printf( wxT(
"%g " ), aValue );
149 for(
unsigned ii = 0; ii < tr_ident->
GetPrmsCount(); ii++ )
153 if( aPrmId == prm->
m_Id )
165 for(
unsigned ii = 0; ii < tr_ident->
GetPrmsCount(); ii++ )
169 if( aPrmId == prm->
m_Id )
174 msg.Printf( wxT(
"%g" ), prm->
m_Value );
175 ( (wxTextCtrl*) prm->
m_ValueCtrl )->SetValue( msg );
180 wxLogMessage( wxT(
"GetPrmValue: prm %d not found" ), (
int) aPrmId );
186 wxColour wxcol = wxColour(
static_cast<unsigned char>( aCol->
r * 255 ),
187 static_cast<unsigned char>( aCol->
g * 255 ),
188 static_cast<unsigned char>( aCol->
b * 255 ) );
195 for(
unsigned ii = 0; ii < tr_ident->
GetPrmsCount(); ii++ )
198 wxTextCtrl* ctl =
static_cast<wxTextCtrl*
>( prm->
m_ValueCtrl );
200 if( aPrmId == prm->
m_Id )
202 ctl->SetBackgroundColour( wxcol );
203 ctl->SetStyle( 0, -1, ctl->GetDefaultStyle() );
213#define MSG_CNT_MAX 10
217 wxASSERT( ( aLineNumber >= 0 ) && ( aLineNumber <
MSG_CNT_MAX ) );
219 if( aLineNumber < 0 )
225 messages[aLineNumber]->SetLabel( aText );
234 wxMessageBox( wxT(
"IsPrmSelected() error" ) );
A color representation with 4 components: red, green, blue, alpha.
wxStaticText * m_Message2
wxStaticText * m_Message9
wxStaticText * m_Message3
wxStaticText * m_Message6
wxRadioButton * m_radioBtnPrm2
wxStaticText * m_Message7
wxRadioButton * m_radioBtnPrm1
wxStaticText * m_Message4
wxStaticText * m_Message1
wxStaticText * m_Message5
wxStaticText * m_Message8
wxStaticText * m_Message10
void SetResult(int aLineNumber, const wxString &aText)
Put the text into the given result line.
void SetPrmBgColor(enum PRMS_ID aPrmId, const KIGFX::COLOR4D *aCol)
Set the background color of a parameter.
std::vector< TRANSLINE_IDENT * > m_transline_list
void SetPrmValue(enum PRMS_ID aPrmId, double aValue)
Read/write params values and results.
enum TRANSLINE_TYPE_ID m_currTransLineType
bool IsPrmSelected(enum PRMS_ID aPrmId) const
double GetPrmValue(enum PRMS_ID aPrmId) const
Return a param value.
PCB calculator the main frame.
A class to handle a list of parameters of a given transline.
unsigned GetPrmsCount() const
TRANSLINE_PRM * GetPrm(unsigned aIdx) const
A class to handle one parameter of transline.
void SetPropertyInDialog(enum PRMS_ID aPrmId, double value)
void SetPropertyBgColorInDialog(enum PRMS_ID aPrmId, const KIGFX::COLOR4D *aCol)
Set the background color of a parameter.
double GetPropertyInDialog(enum PRMS_ID aPrmId)
Return a named property value.
void SetResultInDialog(int line, const char *aText)
Puts the text into the given result line.
bool IsSelectedInDialog(enum PRMS_ID aPrmId)
Return true if the param aPrmId is selected.
double DoubleFromString(const wxString &TextValue)
PANEL_TRANSLINE * getTranslinePanel()