2009-07-07 17:50:02 +00:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Methodes de base de gestion des classes des elements de schematique */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "class_drawpanel.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "program.h"
|
|
|
|
#include "general.h"
|
|
|
|
|
|
|
|
#include "class_marker_sch.h"
|
|
|
|
#include "erc.h"
|
|
|
|
|
|
|
|
/* Marker are mainly used to show an ERC error
|
|
|
|
* but they could be used to give a specifi info
|
2009-07-08 15:42:45 +00:00
|
|
|
*/
|
2009-07-07 17:50:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
const wxChar* NameMarqueurType[] =
|
|
|
|
{
|
|
|
|
wxT( "" ),
|
|
|
|
wxT( "ERC" ),
|
|
|
|
wxT( "PCB" ),
|
|
|
|
wxT( "SIMUL" ),
|
|
|
|
wxT( "?????" )
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**************************/
|
|
|
|
/* class MARKER_SCH */
|
|
|
|
/**************************/
|
|
|
|
|
2009-07-08 15:42:45 +00:00
|
|
|
MARKER_SCH::MARKER_SCH() :
|
2009-08-01 19:26:05 +00:00
|
|
|
SCH_ITEM( NULL, TYPE_MARKER_SCH ),
|
2009-07-08 15:42:45 +00:00
|
|
|
MARKER_BASE()
|
2009-07-07 17:50:02 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-07-08 15:42:45 +00:00
|
|
|
|
2009-07-07 17:50:02 +00:00
|
|
|
MARKER_SCH::MARKER_SCH( const wxPoint& pos, const wxString& text ) :
|
2009-08-01 19:26:05 +00:00
|
|
|
SCH_ITEM( NULL, TYPE_MARKER_SCH ),
|
2009-07-08 15:42:45 +00:00
|
|
|
MARKER_BASE( 0, pos, text, pos )
|
2009-07-07 17:50:02 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MARKER_SCH::~MARKER_SCH()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MARKER_SCH* MARKER_SCH::GenCopy()
|
|
|
|
{
|
2009-07-08 15:42:45 +00:00
|
|
|
MARKER_SCH* newitem = new MARKER_SCH( GetPos(), GetReporter().GetMainText() );
|
2009-07-07 17:50:02 +00:00
|
|
|
|
2009-07-08 15:42:45 +00:00
|
|
|
newitem->SetMarkerType( GetMarkerType() );
|
|
|
|
newitem->SetErrorLevel( GetErrorLevel() );
|
2009-07-07 17:50:02 +00:00
|
|
|
|
|
|
|
return newitem;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(DEBUG)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Show
|
|
|
|
* is used to output the object tree, currently for debugging only.
|
|
|
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
|
|
|
* of nesting of this object within the overall tree.
|
|
|
|
* @param os The ostream& to output to.
|
|
|
|
*/
|
|
|
|
void MARKER_SCH::Show( int nestLevel, std::ostream& os )
|
|
|
|
{
|
|
|
|
// for now, make it look like XML:
|
|
|
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << GetPos()
|
|
|
|
<< "/>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2009-07-10 12:29:31 +00:00
|
|
|
* Function Save (do nothing : markers are no more saved in files )
|
2009-07-07 17:50:02 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
|
|
|
bool MARKER_SCH::Save( FILE* aFile ) const
|
|
|
|
{
|
2009-07-10 12:29:31 +00:00
|
|
|
return true;
|
2009-07-07 17:50:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
void MARKER_SCH::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
2009-07-08 15:42:45 +00:00
|
|
|
const wxPoint& aOffset, int aDrawMode, int aColor )
|
2009-07-07 17:50:02 +00:00
|
|
|
/****************************************************************************/
|
|
|
|
{
|
|
|
|
EDA_Colors color = (EDA_Colors) m_Color;
|
2009-07-08 15:42:45 +00:00
|
|
|
EDA_Colors tmp = color;
|
|
|
|
|
2009-07-07 17:50:02 +00:00
|
|
|
if( GetMarkerType() == MARK_ERC )
|
|
|
|
{
|
|
|
|
color = (GetErrorLevel() == WAR ) ?
|
2009-07-08 15:42:45 +00:00
|
|
|
(EDA_Colors) g_LayerDescr.LayerColor[LAYER_ERC_WARN] :
|
|
|
|
(EDA_Colors) g_LayerDescr.LayerColor[LAYER_ERC_ERR];
|
2009-07-07 17:50:02 +00:00
|
|
|
}
|
|
|
|
|
2009-07-08 15:42:45 +00:00
|
|
|
if( aColor < 0 )
|
2009-07-07 17:50:02 +00:00
|
|
|
m_Color = color;
|
|
|
|
else
|
|
|
|
m_Color = (EDA_Colors) aColor;
|
|
|
|
|
|
|
|
DrawMarker( aPanel, aDC, aDrawMode, aOffset );
|
|
|
|
m_Color = tmp;
|
|
|
|
}
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
EDA_Rect MARKER_SCH::GetBoundingBox()
|
|
|
|
{
|
|
|
|
return GetBoundingBoxMarker();
|
|
|
|
}
|
|
|
|
|