From ecd149edadee0907b624b693bad8c71be89e7e7b Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 16 Sep 2017 11:52:59 -0400 Subject: [PATCH] Revert "Fix for #1554: toolbars open undocked if previously hidden" This reverts commit 048c1b8c5a92e68ca9de67d25098400ab32ab68c. I observed that it was not all right if you switch between Audacity versions, as some cautious upgraders might do: Delete audacity.cfg. Open 2.2.0 and quit. Open 2.1.3 -- and observe that the scrubbing and combined meter toolbars appear, one over the other, at top left. Combined and separate meter toolbars are not meant to appear at the same time. Quit 2.1.3 and open 2.2.0. Now those two toolbars appear at some other random seeming positions. --- src/toolbars/ToolDock.cpp | 17 ++++++++--------- src/toolbars/ToolManager.cpp | 17 ++--------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/toolbars/ToolDock.cpp b/src/toolbars/ToolDock.cpp index e5155847f..3f2a4a55e 100644 --- a/src/toolbars/ToolDock.cpp +++ b/src/toolbars/ToolDock.cpp @@ -237,11 +237,7 @@ bool ToolBarConfiguration::Read { bool result = true; - // Future: might remember visibility in the configuration, not forgetting - // positions of hidden bars. - gPrefs->Read( wxT("Show"), &visible, defaultVisible); - - if (pConfiguration && visible) { + if (pConfiguration) { int ord; gPrefs->Read( wxT("Order"), &ord, -1 ); // Index was written 1-based @@ -271,6 +267,10 @@ bool ToolBarConfiguration::Read } } + // Future: might remember visibility in the configuration, not forgetting + // positions of hidden bars. + gPrefs->Read( wxT("Show"), &visible, defaultVisible); + return result; } @@ -376,8 +376,8 @@ void ToolDock::Undock( ToolBar *bar ) if( mConfiguration.Contains( bar ) ) { mConfiguration.Remove( bar ); + mBars[ bar->GetId() ] = nullptr; } - mBars[ bar->GetId() ] = nullptr; } // @@ -403,15 +403,14 @@ void ToolDock::Dock( ToolBar *bar, bool deflate, ToolBarConfiguration::Position ); // Park the NEW bar in the correct berth - if (!mConfiguration.Contains(bar) && bar->IsVisible()) + if (!mConfiguration.Contains(bar)) mConfiguration.Insert( bar, position ); // Inform toolbar of change bar->SetDocked( this, false ); // Rearrange our world - if (bar->IsVisible()) - LayoutToolBars(); + LayoutToolBars(); Updated(); } diff --git a/src/toolbars/ToolManager.cpp b/src/toolbars/ToolManager.cpp index ff2edb286..38597c58e 100644 --- a/src/toolbars/ToolManager.cpp +++ b/src/toolbars/ToolManager.cpp @@ -681,7 +681,6 @@ void ToolManager::ReadConfig() { wxString oldpath = gPrefs->GetPath(); wxArrayInt unordered[ DockCount ]; - std::vector dockedAndHidden; bool show[ ToolBarCount ]; int width[ ToolBarCount ]; int height[ ToolBarCount ]; @@ -809,9 +808,6 @@ void ToolManager::ReadConfig() } } #endif - // make a note of docked and hidden toolbars - if (!show[ndx]) - dockedAndHidden.push_back(bar); if (!ordered) { @@ -921,13 +917,6 @@ void ToolManager::ReadConfig() } } - // hidden docked toolbars - for (auto bar : dockedAndHidden) { - bar->SetVisible(false ); - bar->GetDock()->Dock(bar, false); - bar->Expose(false); - } - // Restore original config path gPrefs->SetPath( oldpath ); @@ -969,10 +958,8 @@ void ToolManager::WriteConfig() bool bo = mBotDock->GetConfiguration().Contains( bar ); // Save - ToolDock* dock = bar->GetDock(); // dock for both shown and hidden toolbars - gPrefs->Write( wxT("Dock"), static_cast(dock == mTopDock ? TopDockID : dock == mBotDock ? BotDockID : NoDockID )); - - dock = to ? mTopDock : bo ? mBotDock : nullptr; // dock for shown toolbars + gPrefs->Write( wxT("Dock"), (int) (to ? TopDockID : bo ? BotDockID : NoDockID )); + auto dock = to ? mTopDock : bo ? mBotDock : nullptr; ToolBarConfiguration::Write (dock ? &dock->GetConfiguration() : nullptr, bar);