diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 9c24e3deda..f0ec314853 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -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; } diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index 19da4f2acf..dc190b9066 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -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; @@ -481,17 +473,17 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi if( testLine->GetStartPoint() == aPoint ) { - if( !testLine->HasFlag(TEMP_SELECTED ) ) + if( !testLine->HasFlag( TEMP_SELECTED ) ) aList.push_back( testLine ); - testLine->SetFlags(STARTPOINT | TEMP_SELECTED ); + testLine->SetFlags( STARTPOINT | TEMP_SELECTED ); } else if( testLine->GetEndPoint() == aPoint ) { - if( !testLine->HasFlag(TEMP_SELECTED ) ) + if( !testLine->HasFlag( TEMP_SELECTED ) ) aList.push_back( testLine ); - testLine->SetFlags(ENDPOINT | TEMP_SELECTED ); + testLine->SetFlags( ENDPOINT | TEMP_SELECTED ); } break; } @@ -510,7 +502,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi newWire->SetFlags( IS_NEW ); m_frame->AddToScreen( newWire, m_frame->GetScreen() ); - newWire->SetFlags(TEMP_SELECTED | STARTPOINT ); + newWire->SetFlags( TEMP_SELECTED | STARTPOINT ); aList.push_back( newWire ); } break; @@ -518,10 +510,10 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi case SCH_NO_CONNECT_T: case SCH_JUNCTION_T: // Select no-connects and junctions that are connected to items being moved. - if( !test->HasFlag(TEMP_SELECTED ) && test->IsConnected( aPoint ) ) + if( !test->HasFlag( TEMP_SELECTED ) && test->IsConnected( aPoint ) ) { aList.push_back( test ); - test->SetFlags(TEMP_SELECTED ); + test->SetFlags( TEMP_SELECTED ); } break; @@ -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 connections; test->GetConnectionPoints( connections ); @@ -541,7 +537,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi { if( aOriginalItem->HitTest( point ) ) { - test->SetFlags(TEMP_SELECTED ); + test->SetFlags( TEMP_SELECTED ); aList.push_back( test ); break; } diff --git a/include/base_struct.h b/include/base_struct.h index fa02c80548..e0c6db621d 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -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; diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 0271f4d5c5..4b15c41120 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -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 ); }