Added a hot key for (un)locking modules (GAL).

This commit is contained in:
Maciej Suminski 2015-09-03 17:35:41 +02:00
parent 8dbf6beed6
commit 9f41fe0bda
4 changed files with 38 additions and 4 deletions

View File

@ -220,11 +220,11 @@ TOOL_ACTION COMMON_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode",
"", "" );
TOOL_ACTION COMMON_ACTIONS::padDisplayMode( "pcbnew.Control.padDisplayMode",
AS_GLOBAL, 'J', // TODO temporarily, find a better hot key
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::viaDisplayMode( "pcbnew.Control.viaDisplayMode",
AS_GLOBAL, 'L', // TODO temporarily, find a better hot key
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::zoneDisplayEnable( "pcbnew.Control.zoneDisplayEnable",
@ -395,6 +395,10 @@ TOOL_ACTION COMMON_ACTIONS::crossProbeSchToPcb( "pcbnew.EditorControl.crossProbS
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::toggleLockModule( "pcbnew.EditorControl.toggleLockModule",
AS_GLOBAL, 'L',
"", "" );
TOOL_ACTION COMMON_ACTIONS::appendBoard( "pcbnew.EditorControl.appendBoard",
AS_GLOBAL, 0,
"", "" );

View File

@ -300,6 +300,7 @@ public:
static TOOL_ACTION highlightNetCursor;
static TOOL_ACTION drillOrigin;
static TOOL_ACTION crossProbeSchToPcb;
static TOOL_ACTION toggleLockModule;
static TOOL_ACTION appendBoard;
static TOOL_ACTION showHelp;
static TOOL_ACTION toBeDone;

View File

@ -317,6 +317,31 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ToggleLockModule( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const SELECTION& selection = selTool->GetSelection();
bool clearSelection = selection.Empty();
if( clearSelection )
m_toolMgr->RunAction( COMMON_ACTIONS::selectionCursor, true );
for( int i = 0; i < selection.Size(); ++i )
{
if( selection.Item<BOARD_ITEM>( i )->Type() == PCB_MODULE_T )
{
MODULE* module = selection.Item<MODULE>( i );
module->SetLocked( !module->IsLocked() );
}
}
if( clearSelection )
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
return 0;
}
int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW* view = getView();
@ -730,8 +755,9 @@ void PCB_EDITOR_CONTROL::SetTransitions()
Go( &PCB_EDITOR_CONTROL::PlaceModule, COMMON_ACTIONS::placeModule.MakeEvent() );
// Other
Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, SELECTION_TOOL::SelectedEvent );
Go( &PCB_EDITOR_CONTROL::CrossProbeSchToPcb, COMMON_ACTIONS::crossProbeSchToPcb.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ToggleLockModule, COMMON_ACTIONS::toggleLockModule.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, SELECTION_TOOL::SelectedEvent );
Go( &PCB_EDITOR_CONTROL::CrossProbeSchToPcb, COMMON_ACTIONS::crossProbeSchToPcb.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::DrillOrigin, COMMON_ACTIONS::drillOrigin.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HighlightNet, COMMON_ACTIONS::highlightNet.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, COMMON_ACTIONS::highlightNetCursor.MakeEvent() );

View File

@ -76,6 +76,9 @@ public:
*/
int PlaceModule( const TOOL_EVENT& aEvent );
///> (Un)locks module.
int ToggleLockModule( const TOOL_EVENT& aEvent );
///> Notifies eeschema about the selected item.
int CrossProbePcbToSch( const TOOL_EVENT& aEvent );