Commit 9689f496 authored by dickelbeck's avatar dickelbeck
Browse files

New format top level schematic files were not detected if they had a...

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.

parent 29f5fbb7
Loading
Loading
Loading
Loading
+22 −13
Original line number Diff line number Diff line
@@ -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 );
        }
    }