diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index c0bc65e7a7..3701dd4f4d 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -88,17 +88,26 @@ bool LIB_EDIT_FRAME::LoadComponentAndSelectLib( LIB_ALIAS* aLibEntry, PART_LIB* } -bool LIB_EDIT_FRAME::LoadComponentFromCurrentLib( LIB_ALIAS* aLibEntry ) +bool LIB_EDIT_FRAME::LoadComponentFromCurrentLib( LIB_ALIAS* aLibEntry, int aUnit, int aConvert ) { if( !LoadOneLibraryPartAux( aLibEntry, GetCurLib() ) ) return false; + if( aUnit > 0 ) + m_unit = aUnit; + + if( aConvert > 0 ) + m_convert = aConvert; + m_editPinsPerPartOrConvert = GetCurPart()->UnitsLocked() ? true : false; GetScreen()->ClearUndoRedoList(); Zoom_Automatique( false ); SetShowDeMorgan( GetCurPart()->HasConversion() ); + if( aUnit > 0 ) + UpdatePartSelectList(); + return true; } @@ -181,7 +190,7 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event ) PART_LIB* old = SetCurLib( searchLib ); - LoadComponentFromCurrentLib( libEntry ); + LoadComponentFromCurrentLib( libEntry, sel.Unit, sel.Convert ); SetCurLib( old ); diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h index fed9b55318..619a72c60b 100644 --- a/eeschema/libeditframe.h +++ b/eeschema/libeditframe.h @@ -3,7 +3,7 @@ * * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2017 Wayne Stambaugh - * Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -495,11 +495,14 @@ private: /** * Function LoadComponentFromCurrentLib - * loads a component from the current active library. + * loads a component from the current active library, optionally setting the selected + * unit and convert * @param aLibEntry The component to load from \a aLibrary (can be an alias) + * @param aUnit Unit to be selected + * @param aConvert Convert to be selected * @return true if \a aLibEntry loaded correctly. */ - bool LoadComponentFromCurrentLib( LIB_ALIAS* aLibEntry ); + bool LoadComponentFromCurrentLib( LIB_ALIAS* aLibEntry, int aUnit = 0, int aConvert = 0 ); /** * Function LoadOneLibraryPartAux