From 50258c1f2128e6ed2d929891a616fb99bdfa4700 Mon Sep 17 00:00:00 2001 From: James Crook Date: Thu, 17 Aug 2017 12:36:47 +0100 Subject: [PATCH] Bug 1564 - Enh: Don't include empty tooldocks in CTRL + (SHIFT +) F6 cycling --- src/Menus.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index a7079f2c9..4bbbfdf2b 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -3598,6 +3598,7 @@ void AudacityProject::NextOrPrevFrame(bool forward) GetTrackPanel(), mToolManager->GetBotDock(), }; + const auto end = begin + rotationSize; // helper functions @@ -3623,12 +3624,18 @@ void AudacityProject::NextOrPrevFrame(bool forward) while( idx != (idx2 = (idx2 + increment) % rotationSize) ) { wxWindow *toFocus = begin[idx2]; - toFocus->SetFocus(); - if ( FindAncestor() == idx2 ) - // The focus took! - break; - // else, one of the tool docks might be empty because all bars were - // dragged off it. Skip it and try another. + bool bIsAnEmptyDock=false; + if( idx2 != 1 ) + bIsAnEmptyDock = ((idx2==0)?mToolManager->GetTopDock() : mToolManager->GetBotDock())-> + GetChildren().GetCount() < 1; + + // Skip docks that are empty (Bug 1564). + if( !bIsAnEmptyDock ){ + toFocus->SetFocus(); + if ( FindAncestor() == idx2 ) + // The focus took! + break; + } } }