diff options
author | Jochen Dolze <vdr@dolze.de> | 2010-11-18 00:51:37 +0100 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2010-11-18 00:51:37 +0100 |
commit | 5c7d5f31254b3fa2e4e54f95d4f8e1d19eabf443 (patch) | |
tree | f2d4dd8e5508229c5bd899f4e8b8f1169807543a | |
parent | 601a2e4fc98768909341a6fef1ff8799a0f15c66 (diff) | |
download | vdr-plugin-tvonscreen-5c7d5f31254b3fa2e4e54f95d4f8e1d19eabf443.tar.gz vdr-plugin-tvonscreen-5c7d5f31254b3fa2e4e54f95d4f8e1d19eabf443.tar.bz2 |
Added MAINMENUHOOKS patch v1.1
Added option only minutes, which hides the hour display on schedules
Timers are shown as red items
Running broadcasts are shown in cyan
-rw-r--r-- | config.cpp | 22 | ||||
-rw-r--r-- | config.h | 9 | ||||
-rw-r--r-- | magazine.cpp | 221 | ||||
-rw-r--r-- | po/de_DE.po | 15 | ||||
-rw-r--r-- | po/it_IT.po | 14 | ||||
-rw-r--r-- | tvonscreen.cpp | 39 |
6 files changed, 219 insertions, 101 deletions
@@ -28,6 +28,10 @@ tvonscreenConfig::tvonscreenConfig(void) showsearchinitiator=true; fontdsize=0; transparency=100; +#if MAINMENUHOOKSVERSNUM == 10001 + replaceorgschedule=false; +#endif + onlyminutes=false; memset(logos,0,sizeof(logos)); memset(vdradminfile,0,sizeof(vdradminfile)); @@ -46,6 +50,10 @@ bool tvonscreenConfig::SetupParse(const char *Name, const char *Value) else if (strcmp(Name,"showsearchinitiator")==0) showsearchinitiator = atoi(Value); else if (strcmp(Name,"fontdsize")==0) fontdsize = atoi(Value); else if (strcmp(Name,"transparency")==0) transparency = atoi(Value); + else if (strcmp(Name,"onlyminutes")==0) onlyminutes = atoi(Value); +#if MAINMENUHOOKSVERSNUM == 10001 + else if (strcmp(Name,"replaceorgschedule")==0) replaceorgschedule = atoi(Value); +#endif else return false; @@ -100,6 +108,13 @@ tvonscreenConfigPage::tvonscreenConfigPage(void) : cMenuSetupPage() &m_NewConfig.fontdsize,-5,5)); Add(new cMenuEditIntItem(tr("transparency"), &m_NewConfig.transparency,0,100)); +#if MAINMENUHOOKSVERSNUM == 10001 + Add(new cMenuEditBoolItem(tr("replace original schedule"), + &m_NewConfig.replaceorgschedule)); +#endif + Add(new cMenuEditBoolItem(tr("show only minutes"), + &m_NewConfig.onlyminutes)); + Add(new cMenuEditBoolItem(tr("show channel logos"), &m_NewConfig.showLogos)); Add(new cMenuEditBoolItem(tr("show channel names"), @@ -116,7 +131,7 @@ tvonscreenConfigPage::tvonscreenConfigPage(void) : cMenuSetupPage() &m_NewConfig.usertime3)); Add(new cMenuEditBoolItem(tr("jump to next day point if ago"), &m_NewConfig.thenshownextday)); - Add(new cMenuEditBoolItem(tr("Show search item itself"), + Add(new cMenuEditBoolItem(tr("show search item itself"), &m_NewConfig.showsearchinitiator)); } @@ -137,6 +152,9 @@ void tvonscreenConfigPage::Store(void) SetupStore("showsearchinitiator", m_NewConfig.showsearchinitiator); SetupStore("fontdsize", m_NewConfig.fontdsize); SetupStore("transparency", m_NewConfig.transparency); - + SetupStore("onlyminutes", m_NewConfig.onlyminutes); +#if MAINMENUHOOKSVERSNUM == 10001 + SetupStore("replaceorgschedule", m_NewConfig.replaceorgschedule); +#endif tvonscreenCfg = m_NewConfig; } @@ -11,6 +11,11 @@ #include <vdr/config.h> #include <vdr/menuitems.h> +#if defined(MAINMENUHOOKSVERSNUM) & !defined(MAINMENUHOOKSVERSION) +#undef MAINMENUHOOKSVERSNUM +#define MAINMENUHOOKSVERSNUM 10000 +#endif + class tvonscreenConfig { public: @@ -31,6 +36,10 @@ public: int showsearchinitiator; int fontdsize; int transparency; +#if MAINMENUHOOKSVERSNUM == 10001 + int replaceorgschedule; +#endif + int onlyminutes; char logos[PATH_MAX]; char vdradminfile[PATH_MAX]; diff --git a/magazine.cpp b/magazine.cpp index b0e741c..7228af9 100644 --- a/magazine.cpp +++ b/magazine.cpp @@ -377,20 +377,11 @@ void magazine::showTimeline(void) void magazine::showSched(cEvent **ev,tMagazineArea area) { - cEvent *oldev=NULL,*cev=NULL; - - int j=0; - const char *txt; - cString timetxt; - int lh=-1; - int lhc=0; - tColor hgr[2]; hgr[0]=clrSched1; hgr[1]=clrSched2; - - tColor col=clrText; - + int lh=-1; + int lhc=0; for (int i=0;i<evnum;i++) { int y=i*f1->Height(); @@ -402,90 +393,154 @@ void magazine::showSched(cEvent **ev,tMagazineArea area) osd->DrawRectangle(Areas[area].x1,Areas[area].y1+y,Areas[area].x1+ScheduleWidth, Areas[area].y1+y+f1->Height(),hgr[lhc]); } - /* - for (int i=0;i<evnum;i++) + + cEvent *cev=NULL; + tColor col=clrText; + + int timetxtwidth; + int timetxtoffs; + if (tvonscreenCfg.onlyminutes) + { + timetxtwidth=f1->Width("00 "); + timetxtoffs=3; + } + else + { + timetxtwidth=f1->Width("00:00 "); + timetxtoffs=0; + } + int i=0; + while (i<evnum) + { + cev=ev[i]; + if (cev) { + cString timetxt=cev->GetTimeString(); + const char *txt=cev->Title(); + + col=clrText; + if (EDIT_curEvent==cev->EventID()) + { + col=clrYellow; // TODO: define this color! + EDIT_curEVI=i; + } + else + { + if ((time(NULL)>=cev->StartTime()) && (time(NULL)<cev->EndTime())) + { + col=clrCyan; // TODO: define this color! (and use better ones!) + } + } + if (cev->HasTimer()) + { + col=clrRed; // TODO: define this color! (and use better ones!) + } + int y=i*f1->Height(); + // output timestr + f1->Text(Areas[area].x1,Areas[area].y1+y,*timetxt+timetxtoffs,col); - if (ev[i]) + // output title + int lines=f1->TextHeight(ScheduleWidth-timetxtwidth,txt); + //mzlog(0," lines=%i for '%s'",lines,txt); + if (lines>1) { - timetxt=ev[i]->GetTimeString(); - txt=ev[i]->Title(); - - f1->Text(Areas[area].x1,y+Areas[area].y1,*timetxt,col); - f1->Text(f1->Width("00:00 ")+Areas[area].x1, - y+Areas[area].y1,ScheduleWidth-f1->Width("00:00 "), - 20,txt,col); - mzlog(0," out ev[%d]=%s '%s'",i,*timetxt,txt); + bool cut_title=false; + if (i+lines<evnum) + { + for (int x=i+1;x<i+lines;x++) + { + if (ev[x]) + { + cut_title=true; + break; + } + } + if (!cut_title) + { + f1->Text(Areas[area].x1+timetxtwidth,Areas[area].y1+y, + ScheduleWidth-timetxtwidth,20,txt,col); + } + } + else + { + cut_title=true; + } + if (cut_title) + { + lines=1; + if (i<evnum) + { + char *ntxt=strdup(txt); + if (ntxt) + { + while (f1->Width(ntxt)>ScheduleWidth-timetxtwidth) + { + ntxt[strlen(ntxt)-1]=0; + } + ntxt[strlen(ntxt)-1]='.'; + ntxt[strlen(ntxt)-2]='.'; + ntxt[strlen(ntxt)-3]='.'; + f1->Text(timetxtwidth+Areas[area].x1,Areas[area].y1+y,ntxt,col); + free(ntxt); + } + } + } + i+=lines; } + else + { + f1->Text(timetxtwidth+Areas[area].x1,Areas[area].y1+y,txt,col); + i++; + } + y=i*f1->Height(); - } - mzlog(0," ***"); - */ - for (int i=0;i<evnum;i++) - { - int y=i*f1->Height(); - cev=ev[i]; - if (cev!=NULL) - { - if (oldev!=cev) + // output shorttext, if any + if ((txt=cev->ShortText())) { - if (oldev) + int lines=f2->TextHeight(ScheduleWidth-timetxtwidth,txt); + bool enough_space=true; + for (int x=i;x<i+lines;x++) { - txt=oldev->ShortText(); - int cc=f2->TextHeight(ScheduleWidth-f1->Width("00:00 "),txt); - if (cc<=i-j) + if (ev[x]) { - f2->Text(f1->Width("00:00 ")+Areas[area].x1,(j)*f1->Height()+Areas[area].y1, - ScheduleWidth-f1->Width("00:00 "),i-j,txt,col); + enough_space=false; + break; } } - col=clrText; - if (EDIT_curEvent==cev->EventID()) + if (enough_space) { - col=clrYellow; // TODO: define this color! - EDIT_curEVI=i; + f2->Text(Areas[area].x1+timetxtwidth,Areas[area].y1+y, + ScheduleWidth-timetxtwidth,20,txt,col); + i+=lines; } - timetxt=cev->GetTimeString(); - txt=cev->Title(); - if (i+f1->TextHeight(f1->Width("00:00 ")+Areas[area].x1,txt)>=evnum) - break; - f1->Text(Areas[area].x1,y+Areas[area].y1,timetxt,col); - j=i+f1->Text(f1->Width("00:00 ")+Areas[area].x1, - y+Areas[area].y1,ScheduleWidth-f1->Width("00:00 "), - 20,txt,col); - oldev=cev; } - } - } - if (oldev) - { - txt=oldev->ShortText(); - if (j+f2->TextHeight(f1->Width("00:00 ")+Areas[area].x1,txt)>=evnum) - f2->Text(f1->Width("00:00 ")+Areas[area].x1,j*f1->Height()+Areas[area].y1, - ScheduleWidth-f1->Width("00:00 "),evnum-j,txt,col); - } - if (!EDIT_curEvent) - { - if (!timeline_tested) - { - timeline_tested=true; - cPlugin *p = cPluginManager::GetPlugin("timeline"); - if (p) + y=i*f1->Height(); + + // output description, if possible + if ((txt=cev->Description())) { - char *args[]={(char *) "timeline_command_interface",(char *) "conflicts"}; - timeline_found_conflict=p->ProcessArgs(1,args); + int lines=f2->TextHeight(ScheduleWidth-timetxtwidth,txt); + bool enough_space=true; + for (int x=i;x<i+lines;x++) + { + if (ev[x]) + { + enough_space=false; + break; + } + } + if (enough_space) + { + f2->Text(Areas[area].x1+timetxtwidth,Areas[area].y1+y, + ScheduleWidth-timetxtwidth,lines,txt,col); + i+=lines; + } } } - if (timeline_found_conflict) + else { - osd->DrawRectangle(Areas[area].x1,Areas[area].y2-f2->Height()-6, - Areas[area].x1+ScheduleWidth,Areas[area].y2+1,clrText); - osd->DrawRectangle(Areas[area].x1,Areas[area].y2-f2->Height()-4, - Areas[area].x1+ScheduleWidth,Areas[area].y2+1,clrYellow); - const char *txt=tr("Timer conflict!"); - int x=(ScheduleWidth-f2->Width(txt))/2; - f2->Text(x+Areas[area].x1,Areas[area].y2-f2->Height()-4,txt,clrGreen,clrYellow); + i++; } } } @@ -607,16 +662,14 @@ void magazine::calcSched(const cSchedule *s,cEvent **ev) time_t t=cev->StartTime(); if (t>=currentFirstTime) { - struct tm tm_r; - localtime_r(&t,&tm_r); - int i=(tm_r.tm_hour-fullHours[0])*8; - if (i<0) return; - int offs=(tm_r.tm_min*8)/60; - if (i+offs>=evnum) return; + //mzlog(0," %i",t-currentFirstTime); + int i=(t-currentFirstTime)/450; + int offs=0; + if (i>=evnum) return; if (ev[i+offs]) offs++; if (i+offs>=evnum) return; ev[i+offs]=(cEvent *)cev; - //mzlog(0," ev[%d]=%d:%d '%s'",i+offs,tm_r.tm_hour,tm_r.tm_min,cev->Title()); + //mzlog(0," ev[%d+%d] '%s'",i,offs,cev->Title()); } cev=s->Events()->Next(cev); if (!cev) return; diff --git a/po/de_DE.po b/po/de_DE.po index 88c795e..52b666c 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: VDR 1.6.0\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2010-11-15 18:35+0100\n" +"POT-Creation-Date: 2010-11-17 19:24+0100\n" "PO-Revision-Date: 2008-12-22 18:10+0000\n" "Last-Translator: Klaus Schmidinger <kls@cadsoft.de>\n" "Language-Team: <vdr@linuxtv.org>\n" @@ -21,6 +21,12 @@ msgstr "Zeichensatzgröße" msgid "transparency" msgstr "Transparenz" +msgid "replace original schedule" +msgstr "ersetze Menüpunkt Programm" + +msgid "show only minutes" +msgstr "zeige nur Minuten" + msgid "show channel logos" msgstr "zeige Kanal-Logos" @@ -45,7 +51,7 @@ msgstr "Anwenderzeitpunkt 3 (Taste 6)" msgid "jump to next day point if ago" msgstr "Gehe zum nächsten Tag wenn vorbei" -msgid "Show search item itself" +msgid "show search item itself" msgstr "Zeige auch Suchbegriff" msgid "Press 1 for help" @@ -58,9 +64,6 @@ msgstr "%d.%m." msgid "o'clock" msgstr "Uhr" -msgid "Timer conflict!" -msgstr "Timer Konflikt!" - msgid "NORMAL MODE:" msgstr "NORMALER MODUS:" @@ -197,3 +200,5 @@ msgstr "Zeigt EPG als TV-Magazin" msgid "TV-OnScreen" msgstr "TV Magazin" +#~ msgid "Timer conflict!" +#~ msgstr "Timer Konflikt!" diff --git a/po/it_IT.po b/po/it_IT.po index 8ba81c0..57fc2b3 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: VDR 1.6.0\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2010-11-15 18:35+0100\n" +"POT-Creation-Date: 2010-11-17 19:24+0100\n" "PO-Revision-Date: 2010-08-09 19:08+0100\n" "Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" "Language-Team: <vdr@linuxtv.org>\n" @@ -26,6 +26,13 @@ msgstr "" msgid "transparency" msgstr "" +msgid "replace original schedule" +msgstr "" + +#, fuzzy +msgid "show only minutes" +msgstr "Mostra nomi canali" + msgid "show channel logos" msgstr "Mostra loghi canali" @@ -50,7 +57,7 @@ msgstr "Punto utente ora 3 (tasto 6)" msgid "jump to next day point if ago" msgstr "Vai al giorno succ. se scaduto" -msgid "Show search item itself" +msgid "show search item itself" msgstr "Mostra termini di ricerca" msgid "Press 1 for help" @@ -63,9 +70,6 @@ msgstr "%d-%m" msgid "o'clock" msgstr "in punto" -msgid "Timer conflict!" -msgstr "Timer in conflitto!" - msgid "NORMAL MODE:" msgstr "MODALITA' NORMALE:" diff --git a/tvonscreen.cpp b/tvonscreen.cpp index 3c43bdf..96f1d66 100644 --- a/tvonscreen.cpp +++ b/tvonscreen.cpp @@ -10,6 +10,11 @@ #include "config.h" #include "i18n.h" +#if defined(MAINMENUHOOKSVERSNUM) & !defined(MAINMENUHOOKSVERSION) +#undef MAINMENUHOOKSVERSNUM +#define MAINMENUHOOKSVERSNUM 10000 +#endif + static const char *VERSION = "1.1.142"; static const char *DESCRIPTION = trNOOP("Shows the EPG info in form of a typical TV magazine"); static const char *MAINMENUENTRY = trNOOP("TV-OnScreen"); @@ -34,13 +39,13 @@ public: virtual bool Initialize(void); virtual bool Start(void); virtual void Housekeeping(void); - virtual const char *MainMenuEntry(void) - { - return tr(MAINMENUENTRY); - } + virtual const char *MainMenuEntry(void); virtual cOsdObject *MainMenuAction(void); virtual cMenuSetupPage *SetupMenu(void); virtual bool SetupParse(const char *Name, const char *Value); +#if MAINMENUHOOKSVERSNUM == 10001 + virtual bool Service(const char *Id, void *Data); +#endif }; cPluginTvOnscreen::cPluginTvOnscreen(void) @@ -86,6 +91,14 @@ void cPluginTvOnscreen::Housekeeping(void) // Perform any cleanup or other regular tasks. } +const char *cPluginTvOnscreen::MainMenuEntry(void) +{ +#if MAINMENUHOOKSVERSNUM == 10001 + if (tvonscreenCfg.replaceorgschedule) return NULL; +#endif + return tr(MAINMENUENTRY); +} + cOsdObject *cPluginTvOnscreen::MainMenuAction(void) { // Perform the action when selected from the main VDR menu. @@ -105,4 +118,20 @@ bool cPluginTvOnscreen::SetupParse(const char *Name, const char *Value) return tvonscreenCfg.SetupParse(Name,Value); } -VDRPLUGINCREATOR(cPluginTvOnscreen) // Don't touch this!
\ No newline at end of file +#if MAINMENUHOOKSVERSNUM == 10001 +bool cPluginTvOnscreen::Service(const char *Id, void *Data) +{ + if (tvonscreenCfg.replaceorgschedule && + strcmp(Id, "MainMenuHooksPatch-v1.0::osSchedule")==0) + { + if (!Data) return true; + cOsdObject **osd = (cOsdObject **) Data; + if (osd) + *osd = (cOsdObject*) MainMenuAction(); + return true; + } + return false; +} +#endif + +VDRPLUGINCREATOR(cPluginTvOnscreen) // Don't touch this! |