1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-25 16:48:44 +02:00

Shorten remaining names in Wave Track Control menu, change accelerators....

This commit is contained in:
Paul Licameli 2015-08-01 13:40:55 -04:00
commit 86a179f00d
2 changed files with 142 additions and 27 deletions

View File

@ -156,6 +156,9 @@ 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
#define EXPERIMENTAL_CASCADE_TCP_MENU
#include "Audacity.h" #include "Audacity.h"
#include "Experimental.h" #include "Experimental.h"
@ -336,6 +339,8 @@ enum {
OnTimeTrackLogID, OnTimeTrackLogID,
OnTimeTrackLogIntID, OnTimeTrackLogIntID,
ChannelMenuID,
// Reserve an ample block of ids for waveform scale types // Reserve an ample block of ids for waveform scale types
OnFirstWaveformScaleID, OnFirstWaveformScaleID,
OnLastWaveformScaleID = OnFirstWaveformScaleID + 9, OnLastWaveformScaleID = OnFirstWaveformScaleID + 9,
@ -556,6 +561,7 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
mNoteTrackMenu = NULL; mNoteTrackMenu = NULL;
mLabelTrackMenu = NULL; mLabelTrackMenu = NULL;
mTimeTrackMenu = NULL; mTimeTrackMenu = NULL;
mHiddenChannelMenu = mChannelMenuMono = mChannelMenuStereo = NULL;
mRulerWaveformMenu = mRulerSpectrumMenu = NULL; mRulerWaveformMenu = mRulerSpectrumMenu = NULL;
@ -734,17 +740,62 @@ void TrackPanel::BuildMenus(void)
mWaveTrackMenu->Append(OnViewSettingsID, _("&View Settings...")); mWaveTrackMenu->Append(OnViewSettingsID, _("&View Settings..."));
mWaveTrackMenu->AppendSeparator(); mWaveTrackMenu->AppendSeparator();
mWaveTrackMenu->AppendRadioItem(OnChannelMonoID, _("&Mono")); // Handle the channels items
mWaveTrackMenu->AppendRadioItem(OnChannelLeftID, _("&Left Channel")); {
mWaveTrackMenu->AppendRadioItem(OnChannelRightID, _("&Right Channel")); #ifdef EXPERIMENTAL_CASCADE_TCP_MENU
mWaveTrackMenu->Append(OnMergeStereoID, _("Ma&ke Stereo Track")); mChannelMenuMono = new wxMenu();
mWaveTrackMenu->Append(OnSwapChannelsID, _("Swap Stereo &Channels")); mChannelMenuStereo = new wxMenu();
mWaveTrackMenu->Append(OnSplitStereoID, _("Spl&it Stereo Track")); mHiddenChannelMenu = mChannelMenuMono;
mWaveTrackMenu->Append(OnSplitStereoMonoID, _("Split Stereo to Mo&no")); 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->AppendSeparator(); mWaveTrackMenu->AppendSeparator();
#ifdef EXPERIMENTAL_CASCADE_TCP_MENU
mWaveTrackMenu->Append(0, _("&Format"), mFormatMenu);
#else
mWaveTrackMenu->Append(0, _("Set Sample &Format"), mFormatMenu); mWaveTrackMenu->Append(0, _("Set Sample &Format"), mFormatMenu);
#endif
mWaveTrackMenu->AppendSeparator(); mWaveTrackMenu->AppendSeparator();
#ifdef EXPERIMENTAL_CASCADE_TCP_MENU
mWaveTrackMenu->Append(0, _("&Rate"), mRateMenu);
#else
mWaveTrackMenu->Append(0, _("Set Rat&e"), mRateMenu); mWaveTrackMenu->Append(0, _("Set Rat&e"), mRateMenu);
#endif
/* build the pop-down menu used on note (MIDI) tracks */ /* build the pop-down menu used on note (MIDI) tracks */
mNoteTrackMenu = new wxMenu(); mNoteTrackMenu = new wxMenu();
@ -763,7 +814,11 @@ void TrackPanel::BuildMenus(void)
mTimeTrackMenu->Append(OnTimeTrackLinID, _("&Linear")); mTimeTrackMenu->Append(OnTimeTrackLinID, _("&Linear"));
mTimeTrackMenu->Append(OnTimeTrackLogID, _("L&ogarithmic")); mTimeTrackMenu->Append(OnTimeTrackLogID, _("L&ogarithmic"));
mTimeTrackMenu->AppendSeparator(); mTimeTrackMenu->AppendSeparator();
#ifdef EXPERIMENTAL_CASCADE_TCP_MENU
mTimeTrackMenu->Append(OnSetTimeTrackRangeID, _("Set &Range..."));
#else
mTimeTrackMenu->Append(OnSetTimeTrackRangeID, _("Set Ra&nge...")); mTimeTrackMenu->Append(OnSetTimeTrackRangeID, _("Set Ra&nge..."));
#endif
mTimeTrackMenu->AppendCheckItem(OnTimeTrackLogIntID, _("Logarithmic &Interpolation")); mTimeTrackMenu->AppendCheckItem(OnTimeTrackLogIntID, _("Logarithmic &Interpolation"));
mRulerWaveformMenu = new wxMenu(); mRulerWaveformMenu = new wxMenu();
@ -779,14 +834,40 @@ void TrackPanel::BuildMenus(void)
void TrackPanel::BuildCommonDropMenuItems(wxMenu * menu) void TrackPanel::BuildCommonDropMenuItems(wxMenu * menu)
{ {
#ifdef EXPERIMENTAL_CASCADE_TCP_MENU
menu->Append(OnSetNameID, _("&Name..."));
#else
menu->Append(OnSetNameID, _("N&ame...")); menu->Append(OnSetNameID, _("N&ame..."));
menu->AppendSeparator(); #endif
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(); menu->AppendSeparator();
wxMenu *theMenu;
#ifdef EXPERIMENTAL_CASCADE_TCP_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 // static
@ -806,6 +887,13 @@ void TrackPanel::DeleteMenus(void)
{ {
// Note that the submenus (mRateMenu, ...) // Note that the submenus (mRateMenu, ...)
// are deleted by their parent // 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) { if (mWaveTrackMenu) {
delete mWaveTrackMenu; delete mWaveTrackMenu;
mWaveTrackMenu = NULL; mWaveTrackMenu = NULL;
@ -8324,7 +8412,6 @@ void TrackPanel::OnTrackMenu(Track *t)
mPopupMenuTarget = t; mPopupMenuTarget = t;
bool canMakeStereo = false;
Track *next = mTracks->GetNext(t); Track *next = mTracks->GetNext(t);
wxMenu *theMenu = NULL; wxMenu *theMenu = NULL;
@ -8340,31 +8427,55 @@ void TrackPanel::OnTrackMenu(Track *t)
if (t->GetKind() == Track::Wave) { if (t->GetKind() == Track::Wave) {
theMenu = mWaveTrackMenu; theMenu = mWaveTrackMenu;
if (next && !t->GetLinked() && !next->GetLinked()
&& t->GetKind() == Track::Wave
&& next->GetKind() == Track::Wave)
canMakeStereo = true;
theMenu->Enable(OnSwapChannelsID, t->GetLinked()); const bool isMono = !t->GetLinked();
theMenu->Enable(OnMergeStereoID, canMakeStereo); wxMenu *const correctSubMenu =
theMenu->Enable(OnSplitStereoID, t->GetLinked()); isMono ? mChannelMenuMono : mChannelMenuStereo;
theMenu->Enable(OnSplitStereoMonoID, t->GetLinked());
const bool canMakeStereo = isMono &&
(next && !next->GetLinked()
&& t->GetKind() == Track::Wave
&& next->GetKind() == Track::Wave);
mChannelMenuMono->Enable(OnMergeStereoID, canMakeStereo);
// We only need to set check marks. Clearing checks causes problems on Linux (bug 851) // We only need to set check marks. Clearing checks causes problems on Linux (bug 851)
switch (t->GetChannel()) { switch (t->GetChannel()) {
case Track::LeftChannel: case Track::LeftChannel:
theMenu->Check(OnChannelLeftID, true); mChannelMenuMono->Check(OnChannelLeftID, true);
break; break;
case Track::RightChannel: case Track::RightChannel:
theMenu->Check(OnChannelRightID, true); mChannelMenuMono->Check(OnChannelRightID, true);
break; break;
default: default:
theMenu->Check(OnChannelMonoID, true); mChannelMenuMono->Check(OnChannelMonoID, true);
} }
theMenu->Enable(OnChannelMonoID, !t->GetLinked()); #ifdef EXPERIMENTAL_CASCADE_TCP_MENU
theMenu->Enable(OnChannelLeftID, !t->GetLinked()); // Swap in appropriate Channels sub-menu.
theMenu->Enable(OnChannelRightID, !t->GetLinked()); 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
const int display = static_cast<WaveTrack *>(t)->GetDisplay(); const int display = static_cast<WaveTrack *>(t)->GetDisplay();
theMenu->Check( theMenu->Check(

View File

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