forked from mia/Aegisub
Placeholder Edit->Sort menu entry and disabled audio scrubbing again
Originally committed to SVN as r466.
This commit is contained in:
parent
88016e0602
commit
8f077dc4ee
5 changed files with 69 additions and 46 deletions
|
@ -1210,7 +1210,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop scrubbing
|
// Stop scrubbing
|
||||||
bool scrubButton = event.ButtonIsDown(wxMOUSE_BTN_MIDDLE);
|
bool scrubButton = false && event.ButtonIsDown(wxMOUSE_BTN_MIDDLE);
|
||||||
if (scrubbing && !scrubButton) {
|
if (scrubbing && !scrubButton) {
|
||||||
// Release mouse
|
// Release mouse
|
||||||
scrubbing = false;
|
scrubbing = false;
|
||||||
|
@ -1237,24 +1237,34 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
// Set variables
|
// Set variables
|
||||||
scrubLastPos = GetSampleAtX(x);
|
scrubLastPos = GetSampleAtX(x);
|
||||||
scrubTime = clock();
|
scrubTime = clock();
|
||||||
|
scrubLastRate = provider->GetSampleRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scrub
|
// Scrub
|
||||||
if (scrubbing && scrubButton) {
|
if (scrubbing && scrubButton) {
|
||||||
// Get current data
|
// Get current data
|
||||||
__int64 curScrubPos = MAX(0,GetSampleAtX(x));
|
__int64 exactPos = MAX(0,GetSampleAtX(x));
|
||||||
__int64 scrubDelta = curScrubPos - scrubLastPos;
|
|
||||||
int curScrubTime = clock();
|
int curScrubTime = clock();
|
||||||
int scrubDeltaTime = curScrubTime - scrubTime;
|
int scrubDeltaTime = curScrubTime - scrubTime;
|
||||||
|
bool invert = exactPos < scrubLastPos;
|
||||||
|
__int64 curScrubPos = exactPos;
|
||||||
|
|
||||||
|
if (scrubDeltaTime > 0) {
|
||||||
|
// Get derived data
|
||||||
|
int rateChange = provider->GetSampleRate()/20;
|
||||||
|
int curRate = MID(int(scrubLastRate-rateChange),abs(int(exactPos - scrubLastPos)) * CLK_TCK / scrubDeltaTime,int(scrubLastRate+rateChange));
|
||||||
|
if (abs(curRate-scrubLastRate) < rateChange) curRate = scrubLastRate;
|
||||||
|
curScrubPos = scrubLastPos + (curRate * scrubDeltaTime / CLK_TCK * (invert ? -1 : 1));
|
||||||
|
__int64 scrubDelta = curScrubPos - scrubLastPos;
|
||||||
|
scrubLastRate = curRate;
|
||||||
|
|
||||||
// Copy data to buffer
|
// Copy data to buffer
|
||||||
if (scrubDelta != 0 && scrubDeltaTime > 0) {
|
if (scrubDelta != 0) {
|
||||||
// Create buffer
|
// Create buffer
|
||||||
int bufSize = scrubDeltaTime * scrubProvider->GetSampleRate() / CLK_TCK;
|
int bufSize = scrubDeltaTime * scrubProvider->GetSampleRate() / CLK_TCK;
|
||||||
short *buf = new short[bufSize];
|
short *buf = new short[bufSize];
|
||||||
|
|
||||||
// Flag as inverted, if necessary
|
// Flag as inverted, if necessary
|
||||||
bool invert = scrubDelta < 0;
|
|
||||||
if (invert) scrubDelta = -scrubDelta;
|
if (invert) scrubDelta = -scrubDelta;
|
||||||
|
|
||||||
// Copy data from original provider to temp buffer
|
// Copy data from original provider to temp buffer
|
||||||
|
@ -1298,6 +1308,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
if (!player->IsPlaying()) player->Play(0,0xFFFFFFFFFFFF);
|
if (!player->IsPlaying()) player->Play(0,0xFFFFFFFFFFFF);
|
||||||
delete buf;
|
delete buf;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update last pos and time
|
// Update last pos and time
|
||||||
scrubLastPos = curScrubPos;
|
scrubLastPos = curScrubPos;
|
||||||
|
|
|
@ -101,6 +101,7 @@ private:
|
||||||
int scrubTime;
|
int scrubTime;
|
||||||
__int64 scrubLastPos;
|
__int64 scrubLastPos;
|
||||||
bool scrubbing;
|
bool scrubbing;
|
||||||
|
int scrubLastRate;
|
||||||
|
|
||||||
void OnPaint(wxPaintEvent &event);
|
void OnPaint(wxPaintEvent &event);
|
||||||
void OnMouseEvent(wxMouseEvent &event);
|
void OnMouseEvent(wxMouseEvent &event);
|
||||||
|
|
|
@ -238,6 +238,7 @@ void FrameMain::InitMenu() {
|
||||||
editMenu->AppendSeparator();
|
editMenu->AppendSeparator();
|
||||||
editMenu->Append(Menu_Edit_Select, _("&Select lines...\t") + Hotkeys.GetText(_T("Select lines")), _("Selects lines based on defined criterea"));
|
editMenu->Append(Menu_Edit_Select, _("&Select lines...\t") + Hotkeys.GetText(_T("Select lines")), _("Selects lines based on defined criterea"));
|
||||||
editMenu->Append(Menu_Edit_Shift, _("S&hift times...\t") + Hotkeys.GetText(_T("Shift times")), _("Shift subtitles by time or frames"));
|
editMenu->Append(Menu_Edit_Shift, _("S&hift times...\t") + Hotkeys.GetText(_T("Shift times")), _("Shift subtitles by time or frames"));
|
||||||
|
editMenu->Append(Menu_Edit_Sort, _("Sort by Time"), _("Sort all subtitles by their start times"));
|
||||||
editMenu->AppendSeparator();
|
editMenu->AppendSeparator();
|
||||||
AppendBitmapMenuItem (editMenu,Menu_Edit_Find, _("&Find...\t") + Hotkeys.GetText(_T("Find")), _("Find words in subtitles"),wxBITMAP(find_button));
|
AppendBitmapMenuItem (editMenu,Menu_Edit_Find, _("&Find...\t") + Hotkeys.GetText(_T("Find")), _("Find words in subtitles"),wxBITMAP(find_button));
|
||||||
editMenu->Append(Menu_Edit_Find_Next, _("Find next\t") + Hotkeys.GetText(_T("Find Next")), _("Find next match of last word"));
|
editMenu->Append(Menu_Edit_Find_Next, _("Find next\t") + Hotkeys.GetText(_T("Find Next")), _("Find next match of last word"));
|
||||||
|
|
|
@ -182,6 +182,7 @@ private:
|
||||||
void OnReplace (wxCommandEvent &event);
|
void OnReplace (wxCommandEvent &event);
|
||||||
void OnJumpTo (wxCommandEvent &event);
|
void OnJumpTo (wxCommandEvent &event);
|
||||||
void OnShift (wxCommandEvent &event);
|
void OnShift (wxCommandEvent &event);
|
||||||
|
void OnSort (wxCommandEvent &event);
|
||||||
void OnOpenProperties (wxCommandEvent &event);
|
void OnOpenProperties (wxCommandEvent &event);
|
||||||
void OnOpenStylesManager (wxCommandEvent &event);
|
void OnOpenStylesManager (wxCommandEvent &event);
|
||||||
void OnOpenAttachments (wxCommandEvent &event);
|
void OnOpenAttachments (wxCommandEvent &event);
|
||||||
|
@ -300,6 +301,7 @@ enum {
|
||||||
Menu_Edit_Select,
|
Menu_Edit_Select,
|
||||||
Menu_Edit_Undo,
|
Menu_Edit_Undo,
|
||||||
Menu_Edit_Redo,
|
Menu_Edit_Redo,
|
||||||
|
Menu_Edit_Sort,
|
||||||
Menu_Edit_Find,
|
Menu_Edit_Find,
|
||||||
Menu_Edit_Find_Next,
|
Menu_Edit_Find_Next,
|
||||||
Menu_Edit_Replace,
|
Menu_Edit_Replace,
|
||||||
|
|
|
@ -165,6 +165,7 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame)
|
||||||
EVT_MENU(Menu_Edit_Replace, FrameMain::OnReplace)
|
EVT_MENU(Menu_Edit_Replace, FrameMain::OnReplace)
|
||||||
EVT_MENU(Menu_Edit_Shift, FrameMain::OnShift)
|
EVT_MENU(Menu_Edit_Shift, FrameMain::OnShift)
|
||||||
EVT_MENU(Menu_Edit_Select, FrameMain::OnSelect)
|
EVT_MENU(Menu_Edit_Select, FrameMain::OnSelect)
|
||||||
|
EVT_MENU(Menu_Edit_Sort, FrameMain::OnSort)
|
||||||
|
|
||||||
EVT_MENU(Menu_Tools_Properties, FrameMain::OnOpenProperties)
|
EVT_MENU(Menu_Tools_Properties, FrameMain::OnOpenProperties)
|
||||||
EVT_MENU(Menu_Tools_Styles_Manager, FrameMain::OnOpenStylesManager)
|
EVT_MENU(Menu_Tools_Styles_Manager, FrameMain::OnOpenStylesManager)
|
||||||
|
@ -1157,6 +1158,13 @@ void FrameMain::OnSelect (wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////
|
||||||
|
// Sort subtitles
|
||||||
|
void FrameMain::OnSort (wxCommandEvent &event) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// Open styling assistant
|
// Open styling assistant
|
||||||
void FrameMain::OnOpenStylingAssistant (wxCommandEvent &event) {
|
void FrameMain::OnOpenStylingAssistant (wxCommandEvent &event) {
|
||||||
|
|
Loading…
Reference in a new issue