From 6f6f53f1b26521ec7279e6fc64ef26300e8c97a1 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Tue, 10 Apr 2007 00:51:03 +0000 Subject: [PATCH] Karaoke is now more properly autoscrolled into audio display, per bug #334, it still can use some tweaking though Originally committed to SVN as r1054. --- aegisub/audio_display.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/aegisub/audio_display.cpp b/aegisub/audio_display.cpp index 5399bbac8..a29bae8cc 100644 --- a/aegisub/audio_display.cpp +++ b/aegisub/audio_display.cpp @@ -656,14 +656,25 @@ void AudioDisplay::RecreateImage() { void AudioDisplay::MakeDialogueVisible(bool force) { // Variables int temp1=0,temp2=0; - GetTimesSelection(temp1,temp2); + if (karaoke->enabled) { + // In karaoke mode the entire dialogue line should be visible instead of just the selected syllable + GetTimesDialogue(temp1, temp2); + } else { + GetTimesSelection(temp1,temp2); + } int startPos = GetSampleAtMS(temp1); int endPos = GetSampleAtMS(temp2); int startX = GetXAtMS(temp1); int endX = GetXAtMS(temp2); if (force || startX < 50 || endX > w-50) { - UpdatePosition((startPos+endPos-w*samples)/2,true); + if (startX < 50) { + // 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 { + // Otherwise center the selection in display + UpdatePosition((startPos+endPos-w*samples)/2,true); + } } // Update