Eeschema: fix an issue: doc never displayed if a non English language is used due to a bad way to retrieve the DATASHEET field.

This commit is contained in:
jean-pierre charras 2017-10-24 09:47:23 +02:00
parent a562525ec9
commit 302f234264
2 changed files with 3 additions and 7 deletions

View File

@ -357,7 +357,6 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_LIBS*
}
wxString msg;
LIB_ALIAS* libEntry = aLibs->FindLibraryAlias( Component->GetLibId() );
if( !Component->GetFlags() )
{
@ -397,7 +396,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_LIBS*
msg = AddHotkeyName( _( "Autoplace Fields" ), g_Schematic_Hokeys_Descr, HK_AUTOPLACE_FIELDS );
AddMenuItem( PopMenu, ID_AUTOPLACE_FIELDS, msg, KiBitmap( autoplace_fields_xpm ) );
if( !Component->GetFieldText("Datasheet").IsEmpty() )
if( !Component->GetField( DATASHEET )->GetFullyQualifiedText().IsEmpty() )
AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Open Documentation" ), KiBitmap( datasheet_xpm ) );
}

View File

@ -287,7 +287,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_SCH_EDIT_CONVERT_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( item && item->Type() == SCH_COMPONENT_T )
{
@ -298,16 +297,14 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_SCH_DISPLAYDOC_CMP:
// Ensure the struct is a component (could be a piece of a component, like Field, text..)
if( item && item->Type() == SCH_COMPONENT_T )
{
auto text = static_cast<SCH_COMPONENT*>( item )->GetFieldText( "Datasheet" );
wxString text = static_cast<SCH_COMPONENT*>( item )->
GetField( DATASHEET )->GetFullyQualifiedText();
if( !text.IsEmpty() )
{
GetAssociatedDocument( this, text );
}
}
break;