mirror of
https://github.com/cookiengineer/audacity
synced 2026-02-16 15:57:52 +01:00
Fix for #1554: toolbars open undocked if previously hidden
Problem: 1. If a toolbar is docked and hidden, when config is written, dock is set to 0 (undocked). 2. When config is read, if a toolbar is docked, then the show field is ignored, and the toolbar is always shown. Summary of fix: 1. Introduce a new version of the dock field (DockV2) to minimise the problems when running previous versions of Audacity, having run a version with this patch(as suggested by Paul). 2. In ToolManage::WriteConfig, for a docked toolbar which is hidden, DockV2 is set to the dock number, and not 0. 3. In ToolManager::ReadConfig, for a hidden docked toolbar in the config, the toolbar is docked, but is not included in the configuration. Note, that if a version of Audacity without this fix is run after running a version with this fix: 1. The dock of each toolbar is reset to its default value. 2. In addition, for 2.1.3, 2.2.0 and 2.2.1 whether a toolbar is shown or hidden is reset to its default value.
This commit is contained in:
@@ -237,7 +237,11 @@ bool ToolBarConfiguration::Read
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
if (pConfiguration) {
|
||||
// Future: might remember visibility in the configuration, not forgetting
|
||||
// positions of hidden bars.
|
||||
gPrefs->Read( wxT("Show"), &visible, defaultVisible);
|
||||
|
||||
if (pConfiguration && visible) {
|
||||
int ord;
|
||||
gPrefs->Read( wxT("Order"), &ord, -1 );
|
||||
// Index was written 1-based
|
||||
@@ -267,10 +271,6 @@ 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,14 +403,15 @@ void ToolDock::Dock( ToolBar *bar, bool deflate, ToolBarConfiguration::Position
|
||||
);
|
||||
|
||||
// Park the NEW bar in the correct berth
|
||||
if (!mConfiguration.Contains(bar))
|
||||
if (!mConfiguration.Contains(bar) && bar->IsVisible())
|
||||
mConfiguration.Insert( bar, position );
|
||||
|
||||
// Inform toolbar of change
|
||||
bar->SetDocked( this, false );
|
||||
|
||||
// Rearrange our world
|
||||
LayoutToolBars();
|
||||
if (bar->IsVisible())
|
||||
LayoutToolBars();
|
||||
Updated();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user