diff --git a/common/config_params.cpp b/common/config_params.cpp index 1f566b2006..7bad36d9d7 100644 --- a/common/config_params.cpp +++ b/common/config_params.cpp @@ -295,7 +295,10 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const 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; } diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index 149255b32d..3154b4f585 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -41,7 +41,7 @@ #include #include #include - +#include #include #include #include @@ -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 diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 1abee0bf04..1db3dcbb04 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -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 ) ) diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 9118ffe732..e653559fe0 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -546,24 +546,23 @@ void EDA_DRAW_FRAME::createCanvas() void SCH_BASE_FRAME::AddToScreen( SCH_ITEM* aItem ) { - GetScreen()->Append( aItem ); - GetCanvas()->GetView()->Add( aItem ); + GetScreen()->Append( aItem ); + GetCanvas()->GetView()->Add( aItem ); } void SCH_BASE_FRAME::AddToScreen( DLIST& aItems ) { std::vector tmp; - SCH_ITEM* itemList = aItems.begin(); + SCH_ITEM* itemList = aItems.begin(); - while( itemList ) - { - itemList->SetList( nullptr ); - GetCanvas()->GetView()->Add( itemList ); - itemList = itemList->Next(); - } - - GetScreen()->Append( aItems ); + while( itemList ) + { + itemList->SetList( nullptr ); + GetCanvas()->GetView()->Add( itemList ); + itemList = itemList->Next(); + } + GetScreen()->Append( aItems ); } void SCH_BASE_FRAME::RemoveFromScreen( SCH_ITEM* aItem ) diff --git a/eeschema/sch_draw_panel.cpp b/eeschema/sch_draw_panel.cpp index 4ab065b0fa..7a07f981b8 100644 --- a/eeschema/sch_draw_panel.cpp +++ b/eeschema/sch_draw_panel.cpp @@ -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(aScreen) ); + view()->DisplaySheet( const_cast( aScreen ) ); } void SCH_DRAW_PANEL::OnShow() { - //m_view->RecacheAllItems(); } diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index 641b8d21c9..debac65032 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -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; } diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index f8714b1779..6170bd1217 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -1164,7 +1164,8 @@ void SCH_PAINTER::draw ( SCH_SHEET *aSheet, int aLayer ) draw( static_cast( &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(); } diff --git a/eeschema/sch_view.cpp b/eeschema/sch_view.cpp index b3f0e8f270..bd3e0b00be 100644 --- a/eeschema/sch_view.cpp +++ b/eeschema/sch_view.cpp @@ -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() ) ); diff --git a/include/marker_base.h b/include/marker_base.h index 2d2fb72fc9..271fae04e9 100644 --- a/include/marker_base.h +++ b/include/marker_base.h @@ -28,6 +28,7 @@ #include #include +#include /* 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 + 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) MARKER_SEVERITY m_ErrorLevel; ///< Specify the severity of the error COLOR4D m_Color; ///< color 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 + ///< to the position of the shape, used for Hit + ///< Tests DRC_ITEM m_drc; void init();