Originally committed to SVN as r1448.
This commit is contained in:
Rodrigo Braz Monteiro 2007-07-27 08:24:49 +00:00
parent 7e6a5ad6c8
commit 3f934a66db
6 changed files with 50 additions and 13 deletions

View File

@ -1615,9 +1615,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
diagUpdated = false;
NeedCommit = true;
if (curStartMS <= curEndMS) {
grid->editBox->StartTime->SetTime(curStartMS,true);
grid->editBox->EndTime->SetTime(curEndMS,true);
grid->editBox->Duration->SetTime(curEndMS-curStartMS,true);
UpdateTimeEditCtrls();
if (Options.AsBool(_T("Audio Autocommit"))) CommitChanges();
}
@ -2140,7 +2138,7 @@ void AudioDisplay::ChangeLine(int delta) {
////////
// Next
void AudioDisplay::Next() {
void AudioDisplay::Next(bool play) {
wxLogDebug(_T("AudioDisplay::Next"));
// Karaoke
if (karaoke->enabled) {
@ -2180,7 +2178,7 @@ void AudioDisplay::Next() {
if (needsUpdate) Update();
int start=0,end=0;
GetTimesSelection(start,end);
Play(start,end);
if (play) Play(start,end);
}
// Plain mode
@ -2195,7 +2193,7 @@ void AudioDisplay::Next() {
////////////
// Previous
void AudioDisplay::Prev() {
void AudioDisplay::Prev(bool play) {
wxLogDebug(_T("AudioDisplay::Prev"));
// Karaoke
if (karaoke->enabled) {
@ -2233,7 +2231,7 @@ void AudioDisplay::Prev() {
if (needsUpdate) Update();
int start=0,end=0;
GetTimesSelection(start,end);
Play(start,end);
if (play) Play(start,end);
}
// Plain mode
@ -2284,3 +2282,10 @@ void AudioDisplay::OnLoseFocus(wxFocusEvent &event) {
}
//////////////////////////////
// Update time edit controls
void AudioDisplay::UpdateTimeEditCtrls() {
grid->editBox->StartTime->SetTime(curStartMS,true);
grid->editBox->EndTime->SetTime(curEndMS,true);
grid->editBox->Duration->SetTime(curEndMS-curStartMS,true);
}

View File

@ -155,9 +155,10 @@ public:
void SetDialogue(SubtitlesGrid *_grid=NULL,AssDialogue *diag=NULL,int n=-1);
void MakeDialogueVisible(bool force=false);
void ChangeLine(int delta);
void Next();
void Prev();
void Next(bool play=true);
void Prev(bool play=true);
void UpdateTimeEditCtrls();
void CommitChanges(bool nextLine=false);
void AddLead(bool in,bool out);

View File

@ -1247,6 +1247,7 @@ void FrameMain::SetAccelerators() {
entry.push_back(Hotkeys.GetAccelerator(_T("Audio Medusa Shift Start Back"),Medusa_Shift_Start_Back));
entry.push_back(Hotkeys.GetAccelerator(_T("Audio Medusa Shift End Forward"),Medusa_Shift_End_Forward));
entry.push_back(Hotkeys.GetAccelerator(_T("Audio Medusa Shift End Back"),Medusa_Shift_End_Back));
entry.push_back(Hotkeys.GetAccelerator(_T("Audio Medusa Enter"),Medusa_Enter));
}
// Set table

View File

@ -233,6 +233,9 @@ private:
void OnMedusaShiftEndBack(wxCommandEvent &event);
void OnMedusaPlayBefore(wxCommandEvent &event);
void OnMedusaPlayAfter(wxCommandEvent &event);
void OnMedusaEnter(wxCommandEvent &event);
void OnMedusaNext(wxCommandEvent &event);
void OnMedusaPrev(wxCommandEvent &event);
void LoadVideo(wxString filename,bool autoload=false);
void LoadAudio(wxString filename,bool FromVideo=false);
@ -414,6 +417,7 @@ enum {
Medusa_Play_After,
Medusa_Next,
Medusa_Prev,
Medusa_Enter,
Menu_File_Recent = 2000,
Menu_Video_Recent = 2200,

View File

@ -208,12 +208,13 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame)
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_Next, FrameMain::OnMedusaNext)
EVT_MENU(Medusa_Prev, FrameMain::OnMedusaPrev)
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)
EVT_MENU(Medusa_Enter, FrameMain::OnMedusaEnter)
#ifdef __WXMAC__
EVT_MENU(wxID_ABOUT, FrameMain::OnAbout)
@ -1642,28 +1643,42 @@ void FrameMain::OnMedusaPlay(wxCommandEvent &event) {
audioBox->audioDisplay->Play(start,end);
}
void FrameMain::OnMedusaStop(wxCommandEvent &event) {
audioBox->audioDisplay->Stop();
audioBox->audioDisplay->Refresh();
// Playing, stop
if (audioBox->audioDisplay->player->IsPlaying()) {
audioBox->audioDisplay->Stop();
audioBox->audioDisplay->Refresh();
}
// Otherwise, play the last 500 ms
else {
int start=0,end=0;
audioBox->audioDisplay->GetTimesSelection(start,end);
audioBox->audioDisplay->Play(end-500,end);
}
}
void FrameMain::OnMedusaShiftStartForward(wxCommandEvent &event) {
audioBox->audioDisplay->curStartMS += 10;
audioBox->audioDisplay->Update();
audioBox->audioDisplay->wxWindow::Update();
audioBox->audioDisplay->UpdateTimeEditCtrls();
}
void FrameMain::OnMedusaShiftStartBack(wxCommandEvent &event) {
audioBox->audioDisplay->curStartMS -= 10;
audioBox->audioDisplay->Update();
audioBox->audioDisplay->wxWindow::Update();
audioBox->audioDisplay->UpdateTimeEditCtrls();
}
void FrameMain::OnMedusaShiftEndForward(wxCommandEvent &event) {
audioBox->audioDisplay->curEndMS += 10;
audioBox->audioDisplay->Update();
audioBox->audioDisplay->wxWindow::Update();
audioBox->audioDisplay->UpdateTimeEditCtrls();
}
void FrameMain::OnMedusaShiftEndBack(wxCommandEvent &event) {
audioBox->audioDisplay->curEndMS -= 10;
audioBox->audioDisplay->Update();
audioBox->audioDisplay->wxWindow::Update();
audioBox->audioDisplay->UpdateTimeEditCtrls();
}
void FrameMain::OnMedusaPlayBefore(wxCommandEvent &event) {
int start=0,end=0;
@ -1675,3 +1690,12 @@ void FrameMain::OnMedusaPlayAfter(wxCommandEvent &event) {
audioBox->audioDisplay->GetTimesSelection(start,end);
audioBox->audioDisplay->Play(end,end+500);
}
void FrameMain::OnMedusaNext(wxCommandEvent &event) {
audioBox->audioDisplay->Next(false);
}
void FrameMain::OnMedusaPrev(wxCommandEvent &event) {
audioBox->audioDisplay->Prev(false);
}
void FrameMain::OnMedusaEnter(wxCommandEvent &event) {
audioBox->audioDisplay->CommitChanges(true);
}

View File

@ -190,6 +190,7 @@ void HotkeyType::FillMap() {
keyName[WXK_NUMPAD_MULTIPLY] = _T("KP_Multiply");
keyName[WXK_NUMPAD_DIVIDE] = _T("KP_Divide");
keyName[WXK_NUMPAD_DECIMAL] = _T("KP_Decimal");
keyName[WXK_NUMPAD_ENTER] = _T("KP_Enter");
keyName[WXK_F1] = _T("F1");
keyName[WXK_F2] = _T("F2");
@ -396,6 +397,7 @@ void HotkeyManager::LoadDefaults() {
SetHotkey(_("Audio Medusa Play After"),_T("KP_3"));
SetHotkey(_("Audio Medusa Next"),_T("KP_2"));
SetHotkey(_("Audio Medusa Previous"),_T("KP_0"));
SetHotkey(_("Audio Medusa Enter"),_T("KP_Enter"));
SetHotkey(_("Translation Assistant Play"),_T("End"));
SetHotkey(_("Translation Assistant Next"),_T("PgDn"));