mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-03 00:59:43 +02:00
Make a Channels sub-menu, and change accelerators to be more mnemonic...
... Also removes the conflict at top menu level over M accelerator. Make one Channel sub-menu for mono and one for stereo, and swap correct one in, whenever the parent menu opens.
This commit is contained in:
parent
413edf2820
commit
cc08bba27a
@ -339,6 +339,8 @@ enum {
|
||||
OnTimeTrackLogID,
|
||||
OnTimeTrackLogIntID,
|
||||
|
||||
ChannelMenuID,
|
||||
|
||||
// Reserve an ample block of ids for waveform scale types
|
||||
OnFirstWaveformScaleID,
|
||||
OnLastWaveformScaleID = OnFirstWaveformScaleID + 9,
|
||||
@ -559,6 +561,7 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
||||
mNoteTrackMenu = NULL;
|
||||
mLabelTrackMenu = NULL;
|
||||
mTimeTrackMenu = NULL;
|
||||
mHiddenChannelMenu = mChannelMenuMono = mChannelMenuStereo = NULL;
|
||||
|
||||
mRulerWaveformMenu = mRulerSpectrumMenu = NULL;
|
||||
|
||||
@ -737,14 +740,49 @@ void TrackPanel::BuildMenus(void)
|
||||
mWaveTrackMenu->Append(OnViewSettingsID, _("&View Settings..."));
|
||||
mWaveTrackMenu->AppendSeparator();
|
||||
|
||||
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"));
|
||||
// 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->AppendSeparator();
|
||||
|
||||
mWaveTrackMenu->Append(0, _("Set Sample &Format"), mFormatMenu);
|
||||
mWaveTrackMenu->AppendSeparator();
|
||||
mWaveTrackMenu->Append(0, _("Set Rat&e"), mRateMenu);
|
||||
@ -831,6 +869,13 @@ 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;
|
||||
@ -8349,7 +8394,6 @@ void TrackPanel::OnTrackMenu(Track *t)
|
||||
|
||||
mPopupMenuTarget = t;
|
||||
|
||||
bool canMakeStereo = false;
|
||||
Track *next = mTracks->GetNext(t);
|
||||
|
||||
wxMenu *theMenu = NULL;
|
||||
@ -8365,31 +8409,55 @@ 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;
|
||||
|
||||
theMenu->Enable(OnSwapChannelsID, t->GetLinked());
|
||||
theMenu->Enable(OnMergeStereoID, canMakeStereo);
|
||||
theMenu->Enable(OnSplitStereoID, t->GetLinked());
|
||||
theMenu->Enable(OnSplitStereoMonoID, t->GetLinked());
|
||||
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);
|
||||
|
||||
// We only need to set check marks. Clearing checks causes problems on Linux (bug 851)
|
||||
switch (t->GetChannel()) {
|
||||
case Track::LeftChannel:
|
||||
theMenu->Check(OnChannelLeftID, true);
|
||||
mChannelMenuMono->Check(OnChannelLeftID, true);
|
||||
break;
|
||||
case Track::RightChannel:
|
||||
theMenu->Check(OnChannelRightID, true);
|
||||
mChannelMenuMono->Check(OnChannelRightID, true);
|
||||
break;
|
||||
default:
|
||||
theMenu->Check(OnChannelMonoID, true);
|
||||
mChannelMenuMono->Check(OnChannelMonoID, true);
|
||||
}
|
||||
|
||||
theMenu->Enable(OnChannelMonoID, !t->GetLinked());
|
||||
theMenu->Enable(OnChannelLeftID, !t->GetLinked());
|
||||
theMenu->Enable(OnChannelRightID, !t->GetLinked());
|
||||
#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
|
||||
|
||||
const int display = static_cast<WaveTrack *>(t)->GetDisplay();
|
||||
theMenu->Check(
|
||||
|
@ -830,6 +830,10 @@ protected:
|
||||
wxMenu *mRulerWaveformMenu;
|
||||
wxMenu *mRulerSpectrumMenu;
|
||||
|
||||
wxMenu *mChannelMenuMono;
|
||||
wxMenu *mChannelMenuStereo;
|
||||
wxMenu *mHiddenChannelMenu;
|
||||
|
||||
Track *mPopupMenuTarget;
|
||||
|
||||
friend class TrackPanelAx;
|
||||
|
Loading…
x
Reference in New Issue
Block a user