Loading common/edaappl.cpp +49 −48 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ static const wxChar* CommonConfigPath = wxT( "kicad_common" ); * the size of the array. */ #define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / sizeof( struct LANGUAGE_DESCR ) ) /* Default font size */ #define FONT_DEFAULT_SIZE 10 /* Default font size. */ // Default font size #define FONT_DEFAULT_SIZE 10 // Default font size. static wxString languageCfgKey( wxT( "LanguageID" ) ); Loading Loading @@ -108,7 +108,7 @@ struct LANGUAGE_DESCR */ static struct LANGUAGE_DESCR s_Language_List[] = { /* Default language */ // Default language { wxLANGUAGE_DEFAULT, ID_LANGUAGE_DEFAULT, Loading @@ -116,7 +116,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Default" ) }, /* English language */ // English language { wxLANGUAGE_ENGLISH, ID_LANGUAGE_ENGLISH, Loading @@ -125,7 +125,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = true }, /* French language */ // French language { wxLANGUAGE_FRENCH, ID_LANGUAGE_FRENCH, Loading @@ -133,7 +133,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "French" ) }, /* Finnish language */ // Finnish language { wxLANGUAGE_FINNISH, ID_LANGUAGE_FINNISH, Loading @@ -141,7 +141,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Finnish" ) }, /* Spanish language */ // Spanish language { wxLANGUAGE_SPANISH, ID_LANGUAGE_SPANISH, Loading @@ -149,7 +149,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Spanish" ) }, /* Portuguese language */ // Portuguese language { wxLANGUAGE_PORTUGUESE, ID_LANGUAGE_PORTUGUESE, Loading @@ -157,7 +157,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Portuguese" ) }, /* Italian language */ // Italian language { wxLANGUAGE_ITALIAN, ID_LANGUAGE_ITALIAN, Loading @@ -165,7 +165,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Italian" ) }, /* German language */ // German language { wxLANGUAGE_GERMAN, ID_LANGUAGE_GERMAN, Loading @@ -173,7 +173,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "German" ) }, /* Greek language */ // Greek language { wxLANGUAGE_GREEK, ID_LANGUAGE_GREEK, Loading @@ -181,7 +181,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Greek" ) }, /* Slovenian language */ // Slovenian language { wxLANGUAGE_SLOVENIAN, ID_LANGUAGE_SLOVENIAN, Loading @@ -189,7 +189,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Slovenian" ) }, /* Hungarian language */ // Hungarian language { wxLANGUAGE_HUNGARIAN, ID_LANGUAGE_HUNGARIAN, Loading @@ -197,7 +197,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Hungarian" ) }, /* Polish language */ // Polish language { wxLANGUAGE_POLISH, ID_LANGUAGE_POLISH, Loading @@ -205,7 +205,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Polish" ) }, /* Czech language */ // Czech language { wxLANGUAGE_CZECH, ID_LANGUAGE_CZECH, Loading @@ -213,7 +213,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Czech" ) }, /* Russian language */ // Russian language { wxLANGUAGE_RUSSIAN, ID_LANGUAGE_RUSSIAN, Loading @@ -221,7 +221,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Russian" ) }, /* Korean language */ // Korean language { wxLANGUAGE_KOREAN, ID_LANGUAGE_KOREAN, Loading @@ -229,7 +229,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Korean" ) }, /* Chinese simplified */ // Chinese simplified { wxLANGUAGE_CHINESE_SIMPLIFIED, ID_LANGUAGE_CHINESE_SIMPLIFIED, Loading @@ -237,7 +237,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Chinese simplified" ) }, /* Catalan language */ // Catalan language { wxLANGUAGE_CATALAN, ID_LANGUAGE_CATALAN, Loading Loading @@ -286,7 +286,7 @@ EDA_APP::~EDA_APP() { SaveSettings(); /* delete user datas */ // delete user datas if( m_projectSettings ) delete m_projectSettings; Loading @@ -309,10 +309,9 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) m_Id = aId; m_Checker = new wxSingleInstanceChecker( aName.Lower() + wxT( "-" ) + wxGetUserId() ); /* Init KiCad environment * the environment variable KICAD (if exists) gives the kicad path: * something like set KICAD=d:\kicad */ // Init KiCad environment // the environment variable KICAD (if exists) gives the kicad path: // something like set KICAD=d:\kicad bool isDefined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv ); if( isDefined ) // ensure m_KicadEnv ends by "/" Loading @@ -323,8 +322,8 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) m_KicadEnv += UNIX_STRING_DIR_SEP; } /* 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 */ // 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. #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML m_HelpFileName = aName.Lower() + wxT( ".html" ); #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF Loading @@ -333,7 +332,7 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) #error Help files format not defined #endif /* Init parameters for configuration */ // Init parameters for configuration SetVendorName( wxT( "KiCad" ) ); SetAppName( aName.Lower() ); SetTitle( aName ); Loading @@ -342,7 +341,7 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) m_commonSettings = new wxConfig( CommonConfigPath ); 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 wxGIFHandler ); wxImage::AddHandler( new wxJPEGHandler ); Loading Loading @@ -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(); } Loading Loading @@ -418,10 +417,10 @@ void EDA_APP::InitOnLineHelp() bool EDA_APP::SetBinDir() { /* Apple MacOSx */ // Apple MacOSx #ifdef __APPLE__ /* Derive path from location of the app bundle */ // Derive path from location of the app bundle CFBundleRef mainBundle = CFBundleGetMainBundle(); if( mainBundle == NULL ) Loading @@ -446,12 +445,12 @@ bool EDA_APP::SetBinDir() m_BinDir = FROM_UTF8( native_str ); delete[] native_str; /* Linux and Unix */ // Linux and Unix #elif defined(__UNIX__) m_BinDir = wxStandardPaths().GetExecutablePath(); #else m_BinDir = argv[0]; #endif /* __UNIX__ */ #endif // __UNIX__ /* Use unix notation for paths. I am not sure this is a good idea, * but it simplify compatibility between Windows and Unices Loading Loading @@ -493,16 +492,16 @@ void EDA_APP::SetDefaultSearchPaths( void ) if( ::wxGetEnv( wxT( "KICAD" ), NULL ) ) m_searchPaths.AddEnvList( wxT( "KICAD" ) ); /* Add the user's home path. */ // Add the user's home path. 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() ) { 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(); m_searchPaths.Add( fn.GetPath() ); fn.AppendDir( wxT( "share" ) ); Loading @@ -514,7 +513,8 @@ void EDA_APP::SetDefaultSearchPaths( void ) * installed in a different path from the library files. This is * useful for development purposes so the library and documentation * 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__ tmp.AddEnvList( wxT( "PROGRAMFILES" ) ); #elif __WXMAC__ Loading Loading @@ -545,7 +545,7 @@ void EDA_APP::SetDefaultSearchPaths( void ) 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++ ) { if( !wxFileName::IsDirReadable( m_searchPaths[i] ) ) Loading @@ -570,7 +570,7 @@ void EDA_APP::SetDefaultSearchPaths( void ) 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" ) ); if( fn.IsDirReadable() ) Loading @@ -582,7 +582,7 @@ void EDA_APP::SetDefaultSearchPaths( void ) 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 ) ) { fn.AppendDir( wxT( "modules" ) ); Loading @@ -592,7 +592,7 @@ void EDA_APP::SetDefaultSearchPaths( void ) 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" ) ); if( fn.IsDirReadable() ) Loading @@ -604,7 +604,7 @@ void EDA_APP::SetDefaultSearchPaths( void ) 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" ) ); if( fn.IsDirReadable() ) Loading Loading @@ -656,6 +656,7 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) } int draw_bg_color; // FIXME OSX Mountain Lion (10.8) // 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 Loading Loading @@ -688,7 +689,7 @@ void EDA_APP::SaveSettings() m_settings->Write( wxT( "WorkingDir" ), wxGetCwd() ); m_settings->Write( wxT( "BgColor" ), (long) g_DrawBgColor ); /* Save the file history list */ // Save the file history list m_fileHistory.Save( *m_settings ); } Loading Loading @@ -771,7 +772,7 @@ bool EDA_APP::SetLanguage( bool first_time ) 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 ); for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ ) Loading @@ -789,7 +790,7 @@ void EDA_APP::SetLanguagePath( void ) { size_t i; /* Add defined search paths to locale paths */ // Add defined search paths to locale paths if( !m_searchPaths.IsEmpty() ) { for( i = 0; i < m_searchPaths.GetCount(); i++ ) Loading pcbnew/class_board.cpp +51 −98 Original line number Diff line number Diff line Loading @@ -376,9 +376,9 @@ wxString BOARD::GetLayerName( int aLayerIndex, bool aTranslate ) const // 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 // wxGetTranslation must be called explicitly // wxGetTranslation must be called explicitly. static const wxChar* layer_FRONT_name = _( "Front" ); static const wxChar* layer_INNER1_name = _( "Inner1" ); static const wxChar* layer_INNER2_name = _( "Inner2" ); Loading @@ -397,7 +397,7 @@ static const wxChar * layer_INNER14_name = _( "Inner14" ); static const wxChar* layer_BACK_name = _( "Back" ); static const wxChar* layer_ADHESIVE_BACK_name = _( "Adhes_Back" ); 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_SILKSCREEN_BACK_name = _( "SilkS_Back" ); static const wxChar* layer_SILKSCREEN_FRONT_name = _( "SilkS_Front" ); Loading Loading @@ -437,7 +437,7 @@ wxString BOARD::GetDefaultLayerName( int aLayerNumber, bool aTranslate ) case LAYER_N_BACK: txt = layer_BACK_name; break; case ADHESIVE_N_BACK: txt = layer_ADHESIVE_BACK_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 SILKSCREEN_N_BACK: txt = layer_SILKSCREEN_BACK_name; break; case SILKSCREEN_N_FRONT: txt = layer_SILKSCREEN_FRONT_name; break; Loading @@ -451,18 +451,20 @@ wxString BOARD::GetDefaultLayerName( int aLayerNumber, bool aTranslate ) default: txt = wxT( "BAD_INDEX" ); break; } wxString name; 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( false ); } else name = txt; */ return name; } else return txt; } bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) Loading Loading @@ -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 { return m_designSettings.GetCopperLayerCount(); Loading pcbnew/class_board.h +4 −19 Original line number Diff line number Diff line Loading @@ -19,8 +19,6 @@ #include <class_zone_settings.h> #include <pcb_plot_params.h> #include <wx/hashmap.h> class PCB_BASE_FRAME; class PCB_EDIT_FRAME; Loading @@ -36,7 +34,6 @@ class MARKER_PCB; // non-owning container of item candidates when searching for items on the same track. typedef std::vector< TRACK* > TRACK_PTRS; #define HISTORY_MAX_COUNT 8 Loading Loading @@ -101,24 +98,12 @@ public: */ 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: bool m_visible; int m_fixedListIndex; }; WX_DECLARE_STRING_HASH_MAP( int, LAYER_INDEX_HASH_MAP ); /** * Struct VIA_DIMENSION * is a small helper container to handle a stock of specific vias each with Loading pcbnew/pcb_parser.cpp +54 −44 Original line number Diff line number Diff line Loading @@ -56,7 +56,14 @@ void PCB_PARSER::init() { 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; } } Loading Loading @@ -646,7 +653,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) T token; wxString name; wxString type; std::string type; int layerIndex; bool isVisible = true; int visibleLayers = 0; Loading @@ -662,8 +669,9 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) NeedSYMBOL(); name = FromUTF8(); NeedSYMBOL(); type = FromUTF8(); type = CurText(); token = NextTok(); Loading @@ -686,7 +694,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) if( isVisible ) 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.SetFixedListIndex( layerIndex ); Loading @@ -694,7 +702,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) m_layerMap[ name ] = layerIndex; wxLogDebug( wxT( "Mapping layer %s index index %d" ), wxLogDebug( wxT( "Mapping layer %s to index %d" ), GetChars( name ), layerIndex ); if( layerType != LT_UNDEFINED ) Loading @@ -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. if( (copperLayerCount < 2) || ((copperLayerCount % 2) != 0) ) { wxString err; err.Printf( _( "%d is not a valid layer count" ), copperLayerCount ); wxString err = wxString::Format( _( "%d is not a valid layer count" ), copperLayerCount ); THROW_PARSE_ERROR( err, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); } Loading @@ -722,13 +731,14 @@ int PCB_PARSER::lookUpLayer() throw( PARSE_ERROR, IO_ERROR ) if( it == m_layerMap.end() ) { wxString error; error.Printf( wxT( "Layer '%s' in file <%s> at line %d, position %d was not defined in the layers section" ), wxString error = wxString::Format( _( "Layer '%s' in file <%s> at line %d, position %d, was not defined in the layers section" ), GetChars( name ), GetChars( CurSource() ), CurLineNumber(), CurOffset() ); THROW_IO_ERROR( error ); } return m_layerMap[ name ]; return it->second; } Loading pcbnew/pcb_parser.h +2 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ WX_DECLARE_STRING_HASH_MAP( int, LAYER_HASH_MAP ); class PCB_PARSER : public PCB_LEXER { 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. /** Loading Loading @@ -220,6 +220,7 @@ public: PCB_LEXER( aReader ), m_board( 0 ) { init(); } Loading Loading
common/edaappl.cpp +49 −48 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ static const wxChar* CommonConfigPath = wxT( "kicad_common" ); * the size of the array. */ #define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / sizeof( struct LANGUAGE_DESCR ) ) /* Default font size */ #define FONT_DEFAULT_SIZE 10 /* Default font size. */ // Default font size #define FONT_DEFAULT_SIZE 10 // Default font size. static wxString languageCfgKey( wxT( "LanguageID" ) ); Loading Loading @@ -108,7 +108,7 @@ struct LANGUAGE_DESCR */ static struct LANGUAGE_DESCR s_Language_List[] = { /* Default language */ // Default language { wxLANGUAGE_DEFAULT, ID_LANGUAGE_DEFAULT, Loading @@ -116,7 +116,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Default" ) }, /* English language */ // English language { wxLANGUAGE_ENGLISH, ID_LANGUAGE_ENGLISH, Loading @@ -125,7 +125,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = true }, /* French language */ // French language { wxLANGUAGE_FRENCH, ID_LANGUAGE_FRENCH, Loading @@ -133,7 +133,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "French" ) }, /* Finnish language */ // Finnish language { wxLANGUAGE_FINNISH, ID_LANGUAGE_FINNISH, Loading @@ -141,7 +141,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Finnish" ) }, /* Spanish language */ // Spanish language { wxLANGUAGE_SPANISH, ID_LANGUAGE_SPANISH, Loading @@ -149,7 +149,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Spanish" ) }, /* Portuguese language */ // Portuguese language { wxLANGUAGE_PORTUGUESE, ID_LANGUAGE_PORTUGUESE, Loading @@ -157,7 +157,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Portuguese" ) }, /* Italian language */ // Italian language { wxLANGUAGE_ITALIAN, ID_LANGUAGE_ITALIAN, Loading @@ -165,7 +165,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Italian" ) }, /* German language */ // German language { wxLANGUAGE_GERMAN, ID_LANGUAGE_GERMAN, Loading @@ -173,7 +173,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "German" ) }, /* Greek language */ // Greek language { wxLANGUAGE_GREEK, ID_LANGUAGE_GREEK, Loading @@ -181,7 +181,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Greek" ) }, /* Slovenian language */ // Slovenian language { wxLANGUAGE_SLOVENIAN, ID_LANGUAGE_SLOVENIAN, Loading @@ -189,7 +189,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Slovenian" ) }, /* Hungarian language */ // Hungarian language { wxLANGUAGE_HUNGARIAN, ID_LANGUAGE_HUNGARIAN, Loading @@ -197,7 +197,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Hungarian" ) }, /* Polish language */ // Polish language { wxLANGUAGE_POLISH, ID_LANGUAGE_POLISH, Loading @@ -205,7 +205,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Polish" ) }, /* Czech language */ // Czech language { wxLANGUAGE_CZECH, ID_LANGUAGE_CZECH, Loading @@ -213,7 +213,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Czech" ) }, /* Russian language */ // Russian language { wxLANGUAGE_RUSSIAN, ID_LANGUAGE_RUSSIAN, Loading @@ -221,7 +221,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Russian" ) }, /* Korean language */ // Korean language { wxLANGUAGE_KOREAN, ID_LANGUAGE_KOREAN, Loading @@ -229,7 +229,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Korean" ) }, /* Chinese simplified */ // Chinese simplified { wxLANGUAGE_CHINESE_SIMPLIFIED, ID_LANGUAGE_CHINESE_SIMPLIFIED, Loading @@ -237,7 +237,7 @@ static struct LANGUAGE_DESCR s_Language_List[] = _( "Chinese simplified" ) }, /* Catalan language */ // Catalan language { wxLANGUAGE_CATALAN, ID_LANGUAGE_CATALAN, Loading Loading @@ -286,7 +286,7 @@ EDA_APP::~EDA_APP() { SaveSettings(); /* delete user datas */ // delete user datas if( m_projectSettings ) delete m_projectSettings; Loading @@ -309,10 +309,9 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) m_Id = aId; m_Checker = new wxSingleInstanceChecker( aName.Lower() + wxT( "-" ) + wxGetUserId() ); /* Init KiCad environment * the environment variable KICAD (if exists) gives the kicad path: * something like set KICAD=d:\kicad */ // Init KiCad environment // the environment variable KICAD (if exists) gives the kicad path: // something like set KICAD=d:\kicad bool isDefined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv ); if( isDefined ) // ensure m_KicadEnv ends by "/" Loading @@ -323,8 +322,8 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) m_KicadEnv += UNIX_STRING_DIR_SEP; } /* 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 */ // 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. #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML m_HelpFileName = aName.Lower() + wxT( ".html" ); #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF Loading @@ -333,7 +332,7 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) #error Help files format not defined #endif /* Init parameters for configuration */ // Init parameters for configuration SetVendorName( wxT( "KiCad" ) ); SetAppName( aName.Lower() ); SetTitle( aName ); Loading @@ -342,7 +341,7 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) m_commonSettings = new wxConfig( CommonConfigPath ); 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 wxGIFHandler ); wxImage::AddHandler( new wxJPEGHandler ); Loading Loading @@ -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(); } Loading Loading @@ -418,10 +417,10 @@ void EDA_APP::InitOnLineHelp() bool EDA_APP::SetBinDir() { /* Apple MacOSx */ // Apple MacOSx #ifdef __APPLE__ /* Derive path from location of the app bundle */ // Derive path from location of the app bundle CFBundleRef mainBundle = CFBundleGetMainBundle(); if( mainBundle == NULL ) Loading @@ -446,12 +445,12 @@ bool EDA_APP::SetBinDir() m_BinDir = FROM_UTF8( native_str ); delete[] native_str; /* Linux and Unix */ // Linux and Unix #elif defined(__UNIX__) m_BinDir = wxStandardPaths().GetExecutablePath(); #else m_BinDir = argv[0]; #endif /* __UNIX__ */ #endif // __UNIX__ /* Use unix notation for paths. I am not sure this is a good idea, * but it simplify compatibility between Windows and Unices Loading Loading @@ -493,16 +492,16 @@ void EDA_APP::SetDefaultSearchPaths( void ) if( ::wxGetEnv( wxT( "KICAD" ), NULL ) ) m_searchPaths.AddEnvList( wxT( "KICAD" ) ); /* Add the user's home path. */ // Add the user's home path. 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() ) { 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(); m_searchPaths.Add( fn.GetPath() ); fn.AppendDir( wxT( "share" ) ); Loading @@ -514,7 +513,8 @@ void EDA_APP::SetDefaultSearchPaths( void ) * installed in a different path from the library files. This is * useful for development purposes so the library and documentation * 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__ tmp.AddEnvList( wxT( "PROGRAMFILES" ) ); #elif __WXMAC__ Loading Loading @@ -545,7 +545,7 @@ void EDA_APP::SetDefaultSearchPaths( void ) 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++ ) { if( !wxFileName::IsDirReadable( m_searchPaths[i] ) ) Loading @@ -570,7 +570,7 @@ void EDA_APP::SetDefaultSearchPaths( void ) 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" ) ); if( fn.IsDirReadable() ) Loading @@ -582,7 +582,7 @@ void EDA_APP::SetDefaultSearchPaths( void ) 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 ) ) { fn.AppendDir( wxT( "modules" ) ); Loading @@ -592,7 +592,7 @@ void EDA_APP::SetDefaultSearchPaths( void ) 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" ) ); if( fn.IsDirReadable() ) Loading @@ -604,7 +604,7 @@ void EDA_APP::SetDefaultSearchPaths( void ) 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" ) ); if( fn.IsDirReadable() ) Loading Loading @@ -656,6 +656,7 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) } int draw_bg_color; // FIXME OSX Mountain Lion (10.8) // 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 Loading Loading @@ -688,7 +689,7 @@ void EDA_APP::SaveSettings() m_settings->Write( wxT( "WorkingDir" ), wxGetCwd() ); m_settings->Write( wxT( "BgColor" ), (long) g_DrawBgColor ); /* Save the file history list */ // Save the file history list m_fileHistory.Save( *m_settings ); } Loading Loading @@ -771,7 +772,7 @@ bool EDA_APP::SetLanguage( bool first_time ) 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 ); for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ ) Loading @@ -789,7 +790,7 @@ void EDA_APP::SetLanguagePath( void ) { size_t i; /* Add defined search paths to locale paths */ // Add defined search paths to locale paths if( !m_searchPaths.IsEmpty() ) { for( i = 0; i < m_searchPaths.GetCount(); i++ ) Loading
pcbnew/class_board.cpp +51 −98 Original line number Diff line number Diff line Loading @@ -376,9 +376,9 @@ wxString BOARD::GetLayerName( int aLayerIndex, bool aTranslate ) const // 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 // wxGetTranslation must be called explicitly // wxGetTranslation must be called explicitly. static const wxChar* layer_FRONT_name = _( "Front" ); static const wxChar* layer_INNER1_name = _( "Inner1" ); static const wxChar* layer_INNER2_name = _( "Inner2" ); Loading @@ -397,7 +397,7 @@ static const wxChar * layer_INNER14_name = _( "Inner14" ); static const wxChar* layer_BACK_name = _( "Back" ); static const wxChar* layer_ADHESIVE_BACK_name = _( "Adhes_Back" ); 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_SILKSCREEN_BACK_name = _( "SilkS_Back" ); static const wxChar* layer_SILKSCREEN_FRONT_name = _( "SilkS_Front" ); Loading Loading @@ -437,7 +437,7 @@ wxString BOARD::GetDefaultLayerName( int aLayerNumber, bool aTranslate ) case LAYER_N_BACK: txt = layer_BACK_name; break; case ADHESIVE_N_BACK: txt = layer_ADHESIVE_BACK_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 SILKSCREEN_N_BACK: txt = layer_SILKSCREEN_BACK_name; break; case SILKSCREEN_N_FRONT: txt = layer_SILKSCREEN_FRONT_name; break; Loading @@ -451,18 +451,20 @@ wxString BOARD::GetDefaultLayerName( int aLayerNumber, bool aTranslate ) default: txt = wxT( "BAD_INDEX" ); break; } wxString name; 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( false ); } else name = txt; */ return name; } else return txt; } bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) Loading Loading @@ -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 { return m_designSettings.GetCopperLayerCount(); Loading
pcbnew/class_board.h +4 −19 Original line number Diff line number Diff line Loading @@ -19,8 +19,6 @@ #include <class_zone_settings.h> #include <pcb_plot_params.h> #include <wx/hashmap.h> class PCB_BASE_FRAME; class PCB_EDIT_FRAME; Loading @@ -36,7 +34,6 @@ class MARKER_PCB; // non-owning container of item candidates when searching for items on the same track. typedef std::vector< TRACK* > TRACK_PTRS; #define HISTORY_MAX_COUNT 8 Loading Loading @@ -101,24 +98,12 @@ public: */ 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: bool m_visible; int m_fixedListIndex; }; WX_DECLARE_STRING_HASH_MAP( int, LAYER_INDEX_HASH_MAP ); /** * Struct VIA_DIMENSION * is a small helper container to handle a stock of specific vias each with Loading
pcbnew/pcb_parser.cpp +54 −44 Original line number Diff line number Diff line Loading @@ -56,7 +56,14 @@ void PCB_PARSER::init() { 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; } } Loading Loading @@ -646,7 +653,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) T token; wxString name; wxString type; std::string type; int layerIndex; bool isVisible = true; int visibleLayers = 0; Loading @@ -662,8 +669,9 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) NeedSYMBOL(); name = FromUTF8(); NeedSYMBOL(); type = FromUTF8(); type = CurText(); token = NextTok(); Loading @@ -686,7 +694,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) if( isVisible ) 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.SetFixedListIndex( layerIndex ); Loading @@ -694,7 +702,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) m_layerMap[ name ] = layerIndex; wxLogDebug( wxT( "Mapping layer %s index index %d" ), wxLogDebug( wxT( "Mapping layer %s to index %d" ), GetChars( name ), layerIndex ); if( layerType != LT_UNDEFINED ) Loading @@ -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. if( (copperLayerCount < 2) || ((copperLayerCount % 2) != 0) ) { wxString err; err.Printf( _( "%d is not a valid layer count" ), copperLayerCount ); wxString err = wxString::Format( _( "%d is not a valid layer count" ), copperLayerCount ); THROW_PARSE_ERROR( err, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); } Loading @@ -722,13 +731,14 @@ int PCB_PARSER::lookUpLayer() throw( PARSE_ERROR, IO_ERROR ) if( it == m_layerMap.end() ) { wxString error; error.Printf( wxT( "Layer '%s' in file <%s> at line %d, position %d was not defined in the layers section" ), wxString error = wxString::Format( _( "Layer '%s' in file <%s> at line %d, position %d, was not defined in the layers section" ), GetChars( name ), GetChars( CurSource() ), CurLineNumber(), CurOffset() ); THROW_IO_ERROR( error ); } return m_layerMap[ name ]; return it->second; } Loading
pcbnew/pcb_parser.h +2 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ WX_DECLARE_STRING_HASH_MAP( int, LAYER_HASH_MAP ); class PCB_PARSER : public PCB_LEXER { 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. /** Loading Loading @@ -220,6 +220,7 @@ public: PCB_LEXER( aReader ), m_board( 0 ) { init(); } Loading