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
|
||||
{
|
||||
if( m_toolStack.empty() )
|
||||
|
|
|
@ -114,8 +114,6 @@ public:
|
|||
virtual void PushTool( const std::string& actionName );
|
||||
virtual void PopTool( const std::string& actionName );
|
||||
|
||||
void ClearToolStack();
|
||||
|
||||
bool ToolStackIsEmpty() { return m_toolStack.empty(); }
|
||||
|
||||
std::string CurrentToolName() const;
|
||||
|
|
|
@ -369,7 +369,6 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
|||
return 0;
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
|
||||
editFrame->PushTool( tool );
|
||||
Activate();
|
||||
controls->ShowCursor( true );
|
||||
|
@ -381,8 +380,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
|||
if( unselect )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
editFrame->ClearToolStack();
|
||||
|
||||
editFrame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -661,7 +659,6 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
|||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
editFrame->PopTool( tool );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1570,7 +1567,6 @@ bool EDIT_TOOL::updateModificationPoint( PCBNEW_SELECTION& aSelection )
|
|||
bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aSuccessMessage,
|
||||
const wxString& aCanceledMessage, VECTOR2I& aReferencePoint )
|
||||
{
|
||||
std::string tool = "pcbnew.InteractiveEdit.selectReferencePoint";
|
||||
STATUS_TEXT_POPUP statusPopup( frame() );
|
||||
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
|
||||
OPT<VECTOR2I> pickedPoint;
|
||||
|
@ -1625,6 +1621,7 @@ bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aS
|
|||
statusPopup.Move( wxGetMousePosition() + wxPoint( 20, -50 ) );
|
||||
statusPopup.Popup();
|
||||
|
||||
std::string tool = "";
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
|
||||
while( !done )
|
||||
|
@ -1642,8 +1639,10 @@ bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aS
|
|||
|
||||
int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = "pcbnew.InteractiveEdit.selectReferencePoint";
|
||||
CLIPBOARD_IO io;
|
||||
|
||||
frame()->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
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 );
|
||||
} );
|
||||
|
||||
if( selection.Empty() )
|
||||
return 1;
|
||||
|
||||
if( !selection.Empty() )
|
||||
{
|
||||
VECTOR2I refPoint;
|
||||
bool rv = pickReferencePoint( _( "Select reference point for the copy..." ),
|
||||
_( "Selection copied." ), _( "Copy cancelled." ), refPoint );
|
||||
_( "Selection copied." ),
|
||||
_( "Copy cancelled." ),
|
||||
refPoint );
|
||||
frame()->SetMsgPanel( board() );
|
||||
|
||||
if( !rv )
|
||||
return 1;
|
||||
|
||||
if( rv )
|
||||
{
|
||||
selection.SetReferencePoint( refPoint );
|
||||
|
||||
io.SetBoard( board() );
|
||||
io.SaveSelection( selection, m_editModules );
|
||||
}
|
||||
}
|
||||
|
||||
frame()->PopTool( tool );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,10 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
int finalize_state = WAIT_CANCEL;
|
||||
|
||||
std::string tool = *aEvent.Parameter<std::string*>();
|
||||
|
||||
if( !tool.empty() )
|
||||
frame->PushTool( tool );
|
||||
|
||||
Activate();
|
||||
setControls();
|
||||
|
||||
|
@ -152,7 +155,10 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
reset();
|
||||
controls->ForceCursorPosition( false );
|
||||
|
||||
if( !tool.empty() )
|
||||
frame->PopTool( tool );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue