Eeschema: fix a selection bug created in commit bec87864.

Apparently the schematic and symbol library editors now have common
selection filtering so checking for a valid LIB_EDIT_FRAME when
filtering for the  schematic editor frame prevented all schematic
object from being selected.
This commit is contained in:
Wayne Stambaugh 2019-12-12 11:42:11 -05:00
parent bec878640c
commit a18d7a8495
1 changed files with 15 additions and 11 deletions

View File

@ -1085,8 +1085,6 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, bool checkVisibilityO
// NOTE: in the future this is where eeschema layer/itemtype visibility will be handled // NOTE: in the future this is where eeschema layer/itemtype visibility will be handled
LIB_EDIT_FRAME* editFrame = dynamic_cast< LIB_EDIT_FRAME* >( m_frame ); LIB_EDIT_FRAME* editFrame = dynamic_cast< LIB_EDIT_FRAME* >( m_frame );
wxCHECK( editFrame, false );
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case SCH_PIN_T: case SCH_PIN_T:
@ -1099,11 +1097,14 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, bool checkVisibilityO
case LIB_FIELD_T: case LIB_FIELD_T:
{ {
LIB_PART* currentPart = editFrame->GetCurPart(); if( editFrame )
{
LIB_PART* currentPart = editFrame->GetCurPart();
// Nothing in derived symbols is editable at the moment. // Nothing in derived symbols is editable at the moment.
if( currentPart && currentPart->IsAlias() ) if( currentPart && currentPart->IsAlias() )
return false; return false;
}
break; break;
} }
@ -1116,13 +1117,16 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, bool checkVisibilityO
case LIB_BEZIER_T: case LIB_BEZIER_T:
case LIB_PIN_T: case LIB_PIN_T:
{ {
LIB_ITEM* lib_item = (LIB_ITEM*) aItem; if( editFrame )
{
LIB_ITEM* lib_item = (LIB_ITEM*) aItem;
if( lib_item->GetUnit() && lib_item->GetUnit() != editFrame->GetUnit() ) if( lib_item->GetUnit() && lib_item->GetUnit() != editFrame->GetUnit() )
return false; return false;
if( lib_item->GetConvert() && lib_item->GetConvert() != editFrame->GetConvert() ) if( lib_item->GetConvert() && lib_item->GetConvert() != editFrame->GetConvert() )
return false; return false;
}
break; break;
} }