Copy RC_ITEM fix to ERC_ITEM (where it's actually needed).

Fixes https://gitlab.com/kicad/code/kicad/issues/14569
This commit is contained in:
Jeff Young 2023-04-19 14:08:41 +01:00
parent be91f378ac
commit 44640422f2
1 changed files with 21 additions and 30 deletions

View File

@ -287,44 +287,41 @@ void ERC_TREE_MODEL::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
{ {
const RC_TREE_NODE* node = ToNode( aItem ); const RC_TREE_NODE* node = ToNode( aItem );
const std::shared_ptr<RC_ITEM> rcItem = node->m_RcItem; const std::shared_ptr<RC_ITEM> rcItem = node->m_RcItem;
MARKER_BASE* marker = rcItem->GetParent();
EDA_ITEM* item = nullptr;
wxString msg;
switch( node->m_Type ) switch( node->m_Type )
{ {
case RC_TREE_NODE::MARKER: case RC_TREE_NODE::MARKER:
{ if( marker )
wxString prefix;
if( rcItem->GetParent() )
{ {
SEVERITY severity = rcItem->GetParent()->GetSeverity(); SEVERITY severity = rcItem->GetParent()->GetSeverity();
if( severity == RPT_SEVERITY_EXCLUSION ) if( severity == RPT_SEVERITY_EXCLUSION )
{ {
if( m_editFrame->GetSeverity( rcItem->GetErrorCode() ) == RPT_SEVERITY_WARNING ) if( m_editFrame->GetSeverity( rcItem->GetErrorCode() ) == RPT_SEVERITY_WARNING )
prefix = _( "Excluded warning: " ); msg = _( "Excluded warning: " );
else else
prefix = _( "Excluded error: " ); msg = _( "Excluded error: " );
} }
else if( severity == RPT_SEVERITY_WARNING ) else if( severity == RPT_SEVERITY_WARNING )
{ {
prefix = _( "Warning: " ); msg = _( "Warning: " );
} }
else else
{ {
prefix = _( "Error: " ); msg = _( "Error: " );
} }
} }
aVariant = prefix + rcItem->GetErrorMessage(); msg += rcItem->GetErrorMessage();
} break;
break;
case RC_TREE_NODE::MAIN_ITEM: case RC_TREE_NODE::MAIN_ITEM:
if( rcItem->GetParent() if( marker && marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
&& rcItem->GetParent()->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
{ {
aVariant = _( "Drawing Sheet" ); msg = _( "Drawing Sheet" );
break;
} }
else else
{ {
@ -338,8 +335,8 @@ void ERC_TREE_MODEL::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
if( ercItem->MainItemHasSheetPath() ) if( ercItem->MainItemHasSheetPath() )
ercItem->GetMainItemSheetPath().UpdateAllScreenReferences(); ercItem->GetMainItemSheetPath().UpdateAllScreenReferences();
EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetMainItemID() ); item = m_editFrame->GetItem( rcItem->GetMainItemID() );
aVariant = item->GetItemDescription( m_editFrame ); msg = item->GetItemDescription( m_editFrame );
// Reset reference fields to current visible sheet // Reset reference fields to current visible sheet
if( ercItem->MainItemHasSheetPath() ) if( ercItem->MainItemHasSheetPath() )
@ -360,8 +357,8 @@ void ERC_TREE_MODEL::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
if( ercItem->AuxItemHasSheetPath() ) if( ercItem->AuxItemHasSheetPath() )
ercItem->GetAuxItemSheetPath().UpdateAllScreenReferences(); ercItem->GetAuxItemSheetPath().UpdateAllScreenReferences();
EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItemID() ); item = m_editFrame->GetItem( rcItem->GetAuxItemID() );
aVariant = item->GetItemDescription( m_editFrame ); msg = item->GetItemDescription( m_editFrame );
// Reset reference fields to current visible sheet // Reset reference fields to current visible sheet
if( ercItem->AuxItemHasSheetPath() ) if( ercItem->AuxItemHasSheetPath() )
@ -370,17 +367,11 @@ void ERC_TREE_MODEL::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
break; break;
case RC_TREE_NODE::AUX_ITEM2: 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: case RC_TREE_NODE::AUX_ITEM3:
{ UNIMPLEMENTED_FOR( wxS( "AUX_ITEM2 or AUX_ITEM3" ) );
EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItem3ID() ); break;
aVariant = item->GetItemDescription( m_editFrame );
}
break;
} }
msg.Replace( wxS( "\n" ), wxS( " " ) );
aVariant = msg;
} }