diff --git a/HISTORY b/HISTORY index 01f8031..aae3d5c 100644 --- a/HISTORY +++ b/HISTORY @@ -172,3 +172,6 @@ Version 0.1.5 additional skin caching at startup Version 0.1.6 + +- fixed bug that onpause view potentially starts during setting cutting + marks diff --git a/displayreplay.c b/displayreplay.c index 936125b..d89c5e5 100644 --- a/displayreplay.c +++ b/displayreplay.c @@ -16,7 +16,6 @@ cSDDisplayReplay::cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly) { doOutput = false; return; } - replayView->DrawBackground(modeOnly); } cSDDisplayReplay::~cSDDisplayReplay() { @@ -46,6 +45,7 @@ void cSDDisplayReplay::SetMode(bool Play, bool Forward, int Speed) { void cSDDisplayReplay::SetProgress(int Current, int Total) { if (!doOutput) return; + replayView->DelayOnPause(); replayView->DrawProgressBar(Current, Total); replayView->DrawMarks(marks, Current, Total); } @@ -83,6 +83,7 @@ void cSDDisplayReplay::Flush(void) { } if (initial) { + replayView->DrawBackground(modeOnly); replayView->DrawCustomTokens(); replayView->DoFadeIn(); initial = false; diff --git a/views/displayreplayonpauseview.c b/views/displayreplayonpauseview.c index 976d37b..27aaa50 100644 --- a/views/displayreplayonpauseview.c +++ b/views/displayreplayonpauseview.c @@ -6,6 +6,7 @@ cDisplayReplayOnPauseView::cDisplayReplayOnPauseView(cTemplateViewElement *tmplV tmplViewElement->SetPixOffset(0); delay = tmplViewElement->GetNumericParameter(ptDelay) * 1000; SetFadeTime(tmplViewElement->GetNumericParameter(ptFadeTime)); + resetSleep = false; } cDisplayReplayOnPauseView::~cDisplayReplayOnPauseView() { @@ -83,7 +84,20 @@ void cDisplayReplayOnPauseView::Render(void) { } void cDisplayReplayOnPauseView::Action(void) { - DoSleep(delay); + bool doContinue; + int sleepSlice = 10; + do { + doContinue = false; + for (int i = 0; Running() && (i*sleepSlice < delay); i++) { + cCondWait::SleepMs(sleepSlice); + if (resetSleep) { + doContinue = true; + resetSleep = false; + break; + } + } + } while (doContinue); + if (!Running()) return; Render(); diff --git a/views/displayreplayonpauseview.h b/views/displayreplayonpauseview.h index 6c50ce6..b3498af 100644 --- a/views/displayreplayonpauseview.h +++ b/views/displayreplayonpauseview.h @@ -8,10 +8,12 @@ class cDisplayReplayOnPauseView : public cView, public cViewHelpers { private: int delay; + bool resetSleep; virtual void Action(void); public: cDisplayReplayOnPauseView(cTemplateViewElement *tmplViewElement); virtual ~cDisplayReplayOnPauseView(); + void ResetSleep(void) { resetSleep = true; }; void Render(void); void Flush(void) { DoFlush(); }; }; diff --git a/views/displayreplayview.c b/views/displayreplayview.c index 4831161..48ebd75 100644 --- a/views/displayreplayview.c +++ b/views/displayreplayview.c @@ -379,6 +379,12 @@ void cDisplayReplayView::ClearOnPause(void) { } } +void cDisplayReplayView::DelayOnPause(void) { + if (onPauseView) { + onPauseView->ResetSleep(); + } +} + void cDisplayReplayView::DrawCustomTokens(void) { if (!ViewElementImplemented(veCustomTokens)) { return; diff --git a/views/displayreplayview.h b/views/displayreplayview.h index a79e537..6104e2a 100644 --- a/views/displayreplayview.h +++ b/views/displayreplayview.h @@ -33,6 +33,7 @@ public: void DrawMessage(eMessageType type, const char *text); void DrawOnPause(bool modeOnly); void ClearOnPause(void); + void DelayOnPause(void); void DrawCustomTokens(void); void DoFadeIn(void) { Start(); }; void Flush(void) { DoFlush(); };