mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-19 17:40:51 +02:00
Show only the channel-related menu items appropriate to mono or stereo, and...
... Changed accelerators to avoid conflict: for mono tracks, R&ight for stereo tracks, Split Stereo to &Mono
This commit is contained in:
parent
eeaaadb530
commit
b0de2fa900
@ -523,6 +523,9 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
||||
mAdjustRightSelectionCursor = new wxCursor(wxCURSOR_POINT_RIGHT);
|
||||
|
||||
mWaveTrackMenu = NULL;
|
||||
mChannelItemsInsertionPoint = 0;
|
||||
mShowMono = false;
|
||||
|
||||
mNoteTrackMenu = NULL;
|
||||
mLabelTrackMenu = NULL;
|
||||
mTimeTrackMenu = NULL;
|
||||
@ -669,6 +672,43 @@ TrackPanel::~TrackPanel()
|
||||
delete mInitialTrackSelection;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
void ShowMonoItems(wxMenu *pMenu, size_t pos)
|
||||
{
|
||||
// Insert in the reverse of the sequence in which they appear
|
||||
pMenu->Insert(pos, OnMergeStereoID, _("Ma&ke Stereo Track"));
|
||||
pMenu->InsertRadioItem(pos, OnChannelRightID, _("R&ight Channel"));
|
||||
pMenu->InsertRadioItem(pos, OnChannelLeftID, _("&Left Channel"));
|
||||
pMenu->InsertRadioItem(pos, OnChannelMonoID, _("&Mono"));
|
||||
}
|
||||
|
||||
void HideMonoItems(wxMenu *pMenu)
|
||||
{
|
||||
pMenu->Delete(OnChannelMonoID);
|
||||
pMenu->Delete(OnChannelLeftID);
|
||||
pMenu->Delete(OnChannelRightID);
|
||||
pMenu->Delete(OnMergeStereoID);
|
||||
}
|
||||
|
||||
void ShowStereoItems(wxMenu *pMenu, size_t pos)
|
||||
{
|
||||
// Insert in the reverse of the sequence in which they appear
|
||||
pMenu->Insert(pos, OnSplitStereoMonoID, _("Split Stereo to &Mono"));
|
||||
pMenu->Insert(pos, OnSplitStereoID, _("Spl&it Stereo Track"));
|
||||
pMenu->Insert(pos, OnSwapChannelsID, _("Swap Stereo &Channels"));
|
||||
}
|
||||
|
||||
void HideStereoItems(wxMenu *pMenu)
|
||||
{
|
||||
pMenu->Delete(OnSwapChannelsID);
|
||||
pMenu->Delete(OnSplitStereoID);
|
||||
pMenu->Delete(OnSplitStereoMonoID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TrackPanel::BuildMenus(void)
|
||||
{
|
||||
// Get rid of existing menus
|
||||
@ -704,13 +744,9 @@ 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"));
|
||||
mChannelItemsInsertionPoint = mWaveTrackMenu->GetMenuItemCount();
|
||||
ShowMonoItems(mWaveTrackMenu, mChannelItemsInsertionPoint);
|
||||
mShowMono = true;
|
||||
mWaveTrackMenu->AppendSeparator();
|
||||
|
||||
mWaveTrackMenu->Append(0, _("&Format"), mFormatMenu);
|
||||
@ -8294,7 +8330,6 @@ void TrackPanel::OnTrackMenu(Track *t)
|
||||
|
||||
mPopupMenuTarget = t;
|
||||
|
||||
bool canMakeStereo = false;
|
||||
Track *next = mTracks->GetNext(t);
|
||||
|
||||
wxMenu *theMenu = NULL;
|
||||
@ -8310,15 +8345,25 @@ 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();
|
||||
const bool canMakeStereo =
|
||||
(next && isMono && !next->GetLinked() &&
|
||||
next->GetKind() == Track::Wave);
|
||||
|
||||
theMenu->Enable(OnSwapChannelsID, t->GetLinked());
|
||||
if (isMono != mShowMono) {
|
||||
if (isMono) {
|
||||
HideStereoItems(theMenu);
|
||||
ShowMonoItems(theMenu, mChannelItemsInsertionPoint);
|
||||
}
|
||||
else {
|
||||
HideMonoItems(theMenu);
|
||||
ShowStereoItems(theMenu, mChannelItemsInsertionPoint);
|
||||
}
|
||||
mShowMono = isMono;
|
||||
}
|
||||
|
||||
if (isMono) {
|
||||
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()) {
|
||||
@ -8331,10 +8376,7 @@ void TrackPanel::OnTrackMenu(Track *t)
|
||||
default:
|
||||
theMenu->Check(OnChannelMonoID, true);
|
||||
}
|
||||
|
||||
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(
|
||||
|
@ -820,6 +820,9 @@ protected:
|
||||
#endif
|
||||
|
||||
wxMenu *mWaveTrackMenu;
|
||||
size_t mChannelItemsInsertionPoint;
|
||||
bool mShowMono;
|
||||
|
||||
wxMenu *mNoteTrackMenu;
|
||||
wxMenu *mTimeTrackMenu;
|
||||
wxMenu *mLabelTrackMenu;
|
||||
|
Loading…
x
Reference in New Issue
Block a user