Add hotkey for viewing symbol datasheet.
Also fixes a bug when there are multiple datasheets to choose from. Fixes: lp:1793978 * https://bugs.launchpad.net/kicad/+bug/1793978
This commit is contained in:
parent
efefbf0fa0
commit
533b26e8a1
|
@ -156,7 +156,6 @@ enum id_eeschema_frm
|
|||
ID_POPUP_SCH_GENERIC_EDIT_CMP,
|
||||
ID_POPUP_SCH_EDIT_CONVERT_CMP,
|
||||
ID_POPUP_SCH_EDIT_FIELD,
|
||||
ID_POPUP_SCH_DISPLAYDOC_CMP,
|
||||
ID_POPUP_SCH_ENTER_SHEET,
|
||||
ID_POPUP_SCH_LEAVE_SHEET,
|
||||
ID_POPUP_SCH_SELECT_ON_PCB,
|
||||
|
@ -166,6 +165,7 @@ enum id_eeschema_frm
|
|||
ID_POPUP_SCH_GETINFO_MARKER,
|
||||
ID_POPUP_END_RANGE,
|
||||
|
||||
ID_POPUP_SCH_DISPLAYDOC_CMP,
|
||||
ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP,
|
||||
|
||||
// Unit select context menus command IDs.
|
||||
|
|
|
@ -169,10 +169,13 @@ static EDA_HOTKEY HkEditComponentReference( _HKI( "Edit Symbol Reference" ),
|
|||
static EDA_HOTKEY HkEditComponentFootprint( _HKI( "Edit Symbol Footprint" ),
|
||||
HK_EDIT_COMPONENT_FOOTPRINT, 'F',
|
||||
ID_SCH_EDIT_COMPONENT_FOOTPRINT );
|
||||
static EDA_HOTKEY HkShowComponentDatasheet( _HKI( "Show Symbol Datasheet" ),
|
||||
HK_SHOW_COMPONENT_DATASHEET, 'D' + GR_KB_CTRL,
|
||||
ID_POPUP_SCH_DISPLAYDOC_CMP );
|
||||
static EDA_HOTKEY HkEditComponentWithLibedit( _HKI( "Edit with Symbol Editor" ),
|
||||
HK_EDIT_COMPONENT_WITH_LIBEDIT,
|
||||
'E' + GR_KB_CTRL,
|
||||
HK_EDIT_COMPONENT_WITH_LIBEDIT, 'E' + GR_KB_CTRL,
|
||||
ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP );
|
||||
|
||||
static EDA_HOTKEY HkMove( _HKI( "Move Schematic Item" ),
|
||||
HK_MOVE_COMPONENT_OR_ITEM, 'M',
|
||||
ID_SCH_MOVE_ITEM );
|
||||
|
@ -203,6 +206,8 @@ static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTIO
|
|||
static EDA_HOTKEY HkCreatePin( _HKI( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' );
|
||||
static EDA_HOTKEY HkInsertPin( _HKI( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
|
||||
static EDA_HOTKEY HkMoveLibItem( _HKI( "Move Library Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' );
|
||||
static EDA_HOTKEY HkViewDoc( _HKI( "Show Datasheet" ), HK_LIBEDIT_VIEW_DOC, 'D' + GR_KB_CTRL,
|
||||
ID_LIBEDIT_VIEW_DOC );
|
||||
|
||||
// Autoplace fields
|
||||
static EDA_HOTKEY HkAutoplaceFields( _HKI( "Autoplace Fields" ), HK_AUTOPLACE_FIELDS, 'O',
|
||||
|
@ -295,6 +300,7 @@ static EDA_HOTKEY* schematic_Hotkey_List[] =
|
|||
&HkEditComponentValue,
|
||||
&HkEditComponentReference,
|
||||
&HkEditComponentFootprint,
|
||||
&HkShowComponentDatasheet,
|
||||
&HkEditComponentWithLibedit,
|
||||
&HkBeginWire,
|
||||
&HkBeginBus,
|
||||
|
@ -325,6 +331,7 @@ static EDA_HOTKEY* libEdit_Hotkey_List[] =
|
|||
&HkMoveLibItem,
|
||||
&HkMirrorX,
|
||||
&HkMirrorY,
|
||||
&HkViewDoc,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -610,6 +617,7 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
case HK_EDIT_COMPONENT_VALUE: // Edit component value field.
|
||||
case HK_EDIT_COMPONENT_REFERENCE: // Edit component value reference.
|
||||
case HK_EDIT_COMPONENT_FOOTPRINT: // Edit component footprint field.
|
||||
case HK_SHOW_COMPONENT_DATASHEET: // Show component datasheet in browser.
|
||||
case HK_MIRROR_Y: // Mirror Y
|
||||
case HK_MIRROR_X: // Mirror X
|
||||
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
|
||||
|
|
|
@ -43,12 +43,14 @@ enum hotkey_id_commnand {
|
|||
HK_LIBEDIT_MOVE_GRAPHIC_ITEM,
|
||||
HK_MOVEBLOCK_TO_DRAGBLOCK,
|
||||
HK_LIBEDIT_CREATE_PIN,
|
||||
HK_LIBEDIT_VIEW_DOC,
|
||||
HK_DELETE_PIN,
|
||||
HK_ROTATE,
|
||||
HK_EDIT,
|
||||
HK_EDIT_COMPONENT_VALUE,
|
||||
HK_EDIT_COMPONENT_REFERENCE,
|
||||
HK_EDIT_COMPONENT_FOOTPRINT,
|
||||
HK_SHOW_COMPONENT_DATASHEET,
|
||||
HK_EDIT_COMPONENT_WITH_LIBEDIT,
|
||||
HK_MIRROR_X,
|
||||
HK_MIRROR_Y,
|
||||
|
|
|
@ -580,11 +580,12 @@ void LIB_EDIT_FRAME::OnViewEntryDoc( wxCommandEvent& event )
|
|||
{
|
||||
CONTEXT_MENU popup;
|
||||
wxString msg;
|
||||
int id = 0;
|
||||
|
||||
for( LIB_ALIAS* alias : part->GetAliases() )
|
||||
{
|
||||
msg.Printf( wxT( "%s (%s)" ), alias->GetName(), alias->GetDocFileName() );
|
||||
popup.Append( wxID_ANY, msg );
|
||||
popup.Append( id++, msg );
|
||||
}
|
||||
|
||||
PopupMenu( &popup );
|
||||
|
|
|
@ -265,9 +265,11 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
// Menu Inspect:
|
||||
wxMenu* inspectMenu = new wxMenu;
|
||||
|
||||
|
||||
text = AddHotkeyName( _( "Show Datasheet" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_VIEW_DOC );
|
||||
AddMenuItem( inspectMenu,
|
||||
ID_LIBEDIT_VIEW_DOC,
|
||||
_( "Show Datasheet" ),
|
||||
text,
|
||||
_( "Open associated datasheet in web browser" ),
|
||||
KiBitmap( datasheet_xpm ) );
|
||||
|
||||
|
@ -322,7 +324,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
_( "Open the \"Getting Started in KiCad\" guide for beginners" ),
|
||||
KiBitmap( help_xpm ) );
|
||||
|
||||
text = AddHotkeyName( _( "&List Hotkeys..." ), g_Eeschema_Hokeys_Descr, HK_HELP );
|
||||
text = AddHotkeyName( _( "&List Hotkeys..." ), g_Libedit_Hokeys_Descr, HK_HELP );
|
||||
AddMenuItem( helpMenu,
|
||||
ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
|
||||
text,
|
||||
|
|
|
@ -350,6 +350,10 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
|
|||
id = HK_EDIT_COMPONENT_FOOTPRINT;
|
||||
name = _( "Edit Footprint Field..." );
|
||||
break;
|
||||
case DATASHEET:
|
||||
id = HK_SHOW_COMPONENT_DATASHEET;
|
||||
name = _( "Show Datasheet" );
|
||||
break;
|
||||
default:
|
||||
id = HK_EDIT;
|
||||
name = _( "Edit Field..." );
|
||||
|
@ -460,6 +464,11 @@ void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL
|
|||
HK_EDIT_COMPONENT_FOOTPRINT );
|
||||
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_FOOTPRINT, msg,
|
||||
KiBitmap( edit_comp_footprint_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Show Datasheet" ), g_Schematic_Hokeys_Descr,
|
||||
HK_SHOW_COMPONENT_DATASHEET );
|
||||
AddMenuItem( editmenu, ID_POPUP_SCH_DISPLAYDOC_CMP, msg,
|
||||
KiBitmap( datasheet_xpm ) );
|
||||
}
|
||||
|
||||
if( part && part->HasConversion() )
|
||||
|
|
|
@ -107,6 +107,11 @@ const KICAD_T SCH_COLLECTOR::CmpFieldFootprintOnly[] = {
|
|||
EOT
|
||||
};
|
||||
|
||||
const KICAD_T SCH_COLLECTOR::CmpFieldDatasheetOnly[] = {
|
||||
SCH_FIELD_LOCATE_DATASHEET_T,
|
||||
EOT
|
||||
};
|
||||
|
||||
|
||||
const KICAD_T SCH_COLLECTOR::MovableItems[] = {
|
||||
SCH_MARKER_T,
|
||||
|
|
|
@ -68,6 +68,11 @@ public:
|
|||
*/
|
||||
static const KICAD_T CmpFieldFootprintOnly[];
|
||||
|
||||
/**
|
||||
* A scan list for a specific editable field: Datasheet.
|
||||
*/
|
||||
static const KICAD_T CmpFieldDatasheetOnly[];
|
||||
|
||||
/**
|
||||
* A scan list for all movable schematic items.
|
||||
*/
|
||||
|
|
|
@ -1770,6 +1770,10 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
|
|||
return SEARCH_QUIT;
|
||||
break;
|
||||
|
||||
case SCH_FIELD_LOCATE_DATASHEET_T:
|
||||
if( SEARCH_QUIT == aInspector( GetField( DATASHEET ), (void*) this ) )
|
||||
return SEARCH_QUIT;
|
||||
break;
|
||||
|
||||
case LIB_PIN_T:
|
||||
if( PART_SPTR part = m_part.lock() )
|
||||
|
|
|
@ -313,6 +313,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_MENU_RANGE( ID_SCH_MIRROR_X, ID_SCH_ORIENT_NORMAL, SCH_EDIT_FRAME::OnOrient )
|
||||
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
||||
SCH_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_MENU( ID_POPUP_SCH_DISPLAYDOC_CMP, SCH_EDIT_FRAME::OnEditItem )
|
||||
|
||||
// Tools and buttons options toolbar
|
||||
EVT_TOOL( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnSelectOptionToolbar )
|
||||
|
|
|
@ -79,7 +79,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_SCH_RESIZE_SHEET:
|
||||
case ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN:
|
||||
case ID_POPUP_SCH_INIT_CMP:
|
||||
case ID_POPUP_SCH_DISPLAYDOC_CMP:
|
||||
case ID_POPUP_SCH_EDIT_CONVERT_CMP:
|
||||
case ID_POPUP_DELETE_BLOCK:
|
||||
case ID_POPUP_PLACE_BLOCK:
|
||||
|
@ -281,18 +280,6 @@ 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 )
|
||||
{
|
||||
wxString text = static_cast<SCH_COMPONENT*>( item )->GetField( DATASHEET )->GetText();
|
||||
text = ResolveUriByEnvVars( text );
|
||||
|
||||
if( !text.IsEmpty() )
|
||||
GetAssociatedDocument( this, text );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_ENTER_SHEET:
|
||||
|
||||
if( item && (item->Type() == SCH_SHEET_T) )
|
||||
|
@ -1000,6 +987,10 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
|
|||
filterListAux = SCH_COLLECTOR::ComponentsOnly;
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_DISPLAYDOC_CMP:
|
||||
filterList = SCH_COLLECTOR::CmpFieldDatasheetOnly;
|
||||
filterListAux = SCH_COLLECTOR::ComponentsOnly;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1033,6 +1024,16 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
|
|||
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ) );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_DISPLAYDOC_CMP:
|
||||
{
|
||||
wxString text = static_cast<SCH_COMPONENT*>( item )->GetField( DATASHEET )->GetText();
|
||||
text = ResolveUriByEnvVars( text );
|
||||
|
||||
if( !text.IsEmpty() )
|
||||
GetAssociatedDocument( this, text );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_SCH_EDIT_ITEM:
|
||||
EditComponent( (SCH_COMPONENT*) item );
|
||||
break;
|
||||
|
|
|
@ -128,6 +128,7 @@ enum KICAD_T
|
|||
SCH_FIELD_LOCATE_REFERENCE_T,
|
||||
SCH_FIELD_LOCATE_VALUE_T,
|
||||
SCH_FIELD_LOCATE_FOOTPRINT_T,
|
||||
SCH_FIELD_LOCATE_DATASHEET_T,
|
||||
|
||||
// General
|
||||
SCH_SCREEN_T,
|
||||
|
|
Loading…
Reference in New Issue