Commit 0acb404f authored by charras's avatar charras

fixed a libedit crash when editing a pin. Enable translation of static strings

parent 4c6bbb85
...@@ -42,7 +42,7 @@ static const int pin_orientation_codes[] = ...@@ -42,7 +42,7 @@ static const int pin_orientation_codes[] =
#define PIN_ORIENTATION_CNT ( sizeof( pin_orientation_names ) / \ #define PIN_ORIENTATION_CNT ( sizeof( pin_orientation_names ) / \
sizeof( wxString* ) ) sizeof( wxString ) )
static const wxString pin_style_names[] = static const wxString pin_style_names[] =
...@@ -57,7 +57,7 @@ static const wxString pin_style_names[] = ...@@ -57,7 +57,7 @@ static const wxString pin_style_names[] =
}; };
#define PIN_STYLE_CNT ( sizeof( pin_style_names ) / sizeof( wxString* ) ) #define PIN_STYLE_CNT ( sizeof( pin_style_names ) / sizeof( wxString ) )
static const int pin_style_codes[] = static const int pin_style_codes[] =
...@@ -89,7 +89,7 @@ static const wxString pin_electrical_type_names[] = ...@@ -89,7 +89,7 @@ static const wxString pin_electrical_type_names[] =
#define PIN_ELECTRICAL_TYPE_CNT ( sizeof( pin_electrical_type_names ) / \ #define PIN_ELECTRICAL_TYPE_CNT ( sizeof( pin_electrical_type_names ) / \
sizeof( wxString* ) ) sizeof( wxString ) )
const wxChar* MsgPinElectricType[] = const wxChar* MsgPinElectricType[] =
...@@ -1609,8 +1609,9 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -1609,8 +1609,9 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
frame->AppendMsgPanel( _( "Number" ), Text, DARKCYAN ); frame->AppendMsgPanel( _( "Number" ), Text, DARKCYAN );
frame->AppendMsgPanel( _( "Type" ), frame->AppendMsgPanel( _( "Type" ),
pin_electrical_type_names[ m_PinType ], RED ); wxGetTranslation(pin_electrical_type_names[ m_PinType ]),
Text = pin_style_names[ GetStyleCodeIndex( m_PinShape ) ]; RED );
Text = wxGetTranslation(pin_style_names[ GetStyleCodeIndex( m_PinShape ) ]);
frame->AppendMsgPanel( _( "Style" ), Text, BLUE ); frame->AppendMsgPanel( _( "Style" ), Text, BLUE );
if( IsVisible() ) if( IsVisible() )
Text = _( "Yes" ); Text = _( "Yes" );
...@@ -1623,7 +1624,7 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -1623,7 +1624,7 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
frame->AppendMsgPanel( _( "Length" ), Text, MAGENTA ); frame->AppendMsgPanel( _( "Length" ), Text, MAGENTA );
Text = pin_orientation_names[ GetOrientationCodeIndex( m_Orient ) ]; Text = wxGetTranslation(pin_orientation_names[ GetOrientationCodeIndex( m_Orient ) ]);
frame->AppendMsgPanel( _( "Orientation" ), Text, DARKMAGENTA ); frame->AppendMsgPanel( _( "Orientation" ), Text, DARKMAGENTA );
} }
...@@ -1643,7 +1644,10 @@ EDA_Rect LIB_PIN::GetBoundingBox() ...@@ -1643,7 +1644,10 @@ EDA_Rect LIB_PIN::GetBoundingBox()
wxArrayString LIB_PIN::GetOrientationNames( void ) wxArrayString LIB_PIN::GetOrientationNames( void )
{ {
return wxArrayString( PIN_ORIENTATION_CNT, pin_orientation_names ); wxArrayString tmp;
for( unsigned ii = 0; ii < PIN_ORIENTATION_CNT; ii++ )
tmp.Add(wxGetTranslation(pin_orientation_names[ii]));
return tmp;
} }
...@@ -1672,7 +1676,10 @@ int LIB_PIN::GetOrientationCodeIndex( int code ) ...@@ -1672,7 +1676,10 @@ int LIB_PIN::GetOrientationCodeIndex( int code )
wxArrayString LIB_PIN::GetStyleNames( void ) wxArrayString LIB_PIN::GetStyleNames( void )
{ {
return wxArrayString( PIN_STYLE_CNT, pin_style_names ); wxArrayString tmp;
for( unsigned ii = 0; ii < PIN_STYLE_CNT; ii++ )
tmp.Add(wxGetTranslation(pin_style_names[ii]));
return tmp;
} }
...@@ -1701,5 +1708,8 @@ int LIB_PIN::GetStyleCodeIndex( int code ) ...@@ -1701,5 +1708,8 @@ int LIB_PIN::GetStyleCodeIndex( int code )
wxArrayString LIB_PIN::GetElectricalTypeNames( void ) wxArrayString LIB_PIN::GetElectricalTypeNames( void )
{ {
return wxArrayString( PIN_ELECTRICAL_TYPE_CNT, pin_electrical_type_names ); wxArrayString tmp;
for( unsigned ii = 0; ii < PIN_ELECTRICAL_TYPE_CNT; ii++ )
tmp.Add(wxGetTranslation(pin_electrical_type_names[ii]));
return tmp;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment