From 491ac0256df0b03e0199f70463daf0be2901eced Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 14 Jun 2020 07:23:10 -0700 Subject: [PATCH] pcbnew: Add a number of missing handles for module zones --- pcbnew/board_commit.cpp | 3 ++- pcbnew/class_board.cpp | 2 ++ pcbnew/kicad_clipboard.cpp | 2 ++ pcbnew/tools/edit_tool.cpp | 8 ++++++++ pcbnew/tools/selection_tool.cpp | 2 ++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index 42039ac1c9..b83583a6e8 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -149,7 +149,8 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a board->Modules().front()->Add( boardItem ); } else if( boardItem->Type() == PCB_MODULE_TEXT_T || - boardItem->Type() == PCB_MODULE_EDGE_T ) + boardItem->Type() == PCB_MODULE_EDGE_T || + boardItem->Type() == PCB_MODULE_ZONE_AREA_T ) { wxASSERT( boardItem->GetParent() && boardItem->GetParent()->Type() == PCB_MODULE_T ); diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index e8d4a642cb..2aea2d3ec2 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -941,6 +941,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s case PCB_PAD_T: case PCB_MODULE_TEXT_T: case PCB_MODULE_EDGE_T: + case PCB_MODULE_ZONE_AREA_T: // this calls MODULE::Visit() on each module. result = IterateForward( m_modules, inspector, testData, p ); @@ -954,6 +955,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s case PCB_PAD_T: case PCB_MODULE_TEXT_T: case PCB_MODULE_EDGE_T: + case PCB_MODULE_ZONE_AREA_T: continue; default: diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index 6f7a5d0267..349940a656 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -82,6 +82,7 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected ) // check if it not one of the module primitives if( ( i->Type() != PCB_MODULE_EDGE_T ) && ( i->Type() != PCB_MODULE_TEXT_T ) && + ( i->Type() != PCB_MODULE_ZONE_AREA_T ) && ( i->Type() != PCB_PAD_T ) ) { onlyModuleParts = false; @@ -167,6 +168,7 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected ) // Dont format stuff that cannot exist standalone! if( ( i->Type() != PCB_MODULE_EDGE_T ) && ( i->Type() != PCB_MODULE_TEXT_T ) && + ( i->Type() != PCB_MODULE_ZONE_AREA_T ) && ( i->Type() != PCB_PAD_T ) ) { auto item = static_cast( i ); diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 659188655c..13fb807563 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -762,6 +762,7 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) { case PCB_MODULE_EDGE_T: case PCB_MODULE_TEXT_T: + case PCB_MODULE_ZONE_AREA_T: case PCB_PAD_T: // Only create undo entry for items on the board if( !item->IsNew() && !EditingModules() ) @@ -782,6 +783,13 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) break; } + case PCB_MODULE_ZONE_AREA_T: + { + auto& zone = static_cast( *item ); + zone.Mirror( mirrorPoint, false ); + break; + } + case PCB_MODULE_TEXT_T: { auto& modText = static_cast( *item ); diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index f105b54331..8488f5b2c2 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -646,6 +646,7 @@ SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock() case PCB_MODULE_EDGE_T: case PCB_MODULE_TEXT_T: + case PCB_MODULE_ZONE_AREA_T: if( static_cast( item->GetParent() )->IsLocked() ) containsLocked = true; break; @@ -1546,6 +1547,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn switch( aItem->Type() ) { case PCB_ZONE_AREA_T: + case PCB_MODULE_ZONE_AREA_T: { // Check to see if this keepout is part of a footprint // If it is, and we are not editing the footprint, it should not be selectable