Skip to content

Commit

Permalink
Pcbnew: prevent delete hot key from deleting locked footprints. (fixe…
Browse files Browse the repository at this point in the history
…s lp:1538805)
  • Loading branch information
Wayne Stambaugh committed Feb 29, 2016
1 parent 4d2a058 commit bd80063
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pcbnew/hotkeys_board_editor.cpp
Expand Up @@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -647,7 +647,7 @@ bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
wxPoint pos = RefPos( false );
MODULE* module = GetBoard()->GetFootprint( pos, UNDEFINED_LAYER, false );

if( module == NULL )
if( module == NULL || module->IsLocked() )
return false;

RemoveStruct( module, aDC );
Expand All @@ -661,13 +661,14 @@ bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
{
item = PcbGeneralLocateAndDisplay();

if( item == NULL )
// Shouldn't there be a check for locked tracks and vias here?
if( item == NULL || (item->Type() == PCB_MODULE_T && (MODULE*)item->IsLocked()) )
return false;

RemoveStruct( item, aDC );
}
else
return false;
return false;
}

OnModify();
Expand Down Expand Up @@ -920,6 +921,7 @@ bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
return false;
}


bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC )
{
BOARD_ITEM* item = GetCurItem();
Expand Down Expand Up @@ -1133,6 +1135,7 @@ bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
return false;
}


bool PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
Expand Down

0 comments on commit bd80063

Please sign in to comment.