Commit f2b0e185 authored by jean-pierre charras's avatar jean-pierre charras

Minor fixes to prepare wxWidget 2.9.1 use:

* store selected language by name instead of wx language id (that changes between wxWidgets version)
* accept always comma and point as flotating point separator.
parent ede820b4
...@@ -99,6 +99,17 @@ void BASE_SCREEN::SetPageSize( wxSize& aPageSize ) ...@@ -99,6 +99,17 @@ void BASE_SCREEN::SetPageSize( wxSize& aPageSize )
} }
/**
* Function GetScalingFactor
* @return the the current scale used to draw items on screen
* draw coordinates are user coordinates * GetScalingFactor( )
*/
double BASE_SCREEN::GetScalingFactor() const
{
double scale = (double) m_ZoomScalar / (double) GetZoom();
return scale;
}
/** /**
* Function SetScalingFactor * Function SetScalingFactor
* calculates the .m_Zoom member to have a given scaling factor * calculates the .m_Zoom member to have a given scaling factor
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#endif #endif
#ifndef KICAD_BUILD_VERSION #ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2011-03-30)" #define KICAD_BUILD_VERSION "(2011-04-01)"
#endif #endif
// uncomment this line only when creating a stable version // uncomment this line only when creating a stable version
......
...@@ -397,6 +397,10 @@ int ReturnValueFromString( UserUnitType aUnit, const wxString& TextValue, ...@@ -397,6 +397,10 @@ int ReturnValueFromString( UserUnitType aUnit, const wxString& TextValue,
/* Convert the period in decimal point */ /* Convert the period in decimal point */
buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) ); buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) );
// An ugly fix needed by WxWidgets 2.9.1 that sometimes
// back to a point as separator, although the separator is the comma
// TODO: remove this line if WxWidgets 2.9.2 fixes this issue
buf.Replace( wxT( "," ), wxString( decimal_point, 1 ) );
/* Find the end of the numeric part */ /* Find the end of the numeric part */
unsigned brk_point = 0; unsigned brk_point = 0;
......
...@@ -81,6 +81,9 @@ struct LANGUAGE_DESCR ...@@ -81,6 +81,9 @@ struct LANGUAGE_DESCR
/** /**
* Language list struct * Language list struct
* Note: because this list is not created on the fly, wxTranslation
* must be called when a language name must be displayed after translation.
* Do don change this behavior, because m_Lang_Label is also used as key in config
*/ */
static struct LANGUAGE_DESCR s_Language_List[] = static struct LANGUAGE_DESCR s_Language_List[] =
{ {
...@@ -249,7 +252,7 @@ WinEDA_App::WinEDA_App() ...@@ -249,7 +252,7 @@ WinEDA_App::WinEDA_App()
m_EDA_Config = NULL; m_EDA_Config = NULL;
m_Env_Defined = FALSE; m_Env_Defined = FALSE;
m_LanguageId = wxLANGUAGE_DEFAULT; m_LanguageId = wxLANGUAGE_DEFAULT;
m_PdfBrowserIsDefault = TRUE; m_PdfBrowserIsDefault = true;
m_Locale = NULL; m_Locale = NULL;
m_ProjectConfig = NULL; m_ProjectConfig = NULL;
m_EDA_CommonConfig = NULL; m_EDA_CommonConfig = NULL;
...@@ -337,9 +340,20 @@ void WinEDA_App::InitEDA_Appl( const wxString& aName, id_app_type aId ) ...@@ -337,9 +340,20 @@ void WinEDA_App::InitEDA_Appl( const wxString& aName, id_app_type aId )
ReadPdfBrowserInfos(); ReadPdfBrowserInfos();
// Internationalization: loading the kicad suitable Dictionary // Internationalization: loading the kicad suitable Dictionary
m_EDA_CommonConfig->Read( languageCfgKey, &m_LanguageId, wxLANGUAGE_DEFAULT ); wxString languageSel;
m_EDA_CommonConfig->Read( languageCfgKey, &languageSel);
m_LanguageId = wxLANGUAGE_DEFAULT;
// Search for the current selection
for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{
if( s_Language_List[ii].m_Lang_Label == languageSel )
{
m_LanguageId = s_Language_List[ii].m_WX_Lang_Identifier;
break;
}
}
bool succes = SetLanguage( TRUE ); bool succes = SetLanguage( true );
if( !succes ) if( !succes )
{ {
} }
...@@ -459,7 +473,7 @@ bool WinEDA_App::SetBinDir() ...@@ -459,7 +473,7 @@ bool WinEDA_App::SetBinDir()
while( m_BinDir.Last() != '/' && !m_BinDir.IsEmpty() ) while( m_BinDir.Last() != '/' && !m_BinDir.IsEmpty() )
m_BinDir.RemoveLast(); m_BinDir.RemoveLast();
return TRUE; return true;
} }
...@@ -627,7 +641,19 @@ void WinEDA_App::GetSettings(bool aReopenLastUsedDirectory) ...@@ -627,7 +641,19 @@ void WinEDA_App::GetSettings(bool aReopenLastUsedDirectory)
m_HelpSize.x = 500; m_HelpSize.x = 500;
m_HelpSize.y = 400; m_HelpSize.y = 400;
m_LanguageId = m_EDA_CommonConfig->Read( languageCfgKey, wxLANGUAGE_DEFAULT ); wxString languageSel;
m_EDA_CommonConfig->Read( languageCfgKey, &languageSel);
m_LanguageId = wxLANGUAGE_DEFAULT;
// Search for the current selection
for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{
if( s_Language_List[ii].m_Lang_Label == languageSel )
{
m_LanguageId = s_Language_List[ii].m_WX_Lang_Identifier;
break;
}
}
m_EditorName = m_EDA_CommonConfig->Read( wxT( "Editor" ) ); m_EditorName = m_EDA_CommonConfig->Read( wxT( "Editor" ) );
m_fileHistory.Load( *m_EDA_Config ); m_fileHistory.Load( *m_EDA_Config );
...@@ -717,7 +743,17 @@ bool WinEDA_App::SetLanguage( bool first_time ) ...@@ -717,7 +743,17 @@ bool WinEDA_App::SetLanguage( bool first_time )
if( !first_time ) if( !first_time )
{ {
m_EDA_CommonConfig->Write( languageCfgKey, m_LanguageId ); wxString languageSel;
// Search for the current selection
for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{
if( s_Language_List[ii].m_WX_Lang_Identifier == m_LanguageId )
{
languageSel = s_Language_List[ii].m_Lang_Label;
break;
}
}
m_EDA_CommonConfig->Write( languageCfgKey, languageSel );
} }
// Test if floating point notation is working (bug in cross compilation, using wine) // Test if floating point notation is working (bug in cross compilation, using wine)
...@@ -758,12 +794,10 @@ bool WinEDA_App::SetLanguage( bool first_time ) ...@@ -758,12 +794,10 @@ bool WinEDA_App::SetLanguage( bool first_time )
*/ */
void WinEDA_App::SetLanguageIdentifier( int menu_id ) void WinEDA_App::SetLanguageIdentifier( int menu_id )
{ {
unsigned int ii;
wxLogDebug( wxT( "Select language ID %d from %d possible languages." ), wxLogDebug( wxT( "Select language ID %d from %d possible languages." ),
menu_id, LANGUAGE_DESCR_COUNT ); menu_id, LANGUAGE_DESCR_COUNT );
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ ) for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{ {
if( menu_id == s_Language_List[ii].m_KI_Lang_Identifier ) if( menu_id == s_Language_List[ii].m_KI_Lang_Identifier )
{ {
......
...@@ -502,7 +502,7 @@ void LIB_POLYLINE::EndEdit( const wxPoint& aPosition, bool aAbort ) ...@@ -502,7 +502,7 @@ void LIB_POLYLINE::EndEdit( const wxPoint& aPosition, bool aAbort )
if( m_PolyPoints.size() > 2 // do not delete last two points... keep it alive if( m_PolyPoints.size() > 2 // do not delete last two points... keep it alive
&& ( m_ModifyIndex > 0 && ( m_ModifyIndex > 0
&& m_PolyPoints[ m_ModifyIndex ] == m_PolyPoints[ m_ModifyIndex - 1 ] && m_PolyPoints[ m_ModifyIndex ] == m_PolyPoints[ m_ModifyIndex - 1 ]
|| m_ModifyIndex < m_PolyPoints.size() - 1 || m_ModifyIndex < (int)m_PolyPoints.size() - 1
&& m_PolyPoints[ m_ModifyIndex ] == m_PolyPoints[ m_ModifyIndex + 1 ] ) ) && m_PolyPoints[ m_ModifyIndex ] == m_PolyPoints[ m_ModifyIndex + 1 ] ) )
{ {
m_PolyPoints.erase( m_PolyPoints.begin() + m_ModifyIndex ); // delete a point on this m_PolyPoints.erase( m_PolyPoints.begin() + m_ModifyIndex ); // delete a point on this
......
This diff is collapsed.
...@@ -263,11 +263,7 @@ public: ...@@ -263,11 +263,7 @@ public:
* @return the the current scale used to draw items on screen * @return the the current scale used to draw items on screen
* draw coordinates are user coordinates * GetScalingFactor( ) * draw coordinates are user coordinates * GetScalingFactor( )
*/ */
double GetScalingFactor() const double GetScalingFactor() const;
{
return (double) m_ZoomScalar / (double) GetZoom();
}
/** /**
* Function SetScalingFactor * Function SetScalingFactor
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
; General Product Description Definitions ; General Product Description Definitions
!define PRODUCT_NAME "KiCad" !define PRODUCT_NAME "KiCad"
!define PRODUCT_VERSION "2011.03.30" !define PRODUCT_VERSION "2011.04.01"
!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/" !define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/" !define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
!define COMPANY_NAME "" !define COMPANY_NAME ""
......
release version: release version:
2011 mar 30 2011 apr 01
files (.zip,.tgz): files (.zip,.tgz):
kicad-2011-03-30 kicad-2011-04-01
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