From d8fa37d5c28eafdc20f2e715a65c3d42c32a7532 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 2 Dec 2020 13:08:25 +0000 Subject: [PATCH] Remove old root-schematic hacks. They don't work anymore anyway. Fixes https://gitlab.com/kicad/code/kicad/issues/6583 --- .../sch_plugins/kicad/sch_sexpr_plugin.cpp | 10 --- kicad/project_tree_pane.cpp | 70 ------------------- 2 files changed, 80 deletions(-) diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp index bb0c89ebd4..a038281153 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp @@ -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( 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 ); diff --git a/kicad/project_tree_pane.cpp b/kicad/project_tree_pane.cpp index a0c3752340..3b1a18d2f9 100644 --- a/kicad/project_tree_pane.cpp +++ b/kicad/project_tree_pane.cpp @@ -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( TREE_FILE_TYPE::LEGACY_PROJECT ); i < static_cast( TREE_FILE_TYPE::MAX ); i++ ) {