Bring back Copy with Reference as a new action

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5916
This commit is contained in:
Jon Evans 2020-10-25 17:09:32 -04:00
parent c085375531
commit e490b8eda4
3 changed files with 24 additions and 2 deletions

View File

@ -1820,8 +1820,21 @@ int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent )
for( EDA_ITEM* item : selection ) for( EDA_ITEM* item : selection )
items.push_back( static_cast<BOARD_ITEM*>( item ) ); items.push_back( static_cast<BOARD_ITEM*>( item ) );
VECTOR2I refPoint = grid.BestDragOrigin( getViewControls()->GetCursorPosition( false ), VECTOR2I refPoint;
items );
if( aEvent.IsAction( &PCB_ACTIONS::copyWithReference ) )
{
if( !pickReferencePoint( _( "Select reference point for the copy..." ),
_( "Selection copied" ),
_( "Copy cancelled" ),
refPoint ) )
return 0;
}
else
{
refPoint = grid.BestDragOrigin( getViewControls()->GetCursorPosition( false ), items );
}
selection.SetReferencePoint( refPoint ); selection.SetReferencePoint( refPoint );
io.SetBoard( board() ); io.SetBoard( board() );
@ -1873,6 +1886,7 @@ void EDIT_TOOL::setTransitions()
Go( &EDIT_TOOL::FilletTracks, PCB_ACTIONS::filletTracks.MakeEvent() ); Go( &EDIT_TOOL::FilletTracks, PCB_ACTIONS::filletTracks.MakeEvent() );
Go( &EDIT_TOOL::copyToClipboard, ACTIONS::copy.MakeEvent() ); Go( &EDIT_TOOL::copyToClipboard, ACTIONS::copy.MakeEvent() );
Go( &EDIT_TOOL::copyToClipboard, PCB_ACTIONS::copyWithReference.MakeEvent() );
Go( &EDIT_TOOL::cutToClipboard, ACTIONS::cut.MakeEvent() ); Go( &EDIT_TOOL::cutToClipboard, ACTIONS::cut.MakeEvent() );
} }

View File

@ -246,6 +246,11 @@ TOOL_ACTION PCB_ACTIONS::moveWithReference( "pcbnew.InteractiveMove.moveWithRefe
_( "Moves the selected item(s) with a specified starting point" ), _( "Moves the selected item(s) with a specified starting point" ),
move_xpm, AF_ACTIVATE ); move_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::copyWithReference( "pcbnew.InteractiveMove.copyWithReference",
AS_GLOBAL, 0, "", _( "Copy with Reference" ),
_( "Copy selected item(s) to clipboard with a specified starting point" ),
copy_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::duplicateIncrement( "pcbnew.InteractiveEdit.duplicateIncrementPads", TOOL_ACTION PCB_ACTIONS::duplicateIncrement( "pcbnew.InteractiveEdit.duplicateIncrementPads",
AS_GLOBAL, AS_GLOBAL,
MD_SHIFT + MD_CTRL + 'D', LEGACY_HK_NAME( "Duplicate Item and Increment" ), MD_SHIFT + MD_CTRL + 'D', LEGACY_HK_NAME( "Duplicate Item and Increment" ),

View File

@ -97,6 +97,9 @@ public:
/// move with a reference point /// move with a reference point
static TOOL_ACTION moveWithReference; static TOOL_ACTION moveWithReference;
/// copy command with manual reference point selection
static TOOL_ACTION copyWithReference;
/// Rotation of selected objects /// Rotation of selected objects
static TOOL_ACTION rotateCw; static TOOL_ACTION rotateCw;
static TOOL_ACTION rotateCcw; static TOOL_ACTION rotateCcw;