Cleanup ACTION_MENU creation in some places
The ACTION_MENU constructor now takes the tool as an argument, so the call to SetTool() immediately following it can be removed and the tool just passed into the constructor.
This commit is contained in:
parent
9535153f9e
commit
42c6af4bd8
|
@ -247,8 +247,7 @@ void CVPCB_MAINFRAME::setupTools()
|
|||
// to be able to tell the difference between a menu click and a hotkey activation.
|
||||
|
||||
// Create the context menu for the component list box
|
||||
m_componentContextMenu = new ACTION_MENU( false );
|
||||
m_componentContextMenu->SetTool( tool );
|
||||
m_componentContextMenu = new ACTION_MENU( false, tool );
|
||||
m_componentContextMenu->Add( CVPCB_ACTIONS::showFootprintViewer );
|
||||
m_componentContextMenu->AppendSeparator();
|
||||
m_componentContextMenu->Add( ACTIONS::cut );
|
||||
|
@ -258,8 +257,7 @@ void CVPCB_MAINFRAME::setupTools()
|
|||
m_componentContextMenu->Add( CVPCB_ACTIONS::deleteAssoc );
|
||||
|
||||
// Create the context menu for the footprint list box
|
||||
m_footprintContextMenu = new ACTION_MENU( false );
|
||||
m_footprintContextMenu->SetTool( tool );
|
||||
m_footprintContextMenu = new ACTION_MENU( false, tool );
|
||||
m_footprintContextMenu->Add( CVPCB_ACTIONS::showFootprintViewer );
|
||||
}
|
||||
|
||||
|
|
|
@ -60,8 +60,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
// (the file history will be updated when adding/removing files in history)
|
||||
if( !openRecentMenu )
|
||||
{
|
||||
openRecentMenu = new ACTION_MENU( false );
|
||||
openRecentMenu->SetTool( selTool );
|
||||
openRecentMenu = new ACTION_MENU( false, selTool );
|
||||
openRecentMenu->SetTitle( _( "Open Recent" ) );
|
||||
openRecentMenu->SetIcon( BITMAPS::recent );
|
||||
|
||||
|
@ -94,8 +93,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->AppendSeparator();
|
||||
|
||||
// Import submenu
|
||||
ACTION_MENU* submenuImport = new ACTION_MENU( false );
|
||||
submenuImport->SetTool( selTool );
|
||||
ACTION_MENU* submenuImport = new ACTION_MENU( false, selTool );
|
||||
submenuImport->SetTitle( _( "Import" ) );
|
||||
submenuImport->SetIcon( BITMAPS::import );
|
||||
submenuImport->Add( _( "Non-KiCad Schematic..." ),
|
||||
|
@ -108,8 +106,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
|
||||
|
||||
// Export submenu
|
||||
ACTION_MENU* submenuExport = new ACTION_MENU( false );
|
||||
submenuExport->SetTool( selTool );
|
||||
ACTION_MENU* submenuExport = new ACTION_MENU( false, selTool );
|
||||
submenuExport->SetTitle( _( "Export" ) );
|
||||
submenuExport->SetIcon( BITMAPS::export_file );
|
||||
submenuExport->Add( EE_ACTIONS::drawSheetOnClipboard, ACTION_MENU::NORMAL, _( "Drawing to Clipboard" ) );
|
||||
|
|
|
@ -65,8 +65,7 @@ void SYMBOL_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->Add( EE_ACTIONS::importSymbol );
|
||||
|
||||
// Export submenu
|
||||
ACTION_MENU* submenuExport = new ACTION_MENU( false );
|
||||
submenuExport->SetTool( selTool );
|
||||
ACTION_MENU* submenuExport = new ACTION_MENU( false, selTool );
|
||||
submenuExport->SetTitle( _( "Export" ) );
|
||||
submenuExport->SetIcon( BITMAPS::export_file );
|
||||
submenuExport->Add( EE_ACTIONS::exportSymbol, ACTION_MENU::NORMAL, _( "Symbol..." ) );
|
||||
|
|
|
@ -141,8 +141,7 @@ private:
|
|||
|
||||
if( member->Type() == CONNECTION_TYPE::BUS )
|
||||
{
|
||||
ACTION_MENU* submenu = new ACTION_MENU( true );
|
||||
submenu->SetTool( m_tool );
|
||||
ACTION_MENU* submenu = new ACTION_MENU( true, m_tool );
|
||||
AppendSubMenu( submenu, SCH_CONNECTION::PrintBusForUI( name ), name );
|
||||
|
||||
for( const std::shared_ptr<SCH_CONNECTION>& sub_member : member->Members() )
|
||||
|
|
|
@ -62,8 +62,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
// will automatically refresh the menu.
|
||||
if( !openRecentGbrMenu )
|
||||
{
|
||||
openRecentGbrMenu = new ACTION_MENU( false );
|
||||
openRecentGbrMenu->SetTool( selTool );
|
||||
openRecentGbrMenu = new ACTION_MENU( false, selTool );
|
||||
openRecentGbrMenu->SetTitle( _( "Open Recent Gerber File" ) );
|
||||
openRecentGbrMenu->SetIcon( BITMAPS::recent );
|
||||
|
||||
|
@ -81,8 +80,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
// will automatically refresh the menu.
|
||||
if( !openRecentDrlMenu )
|
||||
{
|
||||
openRecentDrlMenu = new ACTION_MENU( false );
|
||||
openRecentDrlMenu->SetTool( selTool );
|
||||
openRecentDrlMenu = new ACTION_MENU( false, selTool );
|
||||
openRecentDrlMenu->SetTitle( _( "Open Recent Drill File" ) );
|
||||
openRecentDrlMenu->SetIcon( BITMAPS::recent );
|
||||
|
||||
|
@ -100,8 +98,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
// will automatically refresh the menu.
|
||||
if( !openRecentJobMenu )
|
||||
{
|
||||
openRecentJobMenu = new ACTION_MENU( false );
|
||||
openRecentJobMenu->SetTool( selTool );
|
||||
openRecentJobMenu = new ACTION_MENU( false, selTool );
|
||||
openRecentJobMenu->SetTitle( _( "Open Recent Job File" ) );
|
||||
openRecentJobMenu->SetIcon( BITMAPS::recent );
|
||||
|
||||
|
@ -119,8 +116,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
// will automatically refresh the menu.
|
||||
if( !openRecentZipMenu )
|
||||
{
|
||||
openRecentZipMenu = new ACTION_MENU( false );
|
||||
openRecentZipMenu->SetTool( selTool );
|
||||
openRecentZipMenu = new ACTION_MENU( false, selTool );
|
||||
openRecentZipMenu->SetTitle( _( "Open Recent Zip File" ) );
|
||||
openRecentZipMenu->SetIcon( BITMAPS::recent );
|
||||
|
||||
|
|
|
@ -53,8 +53,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
|||
// will automatically refresh the menu.
|
||||
if( !openRecentMenu )
|
||||
{
|
||||
openRecentMenu = new ACTION_MENU( false );
|
||||
openRecentMenu->SetTool( selTool );
|
||||
openRecentMenu = new ACTION_MENU( false, selTool );
|
||||
openRecentMenu->SetTitle( _( "Open Recent" ) );
|
||||
openRecentMenu->SetIcon( BITMAPS::recent );
|
||||
|
||||
|
|
|
@ -64,8 +64,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
|||
|
||||
fileMenu->AppendSeparator();
|
||||
|
||||
ACTION_MENU* submenuImport = new ACTION_MENU( false );
|
||||
submenuImport->SetTool( selTool );
|
||||
ACTION_MENU* submenuImport = new ACTION_MENU( false, selTool );
|
||||
submenuImport->SetTitle( _( "Import" ) );
|
||||
submenuImport->SetIcon( BITMAPS::import );
|
||||
|
||||
|
|
|
@ -61,8 +61,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
// will automatically refresh the menu.
|
||||
if( !openRecentMenu )
|
||||
{
|
||||
openRecentMenu = new ACTION_MENU( false );
|
||||
openRecentMenu->SetTool( selTool );
|
||||
openRecentMenu = new ACTION_MENU( false, selTool );
|
||||
openRecentMenu->SetTitle( _( "Open Recent" ) );
|
||||
openRecentMenu->SetIcon( BITMAPS::recent );
|
||||
|
||||
|
@ -102,8 +101,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
BITMAPS::rescue );
|
||||
|
||||
// Import submenu
|
||||
ACTION_MENU* submenuImport = new ACTION_MENU( false );
|
||||
submenuImport->SetTool( selTool );
|
||||
ACTION_MENU* submenuImport = new ACTION_MENU( false, selTool );
|
||||
submenuImport->SetTitle( _( "Import" ) );
|
||||
submenuImport->SetIcon( BITMAPS::import );
|
||||
|
||||
|
@ -122,8 +120,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->Add( submenuImport );
|
||||
|
||||
// Export submenu
|
||||
ACTION_MENU* submenuExport = new ACTION_MENU( false );
|
||||
submenuExport->SetTool( selTool );
|
||||
ACTION_MENU* submenuExport = new ACTION_MENU( false, selTool );
|
||||
submenuExport->SetTitle( _( "Export" ) );
|
||||
submenuExport->SetIcon( BITMAPS::export_file );
|
||||
|
||||
|
@ -158,8 +155,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->Add( submenuExport );
|
||||
|
||||
// Fabrication Outputs submenu
|
||||
ACTION_MENU* submenuFabOutputs = new ACTION_MENU( false );
|
||||
submenuFabOutputs->SetTool( selTool );
|
||||
ACTION_MENU* submenuFabOutputs = new ACTION_MENU( false, selTool );
|
||||
submenuFabOutputs->SetTitle( _( "Fabrication Outputs" ) );
|
||||
submenuFabOutputs->SetIcon( BITMAPS::fabrication );
|
||||
|
||||
|
@ -321,9 +317,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
|
||||
placeMenu->AppendSeparator();
|
||||
|
||||
ACTION_MENU* autoplaceSubmenu = new ACTION_MENU( false );
|
||||
ACTION_MENU* autoplaceSubmenu = new ACTION_MENU( false, selTool );
|
||||
autoplaceSubmenu->SetTitle( _( "Auto-Place Footprints" ) );
|
||||
autoplaceSubmenu->SetTool( selTool );
|
||||
autoplaceSubmenu->SetIcon( BITMAPS::mode_module );
|
||||
|
||||
autoplaceSubmenu->Add( PCB_ACTIONS::autoplaceOffboardComponents );
|
||||
|
@ -401,8 +396,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
#endif
|
||||
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
ACTION_MENU* submenuActionPlugins = new ACTION_MENU( false );
|
||||
submenuActionPlugins->SetTool( selTool );
|
||||
ACTION_MENU* submenuActionPlugins = new ACTION_MENU( false, selTool );
|
||||
submenuActionPlugins->SetTitle( _( "External Plugins" ) );
|
||||
submenuActionPlugins->SetIcon( BITMAPS::puzzle_piece );
|
||||
|
||||
|
|
|
@ -57,8 +57,7 @@ bool ALIGN_DISTRIBUTE_TOOL::Init()
|
|||
m_frame = getEditFrame<PCB_BASE_FRAME>();
|
||||
|
||||
// Create a context menu and make it available through selection tool
|
||||
m_placementMenu = new ACTION_MENU( true );
|
||||
m_placementMenu->SetTool( this );
|
||||
m_placementMenu = new ACTION_MENU( true, this );
|
||||
m_placementMenu->SetIcon( BITMAPS::align_items );
|
||||
m_placementMenu->SetTitle( _( "Align/Distribute" ) );
|
||||
|
||||
|
|
Loading…
Reference in New Issue