From b3a3b05e400acea0555b5766d6078a63aa31556d Mon Sep 17 00:00:00 2001 From: James Crook Date: Sun, 2 Dec 2018 20:00:21 +0000 Subject: [PATCH] Bug 2034 - Mac: first use of Record on 64-bit Audacity causes EGAs, Exports, Imports and Saves to be grayed out This is a guess at the root cause of the bug. --- src/Menus.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index dad45400f..775e3c47e 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -401,21 +401,15 @@ CommandFlag MenuManager::GetUpdateFlags // static variable, used to remember flags for next time. static auto lastFlags = flags; - if (auto focus = wxWindow::FindFocus()) { + // if (auto focus = wxWindow::FindFocus()) { + if (wxWindow * focus = &project) { while (focus && focus->GetParent()) focus = focus->GetParent(); if (focus && !static_cast(focus)->IsIconized()) flags |= NotMinimizedFlag; } - // quick 'short-circuit' return. - if ( checkActive && !project.IsActive() ){ - // short cirucit return should preserve flags that have not been calculated. - flags = (lastFlags & ~NotMinimizedFlag) | flags; - lastFlags = flags; - return flags; - } - + // These flags are cheap to calculate. if (!gAudioIO->IsAudioTokenActive(project.GetAudioIOToken())) flags |= AudioIONotBusyFlag; else @@ -426,6 +420,17 @@ CommandFlag MenuManager::GetUpdateFlags else flags |= NotPausedFlag; + // quick 'short-circuit' return. + if ( checkActive && !project.IsActive() ){ + const auto checkedFlags = + NotMinimizedFlag | AudioIONotBusyFlag | AudioIOBusyFlag | + PausedFlag | NotPausedFlag; + // short cirucit return should preserve flags that have not been calculated. + flags = (lastFlags & ~checkedFlags) | flags; + lastFlags = flags; + return flags; + } + auto &viewInfo = project.GetViewInfo(); const auto &selectedRegion = viewInfo.selectedRegion;