summaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorAndreas Brugger <brougs78@gmx.net>2009-06-06 01:29:22 +0200
committerThomas Günther <tom@toms-cafe.de>2009-06-06 01:29:22 +0200
commit60cd7db51838bb076312fd10e08bca0f4a005f82 (patch)
tree2ce8a57369abbd1ac1fed4a0d6527140808fbc3c /render.c
parent5ace1ef884772e4a15d58839074785b89412c8ee (diff)
parentac64ce03ec6b5766691ff2da3af6f51ed800792a (diff)
downloadvdr-plugin-text2skin-60cd7db51838bb076312fd10e08bca0f4a005f82.tar.gz
vdr-plugin-text2skin-60cd7db51838bb076312fd10e08bca0f4a005f82.tar.bz2
Added brougs78-extensions (thanks to Andreas Brugger / references #39)
- added tokens for the next 3 timers: CurrentEventsTitle[123], CurrentEventsStartDateTime[123], CurrentEventsStopDateTime[123], CurrentEventsChannelNumber[123], CurrentEventsChannelName[123], CurrentEventsIsRecording[123] - added audio- and video-tokens: PresentLanguageCode, PresentLanguageDescription, PresentVideoAR and implemented the missing code for the Language-token - added tokens for replay: ReplayName, ReplayDateTime, ReplayShortText, ReplayDescription, ReplayLanguageCode, ReplayLanguageDescription, ReplayVideoAR - additional recording-tokens: RecordingVideoAR, RecordingSize - added a reset for scrolling text (configurable) - added recording-tokens: RecordingLength, RecordingCuttedLength - added tokens: OsdWidth, OsdHeight - switched the search-order for the fonts to priorise the skin-folder (this avoids error-messages in the log) - added the possibility to have a scrollbar in every menu - not fully implemented yet (to position in menu-lists is not necessarily correct, if there are more items with the same osd-text) - added a configuration option for showing the scrollbar in the menus - added token TimerConflicts using the service interface of the epgsearch plugin "Epgsearch-lastconflictinfo-v1.0" - added a test-feature to search for reruns of a program and add the information to the extended epg-info (trigger DEVELOPMENT_FEATURES). This uses a service interface of the epgsearch plugin "Epgsearch-searchresults-v1.0" - the extended epg-info and the recording-info are extended by AUX-Infos (configurable) there is also an option to strip known tags - the tab-widths are scaled for taking into account that different TT-Fonts have a different width than the default font from VDR - added tokens for signal-info: FrontendSTR, FrontendSNR, FrontendHasLock, FrontendHasSignal - added token PresentEventID for EPG-images - added tokens for recordings: RecordingFilename, RecordingPriority, RecordingLifetime - set EditableWidth. This is important for plugins like 'rotor' or 'extrecmenu'
Diffstat (limited to 'render.c')
-rw-r--r--render.c97
1 files changed, 89 insertions, 8 deletions
diff --git a/render.c b/render.c
index 7610d2e..1c09863 100644
--- a/render.c
+++ b/render.c
@@ -145,15 +145,22 @@ void cText2SkinRender::Action(void)
void cText2SkinRender::Update(void)
{
+ //DStartBench(malen);
+ //DStartBench(ges);
Dbench(update);
for (uint i = 0; i < mDisplay->Objects(); ++i)
DrawObject(mDisplay->GetObject(i));
+ //DShowBench("---\t", malen);
+ //DStartBench(flushen);
Dbench(flush);
mScreen->Flush();
Ddiff("flush only", flush);
Ddiff("complete flush", update);
+ //DShowBench("===\t", flushen);
+ //DShowBench("=== ges\t", ges);
+ //printf("====\t%d\n", mDisplay->Objects());
}
void cText2SkinRender::DrawObject(const cxObject *Object)
@@ -220,7 +227,9 @@ void cText2SkinRender::DrawObject(const cxObject *Object)
uint itemheight = item->Size().h;
uint maxitems = areasize.h / itemheight;
uint yoffset = 0;
+ bool initialEditableWidthSet = false;
+ mMenuScrollbar.maxItems = maxitems;
SetMaxItems(maxitems); //Dprintf("setmaxitems %d\n", maxitems);
for (uint i = 0; i < maxitems; ++i, yoffset += itemheight) {
for (uint j = 1; j < Object->Objects(); ++j) {
@@ -253,14 +262,36 @@ void cText2SkinRender::DrawObject(const cxObject *Object)
++n;
nexttab = GetTab(n);
}
-
+
+ // set initial EditableWidth
+ // this is for plugins like 'extrecmenu' and 'rotor'
+ if ((obj.Type() == cxObject::text || obj.Type() == cxObject::marquee || obj.Type() == cxObject::blink) && !initialEditableWidthSet) {
+ initialEditableWidthSet = true;
+ SetEditableWidth(obj.Size().w);
+ }
+
if (t >= 0 && nexttab > 0 && nexttab < obj.mPos1.x + obj.Size().w - 1)
// there is a "next tab" with text
obj.mPos2.x = Object->mPos1.x + o->mPos1.x + nexttab;
else {
// there is no "next tab", use the rightmost edge
obj.mPos2.x += Object->mPos1.x;
- SetEditableWidth(obj.Size().w);
+ /* not used anymore due to change to fontOsd
+ but could be usefull if someone uses a differnt font
+
+ if ((obj.Type() == cxObject::text || obj.Type() == cxObject::marquee || obj.Type() == cxObject::blink) && t == 1) {
+ // VDR assumes, that the font in the menu is fontOsd,
+ // so the EditableWidth is not necessarily correct
+ // for TTF
+ const cFont *defFont = cFont::GetFont(fontOsd);
+ const char *dummy = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
+ int editableWidth = obj.Size().w;
+ if (defFont != obj.Font())
+ editableWidth = (int)(editableWidth * defFont->Width(dummy) / (1.1 * obj.Font()->Width(dummy)));
+ SetEditableWidth(editableWidth);
+ } */
+ if ((obj.Type() == cxObject::text || obj.Type() == cxObject::marquee || obj.Type() == cxObject::blink) && t == 1)
+ SetEditableWidth(obj.Size().w);
}
obj.mPos2.y += Object->mPos1.y + yoffset;
@@ -358,7 +389,21 @@ void cText2SkinRender::DrawMarquee(const txPoint &Pos, const txSize &Size, const
state = tState();
state.text = Text;
}
-
+
+ if (Text2SkinSetup.MarqueeReset && mUpdate.resetMarquee && mUpdate.currentItem.find(Text, 0) != std::string::npos) {
+ state.offset = 0;
+ state.direction = 1;
+ state.nexttime = 0;
+ state.scrolling = false;
+ mUpdate.foundFirstItem = true;
+ }
+ else {
+ if (mUpdate.foundFirstItem) {
+ mUpdate.resetMarquee = false;
+ mUpdate.foundFirstItem = false;
+ }
+ }
+
if (state.nexttime == 0)
state.nexttime = mNow + 1500;
else if (mNow >= state.nexttime) {
@@ -375,7 +420,7 @@ void cText2SkinRender::DrawMarquee(const txPoint &Pos, const txSize &Size, const
++state.direction;
nextin = 1500;
} else
- --state.offset;
+ Text2SkinSetup.MarqueeLeftRight ? --state.offset : state.offset = 0;
}
state.nexttime = mNow + nextin;
}
@@ -544,6 +589,26 @@ void cText2SkinRender::DrawScrollbar(const txPoint &Pos, const txSize &Size, con
DrawRectangle(sp, ss, Fg);
}
}
+ else if (mMenuScrollbar.Available()) {
+ DrawRectangle(Pos, Size, Bg);
+ txPoint sbPoint = Pos;
+ txSize sbSize = Size;
+ if (sbSize.h > sbSize.w) {
+ // -1 to get at least 1 pixel height
+ double top = double(mMenuScrollbar.Top()) / mMenuScrollbar.total * (sbSize.h - 1);
+ double bottom = double(mMenuScrollbar.Bottom()) / mMenuScrollbar.total * (sbSize.h - 1);
+ sbPoint.y += (uint)top;
+ sbSize.h -= (uint)top + (uint)bottom;
+ }
+ else {
+ // -1 to get at least 1 pixel height
+ double left = double(mMenuScrollbar.Top()) / mMenuScrollbar.total * (sbSize.w - 1);
+ double right = double(mMenuScrollbar.Bottom()) / mMenuScrollbar.total * (sbSize.w - 1);
+ sbPoint.x += (uint)left;
+ sbSize.w -= (uint)left + (uint)right;
+ }
+ DrawRectangle(sbPoint, sbSize, Fg);
+ }
}
txPoint cText2SkinRender::Transform(const txPoint &Pos)
@@ -567,7 +632,9 @@ bool cText2SkinRender::ItemColor(const std::string &Color, tColor &Result)
std::string cText2SkinRender::ImagePath(const std::string &Filename)
{
if (mRender)
- return mRender->mBasePath + "/" + Filename;
+ return (*Filename.data() == '/')
+ ? Filename
+ : mRender->mBasePath + "/" + Filename;
return "";
}
@@ -655,12 +722,26 @@ cxType cText2SkinRender::GetTokenData(const txToken &Token)
case tDateTime: return TimeType(time(NULL), Token.Attrib.Text);
- case tCanScrollUp: return mScroller != NULL && mScroller->CanScrollUp();
+ case tCanScrollUp:
+ if (mScroller)
+ return mScroller->CanScrollUp();
+ if (mMenuScrollbar.Available())
+ return mMenuScrollbar.CanScrollUp();
+ return false;
+
+ case tCanScrollDown:
+ if (mScroller)
+ return mScroller->CanScrollDown();
+ if (mMenuScrollbar.Available())
+ return mMenuScrollbar.CanScrollDown();
+ return false;
- case tCanScrollDown: return mScroller != NULL && mScroller->CanScrollDown();
-
case tIsRecording: return cRecordControls::Active();
+ case tOsdWidth: return (cxType)mBaseSize.w;
+
+ case tOsdHeight: return (cxType)mBaseSize.h;
+
#if VDRVERSNUM >=10318
case tAudioTrack: {
cDevice *dev = cDevice::PrimaryDevice();