From 280b9acf61b8a0ecc866ee679ca23d1ae6636082 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sat, 30 Dec 2006 22:08:23 +0000 Subject: [PATCH] Added Medusa-style (numpad) global timing shortcuts, that can be enabled with the button under the audio display. This is disabled by default. Originally committed to SVN as r662. --- aegisub/audio_box.cpp | 13 +++++++++ aegisub/audio_box.h | 1 + aegisub/audio_display.h | 2 ++ aegisub/changelog.txt | 1 + aegisub/frame_main.cpp | 25 +++++++++++++--- aegisub/frame_main.h | 20 +++++++++++-- aegisub/frame_main_events.cpp | 55 +++++++++++++++++++++++++++++++---- 7 files changed, 106 insertions(+), 11 deletions(-) diff --git a/aegisub/audio_box.cpp b/aegisub/audio_box.cpp index 1816d3e8e..83dbcc3d6 100644 --- a/aegisub/audio_box.cpp +++ b/aegisub/audio_box.cpp @@ -238,6 +238,8 @@ void AudioBox::SetFile(wxString file,bool FromVideo) { if (file != _T("")) loaded = audioDisplay->loaded; audioName = file; } + + frameMain->SetAccelerators(); } @@ -271,6 +273,7 @@ BEGIN_EVENT_TABLE(AudioBox,wxPanel) EVT_TOGGLEBUTTON(Audio_Check_AutoGoto,AudioBox::OnAutoGoto) EVT_TOGGLEBUTTON(Audio_Button_Split,AudioBox::OnSplit) EVT_TOGGLEBUTTON(Audio_Check_SSA,AudioBox::OnSSAMode) + EVT_TOGGLEBUTTON(Audio_Check_Medusa,AudioBox::OnMedusaMode) EVT_TOGGLEBUTTON(Audio_Check_Spectrum,AudioBox::OnSpectrumMode) EVT_TOGGLEBUTTON(Audio_Check_AutoCommit,AudioBox::OnAutoCommit) END_EVENT_TABLE() @@ -590,6 +593,16 @@ void AudioBox::OnSSAMode(wxCommandEvent &event) { } +/////////////// +// Medusa Mode +void AudioBox::OnMedusaMode(wxCommandEvent &event) { + audioDisplay->SetFocus(); + Options.SetBool(_T("Audio Medusa Timing Hotkeys"),MedusaMode->GetValue()); + Options.Save(); + frameMain->SetAccelerators(); +} + + ////////////////////////// // Spectrum Analyzer Mode void AudioBox::OnSpectrumMode(wxCommandEvent &event) { diff --git a/aegisub/audio_box.h b/aegisub/audio_box.h index 56ef6f48f..222348a48 100644 --- a/aegisub/audio_box.h +++ b/aegisub/audio_box.h @@ -107,6 +107,7 @@ private: void OnAutoGoto(wxCommandEvent &event); void OnAutoCommit(wxCommandEvent &event); void OnSSAMode(wxCommandEvent &event); + void OnMedusaMode(wxCommandEvent &event); void OnSpectrumMode(wxCommandEvent &event); public: diff --git a/aegisub/audio_display.h b/aegisub/audio_display.h index f1543fbac..40421390b 100644 --- a/aegisub/audio_display.h +++ b/aegisub/audio_display.h @@ -54,11 +54,13 @@ class AudioBox; class AudioKaraoke; class VideoDisplay; class VideoProvider; +class FrameMain; ///////////////// // Display class class AudioDisplay: public wxWindow { + friend class FrameMain; private: SubtitlesGrid *grid; int line_n; diff --git a/aegisub/changelog.txt b/aegisub/changelog.txt index c79f25b48..1b7019896 100644 --- a/aegisub/changelog.txt +++ b/aegisub/changelog.txt @@ -61,6 +61,7 @@ Please visit http://aegisub.net to download latest version - Minor fix to the calculation of the grid's "Style" column width. (AMZ) - Added a "Selection Onward" option to the Shift Times dialogue. (AMZ) - Main menu was completely re-designed, including several new options. (AMZ) +- Added Medusa-style (numpad) global timing shortcuts, that can be enabled with the button under the audio display. This is disabled by default. (AMZ) = 1.10 beta - 2006.08.07 =========================== diff --git a/aegisub/frame_main.cpp b/aegisub/frame_main.cpp index 45616ff65..402578c60 100644 --- a/aegisub/frame_main.cpp +++ b/aegisub/frame_main.cpp @@ -59,6 +59,7 @@ #include "dialog_splash.h" #include "dialog_tip.h" #include "audio_box.h" +#include "audio_display.h" #include "video_box.h" #include "drop.h" #include "hotkeys.h" @@ -1246,8 +1247,10 @@ void FrameMain::StatusTimeout(wxString text,int ms) { /////////////////////////// // Setup accelerator table void FrameMain::SetAccelerators() { - wxAcceleratorEntry entry[11]; + wxAcceleratorEntry entry[20]; int i = 0; + + // Standard entry[i++] = Hotkeys.GetAccelerator(_T("Video global prev frame"),Video_Prev_Frame); entry[i++] = Hotkeys.GetAccelerator(_T("Video global next frame"),Video_Next_Frame); entry[i++] = Hotkeys.GetAccelerator(_T("Video global focus seek"),Video_Focus_Seek); @@ -1258,9 +1261,23 @@ void FrameMain::SetAccelerators() { entry[i++] = Hotkeys.GetAccelerator(_T("Video global zoom out"),Menu_Video_Zoom_Out); entry[i++] = Hotkeys.GetAccelerator(_T("Video global play"),Video_Play); entry[i++] = Hotkeys.GetAccelerator(_T("Edit box commit"),Edit_Box_Commit); - wxAcceleratorEntry temp; - temp.Set(wxACCEL_CTRL | wxACCEL_ALT,WXK_F12,Kana_Game); - entry[i++] = temp; + + // Medusa + bool medusaPlay = Options.AsBool(_T("Audio Medusa Timing Hotkeys")); + if (medusaPlay && audioBox->audioDisplay->loaded) { + entry[i++] = Hotkeys.GetAccelerator(_T("Audio Medusa Play"),Medusa_Play); + entry[i++] = Hotkeys.GetAccelerator(_T("Audio Medusa Stop"),Medusa_Stop); + entry[i++] = Hotkeys.GetAccelerator(_T("Audio Medusa Play Before"),Medusa_Play_Before); + entry[i++] = Hotkeys.GetAccelerator(_T("Audio Medusa Play After"),Medusa_Play_After); + entry[i++] = Hotkeys.GetAccelerator(_T("Audio Medusa Next"),Medusa_Next); + entry[i++] = Hotkeys.GetAccelerator(_T("Audio Medusa Previous"),Medusa_Prev); + entry[i++] = Hotkeys.GetAccelerator(_T("Audio Medusa Shift Start Forward"),Medusa_Shift_Start_Forward); + entry[i++] = Hotkeys.GetAccelerator(_T("Audio Medusa Shift Start Back"),Medusa_Shift_Start_Back); + entry[i++] = Hotkeys.GetAccelerator(_T("Audio Medusa Shift End Forward"),Medusa_Shift_End_Forward); + entry[i++] = Hotkeys.GetAccelerator(_T("Audio Medusa Shift End Back"),Medusa_Shift_End_Back); + } + + // Set table wxAcceleratorTable table(i,entry); SetAcceleratorTable(table); } diff --git a/aegisub/frame_main.h b/aegisub/frame_main.h index d378a4c0a..fd73d87bc 100644 --- a/aegisub/frame_main.h +++ b/aegisub/frame_main.h @@ -229,7 +229,14 @@ private: void OnPrevLine(wxCommandEvent &event); void OnToggleTags(wxCommandEvent &event); - void OnKanaGame(wxCommandEvent &event); + void OnMedusaPlay(wxCommandEvent &event); + void OnMedusaStop(wxCommandEvent &event); + void OnMedusaShiftStartForward(wxCommandEvent &event); + void OnMedusaShiftStartBack(wxCommandEvent &event); + void OnMedusaShiftEndForward(wxCommandEvent &event); + void OnMedusaShiftEndBack(wxCommandEvent &event); + void OnMedusaPlayBefore(wxCommandEvent &event); + void OnMedusaPlayAfter(wxCommandEvent &event); void LoadVideo(wxString filename,bool autoload=false); void LoadAudio(wxString filename,bool FromVideo=false); @@ -407,7 +414,16 @@ enum { Video_Track_Link_File, Video_Track_Movement_Empty, - Kana_Game, + Medusa_Play, + Medusa_Stop, + Medusa_Shift_Start_Forward, + Medusa_Shift_Start_Back, + Medusa_Shift_End_Forward, + Medusa_Shift_End_Back, + Medusa_Play_Before, + Medusa_Play_After, + Medusa_Next, + Medusa_Prev, Menu_File_Recent = 2000, Menu_Video_Recent = 2200, diff --git a/aegisub/frame_main_events.cpp b/aegisub/frame_main_events.cpp index 41c390624..e86cee7c4 100644 --- a/aegisub/frame_main_events.cpp +++ b/aegisub/frame_main_events.cpp @@ -214,7 +214,16 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame) EVT_MENU(Grid_Toggle_Tags,FrameMain::OnToggleTags) EVT_MENU(Edit_Box_Commit,FrameMain::OnEditBoxCommit) - EVT_MENU(Kana_Game, FrameMain::OnKanaGame) + EVT_MENU(Medusa_Play, FrameMain::OnMedusaPlay) + EVT_MENU(Medusa_Stop, FrameMain::OnMedusaStop) + EVT_MENU(Medusa_Play_After, FrameMain::OnMedusaPlayAfter) + EVT_MENU(Medusa_Play_Before, FrameMain::OnMedusaPlayBefore) + EVT_MENU(Medusa_Next, FrameMain::OnNextLine) + EVT_MENU(Medusa_Prev, FrameMain::OnPrevLine) + EVT_MENU(Medusa_Shift_Start_Forward, FrameMain::OnMedusaShiftStartForward) + EVT_MENU(Medusa_Shift_Start_Back, FrameMain::OnMedusaShiftStartBack) + EVT_MENU(Medusa_Shift_End_Forward, FrameMain::OnMedusaShiftEndForward) + EVT_MENU(Medusa_Shift_End_Back, FrameMain::OnMedusaShiftEndBack) #ifdef __WXMAC__ EVT_MENU(wxID_ABOUT, FrameMain::OnAbout) @@ -1592,8 +1601,44 @@ void FrameMain::OnViewSubs (wxCommandEvent &event) { } -///////////// -// Kana game -void FrameMain::OnKanaGame(wxCommandEvent &event) { - wxMessageBox(_T("TODO")); +//////////////////// +// Medusa shortcuts +void FrameMain::OnMedusaPlay(wxCommandEvent &event) { + int start=0,end=0; + audioBox->audioDisplay->GetTimesSelection(start,end); + audioBox->audioDisplay->Play(start,end); +} +void FrameMain::OnMedusaStop(wxCommandEvent &event) { + audioBox->audioDisplay->Stop(); + audioBox->audioDisplay->Refresh(); +} +void FrameMain::OnMedusaShiftStartForward(wxCommandEvent &event) { + audioBox->audioDisplay->curStartMS += 10; + audioBox->audioDisplay->Update(); + audioBox->audioDisplay->wxWindow::Update(); +} +void FrameMain::OnMedusaShiftStartBack(wxCommandEvent &event) { + audioBox->audioDisplay->curStartMS -= 10; + audioBox->audioDisplay->Update(); + audioBox->audioDisplay->wxWindow::Update(); +} +void FrameMain::OnMedusaShiftEndForward(wxCommandEvent &event) { + audioBox->audioDisplay->curEndMS += 10; + audioBox->audioDisplay->Update(); + audioBox->audioDisplay->wxWindow::Update(); +} +void FrameMain::OnMedusaShiftEndBack(wxCommandEvent &event) { + audioBox->audioDisplay->curEndMS -= 10; + audioBox->audioDisplay->Update(); + audioBox->audioDisplay->wxWindow::Update(); +} +void FrameMain::OnMedusaPlayBefore(wxCommandEvent &event) { + int start=0,end=0; + audioBox->audioDisplay->GetTimesSelection(start,end); + audioBox->audioDisplay->Play(start-500,start); +} +void FrameMain::OnMedusaPlayAfter(wxCommandEvent &event) { + int start=0,end=0; + audioBox->audioDisplay->GetTimesSelection(start,end); + audioBox->audioDisplay->Play(end,end+500); }