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,22 +582,42 @@ bool SCH_LINE::IsConnectable() const
bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const
{
switch( aItem->Type() )
if( m_Layer == LAYER_WIRE )
{
case SCH_JUNCTION_T:
case SCH_NO_CONNECT_T:
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_COMPONENT_T:
case SCH_SHEET_T:
case SCH_SHEET_PIN_T:
return true;
default:
return aItem->GetLayer() == m_Layer;
switch( aItem->Type() )
{
case SCH_JUNCTION_T:
case SCH_NO_CONNECT_T:
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_COMPONENT_T:
case SCH_SHEET_T:
case SCH_SHEET_PIN_T:
return true;
default:
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

@ -208,18 +208,16 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
//
for( EDA_ITEM* item : selection )
{
if( static_cast<SCH_ITEM*>( item )->IsConnectable() )
{
std::vector<wxPoint> connections;
std::vector<wxPoint> connections;
if( item->Type() == SCH_LINE_T )
static_cast<SCH_LINE*>( item )->GetSelectedPoints( connections );
else
connections = static_cast<SCH_ITEM*>( item )->GetConnectionPoints();
if( item->Type() == SCH_LINE_T )
static_cast<SCH_LINE*>( item )->GetSelectedPoints( connections );
else
connections = static_cast<SCH_ITEM*>( item )->GetConnectionPoints();
for( wxPoint point : connections )
getConnectedDragItems( (SCH_ITEM*) item, point, m_dragAdditions );
}
for( wxPoint point : connections )
getConnectedDragItems( static_cast<SCH_ITEM*>( item ), point,
m_dragAdditions );
}
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,
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;
KICAD_T testType = test->Type();