From 29cc16a4c40a3acd8a12b91b82e35e04c58af545 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Wed, 7 Apr 2021 16:53:43 +0100 Subject: [PATCH] Push pcbnew layer alpha change update into base frame This code was shared between the footprint frame and pcb edit frame, so push it into the base edit frame. Also remove the dummy wxUpdateUIEvents that weren't actually being used. --- include/pcb_base_frame.h | 2 -- pcbnew/footprint_edit_frame.cpp | 6 ------ pcbnew/footprint_edit_frame.h | 3 --- pcbnew/pcb_base_edit_frame.cpp | 8 ++++++++ pcbnew/pcb_base_edit_frame.h | 5 +++++ pcbnew/pcb_edit_frame.cpp | 6 ------ pcbnew/pcb_edit_frame.h | 5 ----- pcbnew/tools/pcb_control.cpp | 6 ++---- 8 files changed, 15 insertions(+), 26 deletions(-) diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index 5cecbc925c..bb58fa9716 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -373,8 +373,6 @@ public: void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override; - virtual void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) {} - /** * Display the current grid pane on the status bar. */ diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index e4d0186252..80cfbba760 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -901,12 +901,6 @@ void FOOTPRINT_EDIT_FRAME::OnDisplayOptionsChanged() } -void FOOTPRINT_EDIT_FRAME::OnUpdateLayerAlpha( wxUpdateUIEvent & ) -{ - m_appearancePanel->OnLayerAlphaChanged(); -} - - void FOOTPRINT_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) { diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index 112ac37c4f..16235e5c5b 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -248,9 +248,6 @@ public: ///< @copydoc PCB_BASE_FRAME::SetActiveLayer() void SetActiveLayer( PCB_LAYER_ID aLayer ) override; - ///< @copydoc PCB_BASE_FRAME::OnUpdateLayerAlpha() - void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) override; - void OnDisplayOptionsChanged() override; ///< @copydoc EDA_DRAW_FRAME::UseGalCanvas() diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index 2062ab3ab4..3e914ffda8 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -223,6 +223,7 @@ wxString PCB_BASE_EDIT_FRAME::GetDesignRulesPath() return Prj().AbsolutePath( fn.GetFullName() ); } + void PCB_BASE_EDIT_FRAME::handleActivateEvent( wxActivateEvent& aEvent ) { EDA_DRAW_FRAME::handleActivateEvent( aEvent ); @@ -231,3 +232,10 @@ void PCB_BASE_EDIT_FRAME::handleActivateEvent( wxActivateEvent& aEvent ) if( m_appearancePanel ) m_appearancePanel->RefreshCollapsiblePanes(); } + + +void PCB_BASE_EDIT_FRAME::OnLayerAlphaChanged() +{ + if( m_appearancePanel ) + m_appearancePanel->OnLayerAlphaChanged(); +} diff --git a/pcbnew/pcb_base_edit_frame.h b/pcbnew/pcb_base_edit_frame.h index 2412e5b87b..b35c553682 100644 --- a/pcbnew/pcb_base_edit_frame.h +++ b/pcbnew/pcb_base_edit_frame.h @@ -203,6 +203,11 @@ public: APPEARANCE_CONTROLS* GetAppearancePanel() { return m_appearancePanel; } + /** + * Notify the frame that the layer Alpha is being changed + */ + virtual void OnLayerAlphaChanged(); + protected: /** * Prompts a user to select global or project library tables diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index e25d30bbaa..752e9a221e 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -1136,12 +1136,6 @@ void PCB_EDIT_FRAME::OnDisplayOptionsChanged() } -void PCB_EDIT_FRAME::OnUpdateLayerAlpha( wxUpdateUIEvent & ) -{ - m_appearancePanel->OnLayerAlphaChanged(); -} - - bool PCB_EDIT_FRAME::IsElementVisible( GAL_LAYER_ID aElement ) const { return GetBoard()->IsElementVisible( aElement ); diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 148930f83e..944336de7d 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -268,11 +268,6 @@ public: */ void SetActiveLayer( PCB_LAYER_ID aLayer ) override; - /** - * Update the UI to reflect changes to the current layer's transparency. - */ - void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) override; - void OnDisplayOptionsChanged() override; /** diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index 480f9950c7..392ae67ecd 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -361,8 +361,7 @@ int PCB_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent ) if( IsCopperLayer( currentLayer ) ) view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) ); - wxUpdateUIEvent dummy; - static_cast( m_frame )->OnUpdateLayerAlpha( dummy ); + static_cast( m_frame )->OnLayerAlphaChanged(); } else wxBell(); @@ -391,8 +390,7 @@ int PCB_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent ) if( IsCopperLayer( currentLayer ) ) view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) ); - wxUpdateUIEvent dummy; - static_cast( m_frame )->OnUpdateLayerAlpha( dummy ); + static_cast( m_frame )->OnLayerAlphaChanged(); } else wxBell();