Revert "Fix for #1554: toolbars open undocked if previously hidden"

This reverts commit 048c1b8c5a.

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.
This commit is contained in:
Paul Licameli 2017-09-16 11:52:59 -04:00
parent 75d557463d
commit ecd149edad
2 changed files with 10 additions and 24 deletions

View File

@ -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();
}

View File

@ -681,7 +681,6 @@ void ToolManager::ReadConfig()
{
wxString oldpath = gPrefs->GetPath();
wxArrayInt unordered[ DockCount ];
std::vector<ToolBar*> 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<int>(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);