Fix a few wxWidget asserts related to not existing block operations from mouse drag command.

block rotate and block mirror are not implemented in HandleBlockPlace.
(only available from context menu)

Fixes: lp:1847554
https://bugs.launchpad.net/kicad/+bug/1847554
This commit is contained in:
jean-pierre charras 2019-10-10 10:07:15 +02:00
parent 0210e414d2
commit 7856061cf0
6 changed files with 20 additions and 16 deletions

View File

@ -613,7 +613,7 @@ void EDA_DRAW_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
{
SetStatusText( msg, 5 );
SetStatusText( msg, 6 );
}

View File

@ -621,7 +621,7 @@ void EDA_DRAW_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
{
SetStatusText( msg, 5 );
SetStatusText( msg, 6 );
}

View File

@ -63,9 +63,14 @@ int SCH_EDIT_FRAME::BlockCommand( EDA_KEY key )
switch( key )
{
default:
cmd = key & 0xFF;
cmd = key & 0xFFFF;
if( cmd == 0 ) // All not handled values are seen as block move
cmd = BLOCK_MOVE;
break;
case GR_KB_ALT: // Should be BLOCK_ROTATE. Not suported: fall into move
case 0:
cmd = BLOCK_MOVE;
break;

View File

@ -171,7 +171,11 @@ int LIB_EDIT_FRAME::BlockCommand( EDA_KEY key )
switch( key )
{
default:
cmd = key & 0xFF;
cmd = key & 0xFFFF;
if( cmd == 0 ) // All not handled values are seen as block move
cmd = BLOCK_MOVE;
break;
case EDA_KEY_C( 0xffffffff ): // -1
@ -185,6 +189,8 @@ int LIB_EDIT_FRAME::BlockCommand( EDA_KEY key )
cmd = BLOCK_PRESELECT_MOVE;
break;
case GR_KB_ALT: // Should be BLOCK_ROTATE. Not suported: fall into move
case GR_KB_CTRL: // Should be BLOCK_MIRROR_Y. Not suported: fall into move
case GR_KEY_NONE:
cmd = BLOCK_MOVE;
break;
@ -193,18 +199,10 @@ int LIB_EDIT_FRAME::BlockCommand( EDA_KEY key )
cmd = BLOCK_DUPLICATE;
break;
case GR_KB_ALT:
cmd = BLOCK_ROTATE;
break;
case GR_KB_SHIFTCTRL:
cmd = BLOCK_DELETE;
break;
case GR_KB_CTRL:
cmd = BLOCK_MIRROR_Y;
break;
case MOUSE_MIDDLE:
cmd = BLOCK_ZOOM;
break;

View File

@ -259,6 +259,7 @@ void SCH_BASE_FRAME::UpdateStatusBar()
locformatter = "dx %f dy %f dist %f";
break;
case PERCENT:
case DEGREES:
wxASSERT( false );
break;
@ -525,6 +526,7 @@ bool SCH_BASE_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& a
case BLOCK_DELETE: // Delete
case BLOCK_COPY: // Copy
case BLOCK_FLIP: // Flip
case BLOCK_ROTATE: // Rotate
case BLOCK_ZOOM: // Window Zoom
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: // mirror
@ -574,7 +576,7 @@ bool SCH_BASE_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& a
break;
default:
wxFAIL_MSG( wxString::Format( "SCH_BASE_FRAME::HandleBlockBegin() unknown command: %s",
wxFAIL_MSG( wxString::Format( "SCH_BASE_FRAME::HandleBlockBegin() unknown command: %d",
block->GetCommand() ) );
break;
}

View File

@ -472,13 +472,12 @@ void SCH_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{
auto cmd = (GetParent()->GetToolId() == ID_ZOOM_SELECTION) ? BLOCK_ZOOM : 0;
DBG(printf("start block\n");)
// DBG(printf("start block\n"); fflush(0);)
if( !GetParent()->HandleBlockBegin( nullptr, cmd_type, m_CursorStartPos, cmd ) )
{
// should not occur: error
GetParent()->DisplayToolMsg(
wxT( "EDA_DRAW_PANEL::OnMouseEvent() Block Error" ) );
GetParent()->DisplayToolMsg( "SCH_DRAW_PANEL: Block Error" );
}
else
{