Audio display now follows the play cursor

Originally committed to SVN as r211.
This commit is contained in:
Rodrigo Braz Monteiro 2006-03-05 23:41:00 +00:00
parent 6f0073536e
commit a00a45125e
3 changed files with 33 additions and 9 deletions

View File

@ -1479,19 +1479,42 @@ void AudioDisplay::OnUpdateTimer(wxTimerEvent &event) {
if (curPos > player->GetStartPosition() && curPos < player->GetEndPosition()) {
// Scroll if needed
int posX = GetXAtSample(curPos);
if (posX > w-80) {
UpdatePosition(curPos - samples/2 - 80,true);
bool fullDraw = false;
bool centerLock = Options.AsBool(_T("Audio lock scroll on cursor"));
if (centerLock) {
int goTo = MAX(0,curPos - w*samples/2);
if (goTo >= 0) {
UpdatePosition(goTo,true);
UpdateImage();
Refresh(true);
fullDraw = true;
}
}
else {
if (posX < 80 || posX > w-80) {
int goTo = MAX(0,curPos - 80*samples);
if (goTo >= 0) {
UpdatePosition(goTo,true);
UpdateImage();
fullDraw = true;
}
}
}
// Draw cursor
wxMemoryDC src;
src.SelectObject(*origImage);
dc.Blit(oldCurPos,0,1,h,&src,oldCurPos,0);
dc.SetPen(wxPen(Options.AsColour(_T("Audio Play cursor"))));
curpos = GetXAtSample(curPos);
dc.SetPen(wxPen(Options.AsColour(_T("Audio Play cursor"))));
src.SelectObject(*origImage);
if (fullDraw) {
//dc.Blit(0,0,w,h,&src,0,0);
dc.DrawLine(curpos,0,curpos,h);
//dc.Blit(0,0,curpos-10,h,&src,0,0);
//dc.Blit(curpos+10,0,w-curpos-10,h,&src,curpos+10,0);
}
else {
dc.Blit(oldCurPos,0,1,h,&src,oldCurPos,0);
dc.DrawLine(curpos,0,curpos,h);
}
}
else {
if (curPos > player->GetEndPosition() + 8192) {

View File

@ -63,7 +63,7 @@ Please visit http://aegisub.net to download latest version
- Select lines dialog now has an option on how to deal with comment lines. (Pomyk)
- Last folder for all the file selection dialogs are now remembered in config.dat. (Pomyk)
- Audio current play position cursor will now always be visible. (AMZ)
- Removed video frame/subtitles time sync controls from the grid context menu.
- Removed video frame/subtitles time sync controls from the grid context menu. (AMZ)
= 1.09 beta - 2006.01.16 ===========================

View File

@ -174,6 +174,7 @@ void OptionsManager::LoadDefaults() {
SetInt(_T("Audio Display Height"),100);
SetInt(_T("Timing Default Duration"), 2000);
SetBool(_T("Audio Wheel Default To Zoom"),false);
SetBool(_T("Audio lock scroll on cursor"),false);
SetBool(_T("Audio Spectrum"),false);
SetInt(_T("Audio Spectrum Cutoff"),32);