Browse Source

Bring back Copy with Reference as a new action

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5916
6.0.7
Jon Evans 5 years ago
parent
commit
e490b8eda4
  1. 18
      pcbnew/tools/edit_tool.cpp
  2. 5
      pcbnew/tools/pcb_actions.cpp
  3. 3
      pcbnew/tools/pcb_actions.h

18
pcbnew/tools/edit_tool.cpp

@ -1820,8 +1820,21 @@ int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent )
for( EDA_ITEM* item : selection )
items.push_back( static_cast<BOARD_ITEM*>( item ) );
VECTOR2I refPoint = grid.BestDragOrigin( getViewControls()->GetCursorPosition( false ),
items );
VECTOR2I refPoint;
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 );
io.SetBoard( board() );
@ -1873,6 +1886,7 @@ void EDIT_TOOL::setTransitions()
Go( &EDIT_TOOL::FilletTracks, PCB_ACTIONS::filletTracks.MakeEvent() );
Go( &EDIT_TOOL::copyToClipboard, ACTIONS::copy.MakeEvent() );
Go( &EDIT_TOOL::copyToClipboard, PCB_ACTIONS::copyWithReference.MakeEvent() );
Go( &EDIT_TOOL::cutToClipboard, ACTIONS::cut.MakeEvent() );
}

5
pcbnew/tools/pcb_actions.cpp

@ -246,6 +246,11 @@ TOOL_ACTION PCB_ACTIONS::moveWithReference( "pcbnew.InteractiveMove.moveWithRefe
_( "Moves the selected item(s) with a specified starting point" ),
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",
AS_GLOBAL,
MD_SHIFT + MD_CTRL + 'D', LEGACY_HK_NAME( "Duplicate Item and Increment" ),

3
pcbnew/tools/pcb_actions.h

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

Loading…
Cancel
Save