diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2000-12-09 11:13:00 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2000-12-09 11:13:00 +0100 |
commit | 4cd7c3242513bc23579a376dbd89c4fbdc080614 (patch) | |
tree | 0314d4075370e00d7fda2e8175453980b9cdb205 /menu.c | |
parent | 6b0658a9775aba758b4f6e2e7ef854126ef1e597 (diff) | |
download | vdr-4cd7c3242513bc23579a376dbd89c4fbdc080614.tar.gz vdr-4cd7c3242513bc23579a376dbd89c4fbdc080614.tar.bz2 |
Moved progress display to menu.c
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 45 |
1 files changed, 40 insertions, 5 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.54 2000/12/03 11:43:35 kls Exp $ + * $Id: menu.c 1.55 2000/12/09 11:03:21 kls Exp $ */ #include "menu.h" @@ -2000,10 +2000,10 @@ char *cReplayControl::title = NULL; cReplayControl::cReplayControl(void) { - dvbApi = cDvbApi::PrimaryDvbApi;//XXX + dvbApi = cDvbApi::PrimaryDvbApi; visible = shown = false; if (fileName) - dvbApi->StartReplay(fileName, title); + dvbApi->StartReplay(fileName); } cReplayControl::~cReplayControl() @@ -2038,7 +2038,7 @@ void cReplayControl::Show(void) if (!visible) { Interface->Open(MenuColumns, -3); needsFastResponse = visible = true; - shown = dvbApi->ShowProgress(true); + shown = ShowProgress(true); } } @@ -2050,12 +2050,47 @@ void cReplayControl::Hide(void) } } +bool cReplayControl::ShowProgress(bool Initial) +{ + int Current, Total; + + if (dvbApi->GetIndex(Current, Total)) { + if (Initial) { + Interface->Clear(); + if (title) + Interface->Write(0, 0, title); + } + Interface->Write(-7, 2, IndexToStr(Total)); + Interface->Flush(); +#ifdef DEBUG_OSD + int p = Width() * Current / Total; + Interface->Fill(0, 1, p, 1, clrGreen); + Interface->Fill(p, 1, Width() - p, 1, clrWhite); +#else + int w = Width() * dvbApi->CellWidth(); + int h = dvbApi->LineHeight(); + int p = w * Current / Total; + cBitmap ProgressBar(w, h); + + ProgressBar.Fill(0, 0, p, h - 1, clrGreen); + ProgressBar.Fill(p + 1, 0, w - 1, h - 1, clrWhite); + Interface->SetBitmap(0, dvbApi->LineHeight(), ProgressBar); + + Interface->Flush(); +#endif + Interface->Write(0, 2, IndexToStr(Current)); + Interface->Flush(); + return true; + } + return false; +} + eOSState cReplayControl::ProcessKey(eKeys Key) { if (!dvbApi->Replaying()) return osEnd; if (visible) - shown = dvbApi->ShowProgress(!shown) || shown; + shown = ShowProgress(!shown) || shown; switch (Key) { case kUp: dvbApi->Play(); break; case kDown: dvbApi->Pause(); break; |