libedit: add correct unit/convert from component chooser

Fixes: lp:1705073
* https://bugs.launchpad.net/kicad/+bug/1705073
This commit is contained in:
Chris Pavlina 2017-07-19 11:34:55 -06:00
parent e34f1222fa
commit 04d299ae0e
2 changed files with 17 additions and 5 deletions

View File

@ -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 );

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net>
* 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