Remove old root-schematic hacks. They don't work anymore anyway.
Fixes https://gitlab.com/kicad/code/kicad/issues/6583
This commit is contained in:
parent
4a0543c099
commit
d8fa37d5c2
|
@ -587,16 +587,6 @@ void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
|
|||
m_out->Print( 0, "(kicad_sch (version %d) (generator eeschema)\n\n",
|
||||
SEXPR_SCHEMATIC_FILE_VERSION );
|
||||
|
||||
// Root sheet must have a permanent UUID.
|
||||
// if( aSheet->IsRootSheet() && aSheet->m_Uuid.IsLegacyTimestamp() )
|
||||
// const_cast<KIID&>( aSheet->m_Uuid ).ConvertTimestampToUuid();
|
||||
|
||||
// m_out->Print( 1, "(uuid %s)\n\n", m_out->Quotew( aSheet->m_Uuid.AsString() ).c_str() );
|
||||
|
||||
m_out->Print( 1, "(page %d %d)\n\n",
|
||||
screen->GetVirtualPageNumber(),
|
||||
screen->GetPageCount() );
|
||||
|
||||
screen->GetPageSettings().Format( m_out, 1, 0 );
|
||||
m_out->Print( 0, "\n" );
|
||||
screen->GetTitleBlock().Format( m_out, 1, 0 );
|
||||
|
|
|
@ -329,76 +329,6 @@ wxTreeItemId PROJECT_TREE_PANE::AddItemToProjectTree( const wxString& aName, wxT
|
|||
if( !addFile )
|
||||
return newItemId;
|
||||
|
||||
// only show the schematic if it is a top level schematic. Eeschema
|
||||
// cannot open a schematic and display it properly unless it starts
|
||||
// at the top of the hierarchy. The schematic is top level only if
|
||||
// there is a line in the header saying:
|
||||
// "Sheet 1 "
|
||||
// However if the file has the same name as the project, it is always
|
||||
// shown, because it is expected the root sheet.
|
||||
// (and to fix an issue (under XP but could exist under other OS),
|
||||
// when a .sch file is created, the file
|
||||
// create is sent to the wxFileSystemWatcher, but the file still has 0 byte
|
||||
// so it cannot detected as root sheet
|
||||
// This is an ugly fix.
|
||||
if( fn.GetExt() == "sch" || fn.GetExt() == "kicad_sch" )
|
||||
{
|
||||
wxString fullFileName = aName.BeforeLast( '.' );
|
||||
wxString rootName;
|
||||
PROJECT_TREE_ITEM* itemData = GetItemIdData( m_root );
|
||||
|
||||
if( itemData )
|
||||
rootName = itemData->GetFileName().BeforeLast( '.' );
|
||||
|
||||
if( fullFileName != rootName )
|
||||
{
|
||||
char line[128]; // small because we just need a few bytes from the start of a line
|
||||
FILE* fp;
|
||||
|
||||
fullFileName = aName;
|
||||
fp = wxFopen( fullFileName, wxT( "rt" ) );
|
||||
|
||||
if( fp == NULL )
|
||||
return newItemId;
|
||||
|
||||
addFile = false;
|
||||
|
||||
// check the first 100 lines for the "Sheet 1" or "(page 1" string
|
||||
for( int i = 0; i<100; ++i )
|
||||
{
|
||||
if( !fgets( line, sizeof(line), fp ) )
|
||||
break;
|
||||
|
||||
if( fn.GetExt() == "sch" )
|
||||
{
|
||||
if( strncmp( line, "Sheet 1 ", 8 ) == 0 )
|
||||
{
|
||||
addFile = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( fn.GetExt() == "kicad_sch" )
|
||||
{
|
||||
char* start = line;
|
||||
|
||||
while( *start == ' ' )
|
||||
start++;
|
||||
|
||||
if( strncmp( start, "(page 1 ", 8 ) == 0 )
|
||||
{
|
||||
addFile = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose( fp );
|
||||
|
||||
if( !addFile )
|
||||
return newItemId; // it is a non-top-level schematic
|
||||
}
|
||||
}
|
||||
|
||||
for( int i = static_cast<int>( TREE_FILE_TYPE::LEGACY_PROJECT );
|
||||
i < static_cast<int>( TREE_FILE_TYPE::MAX ); i++ )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue