Implementation of ERC markers.

This commit is contained in:
Jeff Young 2018-09-04 21:53:04 +01:00
parent 47189034aa
commit 5fd20ee786
9 changed files with 71 additions and 30 deletions

View File

@ -295,6 +295,9 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
if( old != UNSPECIFIED_COLOR )
{
if( m_Ident == wxT( "Color4DErcWEx" ) || m_Ident == wxT( "Color4DErcEEx" ) )
*m_Pt_param = COLOR4D( old ).WithAlpha( 0.8 );
else
*m_Pt_param = COLOR4D( old );
return;
}

View File

@ -41,7 +41,7 @@
#include <bitmaps.h>
#include <reporter.h>
#include <wildcards_and_files_ext.h>
#include <sch_view.h>
#include <netlist.h>
#include <netlist_object.h>
#include <sch_marker.h>
@ -629,7 +629,15 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
// Display diags:
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();
// Display message

View File

@ -226,8 +226,8 @@ static PARAM_CFG_ARRAY& cfg_params()
CLR( "Color4DSheetNameEx", LAYER_SHEETNAME, COLOR4D( CYAN ) )
CLR( "Color4DSheetLabelEx", LAYER_SHEETLABEL, COLOR4D( BROWN ) )
CLR( "Color4DNoConnectEx", LAYER_NOCONNECT, COLOR4D( BLUE ) )
CLR( "Color4DErcWEx", LAYER_ERC_WARN, COLOR4D( GREEN ) )
CLR( "Color4DErcEEx", LAYER_ERC_ERR, COLOR4D( RED ) )
CLR( "Color4DErcWEx", LAYER_ERC_WARN, COLOR4D( GREEN ).WithAlpha(0.8 ) )
CLR( "Color4DErcEEx", LAYER_ERC_ERR, COLOR4D( RED ).WithAlpha(0.8 ) )
CLR( "Color4DGridEx", LAYER_SCHEMATIC_GRID, COLOR4D( DARKGRAY ) )
CLR( "Color4DBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND, COLOR4D( WHITE ) )
CLR( "Color4DBrightenedEx", LAYER_BRIGHTENED, COLOR4D( PUREMAGENTA ) )

View File

@ -563,7 +563,6 @@ void SCH_BASE_FRAME::AddToScreen( DLIST<SCH_ITEM>& aItems )
}
GetScreen()->Append( aItems );
}
void SCH_BASE_FRAME::RemoveFromScreen( SCH_ITEM* aItem )

View File

@ -154,13 +154,13 @@ void SCH_DRAW_PANEL::DisplaySheet( const SCH_SHEET* aSheet )
void SCH_DRAW_PANEL::DisplaySheet( const SCH_SCREEN *aScreen )
{
view()->Clear();
if( aScreen )
view()->DisplaySheet( const_cast<SCH_SCREEN*>(aScreen) );
view()->DisplaySheet( const_cast<SCH_SCREEN*>( aScreen ) );
}
void SCH_DRAW_PANEL::OnShow()
{
//m_view->RecacheAllItems();
}

View File

@ -39,6 +39,7 @@
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 ),
MARKER_BASE( 0, pos, text, pos )
{
m_ScalingFactor = 8;
}

View File

@ -1164,7 +1164,8 @@ void SCH_PAINTER::draw ( SCH_SHEET *aSheet, int 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 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 ) );
}
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->SetIsStroke( true );
@ -1197,11 +1199,10 @@ void SCH_PAINTER::draw ( SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
if( aEntry->IsDanglingEnd() )
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->Translate( aBitmap->GetPosition() );
@ -1209,9 +1210,36 @@ void SCH_PAINTER::draw ( SCH_BITMAP *aBitmap, int aLayer )
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();
}

View File

@ -93,7 +93,7 @@ void SCH_VIEW::DisplaySheet( SCH_SCREEN *aSheet )
for( auto item = aSheet->GetDrawItems(); item; item = item->Next() )
{
//printf("-- ADD SCHITEM %p\n", item );
Add(item);
Add( item );
}
m_worksheet.reset ( new KIGFX::WORKSHEET_VIEWITEM( 1, &aSheet->GetPageSettings(), &aSheet->GetTitleBlock() ) );

View File

@ -28,6 +28,7 @@
#include <drc_item.h>
#include <gr_basic.h>
#include <eda_rect.h>
/* Marker are mainly used to show a DRC or ERC error or warning
@ -51,6 +52,8 @@ public:
};
wxPoint m_Pos; ///< position of the marker
int m_ScalingFactor; ///< Scaling factor for m_Size and m_Corners (can
///< set the physical size)
protected:
TYPEMARKER m_MarkerType; ///< The type of marker (useful to filter markers)
@ -59,8 +62,6 @@ protected:
EDA_RECT m_ShapeBoundingBox; ///< Bounding box of the graphic symbol, relative
///< to the position of the shape, used for Hit
///< Tests
int m_ScalingFactor; ///< Scaling factor for m_Size and m_Corners (can
///< set the physical size
DRC_ITEM m_drc;
void init();