ADDED: Allow Eeschema dragging graphical corners

This separates the two options (drag/move) into different actions.  Drag
will drag all graphical lines connected.  Move will disconnect the
graphical lines when moving.
This commit is contained in:
Seth Hillbrand 2020-09-11 09:31:38 -07:00
parent 03f510ff0d
commit 23a9df8a59
2 changed files with 46 additions and 26 deletions

View File

@ -582,6 +582,8 @@ bool SCH_LINE::IsConnectable() const
bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const
{ {
if( m_Layer == LAYER_WIRE )
{
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case SCH_JUNCTION_T: case SCH_JUNCTION_T:
@ -594,10 +596,28 @@ bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const
case SCH_SHEET_T: case SCH_SHEET_T:
case SCH_SHEET_PIN_T: case SCH_SHEET_PIN_T:
return true; return true;
default: default:
return aItem->GetLayer() == m_Layer; break;
} }
}
else if( m_Layer == LAYER_BUS )
{
switch( aItem->Type() )
{
case SCH_JUNCTION_T:
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_SHEET_T:
case SCH_SHEET_PIN_T:
return true;
default:
break;
}
}
return aItem->GetLayer() == m_Layer;
} }

View File

@ -207,8 +207,6 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
// Add connections to the selection for a drag. // Add connections to the selection for a drag.
// //
for( EDA_ITEM* item : selection ) for( EDA_ITEM* item : selection )
{
if( static_cast<SCH_ITEM*>( item )->IsConnectable() )
{ {
std::vector<wxPoint> connections; std::vector<wxPoint> connections;
@ -218,8 +216,8 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
connections = static_cast<SCH_ITEM*>( item )->GetConnectionPoints(); connections = static_cast<SCH_ITEM*>( item )->GetConnectionPoints();
for( wxPoint point : connections ) for( wxPoint point : connections )
getConnectedDragItems( (SCH_ITEM*) item, point, m_dragAdditions ); getConnectedDragItems( static_cast<SCH_ITEM*>( item ), point,
} m_dragAdditions );
} }
m_selectionTool->AddItemsToSel( &m_dragAdditions, QUIET_MODE ); m_selectionTool->AddItemsToSel( &m_dragAdditions, QUIET_MODE );
@ -495,9 +493,11 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoint, void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoint,
EDA_ITEMS& aList ) EDA_ITEMS& aList )
{ {
for( SCH_ITEM* test : m_frame->GetScreen()->Items() ) EE_RTREE& items = m_frame->GetScreen()->Items();
for( SCH_ITEM *test : items.Overlapping( aOriginalItem->GetBoundingBox() ) )
{ {
if( test->IsSelected() || !test->IsConnectable() || !test->CanConnect( aOriginalItem ) ) if( test->IsSelected() || !test->CanConnect( aOriginalItem ) )
continue; continue;
KICAD_T testType = test->Type(); KICAD_T testType = test->Type();