22 #include <wx/colour.h> 23 #include <wx/msgdlg.h> 42 const struct lconv* lc = localeconv();
43 wxChar decimal_point = lc->decimal_point[0];
44 wxString buf( TextValue.Strip( wxString::both ) );
47 buf.Replace( wxT(
"." ), wxString( decimal_point, 1 ) );
50 buf.Replace( wxT(
"," ), wxString( decimal_point, 1 ) );
55 unsigned brk_point = 0;
56 while( brk_point < buf.Len() )
58 wxChar ch = buf[brk_point];
59 if( !( ( ch >=
'0' && ch <=
'9' ) || ( ch == decimal_point ) || ( ch ==
'-' )
60 || ( ch ==
'+' ) || ( ch ==
'e' ) || ( ch ==
'E' ) ) )
69 return std::nan(
"" );
72 if( !buf.Left( brk_point ).ToDouble( &value ) )
73 return std::nan(
"" );
85 wxASSERT( transline );
116 fullmsg.Printf( wxT(
"%g " ), aValue );
145 for(
unsigned ii = 0; ii < tr_ident->
GetPrmsCount(); ii++ )
149 if( aPrmId == prm->
m_Id )
166 for(
unsigned ii = 0; ii < tr_ident->
GetPrmsCount(); ii++ )
170 if( aPrmId == prm->
m_Id )
175 msg.Printf( wxT(
"%g" ), prm->
m_Value );
176 ( (wxTextCtrl*) prm->
m_ValueCtrl )->SetValue( msg );
180 wxLogMessage( wxT(
"GetPrmValue: prm %d not found" ), (
int) aPrmId );
191 wxColour wxcol = wxColour( static_cast<unsigned char>( aCol->
r * 255 ),
192 static_cast<unsigned char>( aCol->
g * 255 ),
193 static_cast<unsigned char>( aCol->
b * 255 ) );
200 for(
unsigned ii = 0; ii < tr_ident->
GetPrmsCount(); ii++ )
203 wxTextCtrl* ctl = static_cast<wxTextCtrl*>( prm->
m_ValueCtrl );
205 if( aPrmId == prm->
m_Id )
207 ctl->SetBackgroundColour( wxcol );
208 ctl->SetStyle( 0, -1, ctl->GetDefaultStyle() );
223 #define MSG_CNT_MAX 8 230 wxASSERT( ( aLineNumber >= 0 ) && ( aLineNumber <
MSG_CNT_MAX ) );
232 if( aLineNumber < 0 )
238 messages[aLineNumber]->SetLabel( aText );
251 wxMessageBox( wxT(
"IsPrmSelected() error" ) );
PCB calculator the main frame.
void SetPropertyBgColorInDialog(enum PRMS_ID aPrmId, const KIGFX::COLOR4D *aCol)
Function SetPropertyBgColorInDialog Set the background color of a parameter.
double DoubleFromString(const wxString &TextValue)
double GetPropertyInDialog(enum PRMS_ID aPrmId)
enum TRANSLINE_TYPE_ID m_currTransLineType
void SetPrmValue(enum PRMS_ID aPrmId, double aValue)
Read/write params values and results.
double GetPrmValue(enum PRMS_ID aPrmId) const
Return a param value.
A class to handle one parameter of transline.
A class to handle a list of parameters of a given transline.
wxStaticText * m_Message2
wxStaticText * m_Message1
wxStaticText * m_Message6
wxRadioButton * m_radioBtnPrm1
wxStaticText * m_Message8
void SetResultInDialog(int line, const wxString &aText)
unsigned GetPrmsCount() const
void SetPrmBgColor(enum PRMS_ID aPrmId, const KIGFX::COLOR4D *aCol)
Set the background color of a parameter.
wxRadioButton * m_radioBtnPrm2
PANEL_TRANSLINE * getTranslinePanel()
TRANSLINE_PRM * GetPrm(unsigned aIdx) const
bool IsSelectedInDialog(enum PRMS_ID aPrmId)
void SetPropertyInDialog(enum PRMS_ID aPrmId, double value)
wxStaticText * m_Message4
void SetResult(int aLineNumber, const wxString &aText)
Put the text into the given result line.
wxStaticText * m_Message3
wxStaticText * m_Message5
wxStaticText * m_Message7
std::vector< TRANSLINE_IDENT * > m_transline_list
bool IsPrmSelected(enum PRMS_ID aPrmId) const
Function IsPrmSelected.
A color representation with 4 components: red, green, blue, alpha.