fixed bug that onpause view potentially starts during setting cutting marks

This commit is contained in:
louis 2015-01-22 18:08:12 +01:00
parent 48afaeed63
commit cacde1887c
6 changed files with 29 additions and 2 deletions

View File

@ -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

View File

@ -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;

View File

@ -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();

View File

@ -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(); };
};

View File

@ -379,6 +379,12 @@ void cDisplayReplayView::ClearOnPause(void) {
}
}
void cDisplayReplayView::DelayOnPause(void) {
if (onPauseView) {
onPauseView->ResetSleep();
}
}
void cDisplayReplayView::DrawCustomTokens(void) {
if (!ViewElementImplemented(veCustomTokens)) {
return;

View File

@ -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(); };