mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-03 17:39:25 +02:00
parent
012debf65a
commit
db5118255b
@ -661,24 +661,24 @@ void TrackPanel::BuildMenus(void)
|
||||
// Use AppendCheckItem so we can have ticks beside the items.
|
||||
// We would use AppendRadioItem but it only currently works on windows and GTK.
|
||||
mRateMenu = new wxMenu();
|
||||
mRateMenu->AppendCheckItem(OnRate8ID, wxT("8000 Hz"));
|
||||
mRateMenu->AppendCheckItem(OnRate11ID, wxT("11025 Hz"));
|
||||
mRateMenu->AppendCheckItem(OnRate16ID, wxT("16000 Hz"));
|
||||
mRateMenu->AppendCheckItem(OnRate22ID, wxT("22050 Hz"));
|
||||
mRateMenu->AppendCheckItem(OnRate44ID, wxT("44100 Hz"));
|
||||
mRateMenu->AppendCheckItem(OnRate48ID, wxT("48000 Hz"));
|
||||
mRateMenu->AppendCheckItem(OnRate88ID, wxT("88200 Hz"));
|
||||
mRateMenu->AppendCheckItem(OnRate96ID, wxT("96000 Hz"));
|
||||
mRateMenu->AppendCheckItem(OnRate176ID, wxT("176400 Hz"));
|
||||
mRateMenu->AppendCheckItem(OnRate192ID, wxT("192000 Hz"));
|
||||
mRateMenu->AppendCheckItem(OnRate352ID, wxT("352800 Hz"));
|
||||
mRateMenu->AppendCheckItem(OnRate384ID, wxT("384000 Hz"));
|
||||
mRateMenu->AppendCheckItem(OnRateOtherID, _("&Other..."));
|
||||
mRateMenu->AppendRadioItem(OnRate8ID, wxT("8000 Hz"));
|
||||
mRateMenu->AppendRadioItem(OnRate11ID, wxT("11025 Hz"));
|
||||
mRateMenu->AppendRadioItem(OnRate16ID, wxT("16000 Hz"));
|
||||
mRateMenu->AppendRadioItem(OnRate22ID, wxT("22050 Hz"));
|
||||
mRateMenu->AppendRadioItem(OnRate44ID, wxT("44100 Hz"));
|
||||
mRateMenu->AppendRadioItem(OnRate48ID, wxT("48000 Hz"));
|
||||
mRateMenu->AppendRadioItem(OnRate88ID, wxT("88200 Hz"));
|
||||
mRateMenu->AppendRadioItem(OnRate96ID, wxT("96000 Hz"));
|
||||
mRateMenu->AppendRadioItem(OnRate176ID, wxT("176400 Hz"));
|
||||
mRateMenu->AppendRadioItem(OnRate192ID, wxT("192000 Hz"));
|
||||
mRateMenu->AppendRadioItem(OnRate352ID, wxT("352800 Hz"));
|
||||
mRateMenu->AppendRadioItem(OnRate384ID, wxT("384000 Hz"));
|
||||
mRateMenu->AppendRadioItem(OnRateOtherID, _("&Other..."));
|
||||
|
||||
mFormatMenu = new wxMenu();
|
||||
mFormatMenu->AppendCheckItem(On16BitID, GetSampleFormatStr(int16Sample));
|
||||
mFormatMenu->AppendCheckItem(On24BitID, GetSampleFormatStr(int24Sample));
|
||||
mFormatMenu->AppendCheckItem(OnFloatID, GetSampleFormatStr(floatSample));
|
||||
mFormatMenu->AppendRadioItem(On16BitID, GetSampleFormatStr(int16Sample));
|
||||
mFormatMenu->AppendRadioItem(On24BitID, GetSampleFormatStr(int24Sample));
|
||||
mFormatMenu->AppendRadioItem(OnFloatID, GetSampleFormatStr(floatSample));
|
||||
|
||||
/* build the pop-down menu used on wave (sampled audio) tracks */
|
||||
mWaveTrackMenu = new wxMenu();
|
||||
@ -690,9 +690,9 @@ void TrackPanel::BuildMenus(void)
|
||||
mWaveTrackMenu->Append(OnSpectrumLogID, _("Spectrogram l&og(f)"));
|
||||
mWaveTrackMenu->Append(OnPitchID, _("Pitc&h (EAC)"));
|
||||
mWaveTrackMenu->AppendSeparator();
|
||||
mWaveTrackMenu->AppendCheckItem(OnChannelMonoID, _("&Mono"));
|
||||
mWaveTrackMenu->AppendCheckItem(OnChannelLeftID, _("&Left Channel"));
|
||||
mWaveTrackMenu->AppendCheckItem(OnChannelRightID, _("&Right Channel"));
|
||||
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"));
|
||||
@ -6346,6 +6346,7 @@ bool TrackPanel::HandleLabelTrackMouseEvent(LabelTrack * lTrack, wxRect &r, wxMo
|
||||
mLabelTrackInfoMenu->Enable(OnPasteSelectedTextID, lTrack->IsTextClipSupported());
|
||||
mLabelTrackInfoMenu->Enable(OnDeleteSelectedLabelID, true);
|
||||
PopupMenu(mLabelTrackInfoMenu, event.m_x + 1, event.m_y + 1);
|
||||
mPopupMenuTarget = NULL;
|
||||
// it's an invalid dragging event
|
||||
lTrack->SetWrongDragging(true);
|
||||
}
|
||||
@ -8015,6 +8016,8 @@ void TrackPanel::OnTrackMenu(Track *t)
|
||||
titleRect.y + titleRect.height + 1);
|
||||
}
|
||||
|
||||
mPopupMenuTarget = NULL;
|
||||
|
||||
SetCapturedTrack(NULL);
|
||||
|
||||
Refresh(false);
|
||||
@ -8272,7 +8275,6 @@ void TrackPanel::OnChannelChange(wxCommandEvent & event)
|
||||
mPopupMenuTarget->GetName().c_str(),
|
||||
channelmsgs[id - OnChannelLeftID]),
|
||||
_("Channel"));
|
||||
mPopupMenuTarget = NULL;
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
@ -8448,7 +8450,6 @@ void TrackPanel::OnSetDisplay(wxCommandEvent & event)
|
||||
UpdateVRuler(wt);
|
||||
}
|
||||
MakeParentModifyState(true);
|
||||
mPopupMenuTarget = NULL;
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
@ -8512,7 +8513,6 @@ void TrackPanel::OnFormatChange(wxCommandEvent & event)
|
||||
_("Format Change"));
|
||||
|
||||
SetMenuCheck( *mFormatMenu, id );
|
||||
mPopupMenuTarget = NULL;
|
||||
MakeParentRedrawScrollbars();
|
||||
Refresh(false);
|
||||
}
|
||||
@ -8569,7 +8569,6 @@ void TrackPanel::OnRateChange(wxCommandEvent & event)
|
||||
SetMenuCheck( *mRateMenu, id );
|
||||
SetRate(mPopupMenuTarget, gRates[id - OnRate8ID]);
|
||||
|
||||
mPopupMenuTarget = NULL;
|
||||
MakeParentRedrawScrollbars();
|
||||
|
||||
Refresh(false);
|
||||
@ -8657,7 +8656,6 @@ void TrackPanel::OnRateOther(wxCommandEvent &event)
|
||||
SetMenuCheck( *mRateMenu, event.GetId() );
|
||||
SetRate(mPopupMenuTarget, newRate);
|
||||
|
||||
mPopupMenuTarget = NULL;
|
||||
MakeParentRedrawScrollbars();
|
||||
Refresh(false);
|
||||
}
|
||||
@ -8698,7 +8696,6 @@ void TrackPanel::OnSetTimeTrackRange(wxCommandEvent & /*event*/)
|
||||
Refresh(false);
|
||||
}
|
||||
}
|
||||
mPopupMenuTarget = NULL;
|
||||
}
|
||||
|
||||
void TrackPanel::OnTimeTrackLin(wxCommandEvent & /*event*/)
|
||||
|
@ -1098,7 +1098,6 @@ BEGIN_EVENT_TABLE(NumericTextCtrl, wxControl)
|
||||
EVT_ERASE_BACKGROUND(NumericTextCtrl::OnErase)
|
||||
EVT_PAINT(NumericTextCtrl::OnPaint)
|
||||
EVT_CONTEXT_MENU(NumericTextCtrl::OnContext)
|
||||
EVT_MENU_RANGE(ID_MENU, ID_MENU+100, NumericTextCtrl::OnMenu)
|
||||
EVT_MOUSE_EVENTS(NumericTextCtrl::OnMouse)
|
||||
EVT_KEY_DOWN(NumericTextCtrl::OnKeyDown)
|
||||
EVT_KEY_UP(NumericTextCtrl::OnKeyUp)
|
||||
@ -1424,39 +1423,6 @@ void NumericTextCtrl::OnPaint(wxPaintEvent & WXUNUSED(event))
|
||||
dc.SetBrush( wxNullBrush );
|
||||
}
|
||||
|
||||
void NumericTextCtrl::OnMenu(wxCommandEvent &event)
|
||||
{
|
||||
int id = event.GetId() - ID_MENU;
|
||||
|
||||
if (!mMenuEnabled || id < 0 || id > GetNumBuiltins()) {
|
||||
event.Skip();
|
||||
return;
|
||||
}
|
||||
|
||||
SetFormatString(GetBuiltinFormat(id));
|
||||
|
||||
int eventType = 0;
|
||||
switch (mType) {
|
||||
case NumericConverter::TIME:
|
||||
eventType = EVT_TIMETEXTCTRL_UPDATED;
|
||||
break;
|
||||
case NumericConverter::FREQUENCY:
|
||||
eventType = EVT_FREQUENCYTEXTCTRL_UPDATED;
|
||||
break;
|
||||
case NumericConverter::LOG_FREQUENCY:
|
||||
eventType = EVT_LOGFREQUENCYTEXTCTRL_UPDATED;
|
||||
break;
|
||||
default:
|
||||
wxASSERT(false);
|
||||
break;
|
||||
}
|
||||
|
||||
wxCommandEvent e(eventType, GetId());
|
||||
e.SetInt(id);
|
||||
e.SetString(GetBuiltinName(id));
|
||||
GetParent()->GetEventHandler()->AddPendingEvent(e);
|
||||
}
|
||||
|
||||
void NumericTextCtrl::OnContext(wxContextMenuEvent &event)
|
||||
{
|
||||
wxMenu menu;
|
||||
@ -1469,13 +1435,49 @@ void NumericTextCtrl::OnContext(wxContextMenuEvent &event)
|
||||
|
||||
SetFocus();
|
||||
|
||||
for(i=0; i<GetNumBuiltins(); i++) {
|
||||
menu.AppendCheckItem(ID_MENU+i, GetBuiltinName(i));
|
||||
if (mFormatString == GetBuiltinFormat(i))
|
||||
menu.Check(ID_MENU+i, true);
|
||||
int currentSelection = -1;
|
||||
for (i = 0; i < GetNumBuiltins(); i++) {
|
||||
menu.AppendRadioItem(ID_MENU + i, GetBuiltinName(i));
|
||||
if (mFormatString == GetBuiltinFormat(i)) {
|
||||
menu.Check(ID_MENU + i, true);
|
||||
currentSelection = i;
|
||||
}
|
||||
}
|
||||
|
||||
PopupMenu(&menu, wxPoint(0, 0));
|
||||
|
||||
// This used to be in an EVT_MENU() event handler, but GTK
|
||||
// is sensitive to what is done within the handler if the
|
||||
// user happens to check the first menuitem and then is
|
||||
// moving down the menu when the ...CTRL_UPDATED event
|
||||
// handler kicks in.
|
||||
for (i = 0; i < GetNumBuiltins(); i++) {
|
||||
if (menu.IsChecked(ID_MENU + i) && i != currentSelection) {
|
||||
SetFormatString(GetBuiltinFormat(i));
|
||||
|
||||
int eventType = 0;
|
||||
switch (mType) {
|
||||
case NumericConverter::TIME:
|
||||
eventType = EVT_TIMETEXTCTRL_UPDATED;
|
||||
break;
|
||||
case NumericConverter::FREQUENCY:
|
||||
eventType = EVT_FREQUENCYTEXTCTRL_UPDATED;
|
||||
break;
|
||||
case NumericConverter::LOG_FREQUENCY:
|
||||
eventType = EVT_LOGFREQUENCYTEXTCTRL_UPDATED;
|
||||
break;
|
||||
default:
|
||||
wxASSERT(false);
|
||||
break;
|
||||
}
|
||||
|
||||
wxCommandEvent e(eventType, GetId());
|
||||
e.SetInt(i);
|
||||
e.SetString(GetBuiltinName(i));
|
||||
GetParent()->GetEventHandler()->AddPendingEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void NumericTextCtrl::OnMouse(wxMouseEvent &event)
|
||||
|
@ -160,7 +160,6 @@ private:
|
||||
void OnPaint(wxPaintEvent &event);
|
||||
void OnFocus(wxFocusEvent &event);
|
||||
void OnContext(wxContextMenuEvent &event);
|
||||
void OnMenu(wxCommandEvent &event);
|
||||
|
||||
void ValueToControls();
|
||||
void ControlsToValue();
|
||||
|
Loading…
x
Reference in New Issue
Block a user