From c80a53ff6ea22aa14d1f9772b310b77ea0da7c42 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 16 May 2004 18:00:00 +0200 Subject: =?UTF-8?q?Version=201.3.7=20-=20Fixed=20a=20memory=20leak=20in=20?= =?UTF-8?q?thread=20handling=20when=20using=20NPTL=20(thanks=20to=20Jon=20?= =?UTF-8?q?Burgess).=20-=20Fixed=20handling=20Setup.RecordDolbyDigital,=20?= =?UTF-8?q?which=20was=20broken=20since=20version=201.1.6.=20-=20Fixed=20h?= =?UTF-8?q?andling=20text=20lengths=20for=20itemized=20EPG=20texts=20(than?= =?UTF-8?q?ks=20to=20Marcel=20Wiesweg).=20-=20Fixed=20the=20help=20for=20L?= =?UTF-8?q?STE=20and=20LSTR=20(was=20broken=20in=201.3.6).=20-=20Improved?= =?UTF-8?q?=20iso8859-7=20fonts=20(thanks=20to=20Dimitrios=20Dimitrakos).?= =?UTF-8?q?=20-=20Added=20some=203-letter=20language=20codes=20(thanks=20t?= =?UTF-8?q?o=20Marcus=20M=C3=B6nnig).=20-=20Added=20language=20code=20hand?= =?UTF-8?q?ling=20to=20the=20subtitling=20descriptor=20in=20'libsi'=20(tha?= =?UTF-8?q?nks=20to=20=20=20Pekka=20Virtanen).=20-=20Moved=20several=20men?= =?UTF-8?q?u=20item=20classes=20from=20menu.c=20to=20menuitems.[hc]=20to?= =?UTF-8?q?=20make=20them=20=20=20available=20for=20plugins.=20-=20The=20e?= =?UTF-8?q?pg2html.pl=20script=20now=20handles=20'|'=20in=20description=20?= =?UTF-8?q?texts.=20-=20The=20new=20setup=20option=20"OSD/Use=20small=20fo?= =?UTF-8?q?nt"=20can=20be=20used=20to=20control=20the=20use=20of=20=20=20t?= =?UTF-8?q?he=20small=20font=20(see=20MANUAL=20for=20details).=20-=20Swapp?= =?UTF-8?q?ed=20osd.[hc]=20and=20osdbase.[hc]=20to=20have=20the=20virtual?= =?UTF-8?q?=20OSD=20base=20class=20named=20cOsd.=20=20=20Plugins=20may=20n?= =?UTF-8?q?eed=20to=20adjust=20their=20#include=20statements.=20-=20Colors?= =?UTF-8?q?=20are=20now=20given=20as=20AARRGGBB=20instead=20of=20AABBGGRR.?= =?UTF-8?q?=20The=20values=20are=20mapped=20to=20=20=20the=20driver's=20(w?= =?UTF-8?q?rong)=20sequence=20in=20dvbosd.c=20(this=20should=20really=20be?= =?UTF-8?q?=20fixed=20in=20the=20=20=20driver,=20together=20with=20the=20e?= =?UTF-8?q?ndian=20problem).=20-=20The=20new=20OSD=20setup=20parameters=20?= =?UTF-8?q?"Left"=20and=20"Top"=20can=20be=20used=20to=20define=20the=20to?= =?UTF-8?q?p=20left=20=20=20corner=20of=20the=20OSD.=20-=20The=20OSD=20siz?= =?UTF-8?q?e=20parameters=20are=20now=20in=20pixel=20(as=20opposed=20to=20?= =?UTF-8?q?formerly=20characters).=20=20=20When=20reading=20a=20'setup.con?= =?UTF-8?q?f'=20file=20from=20an=20older=20version=20of=20VDR,=20the=20OSD?= =?UTF-8?q?width=20=20=20and=20OSDheight=20values=20will=20be=20converted?= =?UTF-8?q?=20to=20pixel=20automatically.=20-=20The=20OSD=20is=20now=20ful?= =?UTF-8?q?ly=20device=20independent.=20See=20the=20comments=20in=20VDR/os?= =?UTF-8?q?d.h=20and=20the=20=20=20description=20in=20PLUGINS.html=20for?= =?UTF-8?q?=20information=20on=20how=20a=20plugin=20can=20implement=20an?= =?UTF-8?q?=20OSD=20=20=20display=20on=20arbitrary=20hardware.=20-=20The?= =?UTF-8?q?=20OSD=20(actually=20its=20cBitmap=20class)=20can=20now=20handl?= =?UTF-8?q?e=20XPM=20files.=20There=20are=20several=20=20=20XPM=20files=20?= =?UTF-8?q?in=20the=20VDR/symbols=20directory=20which=20can=20be=20used=20?= =?UTF-8?q?by=20skins=20(some=20of=20these=20=20=20have=20been=20taken=20f?= =?UTF-8?q?rom=20the=20"elchi"=20patch).=20See=20VDR/skinsttng.c=20for=20e?= =?UTF-8?q?xamples=20on=20how=20=20=20to=20use=20these.=20-=20Due=20to=20t?= =?UTF-8?q?he=20changes=20in=20the=20OSD=20handling=20the=20DEBUG=5FOSD=20?= =?UTF-8?q?option=20for=20a=20textual=20OSD=20=20=20has=20been=20dropped.?= =?UTF-8?q?=20There=20will=20be=20a=20plugin=20that=20implements=20a=20ski?= =?UTF-8?q?n=20with=20this=20=20=20functionality=20later.=20-=20The=20enti?= =?UTF-8?q?re=20OSD=20display=20can=20now=20be=20implemented=20via=20"skin?= =?UTF-8?q?s".=20See=20VDR/skins.[hc],=20=20=20VDR/skinclassic.[hc],=20VDR?= =?UTF-8?q?/skinsttng.[hc]=20and=20PLUGINS.html=20for=20information=20on?= =?UTF-8?q?=20how=20=20=20a=20plugin=20can=20implement=20its=20own=20skin.?= =?UTF-8?q?=20By=20default=20VDR=20comes=20with=20a=20"Classic"=20skin=20?= =?UTF-8?q?=20=20that=20implements=20the=20OSD=20display=20known=20from=20?= =?UTF-8?q?previous=20versions,=20and=20the=20new=20skin=20=20=20named=20"?= =?UTF-8?q?ST:TNG=20Panels",=20which=20is=20also=20the=20default=20skin=20?= =?UTF-8?q?now.=20The=20actual=20skin=20can=20=20=20be=20selected=20throug?= =?UTF-8?q?h=20"Setup/OSD/Skin".=20-=20The=20colors=20used=20in=20a=20skin?= =?UTF-8?q?=20can=20now=20be=20configured=20using=20"themes".=20See=20PLUG?= =?UTF-8?q?INS.html=20=20=20for=20information=20on=20how=20a=20skin=20can?= =?UTF-8?q?=20make=20use=20of=20themes,=20and=20man=20vdr(5)=20for=20the?= =?UTF-8?q?=20=20=20structure=20of=20a=20theme=20file.=20The=20actual=20th?= =?UTF-8?q?eme=20to=20use=20can=20be=20selected=20through=20=20=20"Setup/O?= =?UTF-8?q?SD/Theme".=20-=20Added=20Croatian=20language=20texts=20(thanks?= =?UTF-8?q?=20to=20Drazen=20Dupor).=20=20=20NOTE:=20there=20is=20apparentl?= =?UTF-8?q?y=20a=20problem=20with=20the=20newly=20introduced=20iso8859-2?= =?UTF-8?q?=20font,=20=20=20because=20as=20soon=20as=20Setup/OSD/Language?= =?UTF-8?q?=20is=20set=20to=20Croatian=20(currently=20the=20last=20one=20?= =?UTF-8?q?=20=20in=20the=20list)=20everything=20freezes=20and=20the=20vdr?= =?UTF-8?q?=20processes=20have=20to=20be=20killed=20with=20-9=20=20=20and?= =?UTF-8?q?=20the=20driver=20needs=20to=20be=20reloaded.=20Maybe=20somebod?= =?UTF-8?q?y=20else=20can=20find=20out=20what's=20=20=20going=20wrong=20he?= =?UTF-8?q?re...=20-=20Added=20missing=20NULL=20checks=20when=20accessing?= =?UTF-8?q?=20sectionHandler=20in=20device.c=20(thanks=20to=20=20=20Pekka?= =?UTF-8?q?=20Virtanen).=20-=20Fixed=20setting=20the=20time=20from=20the?= =?UTF-8?q?=20DVB=20data=20stream=20(thanks=20to=20Helmut=20Auer=20for=20?= =?UTF-8?q?=20=20pointing=20out=20a=20frequency/transponder=20handling=20m?= =?UTF-8?q?ixup).=20This=20now=20also=20takes=20the=20=20=20actual=20sourc?= =?UTF-8?q?e=20(sat,=20cable=20etc.)=20into=20account.=20Please=20go=20int?= =?UTF-8?q?o=20"Setup/EPG"=20and=20=20=20set=20the=20"Set=20system=20time"?= =?UTF-8?q?=20and=20"Use=20time=20from=20transponder"=20parameters=20accor?= =?UTF-8?q?dingly=20=20=20(this=20is=20necessary=20even=20if=20you=20have?= =?UTF-8?q?=20already=20set=20them=20before!).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skins.h | 297 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 297 insertions(+) create mode 100644 skins.h (limited to 'skins.h') diff --git a/skins.h b/skins.h new file mode 100644 index 0000000..412810f --- /dev/null +++ b/skins.h @@ -0,0 +1,297 @@ +/* + * skins.h: The optical appearance of the OSD + * + * See the main source file 'vdr.c' for copyright information and + * how to reach the author. + * + * $Id: skins.h 1.1 2004/05/16 09:40:18 kls Exp $ + */ + +#ifndef __SKINS_H +#define __SKINS_H + +#include "channels.h" +#include "epg.h" +#include "keys.h" +#include "osd.h" +#include "recording.h" +#include "themes.h" +#include "tools.h" + +enum eMessageType { mtStatus = 0, mtInfo, mtWarning, mtError }; // will be used to calculate color offsets! + +class cSkinDisplay { +private: + static cSkinDisplay *current; + int editableWidth; //XXX this is not nice, but how else could we know this value? +public: + cSkinDisplay(void); + virtual ~cSkinDisplay(); + int EditableWidth(void) { return editableWidth; } + void SetEditableWidth(int Width) { editableWidth = Width; } + ///< If an item is set through a call to cSkinDisplayMenu::SetItem(), this + ///< function shall be called to set the width of the rightmost tab separated + ///< field. This information will be used for editable items. + virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL) {} + ///< Sets the color buttons to the given strings, provided this cSkinDisplay + ///< actually has a color button display. + virtual void SetMessage(eMessageType Type, const char *Text) {} + ///< Sets a one line message Text, with the given Type. Type can be used + ///< to determine, e.g., the colors for displaying the Text. + virtual void Flush(void) {} + ///< Actually draws the OSD display to the output device. + static cSkinDisplay *Current(void) { return current; } + ///< Returns the currently active cSkinDisplay. + }; + +class cSkinDisplayChannel : public cSkinDisplay { + ///< This class is used to display the current channel, together with + ///< the present and following EPG even. How and to what extent this + ///< is done is totally up to the derived class. +public: + virtual void SetChannel(const cChannel *Channel, int Number) = 0; + ///< Sets the current channel to Channel. If Number is not 0, the + ///< user is in the process of entering a channel number, which must + ///< be displayed accordingly. + virtual void SetEvents(const cEvent *Present, const cEvent *Following) = 0; + ///< Sets the Present and Following EPG events. It either of these + ///< is not available, NULL will be given. + /*TODO + SetButtons + Red = Video options + Green = Info now + Yellow = Info next + Blue = Audio options + AudioOptions + VideoOptions + */ + }; + +class cSkinDisplayMenu : public cSkinDisplay { + ///< This class implements the general purpose menu display, which is + ///< used throughout the program to display information and let the + ///< user interact with items. + ///< A menu consists of the following fields, each of which is explicitly + ///< set by calls to the member functions below: + ///< - Title: a single line of text, indicating what this menu displays + ///< - Color buttons: the red, green, yellow and blue buttons, used for + ///< various functions + ///< - Message: a one line message, indicating a Status, Info, Warning, + ///< or Error condition + ///< - Central area: the main central area of the menu, used to display + ///< one of the following: + ///< - Items: a list of single line items, of which the user may be + ///< able to select one + ///< - Event: the full information about one EPG event + ///< - Text: a multi line, scrollable text +public: + enum { MaxTabs = 6 }; +private: + int tabs[MaxTabs]; +protected: + cTextScroller textScroller; + int Tab(int n) { return (n >= 0 && n < MaxTabs) ? tabs[n] : 0; } + ///< Returns the offset of the given tab from the left border of the + ///< item display area. The value returned is in pixel.//XXX ncurses??? + const char *GetTabbedText(const char *s, int Tab); + ///< Returns the that part of the given string, that follows the given + ///< Tab (where 0 indicates the beginning of the string). If no such + ///< part can be found, NULL will be returned. +public: + cSkinDisplayMenu(void); + virtual void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0); + ///< Sets the tab columns to the given values, which are the number of + ///< characters in each column.//XXX ncurses??? + virtual void Scroll(bool Up, bool Page); + ///< If this menu contains a text area that can be scrolled, this function + ///< will be called to actually scroll the text. Up indicates whether the + ///< text shall be scrolled up or down, and Page is true if it shall be + ///< scrolled by a full page, rather than a single line. An object of the + ///< cTextScroller class can be used to implement the scrolling text area. + virtual int MaxItems(void) = 0; + ///< Returns the maximum number of items the menu can display. + virtual void Clear(void) = 0; + ///< Clears the entire central area of the menu. + virtual void SetTitle(const char *Title) = 0; + ///< Sets the title of this menu to Title. + virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL) = 0; + ///< Sets the color buttons to the given strings. If any of the values is + ///< NULL, any previous text must be removed from the related button. + virtual void SetMessage(eMessageType Type, const char *Text) = 0; + ///< Sets a one line message Text, with the given Type. Type can be used + ///< to determine, e.g., the colors for displaying the Text. + ///< If Text is NULL, any previously displayed message must be removed, and + ///< any previous contents overwritten by the message must be restored. + virtual void SetItem(const char *Text, int Index, bool Current, bool Selectable) = 0; + ///< Sets the item at the given Index to Text. Index is between 0 and the + ///< value returned by MaxItems(), minus one. Text may contain tab characters ('\t'), + ///< which shall be used to separate the text into several columns, according to the + ///< values set by a prior call to SetTabs(). If Current is true, this item shall + ///< be drawn in a way indicating to the user that it is the currently selected + ///< one. Selectable can be used to display items differently that can't be + ///< selected by the user. + ///< Whenever the current status is moved from one item to another, + ///< this function will be first called for the old current item + ///< with Current set to false, and then for the new current item + ///< with Current set to true. + /*TODO + virtual void SetItem(const cEvent *Event, int Index, bool Current, bool Selectable, bool NowNext???, bool Schedule???); + virtual void SetItem(const cTimer *Timer, int Index, bool Current, bool Selectable); + virtual void SetItem(const cChannel *Channel, int Index, bool Current, bool Selectable); + virtual void SetItem(const cRecording *Recording, int Index, bool Current, bool Selectable); + --> false: call SetItem(text) + */ + virtual void SetEvent(const cEvent *Event) = 0; + ///< Sets the Event that shall be displayed, using the entire central area + ///< of the menu. The Event's 'description' shall be displayed using a + ///< cTextScroller, and the Scroll() function will be called to drive scrolling + ///< that text if necessary. + virtual void SetRecording(const cRecording *Recording) = 0; + ///< Sets the Recording that shall be displayed, using the entire central area + ///< of the menu. The Recording's 'summary' shall be displayed using a + ///< cTextScroller, and the Scroll() function will be called to drive scrolling + ///< that text if necessary. + virtual void SetText(const char *Text, bool FixedFont) = 0; + ///< Sets the Text that shall be displayed, using the entire central area + ///< of the menu. The Text shall be displayed using a cTextScroller, and + ///< the Scroll() function will be called to drive scrolling that text if + ///< necessary. + //XXX ??? virtual void SetHelp(const char *Help) = 0; + }; + +class cSkinDisplayReplay : public cSkinDisplay { + ///< This class implements the progress display used during replay of + ///< a recording. +protected: + const cMarks *marks; + class cProgressBar : public cBitmap { + protected: + int total; + int Pos(int p) { return p * Width() / total; } + void Mark(int x, bool Start, bool Current, tColor ColorMark, tColor ColorCurrent); + public: + cProgressBar(int Width, int Height, int Current, int Total, const cMarks *Marks, tColor ColorSeen, tColor ColorRest, tColor ColorSelected, tColor ColorMark, tColor ColorCurrent); + }; +public: + cSkinDisplayReplay(void); + virtual void SetMarks(const cMarks *Marks); + ///< Sets the editing marks to Marks, which shall be used to display the + ///< progress bar through a cProgressBar object. + virtual void SetTitle(const char *Title) = 0; + ///< Sets the title of the recording. + virtual void SetMode(bool Play, bool Forward, int Speed) = 0; + ///< Sets the current replay mode, which can be used to display some + ///< indicator, showing the user whether we are currently in normal + ///< play mode, fast forward etc. + virtual void SetProgress(int Current, int Total) = 0; + ///< This function will be called whenever the position in of the total + ///< length of the recording has changed. A cProgressBar shall then be + ///< used to display a progress indicator. + virtual void SetCurrent(const char *Current) = 0; + ///< Sets the current position within the recording, as a user readable + ///< string if the form "h:mm:ss.ff". The ".ff" part, indicating the + ///< frame number, is optional and the actual implementation needs to + ///< take care that it is erased from the display when a Current string + ///< _with_ ".ff" is followed by one without it. + virtual void SetTotal(const char *Total) = 0; + ///< Sets the total length of the recording, as a user readable + ///< string if the form "h:mm:ss". + virtual void SetJump(const char *Jump) = 0; + ///< Sets the prompt that allows the user to enter a jump point. + ///< Jump is a string of the form "Jump: mm:ss". The actual implementation + ///< needs to be able to handle variations in the length of this + ///< string, which will occur when the user enters an actual value. + ///< If Jump is NULL, the jump prompt shall be removed from the display. + }; + +class cSkinDisplayVolume : public cSkinDisplay { + ///< This class implements the volume/mute display. +public: + virtual void SetVolume(int Current, int Total, bool Mute) = 0; + ///< Sets the volume to the given Current value, which is in the range + ///< 0...Total. If Mute is true, audio is currently muted and a "mute" + ///< indicator shall be displayed. + }; + +class cSkinDisplayMessage : public cSkinDisplay { + ///< This class implements a simple message display. +public: + virtual void SetMessage(eMessageType Type, const char *Text) = 0; + ///< Sets the message to Text. Type can be used to decide how to display + ///< the message, for instance in which colors. + }; + +class cSkin : public cListObject { +private: + char *name; + cTheme *theme; +public: + cSkin(const char *Name, cTheme *Theme = NULL); + ///< Creates a new skin class, with the given Name and Theme. + ///< Name will be used to identify this skin in the 'setup.conf' + ///< file, and is normally not seen by the user. It should + ///< consist of only lowercase letters and digits. + ///< Theme must be a static object that survives the entire lifetime + ///< of this skin. + ///< The constructor of a derived class shall not set up any data + ///< structures yet, because whether or not this skin will actually + ///< be used is not yet known at this point. All actual work shall + ///< be done in the pure functions below. + ///< A cSkin object must be created on the heap and shall not be + ///< explicitly deleted. + virtual ~cSkin(); + const char *Name(void) { return name; } + cTheme *Theme(void) { return theme; } + virtual const char *Description(void) = 0; + ///< Returns a user visible, single line description of this skin, + ///< which may consist of arbitrary text and can, if the skin + ///< implementation wishes to do so, be internationalized. + ///< The actual text shouldn't be too long, so that it can be + ///< fully displayed in the Setup/OSD menu. + virtual cSkinDisplayChannel *DisplayChannel(bool WithInfo) = 0; + ///< Creates and returns a new object for displaying the current + ///< channel. WithInfo indicates whether it shall display only + ///< the basic channel data, or also information about the present + ///< and following EPG event. + ///< The caller must delete the object after use. + virtual cSkinDisplayMenu *DisplayMenu(void) = 0; + ///< Creates and returns a new object for displaying a menu. + ///< The caller must delete the object after use. + virtual cSkinDisplayReplay *DisplayReplay(bool ModeOnly) = 0; + ///< Creates and returns a new object for displaying replay progress. + ///< ModeOnly indicates whether this should be a full featured replay + ///< display, or just a replay mode indicator. + ///< The caller must delete the object after use. + virtual cSkinDisplayVolume *DisplayVolume(void) = 0; + ///< Creates and returns a new object for displaying the current volume. + ///< The caller must delete the object after use. + virtual cSkinDisplayMessage *DisplayMessage(void) = 0; + ///< Creates and returns a new object for displaying a message. + ///< The caller must delete the object after use. + }; + +class cSkins : public cList { +private: + cSkin *current; + cSkinDisplayMessage *displayMessage; +public: + cSkins(void); + ~cSkins(); + bool SetCurrent(const char *Name = NULL); + ///< Sets the current skin to the one indicated by name. + ///< If no such skin can be found, the first one will be used. + cSkin *Current(void) { return current; } + ///< Returns a pointer to the current skin. + bool IsOpen(void) { return cSkinDisplay::Current(); } + ///< Returns true if there is currently a skin display object active. + eKeys Message(eMessageType Type, const char *s, int Seconds = 0); + ///< Displays the given message, either through a currently visible + ///< display object that is capable of doing so, or by creating a + ///< temporary cSkinDisplayMessage object. + void Flush(void); + ///< Flushes the currently active cSkinDisplay, if any. + }; + +extern cSkins Skins; + +#endif //__SKINS_H -- cgit v1.2.3