Fix another case of selection getting out of sync with dragged items.

Use a big hammer this time.

Fixes: lp:1839780
* https://bugs.launchpad.net/kicad/+bug/1839780
This commit is contained in:
Jeff Young 2019-08-31 20:20:44 +01:00
parent e269b5d1b9
commit 5e353e8967
4 changed files with 28 additions and 24 deletions

View File

@ -459,12 +459,15 @@ EDA_ITEM* SCH_LINE::MergeOverlap( SCH_LINE* aLine )
}
// Search for a common end:
if( ( leftmost_start == other_start ) &&
( leftmost_end == other_end ) ) // Trivial case
if( ( leftmost_start == other_start ) && ( leftmost_end == other_end ) ) // Trivial case
{
auto ret = new SCH_LINE( *aLine );
ret->SetStartPoint( leftmost_start );
ret->SetEndPoint( leftmost_end );
if( IsSelected() || aLine->IsSelected() )
ret->SetSelected();
return ret;
}
@ -504,6 +507,10 @@ EDA_ITEM* SCH_LINE::MergeOverlap( SCH_LINE* aLine )
auto ret = new SCH_LINE( *aLine );
ret->SetStartPoint( leftmost_start );
ret->SetEndPoint( leftmost_end );
if( IsSelected() || aLine->IsSelected() )
ret->SetSelected();
return ret;
}

View File

@ -181,6 +181,8 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
//------------------------------------------------------------------------
// Setup a drag or a move
//
m_dragAdditions.clear();
for( SCH_ITEM* it = m_frame->GetScreen()->GetDrawItems(); it; it = it->Next() )
{
it->ClearFlags(TEMP_SELECTED );
@ -445,17 +447,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
if( unselect )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
else
{
m_dragAdditions.clear();
for( SCH_ITEM* it = m_frame->GetScreen()->GetDrawItems(); it; it = it->Next() )
{
if( it->HasFlag( TEMP_SELECTED ) )
m_dragAdditions.push_back( it );
}
m_selectionTool->RemoveItemsFromSel( &m_dragAdditions, QUIET_MODE );
}
m_selectionTool->RebuildSelection(); // Schematic cleanup might have merged lines, etc.
m_dragAdditions.clear();
m_moveInProgress = false;
@ -531,8 +523,12 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi
case SCH_HIER_LABEL_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_BUS_BUS_ENTRY_T:
// Performance optimization:
if( test->HasFlag( TEMP_SELECTED ) )
break;
// Select labels and bus entries that are connected to a wire being moved.
if( !test->HasFlag(TEMP_SELECTED ) && aOriginalItem->Type() == SCH_LINE_T )
if( aOriginalItem->Type() == SCH_LINE_T )
{
std::vector<wxPoint> connections;
test->GetConnectionPoints( connections );

View File

@ -269,7 +269,7 @@ public:
STATUS_FLAGS GetEditFlags() const
{
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED |
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | TEMP_SELECTED | HIGHLIGHTED | BRIGHTENED |
STARTPOINT | ENDPOINT | IS_DANGLING |
BEGIN_ONPAD | END_ONPAD | DP_COUPLED );
return m_Flags & mask;

View File

@ -258,7 +258,8 @@ void FP_CACHE::Load()
if( !dir.IsOpened() )
{
wxString msg = wxString::Format( _( "Footprint library path \"%s\" does not exist" ),
wxString msg = wxString::Format( _( "Footprint library path '%s' does not exist "
"(or is not a directory)." ),
m_lib_raw_path );
THROW_IO_ERROR( msg );
}