From 2661e7a8ee96a484fe472db71cfbf32ad8f50f77 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 6 Dec 2023 13:08:05 +0000 Subject: [PATCH] Fix over-zealous copy/paste and add a few more comments. --- pcbnew/generators/pcb_tuning_pattern.cpp | 6 +++--- pcbnew/pcb_generator.cpp | 4 ++-- pcbnew/pcb_generator.h | 6 ++++-- pcbnew/tools/pcb_point_editor.cpp | 10 +++++++--- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/pcbnew/generators/pcb_tuning_pattern.cpp b/pcbnew/generators/pcb_tuning_pattern.cpp index 3027f4e4eb..f8dc0735a0 100644 --- a/pcbnew/generators/pcb_tuning_pattern.cpp +++ b/pcbnew/generators/pcb_tuning_pattern.cpp @@ -406,7 +406,7 @@ public: void ShowPropertiesDialog( PCB_BASE_EDIT_FRAME* aEditFrame ) override; std::vector GetPreviewItems( GENERATOR_TOOL* aTool, PCB_BASE_EDIT_FRAME* aFrame, - bool aStatusOnly = false ) override; + bool aStatusItemsOnly = false ) override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; @@ -1848,14 +1848,14 @@ void PCB_TUNING_PATTERN::ShowPropertiesDialog( PCB_BASE_EDIT_FRAME* aEditFrame ) std::vector PCB_TUNING_PATTERN::GetPreviewItems( GENERATOR_TOOL* aTool, PCB_BASE_EDIT_FRAME* aFrame, - bool aStatusOnly ) + bool aStatusItemsOnly ) { std::vector previewItems; KIGFX::VIEW* view = aFrame->GetCanvas()->GetView(); if( auto* placer = dynamic_cast( aTool->Router()->Placer() ) ) { - if( !aStatusOnly ) + if( !aStatusItemsOnly ) { PNS::ITEM_SET items = placer->TunedPath(); diff --git a/pcbnew/pcb_generator.cpp b/pcbnew/pcb_generator.cpp index a0d1fb1493..ddfc9b4865 100644 --- a/pcbnew/pcb_generator.cpp +++ b/pcbnew/pcb_generator.cpp @@ -73,7 +73,7 @@ bool PCB_GENERATOR::Update( GENERATOR_TOOL* aTool, BOARD* aBoard, PCB_BASE_EDIT_ std::vector PCB_GENERATOR::GetPreviewItems( GENERATOR_TOOL* aTool, PCB_BASE_EDIT_FRAME* aFrame, - bool aStatusOnly ) + bool aStatusItemsOnly ) { return std::vector(); } @@ -86,7 +86,7 @@ bool PCB_GENERATOR::MakeEditPoints( std::shared_ptr aEditPoints ) c bool PCB_GENERATOR::UpdateFromEditPoints( std::shared_ptr aEditPoints, - BOARD_COMMIT* aCommit ) + BOARD_COMMIT* aCommit ) { return true; } diff --git a/pcbnew/pcb_generator.h b/pcbnew/pcb_generator.h index c6864e21fc..2409723568 100644 --- a/pcbnew/pcb_generator.h +++ b/pcbnew/pcb_generator.h @@ -63,14 +63,16 @@ public: virtual bool Update( GENERATOR_TOOL* aTool, BOARD* aBoard, PCB_BASE_EDIT_FRAME* aFrame, BOARD_COMMIT* aCommit ); +#define STATUS_ITEMS_ONLY true + virtual std::vector GetPreviewItems( GENERATOR_TOOL* aTool, PCB_BASE_EDIT_FRAME* aFrame, - bool aStatusOnly = false ); + bool aStatusItemsOnly = false ); virtual bool MakeEditPoints( std::shared_ptr aEditPoints ) const; virtual bool UpdateFromEditPoints( std::shared_ptr aEditPoints, - BOARD_COMMIT* aCommit ); + BOARD_COMMIT* aCommit ); virtual bool UpdateEditPoints( std::shared_ptr aEditPoints ); diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp index ecbc116ee0..2cb55ec6a5 100644 --- a/pcbnew/tools/pcb_point_editor.cpp +++ b/pcbnew/tools/pcb_point_editor.cpp @@ -1506,12 +1506,16 @@ void PCB_POINT_EDITOR::updateItem( BOARD_COMMIT* aCommit ) generatorItem->UpdateFromEditPoints( m_editPoints, aCommit ); m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genUpdateEdit, aCommit, generatorItem ); + // Note: POINT_EDITOR::m_preview holds only the canvas-draw status "popup"; the meanders + // themselves (ROUTER_PREVIEW_ITEMs) are owned by the router. + m_preview.FreeItems(); - for( EDA_ITEM* previewItem : generatorItem->GetPreviewItems( generatorTool, frame(), true ) ) + for( EDA_ITEM* previewItem : generatorItem->GetPreviewItems( generatorTool, frame(), + STATUS_ITEMS_ONLY ) ) + { m_preview.Add( previewItem ); - - generatorTool->Router()->StopRouting(); + } getView()->Update( &m_preview ); break;