From a18d7a849543d9018c24cb8ae411becb414ad5ef Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Thu, 12 Dec 2019 11:42:11 -0500 Subject: [PATCH] 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. --- eeschema/tools/ee_selection_tool.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 0c3f1caa90..9358febd7f 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -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 LIB_EDIT_FRAME* editFrame = dynamic_cast< LIB_EDIT_FRAME* >( m_frame ); - wxCHECK( editFrame, false ); - switch( aItem->Type() ) { case SCH_PIN_T: @@ -1099,11 +1097,14 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, bool checkVisibilityO 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. - if( currentPart && currentPart->IsAlias() ) - return false; + // Nothing in derived symbols is editable at the moment. + if( currentPart && currentPart->IsAlias() ) + return false; + } break; } @@ -1116,13 +1117,16 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, bool checkVisibilityO case LIB_BEZIER_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() ) - return false; + if( lib_item->GetUnit() && lib_item->GetUnit() != editFrame->GetUnit() ) + return false; - if( lib_item->GetConvert() && lib_item->GetConvert() != editFrame->GetConvert() ) - return false; + if( lib_item->GetConvert() && lib_item->GetConvert() != editFrame->GetConvert() ) + return false; + } break; }