Change audio autoscroll behaviour:

* In karaoke mode, instead of scrolling start to end of active line into view, scroll start of selection to end of line into view. This gives sensible results when horizontal zoom is great enough that the entire line isn't visible at once and the syllable is too far from the start of the line. This fixes #677.
* If the line is too long to fit in the display, always left-align it instead of sometimes left-aligning and sometimes centering. (I think the old behaviour depended on the actual scroll position.)

Originally committed to SVN as r2928.
This commit is contained in:
Niels Martin Hansen 2009-05-14 22:12:05 +00:00
parent b19d604de4
commit 33696616f4

View file

@ -725,20 +725,22 @@ void AudioDisplay::RecreateImage() {
void AudioDisplay::MakeDialogueVisible(bool force) { void AudioDisplay::MakeDialogueVisible(bool force) {
wxLogDebug(_T("AudioDisplay::MakeDialogueVisible(force=%d)"), force?1:0); wxLogDebug(_T("AudioDisplay::MakeDialogueVisible(force=%d)"), force?1:0);
// Variables // Variables
int temp1=0,temp2=0; int startShow=0, endShow=0;
if (karaoke->enabled) { if (karaoke->enabled) {
// In karaoke mode the entire dialogue line should be visible instead of just the selected syllable // In karaoke mode the syllable and as much as possible towards the end of the line should be shown
GetTimesDialogue(temp1, temp2); int dummy = 0;
GetTimesSelection(startShow, dummy);
GetTimesDialogue(dummy, endShow);
} else { } else {
GetTimesSelection(temp1,temp2); GetTimesSelection(startShow,endShow);
} }
int startPos = GetSampleAtMS(temp1); int startPos = GetSampleAtMS(startShow);
int endPos = GetSampleAtMS(temp2); int endPos = GetSampleAtMS(endShow);
int startX = GetXAtMS(temp1); int startX = GetXAtMS(startShow);
int endX = GetXAtMS(temp2); int endX = GetXAtMS(endShow);
if (force || startX < 50 || endX > w-50) { if (force || startX < 50 || endX > w-50) {
if (startX < 50) { if (startX < 50 || endX - startX >= w) {
// Make sure the left edge of the selection is at least 50 pixels from the edge of the display // Make sure the left edge of the selection is at least 50 pixels from the edge of the display
UpdatePosition(startPos - 50*samples, true); UpdatePosition(startPos - 50*samples, true);
} else { } else {