Commit 8eff8df9 authored by dickelbeck's avatar dickelbeck

beautify

parent ce04867e
...@@ -277,10 +277,10 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding ) ...@@ -277,10 +277,10 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding )
*/ */
{ {
#if 0 && defined(DEBUG) #if 1 && defined(DEBUG)
// Dick: this code is working fine, but we have no place to store the layer names yet. // Dick: this code is working fine, but we have no place to store the layer names yet.
const unsigned LAYER_LIMIT = 29; const unsigned LAYER_LIMIT = 29;
// @todo: these layer names should be configurable on a per project basis. // @todo: these layer names should be configurable on a per project basis.
...@@ -288,17 +288,17 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding ) ...@@ -288,17 +288,17 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding )
// deriving the file names from the "configured" layer names. // deriving the file names from the "configured" layer names.
// The main idea is to use a single array of names, and then remove // 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. // spaces on the fly from the names when writing to disk.
#if 1 // my specific layer names #if 1 // my specific layer names
static const wxString layer_name_list[] = { static const wxString layer_name_list[] = {
_( "H2 Bottom" ), _( "Power" ), _( "V2 Signal" ), _( "H1 Signal" ), _( "H2 Bottom" ), _( "Power" ), _( "V2 Signal" ), _( "H1 Signal" ),
_( "Ground" ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ), _( "Ground" ), _( "Inner L5" ), _( "Inner L6" ), _( "Inner L7" ),
_( "Inner L8 " ), _( "Inner L9 " ), _( "Inner L10" ), _( "Inner L11" ), _( "Inner L8" ), _( "Inner L9" ), _( "Inner L10" ), _( "Inner L11" ),
_( "Inner L12" ), _( "Inner L13" ), _( "Inner L14" ), _( "Component" ), _( "Inner L12" ), _( "Inner L13" ), _( "Inner L14" ), _( "Component" ),
_( "Adhes Cop" ), _( "Adhes Cmp" ), _( "SoldP Cop" ), _( "SoldP Cmp" ), _( "Adhes Cop" ), _( "Adhes Cmp" ), _( "SoldP Cop" ), _( "SoldP Cmp" ),
_( "SilkS Cop" ), _( "SilkS Cmp" ), _( "Mask Cop " ), _( "Mask Cmp " ), _( "SilkS Cop" ), _( "SilkS Cmp" ), _( "Mask Cop" ), _( "Mask Cmp" ),
_( "Drawings " ), _( "Comments " ), _( "Eco1 " ), _( "Eco2 " ), _( "Drawings " ), _( "Comments" ), _( "Eco1" ), _( "Eco2" ),
_( "Edges Pcb" ), _( "BAD INDEX" ), _( "Edges Pcb" ), _( "BAD INDEX" ),
}; };
#else #else
...@@ -319,22 +319,22 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding ) ...@@ -319,22 +319,22 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding )
layer_number = LAYER_LIMIT; layer_number = LAYER_LIMIT;
const wxString* p = &layer_name_list[layer_number]; const wxString* p = &layer_name_list[layer_number];
if( omitSpacePadding ) if( omitSpacePadding )
{ {
wxString ret = *p; // copy the string wxString ret = *p; // copy the string
// modify the copy // modify the copy
ret.Trim(); ret.Trim();
ret.Replace( wxT(" "), wxT("_") ); ret.Replace( wxT(" "), wxT("_") );
return ret; return ret;
} }
else else
return *p; return *p;
#else // long standing established code: #else // long standing established code:
static const wxString layer_name_list[] = { static const wxString layer_name_list[] = {
_( "Copper " ), _( "Inner L1 " ), _( "Inner L2 " ), _( "Inner L3 " ), _( "Copper " ), _( "Inner L1 " ), _( "Inner L2 " ), _( "Inner L3 " ),
_( "Inner L4 " ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ), _( "Inner L4 " ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ),
...@@ -346,7 +346,7 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding ) ...@@ -346,7 +346,7 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding )
_( "Edges Pcb" ), _( "--- " ), _( "--- " ), _( "--- " ) _( "Edges Pcb" ), _( "--- " ), _( "--- " ), _( "--- " )
}; };
// Same as layer_name_list, without space, not internationalized // Same as layer_name_list, without space, not internationalized
static const wxString layer_name_list_for_filename[] = { static const wxString layer_name_list_for_filename[] = {
wxT( "Copper" ), wxT( "InnerL1" ), wxT( "InnerL2" ), wxT( "InnerL3" ), wxT( "Copper" ), wxT( "InnerL1" ), wxT( "InnerL2" ), wxT( "InnerL3" ),
...@@ -358,16 +358,16 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding ) ...@@ -358,16 +358,16 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding )
wxT( "Drawings" ), wxT( "Comments" ), wxT( "Eco1" ), wxT( "Eco2" ), wxT( "Drawings" ), wxT( "Comments" ), wxT( "Eco1" ), wxT( "Eco2" ),
wxT( "EdgesPcb" ), wxT( "---" ), wxT( "---" ), wxT( "---" ) wxT( "EdgesPcb" ), wxT( "---" ), wxT( "---" ), wxT( "---" )
}; };
if( (unsigned) layer_number >= 31u ) if( (unsigned) layer_number >= 31u )
layer_number = 31; layer_number = 31;
return omitSpacePadding ? return omitSpacePadding ?
layer_name_list_for_filename[layer_number] : layer_name_list_for_filename[layer_number] :
layer_name_list[layer_number]; layer_name_list[layer_number];
#endif #endif
} }
...@@ -509,6 +509,6 @@ const wxString& valeur_param( int valeur, wxString& buf_texte ) ...@@ -509,6 +509,6 @@ const wxString& valeur_param( int valeur, wxString& buf_texte )
{ {
buf_texte.Printf( wxT( "%2.4f \"" ), valeur * 0.0001 ); buf_texte.Printf( wxT( "%2.4f \"" ), valeur * 0.0001 );
} }
return buf_texte; return buf_texte;
} }
...@@ -118,8 +118,8 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) ...@@ -118,8 +118,8 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
/* 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
*/ */
m_Env_Defined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv ); m_Env_Defined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv );
if( m_Env_Defined ) // ensure m_KicadEnv ends by "/" if( m_Env_Defined ) // ensure m_KicadEnv ends by "/"
{ {
...@@ -214,7 +214,7 @@ bool WinEDA_App::SetBinDir() ...@@ -214,7 +214,7 @@ bool WinEDA_App::SetBinDir()
if (str == NULL) return false; if (str == NULL) return false;
char *native_str = NULL; char *native_str = NULL;
int len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str), int len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str),
kCFStringEncodingUTF8) + 1; kCFStringEncodingUTF8) + 1;
native_str = new char[len]; native_str = new char[len];
CFStringGetCString(str, native_str, len, kCFStringEncodingUTF8); CFStringGetCString(str, native_str, len, kCFStringEncodingUTF8);
m_BinDir = CONV_FROM_UTF8(native_str); m_BinDir = CONV_FROM_UTF8(native_str);
...@@ -222,7 +222,7 @@ bool WinEDA_App::SetBinDir() ...@@ -222,7 +222,7 @@ bool WinEDA_App::SetBinDir()
#elif defined(__UNIX__) #elif defined(__UNIX__)
// Under Linux, if argv[0] doesn't the complete path to the executable, // Under Linux, if argv[0] doesn't the complete path to the executable,
// it's necessary to obtain it using "which <filename>". // it's necessary to obtain it using "which <filename>".
FILE* ftmp; FILE* ftmp;
...@@ -270,7 +270,8 @@ void WinEDA_App::GetSettings() ...@@ -270,7 +270,8 @@ void WinEDA_App::GetSettings()
wxString Line, Ident; wxString Line, Ident;
unsigned ii; unsigned ii;
m_HelpSize.x = 500; m_HelpSize.y = 400; m_HelpSize.x = 500;
m_HelpSize.y = 400;
if( m_EDA_CommonConfig ) if( m_EDA_CommonConfig )
{ {
...@@ -285,8 +286,11 @@ void WinEDA_App::GetSettings() ...@@ -285,8 +286,11 @@ void WinEDA_App::GetSettings()
for( ii = 0; ii < 10; ii++ ) for( ii = 0; ii < 10; ii++ )
{ {
Ident = wxT( "LastProject" ); if( ii ) Ident = wxT( "LastProject" );
if( ii )
Ident << ii; Ident << ii;
if( m_EDA_Config->Read( Ident, &Line ) ) if( m_EDA_Config->Read( Ident, &Line ) )
m_LastProject.Add( Line ); m_LastProject.Add( Line );
} }
...@@ -299,6 +303,7 @@ void WinEDA_App::GetSettings() ...@@ -299,6 +303,7 @@ void WinEDA_App::GetSettings()
Line = m_EDA_Config->Read( wxT( "SdtFontType" ), wxEmptyString ); Line = m_EDA_Config->Read( wxT( "SdtFontType" ), wxEmptyString );
if( !Line.IsEmpty() ) if( !Line.IsEmpty() )
g_StdFont->SetFaceName( Line ); g_StdFont->SetFaceName( Line );
ii = m_EDA_Config->Read( wxT( "SdtFontStyle" ), wxFONTFAMILY_ROMAN ); ii = m_EDA_Config->Read( wxT( "SdtFontStyle" ), wxFONTFAMILY_ROMAN );
g_StdFont->SetStyle( ii ); g_StdFont->SetStyle( ii );
ii = m_EDA_Config->Read( wxT( "SdtFontWeight" ), wxNORMAL ); ii = m_EDA_Config->Read( wxT( "SdtFontWeight" ), wxNORMAL );
...@@ -309,6 +314,7 @@ void WinEDA_App::GetSettings() ...@@ -309,6 +314,7 @@ void WinEDA_App::GetSettings()
Line = m_EDA_Config->Read( wxT( "MsgFontType" ), wxEmptyString ); Line = m_EDA_Config->Read( wxT( "MsgFontType" ), wxEmptyString );
if( !Line.IsEmpty() ) if( !Line.IsEmpty() )
g_MsgFont->SetFaceName( Line ); g_MsgFont->SetFaceName( Line );
ii = m_EDA_Config->Read( wxT( "MsgFontStyle" ), wxFONTFAMILY_ROMAN ); ii = m_EDA_Config->Read( wxT( "MsgFontStyle" ), wxFONTFAMILY_ROMAN );
g_MsgFont->SetStyle( ii ); g_MsgFont->SetStyle( ii );
ii = m_EDA_Config->Read( wxT( "MsgFontWeight" ), wxNORMAL ); ii = m_EDA_Config->Read( wxT( "MsgFontWeight" ), wxNORMAL );
...@@ -318,6 +324,7 @@ void WinEDA_App::GetSettings() ...@@ -318,6 +324,7 @@ void WinEDA_App::GetSettings()
Line = m_EDA_Config->Read( wxT( "DialogFontType" ), wxEmptyString ); Line = m_EDA_Config->Read( wxT( "DialogFontType" ), wxEmptyString );
if( !Line.IsEmpty() ) if( !Line.IsEmpty() )
g_DialogFont->SetFaceName( Line ); g_DialogFont->SetFaceName( Line );
ii = m_EDA_Config->Read( wxT( "DialogFontStyle" ), wxFONTFAMILY_ROMAN ); ii = m_EDA_Config->Read( wxT( "DialogFontStyle" ), wxFONTFAMILY_ROMAN );
g_DialogFont->SetStyle( ii ); g_DialogFont->SetStyle( ii );
ii = m_EDA_Config->Read( wxT( "DialogFontWeight" ), wxNORMAL ); ii = m_EDA_Config->Read( wxT( "DialogFontWeight" ), wxNORMAL );
...@@ -343,7 +350,6 @@ void WinEDA_App::SaveSettings() ...@@ -343,7 +350,6 @@ void WinEDA_App::SaveSettings()
{ {
unsigned int ii; unsigned int ii;
if( m_EDA_Config == NULL ) if( m_EDA_Config == NULL )
return; return;
......
This diff is collapsed.
This diff is collapsed.
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