From 44640422f2bc0759d4c805be62c15dd1f9cfe030 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 19 Apr 2023 14:08:41 +0100 Subject: [PATCH] Copy RC_ITEM fix to ERC_ITEM (where it's actually needed). Fixes https://gitlab.com/kicad/code/kicad/issues/14569 --- eeschema/erc_item.cpp | 51 ++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/eeschema/erc_item.cpp b/eeschema/erc_item.cpp index 3a1c53aea7..8c2d71acbe 100644 --- a/eeschema/erc_item.cpp +++ b/eeschema/erc_item.cpp @@ -287,44 +287,41 @@ void ERC_TREE_MODEL::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem, { const RC_TREE_NODE* node = ToNode( aItem ); const std::shared_ptr rcItem = node->m_RcItem; + MARKER_BASE* marker = rcItem->GetParent(); + EDA_ITEM* item = nullptr; + wxString msg; switch( node->m_Type ) { case RC_TREE_NODE::MARKER: - { - wxString prefix; - - if( rcItem->GetParent() ) + if( marker ) { SEVERITY severity = rcItem->GetParent()->GetSeverity(); if( severity == RPT_SEVERITY_EXCLUSION ) { if( m_editFrame->GetSeverity( rcItem->GetErrorCode() ) == RPT_SEVERITY_WARNING ) - prefix = _( "Excluded warning: " ); + msg = _( "Excluded warning: " ); else - prefix = _( "Excluded error: " ); + msg = _( "Excluded error: " ); } else if( severity == RPT_SEVERITY_WARNING ) { - prefix = _( "Warning: " ); + msg = _( "Warning: " ); } else { - prefix = _( "Error: " ); + msg = _( "Error: " ); } } - aVariant = prefix + rcItem->GetErrorMessage(); - } - break; + msg += rcItem->GetErrorMessage(); + break; case RC_TREE_NODE::MAIN_ITEM: - if( rcItem->GetParent() - && rcItem->GetParent()->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET ) + if( marker && marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET ) { - aVariant = _( "Drawing Sheet" ); - break; + msg = _( "Drawing Sheet" ); } else { @@ -338,8 +335,8 @@ void ERC_TREE_MODEL::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem, if( ercItem->MainItemHasSheetPath() ) ercItem->GetMainItemSheetPath().UpdateAllScreenReferences(); - EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetMainItemID() ); - aVariant = item->GetItemDescription( m_editFrame ); + item = m_editFrame->GetItem( rcItem->GetMainItemID() ); + msg = item->GetItemDescription( m_editFrame ); // Reset reference fields to current visible sheet if( ercItem->MainItemHasSheetPath() ) @@ -360,8 +357,8 @@ void ERC_TREE_MODEL::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem, if( ercItem->AuxItemHasSheetPath() ) ercItem->GetAuxItemSheetPath().UpdateAllScreenReferences(); - EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItemID() ); - aVariant = item->GetItemDescription( m_editFrame ); + item = m_editFrame->GetItem( rcItem->GetAuxItemID() ); + msg = item->GetItemDescription( m_editFrame ); // Reset reference fields to current visible sheet if( ercItem->AuxItemHasSheetPath() ) @@ -370,17 +367,11 @@ void ERC_TREE_MODEL::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem, break; case RC_TREE_NODE::AUX_ITEM2: - { - EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItem2ID() ); - aVariant = item->GetItemDescription( m_editFrame ); - } - break; - case RC_TREE_NODE::AUX_ITEM3: - { - EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItem3ID() ); - aVariant = item->GetItemDescription( m_editFrame ); - } - break; + UNIMPLEMENTED_FOR( wxS( "AUX_ITEM2 or AUX_ITEM3" ) ); + break; } + + msg.Replace( wxS( "\n" ), wxS( " " ) ); + aVariant = msg; }