mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Fix initialization order of the events in pcbnew
The TOOL_EVENT constructor searches for ACTONS::cancelInteractive. That action is global, so we need to ensure it is created before we try to create these events - so switch to a create on first use paradigm for the events.
This commit is contained in:
parent
2ddcc7a7ad
commit
d5c5050d29
@ -3223,7 +3223,7 @@ bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aS
|
||||
// Pass events unless we receive a null event, then we must shut down
|
||||
if( TOOL_EVENT* evt = Wait() )
|
||||
{
|
||||
if( evt->Matches( PCB_EVENTS::SnappingModeChangedByKeyEvent ) )
|
||||
if( evt->Matches( PCB_EVENTS::SnappingModeChangedByKeyEvent() ) )
|
||||
{
|
||||
// Update the layer set when the snapping mode changes
|
||||
setPickerLayerSet();
|
||||
|
@ -2507,8 +2507,20 @@ TOOL_ACTION PCB_ACTIONS::ddImportFootprint( TOOL_ACTION_ARGS()
|
||||
.Name( "pcbnew.Control.ddImportFootprint" )
|
||||
.Scope( AS_GLOBAL ) );
|
||||
|
||||
const TOOL_EVENT PCB_EVENTS::SnappingModeChangedByKeyEvent( TC_MESSAGE, TA_ACTION,
|
||||
"common.Interactive.snappingModeChangedByKey" );
|
||||
|
||||
const TOOL_EVENT PCB_EVENTS::LayerPairPresetChangedByKeyEvent( TC_MESSAGE, TA_ACTION,
|
||||
"pcbnew.Control.layerPairPresetChangedByKey" );
|
||||
const TOOL_EVENT& PCB_EVENTS::SnappingModeChangedByKeyEvent()
|
||||
{
|
||||
static TOOL_EVENT event = TOOL_EVENT( TC_MESSAGE, TA_ACTION,
|
||||
"common.Interactive.snappingModeChangedByKey" );
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
const TOOL_EVENT& PCB_EVENTS::LayerPairPresetChangedByKeyEvent()
|
||||
{
|
||||
static TOOL_EVENT event = TOOL_EVENT( TC_MESSAGE, TA_ACTION,
|
||||
"pcbnew.Control.layerPairPresetChangedByKey" );
|
||||
|
||||
return event;
|
||||
}
|
||||
|
@ -596,9 +596,12 @@ public:
|
||||
class PCB_EVENTS
|
||||
{
|
||||
public:
|
||||
// These are functions that access the underlying event because the event constructor
|
||||
// needs the ACTION::cancelInteractive action, so we must
|
||||
|
||||
/// Hotkey feedback
|
||||
const static TOOL_EVENT SnappingModeChangedByKeyEvent;
|
||||
const static TOOL_EVENT LayerPairPresetChangedByKeyEvent;
|
||||
static const TOOL_EVENT& SnappingModeChangedByKeyEvent();
|
||||
static const TOOL_EVENT& LayerPairPresetChangedByKeyEvent();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -640,7 +640,7 @@ int PCB_CONTROL::CycleLayerPresets( const TOOL_EVENT& aEvent )
|
||||
|
||||
settings->SetCurrentLayerPair( nextPair );
|
||||
|
||||
m_toolMgr->PostEvent( PCB_EVENTS::LayerPairPresetChangedByKeyEvent );
|
||||
m_toolMgr->PostEvent( PCB_EVENTS::LayerPairPresetChangedByKeyEvent() );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1589,7 +1589,7 @@ int PCB_CONTROL::SnapMode( const TOOL_EVENT& aEvent )
|
||||
else
|
||||
snapMode = !snapMode;
|
||||
|
||||
m_toolMgr->PostEvent( PCB_EVENTS::SnappingModeChangedByKeyEvent );
|
||||
m_toolMgr->PostEvent( PCB_EVENTS::SnappingModeChangedByKeyEvent() );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1971,7 +1971,7 @@ void PCB_CONTROL::setTransitions()
|
||||
Go( &PCB_CONTROL::LayerAlphaDec, PCB_ACTIONS::layerAlphaDec.MakeEvent() );
|
||||
|
||||
Go( &PCB_CONTROL::CycleLayerPresets, PCB_ACTIONS::layerPairPresetsCycle.MakeEvent() );
|
||||
Go( &PCB_CONTROL::LayerPresetFeedback, PCB_EVENTS::LayerPairPresetChangedByKeyEvent );
|
||||
Go( &PCB_CONTROL::LayerPresetFeedback, PCB_EVENTS::LayerPairPresetChangedByKeyEvent() );
|
||||
|
||||
// Grid control
|
||||
Go( &PCB_CONTROL::GridPlaceOrigin, ACTIONS::gridSetOrigin.MakeEvent() );
|
||||
@ -1984,7 +1984,7 @@ void PCB_CONTROL::setTransitions()
|
||||
Go( &PCB_CONTROL::SnapMode, PCB_ACTIONS::magneticSnapActiveLayer.MakeEvent() );
|
||||
Go( &PCB_CONTROL::SnapMode, PCB_ACTIONS::magneticSnapAllLayers.MakeEvent() );
|
||||
Go( &PCB_CONTROL::SnapMode, PCB_ACTIONS::magneticSnapToggle.MakeEvent() );
|
||||
Go( &PCB_CONTROL::SnapModeFeedback, PCB_EVENTS::SnappingModeChangedByKeyEvent );
|
||||
Go( &PCB_CONTROL::SnapModeFeedback, PCB_EVENTS::SnappingModeChangedByKeyEvent() );
|
||||
|
||||
// Miscellaneous
|
||||
Go( &PCB_CONTROL::InteractiveDelete, ACTIONS::deleteTool.MakeEvent() );
|
||||
|
Loading…
x
Reference in New Issue
Block a user