Commit d41bc31c authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Fix bug #1447905 (very minor bug, in fact). Fix a few minor coding style issues.

Fix 2 coverity warnings.
parent 2047d873
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -30,7 +30,7 @@
#endif
#endif


#ifndef KICAD_BUILD_VERSION
#ifndef KICAD_BUILD_VERSION
#   define KICAD_BUILD_VERSION "(after 2015-apr-15 BZR unknown)"
#   define KICAD_BUILD_VERSION "(after 2015-may-01 BZR unknown)"
#endif
#endif


/**
/**
+31 −21
Original line number Original line Diff line number Diff line
@@ -716,17 +716,17 @@ wxString EDA_DRAW_FRAME::LengthDoubleToString( double aValue, bool aConvertToMil


bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosition )
bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosition )
{
{
    BLOCK_SELECTOR* Block = &GetScreen()->m_BlockLocate;
    BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;


    if( ( Block->GetCommand() != BLOCK_IDLE ) || ( Block->GetState() != STATE_NO_BLOCK ) )
    if( ( block->GetCommand() != BLOCK_IDLE ) || ( block->GetState() != STATE_NO_BLOCK ) )
        return false;
        return false;


    Block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
    block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );


    if( Block->GetCommand() == 0 )
    if( block->GetCommand() == 0 )
        return false;
        return false;


    switch( Block->GetCommand() )
    switch( block->GetCommand() )
    {
    {
    case BLOCK_IDLE:
    case BLOCK_IDLE:
        break;
        break;
@@ -744,17 +744,17 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosi
    case BLOCK_MIRROR_X:
    case BLOCK_MIRROR_X:
    case BLOCK_MIRROR_Y:            // mirror
    case BLOCK_MIRROR_Y:            // mirror
    case BLOCK_PRESELECT_MOVE:      // Move with preselection list
    case BLOCK_PRESELECT_MOVE:      // Move with preselection list
        Block->InitData( m_canvas, aPosition );
        block->InitData( m_canvas, aPosition );
        break;
        break;


    case BLOCK_PASTE:
    case BLOCK_PASTE:
        Block->InitData( m_canvas, aPosition );
        block->InitData( m_canvas, aPosition );
        Block->SetLastCursorPosition( wxPoint( 0, 0 ) );
        block->SetLastCursorPosition( wxPoint( 0, 0 ) );
        InitBlockPasteInfos();
        InitBlockPasteInfos();


        if( Block->GetCount() == 0 )      // No data to paste
        if( block->GetCount() == 0 )      // No data to paste
        {
        {
            DisplayError( this, wxT( "No Block to paste" ), 20 );
            DisplayError( this, wxT( "No block to paste" ), 20 );
            GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
            GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
            m_canvas->SetMouseCaptureCallback( NULL );
            m_canvas->SetMouseCaptureCallback( NULL );
            return true;
            return true;
@@ -762,13 +762,13 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosi


        if( !m_canvas->IsMouseCaptured() )
        if( !m_canvas->IsMouseCaptured() )
        {
        {
            Block->ClearItemsList();
            block->ClearItemsList();
            DisplayError( this,
            DisplayError( this,
                          wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
                          wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
            return true;
            return true;
        }
        }


        Block->SetState( STATE_BLOCK_MOVE );
        block->SetState( STATE_BLOCK_MOVE );
        m_canvas->CallMouseCapture( aDC, aPosition, false );
        m_canvas->CallMouseCapture( aDC, aPosition, false );
        break;
        break;


@@ -776,13 +776,13 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosi
        {
        {
            wxString msg;
            wxString msg;
            msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
            msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
            Block->GetCommand();
            block->GetCommand();
            DisplayError( this, msg );
            DisplayError( this, msg );
        }
        }
        break;
        break;
    }
    }


    Block->SetMessageBlock( this );
    block->SetMessageBlock( this );
    return true;
    return true;
}
}


@@ -1163,12 +1163,22 @@ void EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos,
    switch( aHotKey )
    switch( aHotKey )
    {
    {
    // All these keys have almost the same treatment
    // All these keys have almost the same treatment
    case GR_KB_CTRL | WXK_NUMPAD8: case GR_KB_CTRL | WXK_UP:
    case GR_KB_CTRL | WXK_NUMPAD8:
    case GR_KB_CTRL | WXK_NUMPAD2: case GR_KB_CTRL | WXK_DOWN:
    case GR_KB_CTRL | WXK_UP:
    case GR_KB_CTRL | WXK_NUMPAD4: case GR_KB_CTRL | WXK_LEFT:
    case GR_KB_CTRL | WXK_NUMPAD2:
    case GR_KB_CTRL | WXK_NUMPAD6: case GR_KB_CTRL | WXK_RIGHT:
    case GR_KB_CTRL | WXK_DOWN:
    case WXK_NUMPAD8: case WXK_UP: case WXK_NUMPAD2: case WXK_DOWN:
    case GR_KB_CTRL | WXK_NUMPAD4:
    case WXK_NUMPAD4: case WXK_LEFT: case WXK_NUMPAD6: case WXK_RIGHT:
    case GR_KB_CTRL | WXK_LEFT:
    case GR_KB_CTRL | WXK_NUMPAD6:
    case GR_KB_CTRL | WXK_RIGHT:
    case WXK_NUMPAD8:
    case WXK_UP:
    case WXK_NUMPAD2:
    case WXK_DOWN:
    case WXK_NUMPAD4:
    case WXK_LEFT:
    case WXK_NUMPAD6:
    case WXK_RIGHT:
        {
        {
            /* Here's a tricky part: when doing cursor key movement, the
            /* Here's a tricky part: when doing cursor key movement, the
             * 'previous' point should be taken from memory, *not* from the
             * 'previous' point should be taken from memory, *not* from the
+4 −2
Original line number Original line Diff line number Diff line
@@ -1495,7 +1495,9 @@ void EDA_DRAW_PANEL::CallMouseCapture( wxDC* aDC, const wxPoint& aPosition, bool
void EDA_DRAW_PANEL::CallEndMouseCapture( wxDC* aDC )
void EDA_DRAW_PANEL::CallEndMouseCapture( wxDC* aDC )
{
{
    wxCHECK_RET( aDC != NULL, wxT( "Invalid device context." ) );
    wxCHECK_RET( aDC != NULL, wxT( "Invalid device context." ) );
    wxCHECK_RET( m_endMouseCaptureCallback != NULL, wxT( "End mouse capture callback not set." ) );


    // CallEndMouseCapture is sometimes called with m_endMouseCaptureCallback == NULL
    // for instance after an ABORT in block paste.
    if( m_endMouseCaptureCallback )
        m_endMouseCaptureCallback( this, aDC );
        m_endMouseCaptureCallback( this, aDC );
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -292,7 +292,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
            m_canvas->Refresh();
            m_canvas->Refresh();
            break;
            break;


        case BLOCK_SAVE:
        case BLOCK_SAVE:    // Save acopy of items in paste buffer
            GetScreen()->UpdatePickList();
            GetScreen()->UpdatePickList();
            DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
            DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );


+1 −1
Original line number Original line Diff line number Diff line
@@ -428,7 +428,7 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
    case HK_ZOOM_CENTER:
    case HK_ZOOM_CENTER:
    case HK_ZOOM_AUTO:
    case HK_ZOOM_AUTO:
    case HK_MOVEBLOCK_TO_DRAGBLOCK:          // Switch to drag mode, when block moving
    case HK_MOVEBLOCK_TO_DRAGBLOCK:          // Switch to drag mode, when block moving
    case HK_SAVE_BLOCK:                      // Copy block to clip board.
    case HK_SAVE_BLOCK:                      // Copy block to paste buffer.
        cmd.SetId( hotKey->m_IdMenuEvent );
        cmd.SetId( hotKey->m_IdMenuEvent );
        GetEventHandler()->ProcessEvent( cmd );
        GetEventHandler()->ProcessEvent( cmd );
        break;
        break;
Loading