Pcbnew, place menu: some enhancements:

- move place dimensions to a sub menu (they are not frequently used, and it
reduce the size of the place menu
- add reset drill origin, similar to reset grid origin.
This commit is contained in:
jean-pierre charras 2023-11-20 13:23:16 +01:00
parent b698ddc82c
commit ed1924b975
4 changed files with 25 additions and 7 deletions

View File

@ -313,11 +313,15 @@ void PCB_EDIT_FRAME::doReCreateMenuBar()
placeMenu->Add( PCB_ACTIONS::drawTextBox );
placeMenu->AppendSeparator();
placeMenu->Add( PCB_ACTIONS::drawAlignedDimension );
placeMenu->Add( PCB_ACTIONS::drawOrthogonalDimension );
placeMenu->Add( PCB_ACTIONS::drawCenterDimension );
placeMenu->Add( PCB_ACTIONS::drawRadialDimension );
placeMenu->Add( PCB_ACTIONS::drawLeader );
ACTION_MENU* dimensionSubmenu = new ACTION_MENU( false, selTool );
dimensionSubmenu->SetTitle( _( "Add Dimension" ) );
dimensionSubmenu->SetIcon( BITMAPS::add_aligned_dimension );
dimensionSubmenu->Add( PCB_ACTIONS::drawAlignedDimension );
dimensionSubmenu->Add( PCB_ACTIONS::drawOrthogonalDimension );
dimensionSubmenu->Add( PCB_ACTIONS::drawCenterDimension );
dimensionSubmenu->Add( PCB_ACTIONS::drawRadialDimension );
dimensionSubmenu->Add( PCB_ACTIONS::drawLeader );
placeMenu->Add( dimensionSubmenu );
placeMenu->AppendSeparator();
placeMenu->Add( PCB_ACTIONS::placeCharacteristics );
@ -325,12 +329,11 @@ void PCB_EDIT_FRAME::doReCreateMenuBar()
placeMenu->AppendSeparator();
placeMenu->Add( PCB_ACTIONS::drillOrigin );
placeMenu->Add( PCB_ACTIONS::drillResetOrigin );
placeMenu->Add( ACTIONS::gridSetOrigin );
placeMenu->AppendSeparator();
placeMenu->Add( ACTIONS::gridResetOrigin );
placeMenu->AppendSeparator();
ACTION_MENU* autoplaceSubmenu = new ACTION_MENU( false, selTool );
autoplaceSubmenu->SetTitle( _( "Auto-Place Footprints" ) );
autoplaceSubmenu->SetIcon( BITMAPS::mode_module );

View File

@ -1598,6 +1598,13 @@ void BOARD_EDITOR_CONTROL::DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME*
int BOARD_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
{
if( aEvent.IsAction( &PCB_ACTIONS::drillResetOrigin ) )
{
m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::GRIDORIGIN );
DoSetDrillOrigin( getView(), m_frame, m_placeOrigin.get(), VECTOR2D( 0, 0 ) );
return 0;
}
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
// Deactivate other tools; particularly important if another PICKER is currently running
@ -1662,6 +1669,7 @@ void BOARD_EDITOR_CONTROL::setTransitions()
// Placing tools
Go( &BOARD_EDITOR_CONTROL::PlaceFootprint, PCB_ACTIONS::placeFootprint.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::DrillOrigin, PCB_ACTIONS::drillOrigin.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::DrillOrigin, PCB_ACTIONS::drillResetOrigin.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::EditFpInFpEditor, PCB_ACTIONS::editFpInFpEditor.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::EditFpInFpEditor, PCB_ACTIONS::editLibFpInFpEditor.MakeEvent() );

View File

@ -1147,6 +1147,12 @@ TOOL_ACTION PCB_ACTIONS::drillOrigin( TOOL_ACTION_ARGS()
.Icon( BITMAPS::set_origin )
.Flags( AF_ACTIVATE ) );
TOOL_ACTION PCB_ACTIONS::drillResetOrigin( TOOL_ACTION_ARGS()
.Name( "pcbnew.EditorControl.drillResetOrigin" )
.Scope( AS_GLOBAL )
.LegacyHotkeyName( "Reset Drill Origin" )
.FriendlyName( _( "Reset Drill Origin" ) ) );
TOOL_ACTION PCB_ACTIONS::toggleLock( TOOL_ACTION_ARGS()
.Name( "pcbnew.EditorControl.toggleLock" )
.Scope( AS_GLOBAL )

View File

@ -528,6 +528,7 @@ public:
static TOOL_ACTION pickerTool;
static TOOL_ACTION measureTool;
static TOOL_ACTION drillOrigin;
static TOOL_ACTION drillResetOrigin;
static TOOL_ACTION placeFileOrigin;
static TOOL_ACTION appendBoard;
static TOOL_ACTION showEeschema;