2011-10-11 20:23:56 +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
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_field.h"
|
2010-10-20 20:24:26 +00:00
|
|
|
#include "transform.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
#include "general.h"
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2008-10-06 05:44:29 +00:00
|
|
|
|
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;
|
|
|
|
class LIB_COMPONENT;
|
2008-03-20 01:50:21 +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
|
2010-09-05 17:01:48 +00:00
|
|
|
typedef std::vector<SCH_FIELD> SCH_FIELDS;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2011-10-19 20:32:21 +00:00
|
|
|
wxPoint m_Pos;
|
2010-12-14 21:39:31 +00:00
|
|
|
wxString m_ChipName; ///< Name to look for in the library, i.e. "74LS00".
|
|
|
|
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.
|
2008-10-06 05:44:29 +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 ) );
|
|
|
|
|
2011-03-29 19:33:07 +00:00
|
|
|
EDA_RECT GetBodyBoundingBox() const;
|
2010-12-13 15:59:00 +00:00
|
|
|
|
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.
|
|
|
|
*
|
|
|
|
* @param libComponent - Component library object to create schematic
|
|
|
|
* component from.
|
2009-10-30 19:26:25 +00:00
|
|
|
* @param sheet - 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.
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_SHEET_PATH* sheet,
|
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
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
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
|
|
|
|
2010-12-14 15:56:30 +00:00
|
|
|
wxString GetLibName() const { return m_ChipName; }
|
|
|
|
|
|
|
|
void SetLibName( const wxString& aName );
|
|
|
|
|
|
|
|
int GetUnit() const { return m_unit; }
|
|
|
|
|
|
|
|
void SetUnit( int aUnit );
|
|
|
|
|
|
|
|
int GetConvert() const { return m_convert; }
|
|
|
|
|
|
|
|
void SetConvert( int aConvert );
|
|
|
|
|
|
|
|
wxString GetPrefix() const { return m_prefix; }
|
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Function GetPartCount
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
int GetPartCount() const;
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
2010-12-14 21:39:31 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.sch" format.
|
2008-04-15 19:38:19 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
2010-09-05 17:01:48 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
/**
|
|
|
|
* Load schematic component from \a aLine in a .sch file.
|
|
|
|
*
|
2010-12-14 21:39:31 +00:00
|
|
|
* @param aLine Essentially this is file to read the component from.
|
|
|
|
* @param aErrorMsg Description of the error if an error occurs while loading the component.
|
2010-11-10 15:30:12 +00:00
|
|
|
* @return True if the component loaded successfully.
|
|
|
|
*/
|
|
|
|
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
|
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
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
void DisplayInfo( EDA_DRAW_FRAME* frame );
|
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)
|
2010-12-31 19:47:39 +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
|
|
|
*/
|
2011-03-25 19:16:05 +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
|
|
|
|
*/
|
2011-03-25 19:16:05 +00:00
|
|
|
void SetTimeStamp( long aNewTimeStamp );
|
2009-04-25 10:12:30 +00:00
|
|
|
|
2009-11-28 09:24:37 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingBox
|
2010-12-14 21:39:31 +00:00
|
|
|
* returns the bounding box of this object for display purposes. This box should be an
|
|
|
|
* enclosing perimeter for visible components of this object, and the units should be
|
|
|
|
* in the pcb or schematic coordinate system. It is OK to overestimate the size by a
|
|
|
|
* few counts.
|
|
|
|
* @return The bounding rectangle of the component.
|
2009-11-28 09:24:37 +00:00
|
|
|
*/
|
2011-03-29 19:33:07 +00:00
|
|
|
EDA_RECT GetBoundingBox() const;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
/**
|
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
|
|
|
*/
|
2010-06-17 16:30:10 +00:00
|
|
|
SCH_FIELD* FindField( const wxString& aFieldName );
|
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
|
|
|
|
}
|
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
//-----</Fields>----------------------------------------------------------
|
2008-11-26 00:20:16 +00:00
|
|
|
|
2008-10-06 05:44:29 +00:00
|
|
|
/**
|
|
|
|
* Function GetFieldCount
|
|
|
|
* returns the number of fields in this component.
|
|
|
|
*/
|
|
|
|
int GetFieldCount() const { return (int) m_Fields.size(); }
|
2008-02-26 19:19:54 +00:00
|
|
|
|
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 );
|
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
virtual void Draw( EDA_DRAW_PANEL* panel,
|
|
|
|
wxDC* DC,
|
|
|
|
const wxPoint& offset,
|
|
|
|
int draw_mode,
|
|
|
|
int Color = -1 )
|
2009-10-16 17:18:23 +00:00
|
|
|
{
|
|
|
|
Draw( panel, DC, offset, draw_mode, Color, true );
|
|
|
|
}
|
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* panel,
|
|
|
|
wxDC* DC,
|
|
|
|
const wxPoint& offset,
|
|
|
|
int draw_mode,
|
|
|
|
int Color,
|
|
|
|
bool DrawPinText );
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2011-04-08 17:41:52 +00:00
|
|
|
virtual void SwapData( SCH_ITEM* aItem );
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
// returns a unique ID, in the form of a path.
|
2011-03-25 19:16:05 +00:00
|
|
|
wxString GetPath( SCH_SHEET_PATH* sheet );
|
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
|
|
|
|
*/
|
|
|
|
static bool IsReferenceStringValid( const wxString &aReferenceString );
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
/**
|
|
|
|
* Function GetRef
|
|
|
|
* returns the reference, for the given sheet path.
|
|
|
|
*/
|
2010-09-05 17:01:48 +00:00
|
|
|
const wxString GetRef( 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.
|
|
|
|
*/
|
2011-03-25 19:16:05 +00:00
|
|
|
void SetRef( 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
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
// returns the unit selection, for the given sheet path.
|
2011-03-25 19:16:05 +00:00
|
|
|
int GetUnitSelection( SCH_SHEET_PATH* aSheet );
|
2008-10-06 05:44:29 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
// Set the unit selection, for the given sheet path.
|
2011-03-25 19:16:05 +00:00
|
|
|
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
|
|
|
|
2010-12-14 21:39:31 +00:00
|
|
|
/**
|
|
|
|
* Function Move
|
|
|
|
* moves item to a new position by \a aMoveVector.
|
|
|
|
* @param aMoveVector The displacement to move the component
|
2009-07-27 14:32:40 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
virtual void Move( const wxPoint& aMoveVector )
|
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
|
|
|
|
2010-12-14 21:39:31 +00:00
|
|
|
/**
|
|
|
|
* Function Mirror_Y
|
|
|
|
* mirrors the component relative to an Y axis about the \a aYaxis_position.
|
|
|
|
* @param aYaxis_position The y axis position
|
2009-07-27 14:32:40 +00:00
|
|
|
*/
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Mirror_Y( int aYaxis_position );
|
2010-12-14 21:39:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Mirror_X (virtual)
|
|
|
|
* mirrors item relative to an X axis about the \a aXaxis_position.
|
|
|
|
* @param aXaxis_position The x axis position
|
|
|
|
*/
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Mirror_X( int aXaxis_position );
|
|
|
|
|
2010-12-14 21:39:31 +00:00
|
|
|
virtual void Rotate( wxPoint rotationPoint );
|
2009-07-27 14:32:40 +00:00
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
/**
|
2010-12-14 21:39:31 +00:00
|
|
|
* Function Matches
|
|
|
|
* compares component reference and value fields against \a aSearchData.
|
2010-03-16 18:22:59 +00:00
|
|
|
*
|
2010-12-14 21:39:31 +00:00
|
|
|
* @param aSearchData Criteria to search against.
|
|
|
|
* @param aAuxData Pointer to auxiliary data, if needed.
|
|
|
|
* Used when searching string in REFERENCE field we must know the sheet path
|
2010-10-20 19:43:58 +00:00
|
|
|
* @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
|
2010-03-16 18:22:59 +00:00
|
|
|
* @return True if this component reference or value field matches the search criteria.
|
|
|
|
*/
|
2010-11-03 14:13:15 +00:00
|
|
|
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
|
|
|
|
|
|
|
|
virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
|
|
|
|
|
|
|
|
wxPoint GetPinPhysicalPosition( LIB_PIN* Pin );
|
|
|
|
|
|
|
|
virtual bool IsSelectStateChanged( const wxRect& aRect );
|
|
|
|
|
2011-01-07 19:24:24 +00:00
|
|
|
virtual bool IsConnectable() const { return true; }
|
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
virtual SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
|
|
|
|
const KICAD_T scanTypes[] );
|
|
|
|
|
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
|
|
|
|
|
|
|
virtual wxString GetSelectMenuText() const;
|
|
|
|
|
2011-08-29 03:04:59 +00:00
|
|
|
virtual BITMAP_DEF GetMenuImage() const { return add_component_xpm; }
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2011-10-11 20:23:56 +00:00
|
|
|
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
|
|
|
|
SCH_SHEET_PATH* aSheetPath );
|
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
virtual bool operator <( const SCH_ITEM& aItem ) const;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
#if defined(DEBUG)
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
/**
|
|
|
|
* Function Show
|
|
|
|
* is used to output the object tree, currently for debugging only.
|
2008-02-26 19:19:54 +00:00
|
|
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
2007-09-20 21:06:49 +00:00
|
|
|
* of nesting of this object within the overall tree.
|
|
|
|
* @param os The ostream& to output to.
|
|
|
|
*/
|
2011-03-25 19:16:05 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os );
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
#endif
|
2010-12-10 19:47:44 +00:00
|
|
|
|
|
|
|
private:
|
2011-03-25 19:16:05 +00:00
|
|
|
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
|
2011-03-29 19:33:07 +00:00
|
|
|
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
|
2010-12-21 15:13:09 +00:00
|
|
|
virtual bool doIsConnected( const wxPoint& aPosition ) const;
|
|
|
|
virtual EDA_ITEM* doClone() const;
|
2011-06-17 13:24:22 +00:00
|
|
|
virtual void doPlot( PLOTTER* aPlotter );
|
2011-10-19 20:32:21 +00:00
|
|
|
virtual wxPoint doGetPosition() const { return m_Pos; }
|
2011-10-19 23:17:28 +00:00
|
|
|
virtual void doSetPosition( const wxPoint& aPosition ) { Move( aPosition - m_Pos ); }
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* COMPONENT_CLASS_H */
|