mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Formatting.
This commit is contained in:
parent
759bfbca99
commit
cedb97c4c3
@ -205,7 +205,8 @@ void DESIGN_BLOCK_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
|
|||||||
row->SetVisible();
|
row->SetVisible();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: in->Unexpected( tok );
|
default:
|
||||||
|
in->Unexpected( tok );
|
||||||
}
|
}
|
||||||
|
|
||||||
in->NeedRIGHT();
|
in->NeedRIGHT();
|
||||||
@ -253,8 +254,10 @@ bool DESIGN_BLOCK_LIB_TABLE::operator==( const DESIGN_BLOCK_LIB_TABLE& aDesignBl
|
|||||||
{
|
{
|
||||||
if( (DESIGN_BLOCK_LIB_TABLE_ROW&) m_rows[i]
|
if( (DESIGN_BLOCK_LIB_TABLE_ROW&) m_rows[i]
|
||||||
!= (DESIGN_BLOCK_LIB_TABLE_ROW&) aDesignBlockTable.m_rows[i] )
|
!= (DESIGN_BLOCK_LIB_TABLE_ROW&) aDesignBlockTable.m_rows[i] )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -268,8 +271,8 @@ void DESIGN_BLOCK_LIB_TABLE::Format( OUTPUTFORMATTER* aOutput, int aIndentLevel
|
|||||||
aOutput->Print( aIndentLevel, "(design_block_lib_table\n" );
|
aOutput->Print( aIndentLevel, "(design_block_lib_table\n" );
|
||||||
aOutput->Print( aIndentLevel + 1, "(version %d)\n", m_version );
|
aOutput->Print( aIndentLevel + 1, "(version %d)\n", m_version );
|
||||||
|
|
||||||
for( LIB_TABLE_ROWS_CITER it = m_rows.begin(); it != m_rows.end(); ++it )
|
for( const LIB_TABLE_ROW& row : m_rows)
|
||||||
it->Format( aOutput, aIndentLevel + 1 );
|
row.Format( aOutput, aIndentLevel + 1 );
|
||||||
|
|
||||||
aOutput->Print( aIndentLevel, ")\n" );
|
aOutput->Print( aIndentLevel, ")\n" );
|
||||||
}
|
}
|
||||||
@ -330,9 +333,9 @@ const DESIGN_BLOCK_LIB_TABLE_ROW* DESIGN_BLOCK_LIB_TABLE::FindRow( const wxStrin
|
|||||||
|
|
||||||
if( !row )
|
if( !row )
|
||||||
{
|
{
|
||||||
wxString msg = wxString::Format(
|
THROW_IO_ERROR( wxString::Format( _( "design-block-lib-table files contain no library "
|
||||||
_( "design-block-lib-table files contain no library named '%s'." ), aNickname );
|
"named '%s'." ),
|
||||||
THROW_IO_ERROR( msg );
|
aNickname ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !row->plugin )
|
if( !row->plugin )
|
||||||
@ -490,14 +493,12 @@ DESIGN_BLOCK_LIB_TABLE::DesignBlockLoadWithOptionalNickname( const LIB_ID& aDesi
|
|||||||
// nickname is empty, sequentially search (alphabetically) all libs/nicks for first match:
|
// nickname is empty, sequentially search (alphabetically) all libs/nicks for first match:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::vector<wxString> nicks = GetLogicalLibs();
|
|
||||||
|
|
||||||
// Search each library going through libraries alphabetically.
|
// Search each library going through libraries alphabetically.
|
||||||
for( unsigned i = 0; i < nicks.size(); ++i )
|
for( const wxString& library : GetLogicalLibs() )
|
||||||
{
|
{
|
||||||
// DesignBlockLoad() returns NULL on not found, does not throw exception
|
// DesignBlockLoad() returns NULL on not found, does not throw exception
|
||||||
// unless there's an IO_ERROR.
|
// unless there's an IO_ERROR.
|
||||||
DESIGN_BLOCK* ret = DesignBlockLoad( nicks[i], DesignBlockname, aKeepUUID );
|
DESIGN_BLOCK* ret = DesignBlockLoad( library, DesignBlockname, aKeepUUID );
|
||||||
|
|
||||||
if( ret )
|
if( ret )
|
||||||
return ret;
|
return ret;
|
||||||
@ -520,7 +521,8 @@ public:
|
|||||||
explicit PCM_DESIGN_BLOCK_LIB_TRAVERSER( const wxString& aPath, DESIGN_BLOCK_LIB_TABLE& aTable,
|
explicit PCM_DESIGN_BLOCK_LIB_TRAVERSER( const wxString& aPath, DESIGN_BLOCK_LIB_TABLE& aTable,
|
||||||
const wxString& aPrefix ) :
|
const wxString& aPrefix ) :
|
||||||
m_lib_table( aTable ),
|
m_lib_table( aTable ),
|
||||||
m_path_prefix( aPath ), m_lib_prefix( aPrefix )
|
m_path_prefix( aPath ),
|
||||||
|
m_lib_prefix( aPrefix )
|
||||||
{
|
{
|
||||||
wxFileName f( aPath, wxS( "" ) );
|
wxFileName f( aPath, wxS( "" ) );
|
||||||
m_prefix_dir_count = f.GetDirCount();
|
m_prefix_dir_count = f.GetDirCount();
|
||||||
@ -539,8 +541,9 @@ public:
|
|||||||
FILEEXT::KiCadDesignBlockLibPathExtension ) )
|
FILEEXT::KiCadDesignBlockLibPathExtension ) )
|
||||||
&& dir.GetDirCount() >= m_prefix_dir_count + 3 )
|
&& dir.GetDirCount() >= m_prefix_dir_count + 3 )
|
||||||
{
|
{
|
||||||
wxString versionedPath = wxString::Format(
|
wxString versionedPath;
|
||||||
wxS( "${%s}" ), ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ) );
|
versionedPath.Printf( wxS( "${%s}" ),
|
||||||
|
ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ) );
|
||||||
|
|
||||||
wxArrayString parts = dir.GetDirs();
|
wxArrayString parts = dir.GetDirs();
|
||||||
parts.RemoveAt( 0, m_prefix_dir_count );
|
parts.RemoveAt( 0, m_prefix_dir_count );
|
||||||
@ -551,16 +554,21 @@ public:
|
|||||||
if( !m_lib_table.HasLibraryWithPath( libPath ) )
|
if( !m_lib_table.HasLibraryWithPath( libPath ) )
|
||||||
{
|
{
|
||||||
wxString name = parts.Last().substr( 0, parts.Last().length() - 7 );
|
wxString name = parts.Last().substr( 0, parts.Last().length() - 7 );
|
||||||
wxString nickname = wxString::Format( wxS( "%s%s" ), m_lib_prefix, name );
|
wxString nickname;
|
||||||
|
nickname.Printf( wxS( "%s%s" ),
|
||||||
|
m_lib_prefix,
|
||||||
|
name );
|
||||||
|
|
||||||
if( m_lib_table.HasLibrary( nickname ) )
|
if( m_lib_table.HasLibrary( nickname ) )
|
||||||
{
|
{
|
||||||
int increment = 1;
|
int increment = 1;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
nickname =
|
nickname.Printf( wxS( "%s%s_%d" ),
|
||||||
wxString::Format( wxS( "%s%s_%d" ), m_lib_prefix, name, increment );
|
m_lib_prefix,
|
||||||
increment++;
|
name,
|
||||||
|
increment++ );
|
||||||
} while( m_lib_table.HasLibrary( nickname ) );
|
} while( m_lib_table.HasLibrary( nickname ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,8 +611,8 @@ bool DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable( DESIGN_BLOCK_LIB_TABLE& aTable )
|
|||||||
SystemDirsAppend( &ss );
|
SystemDirsAppend( &ss );
|
||||||
|
|
||||||
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
|
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
|
||||||
std::optional<wxString> v =
|
std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( envVars,
|
||||||
ENV_VAR::GetVersionedEnvVarValue( envVars, wxT( "TEMPLATE_DIR" ) );
|
wxT( "TEMPLATE_DIR" ) );
|
||||||
|
|
||||||
if( v && !v->IsEmpty() )
|
if( v && !v->IsEmpty() )
|
||||||
ss.AddPaths( *v, 0 );
|
ss.AddPaths( *v, 0 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user