Another attempt to fix the select-reference-point toolstack thing.
This time remove the push/pop from the picker tools as that's responsible for the issue of trying to re-activate the move action when its popped. Instead do the push/pop from the client code of other actions that need it, and not at all from the move-with- reference action. Fixes https://gitlab.com/kicad/code/kicad/issues/5336
This commit is contained in:
parent
50b182574d
commit
b8bbe72e48
|
@ -96,13 +96,6 @@ void TOOLS_HOLDER::PopTool( const std::string& actionName )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TOOLS_HOLDER::ClearToolStack()
|
|
||||||
{
|
|
||||||
m_toolStack.clear();
|
|
||||||
DisplayToolMsg( ACTIONS::selectionTool.GetLabel() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string TOOLS_HOLDER::CurrentToolName() const
|
std::string TOOLS_HOLDER::CurrentToolName() const
|
||||||
{
|
{
|
||||||
if( m_toolStack.empty() )
|
if( m_toolStack.empty() )
|
||||||
|
|
|
@ -114,8 +114,6 @@ public:
|
||||||
virtual void PushTool( const std::string& actionName );
|
virtual void PushTool( const std::string& actionName );
|
||||||
virtual void PopTool( const std::string& actionName );
|
virtual void PopTool( const std::string& actionName );
|
||||||
|
|
||||||
void ClearToolStack();
|
|
||||||
|
|
||||||
bool ToolStackIsEmpty() { return m_toolStack.empty(); }
|
bool ToolStackIsEmpty() { return m_toolStack.empty(); }
|
||||||
|
|
||||||
std::string CurrentToolName() const;
|
std::string CurrentToolName() const;
|
||||||
|
|
|
@ -369,7 +369,6 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
std::string tool = aEvent.GetCommandStr().get();
|
std::string tool = aEvent.GetCommandStr().get();
|
||||||
|
|
||||||
editFrame->PushTool( tool );
|
editFrame->PushTool( tool );
|
||||||
Activate();
|
Activate();
|
||||||
controls->ShowCursor( true );
|
controls->ShowCursor( true );
|
||||||
|
@ -381,8 +380,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
||||||
if( unselect )
|
if( unselect )
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||||
|
|
||||||
editFrame->ClearToolStack();
|
editFrame->PopTool( tool );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,7 +659,6 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||||
|
|
||||||
editFrame->PopTool( tool );
|
editFrame->PopTool( tool );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1570,7 +1567,6 @@ bool EDIT_TOOL::updateModificationPoint( PCBNEW_SELECTION& aSelection )
|
||||||
bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aSuccessMessage,
|
bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aSuccessMessage,
|
||||||
const wxString& aCanceledMessage, VECTOR2I& aReferencePoint )
|
const wxString& aCanceledMessage, VECTOR2I& aReferencePoint )
|
||||||
{
|
{
|
||||||
std::string tool = "pcbnew.InteractiveEdit.selectReferencePoint";
|
|
||||||
STATUS_TEXT_POPUP statusPopup( frame() );
|
STATUS_TEXT_POPUP statusPopup( frame() );
|
||||||
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
|
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
|
||||||
OPT<VECTOR2I> pickedPoint;
|
OPT<VECTOR2I> pickedPoint;
|
||||||
|
@ -1625,6 +1621,7 @@ bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aS
|
||||||
statusPopup.Move( wxGetMousePosition() + wxPoint( 20, -50 ) );
|
statusPopup.Move( wxGetMousePosition() + wxPoint( 20, -50 ) );
|
||||||
statusPopup.Popup();
|
statusPopup.Popup();
|
||||||
|
|
||||||
|
std::string tool = "";
|
||||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||||
|
|
||||||
while( !done )
|
while( !done )
|
||||||
|
@ -1642,8 +1639,10 @@ bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aS
|
||||||
|
|
||||||
int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent )
|
int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
|
std::string tool = "pcbnew.InteractiveEdit.selectReferencePoint";
|
||||||
CLIPBOARD_IO io;
|
CLIPBOARD_IO io;
|
||||||
|
|
||||||
|
frame()->PushTool( tool );
|
||||||
Activate();
|
Activate();
|
||||||
|
|
||||||
PCBNEW_SELECTION& selection = m_selectionTool->RequestSelection(
|
PCBNEW_SELECTION& selection = m_selectionTool->RequestSelection(
|
||||||
|
@ -1651,21 +1650,25 @@ int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent )
|
||||||
EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS, sTool );
|
EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS, sTool );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
if( selection.Empty() )
|
if( !selection.Empty() )
|
||||||
return 1;
|
{
|
||||||
|
VECTOR2I refPoint;
|
||||||
|
bool rv = pickReferencePoint( _( "Select reference point for the copy..." ),
|
||||||
|
_( "Selection copied." ),
|
||||||
|
_( "Copy cancelled." ),
|
||||||
|
refPoint );
|
||||||
|
frame()->SetMsgPanel( board() );
|
||||||
|
|
||||||
VECTOR2I refPoint;
|
if( rv )
|
||||||
bool rv = pickReferencePoint( _( "Select reference point for the copy..." ),
|
{
|
||||||
_( "Selection copied." ), _( "Copy cancelled." ), refPoint );
|
selection.SetReferencePoint( refPoint );
|
||||||
frame()->SetMsgPanel( board() );
|
|
||||||
|
|
||||||
if( !rv )
|
io.SetBoard( board() );
|
||||||
return 1;
|
io.SaveSelection( selection, m_editModules );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
selection.SetReferencePoint( refPoint );
|
frame()->PopTool( tool );
|
||||||
|
|
||||||
io.SetBoard( board() );
|
|
||||||
io.SaveSelection( selection, m_editModules );
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,10 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
int finalize_state = WAIT_CANCEL;
|
int finalize_state = WAIT_CANCEL;
|
||||||
|
|
||||||
std::string tool = *aEvent.Parameter<std::string*>();
|
std::string tool = *aEvent.Parameter<std::string*>();
|
||||||
frame->PushTool( tool );
|
|
||||||
|
if( !tool.empty() )
|
||||||
|
frame->PushTool( tool );
|
||||||
|
|
||||||
Activate();
|
Activate();
|
||||||
setControls();
|
setControls();
|
||||||
|
|
||||||
|
@ -152,7 +155,10 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
controls->ForceCursorPosition( false );
|
controls->ForceCursorPosition( false );
|
||||||
frame->PopTool( tool );
|
|
||||||
|
if( !tool.empty() )
|
||||||
|
frame->PopTool( tool );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue