diff options
-rw-r--r-- | baserender.c | 2 | ||||
-rw-r--r-- | displayreplay.c | 47 | ||||
-rw-r--r-- | displayreplay.h | 3 | ||||
-rw-r--r-- | flat.h | 2 | ||||
-rw-r--r-- | themes/flat-white.theme | 2 |
5 files changed, 50 insertions, 6 deletions
diff --git a/baserender.c b/baserender.c index 121ee07..75d4ba2 100644 --- a/baserender.c +++ b/baserender.c @@ -83,7 +83,7 @@ void cFlatBaseRender::TopBarUpdate(void) { topBarLastDate = curDate; topBarPixmap->Fill(Theme.Color(clrTopBarBg)); - topBarPixmap->DrawText(cPoint(50, 0), topBarTitle, Theme.Color(clrTopBarFont), clrTransparent, font); + topBarPixmap->DrawText(cPoint(marginItem, 0), topBarTitle, Theme.Color(clrTopBarFont), clrTransparent, font); int width = font->Width(*curDate); topBarPixmap->DrawText(cPoint(osdWidth - width, 0), curDate, Theme.Color(clrTopBarDateTimeFont), clrTransparent, font); } 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) { diff --git a/displayreplay.h b/displayreplay.h index 026005c..b332b56 100644 --- a/displayreplay.h +++ b/displayreplay.h @@ -12,6 +12,9 @@ class cFlatDisplayReplay : public cFlatBaseRender, public cSkinDisplayReplay { cPixmap *labelPixmap; void DrawProgressBar(int Current, int Total); + void DrawProgressBarMarks(int Current, int Total); + void DrawProgressBarMark(int X, bool Start, bool Current); + int DrawProgressBarMarkPos(int P, int Total); void UpdateInfo(void); public: cFlatDisplayReplay(bool ModeOnly); @@ -73,6 +73,8 @@ THEME_CLR(Theme, clrReplayBg, 0x90222222); THEME_CLR(Theme, clrReplayFont, 0xFFEEEEEE); THEME_CLR(Theme, clrReplayProgressFg, 0xFFEEEEEE); THEME_CLR(Theme, clrReplayProgressBg, 0xFFEEEEEE); +THEME_CLR(Theme, clrReplayMarkFg, 0xFF222222); +THEME_CLR(Theme, clrReplayMarkCurrentFg, 0xFF3090B0); // Tracks THEME_CLR(Theme, clrTrackItemBg, 0x90909090); diff --git a/themes/flat-white.theme b/themes/flat-white.theme index c5cc734..79f13bd 100644 --- a/themes/flat-white.theme +++ b/themes/flat-white.theme @@ -39,6 +39,8 @@ clrReplayBg = 90CCCCCC clrReplayFont = FF222222 clrReplayProgressFg = FFFFFFFF clrReplayProgressBg = FFFFFFFF +clrReplayMarkFg = FF222222 +clrReplayMarkCurrentFg = FF3090B0 clrTrackItemBg = 90CCCCCC clrTrackItemFont = FF222222 clrTrackItemCurrentBg = 906AB0C0 |