Common-ize EE_ACTIONS::refreshPreview and use it after cursor actions.

Fixes: lp:1818667
* https://bugs.launchpad.net/kicad/+bug/1818667
This commit is contained in:
Jeff Young 2019-07-04 21:56:21 +01:00
parent 867585c1f2
commit a9c66e15ea
14 changed files with 29 additions and 27 deletions

View File

@ -354,6 +354,9 @@ TOOL_ACTION ACTIONS::cursorDblClick( "common.Control.cursorDblClick",
_( "Double-click" ), "Performs left mouse button double-click",
nullptr, AF_NONE, (void*) CURSOR_DBL_CLICK );
TOOL_ACTION ACTIONS::refreshPreview( "common.Control.refreshPreview",
AS_GLOBAL );
TOOL_ACTION ACTIONS::panUp( "common.Control.panUp",
AS_GLOBAL,
MD_SHIFT + WXK_UP, "",

View File

@ -119,6 +119,7 @@ int COMMON_TOOLS::CursorControl( const TOOL_EVENT& aEvent )
}
getViewControls()->SetCursorPosition( cursor, true, true );
m_toolMgr->RunAction( ACTIONS::refreshPreview );
return 0;
}

View File

@ -496,9 +496,6 @@ TOOL_ACTION EE_ACTIONS::breakBus( "eeschema.InteractiveEdit.breakBus",
// SCH_EDITOR_CONTROL
//
TOOL_ACTION EE_ACTIONS::refreshPreview( "eeschema.EditorControl.refreshPreview",
AS_GLOBAL );
TOOL_ACTION EE_ACTIONS::restartMove( "eeschema.EditorControl.restartMove",
AS_GLOBAL );

View File

@ -182,7 +182,6 @@ public:
static TOOL_ACTION editTextAndGraphics;
static TOOL_ACTION toggleHiddenPins;
static TOOL_ACTION toggleSyncedPinsMode;
static TOOL_ACTION refreshPreview;
static TOOL_ACTION restartMove;
static TOOL_ACTION explicitCrossProbe;
static TOOL_ACTION pushPinLength;

View File

@ -211,7 +211,7 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( item && ( evt->IsAction( &EE_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
static_cast<LIB_ITEM*>( item )->SetPosition( wxPoint( cursorPos.x, -cursorPos.y) );
m_view->ClearPreview();
@ -348,7 +348,7 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
}
}
else if( item && ( evt->IsAction( &EE_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
item->CalcEdit( wxPoint( cursorPos.x, -cursorPos.y) );
m_view->ClearPreview();

View File

@ -104,7 +104,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
controls->SetSnapping( !evt->Modifier( MD_ALT ) );
if( evt->IsAction( &EE_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
|| evt->IsAction( &EE_ACTIONS::refreshPreview ) )
|| evt->IsAction( &ACTIONS::refreshPreview ) )
{
if( !m_moveInProgress ) // Prepare to start moving/dragging
{

View File

@ -107,7 +107,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
if( component )
{
getViewControls()->WarpCursor( getViewControls()->GetMousePosition( false ) );
m_toolMgr->RunAction( EE_ACTIONS::refreshPreview );
m_toolMgr->RunAction( ACTIONS::refreshPreview );
}
else if( aEvent.HasPosition() )
m_toolMgr->RunAction( EE_ACTIONS::cursorClick );
@ -210,11 +210,11 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
if( component )
{
m_frame->SelectUnit( component, unit );
m_toolMgr->RunAction( EE_ACTIONS::refreshPreview );
m_toolMgr->RunAction( ACTIONS::refreshPreview );
}
}
}
else if( component && ( evt->IsAction( &EE_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
else if( component && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
component->SetPosition( (wxPoint)cursorPos );
m_view->ClearPreview();
@ -252,7 +252,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
// Prime the pump
if( image )
m_toolMgr->RunAction( EE_ACTIONS::refreshPreview );
m_toolMgr->RunAction( ACTIONS::refreshPreview );
else if( aEvent.HasPosition() )
m_toolMgr->RunAction( ACTIONS::cursorClick );
@ -363,7 +363,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( image && ( evt->IsAction( &EE_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
else if( image && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
image->SetPosition( (wxPoint)cursorPos );
m_view->ClearPreview();
@ -481,7 +481,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
{
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( evt->IsAction( &EE_ACTIONS::refreshPreview ) || evt->IsMotion() )
else if( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() )
{
previewItem->SetPosition( (wxPoint)cursorPos );
m_view->ClearPreview();
@ -668,7 +668,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
else
item = nullptr;
}
else if( item && ( evt->IsAction( &EE_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
static_cast<SCH_ITEM*>( item )->SetPosition( (wxPoint) cursorPos );
m_view->ClearPreview();
@ -778,7 +778,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
sheet = nullptr;
}
else if( sheet && ( evt->IsAction( &EE_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
else if( sheet && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
sizeSheet( sheet, cursorPos );
m_view->ClearPreview();

View File

@ -495,7 +495,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
if( item->IsMoving() )
{
m_toolMgr->RunAction( EE_ACTIONS::refreshPreview );
m_toolMgr->RunAction( ACTIONS::refreshPreview );
}
else
{
@ -677,7 +677,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
if( item->IsMoving() )
{
m_toolMgr->RunAction( EE_ACTIONS::refreshPreview );
m_toolMgr->RunAction( ACTIONS::refreshPreview );
}
else
{
@ -1145,7 +1145,7 @@ int SCH_EDIT_TOOL::ConvertDeMorgan( const TOOL_EVENT& aEvent )
m_frame->ConvertPart( component );
if( component->IsNew() )
m_toolMgr->RunAction( EE_ACTIONS::refreshPreview );
m_toolMgr->RunAction( ACTIONS::refreshPreview );
return 0;
}

View File

@ -166,7 +166,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
if( evt->IsAction( &EE_ACTIONS::moveActivate ) || evt->IsAction( &EE_ACTIONS::restartMove )
|| evt->IsAction( &EE_ACTIONS::move ) || evt->IsAction( &EE_ACTIONS::drag )
|| evt->IsMotion() || evt->IsDrag( BUT_LEFT )
|| evt->IsAction( &EE_ACTIONS::refreshPreview ) )
|| evt->IsAction( &ACTIONS::refreshPreview ) )
{
if( !m_moveInProgress ) // Prepare to start moving/dragging
{
@ -383,7 +383,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
if( component )
{
m_frame->SelectUnit( component, unit );
m_toolMgr->RunAction( EE_ACTIONS::refreshPreview );
m_toolMgr->RunAction( ACTIONS::refreshPreview );
}
}
}

View File

@ -96,6 +96,9 @@ public:
static TOOL_ACTION toggleCursorStyle;
static TOOL_ACTION highContrastMode;
static TOOL_ACTION refreshPreview; // Similar to a synthetic mouseMoved event, but also
// used after a rotate, mirror, etc.
/// Cursor control with keyboard
static TOOL_ACTION cursorUp;
static TOOL_ACTION cursorDown;

View File

@ -80,9 +80,6 @@ TOOL_ACTION PL_ACTIONS::deleteItemCursor( "plEditor.InteractiveEdit.deleteTool",
// PL_EDITOR_CONTROL
//
TOOL_ACTION PL_ACTIONS::refreshPreview( "plEditor.EditorControl.refreshPreview",
AS_GLOBAL );
TOOL_ACTION PL_ACTIONS::toggleBackground( "plEditor.EditorControl.ToggleBackground",
AS_GLOBAL, 0, "",
_( "Background White" ), _( "Switch between white and black background" ),

View File

@ -167,7 +167,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( item && ( evt->IsAction( &PL_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
item->GetPeer()->MoveStartPointToUi( (wxPoint) cursorPos );
item->SetPosition( item->GetPeer()->GetStartPosUi( 0 ) );
@ -253,7 +253,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
}
}
else if( evt->IsAction( &PL_ACTIONS::refreshPreview ) || evt->IsMotion() )
else if( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() )
{
if( item )
{

View File

@ -122,7 +122,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
controls->SetSnapping( !evt->Modifier( MD_ALT ) );
if( evt->IsAction( &PL_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
|| evt->IsAction( &PL_ACTIONS::refreshPreview ) )
|| evt->IsAction( &ACTIONS::refreshPreview ) )
{
//------------------------------------------------------------------------
// Start a move operation

View File

@ -308,7 +308,9 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
if( evt->IsAction( &PCB_ACTIONS::editActivate ) ||
evt->IsAction( &PCB_ACTIONS::move ) ||
evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
evt->IsMotion() ||
evt->IsDrag( BUT_LEFT ) ||
evt->IsAction( &ACTIONS::refreshPreview ) )
{
if( m_dragging && evt->Category() == TC_MOUSE )
{