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 84b068b53a
commit 4e417a6dae

View file

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