1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-10 17:37:45 +02:00

Reorganize "Wave Color" and "Spectrogram Settings" in TCP menu...

... Now they are treated more alike:

Each is shown or hidden (not enabled or disabled) as the corresponding sub-view
of the wave track is shown or not.

Each has separator lines above and below.

They are shown (one or the other or both) after the choices for sub-views, and
not near the bottom of the menu.

This makes the TCP menu one item shorter in the default case that you view only
waveform.
This commit is contained in:
Paul Licameli 2020-02-06 17:38:44 -05:00
parent 540f2c5e67
commit d631697321

View File

@ -694,8 +694,8 @@ void WaveTrackMenuTable::InitMenu(wxMenu *pMenu)
// Bug 1253. Shouldn't open preferences if audio is busy. // Bug 1253. Shouldn't open preferences if audio is busy.
// We can't change them on the fly yet anyway. // We can't change them on the fly yet anyway.
auto gAudioIO = AudioIOBase::Get(); auto gAudioIO = AudioIOBase::Get();
const bool bAudioBusy = gAudioIO->IsBusy(); if ( hasSpectrum )
pMenu->Enable(OnSpectrogramSettingsID, hasSpectrum && !bAudioBusy); pMenu->Enable(OnSpectrogramSettingsID, !gAudioIO->IsBusy());
AudacityProject *const project = &mpData->project; AudacityProject *const project = &mpData->project;
auto &tracks = TrackList::Get( *project ); auto &tracks = TrackList::Get( *project );
@ -769,23 +769,45 @@ BEGIN_POPUP_MENU(WaveTrackMenuTable)
const auto &view = WaveTrackView::Get( *pTrack ); const auto &view = WaveTrackView::Get( *pTrack );
BEGIN_POPUP_MENU_SECTION( "SubViews" ) BEGIN_POPUP_MENU_SECTION( "SubViews" )
if ( WaveTrackSubViews::slots() > 1 )
POPUP_MENU_CHECK_ITEM( "MultiView", OnMultiViewID, XO("&Multi-view"), OnMultiView)
if ( WaveTrackSubViews::slots() > 1 ) int id = OnSetDisplayId;
POPUP_MENU_CHECK_ITEM( "MultiView", OnMultiViewID, XO("&Multi-view"), OnMultiView) for ( const auto &type : AllTypes() ) {
if ( view.GetMultiView() ) {
int id = OnSetDisplayId; POPUP_MENU_CHECK_ITEM( type.name.Internal(), id++, type.name.Msgid(), OnSetDisplay)
for ( const auto &type : AllTypes() ) { }
if ( view.GetMultiView() ) { else {
POPUP_MENU_CHECK_ITEM( type.name.Internal(), id++, type.name.Msgid(), OnSetDisplay) POPUP_MENU_RADIO_ITEM( type.name.Internal(), id++, type.name.Msgid(), OnSetDisplay)
}
} }
else {
POPUP_MENU_RADIO_ITEM( type.name.Internal(), id++, type.name.Msgid(), OnSetDisplay)
}
}
POPUP_MENU_ITEM( "SpectrogramSettings", OnSpectrogramSettingsID, XO("S&pectrogram Settings..."), OnSpectrogramSettings)
END_POPUP_MENU_SECTION() END_POPUP_MENU_SECTION()
if ( pTrack ) {
const auto displays = view.GetDisplays();
bool hasWaveform = (displays.end() != std::find(
displays.begin(), displays.end(),
WaveTrackSubView::Type{ WaveTrackViewConstants::Waveform, {} }
) );
if( hasWaveform ){
BEGIN_POPUP_MENU_SECTION( "WaveColor" )
POPUP_MENU_SUB_MENU( "WaveColor", WaveColorMenuTable)
END_POPUP_MENU_SECTION()
}
bool hasSpectrum = (displays.end() != std::find(
displays.begin(), displays.end(),
WaveTrackSubView::Type{ WaveTrackViewConstants::Spectrum, {} }
) );
if( hasSpectrum ){
BEGIN_POPUP_MENU_SECTION( "SpectrogramSettings" )
POPUP_MENU_ITEM( "SpectrogramSettings", OnSpectrogramSettingsID, XO("S&pectrogram Settings..."), OnSpectrogramSettings)
END_POPUP_MENU_SECTION()
}
}
BEGIN_POPUP_MENU_SECTION( "Channels" ) BEGIN_POPUP_MENU_SECTION( "Channels" )
// If these are enabled again, choose a hot key for Mono that does not conflict // If these are enabled again, choose a hot key for Mono that does not conflict
// with Multi View // with Multi View
@ -802,19 +824,6 @@ BEGIN_POPUP_MENU(WaveTrackMenuTable)
#endif #endif
END_POPUP_MENU_SECTION() END_POPUP_MENU_SECTION()
if ( pTrack ) {
const auto displays = view.GetDisplays();
bool hasWaveform = (displays.end() != std::find(
displays.begin(), displays.end(),
WaveTrackSubView::Type{ WaveTrackViewConstants::Waveform, {} }
) );
if( hasWaveform ){
BEGIN_POPUP_MENU_SECTION( "WaveColor" )
POPUP_MENU_SUB_MENU( "WaveColor", WaveColorMenuTable)
END_POPUP_MENU_SECTION()
}
}
BEGIN_POPUP_MENU_SECTION( "Format" ) BEGIN_POPUP_MENU_SECTION( "Format" )
POPUP_MENU_SUB_MENU( "Format", FormatMenuTable) POPUP_MENU_SUB_MENU( "Format", FormatMenuTable)
END_POPUP_MENU_SECTION() END_POPUP_MENU_SECTION()