From 81a5c0e3bfbd3c1151ea69b057d2658525c53f20 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 19 Jun 2018 11:27:38 +0200 Subject: [PATCH] GAL: Show ratsnest lines when dragging GAL is strict regarding which layers are rendered, therefore to show ratsnest lines when an item is dragged - the ratsnest layer must be kept enabled. Ratsnest line visibility is enabled per item and this is the way to show/hide the lines. Fixes: lp:1666473 * https://bugs.launchpad.net/kicad/+bug/1666473 --- pcbnew/pcb_layer_widget.cpp | 2 +- pcbnew/tool_pcb_editor.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pcbnew/pcb_layer_widget.cpp b/pcbnew/pcb_layer_widget.cpp index ffcdd796d0..fee62612c3 100644 --- a/pcbnew/pcb_layer_widget.cpp +++ b/pcbnew/pcb_layer_widget.cpp @@ -726,7 +726,7 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() ); galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); } - else if ( aId == LAYER_RATSNEST ) + else if( aId == LAYER_RATSNEST ) { // don't touch the layers. ratsnest is enabled on per-item basis. galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); diff --git a/pcbnew/tool_pcb_editor.cpp b/pcbnew/tool_pcb_editor.cpp index 2149aa6bb8..be222bbeca 100644 --- a/pcbnew/tool_pcb_editor.cpp +++ b/pcbnew/tool_pcb_editor.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -770,6 +771,14 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) OnModify(); Compile_Ratsnest( NULL, true ); + if( IsGalCanvasActive() ) + { + // keep the ratsnest layer enabled in view, so it shows up when an item is dragged + auto view = GetGalCanvas()->GetView(); + view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); + view->SetLayerVisible( LAYER_RATSNEST, true ); + } + m_canvas->Refresh(); break;