New format top level schematic files were not detected if they had a significant number of libraries.

The "Sheet 1" string can now be further down in the file than the original 20 line search could detect.
This commit is contained in:
dickelbeck 2009-10-26 21:25:23 +00:00
parent 29f5fbb7ad
commit 9689f496ee
1 changed files with 22 additions and 13 deletions

View File

@ -15,6 +15,7 @@
#include "gestfich.h"
#include "appl_wxstruct.h"
#include "bitmaps.h"
#include "macros.h"
#include "kicad.h"
@ -306,10 +307,13 @@ void WinEDA_PrjFrame::OnDragEnd( wxTreeEvent& event )
wxTreeItemId moved = m_TreeProject->GetSelection();
TreePrjItemData* source_data = GetSelectedData();
wxTreeItemId dest = event.GetItem();
if( !dest.IsOk() )
return; // Cancelled ...
TreePrjItemData* destData =
dynamic_cast<TreePrjItemData*>( m_TreeProject->GetItemData( dest ) );
if( !destData )
return;
@ -325,6 +329,7 @@ void WinEDA_PrjFrame::OnDragEnd( wxTreeEvent& event )
// Select the right destData:
destData =
dynamic_cast<TreePrjItemData*>( m_TreeProject->GetItemData( dest ) );
if( !destData )
return;
}
@ -737,6 +742,7 @@ bool WinEDA_PrjFrame::AddFile( const wxString& name, wxTreeItemId& root )
addFile = true;
if( i==0 )
isSchematic = true;
break;
}
}
@ -762,7 +768,9 @@ bool WinEDA_PrjFrame::AddFile( const wxString& name, wxTreeItemId& root )
}
addFile = false;
for( int i = 0; i<20; ++i )
// check the first 100 lines for the "Sheet 1" string
for( int i = 0; i<100; ++i )
{
if( !fgets( line, sizeof(line), fp ) )
break;
@ -932,6 +940,7 @@ void WinEDA_PrjFrame::ReCreateTreePrj()
if( filename != fn.GetFullName() )
AddFile( dir.GetName() + wxFileName::GetPathSeparator() +
filename, m_root );
cont = dir.GetNext( &filename );
}
}