diff --git a/common/common.cpp b/common/common.cpp index 2795ba707f..7b353b2dd5 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -13,6 +13,7 @@ #include "macros.h" #include "build_version.h" + /*****************************/ wxString GetBuildVersion() /*****************************/ @@ -264,6 +265,8 @@ void MyFree( void* pt_mem ) } + + /**************************************************************/ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding ) /**************************************************************/ @@ -273,6 +276,65 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding ) * (not internatinalized, no space) */ { + +#if 0 || defined(DEBUG) + + // Dick: this code is working fine, but we have no place to store the layer names yet. + + const unsigned LAYER_LIMIT = 29; + + // @todo: these layer names should be configurable on a per project basis. + // In anticipation of that enhancement, here is a different strategy for + // deriving the file names from the "configured" layer names. + // The main idea is to use a single array of names, and then remove + // spaces on the fly from the names when writing to disk. + + +#if 1 // my specific layer names + static const wxString layer_name_list[] = { + _( "H2 Bottom" ), _( "Power" ), _( "V2 Signal" ), _( "H1 Signal" ), + _( "Ground" ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ), + _( "Inner L8 " ), _( "Inner L9 " ), _( "Inner L10" ), _( "Inner L11" ), + _( "Inner L12" ), _( "Inner L13" ), _( "Inner L14" ), _( "Component" ), + _( "Adhes Cop" ), _( "Adhes Cmp" ), _( "SoldP Cop" ), _( "SoldP Cmp" ), + _( "SilkS Cop" ), _( "SilkS Cmp" ), _( "Mask Cop " ), _( "Mask Cmp " ), + _( "Drawings " ), _( "Comments " ), _( "Eco1 " ), _( "Eco2 " ), + _( "Edges Pcb" ), _( "BAD INDEX" ), + }; +#else + static const wxString layer_name_list[] = { + _( "Copper " ), _( "Inner L1 " ), _( "Inner L2 " ), _( "Inner L3 " ), + _( "Inner L4 " ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ), + _( "Inner L8 " ), _( "Inner L9 " ), _( "Inner L10" ), _( "Inner L11" ), + _( "Inner L12" ), _( "Inner L13" ), _( "Inner L14" ), _( "Component" ), + _( "Adhes Cop" ), _( "Adhes Cmp" ), _( "SoldP Cop" ), _( "SoldP Cmp" ), + _( "SilkS Cop" ), _( "SilkS Cmp" ), _( "Mask Cop " ), _( "Mask Cmp " ), + _( "Drawings " ), _( "Comments " ), _( "Eco1 " ), _( "Eco2 " ), + _( "Edges Pcb" ), _( "BAD INDEX" ), + }; + +#endif + + if( (unsigned) layer_number > LAYER_LIMIT ) + layer_number = LAYER_LIMIT; + + const wxString* p = &layer_name_list[layer_number]; + + if( omitSpacePadding ) + { + wxString ret = *p; // copy the string + + // modify the copy + ret.Trim(); + ret.Replace( wxT(" "), wxT("_") ); + + return ret; + } + else + return *p; + +#else // long standing established code: + static const wxString layer_name_list[] = { _( "Copper " ), _( "Inner L1 " ), _( "Inner L2 " ), _( "Inner L3 " ), _( "Inner L4 " ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ), @@ -296,6 +358,7 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding ) wxT( "Drawings" ), wxT( "Comments" ), wxT( "Eco1" ), wxT( "Eco2" ), wxT( "EdgesPcb" ), wxT( "---" ), wxT( "---" ), wxT( "---" ) }; + if( (unsigned) layer_number >= 31u ) layer_number = 31; @@ -303,6 +366,8 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding ) return omitSpacePadding ? layer_name_list_for_filename[layer_number] : layer_name_list[layer_number]; +#endif + }