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);
|
mAdjustRightSelectionCursor = new wxCursor(wxCURSOR_POINT_RIGHT);
|
||||||
|
|
||||||
mWaveTrackMenu = NULL;
|
mWaveTrackMenu = NULL;
|
||||||
|
mChannelItemsInsertionPoint = 0;
|
||||||
|
mShowMono = false;
|
||||||
|
|
||||||
mNoteTrackMenu = NULL;
|
mNoteTrackMenu = NULL;
|
||||||
mLabelTrackMenu = NULL;
|
mLabelTrackMenu = NULL;
|
||||||
mTimeTrackMenu = NULL;
|
mTimeTrackMenu = NULL;
|
||||||
@ -669,6 +672,43 @@ TrackPanel::~TrackPanel()
|
|||||||
delete mInitialTrackSelection;
|
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)
|
void TrackPanel::BuildMenus(void)
|
||||||
{
|
{
|
||||||
// Get rid of existing menus
|
// Get rid of existing menus
|
||||||
@ -704,13 +744,9 @@ void TrackPanel::BuildMenus(void)
|
|||||||
mWaveTrackMenu->Append(OnViewSettingsID, _("&View Settings..."));
|
mWaveTrackMenu->Append(OnViewSettingsID, _("&View Settings..."));
|
||||||
mWaveTrackMenu->AppendSeparator();
|
mWaveTrackMenu->AppendSeparator();
|
||||||
|
|
||||||
mWaveTrackMenu->AppendRadioItem(OnChannelMonoID, _("&Mono"));
|
mChannelItemsInsertionPoint = mWaveTrackMenu->GetMenuItemCount();
|
||||||
mWaveTrackMenu->AppendRadioItem(OnChannelLeftID, _("&Left Channel"));
|
ShowMonoItems(mWaveTrackMenu, mChannelItemsInsertionPoint);
|
||||||
mWaveTrackMenu->AppendRadioItem(OnChannelRightID, _("&Right Channel"));
|
mShowMono = true;
|
||||||
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();
|
mWaveTrackMenu->AppendSeparator();
|
||||||
|
|
||||||
mWaveTrackMenu->Append(0, _("&Format"), mFormatMenu);
|
mWaveTrackMenu->Append(0, _("&Format"), mFormatMenu);
|
||||||
@ -8294,7 +8330,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;
|
||||||
@ -8310,31 +8345,38 @@ 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()
|
const bool isMono = !t->GetLinked();
|
||||||
&& t->GetKind() == Track::Wave
|
const bool canMakeStereo =
|
||||||
&& next->GetKind() == Track::Wave)
|
(next && isMono && !next->GetLinked() &&
|
||||||
canMakeStereo = true;
|
next->GetKind() == Track::Wave);
|
||||||
|
|
||||||
theMenu->Enable(OnSwapChannelsID, t->GetLinked());
|
if (isMono != mShowMono) {
|
||||||
theMenu->Enable(OnMergeStereoID, canMakeStereo);
|
if (isMono) {
|
||||||
theMenu->Enable(OnSplitStereoID, t->GetLinked());
|
HideStereoItems(theMenu);
|
||||||
theMenu->Enable(OnSplitStereoMonoID, t->GetLinked());
|
ShowMonoItems(theMenu, mChannelItemsInsertionPoint);
|
||||||
|
}
|
||||||
// We only need to set check marks. Clearing checks causes problems on Linux (bug 851)
|
else {
|
||||||
switch (t->GetChannel()) {
|
HideMonoItems(theMenu);
|
||||||
case Track::LeftChannel:
|
ShowStereoItems(theMenu, mChannelItemsInsertionPoint);
|
||||||
theMenu->Check(OnChannelLeftID, true);
|
}
|
||||||
break;
|
mShowMono = isMono;
|
||||||
case Track::RightChannel:
|
|
||||||
theMenu->Check(OnChannelRightID, true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
theMenu->Check(OnChannelMonoID, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
theMenu->Enable(OnChannelMonoID, !t->GetLinked());
|
if (isMono) {
|
||||||
theMenu->Enable(OnChannelLeftID, !t->GetLinked());
|
theMenu->Enable(OnMergeStereoID, canMakeStereo);
|
||||||
theMenu->Enable(OnChannelRightID, !t->GetLinked());
|
|
||||||
|
// 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);
|
||||||
|
break;
|
||||||
|
case Track::RightChannel:
|
||||||
|
theMenu->Check(OnChannelRightID, true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
theMenu->Check(OnChannelMonoID, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const int display = static_cast<WaveTrack *>(t)->GetDisplay();
|
const int display = static_cast<WaveTrack *>(t)->GetDisplay();
|
||||||
theMenu->Check(
|
theMenu->Check(
|
||||||
|
@ -820,6 +820,9 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxMenu *mWaveTrackMenu;
|
wxMenu *mWaveTrackMenu;
|
||||||
|
size_t mChannelItemsInsertionPoint;
|
||||||
|
bool mShowMono;
|
||||||
|
|
||||||
wxMenu *mNoteTrackMenu;
|
wxMenu *mNoteTrackMenu;
|
||||||
wxMenu *mTimeTrackMenu;
|
wxMenu *mTimeTrackMenu;
|
||||||
wxMenu *mLabelTrackMenu;
|
wxMenu *mLabelTrackMenu;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user