From 529e1b2b389d778d86531c9fd9b09919a88943fe Mon Sep 17 00:00:00 2001 From: James Crook Date: Sun, 28 Jul 2019 17:28:58 +0100 Subject: [PATCH] Bug 2120 - Residual: Truncation of Selection toolbar too. The problem was more general, and it affected the selection toolbar too, if undocked. --- src/toolbars/SpectralSelectionBar.cpp | 10 +--------- src/toolbars/ToolBar.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/toolbars/SpectralSelectionBar.cpp b/src/toolbars/SpectralSelectionBar.cpp index 12fec1d2b..8ddbb0d1f 100644 --- a/src/toolbars/SpectralSelectionBar.cpp +++ b/src/toolbars/SpectralSelectionBar.cpp @@ -369,15 +369,7 @@ void SpectralSelectionBar::OnChoice(wxCommandEvent &) GetSizer()->Layout(); // Required so that the layout does not mess up on Windows when changing the format. wxWindowBase::GetSizer()->SetMinSize(wxSize(0, mHeight)); // so that height of toolbar does not change wxWindowBase::GetSizer()->SetSizeHints(this); - if( IsDocked() ) - Updated(); - else { - // Bug 2120. Changing the choice also changes the size of the toolbar so - // we need to update the client size, even if undocked. - // If attempting to make this code nicer, remember to test both changing the choice, - // and the choice remaining the same. - GetParent()->SetClientSize( GetSize() + wxSize( 2,2)); - } + Updated(); } void SpectralSelectionBar::OnIdle( wxIdleEvent &evt ) diff --git a/src/toolbars/ToolBar.cpp b/src/toolbars/ToolBar.cpp index a3bb38d08..e17b3c727 100644 --- a/src/toolbars/ToolBar.cpp +++ b/src/toolbars/ToolBar.cpp @@ -617,6 +617,12 @@ void ToolBar::Updated() { if( IsDocked() ) GetDock()->Updated(); + else + // Bug 2120. Changing the choice also changes the size of the toolbar so + // we need to update the client size, even if undocked. + // If modifying/improving this, remember to test both changing the choice, + // and clciking on the choice but not actually changing it. + GetParent()->SetClientSize( GetSize() + wxSize( 2,2)); //wxCommandEvent e( EVT_TOOLBAR_UPDATED, GetId() ); //GetParent()->GetEventHandler()->AddPendingEvent( e ); }