1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-04 17:49:45 +02:00

Revert cascading menus but keep some changed accelarators

Revert "Cascade the four move commands of the track control menu..."
  Revert "Make a Channels sub-menu, and change accelerators to be more mnemonic.  Revert "Channel cascade -- yes.  Move cascade -- no."
This commit is contained in:
Paul Licameli 2015-08-02 13:31:13 -04:00
commit 7514a6848c
2 changed files with 27 additions and 140 deletions

View File

@ -156,10 +156,6 @@ is time to refresh some aspect of the screen.
*//*****************************************************************/
// This conditional compilation switch does not need to be seen
// in any other file, so I define it here, not in Experimental.h -- PRL
#undef EXPERIMENTAL_CASCADE_MOVE_MENU
#define EXPERIMENTAL_CASCADE_TCP_MENU
#include "Audacity.h"
#include "Experimental.h"
@ -340,8 +336,6 @@ enum {
OnTimeTrackLogID,
OnTimeTrackLogIntID,
ChannelMenuID,
// Reserve an ample block of ids for waveform scale types
OnFirstWaveformScaleID,
OnLastWaveformScaleID = OnFirstWaveformScaleID + 9,
@ -562,7 +556,6 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
mNoteTrackMenu = NULL;
mLabelTrackMenu = NULL;
mTimeTrackMenu = NULL;
mHiddenChannelMenu = mChannelMenuMono = mChannelMenuStereo = NULL;
mRulerWaveformMenu = mRulerSpectrumMenu = NULL;
@ -741,62 +734,20 @@ void TrackPanel::BuildMenus(void)
mWaveTrackMenu->Append(OnViewSettingsID, _("&View Settings..."));
mWaveTrackMenu->AppendSeparator();
// Handle the channels items
{
#ifdef EXPERIMENTAL_CASCADE_TCP_MENU
mChannelMenuMono = new wxMenu();
mChannelMenuStereo = new wxMenu();
mHiddenChannelMenu = mChannelMenuMono;
mWaveTrackMenu->Append(ChannelMenuID, _("&Channels"), mChannelMenuStereo);
wxString names[] = {
_("&Mono"),
_("&Left"),
_("&Right"),
_("Make &Stereo"),
_("S&wap"),
_("S&plit"),
_("Split to &Mono"),
};
#else
mChannelMenuMono = mChannelMenuStereo = mWaveTrackMenu;
mHiddenChannelMenu = NULL;
wxString names[] = {
_("&Mono"),
_("&Left Channel"),
_("&Right Channel"),
_("Ma&ke Stereo Track"),
_("Swap Stereo &Channels"),
_("Spl&it Stereo Track"),
_("Split Stereo to Mo&no"),
};
#endif
mChannelMenuMono->AppendRadioItem(OnChannelMonoID, names[0]);
mChannelMenuMono->AppendRadioItem(OnChannelLeftID, names[1]);
mChannelMenuMono->AppendRadioItem(OnChannelRightID, names[2]);
mChannelMenuMono->Append(OnMergeStereoID, names[3]);
mChannelMenuStereo->Append(OnSwapChannelsID, names[4]);
mChannelMenuStereo->Append(OnSplitStereoID, names[5]);
mChannelMenuStereo->Append(OnSplitStereoMonoID, names[6]);
}
mWaveTrackMenu->AppendRadioItem(OnChannelMonoID, _("&Mono"));
mWaveTrackMenu->AppendRadioItem(OnChannelLeftID, _("&Left Channel"));
mWaveTrackMenu->AppendRadioItem(OnChannelRightID, _("&Right Channel"));
mWaveTrackMenu->Append(OnMergeStereoID, _("Ma&ke Stereo Track"));
mWaveTrackMenu->Append(OnSwapChannelsID, _("Swap Stereo &Channels"));
mWaveTrackMenu->Append(OnSplitStereoID, _("Spl&it Stereo Track"));
mWaveTrackMenu->Append(OnSplitStereoMonoID, _("Split Stereo to Mo&no"));
mWaveTrackMenu->AppendSeparator();
#ifdef EXPERIMENTAL_CASCADE_TCP_MENU
mWaveTrackMenu->Append(0, _("&Format"), mFormatMenu);
#else
mWaveTrackMenu->Append(0, _("Set Sample &Format"), mFormatMenu);
#endif
mWaveTrackMenu->AppendSeparator();
#ifdef EXPERIMENTAL_CASCADE_TCP_MENU
mWaveTrackMenu->Append(0, _("&Rate"), mRateMenu);
#else
mWaveTrackMenu->Append(0, _("Set Rat&e"), mRateMenu);
#endif
/* build the pop-down menu used on note (MIDI) tracks */
mNoteTrackMenu = new wxMenu();
@ -815,11 +766,7 @@ void TrackPanel::BuildMenus(void)
mTimeTrackMenu->Append(OnTimeTrackLinID, _("&Linear"));
mTimeTrackMenu->Append(OnTimeTrackLogID, _("L&ogarithmic"));
mTimeTrackMenu->AppendSeparator();
#ifdef EXPERIMENTAL_CASCADE_TCP_MENU
mTimeTrackMenu->Append(OnSetTimeTrackRangeID, _("Set &Range..."));
#else
mTimeTrackMenu->Append(OnSetTimeTrackRangeID, _("Set Ra&nge..."));
#endif
mTimeTrackMenu->AppendCheckItem(OnTimeTrackLogIntID, _("Logarithmic &Interpolation"));
mRulerWaveformMenu = new wxMenu();
@ -835,40 +782,14 @@ void TrackPanel::BuildMenus(void)
void TrackPanel::BuildCommonDropMenuItems(wxMenu * menu)
{
#ifdef EXPERIMENTAL_CASCADE_TCP_MENU
menu->Append(OnSetNameID, _("&Name..."));
#else
menu->Append(OnSetNameID, _("N&ame..."));
#endif
menu->AppendSeparator();
menu->Append(OnMoveUpID, _("Move Track &Up"));
menu->Append(OnMoveDownID, _("Move Track &Down"));
menu->Append(OnMoveTopID, _("Move Track to &Top"));
menu->Append(OnMoveBottomID, _("Move Track to &Bottom"));
menu->AppendSeparator();
wxMenu *theMenu;
#ifdef EXPERIMENTAL_CASCADE_MOVE_MENU
wxMenu *const moveMenu = new wxMenu();
menu->Append(0, _("&Move"), moveMenu);
theMenu = moveMenu;
wxString names[] = {
_("&Up"),
_("&Down"),
_("To &Top"),
_("To &Bottom"),
};
#else
theMenu = menu;
wxString names[] = {
_("Move Track &Up"),
_("Move Track &Down"),
_("Move Track to &Top"),
_("Move Track to &Bottom"),
};
#endif
theMenu->Append(OnMoveUpID, names[0]);
theMenu->Append(OnMoveDownID, names[1]);
theMenu->Append(OnMoveTopID, names[2]);
theMenu->Append(OnMoveBottomID, names[3]);
menu->AppendSeparator();
}
// static
@ -888,13 +809,6 @@ void TrackPanel::DeleteMenus(void)
{
// Note that the submenus (mRateMenu, ...)
// are deleted by their parent
// ... except for this special swapping of the Channel sub-menus.
// One of them is not managed by the main popup menu.
if (mHiddenChannelMenu)
delete mHiddenChannelMenu;
mHiddenChannelMenu = mChannelMenuMono = mChannelMenuStereo = NULL;
if (mWaveTrackMenu) {
delete mWaveTrackMenu;
mWaveTrackMenu = NULL;
@ -8413,6 +8327,7 @@ void TrackPanel::OnTrackMenu(Track *t)
mPopupMenuTarget = t;
bool canMakeStereo = false;
Track *next = mTracks->GetNext(t);
wxMenu *theMenu = NULL;
@ -8428,55 +8343,31 @@ void TrackPanel::OnTrackMenu(Track *t)
if (t->GetKind() == Track::Wave) {
theMenu = mWaveTrackMenu;
if (next && !t->GetLinked() && !next->GetLinked()
&& t->GetKind() == Track::Wave
&& next->GetKind() == Track::Wave)
canMakeStereo = true;
const bool isMono = !t->GetLinked();
wxMenu *const correctSubMenu =
isMono ? mChannelMenuMono : mChannelMenuStereo;
const bool canMakeStereo = isMono &&
(next && !next->GetLinked()
&& t->GetKind() == Track::Wave
&& next->GetKind() == Track::Wave);
mChannelMenuMono->Enable(OnMergeStereoID, canMakeStereo);
theMenu->Enable(OnSwapChannelsID, t->GetLinked());
theMenu->Enable(OnMergeStereoID, canMakeStereo);
theMenu->Enable(OnSplitStereoID, t->GetLinked());
theMenu->Enable(OnSplitStereoMonoID, t->GetLinked());
// We only need to set check marks. Clearing checks causes problems on Linux (bug 851)
switch (t->GetChannel()) {
case Track::LeftChannel:
mChannelMenuMono->Check(OnChannelLeftID, true);
theMenu->Check(OnChannelLeftID, true);
break;
case Track::RightChannel:
mChannelMenuMono->Check(OnChannelRightID, true);
theMenu->Check(OnChannelRightID, true);
break;
default:
mChannelMenuMono->Check(OnChannelMonoID, true);
theMenu->Check(OnChannelMonoID, true);
}
#ifdef EXPERIMENTAL_CASCADE_TCP_MENU
// Swap in appropriate Channels sub-menu.
if (correctSubMenu == mHiddenChannelMenu) {
wxMenu *const otherSubMenu =
isMono ? mChannelMenuStereo : mChannelMenuMono;
size_t position;
wxMenuItem *const pItem =
theMenu->FindChildItem(ChannelMenuID, &position);
wxASSERT(pItem->GetSubMenu() == otherSubMenu);
theMenu->Remove(pItem);
pItem->SetSubMenu(0);
delete pItem;
theMenu->Insert(position, ChannelMenuID,
isMono ? _("&Channel") : _("&Channels"),
correctSubMenu);
mHiddenChannelMenu = otherSubMenu;
}
#else
mChannelMenuStereo->Enable(OnSwapChannelsID, !isMono);
mChannelMenuStereo->Enable(OnSplitStereoID, !isMono);
mChannelMenuStereo->Enable(OnSplitStereoMonoID, !isMono);
mChannelMenuMono->Enable(OnChannelMonoID, isMono);
mChannelMenuMono->Enable(OnChannelLeftID, isMono);
mChannelMenuMono->Enable(OnChannelRightID, isMono);
#endif
theMenu->Enable(OnChannelMonoID, !t->GetLinked());
theMenu->Enable(OnChannelLeftID, !t->GetLinked());
theMenu->Enable(OnChannelRightID, !t->GetLinked());
const int display = static_cast<WaveTrack *>(t)->GetDisplay();
theMenu->Check(

View File

@ -830,10 +830,6 @@ protected:
wxMenu *mRulerWaveformMenu;
wxMenu *mRulerSpectrumMenu;
wxMenu *mChannelMenuMono;
wxMenu *mChannelMenuStereo;
wxMenu *mHiddenChannelMenu;
Track *mPopupMenuTarget;
friend class TrackPanelAx;