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
|
2019-04-30 17:03:19 +00:00
|
|
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-15 13:25:57 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/**
|
2018-01-30 08:56:43 +00:00
|
|
|
* @file sch_screen.h
|
2011-09-30 18:15:37 +00:00
|
|
|
* @brief Definitions for the Eeschema program SCH_SCREEN class.
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-30 08:56:43 +00:00
|
|
|
#ifndef SCREEN_H
|
|
|
|
#define SCREEN_H
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
#include <unordered_set>
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <macros.h>
|
2012-02-26 18:39:39 +00:00
|
|
|
#include <dlist.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <sch_item_struct.h>
|
2017-12-18 05:21:00 +00:00
|
|
|
#include <lib_draw_item.h>
|
2018-01-29 10:37:29 +00:00
|
|
|
#include <base_screen.h>
|
|
|
|
#include <title_block.h>
|
|
|
|
#include <page_info.h>
|
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
|
|
|
#include <kiway_player.h>
|
2015-07-29 12:18:53 +00:00
|
|
|
#include <sch_marker.h>
|
2019-03-11 21:32:05 +00:00
|
|
|
#include <bus_alias.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <../eeschema/general.h>
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2010-10-26 20:25:48 +00:00
|
|
|
|
2010-12-13 15:59:00 +00:00
|
|
|
class LIB_PIN;
|
|
|
|
class SCH_COMPONENT;
|
2019-03-11 21:32:05 +00:00
|
|
|
class SCH_SHEET_LIST;
|
2010-12-31 19:47:39 +00:00
|
|
|
class SCH_SHEET_PATH;
|
2011-01-11 20:34:29 +00:00
|
|
|
class SCH_SHEET_PIN;
|
2011-03-10 19:36:30 +00:00
|
|
|
class SCH_LINE;
|
2011-03-25 19:16:05 +00:00
|
|
|
class SCH_TEXT;
|
2011-06-17 13:24:22 +00:00
|
|
|
class PLOTTER;
|
2018-09-03 10:11:39 +00:00
|
|
|
class SCH_SHEET_LIST;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
enum SCH_LINE_TEST_T
|
|
|
|
{
|
|
|
|
ENTIRE_LENGTH_T,
|
|
|
|
END_POINTS_ONLY_T,
|
|
|
|
EXCLUDE_END_POINTS_T
|
|
|
|
};
|
2011-01-11 20:34:29 +00:00
|
|
|
|
2010-12-13 15:59:00 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
/// Max number of sheets in a hierarchy project
|
|
|
|
#define NB_MAX_SHEET 500
|
2007-06-05 12:10:51 +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
|
|
|
class SCH_SCREEN : public BASE_SCREEN, public KIWAY_HOLDER
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-08-29 16:59:50 +00:00
|
|
|
private:
|
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
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
wxString m_fileName; ///< File used to load the screen.
|
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
int m_refCount; ///< Number of sheets referencing this screen.
|
|
|
|
///< Delete when it goes to zero.
|
|
|
|
|
2018-09-03 10:11:39 +00:00
|
|
|
/** the list of scheet paths sharing this screen
|
|
|
|
* used in some annotation calculations to update alternate references
|
|
|
|
* Note: a screen having a m_refCount = 1 (only one sheet path using it)
|
|
|
|
* can have many scheet paths sharing this screen, if this sheet is inside
|
|
|
|
* an other sheet having many instances (one sheet path by parent sheet instance).
|
|
|
|
*/
|
|
|
|
wxArrayString m_clientSheetPathList;
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
/// The size of the paper to print or plot on
|
2012-01-05 08:07:11 +00:00
|
|
|
PAGE_INFO m_paper; // keep with the MVC 'model' if this class gets split
|
|
|
|
|
2012-01-09 08:35:06 +00:00
|
|
|
TITLE_BLOCK m_titles;
|
|
|
|
|
2017-11-17 17:00:04 +00:00
|
|
|
/// Origin of the auxiliary axis, which is used in exports mostly, but not yet in EESCHEMA
|
2013-08-03 05:15:23 +00:00
|
|
|
wxPoint m_aux_origin;
|
2011-12-22 21:57:50 +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
|
|
|
DLIST< SCH_ITEM > m_drawList; ///< Object list for the screen.
|
|
|
|
|
|
|
|
int m_modification_sync; ///< inequality with PART_LIBS::GetModificationHash()
|
|
|
|
///< will trigger ResolveAll().
|
2011-01-12 21:47:54 +00:00
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
/// List of bus aliases stored in this screen
|
|
|
|
std::unordered_set< std::shared_ptr< BUS_ALIAS > > m_aliases;
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
public:
|
2011-12-31 05:44:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
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_SCREEN( KIWAY* aKiway );
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
~SCH_SCREEN();
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
DLIST< SCH_ITEM > & GetDrawList() { return m_drawList; }
|
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
virtual wxString GetClass() const override
|
2011-01-11 20:34:29 +00:00
|
|
|
{
|
|
|
|
return wxT( "SCH_SCREEN" );
|
|
|
|
}
|
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
const PAGE_INFO& GetPageSettings() const { return m_paper; }
|
|
|
|
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
|
2012-08-29 16:59:50 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
const wxString& GetFileName() const { return m_fileName; }
|
2012-08-29 16:59:50 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
const wxPoint& GetAuxOrigin() const { return m_aux_origin; }
|
|
|
|
void SetAuxOrigin( const wxPoint& aPosition ) { m_aux_origin = aPosition; }
|
2012-01-05 08:07:11 +00:00
|
|
|
|
2012-01-09 08:35:06 +00:00
|
|
|
const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
|
|
|
|
//TITLE_BLOCK& GetTitleBlock() const { return (TITLE_BLOCK&) m_titles; }
|
|
|
|
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
|
|
|
|
|
2011-01-12 21:47:54 +00:00
|
|
|
void DecRefCount();
|
|
|
|
|
2011-01-20 16:34:57 +00:00
|
|
|
void IncRefCount();
|
2011-01-12 21:47:54 +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
|
|
|
int GetRefCount() const { return m_refCount; }
|
2011-01-12 21:47:54 +00:00
|
|
|
|
2018-09-03 10:11:39 +00:00
|
|
|
/**
|
|
|
|
* @return the sheet paths count sharing this screen
|
|
|
|
* if 1 this screen is not in a complex hierarchy: the reference field can be
|
|
|
|
* used to store the component reference
|
|
|
|
* if > 1 this screen is in a complex hierarchy, and components must have
|
|
|
|
* a full alternate reference management
|
|
|
|
*/
|
|
|
|
int GetClientSheetPathsCount() { return (int) m_clientSheetPathList.GetCount(); }
|
|
|
|
|
|
|
|
wxArrayString& GetClientSheetPaths() { return m_clientSheetPathList; }
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* @return A pointer to the first item in the linked list of draw items.
|
2010-12-08 20:12:46 +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
|
|
|
SCH_ITEM* GetDrawItems() const { return m_drawList.begin(); }
|
2012-02-26 18:39:39 +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
|
|
|
void Append( SCH_ITEM* aItem )
|
|
|
|
{
|
|
|
|
m_drawList.Append( aItem );
|
|
|
|
--m_modification_sync;
|
|
|
|
}
|
2012-02-26 18:39:39 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Copy the contents of \a aScreen into this #SCH_SCREEN object.
|
|
|
|
*
|
|
|
|
* @warning The contents of \a Screen cannot contain any duplicate sheet names or any
|
|
|
|
* hierarchy recursion issues or bad things will happen.
|
|
|
|
*
|
|
|
|
* @param aScreen is the screen to append to this one.
|
|
|
|
* @return false if there are any duplicate sheet names or any hierarchy recursion issues the
|
|
|
|
* calling this method or KiCad will crash.
|
|
|
|
*/
|
|
|
|
void Append( SCH_SCREEN* aScreen );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add \a aList of SCH_ITEM objects to the list for draw items for the sheet.
|
2012-02-26 18:39:39 +00:00
|
|
|
*
|
|
|
|
* @param aList A reference to a #DLIST containing the #SCH_ITEM to add to the sheet.
|
|
|
|
*/
|
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
|
|
|
void Append( DLIST< SCH_ITEM >& aList )
|
|
|
|
{
|
|
|
|
m_drawList.Append( aList );
|
|
|
|
--m_modification_sync;
|
|
|
|
}
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
|
|
|
|
*
|
2008-04-17 16:25:29 +00:00
|
|
|
* @return SCH_ITEM* - the one selected, or NULL.
|
|
|
|
*/
|
2011-03-03 19:55:44 +00:00
|
|
|
SCH_ITEM* GetCurItem() const { return (SCH_ITEM*) BASE_SCREEN::GetCurItem(); }
|
2017-12-18 05:21:00 +00:00
|
|
|
LIB_ITEM* GetCurLibItem() const { return (LIB_ITEM*) BASE_SCREEN::GetCurItem(); }
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Sets the currently selected object, m_CurrentItem.
|
|
|
|
*
|
2010-12-14 15:56:30 +00:00
|
|
|
* @param aItem Any object derived from SCH_ITEM
|
2008-04-17 16:25:29 +00:00
|
|
|
*/
|
2011-03-03 19:55:44 +00:00
|
|
|
void SetCurItem( SCH_ITEM* aItem ) { BASE_SCREEN::SetCurItem( (EDA_ITEM*) aItem ); }
|
2017-12-18 05:21:00 +00:00
|
|
|
void SetCurLibItem( LIB_ITEM* aItem ) { BASE_SCREEN::SetCurItem( (EDA_ITEM*) aItem ); }
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2011-06-15 18:44:24 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Delete all draw items and clears the project settings.
|
2011-06-15 18:44:24 +00:00
|
|
|
*/
|
|
|
|
void Clear();
|
|
|
|
|
2010-10-26 20:25:48 +00:00
|
|
|
/**
|
|
|
|
* Free all the items from the schematic associated with the screen.
|
|
|
|
*
|
|
|
|
* This does not delete any sub hierarchies.
|
|
|
|
*/
|
2011-01-11 20:34:29 +00:00
|
|
|
void FreeDrawList();
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Check \a aPosition within a distance of \a aAccuracy for items of type \a aFilter.
|
|
|
|
*
|
2011-03-10 19:36:30 +00:00
|
|
|
* @param aPosition Position in drawing units.
|
|
|
|
* @param aAccuracy The maximum distance within \a Position to check for an item.
|
2011-03-25 19:16:05 +00:00
|
|
|
* @param aType The type of item to find or #NOT_USED to find any item type.
|
2011-03-10 19:36:30 +00:00
|
|
|
* @return The item found that meets the search criteria or NULL if none found.
|
|
|
|
*/
|
|
|
|
SCH_ITEM* GetItem( const wxPoint& aPosition, int aAccuracy = 0,
|
2011-03-25 19:16:05 +00:00
|
|
|
KICAD_T aType = NOT_USED ) const;
|
2011-03-10 19:36:30 +00:00
|
|
|
|
2011-01-11 20:34:29 +00:00
|
|
|
void Place( SCH_EDIT_FRAME* frame, wxDC* DC ) { };
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2014-08-18 16:39:51 +00:00
|
|
|
/**
|
2017-10-22 00:48:25 +00:00
|
|
|
* Initialize or reinitialize the weak reference to the #LIB_PART for each #SCH_COMPONENT
|
|
|
|
* found in m_drawList.
|
|
|
|
*
|
2015-04-03 20:38:24 +00:00
|
|
|
* It must be called from:
|
|
|
|
* - Draw function
|
|
|
|
* - when loading a schematic file
|
|
|
|
* - before creating a netlist (in case a library is modified)
|
2017-10-22 00:48:25 +00:00
|
|
|
* - whenever a symbol library is modified
|
2019-04-30 17:03:19 +00:00
|
|
|
* - whenever the symbol library table is modified.
|
2017-10-22 00:48:25 +00:00
|
|
|
*
|
|
|
|
* @param aForce true forces a refresh even if the library modification has hasn't changed.
|
2014-08-18 16:39:51 +00:00
|
|
|
*/
|
2017-10-22 00:48:25 +00:00
|
|
|
void UpdateSymbolLinks( bool aForce = false );
|
2014-08-18 16:39:51 +00:00
|
|
|
|
2011-01-11 20:34:29 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Draw all the items in the screen to \a aCanvas.
|
|
|
|
*
|
|
|
|
* @note This function is useful only for schematic. The library editor and library viewer
|
|
|
|
* do not use a draw list and therefore draws nothing.
|
|
|
|
*
|
2011-01-11 20:34:29 +00:00
|
|
|
* @param aCanvas The canvas item to draw on.
|
|
|
|
* @param aDC The device context to draw on.
|
|
|
|
*/
|
2019-04-04 22:49:49 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2011-06-17 13:24:22 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Plot all the schematic objects to \a aPlotter.
|
|
|
|
*
|
|
|
|
* @note This function is useful only for schematic. The library editor and library viewer
|
|
|
|
* do not use a draw list and therefore plots nothing.
|
2011-06-17 13:24:22 +00:00
|
|
|
*
|
|
|
|
* @param aPlotter The plotter object to plot to.
|
|
|
|
*/
|
|
|
|
void Plot( PLOTTER* aPlotter );
|
|
|
|
|
2010-10-26 20:25:48 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Remove \a aItem from the schematic associated with this screen.
|
2010-10-26 20:25:48 +00:00
|
|
|
*
|
2012-02-26 18:39:39 +00:00
|
|
|
* @note The removed item is not deleted. It is only unlinked from the item list.
|
|
|
|
* @param aItem Item to be removed from schematic.
|
2010-10-26 20:25:48 +00:00
|
|
|
*/
|
2012-02-26 18:39:39 +00:00
|
|
|
void Remove( SCH_ITEM* aItem );
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Removes \a aItem from the linked list and deletes the object.
|
|
|
|
*
|
|
|
|
* If \a aItem is a schematic sheet label, it is removed from the screen associated with
|
|
|
|
* the sheet that contains the label to be deleted.
|
|
|
|
*
|
2011-03-10 19:36:30 +00:00
|
|
|
* @param aItem The schematic object to be deleted from the screen.
|
|
|
|
*/
|
|
|
|
void DeleteItem( SCH_ITEM* aItem );
|
|
|
|
|
2011-01-11 20:34:29 +00:00
|
|
|
bool CheckIfOnDrawList( SCH_ITEM* st );
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Test all of the connectable objects in the schematic for unused connection points.
|
2016-02-19 15:41:32 +00:00
|
|
|
* @return True if any connection state changes were made.
|
2011-01-21 19:30:59 +00:00
|
|
|
*/
|
2016-02-19 15:41:32 +00:00
|
|
|
bool TestDanglingEnds();
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Replace all of the wires, buses, and junctions in the screen with \a aWireList.
|
2012-02-26 18:39:39 +00:00
|
|
|
*
|
|
|
|
* @param aWireList List of wires to replace the existing wires with.
|
2011-02-05 02:21:11 +00:00
|
|
|
*/
|
2012-02-26 18:39:39 +00:00
|
|
|
void ReplaceWires( DLIST< SCH_ITEM >& aWireList );
|
2011-02-05 02:21:11 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Add all wires and junctions connected to \a aSegment which are not connected any
|
2011-03-10 19:36:30 +00:00
|
|
|
* component pin to \a aItemList.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2011-03-10 19:36:30 +00:00
|
|
|
* @param aSegment The segment to test for connections.
|
|
|
|
*/
|
|
|
|
void MarkConnections( SCH_LINE* aSegment );
|
|
|
|
|
2011-04-15 12:40:56 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Adds all of the wires and junctions to \a aList that make up a connection to the
|
2011-04-15 12:40:56 +00:00
|
|
|
* object at \a aPosition.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2011-04-15 12:40:56 +00:00
|
|
|
* @param aPosition The position of the first connection object in drawing units.
|
|
|
|
* @param aList The pick list to add the connect item to.
|
|
|
|
* @param aFullConnection If true all the objects that make up this connection are
|
2011-05-20 19:21:09 +00:00
|
|
|
* add to \a aList. Otherwise, only the objects up to the first
|
2011-04-15 12:40:56 +00:00
|
|
|
* node are added.
|
|
|
|
* @return The number of items added to \a aList.
|
|
|
|
*/
|
|
|
|
int GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aList, bool aFullConnection );
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
/* full undo redo management : */
|
2009-07-29 13:10:36 +00:00
|
|
|
// use BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aItem )
|
|
|
|
// use BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aItem )
|
2009-07-23 15:37:00 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Free the undo or redo list from \a aList element.
|
|
|
|
*
|
|
|
|
* - Wrappers are deleted.
|
|
|
|
* - data pointed by wrappers are deleted if not in use in schematic
|
|
|
|
* i.e. when they are copy of a schematic item or they are no more in use (DELETED)
|
|
|
|
*
|
2009-07-23 15:37:00 +00:00
|
|
|
* @param aList = the UNDO_REDO_CONTAINER to clear
|
|
|
|
* @param aItemCount = the count of items to remove. < 0 for all items
|
|
|
|
* items are removed from the beginning of the list.
|
|
|
|
* So this function can be called to remove old commands
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 ) override;
|
2008-04-30 17:04:22 +00:00
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
/**
|
|
|
|
* Clear the state flags of all the items in the screen.
|
|
|
|
*/
|
|
|
|
void ClearDrawingState();
|
|
|
|
|
2010-12-13 15:59:00 +00:00
|
|
|
int CountConnectedItems( const wxPoint& aPos, bool aTestJunctions ) const;
|
|
|
|
|
2011-01-11 20:34:29 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Test if a junction is required for the items at \a aPosition on the screen.
|
2011-01-11 20:34:29 +00:00
|
|
|
* <p>
|
2017-11-27 19:27:24 +00:00
|
|
|
* A junction is required at \a aPosition if one of the following criteria is satisfied:
|
2011-01-11 20:34:29 +00:00
|
|
|
* <ul>
|
2017-11-27 19:27:24 +00:00
|
|
|
* <li>one wire midpoint and one or more wire endpoints;</li>
|
|
|
|
* <li>three or more wire endpoints;</li>
|
|
|
|
* <li>one wire midpoint and a component pin;</li>
|
|
|
|
* <li>two or more wire endpoints and a component pin.</li>
|
2011-01-11 20:34:29 +00:00
|
|
|
* </ul>
|
|
|
|
* </p>
|
|
|
|
* @param aPosition The position to test.
|
2017-11-27 19:27:24 +00:00
|
|
|
* @param aNew Checks if a _new_ junction is needed, i.e. there isn't one already
|
2011-01-11 20:34:29 +00:00
|
|
|
* @return True if a junction is required at \a aPosition.
|
|
|
|
*/
|
2017-11-27 19:27:24 +00:00
|
|
|
bool IsJunctionNeeded( const wxPoint& aPosition, bool aNew = false );
|
2011-03-25 19:16:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Test if \a aPosition is a connection point on \a aLayer.
|
2011-03-25 19:16:05 +00:00
|
|
|
*
|
|
|
|
* @param aPosition Position to test.
|
|
|
|
* @param aLayer The layer type to test against. Valid layer types are #LAYER_NOTES,
|
|
|
|
* #LAYER_BUS, and #LAYER_WIRE.
|
|
|
|
* @return True if \a Position is a connection point on \a aLayer.
|
|
|
|
*/
|
|
|
|
bool IsTerminalPoint( const wxPoint& aPosition, int aLayer );
|
2011-01-11 20:34:29 +00:00
|
|
|
|
2011-01-10 20:35:24 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Test the screen for a component pin item at \a aPosition.
|
|
|
|
*
|
2011-01-10 20:35:24 +00:00
|
|
|
* @param aPosition Position to test.
|
|
|
|
* @param aComponent The component if a pin was found, otherwise NULL.
|
|
|
|
* @param aEndPointOnly Set to true to test if \a aPosition is the connection
|
|
|
|
* point of the pin.
|
|
|
|
* @return The pin item if found, otherwise NULL.
|
|
|
|
*/
|
|
|
|
LIB_PIN* GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponent = NULL,
|
2011-03-10 19:36:30 +00:00
|
|
|
bool aEndPointOnly = false ) const;
|
2010-12-13 15:59:00 +00:00
|
|
|
|
2011-08-31 13:27:05 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Returns a sheet object pointer that is named \a aName.
|
2011-08-31 13:27:05 +00:00
|
|
|
*
|
2017-11-17 17:00:04 +00:00
|
|
|
* @note The screen hierarchy is not descend.
|
2011-08-31 13:27:05 +00:00
|
|
|
* @param aName is the case insensitive name of the sheet.
|
|
|
|
* @return A pointer to the SCH_SHEET object found or NULL.
|
|
|
|
*/
|
|
|
|
SCH_SHEET* GetSheet( const wxString& aName );
|
|
|
|
|
2011-01-11 20:34:29 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Test the screen if \a aPosition is a sheet label object.
|
|
|
|
*
|
2011-01-11 20:34:29 +00:00
|
|
|
* @param aPosition The position to test.
|
|
|
|
* @return The sheet label object if found otherwise NULL.
|
|
|
|
*/
|
|
|
|
SCH_SHEET_PIN* GetSheetLabel( const wxPoint& aPosition );
|
|
|
|
|
2010-12-31 19:47:39 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Clear the annotation for the components in \a aSheetPath on the screen.
|
|
|
|
*
|
2016-02-15 20:22:45 +00:00
|
|
|
* @param aSheetPath The sheet path of the component annotation to clear. If NULL then
|
|
|
|
* the entire hierarchy is cleared.
|
2010-12-31 19:47:39 +00:00
|
|
|
*/
|
2016-02-15 20:22:45 +00:00
|
|
|
void ClearAnnotation( SCH_SHEET_PATH* aSheetPath );
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2018-09-03 10:11:39 +00:00
|
|
|
/**
|
|
|
|
* For screens shared by many sheetpaths (complex hierarchies):
|
|
|
|
* to be able to clear or modify any reference related sharing this screen
|
|
|
|
* (i.e. thie list of components), an entry for each screen path must exist.
|
|
|
|
* This function creates missing entries, using as default reference the current
|
|
|
|
* reference field and unit number
|
|
|
|
* Note: m_clientSheetPathList must be up to date
|
|
|
|
* ( built by SCH_SCREENS::BuildClientSheetPathList() )
|
|
|
|
*/
|
|
|
|
void EnsureAlternateReferencesExist();
|
|
|
|
|
2010-12-31 19:47:39 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Add all schematic sheet and component objects in the screen to \a aItems.
|
|
|
|
*
|
2011-02-09 12:06:42 +00:00
|
|
|
* @param aItems Hierarchical item list to fill.
|
2010-12-31 19:47:39 +00:00
|
|
|
*/
|
2011-03-25 19:16:05 +00:00
|
|
|
void GetHierarchicalItems( EDA_ITEMS& aItems );
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return all the items at \a aPosition that form a node.
|
2011-03-25 19:16:05 +00:00
|
|
|
*
|
|
|
|
* @param aPosition The wxPoint to test for node items.
|
|
|
|
* @param aList A #EDA_ITEMS container to place the items found.
|
|
|
|
* @return The number of node items found at \a aPosition.
|
|
|
|
*/
|
|
|
|
int GetNode( const wxPoint& aPosition, EDA_ITEMS& aList );
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return a wire or bus item located at \a aPosition.
|
2011-03-25 19:16:05 +00:00
|
|
|
*
|
|
|
|
* @param aPosition The wxPoint to test for node items.
|
|
|
|
* @return The SCH_LINE* of the wire or bus item found at \a aPosition or NULL if item not
|
|
|
|
* found.
|
|
|
|
*/
|
|
|
|
SCH_LINE* GetWireOrBus( const wxPoint& aPosition );
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return a line item located at \a aPosition.
|
2011-03-25 19:16:05 +00:00
|
|
|
*
|
|
|
|
* @param aPosition The wxPoint to test for a line item.
|
|
|
|
* @param aAccuracy Amount to inflate the item hit test bounding box.
|
|
|
|
* @param aLayer The layer the line is drawn upon.
|
|
|
|
* @param aSearchType Additional line test criteria.
|
|
|
|
* @return The SCH_LINE* of the wire item found at \a aPosition or NULL if item not
|
|
|
|
* found.
|
|
|
|
*/
|
|
|
|
SCH_LINE* GetLine( const wxPoint& aPosition, int aAccuracy = 0, int aLayer = LAYER_NOTES,
|
|
|
|
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T );
|
|
|
|
|
|
|
|
SCH_LINE* GetWire( const wxPoint& aPosition, int aAccuracy = 0,
|
|
|
|
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T )
|
|
|
|
{
|
|
|
|
return GetLine( aPosition, aAccuracy, LAYER_WIRE, aSearchType );
|
|
|
|
}
|
|
|
|
|
|
|
|
SCH_LINE* GetBus( const wxPoint& aPosition, int aAccuracy = 0,
|
|
|
|
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T )
|
|
|
|
{
|
|
|
|
return GetLine( aPosition, aAccuracy, LAYER_BUS, aSearchType );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return a label item located at \a aPosition.
|
2011-03-25 19:16:05 +00:00
|
|
|
*
|
|
|
|
* @param aPosition The wxPoint to test for label items.
|
|
|
|
* @param aAccuracy Amount to inflate the item hit test bounding box.
|
|
|
|
* @return The SCH_TEXT* of the label item found at \a aPosition or NULL if item not
|
|
|
|
* found.
|
|
|
|
*/
|
|
|
|
SCH_TEXT* GetLabel( const wxPoint& aPosition, int aAccuracy = 0 );
|
2010-12-31 19:47:39 +00:00
|
|
|
|
2011-03-28 18:23:01 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Search this screen for a symbol with \a aReference and set the footprint field to
|
2011-03-28 18:23:01 +00:00
|
|
|
* \a aFootPrint if found.
|
|
|
|
*
|
2016-02-15 20:14:07 +00:00
|
|
|
* @param aSheetPath The sheet path used to look up the reference designator.
|
2011-03-28 18:23:01 +00:00
|
|
|
* @param aReference The reference designator of the component.
|
2011-03-29 15:21:35 +00:00
|
|
|
* @param aFootPrint The value to set the footprint field.
|
2011-03-28 18:23:01 +00:00
|
|
|
* @param aSetVisible The value to set the field visibility flag.
|
2011-03-29 15:21:35 +00:00
|
|
|
* @return True if \a aReference was found otherwise false.
|
2011-03-28 18:23:01 +00:00
|
|
|
*/
|
2016-02-15 20:14:07 +00:00
|
|
|
bool SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxString& aReference,
|
2011-03-28 18:23:01 +00:00
|
|
|
const wxString& aFootPrint, bool aSetVisible );
|
|
|
|
|
2011-01-07 19:24:24 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Create a list of items found when a block command is initiated.
|
|
|
|
*
|
|
|
|
* The items selected depend on the block command. If the drag block command is issued,
|
|
|
|
* then any items connected to items in the block are also selected.
|
2011-01-07 19:24:24 +00:00
|
|
|
*/
|
|
|
|
void SelectBlockItems();
|
|
|
|
|
2011-01-10 16:50:40 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Add all the items in the screen within the block selection rectangle to the pick list.
|
|
|
|
*
|
2011-01-10 16:50:40 +00:00
|
|
|
* @return The number of items in the pick list.
|
|
|
|
*/
|
|
|
|
int UpdatePickList();
|
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
/**
|
|
|
|
* Adds a bus alias definition (and transfers ownership of the pointer)
|
|
|
|
*/
|
|
|
|
void AddBusAlias( std::shared_ptr<BUS_ALIAS> aAlias );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all bus alias definitions
|
|
|
|
*/
|
|
|
|
void ClearBusAliases()
|
|
|
|
{
|
|
|
|
m_aliases.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a list of bus aliases defined in this screen
|
|
|
|
*/
|
|
|
|
std::unordered_set< std::shared_ptr<BUS_ALIAS> > GetBusAliases()
|
|
|
|
{
|
|
|
|
return m_aliases;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the given string is a valid bus alias in a loaded screen
|
|
|
|
*/
|
|
|
|
static bool IsBusAlias( const wxString& aLabel );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a pointer to a bus alias object for the given label,
|
|
|
|
* or null if one doesn't exist
|
|
|
|
*/
|
|
|
|
static std::shared_ptr<BUS_ALIAS> GetBusAlias( const wxString& aLabel );
|
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
#if defined(DEBUG)
|
2016-09-25 17:06:49 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os ) const override;
|
2011-12-22 21:57:50 +00:00
|
|
|
#endif
|
2007-08-20 01:20:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Container class that holds multiple #SCH_SCREEN objects in a hierarchy.
|
|
|
|
*
|
|
|
|
* Individual #SCH_SCREEN objects are unique and correspond to .sch files.
|
2011-10-07 14:41:30 +00:00
|
|
|
*/
|
2010-10-26 20:25:48 +00:00
|
|
|
class SCH_SCREENS
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
private:
|
2010-10-26 20:25:48 +00:00
|
|
|
std::vector< SCH_SCREEN* > m_screens;
|
|
|
|
unsigned int m_index;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2017-11-17 17:00:04 +00:00
|
|
|
SCH_SCREENS( SCH_SHEET* aSheet = NULL );
|
2010-10-26 20:25:48 +00:00
|
|
|
~SCH_SCREENS();
|
|
|
|
int GetCount() const { return m_screens.size(); }
|
2008-02-28 19:27:25 +00:00
|
|
|
SCH_SCREEN* GetFirst();
|
|
|
|
SCH_SCREEN* GetNext();
|
2014-04-30 19:16:22 +00:00
|
|
|
SCH_SCREEN* GetScreen( unsigned int aIndex ) const;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2016-02-15 20:22:45 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Clear the annotation for all components in the hierarchy.
|
2016-02-15 20:22:45 +00:00
|
|
|
*/
|
|
|
|
void ClearAnnotation();
|
|
|
|
|
2018-09-03 10:11:39 +00:00
|
|
|
/**
|
|
|
|
* Clear the annotation for the components inside new sheetpaths
|
|
|
|
* when a complex hierarchy is modified and new sheetpaths added
|
|
|
|
* when a screen shares more than one sheet path, missing alternate references are added
|
|
|
|
* and alternate references of new sheet paths are cleared
|
|
|
|
*
|
|
|
|
* @param aInitialSheetPathList is the initial sheet paths list of hierarchy before changes.
|
|
|
|
*/
|
|
|
|
void ClearAnnotationOfNewSheetPaths( SCH_SHEET_LIST& aInitialSheetPathList );
|
|
|
|
|
2010-12-31 19:47:39 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Test all sheet and component objects in the schematic for duplicate time stamps
|
|
|
|
* and replaces them as necessary.
|
|
|
|
* Time stamps must be unique in order for complex hierarchies know which components go
|
|
|
|
* to which sheets.
|
2010-12-31 19:47:39 +00:00
|
|
|
* @return The number of duplicate time stamps replaced.
|
|
|
|
*/
|
|
|
|
int ReplaceDuplicateTimeStamps();
|
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Delete all electronic rules check markers of \a aMarkerType from all the screens in
|
2011-03-10 19:36:30 +00:00
|
|
|
* the list.
|
2011-03-25 19:16:05 +00:00
|
|
|
* @param aMarkerType Type of markers to be deleted.
|
2011-03-10 19:36:30 +00:00
|
|
|
*/
|
2015-07-29 12:18:53 +00:00
|
|
|
void DeleteAllMarkers( enum MARKER_BASE::TYPEMARKER aMarkerType );
|
2011-03-10 19:36:30 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Return the number of ERC markers of \a aMarkerType from all of the screens in the list.
|
2011-10-07 14:41:30 +00:00
|
|
|
*
|
2015-07-29 12:18:53 +00:00
|
|
|
* @param aMarkerType Indicates the type of marker to count. if MARKER_UNSPEC
|
|
|
|
* all markers are counted.
|
2015-07-29 18:06:45 +00:00
|
|
|
* @param aSeverity Indicates the error level of marker to count.
|
|
|
|
* useMARKER_SEVERITY_UNSPEC to count all markersof the specified type
|
2011-10-07 14:41:30 +00:00
|
|
|
* @return int count of the markers found.
|
|
|
|
*/
|
2015-07-29 18:06:45 +00:00
|
|
|
int GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType,
|
|
|
|
enum MARKER_BASE::MARKER_SEVERITY aSeverity );
|
2011-10-07 14:41:30 +00:00
|
|
|
|
2017-07-09 18:17:18 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Initialize or reinitialize the weak reference to the #LIB_PART for each #SCH_COMPONENT
|
|
|
|
* found in the full schematic.
|
|
|
|
*
|
2017-07-09 18:17:18 +00:00
|
|
|
* It must be called from:
|
2017-10-22 00:48:25 +00:00
|
|
|
* - draw functions
|
2017-07-09 18:17:18 +00:00
|
|
|
* - when loading a schematic file
|
|
|
|
* - before creating a netlist (in case a library is modified)
|
2017-10-22 00:48:25 +00:00
|
|
|
* - whenever any of the libraries are modified.
|
2019-04-30 17:03:19 +00:00
|
|
|
* - whenever the symbol library table is modified.
|
2017-07-09 18:17:18 +00:00
|
|
|
*/
|
2017-10-22 00:48:25 +00:00
|
|
|
void UpdateSymbolLinks( bool aForce = false );
|
2017-07-09 18:17:18 +00:00
|
|
|
|
2017-03-10 14:36:55 +00:00
|
|
|
void TestDanglingEnds();
|
2017-03-04 19:49:55 +00:00
|
|
|
|
2017-03-05 22:31:31 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Test all of the schematic symbols to see if all #LIB_ID objects library nickname is not
|
2017-03-05 22:31:31 +00:00
|
|
|
* set.
|
|
|
|
*
|
|
|
|
* If none of the #LIB_ID object library nicknames are not set, this indicates that the
|
|
|
|
* project was created before the symbol library implementation.
|
|
|
|
*
|
2017-10-06 18:07:43 +00:00
|
|
|
* @return true in there are any symbols and if all of the #LIB_ID object library nicknames
|
|
|
|
* are empty, otherwise false.
|
2017-03-05 22:31:31 +00:00
|
|
|
*/
|
|
|
|
bool HasNoFullyDefinedLibIds();
|
|
|
|
|
2017-11-17 17:00:04 +00:00
|
|
|
/**
|
|
|
|
* Fetch all of the symbol library nickames into \a aLibNicknames.
|
|
|
|
*
|
|
|
|
* @param aLibNicknames is the array to populate with all of the unique library nicknames.
|
|
|
|
* @return the number of symbol library nicknames found.
|
|
|
|
*/
|
|
|
|
size_t GetLibNicknames( wxArrayString& aLibNicknames );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Change all of the symbol library nicknames.
|
|
|
|
*
|
|
|
|
* @param aFrom the current symbol library name to change.
|
|
|
|
* @param aTo the new symbol library name.
|
|
|
|
* @return the number of symbol library nicknames that were changed.
|
|
|
|
*/
|
|
|
|
int ChangeSymbolLibNickname( const wxString& aFrom, const wxString& aTo );
|
|
|
|
|
2018-09-03 10:11:39 +00:00
|
|
|
/**
|
|
|
|
* built the list of sheet paths sharing a screen for each screen in use
|
|
|
|
*/
|
|
|
|
void BuildClientSheetPathList();
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
private:
|
2017-11-17 17:00:04 +00:00
|
|
|
void addScreenToList( SCH_SCREEN* aScreen );
|
|
|
|
void buildScreenList( SCH_SHEET* aSheet);
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2018-01-30 08:56:43 +00:00
|
|
|
#endif /* SCREEN_H */
|