From e832a94a9ca0af8fa3fa989162d3196acfaa0d63 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sat, 17 Oct 2020 15:52:51 -0400 Subject: [PATCH] Turn on zone visibility when you start drawing a zone It's disconcerting to have the zone turn invisible when you finish drawing and drop the selection. --- pcbnew/pcb_base_edit_frame.cpp | 7 +++++++ pcbnew/pcb_base_edit_frame.h | 2 ++ pcbnew/tools/drawing_tool.cpp | 3 +++ pcbnew/widgets/appearance_controls.cpp | 4 +++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index a65fdda3fb..079e3281da 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -205,6 +205,13 @@ void PCB_BASE_EDIT_FRAME::SetGridVisibility( bool aVisible ) } +void PCB_BASE_EDIT_FRAME::SetObjectVisible( GAL_LAYER_ID aLayer, bool aVisible ) +{ + if( m_appearancePanel ) + m_appearancePanel->SetObjectVisible( aLayer, aVisible ); +} + + COLOR_SETTINGS* PCB_BASE_EDIT_FRAME::GetColorSettings() { return Pgm().GetSettingsManager().GetColorSettings( GetPcbNewSettings()->m_ColorTheme ); diff --git a/pcbnew/pcb_base_edit_frame.h b/pcbnew/pcb_base_edit_frame.h index 2a9e597f9f..4475c7243b 100644 --- a/pcbnew/pcb_base_edit_frame.h +++ b/pcbnew/pcb_base_edit_frame.h @@ -168,6 +168,8 @@ public: */ void SetGridVisibility( bool aVisible ) override; + void SetObjectVisible( GAL_LAYER_ID aLayer, bool aVisible = true ); + /** * Function GetRotationAngle() * Returns the angle used for rotate operations. diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 2c7c7ce9da..3ddefb2dfc 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -1753,6 +1753,9 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent ) if( !getSourceZoneForAction( zoneMode, &sourceZone ) ) return 0; + // Turn zones on if they are off, so that the created object will be visible after completion + m_frame->SetObjectVisible( LAYER_ZONES ); + ZONE_CREATE_HELPER::PARAMS params; params.m_keepout = drawMode == MODE::KEEPOUT; diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index d97c2ad7d2..73185a3356 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -1039,12 +1039,14 @@ void APPEARANCE_CONTROLS::SetLayerVisible( LAYER_NUM aLayer, bool isVisible ) void APPEARANCE_CONTROLS::SetObjectVisible( GAL_LAYER_ID aLayer, bool isVisible ) { - // Currently only used for the grid, so we just update the ui if( m_objectSettingsMap.count( aLayer ) ) { APPEARANCE_SETTING* setting = m_objectSettingsMap.at( aLayer ); setting->ctl_visibility->SetValue( isVisible ); } + + m_frame->GetCanvas()->GetView()->SetLayerVisible( aLayer, isVisible ); + m_frame->GetCanvas()->Refresh(); }