2011-10-19 20:32:21 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
|
|
|
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @file sch_marker.h
|
|
|
|
* @brief SCH_MARKER class definition.
|
|
|
|
*/
|
2009-07-07 17:50:02 +00:00
|
|
|
|
2011-12-14 17:25:42 +00:00
|
|
|
#ifndef TYPE_SCH_MARKER_H_
|
|
|
|
#define TYPE_SCH_MARKER_H_
|
2009-07-07 17:50:02 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <sch_item_struct.h>
|
|
|
|
#include <class_marker_base.h>
|
2009-07-07 17:50:02 +00:00
|
|
|
|
|
|
|
/* Marker are mainly used to show an ERC error
|
2010-09-05 17:01:48 +00:00
|
|
|
*/
|
2009-07-07 17:50:02 +00:00
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
enum TypeMarker {
|
|
|
|
/* Markers type */
|
2009-07-07 17:50:02 +00:00
|
|
|
MARK_UNSPEC,
|
|
|
|
MARK_ERC,
|
|
|
|
MARK_PCB,
|
|
|
|
MARK_SIMUL,
|
|
|
|
MARK_NMAX /* Lats value: end of list */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Names for corresponding types of markers: */
|
|
|
|
extern const wxChar* NameMarqueurType[];
|
|
|
|
|
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
class SCH_MARKER : public SCH_ITEM, public MARKER_BASE
|
2009-07-07 17:50:02 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-09-05 17:01:48 +00:00
|
|
|
SCH_MARKER();
|
2012-01-09 20:26:55 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_MARKER( const wxPoint& aPos, const wxString& aText );
|
2012-01-09 20:26:55 +00:00
|
|
|
|
|
|
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
~SCH_MARKER();
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2009-07-07 17:50:02 +00:00
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
return wxT( "SCH_MARKER" );
|
2009-07-07 17:50:02 +00:00
|
|
|
}
|
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
|
2010-12-21 15:13:09 +00:00
|
|
|
int aDraw_mode, int aColor = -1 );
|
2009-07-07 17:50:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Save
|
|
|
|
* writes the data structures for this object out to a FILE in "*.sch"
|
|
|
|
* format.
|
|
|
|
* @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;
|
2009-07-07 17:50:02 +00:00
|
|
|
|
2009-07-08 15:42:45 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingBox
|
|
|
|
* returns the orthogonal, 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.
|
|
|
|
*/
|
2011-03-29 19:33:07 +00:00
|
|
|
virtual EDA_RECT GetBoundingBox() const;
|
2009-07-08 15:42:45 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
// Geometric transforms (used in block operations):
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
/** virtual function Move
|
|
|
|
* move item to a new position.
|
2009-12-02 21:44:03 +00:00
|
|
|
* @param aMoveVector = the displacement vector
|
2009-07-27 14:32:40 +00:00
|
|
|
*/
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Move( const wxPoint& aMoveVector )
|
2009-07-27 14:32:40 +00:00
|
|
|
{
|
|
|
|
m_Pos += aMoveVector;
|
|
|
|
}
|
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
/** virtual function Mirror_Y
|
|
|
|
* mirror item relative to an Y axis
|
|
|
|
* @param aYaxis_position = the y axis position
|
|
|
|
*/
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Mirror_Y( int aYaxis_position );
|
|
|
|
virtual void Rotate( wxPoint rotationPoint );
|
|
|
|
virtual void Mirror_X( int aXaxis_position );
|
2009-07-27 14:32:40 +00:00
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
/**
|
2010-04-06 14:09:52 +00:00
|
|
|
* Compare DRC marker main and auxiliary text against search string.
|
2010-03-16 18:22:59 +00:00
|
|
|
*
|
|
|
|
* @param aSearchData - Criteria to search against.
|
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 the DRC main or auxiliary text matches the search criteria.
|
|
|
|
*/
|
2010-10-20 19:43:58 +00:00
|
|
|
virtual bool Matches( wxFindReplaceData& aSearchData, wxPoint * aFindLocation );
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2010-04-06 14:09:52 +00:00
|
|
|
/**
|
|
|
|
* Show the marker electronics rule check error on the message panel.
|
|
|
|
*
|
|
|
|
* @param aFrame - Top window that owns the message panel.
|
|
|
|
*/
|
2011-03-25 19:16:05 +00:00
|
|
|
void DisplayInfo( EDA_DRAW_FRAME* aFrame );
|
2010-04-06 14:09:52 +00:00
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
virtual bool IsSelectStateChanged( const wxRect& aRect );
|
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
virtual wxString GetSelectMenuText() const { return wxString( _( "ERC Marker" ) ); }
|
|
|
|
|
2011-08-29 03:04:59 +00:00
|
|
|
virtual BITMAP_DEF GetMenuImage() const { return erc_xpm; }
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2009-07-07 17:50:02 +00:00
|
|
|
#if defined(DEBUG)
|
2011-12-14 17:25:42 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os ) const; // override
|
2009-07-07 17:50:02 +00:00
|
|
|
#endif
|
2010-12-13 15:59:00 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
|
2010-12-21 15:13:09 +00:00
|
|
|
virtual EDA_ITEM* doClone() const;
|
2011-10-19 20:32:21 +00:00
|
|
|
virtual wxPoint doGetPosition() const { return m_Pos; }
|
|
|
|
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
|
2009-07-07 17:50:02 +00:00
|
|
|
};
|
|
|
|
|
2011-12-14 17:25:42 +00:00
|
|
|
#endif // TYPE_SCH_MARKER_H_
|