1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-16 16:47:41 +02:00

Send size event after repopulating MeterToolbar buttons.

If we don't do this, it does not regain its former size, if it is floating.
This commit is contained in:
James Crook 2017-04-27 09:51:34 +01:00
parent 7e2a7aad89
commit 7661d179ba
5 changed files with 19 additions and 8 deletions

View File

@ -394,6 +394,8 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
return;
}
// flush now so toolbars will know their position.
gPrefs->Flush();
if (mCategories) {
// Now apply the changes
for (size_t i = 0; i < mCategories->GetPageCount(); i++) {

View File

@ -173,6 +173,10 @@ void MeterToolBar::UpdatePrefs()
// Give base class a chance
ToolBar::UpdatePrefs();
wxSizeEvent e;
GetParent()->GetEventHandler()->AddPendingEvent( e );
}
void MeterToolBar::RegenerateTooltips()
@ -226,7 +230,7 @@ void MeterToolBar::OnSize( wxSizeEvent & event) //WXUNUSED(event) )
mRecordMeter->SetMinSize( wxSize( width, height ));
}
if( mPlayMeter ) {
mPlayMeter->SetMinSize( wxSize( width, height ));
mPlayMeter->SetMinSize( wxSize( width, height));
mSizer->SetItemPosition( mPlayMeter, pos );
}

View File

@ -484,9 +484,6 @@ void ToolBar::ReCreateButtons()
// Use a box sizer for laying out controls
ms->Add((mHSizer = safenew wxBoxSizer(wxHORIZONTAL)), 1, wxEXPAND);
// (Re)Establish dock state
SetDocked(GetDock(), false);
// Go add all the rest of the gadgets
Populate();
@ -498,6 +495,10 @@ void ToolBar::ReCreateButtons()
ms->Add(mResizer, 0, wxEXPAND | wxALIGN_TOP | wxLEFT, 1);
mResizer->SetToolTip(_("Click and drag to resize toolbar"));
}
// Set dock after possibly creating resizer.
// (Re)Establish dock state
SetDocked(GetDock(), false);
// Set the sizer
SetSizerAndFit(ms.release());
@ -585,8 +586,10 @@ void ToolBar::SetDocked( ToolDock *dock, bool pushed )
//
void ToolBar::Updated()
{
wxCommandEvent e( EVT_TOOLBAR_UPDATED, GetId() );
GetParent()->GetEventHandler()->AddPendingEvent( e );
if( IsDocked() )
GetDock()->Updated();
//wxCommandEvent e( EVT_TOOLBAR_UPDATED, GetId() );
//GetParent()->GetEventHandler()->AddPendingEvent( e );
}
//

View File

@ -309,6 +309,7 @@ public:
// Reverse what was done by WrapConfiguration.
void RestoreConfiguration(ToolBarConfiguration &backup);
void Updated();
protected:
@ -323,7 +324,7 @@ public:
void VisitLayout(LayoutVisitor &visitor,
ToolBarConfiguration *pWrappedConfiguration = nullptr);
void Updated();
int mTotalToolBarHeight;
wxWindow *mParent;

View File

@ -170,8 +170,9 @@ void ToolFrame::OnGrabber( GrabberEvent & event )
void ToolFrame::OnToolBarUpdate( wxCommandEvent & event )
{
// Resize floater window to exactly contain toolbar
// use actual size rather than minimum size.
if (mBar)
mBar->GetParent()->SetClientSize( mBar->GetMinSize() );
mBar->GetParent()->SetClientSize( mBar->GetSize() );// ->GetMinSize() );
// Allow it to propagate to our parent
event.Skip();