Skip to content
Snippets Groups Projects
Commit f07e40a4 authored by James Crook's avatar James Crook
Browse files

Bug 1983 - Preference updates do not preserve toolbar widths

parent e4bdd68c
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment