mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
Fix missing toolbars at startup on Linux
The problem was that on Linux (not Windows or Mac) menu events are generated when checking the menu items in the toolbar menu. Becuase of the recent changes I made and how the toolbars are being shown (toggled) when the toolbar menu is checked, they were simply being hidden. Actually, the were being shown and then hidden because of the toggle. So, with this change I made exposing toolbars a bit more deterministic. The menus still use a toggle, but the ToolManager now shows or hides the bars explicitly during setup, so the menu toggle issue is resolved.
This commit is contained in:
parent
e2bced3a0a
commit
9404a28954
@ -5114,8 +5114,8 @@ void AudacityProject::OnShowMeterToolBar()
|
||||
{
|
||||
if( !mToolManager->IsVisible( MeterBarID ) )
|
||||
{
|
||||
mToolManager->Hide( PlayMeterBarID );
|
||||
mToolManager->Hide( RecordMeterBarID );
|
||||
mToolManager->Expose( PlayMeterBarID, false );
|
||||
mToolManager->Expose( RecordMeterBarID, false );
|
||||
}
|
||||
mToolManager->ShowHide( MeterBarID );
|
||||
ModifyToolbarMenus();
|
||||
@ -5125,7 +5125,7 @@ void AudacityProject::OnShowRecordMeterToolBar()
|
||||
{
|
||||
if( !mToolManager->IsVisible( RecordMeterBarID ) )
|
||||
{
|
||||
mToolManager->Hide( MeterBarID );
|
||||
mToolManager->Expose( MeterBarID, false );
|
||||
}
|
||||
mToolManager->ShowHide( RecordMeterBarID );
|
||||
ModifyToolbarMenus();
|
||||
@ -5135,7 +5135,7 @@ void AudacityProject::OnShowPlayMeterToolBar()
|
||||
{
|
||||
if( !mToolManager->IsVisible( PlayMeterBarID ) )
|
||||
{
|
||||
mToolManager->Hide( MeterBarID );
|
||||
mToolManager->Expose( MeterBarID, false );
|
||||
}
|
||||
mToolManager->ShowHide( PlayMeterBarID );
|
||||
ModifyToolbarMenus();
|
||||
|
@ -416,31 +416,6 @@ int ToolDock::PositionBar( ToolBar *t, wxPoint & pos, wxRect & rect )
|
||||
return tindx;
|
||||
}
|
||||
|
||||
//
|
||||
// Toggles the visible/hidden state of a toolbar
|
||||
//
|
||||
void ToolDock::ShowHide( int type )
|
||||
{
|
||||
ToolBar *t = mBars[ type ];
|
||||
|
||||
// Maintain the docked array
|
||||
if( t->IsVisible() )
|
||||
{
|
||||
mDockedBars.Remove( t );
|
||||
}
|
||||
else
|
||||
{
|
||||
mDockedBars.Add( t );
|
||||
}
|
||||
|
||||
// Make it (dis)appear
|
||||
t->Expose( !t->IsVisible() );
|
||||
|
||||
// Update the layout
|
||||
LayoutToolBars();
|
||||
Updated();
|
||||
}
|
||||
|
||||
//
|
||||
// Set the visible/hidden state of a toolbar
|
||||
//
|
||||
|
@ -54,7 +54,6 @@ class ToolDock:public wxPanel
|
||||
~ToolDock();
|
||||
|
||||
void LayoutToolBars();
|
||||
void ShowHide( int type );
|
||||
void Expose( int type, bool show );
|
||||
int GetOrder( ToolBar *bar );
|
||||
int GetBarCount();
|
||||
|
@ -546,7 +546,7 @@ void ToolManager::Reset()
|
||||
floater->CentreOnParent( );
|
||||
floater->Move( floater->GetPosition() + wxSize( ndx * 10 - 200, ndx * 10 ));
|
||||
bar->SetDocked( NULL, false );
|
||||
bar->Expose( false );
|
||||
Expose( ndx, false );
|
||||
}
|
||||
|
||||
}
|
||||
@ -715,11 +715,11 @@ void ToolManager::ReadConfig()
|
||||
bar->SetPositioned();
|
||||
}
|
||||
|
||||
// Show or hide it
|
||||
bar->Expose( show[ ndx ] );
|
||||
|
||||
// Inform toolbar of change
|
||||
bar->SetDocked( NULL, false );
|
||||
|
||||
// Show or hide it
|
||||
Expose( ndx, show[ ndx ] );
|
||||
}
|
||||
|
||||
// Change back to the bar root
|
||||
@ -747,15 +747,8 @@ void ToolManager::ReadConfig()
|
||||
// Dock it
|
||||
d->Dock( t );
|
||||
|
||||
// Hide the bar
|
||||
if( !show[ t->GetId() ] )
|
||||
{
|
||||
d->ShowHide( t->GetId() );
|
||||
}
|
||||
else
|
||||
{
|
||||
t->Expose( show[ ndx ] );
|
||||
}
|
||||
// Show or hide it
|
||||
Expose( t->GetId(), show[ t->GetId() ] );
|
||||
}
|
||||
}
|
||||
|
||||
@ -767,15 +760,8 @@ void ToolManager::ReadConfig()
|
||||
// Dock it
|
||||
d->Dock( t );
|
||||
|
||||
// Hide the bar
|
||||
if( !show[ t->GetId() ] )
|
||||
{
|
||||
d->ShowHide( t->GetId() );
|
||||
}
|
||||
else
|
||||
{
|
||||
t->Expose( show[ ndx ] );
|
||||
}
|
||||
// Show or hide the bar
|
||||
Expose( t->GetId(), show[ t->GetId() ] );
|
||||
}
|
||||
}
|
||||
|
||||
@ -915,24 +901,7 @@ bool ToolManager::IsVisible( int type )
|
||||
//
|
||||
void ToolManager::ShowHide( int type )
|
||||
{
|
||||
ToolBar *t = mBars[ type ];
|
||||
|
||||
// Handle docked and floaters differently
|
||||
if( t->IsDocked() )
|
||||
{
|
||||
t->GetDock()->ShowHide( type );
|
||||
}
|
||||
else
|
||||
{
|
||||
t->Expose( !t->IsVisible() );
|
||||
}
|
||||
}
|
||||
|
||||
void ToolManager::Hide( int type )
|
||||
{
|
||||
if( !IsVisible( type ) )
|
||||
return;
|
||||
ShowHide( type );
|
||||
Expose( type, !mBars[ type ]->IsVisible() );
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -57,7 +57,7 @@ class ToolManager:public wxEvtHandler
|
||||
bool IsVisible( int type );
|
||||
|
||||
void ShowHide( int type );
|
||||
void Hide( int type );
|
||||
|
||||
void Expose( int type, bool show );
|
||||
|
||||
ToolBar *GetToolBar( int type ) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user