1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-24 16:01:16 +02:00

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.
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; bool result = true;
// Future: might remember visibility in the configuration, not forgetting if (pConfiguration) {
// positions of hidden bars.
gPrefs->Read( wxT("Show"), &visible, defaultVisible);
if (pConfiguration && visible) {
int ord; int ord;
gPrefs->Read( wxT("Order"), &ord, -1 ); gPrefs->Read( wxT("Order"), &ord, -1 );
// Index was written 1-based // 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; return result;
} }
@ -376,8 +376,8 @@ void ToolDock::Undock( ToolBar *bar )
if( mConfiguration.Contains( bar ) ) if( mConfiguration.Contains( bar ) )
{ {
mConfiguration.Remove( 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 // Park the NEW bar in the correct berth
if (!mConfiguration.Contains(bar) && bar->IsVisible()) if (!mConfiguration.Contains(bar))
mConfiguration.Insert( bar, position ); mConfiguration.Insert( bar, position );
// Inform toolbar of change // Inform toolbar of change
bar->SetDocked( this, false ); bar->SetDocked( this, false );
// Rearrange our world // Rearrange our world
if (bar->IsVisible()) LayoutToolBars();
LayoutToolBars();
Updated(); Updated();
} }

View File

@ -681,7 +681,6 @@ void ToolManager::ReadConfig()
{ {
wxString oldpath = gPrefs->GetPath(); wxString oldpath = gPrefs->GetPath();
wxArrayInt unordered[ DockCount ]; wxArrayInt unordered[ DockCount ];
std::vector<ToolBar*> dockedAndHidden;
bool show[ ToolBarCount ]; bool show[ ToolBarCount ];
int width[ ToolBarCount ]; int width[ ToolBarCount ];
int height[ ToolBarCount ]; int height[ ToolBarCount ];
@ -809,9 +808,6 @@ void ToolManager::ReadConfig()
} }
} }
#endif #endif
// make a note of docked and hidden toolbars
if (!show[ndx])
dockedAndHidden.push_back(bar);
if (!ordered) 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 // Restore original config path
gPrefs->SetPath( oldpath ); gPrefs->SetPath( oldpath );
@ -969,10 +958,8 @@ void ToolManager::WriteConfig()
bool bo = mBotDock->GetConfiguration().Contains( bar ); bool bo = mBotDock->GetConfiguration().Contains( bar );
// Save // Save
ToolDock* dock = bar->GetDock(); // dock for both shown and hidden toolbars gPrefs->Write( wxT("Dock"), (int) (to ? TopDockID : bo ? BotDockID : NoDockID ));
gPrefs->Write( wxT("Dock"), static_cast<int>(dock == mTopDock ? TopDockID : dock == mBotDock ? BotDockID : NoDockID )); auto dock = to ? mTopDock : bo ? mBotDock : nullptr;
dock = to ? mTopDock : bo ? mBotDock : nullptr; // dock for shown toolbars
ToolBarConfiguration::Write ToolBarConfiguration::Write
(dock ? &dock->GetConfiguration() : nullptr, bar); (dock ? &dock->GetConfiguration() : nullptr, bar);