mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-06 14:52:34 +02:00
Bug 1983 - Preference updates do not preserve toolbar widths
This commit is contained in:
parent
e4bdd68c70
commit
f07e40a4c0
@ -459,6 +459,13 @@ void ToolBar::Create( wxWindow *parent )
|
||||
mVisible = true;
|
||||
}
|
||||
|
||||
void ToolBar::SetToDefaultSize(){
|
||||
wxSize sz;
|
||||
sz.SetHeight( -1 );
|
||||
sz.SetWidth( GetInitialWidth());
|
||||
SetSize( sz );
|
||||
}
|
||||
|
||||
void ToolBar::ReCreateButtons()
|
||||
{
|
||||
wxSize sz3 = GetSize();
|
||||
@ -519,12 +526,18 @@ void ToolBar::ReCreateButtons()
|
||||
sz2.SetWidth(GetMinToolbarWidth());
|
||||
sz2.y = tbs -1;
|
||||
SetMinSize(sz2);
|
||||
// Initial size at least as big as minimum.
|
||||
|
||||
// sz2 is now the minimum size.
|
||||
// sz3 is the size we were.
|
||||
// When recreating buttons, we want to preserve size.
|
||||
// But not if that makes the size too small.
|
||||
|
||||
// Size at least as big as minimum.
|
||||
if( sz3.y < sz2.y )
|
||||
sz3.y = sz2.y;
|
||||
//if( sz3.x < sz2.x )
|
||||
sz3.x = GetInitialWidth();
|
||||
//sz.SetWidth();
|
||||
if( sz3.x < sz2.x )
|
||||
sz3.x = sz2.x;
|
||||
|
||||
SetSize(sz3);
|
||||
}
|
||||
else
|
||||
|
@ -96,6 +96,7 @@ class ToolBar /* not final */ : public wxPanelWrapper
|
||||
|
||||
bool AcceptsFocus() const override { return false; };
|
||||
|
||||
void SetToDefaultSize();
|
||||
//NEW virtuals:
|
||||
virtual void Create(wxWindow *parent);
|
||||
virtual void EnableDisableButtons() = 0;
|
||||
|
@ -546,6 +546,7 @@ void ToolManager::Reset()
|
||||
floater->Destroy();
|
||||
|
||||
// Recreate bar buttons (and resize it)
|
||||
bar->SetToDefaultSize();
|
||||
bar->ReCreateButtons();
|
||||
bar->EnableDisableButtons();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user