From bd800630be76cb69b0481465b144d6a6283f32bc Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Mon, 29 Feb 2016 16:12:03 -0500 Subject: [PATCH] Pcbnew: prevent delete hot key from deleting locked footprints. (fixes lp:1538805) --- pcbnew/hotkeys_board_editor.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 0b4e20700f..3f2c51879f 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -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 @@ -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 ); @@ -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(); @@ -920,6 +921,7 @@ bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand ) return false; } + bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC ) { BOARD_ITEM* item = GetCurItem(); @@ -1133,6 +1135,7 @@ bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand ) return false; } + bool PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem( int aIdCommand ) { BOARD_ITEM* item = GetCurItem();