2011-10-11 20:23:56 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-02-28 16:56:09 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
|
|
* Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com
|
2017-01-31 01:31:19 +00:00
|
|
|
* Copyright (C) 2015-2017 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-11 20:23:56 +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
|
|
|
/**
|
|
|
|
* @file sch_component.h
|
|
|
|
* @brief Definition the SCH_COMPONENT class for Eeschema.
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#ifndef COMPONENT_CLASS_H
|
|
|
|
#define COMPONENT_CLASS_H
|
|
|
|
|
2017-01-31 01:31:19 +00:00
|
|
|
#include <lib_id.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <sch_field.h>
|
|
|
|
#include <transform.h>
|
|
|
|
#include <general.h>
|
2015-06-08 00:07:42 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <lib_draw_item.h>
|
2008-10-06 05:44:29 +00:00
|
|
|
|
2016-08-11 12:41:38 +00:00
|
|
|
class SCH_SCREEN;
|
2009-12-02 21:44:03 +00:00
|
|
|
class SCH_SHEET_PATH;
|
2011-04-27 19:44:32 +00:00
|
|
|
class LIB_ITEM;
|
2010-11-10 15:30:12 +00:00
|
|
|
class LIB_PIN;
|
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 LIB_PART;
|
2013-09-25 19:09:57 +00:00
|
|
|
class NETLIST_OBJECT_LIST;
|
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 LIB_PART;
|
|
|
|
class PART_LIBS;
|
|
|
|
class SCH_COLLECTOR;
|
2016-07-06 09:22:56 +00:00
|
|
|
class SCH_SCREEN;
|
2017-03-09 23:33:39 +00:00
|
|
|
class SYMBOL_LIB_TABLE;
|
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
|
|
|
|
2008-10-06 05:44:29 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
/// A container for several SCH_FIELD items
|
2016-06-29 15:09:55 +00:00
|
|
|
typedef std::vector<SCH_FIELD> SCH_FIELDS;
|
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
|
|
|
|
2016-06-29 15:09:55 +00:00
|
|
|
typedef std::weak_ptr<LIB_PART> PART_REF;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
|
|
|
2016-07-11 19:48:46 +00:00
|
|
|
extern std::string toUTFTildaText( const wxString& txt );
|
|
|
|
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
/**
|
|
|
|
* Class SCH_COMPONENT
|
|
|
|
* describes a real schematic component
|
2007-09-13 11:55:46 +00:00
|
|
|
*/
|
2008-03-20 01:50:21 +00:00
|
|
|
class SCH_COMPONENT : public SCH_ITEM
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
friend class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC;
|
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
public:
|
|
|
|
enum AUTOPLACED { AUTOPLACED_NO = 0, AUTOPLACED_AUTO, AUTOPLACED_MANUAL };
|
|
|
|
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
|
|
|
wxPoint m_Pos;
|
2017-01-31 01:31:19 +00:00
|
|
|
|
|
|
|
///< Name and library where symbol was loaded from, i.e. "74xx:74LS00".
|
|
|
|
LIB_ID m_lib_id;
|
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 m_unit; ///< The unit for multiple part per package components.
|
|
|
|
int m_convert; ///< The alternate body style for components that have more than
|
|
|
|
///< one body style defined. Primarily used for components that
|
|
|
|
///< have a De Morgan conversion.
|
|
|
|
wxString m_prefix; ///< C, R, U, Q etc - the first character which typically indicates
|
|
|
|
///< what the component is. Determined, upon placement, from the
|
|
|
|
///< library component. Created upon file load, by the first
|
|
|
|
///< non-digits in the reference fields.
|
|
|
|
TRANSFORM m_transform; ///< The rotation/mirror transformation matrix.
|
|
|
|
SCH_FIELDS m_Fields; ///< Variable length list of fields.
|
|
|
|
|
|
|
|
PART_REF m_part; ///< points into the PROJECT's libraries to the LIB_PART for this component
|
2008-10-06 05:44:29 +00:00
|
|
|
|
2015-06-08 00:07:42 +00:00
|
|
|
std::vector<bool> m_isDangling; ///< One isDangling per pin
|
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
AUTOPLACED m_fieldsAutoplaced; ///< indicates status of field autoplacement
|
|
|
|
|
2013-01-12 17:32:24 +00:00
|
|
|
/**
|
2016-02-15 20:15:51 +00:00
|
|
|
* A temporary sheet path is required to generate the correct reference designator string
|
2013-01-12 17:32:24 +00:00
|
|
|
* in complex heirarchies. Hopefully this is only a temporary hack to decouple schematic
|
|
|
|
* objects from the drawing window until a better design for handling complex heirarchies
|
|
|
|
* can be implemented.
|
|
|
|
*/
|
2016-02-15 20:15:51 +00:00
|
|
|
const SCH_SHEET_PATH* m_currentSheetPath;
|
2013-01-12 17:32:24 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
/**
|
2011-01-07 19:24:24 +00:00
|
|
|
* Defines the hierarchical path and reference of the component. This allows support
|
|
|
|
* for hierarchical sheets that reference the same schematic. The format for the path
|
2010-12-31 19:47:39 +00:00
|
|
|
* is /<sheet time stamp>/<sheet time stamp>/.../&lscomponent time stamp>.
|
|
|
|
* A single / denotes the root sheet.
|
2008-04-15 19:38:19 +00:00
|
|
|
*/
|
2010-09-05 17:01:48 +00:00
|
|
|
wxArrayString m_PathsAndReferences;
|
2008-02-12 21:12:46 +00:00
|
|
|
|
2009-10-16 17:18:23 +00:00
|
|
|
void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
public:
|
2010-11-03 14:13:15 +00:00
|
|
|
SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = NULL );
|
2008-10-19 18:31:09 +00:00
|
|
|
|
2009-10-16 17:18:23 +00:00
|
|
|
/**
|
|
|
|
* Create schematic component from library component object.
|
|
|
|
*
|
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
|
|
|
* @param aPart - library part to create schematic component from.
|
|
|
|
* @param aSheet - Schematic sheet the component is place into.
|
2009-10-16 17:18:23 +00:00
|
|
|
* @param unit - Part for components that have multiple parts per
|
|
|
|
* package.
|
|
|
|
* @param convert - Use the alternate body style for the schematic
|
|
|
|
* component.
|
|
|
|
* @param pos - Position to place new component.
|
|
|
|
* @param setNewItemFlag - Set the component IS_NEW and IS_MOVED flags.
|
|
|
|
*/
|
2016-02-15 20:15:51 +00:00
|
|
|
SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* aSheet,
|
2009-10-16 17:18:23 +00:00
|
|
|
int unit = 0, int convert = 0,
|
|
|
|
const wxPoint& pos = wxPoint( 0, 0 ),
|
|
|
|
bool setNewItemFlag = false );
|
|
|
|
|
2008-10-19 18:31:09 +00:00
|
|
|
/**
|
|
|
|
* Copy Constructor
|
2010-12-21 15:13:09 +00:00
|
|
|
* clones \a aComponent into a new object. All fields are copied as is except
|
2008-10-19 18:31:09 +00:00
|
|
|
* for the linked list management pointers which are set to NULL, and the
|
2009-12-02 21:44:03 +00:00
|
|
|
* SCH_FIELD's m_Parent pointers which are set to the new parent,
|
2008-10-19 18:31:09 +00:00
|
|
|
* i.e. this new object.
|
|
|
|
*/
|
2010-12-21 15:13:09 +00:00
|
|
|
SCH_COMPONENT( const SCH_COMPONENT& aComponent );
|
2008-10-19 18:31:09 +00:00
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
~SCH_COMPONENT() { }
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
wxString GetClass() const override
|
2007-09-13 11:28:58 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
return wxT( "SCH_COMPONENT" );
|
2007-09-13 11:28:58 +00:00
|
|
|
}
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2016-07-11 19:48:46 +00:00
|
|
|
const wxArrayString& GetPathsAndReferences() const { return m_PathsAndReferences; }
|
|
|
|
|
2015-02-28 16:56:09 +00:00
|
|
|
/**
|
|
|
|
* Virtual function IsMovableFromAnchorPoint
|
|
|
|
* Return true for items which are moved with the anchor point at mouse cursor
|
|
|
|
* and false for items moved with no reference to anchor
|
|
|
|
* Usually return true for small items (labels, junctions) and false for
|
|
|
|
* items which can be large (hierarchical sheets, compoments)
|
|
|
|
* @return false for a componant
|
|
|
|
*/
|
2016-09-25 17:06:49 +00:00
|
|
|
bool IsMovableFromAnchorPoint() override { return false; }
|
2015-02-28 16:56:09 +00:00
|
|
|
|
2017-01-31 01:31:19 +00:00
|
|
|
void SetLibId( const LIB_ID& aName, PART_LIBS* aLibs=NULL );
|
2017-03-09 23:33:39 +00:00
|
|
|
void SetLibId( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aSymLibTable );
|
|
|
|
|
2017-01-31 01:31:19 +00:00
|
|
|
const LIB_ID& GetLibId() const { return m_lib_id; }
|
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
|
|
|
|
2017-03-04 00:04:43 +00:00
|
|
|
PART_REF& GetPartRef() { return m_part; }
|
|
|
|
|
2017-04-02 12:09:01 +00:00
|
|
|
/**
|
|
|
|
* Return information about the aliased parts
|
|
|
|
*/
|
|
|
|
wxString GetAliasDescription() const;
|
|
|
|
wxString GetAliasDocumentation() const;
|
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Function Resolve
|
|
|
|
* [re-]assigns the current LIB_PART from aLibs which this component
|
|
|
|
* is based on.
|
|
|
|
* @param aLibs is the current set of LIB_PARTs to choose from.
|
|
|
|
*/
|
|
|
|
bool Resolve( PART_LIBS* aLibs );
|
2010-12-14 15:56:30 +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
|
|
|
static void ResolveAll( const SCH_COLLECTOR& aComponents, PART_LIBS* aLibs );
|
2010-12-14 15:56:30 +00:00
|
|
|
|
|
|
|
int GetUnit() const { return m_unit; }
|
|
|
|
|
2013-07-05 17:48:01 +00:00
|
|
|
/**
|
|
|
|
* change the unit id to aUnit
|
|
|
|
* has maening only for multiple parts per package
|
|
|
|
* Also set the modified flag bit
|
|
|
|
* @param aUnit = the new unit Id
|
|
|
|
*/
|
2010-12-14 15:56:30 +00:00
|
|
|
void SetUnit( int aUnit );
|
|
|
|
|
2013-07-05 17:48:01 +00:00
|
|
|
/**
|
|
|
|
* change the unit id to aUnit
|
|
|
|
* has maening only for multiple parts per package
|
|
|
|
* Do not change the modified flag bit, and should be used when
|
|
|
|
* change is not due to an edition command
|
|
|
|
* @param aUnit = the new unit Id
|
|
|
|
*/
|
|
|
|
void UpdateUnit( int aUnit );
|
|
|
|
|
2010-12-14 15:56:30 +00:00
|
|
|
int GetConvert() const { return m_convert; }
|
|
|
|
|
|
|
|
void SetConvert( int aConvert );
|
|
|
|
|
|
|
|
wxString GetPrefix() const { return m_prefix; }
|
|
|
|
|
2016-07-06 09:22:56 +00:00
|
|
|
void SetPrefix( const wxString& aPrefix ) { m_prefix = aPrefix; }
|
|
|
|
|
2010-12-14 21:39:31 +00:00
|
|
|
TRANSFORM& GetTransform() const { return const_cast< TRANSFORM& >( m_transform ); }
|
|
|
|
|
|
|
|
void SetTransform( const TRANSFORM& aTransform );
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2011-06-17 13:24:22 +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
|
|
|
* Function GetUnitCount
|
2011-06-17 13:24:22 +00:00
|
|
|
* returns the number of parts per package of the component.
|
|
|
|
*
|
|
|
|
* @return The number of parts per package or zero if the library entry cannot be found.
|
|
|
|
*/
|
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 GetUnitCount() const;
|
2011-06-17 13:24:22 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool Save( FILE* aFile ) const override;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool Load( LINE_READER& aLine, wxString& aErrorMsg ) override;
|
2008-10-06 05:44:29 +00:00
|
|
|
|
2010-12-14 21:39:31 +00:00
|
|
|
/**
|
|
|
|
* Function SetOrientation
|
|
|
|
* computes the new transform matrix based on \a aOrientation for the component which is
|
|
|
|
* applied to the current transform.
|
|
|
|
* @param aOrientation The orientation to apply to the transform.
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
void SetOrientation( int aOrientation );
|
2010-01-13 21:15:54 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-11-12 16:59:16 +00:00
|
|
|
* Function GetOrientation
|
2009-04-09 11:34:41 +00:00
|
|
|
* Used to display component orientation (in dialog editor or info)
|
|
|
|
* @return the orientation and mirror
|
|
|
|
* Note: Because there are different ways to have a given orientation/mirror,
|
2009-12-02 21:44:03 +00:00
|
|
|
* the orientation/mirror is not necessary what the used does
|
|
|
|
* (example : a mirrorX then a mirrorY give no mirror but rotate the
|
|
|
|
* component).
|
2009-04-09 11:34:41 +00:00
|
|
|
* So this function find a rotation and a mirror value
|
2010-01-13 21:15:54 +00:00
|
|
|
* ( CMP_MIRROR_X because this is the first mirror option tested)
|
2009-04-09 11:34:41 +00:00
|
|
|
* but can differs from the orientation made by an user
|
2010-01-13 21:15:54 +00:00
|
|
|
* ( a CMP_MIRROR_Y is find as a CMP_MIRROR_X + orientation 180, because
|
2009-12-02 21:44:03 +00:00
|
|
|
* they are equivalent)
|
2009-04-09 11:34:41 +00:00
|
|
|
*/
|
2011-03-25 19:16:05 +00:00
|
|
|
int GetOrientation();
|
2009-04-09 11:34:41 +00:00
|
|
|
|
2010-12-14 21:39:31 +00:00
|
|
|
/**
|
|
|
|
* Function GetScreenCoord
|
|
|
|
* Returns the coordinated point relative to the orientation of the component of \a aPoint.
|
|
|
|
* The coordinates are always relative to the anchor position of the component.
|
|
|
|
* @param aPoint The coordinates to transform.
|
|
|
|
* @return The transformed point.
|
|
|
|
*/
|
2011-03-25 19:16:05 +00:00
|
|
|
wxPoint GetScreenCoord( const wxPoint& aPoint );
|
2010-12-14 21:39:31 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
|
2008-10-06 05:44:29 +00:00
|
|
|
|
2008-04-21 06:34:56 +00:00
|
|
|
/**
|
2010-12-14 21:39:31 +00:00
|
|
|
* Function ClearAnnotation
|
|
|
|
* clears exiting component annotation ( i.i IC23 changed to IC? and part reset to 1)
|
2016-02-15 20:22:45 +00:00
|
|
|
* @param aSheetPath: SCH_SHEET_PATH value: if NULL remove all annotations,
|
|
|
|
* else remove annotation relative to this sheetpath
|
2008-04-21 06:34:56 +00:00
|
|
|
*/
|
2016-02-15 20:22:45 +00:00
|
|
|
void ClearAnnotation( SCH_SHEET_PATH* aSheetPath );
|
2008-04-21 06:34:56 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetTimeStamp
|
2010-12-14 21:39:31 +00:00
|
|
|
* changes the time stamp to \a aNewTimeStamp updates the reference path.
|
|
|
|
* @see m_PathsAndReferences
|
2009-04-25 10:12:30 +00:00
|
|
|
* @param aNewTimeStamp = new time stamp
|
|
|
|
*/
|
2012-05-25 01:52:04 +00:00
|
|
|
void SetTimeStamp( time_t aNewTimeStamp );
|
2009-04-25 10:12:30 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
const EDA_RECT GetBoundingBox() const override;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
/**
|
|
|
|
* Function GetBodyBoundingBox
|
|
|
|
* Return a bounding box for the component body but not the fields.
|
|
|
|
*/
|
|
|
|
EDA_RECT GetBodyBoundingBox() const;
|
|
|
|
|
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
//-----<Fields>-----------------------------------------------------------
|
|
|
|
|
2008-10-06 05:44:29 +00:00
|
|
|
/**
|
|
|
|
* Function GetField
|
|
|
|
* returns a field.
|
2010-06-17 16:30:10 +00:00
|
|
|
* @param aFieldNdx An index into the array of fields, not a field id.
|
2009-12-02 21:44:03 +00:00
|
|
|
* @return SCH_FIELD* - the field value or NULL if does not exist
|
2008-10-06 05:44:29 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_FIELD* GetField( int aFieldNdx ) const;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2017-04-02 12:09:01 +00:00
|
|
|
/**
|
|
|
|
* Returns text associated with a given field (if such a field exists)
|
|
|
|
* @aFieldName is the name of the field
|
|
|
|
*/
|
2017-05-22 14:05:36 +00:00
|
|
|
wxString GetFieldText( wxString aFieldName, bool aIncludeDefaultFields = true ) const;
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
/**
|
|
|
|
* Function GetFields
|
|
|
|
* populates a std::vector with SCH_FIELDs.
|
|
|
|
* @param aVector - vector to populate.
|
|
|
|
* @param aVisibleOnly - if true, only get fields that are visible and contain text.
|
|
|
|
*/
|
|
|
|
void GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly );
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
/**
|
2008-10-06 05:44:29 +00:00
|
|
|
* Function AddField
|
2008-10-06 15:03:59 +00:00
|
|
|
* adds a field to the component. The field is copied as it is put into
|
|
|
|
* the component.
|
2009-12-02 21:44:03 +00:00
|
|
|
* @param aField A const reference to the SCH_FIELD to add.
|
2010-06-17 16:30:10 +00:00
|
|
|
* @return SCH_FIELD* - the newly inserted field.
|
|
|
|
*/
|
|
|
|
SCH_FIELD* AddField( const SCH_FIELD& aField );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function FindField
|
|
|
|
* searches for SCH_FIELD with \a aFieldName and returns it if found, else NULL.
|
2007-09-20 21:06:49 +00:00
|
|
|
*/
|
2017-05-22 14:05:36 +00:00
|
|
|
SCH_FIELD* FindField( const wxString& aFieldName, bool aIncludeDefaultFields = true );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
void SetFields( const SCH_FIELDS& aFields )
|
2008-11-26 00:20:16 +00:00
|
|
|
{
|
|
|
|
m_Fields = aFields; // vector copying, length is changed possibly
|
|
|
|
}
|
2008-10-06 05:44:29 +00:00
|
|
|
/**
|
|
|
|
* Function GetFieldCount
|
|
|
|
* returns the number of fields in this component.
|
|
|
|
*/
|
2016-07-11 19:48:46 +00:00
|
|
|
int GetFieldCount() const { return (int)m_Fields.size(); }
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
/**
|
|
|
|
* Function GetFieldsAutoplaced
|
|
|
|
* returns whether the fields are autoplaced.
|
|
|
|
*/
|
|
|
|
AUTOPLACED GetFieldsAutoplaced() const { return m_fieldsAutoplaced; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ClearFieldsAutoplaced
|
|
|
|
* Set fields autoplaced flag false.
|
|
|
|
*/
|
|
|
|
void ClearFieldsAutoplaced() { m_fieldsAutoplaced = AUTOPLACED_NO; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function AutoplaceFields
|
|
|
|
* Automatically orient all the fields in the component.
|
|
|
|
* @param aScreen - the SCH_SCREEN associated with the current instance of the
|
|
|
|
* component. This can be NULL when aManual is false.
|
|
|
|
* @param aManual - True if the autoplace was manually initiated (e.g. by a hotkey
|
|
|
|
* or a menu item). Some more 'intelligent' routines will be used that would be
|
|
|
|
* annoying if done automatically during moves.
|
|
|
|
*/
|
|
|
|
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function AutoAutoplaceFields
|
|
|
|
* Autoplace fields only if correct to do so automatically. That is, do not
|
|
|
|
* autoplace if fields have been moved by hand.
|
|
|
|
* @param aScreen - the SCH_SCREEN associated with the current instance of the
|
|
|
|
* component.
|
|
|
|
*/
|
|
|
|
void AutoAutoplaceFields( SCH_SCREEN* aScreen )
|
|
|
|
{
|
|
|
|
if( GetFieldsAutoplaced() )
|
|
|
|
AutoplaceFields( aScreen, GetFieldsAutoplaced() == AUTOPLACED_MANUAL );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//-----</Fields>----------------------------------------------------------
|
|
|
|
|
|
|
|
|
2009-10-30 19:26:25 +00:00
|
|
|
/**
|
2010-12-14 21:39:31 +00:00
|
|
|
* Function GetPin
|
|
|
|
* finds a component pin by number.
|
2009-10-30 19:26:25 +00:00
|
|
|
*
|
|
|
|
* @param number - The number of the pin to find.
|
|
|
|
* @return Pin object if found, otherwise NULL.
|
|
|
|
*/
|
|
|
|
LIB_PIN* GetPin( const wxString& number );
|
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
/**
|
|
|
|
* Function GetPins
|
|
|
|
* populate a vector with all the pins.
|
|
|
|
*/
|
|
|
|
void GetPins( std::vector<LIB_PIN*>& aPinsList );
|
|
|
|
|
2015-02-28 16:56:09 +00:00
|
|
|
/**
|
|
|
|
* Virtual function, from the base class SCH_ITEM::Draw
|
|
|
|
*/
|
|
|
|
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
|
2017-02-20 17:48:27 +00:00
|
|
|
GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override
|
2009-10-16 17:18:23 +00:00
|
|
|
{
|
2015-02-28 16:56:09 +00:00
|
|
|
Draw( aPanel, aDC, aOffset, aDrawMode, aColor, true );
|
2009-10-16 17:18:23 +00:00
|
|
|
}
|
|
|
|
|
2015-02-28 16:56:09 +00:00
|
|
|
/**
|
|
|
|
* Function Draw, specific to components.
|
|
|
|
* Draw a component, with or without pin texts.
|
|
|
|
* @param aPanel DrawPanel to use (can be null) mainly used for clipping purposes.
|
|
|
|
* @param aDC Device Context (can be null)
|
|
|
|
* @param aOffset drawing Offset (usually wxPoint(0,0),
|
|
|
|
* but can be different when moving an object)
|
|
|
|
* @param aDrawMode GR_OR, GR_XOR, ...
|
2017-02-20 17:48:27 +00:00
|
|
|
* @param aColor COLOR4D::UNSPECIFIED to use the normal body item color, or use this color if >= 0
|
2015-02-28 16:56:09 +00:00
|
|
|
* @param aDrawPinText = true to draw pin texts, false to draw only the pin shape
|
|
|
|
* usually false to draw a component when moving it, and true otherwise.
|
|
|
|
*/
|
|
|
|
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
|
2017-02-20 16:57:41 +00:00
|
|
|
GR_DRAWMODE aDrawMode, COLOR4D aColor,
|
2015-02-28 16:56:09 +00:00
|
|
|
bool aDrawPinText );
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void SwapData( SCH_ITEM* aItem ) override;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2016-02-15 20:22:45 +00:00
|
|
|
// returns a unique ID, in the form of a path.
|
|
|
|
wxString GetPath( const SCH_SHEET_PATH* sheet ) const;
|
2008-10-06 05:44:29 +00:00
|
|
|
|
2011-05-31 16:29:14 +00:00
|
|
|
/**
|
|
|
|
* Function IsReferenceStringValid (static)
|
|
|
|
* Tests for an acceptable reference string
|
|
|
|
* An acceptable reference string must support unannotation
|
|
|
|
* i.e starts by letter
|
|
|
|
* @param aReferenceString = the reference string to validate
|
|
|
|
* @return true if OK
|
|
|
|
*/
|
2011-12-14 17:25:42 +00:00
|
|
|
static bool IsReferenceStringValid( const wxString& aReferenceString );
|
2011-05-31 16:29:14 +00:00
|
|
|
|
2016-02-15 20:15:51 +00:00
|
|
|
void SetCurrentSheetPath( const SCH_SHEET_PATH* aSheetPath )
|
2013-01-12 17:32:24 +00:00
|
|
|
{
|
2016-02-15 20:15:51 +00:00
|
|
|
m_currentSheetPath = aSheetPath;
|
2013-01-12 17:32:24 +00:00
|
|
|
}
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
/**
|
|
|
|
* Function GetRef
|
|
|
|
* returns the reference, for the given sheet path.
|
|
|
|
*/
|
2016-02-15 20:17:51 +00:00
|
|
|
const wxString GetRef( const SCH_SHEET_PATH* sheet );
|
2008-10-06 05:44:29 +00:00
|
|
|
|
2011-05-31 16:29:14 +00:00
|
|
|
/**
|
|
|
|
* Set the reference, for the given sheet path.
|
|
|
|
*/
|
2016-02-15 20:18:32 +00:00
|
|
|
void SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref );
|
2008-10-06 05:44:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function AddHierarchicalReference
|
2009-12-02 21:44:03 +00:00
|
|
|
* adds a full hierarchical reference (path + local reference)
|
2010-12-14 15:56:30 +00:00
|
|
|
* @param aPath Hierarchical path (/<sheet timestamp>/<component
|
|
|
|
* timestamp> like /05678E50/A23EF560)
|
2011-01-07 19:24:24 +00:00
|
|
|
* @param aRef :local reference like C45, R56
|
2010-12-14 15:56:30 +00:00
|
|
|
* @param aMulti Part selection, used in multi part per package (0 or 1 for non multi)
|
2008-04-16 08:40:31 +00:00
|
|
|
*/
|
2011-03-25 19:16:05 +00:00
|
|
|
void AddHierarchicalReference( const wxString& aPath,
|
|
|
|
const wxString& aRef,
|
|
|
|
int aMulti );
|
2008-10-06 05:44:29 +00:00
|
|
|
|
2016-02-15 20:16:54 +00:00
|
|
|
// returns the unit selection, for the given sheet path.
|
2016-02-15 20:17:51 +00:00
|
|
|
int GetUnitSelection( SCH_SHEET_PATH* aSheet );
|
2008-10-06 05:44:29 +00:00
|
|
|
|
2016-02-15 20:16:54 +00:00
|
|
|
// Set the unit selection, for the given sheet path.
|
|
|
|
void SetUnitSelection( SCH_SHEET_PATH* aSheet, int aUnitSelection );
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
// Geometric transforms (used in block operations):
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
void Move( const wxPoint& aMoveVector ) override
|
2009-07-27 14:32:40 +00:00
|
|
|
{
|
2010-12-14 21:39:31 +00:00
|
|
|
if( aMoveVector == wxPoint( 0, 0 ) )
|
|
|
|
return;
|
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
m_Pos += aMoveVector;
|
2010-12-14 21:39:31 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
for( int ii = 0; ii < GetFieldCount(); ii++ )
|
2009-12-02 21:44:03 +00:00
|
|
|
GetField( ii )->Move( aMoveVector );
|
2009-07-27 14:32:40 +00:00
|
|
|
|
2010-12-14 21:39:31 +00:00
|
|
|
SetModified();
|
|
|
|
}
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void MirrorY( int aYaxis_position ) override;
|
2010-12-14 21:39:31 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void MirrorX( int aXaxis_position ) override;
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void Rotate( wxPoint aPosition ) override;
|
2009-07-27 14:32:40 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
|
2010-11-03 14:13:15 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
2010-11-03 14:13:15 +00:00
|
|
|
|
2015-06-08 00:07:42 +00:00
|
|
|
/**
|
2015-07-20 19:49:32 +00:00
|
|
|
* Test if the component's dangling state has changed for one given pin index. As
|
|
|
|
* a side effect, actually update the dangling status for that pin.
|
|
|
|
*
|
|
|
|
* @param aItemList - list of all DANGLING_END_ITEMs to be tested
|
|
|
|
* @param aLibPins - list of all the LIB_PIN items in this component's symbol
|
|
|
|
* @param aPin - index into aLibPins that identifies the pin to test
|
|
|
|
* @return true if the pin's state has changed.
|
2015-06-08 00:07:42 +00:00
|
|
|
*/
|
2015-07-20 19:49:32 +00:00
|
|
|
bool IsPinDanglingStateChanged( std::vector<DANGLING_END_ITEM>& aItemList,
|
|
|
|
LIB_PINS& aLibPins, unsigned aPin );
|
2015-06-08 00:07:42 +00:00
|
|
|
|
2015-07-20 19:49:32 +00:00
|
|
|
/**
|
|
|
|
* Test if the component's dangling state has changed for all pins. As a side
|
|
|
|
* effect, actually update the dangling status for all pins (does not short-circuit).
|
|
|
|
*
|
|
|
|
* @param aItemList - list of all DANGLING_END_ITEMs to be tested
|
|
|
|
* @return true if any pin's state has changed.
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
bool IsDanglingStateChanged( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
2015-06-08 00:07:42 +00:00
|
|
|
|
2015-07-20 19:49:32 +00:00
|
|
|
/**
|
|
|
|
* Return whether any pin has dangling status. Does NOT update the internal status,
|
|
|
|
* only checks the existing status.
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
bool IsDangling() const override;
|
2015-06-08 00:07:42 +00:00
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
wxPoint GetPinPhysicalPosition( LIB_PIN* Pin );
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool IsSelectStateChanged( const wxRect& aRect ) override;
|
2010-11-03 14:13:15 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
bool IsConnectable() const override { return true; }
|
2011-01-07 19:24:24 +00:00
|
|
|
|
2013-09-27 17:58:58 +00:00
|
|
|
/**
|
|
|
|
* @return true if the component is in netlist
|
|
|
|
* which means this is not a power component, or something
|
|
|
|
* like a component reference starting by #
|
|
|
|
*/
|
|
|
|
bool IsInNetlist() const;
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void GetConnectionPoints( std::vector<wxPoint>& aPoints ) const override;
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2016-07-12 19:05:54 +00:00
|
|
|
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2010-12-13 15:59:00 +00:00
|
|
|
/**
|
|
|
|
* Function GetDrawItem().
|
|
|
|
* Return the component library item at \a aPosition that is part of this component.
|
|
|
|
*
|
|
|
|
* @param aPosition - Schematic position of the component library object.
|
|
|
|
* @param aType - Type of component library object to find or any if set to TYPE_NOT_INIT.
|
|
|
|
* @return A pointer to the component library object if found, otherwise NULL.
|
|
|
|
*/
|
2011-04-27 19:44:32 +00:00
|
|
|
LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT );
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
wxString GetSelectMenuText() const override;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2017-02-20 12:20:39 +00:00
|
|
|
BITMAP_DEF GetMenuImage() const override;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2013-09-25 19:09:57 +00:00
|
|
|
void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
|
2016-09-25 17:06:49 +00:00
|
|
|
SCH_SHEET_PATH* aSheetPath ) override;
|
2011-10-11 20:23:56 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool operator <( const SCH_ITEM& aItem ) const override;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2012-02-22 21:37:34 +00:00
|
|
|
bool operator==( const SCH_COMPONENT& aComponent) const;
|
|
|
|
bool operator!=( const SCH_COMPONENT& aComponent) const;
|
|
|
|
|
2012-01-09 20:26:55 +00:00
|
|
|
SCH_ITEM& operator=( const SCH_ITEM& aItem );
|
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
bool IsReplaceable() const override { return true; }
|
2011-12-01 16:49:28 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
wxPoint GetPosition() const override { return m_Pos; }
|
2012-03-15 14:31:16 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
void SetPosition( const wxPoint& aPosition ) override { Move( aPosition - m_Pos ); }
|
2012-03-15 14:31:16 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
|
2012-03-15 14:31:16 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const override;
|
2012-03-15 14:31:16 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void Plot( PLOTTER* aPlotter ) override;
|
2012-03-15 14:31:16 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
EDA_ITEM* Clone() const override;
|
2012-03-17 14:39:27 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
#if defined(DEBUG)
|
2016-09-25 17:06:49 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os ) const override;
|
2008-02-26 19:19:54 +00:00
|
|
|
#endif
|
2010-12-10 19:47:44 +00:00
|
|
|
|
|
|
|
private:
|
2016-09-24 18:53:15 +00:00
|
|
|
bool doIsConnected( const wxPoint& aPosition ) const override;
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* COMPONENT_CLASS_H */
|