From 9884f40952a6202eee762c1a0f1be52df47d153d Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 9 Dec 2021 10:14:11 -0800 Subject: [PATCH] Update call signature for SwitchLayer We don't use DC anymore --- include/pcb_base_frame.h | 7 ++++++- pcbnew/edit.cpp | 2 +- pcbnew/pcb_base_frame.cpp | 2 +- pcbnew/pcb_edit_frame.h | 7 ++++++- pcbnew/tools/pcb_control.cpp | 10 +++++----- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index 17ea164c69..67a509f16a 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -351,7 +351,12 @@ public: PCB_LAYER_ID SelectOneLayer( PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask = LSET(), wxPoint aDlgPosition = wxDefaultPosition ); - virtual void SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ); + /** + * Change the active layer in the frame + * + * @param aLayer New layer to make active + */ + virtual void SwitchLayer( PCB_LAYER_ID aLayer ); virtual void SetActiveLayer( PCB_LAYER_ID aLayer ) { GetScreen()->m_Active_Layer = aLayer; } virtual PCB_LAYER_ID GetActiveLayer() const { return GetScreen()->m_Active_Layer; } diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 432a39b82e..5293f525dd 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -75,7 +75,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } -void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ) +void PCB_EDIT_FRAME::SwitchLayer( PCB_LAYER_ID layer ) { PCB_LAYER_ID curLayer = GetActiveLayer(); auto displ_opts = GetDisplayOptions(); diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 5f4f54dd58..5f8d6be503 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -576,7 +576,7 @@ EDA_3D_VIEWER_FRAME* PCB_BASE_FRAME::CreateAndShow3D_Frame() } -void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ) +void PCB_BASE_FRAME::SwitchLayer( PCB_LAYER_ID layer ) { PCB_LAYER_ID preslayer = GetActiveLayer(); auto& displ_opts = GetDisplayOptions(); diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index d05525ec64..3ac8e11e0c 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -548,7 +548,12 @@ public: */ void OnEditItemRequest( BOARD_ITEM* aItem ) override; - void SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ) override; + /** + * Change the active layer in the editor + * + * @param layer New layer to make active + */ + void SwitchLayer( PCB_LAYER_ID layer ) override; /** * Modify one track segment width or one via diameter (using DRC control). diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index 3a0cd1d523..18c77ae571 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -354,7 +354,7 @@ int PCB_CONTROL::RatsnestModeCycle( const TOOL_EVENT& aEvent ) int PCB_CONTROL::LayerSwitch( const TOOL_EVENT& aEvent ) { - m_frame->SwitchLayer( nullptr, aEvent.Parameter() ); + m_frame->SwitchLayer( aEvent.Parameter() ); return 0; } @@ -380,7 +380,7 @@ int PCB_CONTROL::LayerNext( const TOOL_EVENT& aEvent ) } wxCHECK( IsCopperLayer( layer ), 0 ); - editFrame->SwitchLayer( nullptr, ToLAYER_ID( layer ) ); + editFrame->SwitchLayer( ToLAYER_ID( layer ) ); return 0; } @@ -410,7 +410,7 @@ int PCB_CONTROL::LayerPrev( const TOOL_EVENT& aEvent ) wxCHECK( IsCopperLayer( layer ), 0 ); - editFrame->SwitchLayer( nullptr, ToLAYER_ID( layer ) ); + editFrame->SwitchLayer( ToLAYER_ID( layer ) ); return 0; } @@ -422,9 +422,9 @@ int PCB_CONTROL::LayerToggle( const TOOL_EVENT& aEvent ) PCB_SCREEN* screen = m_frame->GetScreen(); if( currentLayer == screen->m_Route_Layer_TOP ) - m_frame->SwitchLayer( nullptr, screen->m_Route_Layer_BOTTOM ); + m_frame->SwitchLayer( screen->m_Route_Layer_BOTTOM ); else - m_frame->SwitchLayer( nullptr, screen->m_Route_Layer_TOP ); + m_frame->SwitchLayer( screen->m_Route_Layer_TOP ); return 0; }