mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Support URLs in Symbol Chooser info panel.
Also adds support for sim library fields as URLs. Fixes https://gitlab.com/kicad/code/kicad/-/issues/20811
This commit is contained in:
parent
b772960717
commit
34f2038a95
@ -43,7 +43,7 @@ static const wxString FieldFormat = wxS(
|
||||
" <td><b>__NAME__</b></td>"
|
||||
" <td>__VALUE__</td>"
|
||||
"</tr>" );
|
||||
static const wxString DatasheetLinkFormat = wxS( "<a href=\"__HREF__\">__TEXT__</a>" );
|
||||
static const wxString LinkFormat = wxS( "<a href=\"__HREF__\">__TEXT__</a>" );
|
||||
|
||||
|
||||
class FOOTPRINT_INFO_GENERATOR
|
||||
@ -183,7 +183,7 @@ protected:
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString datasheetlink = DatasheetLinkFormat;
|
||||
wxString datasheetlink = LinkFormat;
|
||||
datasheetlink.Replace( wxS( "__HREF__" ), EscapeHTML( text ) );
|
||||
|
||||
if( text.Length() > 75 )
|
||||
@ -207,7 +207,23 @@ protected:
|
||||
|
||||
default:
|
||||
text = aField.GetShownText( false );
|
||||
fieldhtml.Replace( wxS( "__VALUE__" ), EscapeHTML( text ) );
|
||||
|
||||
if( aField.IsHypertext() )
|
||||
{
|
||||
wxString link = LinkFormat;
|
||||
link.Replace( wxS( "__HREF__" ), EscapeHTML( text ) );
|
||||
|
||||
if( text.Length() > 75 )
|
||||
text = text.Left( 72 ) + wxT( "..." );
|
||||
|
||||
link.Replace( wxS( "__TEXT__" ), EscapeHTML( text ) );
|
||||
|
||||
fieldhtml.Replace( wxS( "__VALUE__" ), link );
|
||||
}
|
||||
else
|
||||
{
|
||||
fieldhtml.Replace( wxS( "__VALUE__" ), EscapeHTML( text ) );
|
||||
}
|
||||
}
|
||||
|
||||
return fieldhtml;
|
||||
|
@ -1021,6 +1021,18 @@ void SCH_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
||||
}
|
||||
|
||||
|
||||
bool SCH_FIELD::IsHypertext() const
|
||||
{
|
||||
if( m_id == FIELD_T::INTERSHEET_REFS )
|
||||
return true;
|
||||
|
||||
if( m_name == SIM_LIBRARY::LIBRARY_FIELD )
|
||||
return true;
|
||||
|
||||
return IsURL( GetShownText( false ) );
|
||||
}
|
||||
|
||||
|
||||
void SCH_FIELD::DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const
|
||||
{
|
||||
constexpr int START_ID = 1;
|
||||
@ -1056,7 +1068,7 @@ void SCH_FIELD::DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const
|
||||
else if( sel == 999 )
|
||||
href = SCH_NAVIGATE_TOOL::g_BackLink;
|
||||
}
|
||||
else if( IsURL( GetShownText( false ) ) )
|
||||
else if( IsURL( GetShownText( false ) ) || m_name == SIM_LIBRARY::LIBRARY_FIELD )
|
||||
{
|
||||
href = GetShownText( false );
|
||||
}
|
||||
|
@ -90,13 +90,7 @@ public:
|
||||
return _( "Field" );
|
||||
}
|
||||
|
||||
bool IsHypertext() const override
|
||||
{
|
||||
if( m_id == FIELD_T::INTERSHEET_REFS )
|
||||
return true;
|
||||
|
||||
return IsURL( GetShownText( false ) );
|
||||
}
|
||||
bool IsHypertext() const override;
|
||||
|
||||
void DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const override;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user