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
1 changed files with 37 additions and 28 deletions

View File

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