diff options
| author | Martin Schirrmacher <vdr.skinflat@schirrmacher.eu> | 2013-07-30 16:58:53 +0200 |
|---|---|---|
| committer | Martin Schirrmacher <vdr.skinflat@schirrmacher.eu> | 2013-07-30 16:58:53 +0200 |
| commit | fda74b31336497c3eb6eba85bf25353883f6590a (patch) | |
| tree | ebd1db77e020561223597588bb7edf5ed0f80f0b /displayreplay.c | |
| parent | 3ccaa83310d1a66bfe60db0302356df7ac0cc78b (diff) | |
| download | skin-flat-fda74b31336497c3eb6eba85bf25353883f6590a.tar.gz skin-flat-fda74b31336497c3eb6eba85bf25353883f6590a.tar.bz2 | |
support for replay marks
Diffstat (limited to 'displayreplay.c')
| -rw-r--r-- | displayreplay.c | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/displayreplay.c b/displayreplay.c index 17a2655..fd32454 100644 --- a/displayreplay.c +++ b/displayreplay.c @@ -1,7 +1,7 @@ #include "displayreplay.h" cFlatDisplayReplay::cFlatDisplayReplay(bool ModeOnly) { - progressBarHeight = 10; + progressBarHeight = 20; labelHeight = fontHeight; current = ""; total = ""; @@ -9,8 +9,8 @@ cFlatDisplayReplay::cFlatDisplayReplay(bool ModeOnly) { TopBarCreate(); MessageCreate(); - labelPixmap = osd->CreatePixmap(1, cRect(0, osdHeight - 50 - labelHeight, osdWidth, labelHeight)); - progressBarPixmap = osd->CreatePixmap(1, cRect(0, osdHeight - 50 - labelHeight - progressBarHeight, osdWidth, progressBarHeight)); + labelPixmap = osd->CreatePixmap(1, cRect(0, osdHeight - labelHeight, osdWidth, labelHeight)); + progressBarPixmap = osd->CreatePixmap(1, cRect(0, osdHeight - labelHeight - progressBarHeight - marginItem, osdWidth, progressBarHeight)); labelPixmap->Fill(Theme.Color(clrReplayBg)); progressBarPixmap->Fill(clrTransparent); @@ -90,15 +90,52 @@ void cFlatDisplayReplay::SetMode(bool Play, bool Forward, int Speed) { } void cFlatDisplayReplay::DrawProgressBar(int Current, int Total) { + int top = progressBarHeight / 2 - 3; int barFullWidth = progressBarPixmap->ViewPort().Width(); double percentLeft = ((double)Current) / (double)Total; progressBarPixmap->Fill( clrTransparent ); if (Current > 0) { - progressBarPixmap->DrawRectangle(cRect( 0, 2, barFullWidth, 2), Theme.Color(clrReplayProgressBg)); - progressBarPixmap->DrawRectangle(cRect( 0, 0, (barFullWidth * percentLeft), 6), Theme.Color(clrReplayProgressFg)); + progressBarPixmap->DrawRectangle(cRect( 0, top + 2, barFullWidth, 2), Theme.Color(clrReplayProgressBg)); + progressBarPixmap->DrawRectangle(cRect( 0, top, (barFullWidth * percentLeft), 6), Theme.Color(clrReplayProgressFg)); } + if( Total > 0 ) + DrawProgressBarMarks(Current, Total); +} + +void cFlatDisplayReplay::DrawProgressBarMarks(int Current, int Total) { + if( marks ) { + bool Start = true; + for( const cMark *m = marks->First(); m; m = marks->Next(m) ) { + int p1 = DrawProgressBarMarkPos( m->Position(), Total ); + DrawProgressBarMark(p1, Start, m->Position() == Current); + Start = !Start; + } + } +} + +int cFlatDisplayReplay::DrawProgressBarMarkPos(int P, int Total) { + return P * progressBarPixmap->ViewPort().Width() / Total; +} + +void cFlatDisplayReplay::DrawProgressBarMark(int X, bool Start, bool Current) +{ + if( Start ) + if( Current ) + progressBarPixmap->DrawRectangle(cRect( X-5, 0, 10, 3), Theme.Color(clrReplayMarkCurrentFg)); + else + progressBarPixmap->DrawRectangle(cRect( X-3, 0, 6, 3), Theme.Color(clrReplayMarkFg)); + else + if( Current ) + progressBarPixmap->DrawRectangle(cRect( X-5, progressBarHeight - 3, 10, 3), Theme.Color(clrReplayMarkCurrentFg)); + else + progressBarPixmap->DrawRectangle(cRect( X-3, progressBarHeight - 3, 6, 3), Theme.Color(clrReplayMarkFg)); + + if( Current ) + progressBarPixmap->DrawRectangle(cRect( X-1, 0, 2, progressBarHeight), Theme.Color(clrReplayMarkCurrentFg)); + else + progressBarPixmap->DrawRectangle(cRect( X-1, 0, 2, progressBarHeight), Theme.Color(clrReplayMarkFg)); } void cFlatDisplayReplay::SetProgress(int Current, int Total) { |
