2011-10-15 13:25:57 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file sch_sheet_path.cpp
|
|
|
|
* @brief SCH_SHEET_PATH class implementation.
|
|
|
|
*/
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <general.h>
|
|
|
|
#include <dlist.h>
|
|
|
|
#include <class_sch_screen.h>
|
|
|
|
#include <sch_item_struct.h>
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2015-02-21 08:11:58 +00:00
|
|
|
#include <sch_reference_list.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_library.h>
|
|
|
|
#include <sch_sheet.h>
|
|
|
|
#include <sch_sheet_path.h>
|
|
|
|
#include <sch_component.h>
|
|
|
|
#include <template_fieldnames.h>
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialogs/dialog_schematic_find.h>
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2015-03-23 11:45:31 +00:00
|
|
|
#include <boost/foreach.hpp>
|
2015-06-07 20:31:55 +00:00
|
|
|
#include <wx/filename.h>
|
2015-03-23 11:45:31 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH::SCH_SHEET_PATH()
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2011-01-23 21:22:42 +00:00
|
|
|
for( int i = 0; i<DSLSZ; i++ )
|
|
|
|
m_sheets[i] = NULL;
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2011-01-23 21:22:42 +00:00
|
|
|
m_numSheets = 0;
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
bool SCH_SHEET_PATH::BuildSheetPathInfoFromSheetPathValue( const wxString& aPath, bool aFound )
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
if( aFound )
|
2009-01-07 20:09:03 +00:00
|
|
|
return true;
|
|
|
|
|
2015-06-07 20:31:55 +00:00
|
|
|
if( GetCount() == 0 )
|
2009-01-07 20:09:03 +00:00
|
|
|
Push( g_RootSheet );
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
if( aPath == Path() )
|
2009-01-07 20:09:03 +00:00
|
|
|
return true;
|
|
|
|
|
2011-01-23 21:22:42 +00:00
|
|
|
SCH_ITEM* schitem = LastDrawList();
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2015-06-07 20:31:55 +00:00
|
|
|
while( schitem && GetCount() < NB_MAX_SHEET )
|
2009-01-07 20:09:03 +00:00
|
|
|
{
|
2011-01-23 21:22:42 +00:00
|
|
|
if( schitem->Type() == SCH_SHEET_T )
|
2009-01-07 20:09:03 +00:00
|
|
|
{
|
2011-01-23 21:22:42 +00:00
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) schitem;
|
2009-01-07 20:09:03 +00:00
|
|
|
Push( sheet );
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
if( aPath == Path() )
|
2009-01-07 20:09:03 +00:00
|
|
|
return true;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
if( BuildSheetPathInfoFromSheetPathValue( aPath ) )
|
2009-01-07 20:09:03 +00:00
|
|
|
return true;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-01-07 20:09:03 +00:00
|
|
|
Pop();
|
|
|
|
}
|
2011-12-01 16:49:28 +00:00
|
|
|
|
2011-01-23 21:22:42 +00:00
|
|
|
schitem = schitem->Next();
|
2009-01-07 20:09:03 +00:00
|
|
|
}
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2009-01-07 20:09:03 +00:00
|
|
|
return false;
|
|
|
|
}
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
int SCH_SHEET_PATH::Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2011-01-23 21:22:42 +00:00
|
|
|
if( m_numSheets > aSheetPathToTest.m_numSheets )
|
2009-01-04 18:52:57 +00:00
|
|
|
return 1;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2011-01-23 21:22:42 +00:00
|
|
|
if( m_numSheets < aSheetPathToTest.m_numSheets )
|
2009-01-04 18:52:57 +00:00
|
|
|
return -1;
|
|
|
|
|
2011-01-23 21:22:42 +00:00
|
|
|
//otherwise, same number of sheets.
|
|
|
|
for( unsigned i = 0; i<m_numSheets; i++ )
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2011-12-12 08:37:05 +00:00
|
|
|
if( m_sheets[i]->GetTimeStamp() > aSheetPathToTest.m_sheets[i]->GetTimeStamp() )
|
2009-01-04 18:52:57 +00:00
|
|
|
return 1;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2011-12-12 08:37:05 +00:00
|
|
|
if( m_sheets[i]->GetTimeStamp() < aSheetPathToTest.m_sheets[i]->GetTimeStamp() )
|
2009-01-04 18:52:57 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
SCH_SHEET* SCH_SHEET_PATH::Last() const
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2011-01-23 21:22:42 +00:00
|
|
|
if( m_numSheets )
|
|
|
|
return m_sheets[m_numSheets - 1];
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
SCH_SCREEN* SCH_SHEET_PATH::LastScreen() const
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2010-04-01 13:15:48 +00:00
|
|
|
SCH_SHEET* lastSheet = Last();
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2010-04-01 13:15:48 +00:00
|
|
|
if( lastSheet )
|
2011-01-20 16:34:57 +00:00
|
|
|
return lastSheet->GetScreen();
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
SCH_ITEM* SCH_SHEET_PATH::LastDrawList() const
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2011-01-23 21:22:42 +00:00
|
|
|
SCH_SHEET* lastSheet = Last();
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-01-23 21:22:42 +00:00
|
|
|
if( lastSheet && lastSheet->GetScreen() )
|
|
|
|
return lastSheet->GetScreen()->GetDrawItems();
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
SCH_ITEM* SCH_SHEET_PATH::FirstDrawList() const
|
2010-03-16 18:22:59 +00:00
|
|
|
{
|
|
|
|
SCH_ITEM* item = NULL;
|
|
|
|
|
2011-01-23 21:22:42 +00:00
|
|
|
if( m_numSheets && m_sheets[0]->GetScreen() )
|
|
|
|
item = m_sheets[0]->GetScreen()->GetDrawItems();
|
|
|
|
|
|
|
|
/* @fixme - These lists really should be one of the boost pointer containers. This
|
|
|
|
* is a brain dead hack to allow reverse iteration of EDA_ITEM linked
|
|
|
|
* list.
|
|
|
|
*/
|
|
|
|
SCH_ITEM* lastItem = NULL;
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
while( item )
|
2011-01-23 21:22:42 +00:00
|
|
|
{
|
|
|
|
lastItem = item;
|
|
|
|
item = item->Next();
|
|
|
|
}
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2011-01-23 21:22:42 +00:00
|
|
|
return lastItem;
|
2010-03-16 18:22:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
void SCH_SHEET_PATH::Push( SCH_SHEET* aSheet )
|
|
|
|
{
|
2011-03-29 19:33:07 +00:00
|
|
|
wxCHECK_RET( m_numSheets < DSLSZ,
|
|
|
|
wxString::Format( _( "Schematic sheets can only be nested %d levels deep." ),
|
|
|
|
DSLSZ ) );
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2011-03-29 19:33:07 +00:00
|
|
|
m_sheets[ m_numSheets ] = aSheet;
|
|
|
|
m_numSheets++;
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET* SCH_SHEET_PATH::Pop()
|
|
|
|
{
|
2011-01-23 21:22:42 +00:00
|
|
|
if( m_numSheets > 0 )
|
|
|
|
{
|
|
|
|
m_numSheets--;
|
|
|
|
return m_sheets[m_numSheets];
|
|
|
|
}
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2011-01-23 21:22:42 +00:00
|
|
|
return NULL;
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-17 01:06:08 +00:00
|
|
|
wxString SCH_SHEET_PATH::Path() const
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2009-01-04 18:52:57 +00:00
|
|
|
wxString s, t;
|
|
|
|
|
2009-01-06 20:09:32 +00:00
|
|
|
s = wxT( "/" ); // This is the root path
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
// start at 1 to avoid the root sheet,
|
|
|
|
// which does not need to be added to the path
|
|
|
|
// it's timestamp changes anyway.
|
2011-01-23 21:22:42 +00:00
|
|
|
for( unsigned i = 1; i < m_numSheets; i++ )
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2015-04-23 19:43:45 +00:00
|
|
|
t.Printf( _( "%8.8lX/" ), (long unsigned) m_sheets[i]->GetTimeStamp() );
|
2009-01-04 18:52:57 +00:00
|
|
|
s = s + t;
|
|
|
|
}
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-03 02:13:33 +00:00
|
|
|
wxString SCH_SHEET_PATH::PathHumanReadable() const
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2015-11-03 19:44:05 +00:00
|
|
|
wxString s;
|
2009-01-04 18:52:57 +00:00
|
|
|
|
|
|
|
s = wxT( "/" );
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
// start at 1 to avoid the root sheet, as above.
|
2011-01-23 21:22:42 +00:00
|
|
|
for( unsigned i = 1; i< m_numSheets; i++ )
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2011-12-08 15:45:01 +00:00
|
|
|
s = s + m_sheets[i]->GetName() + wxT( "/" );
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
|
2010-03-16 18:22:59 +00:00
|
|
|
{
|
|
|
|
bool hasWrapped = false;
|
|
|
|
bool firstItemFound = false;
|
|
|
|
SCH_ITEM* drawItem = FirstDrawList();
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
while( drawItem )
|
2010-03-16 18:22:59 +00:00
|
|
|
{
|
|
|
|
if( drawItem->Type() == aType )
|
|
|
|
{
|
|
|
|
if( aLastItem == NULL || firstItemFound )
|
|
|
|
{
|
|
|
|
return drawItem;
|
|
|
|
}
|
|
|
|
else if( !firstItemFound && drawItem == aLastItem )
|
|
|
|
{
|
|
|
|
firstItemFound = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
drawItem = drawItem->Back();
|
|
|
|
|
|
|
|
if( drawItem == NULL && aLastItem && aWrap && !hasWrapped )
|
|
|
|
{
|
|
|
|
hasWrapped = true;
|
|
|
|
drawItem = FirstDrawList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-30 22:22:38 +00:00
|
|
|
SCH_SHEET_PATH& SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 )
|
2011-01-23 21:22:42 +00:00
|
|
|
{
|
2011-01-30 22:22:38 +00:00
|
|
|
if( this == &d1 ) // Self assignment is bad!
|
|
|
|
return *this;
|
|
|
|
|
2011-01-23 21:22:42 +00:00
|
|
|
m_numSheets = d1.m_numSheets;
|
|
|
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
for( i = 0; i < m_numSheets; i++ )
|
|
|
|
m_sheets[i] = d1.m_sheets[i];
|
|
|
|
|
|
|
|
for( ; i < DSLSZ; i++ )
|
|
|
|
m_sheets[i] = 0;
|
|
|
|
|
2011-01-30 22:22:38 +00:00
|
|
|
return *this;
|
2011-01-23 21:22:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-03 02:13:33 +00:00
|
|
|
bool SCH_SHEET_PATH::operator==( const SCH_SHEET_PATH& d1 ) const
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2011-01-23 21:22:42 +00:00
|
|
|
if( m_numSheets != d1.m_numSheets )
|
2009-01-04 18:52:57 +00:00
|
|
|
return false;
|
2010-08-03 02:13:33 +00:00
|
|
|
|
2011-01-23 21:22:42 +00:00
|
|
|
for( unsigned i = 0; i < m_numSheets; i++ )
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2011-01-23 21:22:42 +00:00
|
|
|
if( m_sheets[i] != d1.m_sheets[i] )
|
2009-01-04 18:52:57 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-07 20:31:55 +00:00
|
|
|
bool SCH_SHEET_PATH::TestForRecursion( const wxString& aSrcFileName,
|
|
|
|
const wxString& aDestFileName ) const
|
|
|
|
{
|
|
|
|
wxFileName rootFn = g_RootSheet->GetFileName();
|
|
|
|
wxFileName srcFn = aSrcFileName;
|
|
|
|
wxFileName destFn = aDestFileName;
|
|
|
|
|
|
|
|
if( srcFn.IsRelative() )
|
|
|
|
srcFn.MakeAbsolute( rootFn.GetPath() );
|
|
|
|
|
|
|
|
if( destFn.IsRelative() )
|
|
|
|
destFn.MakeAbsolute( rootFn.GetPath() );
|
|
|
|
|
|
|
|
|
|
|
|
// The source and destination sheet file names cannot be the same.
|
|
|
|
if( srcFn == destFn )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/// @todo Store sheet file names with full path, either relative to project path
|
|
|
|
/// or absolute path. The current design always assumes subsheet files are
|
|
|
|
/// located in the project folder which may or may not be desirable.
|
|
|
|
unsigned i = 0;
|
|
|
|
|
|
|
|
while( i < m_numSheets )
|
|
|
|
{
|
|
|
|
wxFileName cmpFn = m_sheets[i]->GetFileName();
|
|
|
|
|
|
|
|
if( cmpFn.IsRelative() )
|
|
|
|
cmpFn.MakeAbsolute( rootFn.GetPath() );
|
|
|
|
|
|
|
|
// Test if the file name of the destination sheet is in anywhere in this sheet path.
|
|
|
|
if( cmpFn == destFn )
|
|
|
|
break;
|
|
|
|
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The destination sheet file name was not found in the sheet path or the destination
|
|
|
|
// sheet file name is the root sheet so no recursion is possible.
|
|
|
|
if( i >= m_numSheets || i == 0 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// Walk back up to the root sheet to see if the source file name is already a parent in
|
|
|
|
// the sheet path. If so, recursion will occur.
|
|
|
|
do
|
|
|
|
{
|
|
|
|
i -= 1;
|
|
|
|
|
|
|
|
wxFileName cmpFn = m_sheets[i]->GetFileName();
|
|
|
|
|
|
|
|
if( cmpFn.IsRelative() )
|
|
|
|
cmpFn.MakeAbsolute( rootFn.GetPath() );
|
|
|
|
|
|
|
|
if( cmpFn == srcFn )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} while( i != 0 );
|
|
|
|
|
|
|
|
// The source sheet file name is not a parent of the destination sheet file name.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int SCH_SHEET_PATH::FindSheet( const wxString& aFileName ) const
|
|
|
|
{
|
|
|
|
for( unsigned i = 0; i < m_numSheets; i++ )
|
|
|
|
{
|
|
|
|
if( m_sheets[i]->GetFileName().CmpNoCase( aFileName ) == 0 )
|
|
|
|
return (int)i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return SHEET_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SCH_SHEET* SCH_SHEET_PATH::FindSheetByName( const wxString& aSheetName )
|
|
|
|
{
|
|
|
|
for( unsigned i = 0; i < m_numSheets; i++ )
|
|
|
|
{
|
|
|
|
if( m_sheets[i]->GetName().CmpNoCase( aSheetName ) == 0 )
|
|
|
|
return m_sheets[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-29 19:33:07 +00:00
|
|
|
/********************************************************************/
|
2009-12-02 21:44:03 +00:00
|
|
|
/* Class SCH_SHEET_LIST to handle the list of Sheets in a hierarchy */
|
2011-03-29 19:33:07 +00:00
|
|
|
/********************************************************************/
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_LIST::SCH_SHEET_LIST( SCH_SHEET* aSheet )
|
|
|
|
{
|
2009-01-06 20:09:32 +00:00
|
|
|
m_index = 0;
|
|
|
|
m_count = 0;
|
2015-06-07 20:31:55 +00:00
|
|
|
m_list = NULL;
|
2013-10-27 18:21:53 +00:00
|
|
|
m_isRootSheet = false;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-01-06 20:09:32 +00:00
|
|
|
if( aSheet == NULL )
|
|
|
|
aSheet = g_RootSheet;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-01-06 20:09:32 +00:00
|
|
|
BuildSheetList( aSheet );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH* SCH_SHEET_LIST::GetFirst()
|
|
|
|
{
|
2009-01-04 18:52:57 +00:00
|
|
|
m_index = 0;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-01-06 20:09:32 +00:00
|
|
|
if( GetCount() > 0 )
|
2015-06-07 20:31:55 +00:00
|
|
|
return &( m_list[0] );
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH* SCH_SHEET_LIST::GetNext()
|
|
|
|
{
|
2009-01-06 20:09:32 +00:00
|
|
|
if( m_index < GetCount() )
|
2009-01-04 18:52:57 +00:00
|
|
|
m_index++;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
return GetSheet( m_index );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
SCH_SHEET_PATH* SCH_SHEET_LIST::GetLast()
|
|
|
|
{
|
|
|
|
if( GetCount() == 0 )
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
m_index = GetCount() - 1;
|
|
|
|
|
|
|
|
return GetSheet( m_index );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SCH_SHEET_PATH* SCH_SHEET_LIST::GetPrevious()
|
|
|
|
{
|
|
|
|
if( m_index == 0 )
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
m_index -= 1;
|
|
|
|
|
|
|
|
return GetSheet( m_index );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-07 20:31:55 +00:00
|
|
|
SCH_SHEET_PATH* SCH_SHEET_LIST::GetSheet( int aIndex ) const
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2009-01-06 20:09:32 +00:00
|
|
|
if( aIndex < GetCount() )
|
2015-06-07 20:31:55 +00:00
|
|
|
return &( m_list[aIndex] );
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-08 14:37:45 +00:00
|
|
|
SCH_SHEET_PATH* SCH_SHEET_LIST::GetSheetByPath( const wxString aPath, bool aHumanReadable )
|
2011-11-17 01:06:08 +00:00
|
|
|
{
|
|
|
|
SCH_SHEET_PATH* sheet = GetFirst();
|
|
|
|
wxString sheetPath;
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
while( sheet )
|
2011-11-17 01:06:08 +00:00
|
|
|
{
|
|
|
|
sheetPath = ( aHumanReadable ) ? sheet->PathHumanReadable() : sheet->Path();
|
|
|
|
|
|
|
|
if( sheetPath == aPath )
|
|
|
|
return sheet;
|
|
|
|
|
|
|
|
sheet = GetNext();
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
|
|
|
|
{
|
2014-08-23 15:22:50 +00:00
|
|
|
wxCHECK_RET( aSheet != NULL, wxT( "Cannot build sheet list from undefined sheet." ) );
|
|
|
|
|
2013-10-27 18:21:53 +00:00
|
|
|
if( aSheet == g_RootSheet )
|
|
|
|
m_isRootSheet = true;
|
|
|
|
|
2015-06-07 20:31:55 +00:00
|
|
|
if( m_list == NULL )
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2009-01-06 20:09:32 +00:00
|
|
|
int count = aSheet->CountSheets();
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
m_count = count;
|
|
|
|
m_index = 0;
|
2015-06-07 20:31:55 +00:00
|
|
|
m_list = new SCH_SHEET_PATH[ count ];
|
2009-01-04 18:52:57 +00:00
|
|
|
m_currList.Clear();
|
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2009-01-06 20:09:32 +00:00
|
|
|
m_currList.Push( aSheet );
|
2015-06-07 20:31:55 +00:00
|
|
|
m_list[m_index] = m_currList;
|
2009-01-04 18:52:57 +00:00
|
|
|
m_index++;
|
2009-12-02 21:44:03 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( aSheet->GetScreen() )
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2010-12-08 20:12:46 +00:00
|
|
|
EDA_ITEM* strct = m_currList.LastDrawList();
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
while( strct )
|
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
if( strct->Type() == SCH_SHEET_T )
|
2009-01-04 18:52:57 +00:00
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) strct;
|
2009-01-06 20:09:32 +00:00
|
|
|
BuildSheetList( sheet );
|
2009-01-04 18:52:57 +00:00
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
strct = strct->Next();
|
|
|
|
}
|
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
m_currList.Pop();
|
|
|
|
}
|
2010-03-16 18:22:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
SCH_ITEM* SCH_SHEET_LIST::FindNextItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFoundIn,
|
|
|
|
SCH_ITEM* aLastItem, bool aWrap )
|
|
|
|
{
|
|
|
|
bool hasWrapped = false;
|
|
|
|
bool firstItemFound = false;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
|
|
|
SCH_ITEM* drawItem = NULL;
|
2010-03-16 18:22:59 +00:00
|
|
|
SCH_SHEET_PATH* sheet = GetFirst();
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
while( sheet )
|
2010-03-16 18:22:59 +00:00
|
|
|
{
|
|
|
|
drawItem = sheet->LastDrawList();
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
while( drawItem )
|
2010-03-16 18:22:59 +00:00
|
|
|
{
|
|
|
|
if( drawItem->Type() == aType )
|
|
|
|
{
|
|
|
|
if( aLastItem == NULL || firstItemFound )
|
|
|
|
{
|
|
|
|
if( aSheetFoundIn )
|
|
|
|
*aSheetFoundIn = sheet;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
return drawItem;
|
|
|
|
}
|
|
|
|
else if( !firstItemFound && drawItem == aLastItem )
|
|
|
|
{
|
|
|
|
firstItemFound = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
drawItem = drawItem->Next();
|
|
|
|
}
|
|
|
|
|
|
|
|
sheet = GetNext();
|
|
|
|
|
|
|
|
if( sheet == NULL && aLastItem && aWrap && !hasWrapped )
|
|
|
|
{
|
|
|
|
hasWrapped = true;
|
|
|
|
sheet = GetFirst();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SCH_ITEM* SCH_SHEET_LIST::FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFoundIn,
|
|
|
|
SCH_ITEM* aLastItem, bool aWrap )
|
|
|
|
{
|
|
|
|
bool hasWrapped = false;
|
|
|
|
bool firstItemFound = false;
|
|
|
|
SCH_ITEM* drawItem = NULL;
|
|
|
|
SCH_SHEET_PATH* sheet = GetLast();
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
while( sheet )
|
2010-03-16 18:22:59 +00:00
|
|
|
{
|
|
|
|
drawItem = sheet->FirstDrawList();
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
while( drawItem )
|
2010-03-16 18:22:59 +00:00
|
|
|
{
|
|
|
|
if( drawItem->Type() == aType )
|
|
|
|
{
|
|
|
|
if( aLastItem == NULL || firstItemFound )
|
|
|
|
{
|
|
|
|
if( aSheetFoundIn )
|
|
|
|
*aSheetFoundIn = sheet;
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
return drawItem;
|
|
|
|
}
|
|
|
|
else if( !firstItemFound && drawItem == aLastItem )
|
|
|
|
{
|
|
|
|
firstItemFound = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
drawItem = drawItem->Back();
|
|
|
|
}
|
|
|
|
|
|
|
|
sheet = GetPrevious();
|
|
|
|
|
|
|
|
if( sheet == NULL && aLastItem && aWrap && !hasWrapped )
|
|
|
|
{
|
|
|
|
hasWrapped = true;
|
|
|
|
sheet = GetLast();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-07 20:31:55 +00:00
|
|
|
bool SCH_SHEET_LIST::TestForRecursion( const SCH_SHEET_LIST& aSrcSheetHierarchy,
|
|
|
|
const wxString& aDestFileName ) const
|
|
|
|
{
|
|
|
|
wxFileName rootFn = g_RootSheet->GetFileName();
|
|
|
|
wxFileName destFn = aDestFileName;
|
|
|
|
|
|
|
|
if( destFn.IsRelative() )
|
|
|
|
destFn.MakeAbsolute( rootFn.GetPath() );
|
|
|
|
|
|
|
|
// Test each SCH_SHEET_PATH in this SCH_SHEET_LIST for potential recursion.
|
|
|
|
for( int i = 0; i < m_count; i++ )
|
|
|
|
{
|
|
|
|
// Test each SCH_SHEET_PATH in the source sheet.
|
|
|
|
for( int j = 0; j < aSrcSheetHierarchy.GetCount(); j++ )
|
|
|
|
{
|
|
|
|
SCH_SHEET_PATH* sheetPath = aSrcSheetHierarchy.GetSheet( j );
|
|
|
|
|
|
|
|
for( unsigned k = 0; k < sheetPath->GetCount(); k++ )
|
|
|
|
{
|
|
|
|
if( m_list[i].TestForRecursion( sheetPath->GetSheet( k )->GetFileName(),
|
|
|
|
aDestFileName ) )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// The source sheet file can safely be added to the destination sheet file.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SCH_SHEET* SCH_SHEET_LIST::FindSheetByName( const wxString& aSheetName )
|
|
|
|
{
|
|
|
|
for( int i = 0; i < m_count; i++ )
|
|
|
|
{
|
2015-12-27 12:16:46 +00:00
|
|
|
SCH_SHEET* sheet = m_list[i].FindSheetByName( aSheetName );
|
2015-06-07 20:31:55 +00:00
|
|
|
|
|
|
|
if( sheet )
|
|
|
|
return sheet;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|