Give the pad placement tool a context menu.

ADDED: allow pad properties to be edited while placing pads.

Fixes https://gitlab.com/kicad/code/kicad/issues/6953
This commit is contained in:
Jeff Young 2021-01-15 00:50:52 +00:00
parent 9b69c1e198
commit 36508807e7
2 changed files with 30 additions and 6 deletions

View File

@ -101,7 +101,23 @@ bool PAD_TOOL::Init()
menu.AddItem( PCB_ACTIONS::pushPadSettings, singlePadSel, 400 ); menu.AddItem( PCB_ACTIONS::pushPadSettings, singlePadSel, 400 );
} }
auto& ctxMenu = m_menu.GetMenu();
// cancel current tool goes in main context menu at the top if present
ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 );
ctxMenu.AddSeparator( 1 );
ctxMenu.AddItem( PCB_ACTIONS::rotateCcw, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( PCB_ACTIONS::rotateCw, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( PCB_ACTIONS::flip, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( PCB_ACTIONS::mirror, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( PCB_ACTIONS::properties, SELECTION_CONDITIONS::ShowAlways );
// Finally, add the standard zoom/grid items
getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
return true; return true;
} }
@ -526,19 +542,22 @@ int PAD_TOOL::EditPad( const TOOL_EVENT& aEvent )
PAD* pad = static_cast<PAD*>( selection[0] ); PAD* pad = static_cast<PAD*>( selection[0] );
PCB_LAYER_ID layer = explodePad( pad ); PCB_LAYER_ID layer = explodePad( pad );
m_wasHighContrast = ( opts.m_ContrastModeDisplay != m_wasHighContrast = ( opts.m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL );
HIGH_CONTRAST_MODE::NORMAL );
frame()->SetActiveLayer( layer ); frame()->SetActiveLayer( layer );
if( !m_wasHighContrast ) if( !m_wasHighContrast )
m_toolMgr->RunAction( ACTIONS::highContrastMode, false ); m_toolMgr->RunAction( ACTIONS::highContrastMode, false );
if( PCB_ACTIONS::explodePad.GetHotKey() == PCB_ACTIONS::recombinePad.GetHotKey() ) if( PCB_ACTIONS::explodePad.GetHotKey() == PCB_ACTIONS::recombinePad.GetHotKey() )
{
msg.Printf( _( "Pad Edit Mode. Press %s again to exit." ), msg.Printf( _( "Pad Edit Mode. Press %s again to exit." ),
KeyNameFromKeyCode( PCB_ACTIONS::recombinePad.GetHotKey() ) ); KeyNameFromKeyCode( PCB_ACTIONS::recombinePad.GetHotKey() ) );}
else else
{
msg.Printf( _( "Pad Edit Mode. Press %s to exit." ), msg.Printf( _( "Pad Edit Mode. Press %s to exit." ),
KeyNameFromKeyCode( PCB_ACTIONS::recombinePad.GetHotKey() ) ); KeyNameFromKeyCode( PCB_ACTIONS::recombinePad.GetHotKey() ) );
}
infoBar->RemoveAllButtons(); infoBar->RemoveAllButtons();
infoBar->ShowMessage( msg, wxICON_INFORMATION ); infoBar->ShowMessage( msg, wxICON_INFORMATION );
@ -548,8 +567,7 @@ int PAD_TOOL::EditPad( const TOOL_EVENT& aEvent )
if( m_editPad == niluuid ) if( m_editPad == niluuid )
{ {
bool highContrast = ( opts.m_ContrastModeDisplay != bool highContrast = ( opts.m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL );
HIGH_CONTRAST_MODE::NORMAL );
if( m_wasHighContrast != highContrast ) if( m_wasHighContrast != highContrast )
m_toolMgr->RunAction( ACTIONS::highContrastMode, false ); m_toolMgr->RunAction( ACTIONS::highContrastMode, false );

View File

@ -23,7 +23,6 @@
#include "pcb_tool_base.h" #include "pcb_tool_base.h"
#include <view/view_controls.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <board_commit.h> #include <board_commit.h>
#include <footprint.h> #include <footprint.h>
@ -221,6 +220,13 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
// Refresh preview after event runs // Refresh preview after event runs
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->RunAction( ACTIONS::refreshPreview );
} }
else if( evt->IsAction( &PCB_ACTIONS::properties ) )
{
frame()->OnEditItemRequest( newItem.get() );
// Notify other tools of the changes
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
}
else if( evt->IsAction( &ACTIONS::refreshPreview ) ) else if( evt->IsAction( &ACTIONS::refreshPreview ) )
{ {
preview.Clear(); preview.Clear();