1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-06 14:52:34 +02:00

Bug1431: Undocked toolbars should hide when project window minimizes

This commit is contained in:
Paul Licameli 2016-06-29 15:13:38 -04:00
parent fe1a0844d0
commit 625584d99a
4 changed files with 40 additions and 0 deletions

View File

@ -2174,6 +2174,22 @@ void AudacityProject::OnUpdateUI(wxUpdateUIEvent & WXUNUSED(event))
UpdateMenus();
}
void AudacityProject::MacShowUndockedToolbars(bool show)
{
#ifdef __WXMAC__
// Find all the floating toolbars, and show or hide them
const auto &children = GetChildren();
for(const auto &child : children) {
if (auto frame = dynamic_cast<ToolFrame*>(child)) {
if (!show)
frame->Hide();
else if (frame->GetToolBar()->IsVisible())
frame->Show();
}
}
#endif
}
void AudacityProject::OnActivate(wxActivateEvent & event)
{
// Activate events can fire during window teardown, so just
@ -2207,6 +2223,10 @@ void AudacityProject::OnActivate(wxActivateEvent & event)
if (wxGetTopLevelParent(w) ==this) {
mLastFocusedWindow = w;
}
#ifdef __WXMAC__
if (IsIconized())
MacShowUndockedToolbars(false);
#endif
}
else {
SetActiveProject(this);
@ -2220,6 +2240,10 @@ void AudacityProject::OnActivate(wxActivateEvent & event)
}
// No longer need to remember the last focused window
mLastFocusedWindow = NULL;
#ifdef __WXMAC__
MacShowUndockedToolbars(true);
#endif
}
event.Skip();
}

View File

@ -312,7 +312,9 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
void OnMenu(wxCommandEvent & event);
void OnUpdateUI(wxUpdateUIEvent & event);
void MacShowUndockedToolbars(bool show);
void OnActivate(wxActivateEvent & event);
void OnMouseEvent(wxMouseEvent & event);
void OnIconize(wxIconizeEvent &event);
void OnSize(wxSizeEvent & event);

View File

@ -925,6 +925,18 @@ AudacityProject * TrackPanel::GetProject() const
/// AS: This gets called on our wx timer events.
void TrackPanel::OnTimer(wxTimerEvent& )
{
#ifdef __WXMAC__
// Unfortunate part of fix for bug 1431
// Without this, the toolbars hide only every other time that you press
// the yellow title bar button. For some reason, not every press sends
// us a deactivate event for the application.
{
auto project = GetProject();
if (project->IsIconized())
project->MacShowUndockedToolbars(false);
}
#endif
mTimeCount++;
// AS: If the user is dragging the mouse and there is a track that
// has captured the mouse, then scroll the screen, as necessary.

View File

@ -138,6 +138,8 @@ public:
~ToolFrame();
ToolBar *GetToolBar() { return mBar; }
//
// Transition a toolbar from float to dragging
//