1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-17 09:07: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; return;
} }
// flush now so toolbars will know their position.
gPrefs->Flush();
if (mCategories) { if (mCategories) {
// Now apply the changes // Now apply the changes
for (size_t i = 0; i < mCategories->GetPageCount(); i++) { for (size_t i = 0; i < mCategories->GetPageCount(); i++) {

View File

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

View File

@ -484,9 +484,6 @@ void ToolBar::ReCreateButtons()
// Use a box sizer for laying out controls // Use a box sizer for laying out controls
ms->Add((mHSizer = safenew wxBoxSizer(wxHORIZONTAL)), 1, wxEXPAND); ms->Add((mHSizer = safenew wxBoxSizer(wxHORIZONTAL)), 1, wxEXPAND);
// (Re)Establish dock state
SetDocked(GetDock(), false);
// Go add all the rest of the gadgets // Go add all the rest of the gadgets
Populate(); Populate();
@ -498,6 +495,10 @@ void ToolBar::ReCreateButtons()
ms->Add(mResizer, 0, wxEXPAND | wxALIGN_TOP | wxLEFT, 1); ms->Add(mResizer, 0, wxEXPAND | wxALIGN_TOP | wxLEFT, 1);
mResizer->SetToolTip(_("Click and drag to resize toolbar")); mResizer->SetToolTip(_("Click and drag to resize toolbar"));
} }
// Set dock after possibly creating resizer.
// (Re)Establish dock state
SetDocked(GetDock(), false);
// Set the sizer // Set the sizer
SetSizerAndFit(ms.release()); SetSizerAndFit(ms.release());
@ -585,8 +586,10 @@ void ToolBar::SetDocked( ToolDock *dock, bool pushed )
// //
void ToolBar::Updated() void ToolBar::Updated()
{ {
wxCommandEvent e( EVT_TOOLBAR_UPDATED, GetId() ); if( IsDocked() )
GetParent()->GetEventHandler()->AddPendingEvent( e ); 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. // Reverse what was done by WrapConfiguration.
void RestoreConfiguration(ToolBarConfiguration &backup); void RestoreConfiguration(ToolBarConfiguration &backup);
void Updated();
protected: protected:
@ -323,7 +324,7 @@ public:
void VisitLayout(LayoutVisitor &visitor, void VisitLayout(LayoutVisitor &visitor,
ToolBarConfiguration *pWrappedConfiguration = nullptr); ToolBarConfiguration *pWrappedConfiguration = nullptr);
void Updated();
int mTotalToolBarHeight; int mTotalToolBarHeight;
wxWindow *mParent; wxWindow *mParent;

View File

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