diff --git a/displayreplay.c b/displayreplay.c index 88d6802..f82f1cc 100644 --- a/displayreplay.c +++ b/displayreplay.c @@ -1,4 +1,5 @@ #define __STL_CONFIG_H +#include #include "displayreplay.h" cSDDisplayReplay::cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly) { @@ -41,7 +42,14 @@ void cSDDisplayReplay::SetMode(bool Play, bool Forward, int Speed) { if (!doOutput) return; if (!Play && Speed < 0) { - replayView->DrawOnPause(modeOnly); + string recFileName = ""; + cControl *control = cControl::Control(); + if (control) { + const cRecording *recording = control->GetRecording(); + if (recording && recording->FileName()) + recFileName = recording->FileName(); + } + replayView->DrawOnPause(recFileName, modeOnly); } else { replayView->ClearOnPause(); } diff --git a/views/displayreplayonpauseview.c b/views/displayreplayonpauseview.c index 27aaa50..557a574 100644 --- a/views/displayreplayonpauseview.c +++ b/views/displayreplayonpauseview.c @@ -1,8 +1,8 @@ #define __STL_CONFIG_H -#include #include "displayreplayonpauseview.h" -cDisplayReplayOnPauseView::cDisplayReplayOnPauseView(cTemplateViewElement *tmplViewElement) : cView(tmplViewElement) { +cDisplayReplayOnPauseView::cDisplayReplayOnPauseView(string recFileName, cTemplateViewElement *tmplViewElement) : cView(tmplViewElement) { + this->recFileName = recFileName; tmplViewElement->SetPixOffset(0); delay = tmplViewElement->GetNumericParameter(ptDelay) * 1000; SetFadeTime(tmplViewElement->GetNumericParameter(ptFadeTime)); @@ -18,11 +18,10 @@ void cDisplayReplayOnPauseView::Render(void) { map < string, string > stringTokens; map < string, int > intTokens; map < string, vector< map< string, string > > > loopTokens; - const cRecording *recording = NULL; - cControl *control = cControl::Control(); - if (control) { - recording = control->GetRecording(); - } + if (recFileName.size() == 0) + return; + const cRecording *recording = new cRecording(recFileName.c_str()); + if (recording) { string name = recording->Name() ? recording->Name() : ""; stringTokens.insert(pair("name", name)); @@ -81,6 +80,8 @@ void cDisplayReplayOnPauseView::Render(void) { } SetScraperTokens(NULL, recording, stringTokens, intTokens, loopTokens); DrawViewElement(veOnPause, &stringTokens, &intTokens, &loopTokens); + if (recording) + delete recording; } void cDisplayReplayOnPauseView::Action(void) { diff --git a/views/displayreplayonpauseview.h b/views/displayreplayonpauseview.h index b3498af..09d2044 100644 --- a/views/displayreplayonpauseview.h +++ b/views/displayreplayonpauseview.h @@ -9,9 +9,10 @@ class cDisplayReplayOnPauseView : public cView, public cViewHelpers { private: int delay; bool resetSleep; + string recFileName; virtual void Action(void); public: - cDisplayReplayOnPauseView(cTemplateViewElement *tmplViewElement); + cDisplayReplayOnPauseView(string recFileName, cTemplateViewElement *tmplViewElement); virtual ~cDisplayReplayOnPauseView(); void ResetSleep(void) { resetSleep = true; }; void Render(void); diff --git a/views/displayreplayview.c b/views/displayreplayview.c index cf68bf7..90b49ba 100644 --- a/views/displayreplayview.c +++ b/views/displayreplayview.c @@ -376,12 +376,12 @@ void cDisplayReplayView::DrawMessage(eMessageType type, const char *text) { DrawViewElement(veMessage, &stringTokens, &intTokens); } -void cDisplayReplayView::DrawOnPause(bool modeOnly) { +void cDisplayReplayView::DrawOnPause(string recFileName, bool modeOnly) { eViewElement veTmplOnPause = modeOnly ? veOnPauseModeOnly : veOnPause; cTemplateViewElement *tmplOnPause = tmplView->GetViewElement(veTmplOnPause); if (!tmplOnPause) return; - onPauseView = new cDisplayReplayOnPauseView(tmplOnPause); + onPauseView = new cDisplayReplayOnPauseView(recFileName, tmplOnPause); onPauseView->Start(); } diff --git a/views/displayreplayview.h b/views/displayreplayview.h index d5342c1..77c2eb4 100644 --- a/views/displayreplayview.h +++ b/views/displayreplayview.h @@ -32,7 +32,7 @@ public: void DrawControlIcons(bool play, bool forward, int speed, bool modeOnly); void DrawJump(const char *jump); void DrawMessage(eMessageType type, const char *text); - void DrawOnPause(bool modeOnly); + void DrawOnPause(string recFileName, bool modeOnly); void ClearOnPause(void); void DelayOnPause(void); void DrawCustomTokens(void);