From 217fcb26808f74c9de81b4c653757f75ba13852f Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 17 Mar 2002 18:00:00 +0100 Subject: =?UTF-8?q?Version=201.0.0pre4=20-=20Added=20'Ca'=20code=20201=20f?= =?UTF-8?q?or=20'Cryptoworks,=20GOD-DIGITAL'=20to=20'ca.conf'=20(thanks=20?= =?UTF-8?q?to=20=20=20Bernd=20Schweikert).=20-=20Fixed=20avoiding=20the=20?= =?UTF-8?q?primary=20DVB=20interface=20in=20case=20Setup.PrimaryLimit=20is?= =?UTF-8?q?=200.=20-=20Fixed=20handling=20CICAM=20settings=20if=20the=20fi?= =?UTF-8?q?rst=20one=20of=20a=20DVB=20card=20was=20FTA.=20-=20Fixed=20reac?= =?UTF-8?q?ting=20on=20changes=20in=20CICAM=20settings=20(needed=20to=20re?= =?UTF-8?q?start=20VDR=20before).=20-=20The=20"Blue"=20button=20in=20the?= =?UTF-8?q?=20"Main"=20menu=20now=20works=20as=20"Stop"=20button=20if=20a?= =?UTF-8?q?=20recording=20=20=20is=20currently=20being=20replayed.=20-=20N?= =?UTF-8?q?ew=20command=20line=20option=20'-m'=20to=20mute=20audio=20of=20?= =?UTF-8?q?the=20primary=20DVB=20device=20at=20=20=20startup=20(suggested?= =?UTF-8?q?=20by=20Mirko=20G=FCnther).=20-=20The=20new=20SVDRP=20command?= =?UTF-8?q?=20VOLU=20can=20be=20used=20to=20control=20the=20audio=20volume?= =?UTF-8?q?=20(suggested=20=20=20by=20Mirko=20G=FCnther).=20-=20Fixed=20re?= =?UTF-8?q?setting=20'mute'=20state=20when=20setting=20the=20volume=20to?= =?UTF-8?q?=20a=20non-zero=20value.=20-=20Added=20log=20messages=20when=20?= =?UTF-8?q?deleting=20recordings=20in=20case=20the=20disk=20runs=20full=20?= =?UTF-8?q?while=20=20=20recording.=20-=20Fixed=20closing=20a=20pipe=20(us?= =?UTF-8?q?ed=20for=20replaying=20Dolby=20Digital=20audio),=20which=20=20?= =?UTF-8?q?=20sometimes=20left=20'zombie'=20processes=20behind=20(thanks?= =?UTF-8?q?=20to=20Werner=20Fink=20for=20helping=20=20=20to=20debug=20this?= =?UTF-8?q?=20one).=20-=20Now=20starting=20the=20Dolby=20Digital=20output?= =?UTF-8?q?=20thread=20only=20if=20the=20recording=20actually=20=20=20cont?= =?UTF-8?q?ains=20Dolby=20Digital=20audio=20data=20(thanks=20to=20Werner?= =?UTF-8?q?=20Fink).=20-=20Implemented=20OSD=20for=20Volume=20and=20Mute?= =?UTF-8?q?=20(works=20only=20if=20there=20is=20no=20other=20OSD=20=20=20a?= =?UTF-8?q?ctivity,=20but=20this=20should=20be=20no=20problem=20for=20norm?= =?UTF-8?q?al=20use).=20-=20Changed=20the=20MANUAL=20description=20of=20th?= =?UTF-8?q?e=20"Conditional=20Access"=20setup=20parameters=20=20=20to=20re?= =?UTF-8?q?flect=20the=20actual=20"CICAM=20DVBn=20m"=20notation=20in=20the?= =?UTF-8?q?=20"Setup"=20menu.=20-=20The=20new=20Setup=20parameter=20"Use?= =?UTF-8?q?=20time=20from=20transponder"=20can=20be=20used=20to=20define?= =?UTF-8?q?=20which=20=20=20transponder=20shall=20be=20used=20to=20set=20t?= =?UTF-8?q?he=20system=20time=20(see=20MANUAL=20for=20details).=20=20=20If?= =?UTF-8?q?=20you=20have=20been=20using=20the=20SetSystemTime=20option=20p?= =?UTF-8?q?reviously,=20you=20now=20MUST=20=20=20select=20a=20channel=20th?= =?UTF-8?q?at=20you=20trust=20to=20have=20a=20reliable=20time=20base.=20-?= =?UTF-8?q?=20Grouped=20the=20Setup=20parameters=20into=20several=20sub-me?= =?UTF-8?q?nus,=20so=20that=20each=20group=20of=20=20=20parameters=20fits?= =?UTF-8?q?=20on=20a=20single=20screen=20-=20unless=20the=20height=20of=20?= =?UTF-8?q?the=20OSD=20has=20been=20=20=20set=20to=20a=20small=20value=20(?= =?UTF-8?q?based=20on=20code=20from=20Markus=20Lang).=20-=20Changed=20the?= =?UTF-8?q?=20title=20of=20the=20"Main"=20menu=20to=20"VDR".=20-=20Fixed?= =?UTF-8?q?=20displaying=20a=20system=20message=20while=20the=20replay=20m?= =?UTF-8?q?ode=20is=20being=20shown.=20-=20Physically=20removing=20a=20del?= =?UTF-8?q?eted=20recording=20if=20one=20with=20the=20same=20name=20shall?= =?UTF-8?q?=20be=20=20=20deleted=20again.=20-=20The=20"Left"=20and=20"Righ?= =?UTF-8?q?t"=20keys=20are=20now=20used=20to=20page=20up=20and=20down=20in?= =?UTF-8?q?=20text=20displays=20=20=20(like=20the=20EPG=20descriptions=20o?= =?UTF-8?q?r=20the=20results=20of=20commands=20executed=20from=20the=20=20?= =?UTF-8?q?=20"Commands"=20menu).=20-=20Fixed=20high=20CPU=20usage=20in=20?= =?UTF-8?q?transfer=20mode.=20-=20Replaced=20'killproc'=20with=20'killall'?= =?UTF-8?q?=20in=20'runvdr',=20since=20apparently=20'killproc'=20=20=20is?= =?UTF-8?q?=20not=20available=20by=20default=20on=20some=20Linux=20distrib?= =?UTF-8?q?utions,=20whereas=20'killall'=20is.=20=20=20Please=20check=20if?= =?UTF-8?q?=20your=20system=20provides=20'killall'=20-=20if=20it=20doesn't?= =?UTF-8?q?,=20please=20change=20=20=20this=20back=20in=20'runvdr'=20and?= =?UTF-8?q?=20report=20this=20(thanks=20to=20Achim=20Lange).=20-=20The=20"?= =?UTF-8?q?Commands"=20menu=20now=20automatically=20assigns=20number=20key?= =?UTF-8?q?s=20as=20hotkeys=20to=20the=20=20=20commands.=20If=20you=20have?= =?UTF-8?q?=20preceeded=20your=20commands=20with=20digits=20you=20may=20wa?= =?UTF-8?q?nt=20to=20=20=20remove=20these=20from=20your=20'commands.conf'?= =?UTF-8?q?=20file.=20-=20The=20new=20Setup=20item=20"Restart"=20can=20be?= =?UTF-8?q?=20used=20to=20force=20a=20complete=20restart=20of=20VDR,=20=20?= =?UTF-8?q?=20including=20reloading=20the=20driver.=20Note=20that=20this?= =?UTF-8?q?=20can=20only=20work=20if=20VDR=20and=20the=20=20=20driver=20ar?= =?UTF-8?q?e=20wrapped=20into=20a=20mechanism=20that=20actually=20performs?= =?UTF-8?q?=20this=20action=20if=20VDR=20=20=20exits.=20The=20'runvdr'=20s?= =?UTF-8?q?cript=20can=20be=20used=20for=20this=20purpose.=20-=20Refined?= =?UTF-8?q?=20texts=20of=20the=20"Setup"=20menu.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- menu.c | 532 +++++++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 439 insertions(+), 93 deletions(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index b1e7e49..93f1ff7 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.160 2002/03/03 16:12:29 kls Exp $ + * $Id: menu.c 1.172 2002/03/17 14:23:44 kls Exp $ */ #include "menu.h" @@ -168,6 +168,47 @@ void cMenuEditChanItem::Set(void) SetValue(buf); } +// --- cMenuEditTranItem ----------------------------------------------------- + +class cMenuEditTranItem : public cMenuEditChanItem { +private: + int number; + int transponder; +public: + cMenuEditTranItem(const char *Name, int *Value); + virtual eOSState ProcessKey(eKeys Key); + }; + +cMenuEditTranItem::cMenuEditTranItem(const char *Name, int *Value) +:cMenuEditChanItem(Name, Value) +{ + number = 0; + transponder = *Value; + cChannel *channel = Channels.First(); + while (channel) { + if (!channel->groupSep && ISTRANSPONDER(channel->frequency, *Value)) { + number = channel->number; + break; + } + channel = (cChannel *)channel->Next(); + } + *Value = number; + Set(); + *Value = transponder; +} + +eOSState cMenuEditTranItem::ProcessKey(eKeys Key) +{ + *value = number; + eOSState state = cMenuEditChanItem::ProcessKey(Key); + number = *value; + cChannel *channel = Channels.GetByNumber(*value); + if (channel) + transponder = channel->frequency; + *value = transponder; + return state; +} + // --- cMenuEditDayItem ------------------------------------------------------ class cMenuEditDayItem : public cMenuEditIntItem { @@ -892,8 +933,8 @@ public: virtual void Display(int Offset = -1, eDvbColor FgColor = clrWhite, eDvbColor BgColor = clrBackground); bool CanScrollUp(void) { return offset > 0; } bool CanScrollDown(void) { return h + offset < lines; } - void ScrollUp(void); - void ScrollDown(void); + void ScrollUp(bool Page); + void ScrollDown(bool Page); virtual eOSState ProcessKey(eKeys Key); }; @@ -952,20 +993,20 @@ void cMenuTextItem::Display(int Offset, eDvbColor FgColor, eDvbColor BgColor) if (CanScrollDown()) Interface->Write(x + w - 1, y + h - 1, "v", bgColor, fgColor); } -void cMenuTextItem::ScrollUp(void) +void cMenuTextItem::ScrollUp(bool Page) { if (CanScrollUp()) { Clear(); - offset--; + offset = max(offset - (Page ? h : 1), 0); Display(); } } -void cMenuTextItem::ScrollDown(void) +void cMenuTextItem::ScrollDown(bool Page) { if (CanScrollDown()) { Clear(); - offset++; + offset = min(offset + (Page ? h : 1), lines - h); Display(); } } @@ -973,10 +1014,14 @@ void cMenuTextItem::ScrollDown(void) eOSState cMenuTextItem::ProcessKey(eKeys Key) { switch (Key) { + case kLeft|k_Repeat: + case kLeft: case kUp|k_Repeat: - case kUp: ScrollUp(); break; + case kUp: ScrollUp(NORMALKEY(Key) == kLeft); break; + case kRight|k_Repeat: + case kRight: case kDown|k_Repeat: - case kDown: ScrollDown(); break; + case kDown: ScrollDown(NORMALKEY(Key) == kRight); break; default: return osUnknown; } return osContinue; @@ -1394,7 +1439,7 @@ cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentCha currentChannel = CurrentChannelNr; delete pArray; - SetHelp(tr("Record"), Now ? tr("Next") : tr("Now"), tr("Schedule"), tr("Switch")); + SetHelp(tr("Record"), Now ? tr("Next") : tr("Now"), tr("Button$Schedule"), tr("Switch")); } const cEventInfo *cMenuWhatsOn::ScheduleEventInfo(void) @@ -1876,84 +1921,45 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key) return state; } -// --- cMenuSetup ------------------------------------------------------------ +// --- cMenuSetupPage -------------------------------------------------------- -class cMenuSetup : public cOsdMenu { -private: +class cMenuSetupPage : public cOsdMenu { +protected: cSetup data; int osdLanguage; - void Set(void); + void SetupTitle(const char *s); + virtual void Set(void) = 0; public: - cMenuSetup(void); + cMenuSetupPage(void); virtual eOSState ProcessKey(eKeys Key); }; -cMenuSetup::cMenuSetup(void) -:cOsdMenu("", 25) +cMenuSetupPage::cMenuSetupPage(void) +:cOsdMenu("", 30) { data = Setup; osdLanguage = Setup.OSDLanguage; - Set(); } -void cMenuSetup::Set(void) +void cMenuSetupPage::SetupTitle(const char *s) { - Clear(); - SetTitle(tr("Setup")); - Add(new cMenuEditStraItem(tr("OSD-Language"), &data.OSDLanguage, NumLanguages, Languages())); - Add(new cMenuEditIntItem( tr("PrimaryDVB"), &data.PrimaryDVB, 1, cDvbApi::NumDvbApis)); - Add(new cMenuEditBoolItem(tr("ShowInfoOnChSwitch"), &data.ShowInfoOnChSwitch)); - Add(new cMenuEditBoolItem(tr("MenuScrollPage"), &data.MenuScrollPage)); - Add(new cMenuEditBoolItem(tr("MarkInstantRecord"), &data.MarkInstantRecord)); - Add(new cMenuEditStrItem( tr("NameInstantRecord"), data.NameInstantRecord, sizeof(data.NameInstantRecord), FileNameChars)); - Add(new cMenuEditIntItem( tr("LnbSLOF"), &data.LnbSLOF)); - Add(new cMenuEditIntItem( tr("LnbFrequLo"), &data.LnbFrequLo)); - Add(new cMenuEditIntItem( tr("LnbFrequHi"), &data.LnbFrequHi)); - Add(new cMenuEditBoolItem(tr("DiSEqC"), &data.DiSEqC)); - Add(new cMenuEditBoolItem(tr("SetSystemTime"), &data.SetSystemTime)); - Add(new cMenuEditIntItem( tr("MarginStart"), &data.MarginStart)); - Add(new cMenuEditIntItem( tr("MarginStop"), &data.MarginStop)); - Add(new cMenuEditIntItem( tr("EPGScanTimeout"), &data.EPGScanTimeout)); - Add(new cMenuEditIntItem( tr("EPGBugfixLevel"), &data.EPGBugfixLevel, 0, MAXEPGBUGFIXLEVEL)); - Add(new cMenuEditIntItem( tr("SVDRPTimeout"), &data.SVDRPTimeout)); - Add(new cMenuEditBoolItem(tr("SortTimers"), &data.SortTimers)); - Add(new cMenuEditIntItem( tr("PrimaryLimit"), &data.PrimaryLimit, 0, MAXPRIORITY)); - Add(new cMenuEditIntItem( tr("DefaultPriority"), &data.DefaultPriority, 0, MAXPRIORITY)); - Add(new cMenuEditIntItem( tr("DefaultLifetime"), &data.DefaultLifetime, 0, MAXLIFETIME)); - Add(new cMenuEditBoolItem(tr("UseSubtitle"), &data.UseSubtitle)); - Add(new cMenuEditBoolItem(tr("RecordingDirs"), &data.RecordingDirs)); - Add(new cMenuEditBoolItem(tr("VideoFormat"), &data.VideoFormat, "4:3", "16:9")); - Add(new cMenuEditBoolItem(tr("RecordDolbyDigital"), &data.RecordDolbyDigital)); - Add(new cMenuEditBoolItem(tr("ChannelInfoPos"), &data.ChannelInfoPos, tr("bottom"), tr("top"))); - Add(new cMenuEditIntItem( tr("OSDwidth"), &data.OSDwidth, MINOSDWIDTH, MAXOSDWIDTH)); - Add(new cMenuEditIntItem( tr("OSDheight"), &data.OSDheight, MINOSDHEIGHT, MAXOSDHEIGHT)); - Add(new cMenuEditIntItem( tr("OSDMessageTime"), &data.OSDMessageTime, 1, 60)); - Add(new cMenuEditIntItem( tr("MaxVideoFileSize"), &data.MaxVideoFileSize, MINVIDEOFILESIZE, MAXVIDEOFILESIZE)); - Add(new cMenuEditBoolItem(tr("SplitEditedFiles"), &data.SplitEditedFiles)); - Add(new cMenuEditIntItem( tr("MinEventTimeout"), &data.MinEventTimeout)); - Add(new cMenuEditIntItem( tr("MinUserInactivity"), &data.MinUserInactivity)); - Add(new cMenuEditBoolItem(tr("MultiSpeedMode"), &data.MultiSpeedMode)); - Add(new cMenuEditBoolItem(tr("ShowReplayMode"), &data.ShowReplayMode)); - for (int d = 0; d < cDvbApi::NumDvbApis; d++) { - for (int i = 0; i < 2; i++) { - char buffer[32]; - snprintf(buffer, sizeof(buffer), "%s%d %d", tr("CICAM DVB"), d + 1, i + 1); - Add(new cMenuEditCaItem(buffer, &data.CaCaps[d][i])); - } - } + char buf[40]; // can't call tr() for more than one string at a time! + char *q = buf + snprintf(buf, sizeof(buf), "%s - ", tr("Setup")); + snprintf(q, sizeof(buf) - strlen(buf), "%s", tr(s)); + SetTitle(buf); } -eOSState cMenuSetup::ProcessKey(eKeys Key) +eOSState cMenuSetupPage::ProcessKey(eKeys Key) { eOSState state = cOsdMenu::ProcessKey(Key); if (state == osUnknown) { switch (Key) { - case kOk: state = (Setup.PrimaryDVB != data.PrimaryDVB) ? osSwitchDvb : osEnd; - cDvbApi::PrimaryDvbApi->SetUseTSTime(data.SetSystemTime); + case kOk: state = (Setup.PrimaryDVB != data.PrimaryDVB) ? osSwitchDvb : osBack; cDvbApi::PrimaryDvbApi->SetVideoFormat(data.VideoFormat ? VIDEO_FORMAT_16_9 : VIDEO_FORMAT_4_3); Setup = data; Setup.Save(); + cDvbApi::SetCaCaps(); break; default: break; } @@ -1969,6 +1975,235 @@ eOSState cMenuSetup::ProcessKey(eKeys Key) return state; } +// --- cMenuSetupOSD --------------------------------------------------------- + +class cMenuSetupOSD : public cMenuSetupPage { +private: + virtual void Set(void); +public: + cMenuSetupOSD(void) { Set(); } + }; + +void cMenuSetupOSD::Set(void) +{ + Clear(); + SetupTitle("OSD"); + Add(new cMenuEditStraItem(tr("Setup.OSD$Language"), &data.OSDLanguage, NumLanguages, Languages())); + Add(new cMenuEditIntItem( tr("Setup.OSD$Width"), &data.OSDwidth, MINOSDWIDTH, MAXOSDWIDTH)); + Add(new cMenuEditIntItem( tr("Setup.OSD$Height"), &data.OSDheight, MINOSDHEIGHT, MAXOSDHEIGHT)); + Add(new cMenuEditIntItem( tr("Setup.OSD$Message time"), &data.OSDMessageTime, 1, 60)); + Add(new cMenuEditBoolItem(tr("Setup.OSD$Channel info position"), &data.ChannelInfoPos, tr("bottom"), tr("top"))); + Add(new cMenuEditBoolItem(tr("Setup.OSD$Info on channel switch"), &data.ShowInfoOnChSwitch)); + Add(new cMenuEditBoolItem(tr("Setup.OSD$Scroll pages"), &data.MenuScrollPage)); + Add(new cMenuEditBoolItem(tr("Setup.OSD$Sort timers"), &data.SortTimers)); + Add(new cMenuEditBoolItem(tr("Setup.OSD$Recording directories"), &data.RecordingDirs)); +} + +// --- cMenuSetupEPG --------------------------------------------------------- + +class cMenuSetupEPG : public cMenuSetupPage { +private: + virtual void Set(void); +public: + cMenuSetupEPG(void) { Set(); } + }; + +void cMenuSetupEPG::Set(void) +{ + Clear(); + SetupTitle("EPG"); + Add(new cMenuEditIntItem( tr("Setup.EPG$EPG scan timeout"), &data.EPGScanTimeout)); + Add(new cMenuEditIntItem( tr("Setup.EPG$EPG bugfix level"), &data.EPGBugfixLevel, 0, MAXEPGBUGFIXLEVEL)); + Add(new cMenuEditBoolItem(tr("Setup.EPG$Set system time"), &data.SetSystemTime)); + Add(new cMenuEditTranItem(tr("Setup.EPG$Use time from transponder"), &data.TimeTransponder)); +} + +// --- cMenuSetupDVB --------------------------------------------------------- + +class cMenuSetupDVB : public cMenuSetupPage { +private: + virtual void Set(void); +public: + cMenuSetupDVB(void) { Set(); } + }; + +void cMenuSetupDVB::Set(void) +{ + Clear(); + SetupTitle("DVB"); + Add(new cMenuEditIntItem( tr("Setup.DVB$Primary DVB interface"), &data.PrimaryDVB, 1, cDvbApi::NumDvbApis)); + Add(new cMenuEditBoolItem(tr("Setup.DVB$Video format"), &data.VideoFormat, "4:3", "16:9")); +} + +// --- cMenuSetupLNB --------------------------------------------------------- + +class cMenuSetupLNB : public cMenuSetupPage { +private: + virtual void Set(void); +public: + cMenuSetupLNB(void) { Set(); } + }; + +void cMenuSetupLNB::Set(void) +{ + Clear(); + SetupTitle("LNB"); + Add(new cMenuEditIntItem( tr("Setup.LNB$SLOF"), &data.LnbSLOF)); + Add(new cMenuEditIntItem( tr("Setup.LNB$Low LNB frequency"), &data.LnbFrequLo)); + Add(new cMenuEditIntItem( tr("Setup.LNB$High LNB frequency"), &data.LnbFrequHi)); + Add(new cMenuEditBoolItem(tr("Setup.LNB$Use DiSEqC"), &data.DiSEqC)); +} + +// --- cMenuSetupCICAM ------------------------------------------------------- + +class cMenuSetupCICAM : public cMenuSetupPage { +private: + virtual void Set(void); +public: + cMenuSetupCICAM(void) { Set(); } + }; + +void cMenuSetupCICAM::Set(void) +{ + Clear(); + SetupTitle("CICAM"); + for (int d = 0; d < cDvbApi::NumDvbApis; d++) { + for (int i = 0; i < 2; i++) { + char buffer[32]; + snprintf(buffer, sizeof(buffer), "%s%d %d", tr("Setup.CICAM$CICAM DVB"), d + 1, i + 1); + Add(new cMenuEditCaItem(buffer, &data.CaCaps[d][i])); + } + } +} + +// --- cMenuSetupRecord ------------------------------------------------------ + +class cMenuSetupRecord : public cMenuSetupPage { +private: + virtual void Set(void); +public: + cMenuSetupRecord(void) { Set(); } + }; + +void cMenuSetupRecord::Set(void) +{ + Clear(); + SetupTitle("Recording"); + Add(new cMenuEditIntItem( tr("Setup.Recording$Margin at start"), &data.MarginStart)); + Add(new cMenuEditIntItem( tr("Setup.Recording$Margin at stop"), &data.MarginStop)); + Add(new cMenuEditIntItem( tr("Setup.Recording$Primary limit"), &data.PrimaryLimit, 0, MAXPRIORITY)); + Add(new cMenuEditIntItem( tr("Setup.Recording$Default priority"), &data.DefaultPriority, 0, MAXPRIORITY)); + Add(new cMenuEditIntItem( tr("Setup.Recording$Default lifetime"), &data.DefaultLifetime, 0, MAXLIFETIME)); + Add(new cMenuEditBoolItem(tr("Setup.Recording$Use episode name"), &data.UseSubtitle)); + Add(new cMenuEditBoolItem(tr("Setup.Recording$Mark instant recording"), &data.MarkInstantRecord)); + Add(new cMenuEditStrItem( tr("Setup.Recording$Name instant recording"), data.NameInstantRecord, sizeof(data.NameInstantRecord), FileNameChars)); + Add(new cMenuEditBoolItem(tr("Setup.Recording$Record Dolby Digital"), &data.RecordDolbyDigital)); + Add(new cMenuEditIntItem( tr("Setup.Recording$Max. video file size"), &data.MaxVideoFileSize, MINVIDEOFILESIZE, MAXVIDEOFILESIZE)); + Add(new cMenuEditBoolItem(tr("Setup.Recording$Split edited files"), &data.SplitEditedFiles)); +} + +// --- cMenuSetupReplay ------------------------------------------------------ + +class cMenuSetupReplay : public cMenuSetupPage { +private: + virtual void Set(void); +public: + cMenuSetupReplay(void) { Set(); } + }; + +void cMenuSetupReplay::Set(void) +{ + Clear(); + SetupTitle("Replay"); + Add(new cMenuEditBoolItem(tr("Setup.Replay$Multi speed mode"), &data.MultiSpeedMode)); + Add(new cMenuEditBoolItem(tr("Setup.Replay$Show replay mode"), &data.ShowReplayMode)); +} + +// --- cMenuSetupMisc -------------------------------------------------------- + +class cMenuSetupMisc : public cMenuSetupPage { +private: + virtual void Set(void); +public: + cMenuSetupMisc(void) { Set(); } + }; + +void cMenuSetupMisc::Set(void) +{ + Clear(); + SetupTitle("Miscellaneous"); + Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Min. event timeout"), &data.MinEventTimeout)); + Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Min. user inactivity"), &data.MinUserInactivity)); + Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$SVDRP timeout"), &data.SVDRPTimeout)); +} + +// --- cMenuSetup ------------------------------------------------------------ + +class cMenuSetup : public cOsdMenu { +private: + virtual void Set(void); + eOSState Restart(void); +public: + cMenuSetup(void); + virtual eOSState ProcessKey(eKeys Key); + }; + +cMenuSetup::cMenuSetup(void) +:cOsdMenu("") +{ + Set(); +} + +void cMenuSetup::Set(void) +{ + Clear(); + SetTitle(tr("Setup")); + SetHasHotkeys(); + Add(new cOsdItem(hk(tr("OSD")), osUser1)); + Add(new cOsdItem(hk(tr("EPG")), osUser2)); + Add(new cOsdItem(hk(tr("DVB")), osUser3)); + Add(new cOsdItem(hk(tr("LNB")), osUser4)); + Add(new cOsdItem(hk(tr("CICAM")), osUser5)); + Add(new cOsdItem(hk(tr("Recording")), osUser6)); + Add(new cOsdItem(hk(tr("Replay")), osUser7)); + Add(new cOsdItem(hk(tr("Miscellaneous")), osUser8)); + Add(new cOsdItem(hk(tr("Restart")), osUser9)); +} + +eOSState cMenuSetup::Restart(void) +{ + if (Interface->Confirm(cRecordControls::Active() ? tr("Recording - restart anyway?") : tr("Really restart?"))) { + cThread::EmergencyExit(true); + return osEnd; + } + return osContinue; +} + +eOSState cMenuSetup::ProcessKey(eKeys Key) +{ + int osdLanguage = Setup.OSDLanguage; + eOSState state = cOsdMenu::ProcessKey(Key); + + switch (state) { + case osUser1: return AddSubMenu(new cMenuSetupOSD); + case osUser2: return AddSubMenu(new cMenuSetupEPG); + case osUser3: return AddSubMenu(new cMenuSetupDVB); + case osUser4: return AddSubMenu(new cMenuSetupLNB); + case osUser5: return AddSubMenu(new cMenuSetupCICAM); + case osUser6: return AddSubMenu(new cMenuSetupRecord); + case osUser7: return AddSubMenu(new cMenuSetupReplay); + case osUser8: return AddSubMenu(new cMenuSetupMisc); + case osUser9: return Restart(); + default: ; + } + if (Setup.OSDLanguage != osdLanguage) { + Set(); + if (!HasSubMenu()) + Display(); + } + return state; +} + // --- cMenuCommands --------------------------------------------------------- class cMenuCommands : public cOsdMenu { @@ -1982,14 +2217,14 @@ public: cMenuCommands::cMenuCommands(void) :cOsdMenu(tr("Commands")) { + SetHasHotkeys(); int i = 0; cCommand *command; while ((command = Commands.Get(i)) != NULL) { - Add(new cOsdItem(command->Title())); + Add(new cOsdItem(hk(command->Title()))); i++; } - SetHasHotkeys(); } eOSState cMenuCommands::Execute(void) @@ -2022,9 +2257,24 @@ eOSState cMenuCommands::ProcessKey(eKeys Key) #define ON_PRIMARY_INTERFACE tr("on primary interface") cMenuMain::cMenuMain(bool Replaying, eOSState State) -:cOsdMenu(tr("Main")) +:cOsdMenu("") { - digit = 0; + replaying = Replaying; + Set(); + + // Initial submenus: + + switch (State) { + case osRecordings: AddSubMenu(new cMenuRecordings(NULL, 0, true)); break; + default: break; + } +} + +void cMenuMain::Set(void) +{ + Clear(); + //SetTitle("VDR"); // this is done below, including disk usage + SetHasHotkeys(); // Title with disk usage: @@ -2036,7 +2286,7 @@ cMenuMain::cMenuMain(bool Replaying, eOSState State) int Minutes = int(double(FreeMB) / MB_PER_MINUTE); int Hours = Minutes / 60; Minutes %= 60; - snprintf(buffer, sizeof(buffer), "%s - Disk %d%% - %2d:%02d %s", tr("Main"), Percent, Hours, Minutes, tr("free")); + snprintf(buffer, sizeof(buffer), "%s - Disk %d%% - %2d:%02d %s", tr("VDR"), Percent, Hours, Minutes, tr("free")); SetTitle(buffer); // Basic menu items: @@ -2051,7 +2301,7 @@ cMenuMain::cMenuMain(bool Replaying, eOSState State) // Replay control: - if (Replaying) + if (replaying) Add(new cOsdItem(tr(" Stop replaying"), osStopReplay)); // Record control: @@ -2077,32 +2327,14 @@ cMenuMain::cMenuMain(bool Replaying, eOSState State) // Color buttons: - SetHelp(tr("Record"), cDvbApi::PrimaryDvbApi->CanToggleAudioTrack() ? tr("Language") : NULL, NULL, cReplayControl::LastReplayed() ? tr("Resume") : NULL); + SetHelp(tr("Record"), cDvbApi::PrimaryDvbApi->CanToggleAudioTrack() ? tr("Language") : NULL, NULL, replaying ? tr("Button$Stop") : cReplayControl::LastReplayed() ? tr("Resume") : NULL); Display(); lastActivity = time(NULL); - SetHasHotkeys(); - - // Initial submenus: - - switch (State) { - case osRecordings: AddSubMenu(new cMenuRecordings(NULL, 0, true)); break; - default: break; - } -} - -const char *cMenuMain::hk(const char *s) -{ - static char buffer[32]; - if (digit < 9) { - snprintf(buffer, sizeof(buffer), " %d %s", ++digit, s); - return buffer; - } - else - return s; } eOSState cMenuMain::ProcessKey(eKeys Key) { + int osdLanguage = Setup.OSDLanguage; eOSState state = cOsdMenu::ProcessKey(Key); switch (state) { @@ -2143,13 +2375,19 @@ eOSState cMenuMain::ProcessKey(eKeys Key) } break; case kBlue: if (!HasSubMenu()) - state = osReplay; + state = replaying ? osStopReplay : osReplay; break; default: break; } } - if (Key != kNone) + if (Key != kNone) { lastActivity = time(NULL); + if (Setup.OSDLanguage != osdLanguage) { + Set(); + if (!HasSubMenu()) + Display(); + } + } else if (time(NULL) - lastActivity > MENUTIMEOUT) state = osEnd; return state; @@ -2345,6 +2583,109 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) return osEnd; } +// --- cVolumeBar ------------------------------------------------------------ + +class cVolumeBar : public cBitmap { +public: + cVolumeBar(int Width, int Height, int Current, int Total, const char *Prompt = NULL); + }; + +cVolumeBar::cVolumeBar(int Width, int Height, int Current, int Total, const char *Prompt) +:cBitmap(Width, Height, 2) +{ + int l = Prompt ? cBitmap::Width(Prompt) : 0; + int p = (Width - l) * Current / Total; + Text(0, 0, Prompt, clrGreen); + Fill(l, 0, p, Height - 1, clrGreen); + Fill(l + p, 0, Width - 1, Height - 1, clrWhite); +} + +// --- cDisplayVolume -------------------------------------------------------- + +#define VOLUMETIMEOUT 1000 //ms +#define MUTETIMEOUT 5000 //ms + +cDisplayVolume *cDisplayVolume::displayVolume = NULL; + +cDisplayVolume::cDisplayVolume(void) +:cOsdBase(true) +{ + displayVolume = this; + timeout = time_ms() + (cDvbApi::PrimaryDvbApi->IsMute() ? MUTETIMEOUT : VOLUMETIMEOUT); + Interface->Open(Setup.OSDwidth, -1); + Show(); +} + +cDisplayVolume::~cDisplayVolume() +{ + Interface->Close(); + displayVolume = NULL; +} + +void cDisplayVolume::Show(void) +{ + cDvbApi *dvbApi = cDvbApi::PrimaryDvbApi; + if (dvbApi->IsMute()) { + Interface->Fill(0, 0, Width(), 1, clrTransparent); + Interface->Write(0, 0, tr("Mute"), clrGreen); + } + else { + int Current = cDvbApi::CurrentVolume(); + int Total = MAXVOLUME; + const char *Prompt = tr("Volume "); +#ifdef DEBUG_OSD + int l = strlen(Prompt); + int p = int(double(Width() - l) * Current / Total + 0.5); + Interface->Write(0, 0, Prompt, clrGreen); + Interface->Fill(l, 0, p, 1, clrGreen); + Interface->Fill(l + p, 0, Width() - l - p, 1, clrWhite); +#else + cVolumeBar VolumeBar(Width() * dvbApi->CellWidth(), dvbApi->LineHeight(), Current, Total, Prompt); + Interface->SetBitmap(0, 0, VolumeBar); +#endif + } +} + +cDisplayVolume *cDisplayVolume::Create(void) +{ + if (!displayVolume) + new cDisplayVolume; + return displayVolume; +} + +void cDisplayVolume::Process(eKeys Key) +{ + if (displayVolume) + displayVolume->ProcessKey(Key); +} + +eOSState cDisplayVolume::ProcessKey(eKeys Key) +{ + switch (Key) { + case kVolUp|k_Repeat: + case kVolUp: + case kVolDn|k_Repeat: + case kVolDn: + Show(); + timeout = time_ms() + VOLUMETIMEOUT; + break; + case kMute: + if (cDvbApi::PrimaryDvbApi->IsMute()) { + Show(); + timeout = time_ms() + MUTETIMEOUT; + } + else + timeout = 0; + break; + case kNone: break; + default: if ((Key & k_Release) == 0) { + Interface->PutKey(Key); + return osEnd; + } + } + return time_ms() < timeout ? osContinue : osEnd; +} + // --- cRecordControl -------------------------------------------------------- cRecordControl::cRecordControl(cDvbApi *DvbApi, cTimer *Timer) @@ -2666,6 +3007,8 @@ void cReplayControl::DisplayAtBottom(const char *s) if (s) { int w = dvbApi->WidthInCells(s); int d = max(Width() - w, 0) / 2; + if (modeOnly) //XXX remove when displaying replay mode differently + Interface->Fill(0, -1, Interface->Width(), 1, clrTransparent); //XXX remove when displaying replay mode differently Interface->Write(d, -1, s); Interface->Flush(); } @@ -2685,8 +3028,11 @@ void cReplayControl::ShowMode(void) if (NormalPlay) return; // no need to do indicate ">" unless there was a different mode displayed before // open small display + /*XXX change when displaying replay mode differently Interface->Open(9, -1); Interface->Clear(); + XXX*/ + Interface->Open(0, -1); //XXX remove when displaying replay mode differently visible = modeOnly = true; } -- cgit v1.2.3