Add FocusOnLocation for second items in ERC markers.

Fixes: lp:4237
* https://bugs.launchpad.net/kicad/+bug/4237
This commit is contained in:
Jeff Young 2020-04-22 23:34:49 +01:00
parent 36d716bb50
commit aec3649524
3 changed files with 29 additions and 5 deletions

View File

@ -83,7 +83,10 @@ public:
{ {
href.Printf( wxT( "href='%d'" ), ii ); href.Printf( wxT( "href='%d'" ), ii );
marker_text = m_MarkerListReferences[ii]->GetReporter().ShowHtml( aUnits ); marker_text = m_MarkerListReferences[ii]->GetReporter().ShowHtml( aUnits );
marker_text.Replace( wxT( "href=''"), href ); marker_text.Replace( wxT( "href=''"), href, false );
href.Printf( wxT( "href='%d'" ), -ii );
marker_text.Replace( wxT( "href=''"), href, false );
htmlpage += marker_text; htmlpage += marker_text;
} }

View File

@ -213,10 +213,17 @@ void DIALOG_ERC::OnLeftClickMarkersList( wxHtmlLinkEvent& event )
m_lastMarkerFound = NULL; m_lastMarkerFound = NULL;
long index; long index;
bool secondItem = false;
if( !link.ToLong( &index ) ) if( !link.ToLong( &index ) )
return; return;
if( index < 0 )
{
secondItem = true;
index = -index;
}
const SCH_MARKER* marker = m_MarkersList->GetItem( index ); const SCH_MARKER* marker = m_MarkersList->GetItem( index );
if( marker == NULL ) if( marker == NULL )
@ -262,8 +269,18 @@ void DIALOG_ERC::OnLeftClickMarkersList( wxHtmlLinkEvent& event )
} }
m_lastMarkerFound = marker; m_lastMarkerFound = marker;
m_parent->FocusOnLocation( marker->m_Pos, false, true );
m_parent->SetCrossHairPosition( marker->m_Pos ); if( secondItem )
{
m_parent->FocusOnLocation( marker->GetReporter().GetPointB() );
m_parent->SetCrossHairPosition( marker->GetReporter().GetPointB() );
}
else
{
m_parent->FocusOnLocation( marker->m_Pos, false, true );
m_parent->SetCrossHairPosition( marker->m_Pos );
}
RedrawDrawPanel(); RedrawDrawPanel();
} }

View File

@ -104,17 +104,21 @@ wxString DRC_ITEM::ShowHtml( EDA_UNITS_T aUnits ) const
// an html fragment for the entire message in the listbox. feel free // an html fragment for the entire message in the listbox. feel free
// to add color if you want: // to add color if you want:
return wxString::Format( "<p><b>%s</b><br>&nbsp;&nbsp; <font color='%s'><a href=''>%s</a></font>: %s<br>&nbsp;&nbsp; %s: %s", return wxString::Format( "<p><b>%s</b><br>"
"&nbsp;&nbsp; <font color='%s'><a href=''>%s</a></font>: %s<br>"
"&nbsp;&nbsp; <font color='%s'><a href=''>%s</a></font>: %s",
errText, errText,
hrefColour.GetAsString( wxC2S_HTML_SYNTAX ), hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
ShowCoord( aUnits, m_MainPosition ), ShowCoord( aUnits, m_MainPosition ),
mainText, mainText,
hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
ShowCoord( aUnits, m_AuxiliaryPosition ), ShowCoord( aUnits, m_AuxiliaryPosition ),
auxText ); auxText );
} }
else else
{ {
return wxString::Format( "<p><b>%s</b><br>&nbsp;&nbsp; <font color='%s'><a href=''>%s</a></font>: %s", return wxString::Format( "<p><b>%s</b><br>"
"&nbsp;&nbsp; <font color='%s'><a href=''>%s</a></font>: %s",
errText, errText,
hrefColour.GetAsString( wxC2S_HTML_SYNTAX ), hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
ShowCoord( aUnits, m_MainPosition ), ShowCoord( aUnits, m_MainPosition ),