From 302f23426424326c7f0a2c4c5b33ef3d4f9aa501 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 24 Oct 2017 09:47:23 +0200 Subject: [PATCH] Eeschema: fix an issue: doc never displayed if a non English language is used due to a bad way to retrieve the DATASHEET field. --- eeschema/onrightclick.cpp | 3 +-- eeschema/schedit.cpp | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index ab2c712e1e..719a42dd8e 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -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 ) ); } diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index 906a129da9..b350c5634f 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -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( item )->GetFieldText( "Datasheet" ); + wxString text = static_cast( item )-> + GetField( DATASHEET )->GetFullyQualifiedText(); if( !text.IsEmpty() ) - { GetAssociatedDocument( this, text ); - } } break;