populate PCB_PARSER::m_layerMap with English layernames so footprints
can be parsed, since they do not have an overriding layer name map like a BOARD does. Avoid doubly looking up hashtable entries in m_layerMap. Minor code reformatting.
This commit is contained in:
parent
b4ab7ef7ea
commit
272936ef21
|
@ -65,8 +65,8 @@ static const wxChar* CommonConfigPath = wxT( "kicad_common" );
|
||||||
* the size of the array. */
|
* the size of the array. */
|
||||||
#define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / sizeof( struct LANGUAGE_DESCR ) )
|
#define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / sizeof( struct LANGUAGE_DESCR ) )
|
||||||
|
|
||||||
/* Default font size */
|
// Default font size
|
||||||
#define FONT_DEFAULT_SIZE 10 /* Default font size. */
|
#define FONT_DEFAULT_SIZE 10 // Default font size.
|
||||||
|
|
||||||
static wxString languageCfgKey( wxT( "LanguageID" ) );
|
static wxString languageCfgKey( wxT( "LanguageID" ) );
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ struct LANGUAGE_DESCR
|
||||||
*/
|
*/
|
||||||
static struct LANGUAGE_DESCR s_Language_List[] =
|
static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
{
|
{
|
||||||
/* Default language */
|
// Default language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_DEFAULT,
|
wxLANGUAGE_DEFAULT,
|
||||||
ID_LANGUAGE_DEFAULT,
|
ID_LANGUAGE_DEFAULT,
|
||||||
|
@ -116,7 +116,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Default" )
|
_( "Default" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* English language */
|
// English language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_ENGLISH,
|
wxLANGUAGE_ENGLISH,
|
||||||
ID_LANGUAGE_ENGLISH,
|
ID_LANGUAGE_ENGLISH,
|
||||||
|
@ -125,7 +125,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
true
|
true
|
||||||
},
|
},
|
||||||
|
|
||||||
/* French language */
|
// French language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_FRENCH,
|
wxLANGUAGE_FRENCH,
|
||||||
ID_LANGUAGE_FRENCH,
|
ID_LANGUAGE_FRENCH,
|
||||||
|
@ -133,7 +133,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "French" )
|
_( "French" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Finnish language */
|
// Finnish language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_FINNISH,
|
wxLANGUAGE_FINNISH,
|
||||||
ID_LANGUAGE_FINNISH,
|
ID_LANGUAGE_FINNISH,
|
||||||
|
@ -141,7 +141,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Finnish" )
|
_( "Finnish" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Spanish language */
|
// Spanish language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_SPANISH,
|
wxLANGUAGE_SPANISH,
|
||||||
ID_LANGUAGE_SPANISH,
|
ID_LANGUAGE_SPANISH,
|
||||||
|
@ -149,7 +149,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Spanish" )
|
_( "Spanish" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Portuguese language */
|
// Portuguese language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_PORTUGUESE,
|
wxLANGUAGE_PORTUGUESE,
|
||||||
ID_LANGUAGE_PORTUGUESE,
|
ID_LANGUAGE_PORTUGUESE,
|
||||||
|
@ -157,7 +157,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Portuguese" )
|
_( "Portuguese" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Italian language */
|
// Italian language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_ITALIAN,
|
wxLANGUAGE_ITALIAN,
|
||||||
ID_LANGUAGE_ITALIAN,
|
ID_LANGUAGE_ITALIAN,
|
||||||
|
@ -165,7 +165,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Italian" )
|
_( "Italian" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* German language */
|
// German language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_GERMAN,
|
wxLANGUAGE_GERMAN,
|
||||||
ID_LANGUAGE_GERMAN,
|
ID_LANGUAGE_GERMAN,
|
||||||
|
@ -173,7 +173,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "German" )
|
_( "German" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Greek language */
|
// Greek language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_GREEK,
|
wxLANGUAGE_GREEK,
|
||||||
ID_LANGUAGE_GREEK,
|
ID_LANGUAGE_GREEK,
|
||||||
|
@ -181,7 +181,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Greek" )
|
_( "Greek" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Slovenian language */
|
// Slovenian language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_SLOVENIAN,
|
wxLANGUAGE_SLOVENIAN,
|
||||||
ID_LANGUAGE_SLOVENIAN,
|
ID_LANGUAGE_SLOVENIAN,
|
||||||
|
@ -189,7 +189,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Slovenian" )
|
_( "Slovenian" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Hungarian language */
|
// Hungarian language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_HUNGARIAN,
|
wxLANGUAGE_HUNGARIAN,
|
||||||
ID_LANGUAGE_HUNGARIAN,
|
ID_LANGUAGE_HUNGARIAN,
|
||||||
|
@ -197,7 +197,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Hungarian" )
|
_( "Hungarian" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Polish language */
|
// Polish language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_POLISH,
|
wxLANGUAGE_POLISH,
|
||||||
ID_LANGUAGE_POLISH,
|
ID_LANGUAGE_POLISH,
|
||||||
|
@ -205,7 +205,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Polish" )
|
_( "Polish" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Czech language */
|
// Czech language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_CZECH,
|
wxLANGUAGE_CZECH,
|
||||||
ID_LANGUAGE_CZECH,
|
ID_LANGUAGE_CZECH,
|
||||||
|
@ -213,7 +213,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Czech" )
|
_( "Czech" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Russian language */
|
// Russian language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_RUSSIAN,
|
wxLANGUAGE_RUSSIAN,
|
||||||
ID_LANGUAGE_RUSSIAN,
|
ID_LANGUAGE_RUSSIAN,
|
||||||
|
@ -221,7 +221,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Russian" )
|
_( "Russian" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Korean language */
|
// Korean language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_KOREAN,
|
wxLANGUAGE_KOREAN,
|
||||||
ID_LANGUAGE_KOREAN,
|
ID_LANGUAGE_KOREAN,
|
||||||
|
@ -229,7 +229,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Korean" )
|
_( "Korean" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Chinese simplified */
|
// Chinese simplified
|
||||||
{
|
{
|
||||||
wxLANGUAGE_CHINESE_SIMPLIFIED,
|
wxLANGUAGE_CHINESE_SIMPLIFIED,
|
||||||
ID_LANGUAGE_CHINESE_SIMPLIFIED,
|
ID_LANGUAGE_CHINESE_SIMPLIFIED,
|
||||||
|
@ -237,7 +237,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Chinese simplified" )
|
_( "Chinese simplified" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Catalan language */
|
// Catalan language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_CATALAN,
|
wxLANGUAGE_CATALAN,
|
||||||
ID_LANGUAGE_CATALAN,
|
ID_LANGUAGE_CATALAN,
|
||||||
|
@ -286,7 +286,7 @@ EDA_APP::~EDA_APP()
|
||||||
{
|
{
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
|
||||||
/* delete user datas */
|
// delete user datas
|
||||||
if( m_projectSettings )
|
if( m_projectSettings )
|
||||||
delete m_projectSettings;
|
delete m_projectSettings;
|
||||||
|
|
||||||
|
@ -309,10 +309,9 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
|
||||||
m_Id = aId;
|
m_Id = aId;
|
||||||
m_Checker = new wxSingleInstanceChecker( aName.Lower() + wxT( "-" ) + wxGetUserId() );
|
m_Checker = new wxSingleInstanceChecker( aName.Lower() + wxT( "-" ) + wxGetUserId() );
|
||||||
|
|
||||||
/* Init KiCad environment
|
// Init KiCad environment
|
||||||
* the environment variable KICAD (if exists) gives the kicad path:
|
// the environment variable KICAD (if exists) gives the kicad path:
|
||||||
* something like set KICAD=d:\kicad
|
// something like set KICAD=d:\kicad
|
||||||
*/
|
|
||||||
bool isDefined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv );
|
bool isDefined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv );
|
||||||
|
|
||||||
if( isDefined ) // ensure m_KicadEnv ends by "/"
|
if( isDefined ) // ensure m_KicadEnv ends by "/"
|
||||||
|
@ -323,8 +322,8 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
|
||||||
m_KicadEnv += UNIX_STRING_DIR_SEP;
|
m_KicadEnv += UNIX_STRING_DIR_SEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare On Line Help. Use only lower case for help file names, in order to
|
// Prepare On Line Help. Use only lower case for help file names, in order to
|
||||||
* avoid problems with upper/lower case file names under windows and unix */
|
// avoid problems with upper/lower case file names under windows and unix.
|
||||||
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
|
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
|
||||||
m_HelpFileName = aName.Lower() + wxT( ".html" );
|
m_HelpFileName = aName.Lower() + wxT( ".html" );
|
||||||
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
|
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
|
||||||
|
@ -333,7 +332,7 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
|
||||||
#error Help files format not defined
|
#error Help files format not defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Init parameters for configuration */
|
// Init parameters for configuration
|
||||||
SetVendorName( wxT( "KiCad" ) );
|
SetVendorName( wxT( "KiCad" ) );
|
||||||
SetAppName( aName.Lower() );
|
SetAppName( aName.Lower() );
|
||||||
SetTitle( aName );
|
SetTitle( aName );
|
||||||
|
@ -342,7 +341,7 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
|
||||||
m_commonSettings = new wxConfig( CommonConfigPath );
|
m_commonSettings = new wxConfig( CommonConfigPath );
|
||||||
wxASSERT( m_commonSettings != NULL );
|
wxASSERT( m_commonSettings != NULL );
|
||||||
|
|
||||||
/* Install some image handlers, mainly for help */
|
// Install some image handlers, mainly for help
|
||||||
wxImage::AddHandler( new wxPNGHandler );
|
wxImage::AddHandler( new wxPNGHandler );
|
||||||
wxImage::AddHandler( new wxGIFHandler );
|
wxImage::AddHandler( new wxGIFHandler );
|
||||||
wxImage::AddHandler( new wxJPEGHandler );
|
wxImage::AddHandler( new wxJPEGHandler );
|
||||||
|
@ -375,7 +374,7 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set locale option for separator used in float numbers */
|
// Set locale option for separator used in float numbers
|
||||||
SetLocaleTo_Default();
|
SetLocaleTo_Default();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,10 +417,10 @@ void EDA_APP::InitOnLineHelp()
|
||||||
|
|
||||||
bool EDA_APP::SetBinDir()
|
bool EDA_APP::SetBinDir()
|
||||||
{
|
{
|
||||||
/* Apple MacOSx */
|
// Apple MacOSx
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
||||||
/* Derive path from location of the app bundle */
|
// Derive path from location of the app bundle
|
||||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||||
|
|
||||||
if( mainBundle == NULL )
|
if( mainBundle == NULL )
|
||||||
|
@ -446,12 +445,12 @@ bool EDA_APP::SetBinDir()
|
||||||
m_BinDir = FROM_UTF8( native_str );
|
m_BinDir = FROM_UTF8( native_str );
|
||||||
delete[] native_str;
|
delete[] native_str;
|
||||||
|
|
||||||
/* Linux and Unix */
|
// Linux and Unix
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
m_BinDir = wxStandardPaths().GetExecutablePath();
|
m_BinDir = wxStandardPaths().GetExecutablePath();
|
||||||
#else
|
#else
|
||||||
m_BinDir = argv[0];
|
m_BinDir = argv[0];
|
||||||
#endif /* __UNIX__ */
|
#endif // __UNIX__
|
||||||
|
|
||||||
/* Use unix notation for paths. I am not sure this is a good idea,
|
/* Use unix notation for paths. I am not sure this is a good idea,
|
||||||
* but it simplify compatibility between Windows and Unices
|
* but it simplify compatibility between Windows and Unices
|
||||||
|
@ -493,16 +492,16 @@ void EDA_APP::SetDefaultSearchPaths( void )
|
||||||
if( ::wxGetEnv( wxT( "KICAD" ), NULL ) )
|
if( ::wxGetEnv( wxT( "KICAD" ), NULL ) )
|
||||||
m_searchPaths.AddEnvList( wxT( "KICAD" ) );
|
m_searchPaths.AddEnvList( wxT( "KICAD" ) );
|
||||||
|
|
||||||
/* Add the user's home path. */
|
// Add the user's home path.
|
||||||
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetUserDataDir() );
|
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetUserDataDir() );
|
||||||
|
|
||||||
/* Standard application data path if it is different from the binary path. */
|
// Standard application data path if it is different from the binary path.
|
||||||
if( fn.GetPath() != GetTraits()->GetStandardPaths().GetDataDir() )
|
if( fn.GetPath() != GetTraits()->GetStandardPaths().GetDataDir() )
|
||||||
{
|
{
|
||||||
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() );
|
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Up one level relative to binary path with "share" appended for Windows. */
|
// Up one level relative to binary path with "share" appended for Windows.
|
||||||
fn.RemoveLastDir();
|
fn.RemoveLastDir();
|
||||||
m_searchPaths.Add( fn.GetPath() );
|
m_searchPaths.Add( fn.GetPath() );
|
||||||
fn.AppendDir( wxT( "share" ) );
|
fn.AppendDir( wxT( "share" ) );
|
||||||
|
@ -514,7 +513,8 @@ void EDA_APP::SetDefaultSearchPaths( void )
|
||||||
* installed in a different path from the library files. This is
|
* installed in a different path from the library files. This is
|
||||||
* useful for development purposes so the library and documentation
|
* useful for development purposes so the library and documentation
|
||||||
* files do not need to be installed separately. If someone can
|
* files do not need to be installed separately. If someone can
|
||||||
* figure out a way to implement this without #ifdef, please do. */
|
* figure out a way to implement this without #ifdef, please do.
|
||||||
|
*/
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
tmp.AddEnvList( wxT( "PROGRAMFILES" ) );
|
tmp.AddEnvList( wxT( "PROGRAMFILES" ) );
|
||||||
#elif __WXMAC__
|
#elif __WXMAC__
|
||||||
|
@ -545,7 +545,7 @@ void EDA_APP::SetDefaultSearchPaths( void )
|
||||||
m_searchPaths.Add( fn.GetPath() );
|
m_searchPaths.Add( fn.GetPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove all non-existent paths from the list. */
|
// Remove all non-existent paths from the list.
|
||||||
for( i = 0; i < m_searchPaths.GetCount(); i++ )
|
for( i = 0; i < m_searchPaths.GetCount(); i++ )
|
||||||
{
|
{
|
||||||
if( !wxFileName::IsDirReadable( m_searchPaths[i] ) )
|
if( !wxFileName::IsDirReadable( m_searchPaths[i] ) )
|
||||||
|
@ -570,7 +570,7 @@ void EDA_APP::SetDefaultSearchPaths( void )
|
||||||
m_libSearchPaths.Add( fn.GetPath() );
|
m_libSearchPaths.Add( fn.GetPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add schematic doc file path (library/doc)to search path list. */
|
// Add schematic doc file path (library/doc)to search path list.
|
||||||
fn.AppendDir( wxT( "doc" ) );
|
fn.AppendDir( wxT( "doc" ) );
|
||||||
|
|
||||||
if( fn.IsDirReadable() )
|
if( fn.IsDirReadable() )
|
||||||
|
@ -582,7 +582,7 @@ void EDA_APP::SetDefaultSearchPaths( void )
|
||||||
fn.RemoveLastDir(); // point to <kicad path>
|
fn.RemoveLastDir(); // point to <kicad path>
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add PCB library file path to search path list. */
|
// Add PCB library file path to search path list.
|
||||||
if( ( m_Id == APP_PCBNEW_T ) || ( m_Id == APP_CVPCB_T ) )
|
if( ( m_Id == APP_PCBNEW_T ) || ( m_Id == APP_CVPCB_T ) )
|
||||||
{
|
{
|
||||||
fn.AppendDir( wxT( "modules" ) );
|
fn.AppendDir( wxT( "modules" ) );
|
||||||
|
@ -592,7 +592,7 @@ void EDA_APP::SetDefaultSearchPaths( void )
|
||||||
m_libSearchPaths.Add( fn.GetPath() );
|
m_libSearchPaths.Add( fn.GetPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add 3D module library file path to search path list. */
|
// Add 3D module library file path to search path list.
|
||||||
fn.AppendDir( wxT( "packages3d" ) );
|
fn.AppendDir( wxT( "packages3d" ) );
|
||||||
|
|
||||||
if( fn.IsDirReadable() )
|
if( fn.IsDirReadable() )
|
||||||
|
@ -604,7 +604,7 @@ void EDA_APP::SetDefaultSearchPaths( void )
|
||||||
fn.RemoveLastDir(); // point to <kicad path>
|
fn.RemoveLastDir(); // point to <kicad path>
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add KiCad template file path to search path list. */
|
// Add KiCad template file path to search path list.
|
||||||
fn.AppendDir( wxT( "template" ) );
|
fn.AppendDir( wxT( "template" ) );
|
||||||
|
|
||||||
if( fn.IsDirReadable() )
|
if( fn.IsDirReadable() )
|
||||||
|
@ -656,6 +656,7 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
|
||||||
}
|
}
|
||||||
|
|
||||||
int draw_bg_color;
|
int draw_bg_color;
|
||||||
|
|
||||||
// FIXME OSX Mountain Lion (10.8)
|
// FIXME OSX Mountain Lion (10.8)
|
||||||
// Seems that Read doesn't found anything and ColorFromInt Asserts - I'm unable to reproduce on 10.7
|
// Seems that Read doesn't found anything and ColorFromInt Asserts - I'm unable to reproduce on 10.7
|
||||||
// In general terms i think is better have a failsafe BLACK default than an uninit variable
|
// In general terms i think is better have a failsafe BLACK default than an uninit variable
|
||||||
|
@ -688,7 +689,7 @@ void EDA_APP::SaveSettings()
|
||||||
m_settings->Write( wxT( "WorkingDir" ), wxGetCwd() );
|
m_settings->Write( wxT( "WorkingDir" ), wxGetCwd() );
|
||||||
m_settings->Write( wxT( "BgColor" ), (long) g_DrawBgColor );
|
m_settings->Write( wxT( "BgColor" ), (long) g_DrawBgColor );
|
||||||
|
|
||||||
/* Save the file history list */
|
// Save the file history list
|
||||||
m_fileHistory.Save( *m_settings );
|
m_fileHistory.Save( *m_settings );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,7 +772,7 @@ bool EDA_APP::SetLanguage( bool first_time )
|
||||||
|
|
||||||
void EDA_APP::SetLanguageIdentifier( int menu_id )
|
void EDA_APP::SetLanguageIdentifier( int menu_id )
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT( "Select language ID %d from %d possible languages." ),
|
wxLogDebug( wxT( "Select language ID %d from %zd possible languages." ),
|
||||||
menu_id, LANGUAGE_DESCR_COUNT );
|
menu_id, LANGUAGE_DESCR_COUNT );
|
||||||
|
|
||||||
for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
|
for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
|
||||||
|
@ -789,7 +790,7 @@ void EDA_APP::SetLanguagePath( void )
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
/* Add defined search paths to locale paths */
|
// Add defined search paths to locale paths
|
||||||
if( !m_searchPaths.IsEmpty() )
|
if( !m_searchPaths.IsEmpty() )
|
||||||
{
|
{
|
||||||
for( i = 0; i < m_searchPaths.GetCount(); i++ )
|
for( i = 0; i < m_searchPaths.GetCount(); i++ )
|
||||||
|
|
|
@ -376,9 +376,9 @@ wxString BOARD::GetLayerName( int aLayerIndex, bool aTranslate ) const
|
||||||
|
|
||||||
|
|
||||||
// Default layer names are statically initialized,
|
// Default layer names are statically initialized,
|
||||||
// because we want the English name and the translation
|
// because we want the English name and the translation.
|
||||||
// The English name is stored here, and to get the translation
|
// The English name is stored here, and to get the translation
|
||||||
// wxGetTranslation must be called explicitly
|
// wxGetTranslation must be called explicitly.
|
||||||
static const wxChar* layer_FRONT_name = _( "Front" );
|
static const wxChar* layer_FRONT_name = _( "Front" );
|
||||||
static const wxChar* layer_INNER1_name = _( "Inner1" );
|
static const wxChar* layer_INNER1_name = _( "Inner1" );
|
||||||
static const wxChar* layer_INNER2_name = _( "Inner2" );
|
static const wxChar* layer_INNER2_name = _( "Inner2" );
|
||||||
|
@ -397,7 +397,7 @@ static const wxChar * layer_INNER14_name = _( "Inner14" );
|
||||||
static const wxChar* layer_BACK_name = _( "Back" );
|
static const wxChar* layer_BACK_name = _( "Back" );
|
||||||
static const wxChar* layer_ADHESIVE_BACK_name = _( "Adhes_Back" );
|
static const wxChar* layer_ADHESIVE_BACK_name = _( "Adhes_Back" );
|
||||||
static const wxChar* layer_ADHESIVE_FRONT_name = _( "Adhes_Front" );
|
static const wxChar* layer_ADHESIVE_FRONT_name = _( "Adhes_Front" );
|
||||||
static const wxChar * layer_SOLDERPASTE_BACK_namet = _( "SoldP_Back" );
|
static const wxChar* layer_SOLDERPASTE_BACK_name = _( "SoldP_Back" );
|
||||||
static const wxChar* layer_SOLDERPASTE_FRONT_name = _( "SoldP_Front" );
|
static const wxChar* layer_SOLDERPASTE_FRONT_name = _( "SoldP_Front" );
|
||||||
static const wxChar* layer_SILKSCREEN_BACK_name = _( "SilkS_Back" );
|
static const wxChar* layer_SILKSCREEN_BACK_name = _( "SilkS_Back" );
|
||||||
static const wxChar* layer_SILKSCREEN_FRONT_name = _( "SilkS_Front" );
|
static const wxChar* layer_SILKSCREEN_FRONT_name = _( "SilkS_Front" );
|
||||||
|
@ -437,7 +437,7 @@ wxString BOARD::GetDefaultLayerName( int aLayerNumber, bool aTranslate )
|
||||||
case LAYER_N_BACK: txt = layer_BACK_name; break;
|
case LAYER_N_BACK: txt = layer_BACK_name; break;
|
||||||
case ADHESIVE_N_BACK: txt = layer_ADHESIVE_BACK_name; break;
|
case ADHESIVE_N_BACK: txt = layer_ADHESIVE_BACK_name; break;
|
||||||
case ADHESIVE_N_FRONT: txt = layer_ADHESIVE_FRONT_name; break;
|
case ADHESIVE_N_FRONT: txt = layer_ADHESIVE_FRONT_name; break;
|
||||||
case SOLDERPASTE_N_BACK: txt = layer_SOLDERPASTE_BACK_namet; break;
|
case SOLDERPASTE_N_BACK: txt = layer_SOLDERPASTE_BACK_name; break;
|
||||||
case SOLDERPASTE_N_FRONT: txt = layer_SOLDERPASTE_FRONT_name; break;
|
case SOLDERPASTE_N_FRONT: txt = layer_SOLDERPASTE_FRONT_name; break;
|
||||||
case SILKSCREEN_N_BACK: txt = layer_SILKSCREEN_BACK_name; break;
|
case SILKSCREEN_N_BACK: txt = layer_SILKSCREEN_BACK_name; break;
|
||||||
case SILKSCREEN_N_FRONT: txt = layer_SILKSCREEN_FRONT_name; break;
|
case SILKSCREEN_N_FRONT: txt = layer_SILKSCREEN_FRONT_name; break;
|
||||||
|
@ -451,18 +451,20 @@ wxString BOARD::GetDefaultLayerName( int aLayerNumber, bool aTranslate )
|
||||||
default: txt = wxT( "BAD_INDEX" ); break;
|
default: txt = wxT( "BAD_INDEX" ); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString name;
|
|
||||||
if( aTranslate )
|
if( aTranslate )
|
||||||
{
|
{
|
||||||
name = wxGetTranslation( txt );
|
wxString name = wxGetTranslation( txt );
|
||||||
|
|
||||||
|
/* would someone translate into a name with leading or trailing spaces?
|
||||||
name.Trim( true );
|
name.Trim( true );
|
||||||
name.Trim( false );
|
name.Trim( false );
|
||||||
}
|
*/
|
||||||
else
|
|
||||||
name = txt;
|
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
|
bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
|
||||||
|
@ -573,55 +575,6 @@ LAYER_T LAYER::ParseType( const char* aType )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LAYER::GetDefaultIndex( const wxString& aName )
|
|
||||||
{
|
|
||||||
static LAYER_INDEX_HASH_MAP layerIndices;
|
|
||||||
|
|
||||||
if( layerIndices.empty() )
|
|
||||||
{
|
|
||||||
// These are only default layer names. The copper names may be over-ridden in
|
|
||||||
// the BOARD (*.brd) file.
|
|
||||||
|
|
||||||
layerIndices[ _( "Front" ) ] = LAYER_N_FRONT;
|
|
||||||
layerIndices[ _( "Inner2" ) ] = LAYER_N_2;
|
|
||||||
layerIndices[ _( "Inner3" ) ] = LAYER_N_3;
|
|
||||||
layerIndices[ _( "Inner4" ) ] = LAYER_N_4;
|
|
||||||
layerIndices[ _( "Inner5" ) ] = LAYER_N_5;
|
|
||||||
layerIndices[ _( "Inner6" ) ] = LAYER_N_6;
|
|
||||||
layerIndices[ _( "Inner7" ) ] = LAYER_N_7;
|
|
||||||
layerIndices[ _( "Inner8" ) ] = LAYER_N_8;
|
|
||||||
layerIndices[ _( "Inner9" ) ] = LAYER_N_9;
|
|
||||||
layerIndices[ _( "Inner10" ) ] = LAYER_N_10;
|
|
||||||
layerIndices[ _( "Inner11" ) ] = LAYER_N_11;
|
|
||||||
layerIndices[ _( "Inner12" ) ] = LAYER_N_12;
|
|
||||||
layerIndices[ _( "Inner13" ) ] = LAYER_N_13;
|
|
||||||
layerIndices[ _( "Inner14" ) ] = LAYER_N_14;
|
|
||||||
layerIndices[ _( "Inner15" ) ] = LAYER_N_15;
|
|
||||||
layerIndices[ _( "Back" ) ] = LAYER_N_BACK;
|
|
||||||
layerIndices[ _( "Adhes_Back" ) ] = ADHESIVE_N_BACK;
|
|
||||||
layerIndices[ _( "Adhes_Front" ) ] = ADHESIVE_N_FRONT;
|
|
||||||
layerIndices[ _( "SoldP_Back" ) ] = SOLDERPASTE_N_BACK;
|
|
||||||
layerIndices[ _( "SoldP_Front" ) ] = SOLDERPASTE_N_FRONT;
|
|
||||||
layerIndices[ _( "SilkS_Back" ) ] = SILKSCREEN_N_BACK;
|
|
||||||
layerIndices[ _( "SilkS_Front" ) ] = SILKSCREEN_N_FRONT;
|
|
||||||
layerIndices[ _( "Mask_Back" ) ] = SOLDERMASK_N_BACK;
|
|
||||||
layerIndices[ _( "Mask_Front" ) ] = SOLDERMASK_N_FRONT;
|
|
||||||
layerIndices[ _( "Drawings" ) ] = DRAW_N;
|
|
||||||
layerIndices[ _( "Comments" ) ] = COMMENT_N;
|
|
||||||
layerIndices[ _( "Eco1" ) ] = ECO1_N;
|
|
||||||
layerIndices[ _( "Eco2" ) ] = ECO2_N;
|
|
||||||
layerIndices[ _( "PCB_Edges" ) ] = EDGE_N;
|
|
||||||
}
|
|
||||||
|
|
||||||
const LAYER_INDEX_HASH_MAP::iterator it = layerIndices.find( aName );
|
|
||||||
|
|
||||||
if( it == layerIndices.end() )
|
|
||||||
return UNDEFINED_LAYER;
|
|
||||||
|
|
||||||
return layerIndices[ aName ];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int BOARD::GetCopperLayerCount() const
|
int BOARD::GetCopperLayerCount() const
|
||||||
{
|
{
|
||||||
return m_designSettings.GetCopperLayerCount();
|
return m_designSettings.GetCopperLayerCount();
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
#include <class_zone_settings.h>
|
#include <class_zone_settings.h>
|
||||||
#include <pcb_plot_params.h>
|
#include <pcb_plot_params.h>
|
||||||
|
|
||||||
#include <wx/hashmap.h>
|
|
||||||
|
|
||||||
|
|
||||||
class PCB_BASE_FRAME;
|
class PCB_BASE_FRAME;
|
||||||
class PCB_EDIT_FRAME;
|
class PCB_EDIT_FRAME;
|
||||||
|
@ -36,7 +34,6 @@ class MARKER_PCB;
|
||||||
// non-owning container of item candidates when searching for items on the same track.
|
// non-owning container of item candidates when searching for items on the same track.
|
||||||
typedef std::vector< TRACK* > TRACK_PTRS;
|
typedef std::vector< TRACK* > TRACK_PTRS;
|
||||||
|
|
||||||
|
|
||||||
#define HISTORY_MAX_COUNT 8
|
#define HISTORY_MAX_COUNT 8
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,24 +98,12 @@ public:
|
||||||
*/
|
*/
|
||||||
static LAYER_T ParseType( const char* aType );
|
static LAYER_T ParseType( const char* aType );
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetDefaultIndex
|
|
||||||
* returns the layer index of the layer \a aName.
|
|
||||||
*
|
|
||||||
* @param aName A reference to a wxString object containing the default layer name.
|
|
||||||
* @return The index of the layer \a aName if found otherwise #UNDEFINED_LAYER_INDEX.
|
|
||||||
*/
|
|
||||||
static int GetDefaultIndex( const wxString& aName );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_visible;
|
bool m_visible;
|
||||||
int m_fixedListIndex;
|
int m_fixedListIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
WX_DECLARE_STRING_HASH_MAP( int, LAYER_INDEX_HASH_MAP );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Struct VIA_DIMENSION
|
* Struct VIA_DIMENSION
|
||||||
* is a small helper container to handle a stock of specific vias each with
|
* is a small helper container to handle a stock of specific vias each with
|
||||||
|
|
|
@ -56,7 +56,14 @@ void PCB_PARSER::init()
|
||||||
{
|
{
|
||||||
m_layerMap.clear();
|
m_layerMap.clear();
|
||||||
|
|
||||||
// @todo add default layernames here.
|
// Add untranslated default (i.e. english) layernames.
|
||||||
|
// Some may be overridden later if parsing a board rather than a footprint.
|
||||||
|
// The english name will survive if parsing only a footprint.
|
||||||
|
for( int layerNdx = 0; layerNdx < NB_LAYERS; ++layerNdx )
|
||||||
|
{
|
||||||
|
wxString untranslated = BOARD::GetDefaultLayerName( layerNdx, false );
|
||||||
|
m_layerMap[ untranslated ] = layerNdx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -646,7 +653,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
|
||||||
|
|
||||||
T token;
|
T token;
|
||||||
wxString name;
|
wxString name;
|
||||||
wxString type;
|
std::string type;
|
||||||
int layerIndex;
|
int layerIndex;
|
||||||
bool isVisible = true;
|
bool isVisible = true;
|
||||||
int visibleLayers = 0;
|
int visibleLayers = 0;
|
||||||
|
@ -662,8 +669,9 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
|
||||||
|
|
||||||
NeedSYMBOL();
|
NeedSYMBOL();
|
||||||
name = FromUTF8();
|
name = FromUTF8();
|
||||||
|
|
||||||
NeedSYMBOL();
|
NeedSYMBOL();
|
||||||
type = FromUTF8();
|
type = CurText();
|
||||||
|
|
||||||
token = NextTok();
|
token = NextTok();
|
||||||
|
|
||||||
|
@ -686,7 +694,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
|
||||||
if( isVisible )
|
if( isVisible )
|
||||||
visibleLayers |= 1 << layerIndex;
|
visibleLayers |= 1 << layerIndex;
|
||||||
|
|
||||||
enum LAYER_T layerType = LAYER::ParseType( TO_UTF8( type ) );
|
enum LAYER_T layerType = LAYER::ParseType( type.c_str() );
|
||||||
LAYER layer( name, layerType, isVisible );
|
LAYER layer( name, layerType, isVisible );
|
||||||
|
|
||||||
layer.SetFixedListIndex( layerIndex );
|
layer.SetFixedListIndex( layerIndex );
|
||||||
|
@ -694,7 +702,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
|
||||||
|
|
||||||
m_layerMap[ name ] = layerIndex;
|
m_layerMap[ name ] = layerIndex;
|
||||||
|
|
||||||
wxLogDebug( wxT( "Mapping layer %s index index %d" ),
|
wxLogDebug( wxT( "Mapping layer %s to index %d" ),
|
||||||
GetChars( name ), layerIndex );
|
GetChars( name ), layerIndex );
|
||||||
|
|
||||||
if( layerType != LT_UNDEFINED )
|
if( layerType != LT_UNDEFINED )
|
||||||
|
@ -704,8 +712,9 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
|
||||||
// We need at least 2 copper layers and there must be an even number of them.
|
// We need at least 2 copper layers and there must be an even number of them.
|
||||||
if( (copperLayerCount < 2) || ((copperLayerCount % 2) != 0) )
|
if( (copperLayerCount < 2) || ((copperLayerCount % 2) != 0) )
|
||||||
{
|
{
|
||||||
wxString err;
|
wxString err = wxString::Format(
|
||||||
err.Printf( _( "%d is not a valid layer count" ), copperLayerCount );
|
_( "%d is not a valid layer count" ), copperLayerCount );
|
||||||
|
|
||||||
THROW_PARSE_ERROR( err, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
THROW_PARSE_ERROR( err, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,13 +731,14 @@ int PCB_PARSER::lookUpLayer() throw( PARSE_ERROR, IO_ERROR )
|
||||||
|
|
||||||
if( it == m_layerMap.end() )
|
if( it == m_layerMap.end() )
|
||||||
{
|
{
|
||||||
wxString error;
|
wxString error = wxString::Format(
|
||||||
error.Printf( wxT( "Layer '%s' in file <%s> at line %d, position %d was not defined in the layers section" ),
|
_( "Layer '%s' in file <%s> at line %d, position %d, was not defined in the layers section" ),
|
||||||
GetChars( name ), GetChars( CurSource() ), CurLineNumber(), CurOffset() );
|
GetChars( name ), GetChars( CurSource() ), CurLineNumber(), CurOffset() );
|
||||||
|
|
||||||
THROW_IO_ERROR( error );
|
THROW_IO_ERROR( error );
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_layerMap[ name ];
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ WX_DECLARE_STRING_HASH_MAP( int, LAYER_HASH_MAP );
|
||||||
class PCB_PARSER : public PCB_LEXER
|
class PCB_PARSER : public PCB_LEXER
|
||||||
{
|
{
|
||||||
BOARD* m_board;
|
BOARD* m_board;
|
||||||
LAYER_HASH_MAP m_layerMap; //< Map layer name to it's index saved in BOARD::m_Layer.
|
LAYER_HASH_MAP m_layerMap; ///< Map layer name to it's index saved in BOARD::m_Layer.
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -220,6 +220,7 @@ public:
|
||||||
PCB_LEXER( aReader ),
|
PCB_LEXER( aReader ),
|
||||||
m_board( 0 )
|
m_board( 0 )
|
||||||
{
|
{
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue