From 9f427da56fc39aa0144105f238813422444141be Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 11 Jun 2019 09:13:56 +0100 Subject: [PATCH] Use the ACTION_ID offset when updating the layer pair bitmap. --- common/tool/action_toolbar.cpp | 6 ++++++ include/tool/action_toolbar.h | 7 +++++++ pcbnew/toolbars_pcb_editor.cpp | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/common/tool/action_toolbar.cpp b/common/tool/action_toolbar.cpp index a80cd51833..7fb1c5afc5 100644 --- a/common/tool/action_toolbar.cpp +++ b/common/tool/action_toolbar.cpp @@ -65,6 +65,12 @@ void ACTION_TOOLBAR::AddButton( const TOOL_ACTION& aAction ) } +void ACTION_TOOLBAR::SetToolBitmap( const TOOL_ACTION& aAction, const wxBitmap& aBitmap ) +{ + wxAuiToolBar::SetToolBitmap( aAction.GetId() + ACTION_ID, aBitmap ); +} + + void ACTION_TOOLBAR::Toggle( const TOOL_ACTION& aAction, bool aState ) { int toolId = aAction.GetId() + ACTION_ID; diff --git a/include/tool/action_toolbar.h b/include/tool/action_toolbar.h index ed6e6aa6c5..7e78ad3317 100644 --- a/include/tool/action_toolbar.h +++ b/include/tool/action_toolbar.h @@ -60,6 +60,13 @@ public: */ void AddButton( const TOOL_ACTION& aAction ); + /** + * Function SetToolBitmap() + * Updates the bitmap of a particular tool. Not icon-based because we use it + * for the custom-drawn layer pair bitmap. + */ + void SetToolBitmap( const TOOL_ACTION& aAction, const wxBitmap& aBitmap ); + /** * Applies the default toggle action. For checked items this is check/uncheck; for * non-checked items it's enable/disable. diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index af4520a6d1..9f5e51ac6f 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -206,7 +206,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator() if( m_mainToolBar ) { - m_mainToolBar->SetToolBitmap( PCB_ACTIONS::selectLayerPair.GetId(), *LayerPairBitmap ); + m_mainToolBar->SetToolBitmap( PCB_ACTIONS::selectLayerPair, *LayerPairBitmap ); m_mainToolBar->Refresh(); } }