Implementation of ERC markers.
This commit is contained in:
parent
47189034aa
commit
5fd20ee786
|
@ -295,7 +295,10 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
|
||||||
|
|
||||||
if( old != UNSPECIFIED_COLOR )
|
if( old != UNSPECIFIED_COLOR )
|
||||||
{
|
{
|
||||||
*m_Pt_param = COLOR4D( old );
|
if( m_Ident == wxT( "Color4DErcWEx" ) || m_Ident == wxT( "Color4DErcEEx" ) )
|
||||||
|
*m_Pt_param = COLOR4D( old ).WithAlpha( 0.8 );
|
||||||
|
else
|
||||||
|
*m_Pt_param = COLOR4D( old );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
#include <reporter.h>
|
#include <reporter.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
#include <sch_view.h>
|
||||||
#include <netlist.h>
|
#include <netlist.h>
|
||||||
#include <netlist_object.h>
|
#include <netlist_object.h>
|
||||||
#include <sch_marker.h>
|
#include <sch_marker.h>
|
||||||
|
@ -629,7 +629,15 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
||||||
// Display diags:
|
// Display diags:
|
||||||
DisplayERC_MarkersList();
|
DisplayERC_MarkersList();
|
||||||
|
|
||||||
// Display new markers:
|
// Display new markers from the current screen:
|
||||||
|
KIGFX::VIEW* view = m_parent->GetCanvas()->GetView();
|
||||||
|
|
||||||
|
for( auto item = m_parent->GetScreen()->GetDrawItems(); item; item = item->Next() )
|
||||||
|
{
|
||||||
|
if( item->Type() == SCH_MARKER_T )
|
||||||
|
view->Add( item );
|
||||||
|
}
|
||||||
|
|
||||||
m_parent->GetCanvas()->Refresh();
|
m_parent->GetCanvas()->Refresh();
|
||||||
|
|
||||||
// Display message
|
// Display message
|
||||||
|
|
|
@ -226,8 +226,8 @@ static PARAM_CFG_ARRAY& cfg_params()
|
||||||
CLR( "Color4DSheetNameEx", LAYER_SHEETNAME, COLOR4D( CYAN ) )
|
CLR( "Color4DSheetNameEx", LAYER_SHEETNAME, COLOR4D( CYAN ) )
|
||||||
CLR( "Color4DSheetLabelEx", LAYER_SHEETLABEL, COLOR4D( BROWN ) )
|
CLR( "Color4DSheetLabelEx", LAYER_SHEETLABEL, COLOR4D( BROWN ) )
|
||||||
CLR( "Color4DNoConnectEx", LAYER_NOCONNECT, COLOR4D( BLUE ) )
|
CLR( "Color4DNoConnectEx", LAYER_NOCONNECT, COLOR4D( BLUE ) )
|
||||||
CLR( "Color4DErcWEx", LAYER_ERC_WARN, COLOR4D( GREEN ) )
|
CLR( "Color4DErcWEx", LAYER_ERC_WARN, COLOR4D( GREEN ).WithAlpha(0.8 ) )
|
||||||
CLR( "Color4DErcEEx", LAYER_ERC_ERR, COLOR4D( RED ) )
|
CLR( "Color4DErcEEx", LAYER_ERC_ERR, COLOR4D( RED ).WithAlpha(0.8 ) )
|
||||||
CLR( "Color4DGridEx", LAYER_SCHEMATIC_GRID, COLOR4D( DARKGRAY ) )
|
CLR( "Color4DGridEx", LAYER_SCHEMATIC_GRID, COLOR4D( DARKGRAY ) )
|
||||||
CLR( "Color4DBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND, COLOR4D( WHITE ) )
|
CLR( "Color4DBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND, COLOR4D( WHITE ) )
|
||||||
CLR( "Color4DBrightenedEx", LAYER_BRIGHTENED, COLOR4D( PUREMAGENTA ) )
|
CLR( "Color4DBrightenedEx", LAYER_BRIGHTENED, COLOR4D( PUREMAGENTA ) )
|
||||||
|
|
|
@ -546,24 +546,23 @@ void EDA_DRAW_FRAME::createCanvas()
|
||||||
|
|
||||||
void SCH_BASE_FRAME::AddToScreen( SCH_ITEM* aItem )
|
void SCH_BASE_FRAME::AddToScreen( SCH_ITEM* aItem )
|
||||||
{
|
{
|
||||||
GetScreen()->Append( aItem );
|
GetScreen()->Append( aItem );
|
||||||
GetCanvas()->GetView()->Add( aItem );
|
GetCanvas()->GetView()->Add( aItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCH_BASE_FRAME::AddToScreen( DLIST<SCH_ITEM>& aItems )
|
void SCH_BASE_FRAME::AddToScreen( DLIST<SCH_ITEM>& aItems )
|
||||||
{
|
{
|
||||||
std::vector<SCH_ITEM*> tmp;
|
std::vector<SCH_ITEM*> tmp;
|
||||||
SCH_ITEM* itemList = aItems.begin();
|
SCH_ITEM* itemList = aItems.begin();
|
||||||
|
|
||||||
while( itemList )
|
while( itemList )
|
||||||
{
|
{
|
||||||
itemList->SetList( nullptr );
|
itemList->SetList( nullptr );
|
||||||
GetCanvas()->GetView()->Add( itemList );
|
GetCanvas()->GetView()->Add( itemList );
|
||||||
itemList = itemList->Next();
|
itemList = itemList->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->Append( aItems );
|
|
||||||
|
|
||||||
|
GetScreen()->Append( aItems );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCH_BASE_FRAME::RemoveFromScreen( SCH_ITEM* aItem )
|
void SCH_BASE_FRAME::RemoveFromScreen( SCH_ITEM* aItem )
|
||||||
|
|
|
@ -154,13 +154,13 @@ void SCH_DRAW_PANEL::DisplaySheet( const SCH_SHEET* aSheet )
|
||||||
void SCH_DRAW_PANEL::DisplaySheet( const SCH_SCREEN *aScreen )
|
void SCH_DRAW_PANEL::DisplaySheet( const SCH_SCREEN *aScreen )
|
||||||
{
|
{
|
||||||
view()->Clear();
|
view()->Clear();
|
||||||
|
|
||||||
if( aScreen )
|
if( aScreen )
|
||||||
view()->DisplaySheet( const_cast<SCH_SCREEN*>(aScreen) );
|
view()->DisplaySheet( const_cast<SCH_SCREEN*>( aScreen ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCH_DRAW_PANEL::OnShow()
|
void SCH_DRAW_PANEL::OnShow()
|
||||||
{
|
{
|
||||||
|
|
||||||
//m_view->RecacheAllItems();
|
//m_view->RecacheAllItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
SCH_MARKER::SCH_MARKER() : SCH_ITEM( NULL, SCH_MARKER_T ), MARKER_BASE()
|
SCH_MARKER::SCH_MARKER() : SCH_ITEM( NULL, SCH_MARKER_T ), MARKER_BASE()
|
||||||
{
|
{
|
||||||
|
m_ScalingFactor = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ SCH_MARKER::SCH_MARKER( const wxPoint& pos, const wxString& text ) :
|
||||||
SCH_ITEM( NULL, SCH_MARKER_T ),
|
SCH_ITEM( NULL, SCH_MARKER_T ),
|
||||||
MARKER_BASE( 0, pos, text, pos )
|
MARKER_BASE( 0, pos, text, pos )
|
||||||
{
|
{
|
||||||
|
m_ScalingFactor = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1164,7 +1164,8 @@ void SCH_PAINTER::draw ( SCH_SHEET *aSheet, int aLayer )
|
||||||
draw( static_cast<SCH_HIERLABEL*>( &sheetPin ), aLayer );
|
draw( static_cast<SCH_HIERLABEL*>( &sheetPin ), aLayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCH_PAINTER::draw ( SCH_NO_CONNECT *aNC, int aLayer )
|
|
||||||
|
void SCH_PAINTER::draw( SCH_NO_CONNECT *aNC, int aLayer )
|
||||||
{
|
{
|
||||||
int delta = aNC->GetSize().x / 2;
|
int delta = aNC->GetSize().x / 2;
|
||||||
int width = GetDefaultLineThickness();
|
int width = GetDefaultLineThickness();
|
||||||
|
@ -1180,7 +1181,8 @@ void SCH_PAINTER::draw ( SCH_NO_CONNECT *aNC, int aLayer )
|
||||||
m_gal->DrawLine( p + VECTOR2D(-delta, delta), p+VECTOR2D( delta, -delta ) );
|
m_gal->DrawLine( p + VECTOR2D(-delta, delta), p+VECTOR2D( delta, -delta ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCH_PAINTER::draw ( SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
|
|
||||||
|
void SCH_PAINTER::draw( SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
|
||||||
{
|
{
|
||||||
m_gal->SetStrokeColor( GetLayerColor( LAYER_BUS ) );
|
m_gal->SetStrokeColor( GetLayerColor( LAYER_BUS ) );
|
||||||
m_gal->SetIsStroke( true );
|
m_gal->SetIsStroke( true );
|
||||||
|
@ -1197,11 +1199,10 @@ void SCH_PAINTER::draw ( SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
|
||||||
|
|
||||||
if( aEntry->IsDanglingEnd() )
|
if( aEntry->IsDanglingEnd() )
|
||||||
m_gal->DrawCircle( endPos, TARGET_BUSENTRY_RADIUS );
|
m_gal->DrawCircle( endPos, TARGET_BUSENTRY_RADIUS );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCH_PAINTER::draw ( SCH_BITMAP *aBitmap, int aLayer )
|
|
||||||
|
void SCH_PAINTER::draw( SCH_BITMAP *aBitmap, int aLayer )
|
||||||
{
|
{
|
||||||
m_gal->Save();
|
m_gal->Save();
|
||||||
m_gal->Translate( aBitmap->GetPosition() );
|
m_gal->Translate( aBitmap->GetPosition() );
|
||||||
|
@ -1209,9 +1210,36 @@ void SCH_PAINTER::draw ( SCH_BITMAP *aBitmap, int aLayer )
|
||||||
m_gal->Restore();
|
m_gal->Restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCH_PAINTER::draw ( SCH_MARKER *aMarker, int aLayer )
|
|
||||||
{
|
|
||||||
|
|
||||||
|
void SCH_PAINTER::draw( SCH_MARKER *aMarker, int aLayer )
|
||||||
|
{
|
||||||
|
const int scale = aMarker->m_ScalingFactor;
|
||||||
|
|
||||||
|
// If you are changing this, update the bounding box as well
|
||||||
|
const VECTOR2D arrow[] = {
|
||||||
|
VECTOR2D( 0 * scale, 0 * scale ),
|
||||||
|
VECTOR2D( 8 * scale, 1 * scale ),
|
||||||
|
VECTOR2D( 4 * scale, 3 * scale ),
|
||||||
|
VECTOR2D( 13 * scale, 8 * scale ),
|
||||||
|
VECTOR2D( 9 * scale, 9 * scale ),
|
||||||
|
VECTOR2D( 8 * scale, 13 * scale ),
|
||||||
|
VECTOR2D( 3 * scale, 4 * scale ),
|
||||||
|
VECTOR2D( 1 * scale, 8 * scale ),
|
||||||
|
VECTOR2D( 0 * scale, 0 * scale )
|
||||||
|
};
|
||||||
|
|
||||||
|
COLOR4D color = GetLayerColor( LAYER_ERC_WARN );
|
||||||
|
|
||||||
|
if( aMarker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_ERROR )
|
||||||
|
color = GetLayerColor( LAYER_ERC_ERR );
|
||||||
|
|
||||||
|
m_gal->Save();
|
||||||
|
m_gal->Translate( aMarker->GetPosition() );
|
||||||
|
m_gal->SetFillColor( color );
|
||||||
|
m_gal->SetIsFill( true );
|
||||||
|
m_gal->SetIsStroke( false );
|
||||||
|
m_gal->DrawPolygon( arrow, sizeof( arrow ) / sizeof( VECTOR2D ) );
|
||||||
|
m_gal->Restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ void SCH_VIEW::DisplaySheet( SCH_SCREEN *aSheet )
|
||||||
for( auto item = aSheet->GetDrawItems(); item; item = item->Next() )
|
for( auto item = aSheet->GetDrawItems(); item; item = item->Next() )
|
||||||
{
|
{
|
||||||
//printf("-- ADD SCHITEM %p\n", item );
|
//printf("-- ADD SCHITEM %p\n", item );
|
||||||
Add(item);
|
Add( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_worksheet.reset ( new KIGFX::WORKSHEET_VIEWITEM( 1, &aSheet->GetPageSettings(), &aSheet->GetTitleBlock() ) );
|
m_worksheet.reset ( new KIGFX::WORKSHEET_VIEWITEM( 1, &aSheet->GetPageSettings(), &aSheet->GetTitleBlock() ) );
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <drc_item.h>
|
#include <drc_item.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
|
#include <eda_rect.h>
|
||||||
|
|
||||||
|
|
||||||
/* Marker are mainly used to show a DRC or ERC error or warning
|
/* Marker are mainly used to show a DRC or ERC error or warning
|
||||||
|
@ -51,16 +52,16 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
wxPoint m_Pos; ///< position of the marker
|
wxPoint m_Pos; ///< position of the marker
|
||||||
|
int m_ScalingFactor; ///< Scaling factor for m_Size and m_Corners (can
|
||||||
|
///< set the physical size)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TYPEMARKER m_MarkerType; ///< The type of marker (useful to filter markers)
|
TYPEMARKER m_MarkerType; ///< The type of marker (useful to filter markers)
|
||||||
MARKER_SEVERITY m_ErrorLevel; ///< Specify the severity of the error
|
MARKER_SEVERITY m_ErrorLevel; ///< Specify the severity of the error
|
||||||
COLOR4D m_Color; ///< color
|
COLOR4D m_Color; ///< color
|
||||||
EDA_RECT m_ShapeBoundingBox; ///< Bounding box of the graphic symbol, relative
|
EDA_RECT m_ShapeBoundingBox; ///< Bounding box of the graphic symbol, relative
|
||||||
///< to the position of the shape, used for Hit
|
///< to the position of the shape, used for Hit
|
||||||
///< Tests
|
///< Tests
|
||||||
int m_ScalingFactor; ///< Scaling factor for m_Size and m_Corners (can
|
|
||||||
///< set the physical size
|
|
||||||
DRC_ITEM m_drc;
|
DRC_ITEM m_drc;
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
Loading…
Reference in New Issue