1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-29 22:58:39 +02:00

Make the Windows menu key work for the ruler

This commit is contained in:
Paul Licameli 2016-05-06 18:21:15 -04:00
parent c616d433c2
commit 5c3548528f
2 changed files with 13 additions and 0 deletions

View File

@ -1784,9 +1784,13 @@ BEGIN_EVENT_TABLE(AdornedRulerPanel, wxPanel)
EVT_COMMAND(wxID_ANY, EVT_CAPTURE_KEY, AdornedRulerPanel::OnCaptureKey) EVT_COMMAND(wxID_ANY, EVT_CAPTURE_KEY, AdornedRulerPanel::OnCaptureKey)
EVT_KEY_DOWN(AdornedRulerPanel::OnKeyDown) EVT_KEY_DOWN(AdornedRulerPanel::OnKeyDown)
// Correct management of track focus
EVT_SET_FOCUS(AdornedRulerPanel::OnSetFocus) EVT_SET_FOCUS(AdornedRulerPanel::OnSetFocus)
EVT_KILL_FOCUS(AdornedRulerPanel::OnKillFocus) EVT_KILL_FOCUS(AdornedRulerPanel::OnKillFocus)
// Pop up menus on Windows
EVT_CONTEXT_MENU(AdornedRulerPanel::OnContextMenu)
END_EVENT_TABLE() END_EVENT_TABLE()
AdornedRulerPanel::AdornedRulerPanel(AudacityProject* parent, AdornedRulerPanel::AdornedRulerPanel(AudacityProject* parent,
@ -2831,6 +2835,7 @@ void AdornedRulerPanel::OnKeyDown(wxKeyEvent &event)
break; break;
default: default:
event.Skip();
break; break;
} }
} }
@ -2849,6 +2854,13 @@ void AdornedRulerPanel::OnKillFocus(wxFocusEvent & WXUNUSED(event))
Refresh(false); Refresh(false);
} }
void AdornedRulerPanel::OnContextMenu(wxContextMenuEvent & WXUNUSED(event))
{
auto rect = GetRect();
wxPoint position(rect.GetLeft() + 1, rect.GetBottom() + 1);
ShowMenu(position);
}
void AdornedRulerPanel::OnCaptureLost(wxMouseCaptureLostEvent & WXUNUSED(evt)) void AdornedRulerPanel::OnCaptureLost(wxMouseCaptureLostEvent & WXUNUSED(evt))
{ {
DrawQuickPlayIndicator(NULL); DrawQuickPlayIndicator(NULL);

View File

@ -478,6 +478,7 @@ private:
void OnKeyDown(wxKeyEvent &event); void OnKeyDown(wxKeyEvent &event);
void OnSetFocus(wxFocusEvent &); void OnSetFocus(wxFocusEvent &);
void OnKillFocus(wxFocusEvent &); void OnKillFocus(wxFocusEvent &);
void OnContextMenu(wxContextMenuEvent & WXUNUSED(event));
bool mPlayRegionDragsSelection; bool mPlayRegionDragsSelection;
bool mTimelineToolTip; bool mTimelineToolTip;