Put pad enumerate tool in PAD_TOOL submenu
Prior to this, it was in the top level of the selection menu, and was always shown, even if the module editor didn't have a loaded footprint.
This commit is contained in:
parent
ca91c27852
commit
2fa17b4460
|
@ -958,12 +958,14 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
|
||||||
m_toolManager->RegisterTool( new MODULE_EDITOR_TOOLS );
|
m_toolManager->RegisterTool( new MODULE_EDITOR_TOOLS );
|
||||||
m_toolManager->RegisterTool( new PLACEMENT_TOOL );
|
m_toolManager->RegisterTool( new PLACEMENT_TOOL );
|
||||||
m_toolManager->RegisterTool( new PICKER_TOOL );
|
m_toolManager->RegisterTool( new PICKER_TOOL );
|
||||||
m_toolManager->InitTools();
|
|
||||||
|
|
||||||
|
m_toolManager->GetTool<PAD_TOOL>()->SetEditModules( true );
|
||||||
m_toolManager->GetTool<SELECTION_TOOL>()->SetEditModules( true );
|
m_toolManager->GetTool<SELECTION_TOOL>()->SetEditModules( true );
|
||||||
m_toolManager->GetTool<EDIT_TOOL>()->SetEditModules( true );
|
m_toolManager->GetTool<EDIT_TOOL>()->SetEditModules( true );
|
||||||
m_toolManager->GetTool<DRAWING_TOOL>()->SetEditModules( true );
|
m_toolManager->GetTool<DRAWING_TOOL>()->SetEditModules( true );
|
||||||
|
|
||||||
|
m_toolManager->InitTools();
|
||||||
|
|
||||||
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,23 +87,6 @@ void MODULE_EDITOR_TOOLS::Reset( RESET_REASON aReason )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MODULE_EDITOR_TOOLS::Init()
|
|
||||||
{
|
|
||||||
// Find the selection tool, so they can cooperate
|
|
||||||
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
|
||||||
|
|
||||||
if( !selectionTool )
|
|
||||||
{
|
|
||||||
DisplayError( NULL, wxT( "pcbnew.InteractiveSelection tool is not available" ) );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
selectionTool->GetToolMenu().GetMenu().AddItem( COMMON_ACTIONS::enumeratePads );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MODULE_EDITOR_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
|
int MODULE_EDITOR_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
m_frame->SetToolID( ID_MODEDIT_PAD_TOOL, wxCURSOR_PENCIL, _( "Add pads" ) );
|
m_frame->SetToolID( ID_MODEDIT_PAD_TOOL, wxCURSOR_PENCIL, _( "Add pads" ) );
|
||||||
|
|
|
@ -50,9 +50,6 @@ public:
|
||||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||||
void Reset( RESET_REASON aReason ) override;
|
void Reset( RESET_REASON aReason ) override;
|
||||||
|
|
||||||
/// @copydoc TOOL_INTERACTIVE::Init()
|
|
||||||
bool Init() override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function PlacePad()
|
* Function PlacePad()
|
||||||
* Places a pad in module editor.
|
* Places a pad in module editor.
|
||||||
|
|
|
@ -47,7 +47,9 @@ public:
|
||||||
|
|
||||||
using SHOW_FUNCTOR = std::function<bool()>;
|
using SHOW_FUNCTOR = std::function<bool()>;
|
||||||
|
|
||||||
PAD_CONTEXT_MENU( SHOW_FUNCTOR aHaveGlobalPadSetting):
|
PAD_CONTEXT_MENU( bool aEditingFootprint,
|
||||||
|
SHOW_FUNCTOR aHaveGlobalPadSetting ):
|
||||||
|
m_editingFootprint( aEditingFootprint ),
|
||||||
m_haveGlobalPadSettings( aHaveGlobalPadSetting )
|
m_haveGlobalPadSettings( aHaveGlobalPadSetting )
|
||||||
{
|
{
|
||||||
SetIcon( pad_xpm );
|
SetIcon( pad_xpm );
|
||||||
|
@ -56,13 +58,21 @@ public:
|
||||||
Add( COMMON_ACTIONS::copyPadSettings );
|
Add( COMMON_ACTIONS::copyPadSettings );
|
||||||
Add( COMMON_ACTIONS::applyPadSettings );
|
Add( COMMON_ACTIONS::applyPadSettings );
|
||||||
Add( COMMON_ACTIONS::pushPadSettings );
|
Add( COMMON_ACTIONS::pushPadSettings );
|
||||||
|
|
||||||
|
// show modedit-specific items
|
||||||
|
if( m_editingFootprint )
|
||||||
|
{
|
||||||
|
AppendSeparator();
|
||||||
|
|
||||||
|
Add( COMMON_ACTIONS::enumeratePads );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
CONTEXT_MENU* create() const override
|
CONTEXT_MENU* create() const override
|
||||||
{
|
{
|
||||||
return new PAD_CONTEXT_MENU( m_haveGlobalPadSettings );
|
return new PAD_CONTEXT_MENU( m_editingFootprint, m_haveGlobalPadSettings );
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -111,6 +121,7 @@ private:
|
||||||
Enable( getMenuId( COMMON_ACTIONS::pushPadSettings ), enablements.canPush );
|
Enable( getMenuId( COMMON_ACTIONS::pushPadSettings ), enablements.canPush );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool m_editingFootprint;
|
||||||
SHOW_FUNCTOR m_haveGlobalPadSettings;
|
SHOW_FUNCTOR m_haveGlobalPadSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -152,7 +163,8 @@ bool PAD_TOOL::Init()
|
||||||
return hasMasterPadSettings();
|
return hasMasterPadSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
auto contextMenu = std::make_shared<PAD_CONTEXT_MENU>( haveMasterPad );
|
auto contextMenu = std::make_shared<PAD_CONTEXT_MENU>(
|
||||||
|
EditingModules(), haveMasterPad );
|
||||||
contextMenu->SetTool( this );
|
contextMenu->SetTool( this );
|
||||||
|
|
||||||
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
||||||
|
|
Loading…
Reference in New Issue