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.
This commit is contained in:
Ian McInerney 2021-04-07 16:53:43 +01:00
parent 3fd3be9843
commit 29cc16a4c4
8 changed files with 15 additions and 26 deletions

View File

@ -373,8 +373,6 @@ public:
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override; void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
virtual void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) {}
/** /**
* Display the current grid pane on the status bar. * Display the current grid pane on the status bar.
*/ */

View File

@ -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, void FOOTPRINT_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
{ {

View File

@ -248,9 +248,6 @@ public:
///< @copydoc PCB_BASE_FRAME::SetActiveLayer() ///< @copydoc PCB_BASE_FRAME::SetActiveLayer()
void SetActiveLayer( PCB_LAYER_ID aLayer ) override; void SetActiveLayer( PCB_LAYER_ID aLayer ) override;
///< @copydoc PCB_BASE_FRAME::OnUpdateLayerAlpha()
void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) override;
void OnDisplayOptionsChanged() override; void OnDisplayOptionsChanged() override;
///< @copydoc EDA_DRAW_FRAME::UseGalCanvas() ///< @copydoc EDA_DRAW_FRAME::UseGalCanvas()

View File

@ -223,6 +223,7 @@ wxString PCB_BASE_EDIT_FRAME::GetDesignRulesPath()
return Prj().AbsolutePath( fn.GetFullName() ); return Prj().AbsolutePath( fn.GetFullName() );
} }
void PCB_BASE_EDIT_FRAME::handleActivateEvent( wxActivateEvent& aEvent ) void PCB_BASE_EDIT_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
{ {
EDA_DRAW_FRAME::handleActivateEvent( aEvent ); EDA_DRAW_FRAME::handleActivateEvent( aEvent );
@ -231,3 +232,10 @@ void PCB_BASE_EDIT_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
if( m_appearancePanel ) if( m_appearancePanel )
m_appearancePanel->RefreshCollapsiblePanes(); m_appearancePanel->RefreshCollapsiblePanes();
} }
void PCB_BASE_EDIT_FRAME::OnLayerAlphaChanged()
{
if( m_appearancePanel )
m_appearancePanel->OnLayerAlphaChanged();
}

View File

@ -203,6 +203,11 @@ public:
APPEARANCE_CONTROLS* GetAppearancePanel() { return m_appearancePanel; } APPEARANCE_CONTROLS* GetAppearancePanel() { return m_appearancePanel; }
/**
* Notify the frame that the layer Alpha is being changed
*/
virtual void OnLayerAlphaChanged();
protected: protected:
/** /**
* Prompts a user to select global or project library tables * Prompts a user to select global or project library tables

View File

@ -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 bool PCB_EDIT_FRAME::IsElementVisible( GAL_LAYER_ID aElement ) const
{ {
return GetBoard()->IsElementVisible( aElement ); return GetBoard()->IsElementVisible( aElement );

View File

@ -268,11 +268,6 @@ public:
*/ */
void SetActiveLayer( PCB_LAYER_ID aLayer ) override; 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; void OnDisplayOptionsChanged() override;
/** /**

View File

@ -361,8 +361,7 @@ int PCB_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
if( IsCopperLayer( currentLayer ) ) if( IsCopperLayer( currentLayer ) )
view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) ); view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) );
wxUpdateUIEvent dummy; static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->OnLayerAlphaChanged();
static_cast<PCB_EDIT_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
} }
else else
wxBell(); wxBell();
@ -391,8 +390,7 @@ int PCB_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
if( IsCopperLayer( currentLayer ) ) if( IsCopperLayer( currentLayer ) )
view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) ); view->UpdateLayerColor( ZONE_LAYER_FOR( currentLayer ) );
wxUpdateUIEvent dummy; static_cast<PCB_BASE_EDIT_FRAME*>( m_frame )->OnLayerAlphaChanged();
static_cast<PCB_BASE_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
} }
else else
wxBell(); wxBell();