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

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

Fix 2 coverity warnings.
parent 2047d873
...@@ -30,7 +30,7 @@ ...@@ -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
/** /**
......
...@@ -716,17 +716,17 @@ wxString EDA_DRAW_FRAME::LengthDoubleToString( double aValue, bool aConvertToMil ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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;
} }
...@@ -1162,13 +1162,23 @@ void EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, ...@@ -1162,13 +1162,23 @@ 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
......
...@@ -1495,7 +1495,9 @@ void EDA_DRAW_PANEL::CallMouseCapture( wxDC* aDC, const wxPoint& aPosition, bool ...@@ -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." ) );
m_endMouseCaptureCallback( this, aDC ); // CallEndMouseCapture is sometimes called with m_endMouseCaptureCallback == NULL
// for instance after an ABORT in block paste.
if( m_endMouseCaptureCallback )
m_endMouseCaptureCallback( this, aDC );
} }
...@@ -292,7 +292,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC ) ...@@ -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 );
......
...@@ -428,7 +428,7 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -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;
......
...@@ -139,7 +139,7 @@ int PCBNEW_CONTROL::ZoomPreset( const TOOL_EVENT& aEvent ) ...@@ -139,7 +139,7 @@ int PCBNEW_CONTROL::ZoomPreset( const TOOL_EVENT& aEvent )
{ {
return ZoomFitScreen( aEvent ); return ZoomFitScreen( aEvent );
} }
else if( idx < 0 || idx >= zoomList.size() ) else if( idx >= zoomList.size() )
{ {
assert( false ); assert( false );
return 0; return 0;
......
...@@ -72,6 +72,8 @@ SELECTION_TOOL::SELECTION_TOOL() : ...@@ -72,6 +72,8 @@ SELECTION_TOOL::SELECTION_TOOL() :
m_frame( NULL ), m_additive( false ), m_multiple( false ), m_frame( NULL ), m_additive( false ), m_multiple( false ),
m_editModules( false ), m_locked( true ) m_editModules( false ), m_locked( true )
{ {
// Do not leave uninitialized members:
m_preliminary = false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment