From 29b0e31ee6d0c8a52618add63e90d6b5ca979d6a Mon Sep 17 00:00:00 2001 From: James Crook Date: Sun, 28 Jul 2019 13:08:34 +0100 Subject: [PATCH] Bug 2120 - Spectral Selection Toolbar can be truncated when undocked --- src/toolbars/SpectralSelectionBar.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/toolbars/SpectralSelectionBar.cpp b/src/toolbars/SpectralSelectionBar.cpp index 8ddbb0d1f..12fec1d2b 100644 --- a/src/toolbars/SpectralSelectionBar.cpp +++ b/src/toolbars/SpectralSelectionBar.cpp @@ -369,7 +369,15 @@ 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); - Updated(); + 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)); + } } void SpectralSelectionBar::OnIdle( wxIdleEvent &evt )