Clear hover selections after command.
Fixes https://gitlab.com/kicad/code/kicad/issues/13073
This commit is contained in:
parent
5a7982161d
commit
af71c2d877
|
@ -1560,15 +1560,18 @@ int SCH_EDITOR_CONTROL::Redo( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_EDITOR_CONTROL::doCopy( bool aUseLocalClipboard )
|
bool SCH_EDITOR_CONTROL::doCopy( bool aUseDuplicateClipboard )
|
||||||
{
|
{
|
||||||
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||||
EE_SELECTION& selection = selTool->RequestSelection();
|
EE_SELECTION& selection = selTool->RequestSelection();
|
||||||
SCHEMATIC& schematic = m_frame->Schematic();
|
SCHEMATIC& schematic = m_frame->Schematic();
|
||||||
|
|
||||||
if( !selection.GetSize() )
|
if( selection.Empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if( aUseDuplicateClipboard )
|
||||||
|
m_duplicateIsHoverSelection = selection.IsHover();
|
||||||
|
|
||||||
selection.SetScreen( m_frame->GetScreen() );
|
selection.SetScreen( m_frame->GetScreen() );
|
||||||
m_supplementaryClipboard.clear();
|
m_supplementaryClipboard.clear();
|
||||||
|
|
||||||
|
@ -1588,9 +1591,12 @@ bool SCH_EDITOR_CONTROL::doCopy( bool aUseLocalClipboard )
|
||||||
|
|
||||||
plugin.Format( &selection, &selPath, schematic, &formatter, true );
|
plugin.Format( &selection, &selPath, schematic, &formatter, true );
|
||||||
|
|
||||||
if( aUseLocalClipboard )
|
if( selection.IsHover() )
|
||||||
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
|
|
||||||
|
if( aUseDuplicateClipboard )
|
||||||
{
|
{
|
||||||
m_localClipboard = formatter.GetString();
|
m_duplicateClipboard = formatter.GetString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1778,7 +1784,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
||||||
VECTOR2I eventPos;
|
VECTOR2I eventPos;
|
||||||
|
|
||||||
if( aEvent.IsAction( &ACTIONS::duplicate ) )
|
if( aEvent.IsAction( &ACTIONS::duplicate ) )
|
||||||
content = m_localClipboard;
|
content = m_duplicateClipboard;
|
||||||
else
|
else
|
||||||
content = m_toolMgr->GetClipboardUTF8();
|
content = m_toolMgr->GetClipboardUTF8();
|
||||||
|
|
||||||
|
@ -2233,6 +2239,8 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selection.SetIsHover( m_duplicateIsHoverSelection );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2258,6 +2266,9 @@ int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent )
|
||||||
if( selection.GetSize() >= 1 )
|
if( selection.GetSize() >= 1 )
|
||||||
symbol = (SCH_SYMBOL*) selection.Front();
|
symbol = (SCH_SYMBOL*) selection.Front();
|
||||||
|
|
||||||
|
if( selection.IsHover() )
|
||||||
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
|
|
||||||
if( !symbol || symbol->GetEditFlags() != 0 )
|
if( !symbol || symbol->GetEditFlags() != 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -166,8 +166,8 @@ public:
|
||||||
const wxString& aSearchText );
|
const wxString& aSearchText );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///< copy selection to clipboard or to m_localClipboard if aUseLocalClipboard is true
|
///< copy selection to clipboard or to m_duplicateClipboard
|
||||||
bool doCopy( bool aUseLocalClipboard = false );
|
bool doCopy( bool aUseDuplicateClipboard = false );
|
||||||
|
|
||||||
bool rescueProject( RESCUER& aRescuer, bool aRunningOnDemand );
|
bool rescueProject( RESCUER& aRescuer, bool aRunningOnDemand );
|
||||||
|
|
||||||
|
@ -228,7 +228,8 @@ private:
|
||||||
EDA_ITEM* m_pickerItem; // Current item for picker highlighting.
|
EDA_ITEM* m_pickerItem; // Current item for picker highlighting.
|
||||||
|
|
||||||
// Temporary storage location for Duplicate action
|
// Temporary storage location for Duplicate action
|
||||||
std::string m_localClipboard;
|
std::string m_duplicateClipboard;
|
||||||
|
bool m_duplicateIsHoverSelection;
|
||||||
|
|
||||||
// A map of sheet filename --> screens for the clipboard contents. We use these to hook up
|
// A map of sheet filename --> screens for the clipboard contents. We use these to hook up
|
||||||
// cut/paste operations for unsaved sheet content.
|
// cut/paste operations for unsaved sheet content.
|
||||||
|
|
Loading…
Reference in New Issue