From 81aec949dc86b106e74291b46155c4a11d3b0a4c Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Fri, 21 Sep 2007 22:56:44 +0000 Subject: [PATCH] Change more places to check for Cmd key on Mac rather than Ctrl key. Originally committed to SVN as r1574. --- aegisub/base_grid.cpp | 8 ++++++++ aegisub/dialog_style_manager.cpp | 8 ++++++++ aegisub/frame_main_events.cpp | 4 ++++ aegisub/subs_edit_box.cpp | 11 ++++++++++- aegisub/timeedit_ctrl.cpp | 4 ++++ aegisub/video_box.cpp | 8 ++++++++ aegisub/video_slider.cpp | 4 ++++ aegisub/visual_tool.cpp | 4 ++++ 8 files changed, 50 insertions(+), 1 deletion(-) diff --git a/aegisub/base_grid.cpp b/aegisub/base_grid.cpp index 9748db58b..084685908 100644 --- a/aegisub/base_grid.cpp +++ b/aegisub/base_grid.cpp @@ -577,7 +577,11 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) { // Modifiers bool shift = event.m_shiftDown; bool alt = event.m_altDown; +#ifdef __APPLE__ + bool ctrl = event.m_metaDown; +#else bool ctrl = event.m_controlDown; +#endif // Row that mouse is over bool click = event.ButtonDown(wxMOUSE_BTN_LEFT); @@ -952,7 +956,11 @@ void BaseGrid::OnKeyPress(wxKeyEvent &event) { // Get scan code int key = event.GetKeyCode(); +#ifdef __APPLE__ + bool ctrl = event.m_metaDown; +#else bool ctrl = event.m_controlDown; +#endif bool alt = event.m_altDown; bool shift = event.m_shiftDown; diff --git a/aegisub/dialog_style_manager.cpp b/aegisub/dialog_style_manager.cpp index 3a8b5353a..759786afe 100644 --- a/aegisub/dialog_style_manager.cpp +++ b/aegisub/dialog_style_manager.cpp @@ -1154,7 +1154,11 @@ void DialogStyleManager::OnKeyDown(wxKeyEvent &event) { case 'C' : case 'c' : +#ifdef __APPLE__ + if (event.CmdDown()) { +#else if (event.ControlDown()) { +#endif if (wxWindow::FindFocus()==CurrentList) { CopyToClipboard(CurrentList,styleMap); } @@ -1166,7 +1170,11 @@ void DialogStyleManager::OnKeyDown(wxKeyEvent &event) { case 'V' : case 'v' : +#ifdef __APPLE__ + if (event.CmdDown()) { +#else if (event.ControlDown()) { +#endif if (wxWindow::FindFocus()==CurrentList) { PasteToCurrent(); } diff --git a/aegisub/frame_main_events.cpp b/aegisub/frame_main_events.cpp index 16eead0fe..b2eb56077 100644 --- a/aegisub/frame_main_events.cpp +++ b/aegisub/frame_main_events.cpp @@ -1006,7 +1006,11 @@ void FrameMain::OnOpenLog (wxCommandEvent &event) { /////////////////// // Open Automation void FrameMain::OnOpenAutomation (wxCommandEvent &event) { +#ifdef __APPLE__ + if (wxGetMouseState().CmdDown()) { +#else if (wxGetMouseState().ControlDown()) { +#endif wxGetApp().global_scripts->Reload(); if (wxGetMouseState().ShiftDown()) { const std::vector scripts = local_scripts->GetScripts(); diff --git a/aegisub/subs_edit_box.cpp b/aegisub/subs_edit_box.cpp index b020081cb..1b4a08ff3 100644 --- a/aegisub/subs_edit_box.cpp +++ b/aegisub/subs_edit_box.cpp @@ -824,7 +824,11 @@ void SubsEditBox::DoKeyPress(wxKeyEvent &event) { if (key == WXK_RETURN || key == WXK_NUMPAD_ENTER) { if (enabled) { +#ifdef __APPLE__ + Commit(event.m_metaDown); +#else Commit(event.m_controlDown); +#endif return; } } @@ -1292,7 +1296,12 @@ void SubsEditBox::OnButtonStrikeout(wxCommandEvent &event) { ////////// // Commit void SubsEditBox::OnButtonCommit(wxCommandEvent &event) { - Commit(wxGetMouseState().ControlDown()); + Commit(wxGetMouseState(). +#ifdef __APPLE__ + CmdDown()); +#else + ControlDown()); +#endif } diff --git a/aegisub/timeedit_ctrl.cpp b/aegisub/timeedit_ctrl.cpp index fe70fb78b..146a52a20 100644 --- a/aegisub/timeedit_ctrl.cpp +++ b/aegisub/timeedit_ctrl.cpp @@ -233,7 +233,11 @@ void TimeEdit::OnKeyDown(wxKeyEvent &event) { Refresh(); // Check if it's an acceptable key +#ifdef __APPLE__ + if (!event.CmdDown()) { +#else if (!event.ControlDown()) { +#endif if (byFrame || !insertMode || (key != WXK_BACK && key != WXK_DELETE)) { // Reset selection first, if necessary if (!byFrame && insertMode) { diff --git a/aegisub/video_box.cpp b/aegisub/video_box.cpp index 3f9e8906b..175e8402f 100644 --- a/aegisub/video_box.cpp +++ b/aegisub/video_box.cpp @@ -168,7 +168,11 @@ END_EVENT_TABLE() // Play video void VideoBox::OnVideoPlay(wxCommandEvent &event) { VideoContext *ctx = VideoContext::Get(); +#ifdef __APPLE__ + ctx->EnableAudioSync(wxGetMouseState().CmdDown() == false); +#else ctx->EnableAudioSync(wxGetMouseState().ControlDown() == false); +#endif ctx->Play(); } @@ -177,7 +181,11 @@ void VideoBox::OnVideoPlay(wxCommandEvent &event) { // Play video line void VideoBox::OnVideoPlayLine(wxCommandEvent &event) { VideoContext *ctx = VideoContext::Get(); +#ifdef __APPLE__ + ctx->EnableAudioSync(wxGetMouseState().CmdDown() == false); +#else ctx->EnableAudioSync(wxGetMouseState().ControlDown() == false); +#endif ctx->PlayLine(); } diff --git a/aegisub/video_slider.cpp b/aegisub/video_slider.cpp index 6d11b37ec..dcfc1936e 100644 --- a/aegisub/video_slider.cpp +++ b/aegisub/video_slider.cpp @@ -247,7 +247,11 @@ void VideoSlider::OnKeyDown(wxKeyEvent &event) { // Get flags int key = event.GetKeyCode(); +#ifdef __APPLE__ + bool ctrl = event.m_metaDown; +#else bool ctrl = event.m_controlDown; +#endif bool alt = event.m_altDown; bool shift = event.m_shiftDown; int direction = 0; diff --git a/aegisub/visual_tool.cpp b/aegisub/visual_tool.cpp index ef4c1c14a..3abdf6f41 100644 --- a/aegisub/visual_tool.cpp +++ b/aegisub/visual_tool.cpp @@ -128,7 +128,11 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) { leftClick = event.ButtonDown(wxMOUSE_BTN_LEFT); leftDClick = event.LeftDClick(); shiftDown = event.m_shiftDown; +#ifdef __APPLE__ + ctrlDown = event.m_metaDown; // Cmd key +#else ctrlDown = event.m_controlDown; +#endif altDown = event.m_altDown; // Drag a feature