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 --- osdbase.h | 296 +++++++++++++++++++++----------------------------------------- 1 file changed, 101 insertions(+), 195 deletions(-) (limited to 'osdbase.h') diff --git a/osdbase.h b/osdbase.h index 3277d82..53fbf6b 100644 --- a/osdbase.h +++ b/osdbase.h @@ -4,221 +4,127 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.h 1.9 2004/01/31 10:28:49 kls Exp $ + * $Id: osdbase.h 1.10 2004/04/30 13:40:11 kls Exp $ */ #ifndef __OSDBASE_H #define __OSDBASE_H -#include -#include "font.h" +#include "config.h" +#include "osd.h" +#include "skins.h" +#include "tools.h" -#define MAXNUMCOLORS 256 +enum eOSState { osUnknown, + osContinue, + osSchedule, + osChannels, + osTimers, + osRecordings, + osPlugin, + osSetup, + osCommands, + osPause, + osRecord, + osReplay, + osStopRecord, + osStopReplay, + osCancelEdit, + osSwitchDvb, + osBack, + osEnd, + os_User, // the following values can be used locally + osUser1, + osUser2, + osUser3, + osUser4, + osUser5, + osUser6, + osUser7, + osUser8, + osUser9, + osUser10, + }; -enum eDvbColor { -#ifdef DEBUG_OSD - clrBackground, - clrTransparent = clrBackground, - clrBlack = clrBackground, - clrRed, - clrGreen, - clrYellow, - clrBlue, - clrMagenta, - clrCyan, - clrWhite, -#else - clrTransparent = 0x00000000, - clrBackground = 0x7F000000, // 50% gray - clrBlack = 0xFF000000, - clrRed = 0xFF1414FC, - clrGreen = 0xFF24FC24, - clrYellow = 0xFF24C0FC, - clrMagenta = 0xFFFC00B0, - clrBlue = 0xFFFC0000, - clrCyan = 0xFFFCFC00, - clrWhite = 0xFFFCFCFC, -#endif - }; - -class cPalette { +class cOsdItem : public cListObject { private: - eDvbColor color[MAXNUMCOLORS]; - int maxColors, numColors; - bool used[MAXNUMCOLORS]; - bool fetched[MAXNUMCOLORS]; - bool full; + char *text; + int offset; + eOSState state; + bool selectable; protected: - typedef u_char tIndexes[MAXNUMCOLORS]; + bool fresh; public: - cPalette(int Bpp); - int Index(eDvbColor Color); - void Reset(void); - void SetColor(int Index, eDvbColor Color); - eDvbColor GetColor(int Index) { return Index < maxColors ? color[Index] : clrBlack; } - const eDvbColor *NewColors(int &FirstColor, int &LastColor); - // With every call this function returns a consecutive range of - // color entries that have been added since the last call. The - // return value is the address of the first new color, and the - // index of the first and last new color are returned in the given - // int parameters. If there are no new color entries, NULL will - // be returned. - const eDvbColor *AllColors(int &NumColors); - // Returns a pointer to the complete color table and stores the - // number of valid entries in NumColors. If no colors have been - // stored yet, NumColors will be set to 0 and the function will - // return NULL. - void Take(const cPalette &Palette, tIndexes *Indexes = NULL); + cOsdItem(eOSState State = osUnknown); + cOsdItem(const char *Text, eOSState State = osUnknown); + virtual ~cOsdItem(); + bool Selectable(void) { return selectable; } + void SetText(const char *Text, bool Copy = true); + void SetSelectable(bool Selectable); + void SetFresh(bool Fresh); + const char *Text(void) { return text; } + virtual void Set(void) {} + virtual eOSState ProcessKey(eKeys Key); }; -class cBitmap : public cPalette { +class cOsdObject { + friend class cOsdMenu; private: - const cFont *font; - eDvbFont fontType; - u_char *bitmap; - bool clearWithBackground; + bool isMenu; protected: - int width, height; - int dirtyX1, dirtyY1, dirtyX2, dirtyY2; + bool needsFastResponse; public: - cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground = true); - virtual ~cBitmap(); - bool ClearWithBackground(void) { return clearWithBackground; } - eDvbFont SetFont(eDvbFont Font); - bool Dirty(int &x1, int &y1, int &x2, int &y2); - void SetIndex(int x, int y, u_char Index); - void SetPixel(int x, int y, eDvbColor Color); - void SetBitmap(int x, int y, const cBitmap &Bitmap); - int Width(void) { return width; } - int Width(unsigned char c); - int Width(const char *s); - int Height(void) { return height; } - void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground); - void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); - void Clean(void); - void Clear(void); - const u_char *Data(int x, int y); + cOsdObject(bool FastResponse = false) { isMenu = false; needsFastResponse = FastResponse; } + virtual ~cOsdObject() {} + bool NeedsFastResponse(void) { return needsFastResponse; } + bool IsMenu(void) { return isMenu; } + virtual void Show(void) {} + virtual eOSState ProcessKey(eKeys Key) { return osUnknown; } }; -#define MAXNUMWINDOWS 7 // OSD windows are counted 1...7 - -class cWindow : public cBitmap { -private: - int handle; // the index within the OSD's window array (0...MAXNUMWINDOWS - 1) - int x0, y0; - int bpp; - bool tiled; - bool shown; -public: - cWindow(int Handle, int x, int y, int w, int h, int Bpp, bool ClearWithBackground, bool Tiled); - int X0(void) { return x0; } - int Y0(void) { return y0; } - int Bpp(void) { return bpp; } - bool Tiled(void) { return tiled; } - bool Shown(void) { bool s = shown; shown = true; return s; } - int Handle(void) { return handle; } - bool Contains(int x, int y); - void Relocate(int x, int y); - void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); - void SetBitmap(int x, int y, const cBitmap &Bitmap); - void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground); - const u_char *Data(int x, int y); - }; - -typedef int tWindowHandle; - -// '-1' is used as an error return value! -#define ALL_WINDOWS (-2) -#define ALL_TILED_WINDOWS (-3) -#define LAST_CREATED_WINDOW (-4) - -class cOsdBase { +class cOsdMenu : public cOsdObject, public cList { private: - int numWindows; - int x0, y0; - cWindow *window[MAXNUMWINDOWS]; - cWindow *GetWindow(int x, int y); - cWindow *GetWindow(tWindowHandle Window); + static cSkinDisplayMenu *displayMenu; + static int displayMenuCount; + static int displayMenuItems; + char *title; + int cols[cSkinDisplayMenu::MaxTabs]; + int first, current, marked; + cOsdMenu *subMenu; + const char *helpRed, *helpGreen, *helpYellow, *helpBlue; + char *status; + int digit; + bool hasHotkeys; protected: - cWindow *GetWindowNr(int i) { return i < MAXNUMWINDOWS ? window[i] : NULL; } - int NumWindows(void) { return numWindows; } - int X0(void) { return x0; } - int Y0(void) { return y0; } - virtual bool OpenWindow(cWindow *Window) = 0; - // Opens the window on the OSD hardware, without actually showing it (the - // initial state shall be "hidden"). - virtual void CommitWindow(cWindow *Window) = 0; - // Write any modified data and color definitions to the OSD hardware. - // Use the window's Dirty() function to find out which area of data - // actually needs to be transferred. If the window has not yet been explicitly - // shown through a call to ShowWindow(), no visible activity shall take place. - virtual void ShowWindow(cWindow *Window) = 0; - // Make the window actually visible on the OSD hardware. - virtual void HideWindow(cWindow *Window, bool Hide) = 0; - // Temporarily hide the window (if 'Hide' is 'true') or make a previously - // hidden window visible again (if 'Hide' is 'false'). - virtual void MoveWindow(cWindow *Window, int x, int y) = 0; - // Move the window to a new location. - virtual void CloseWindow(cWindow *Window) = 0; - // Close the window and release any OSD hardware resources allocated for it. + cSkinDisplayMenu *DisplayMenu(void) { return displayMenu; } + const char *hk(const char *s); + void SetHasHotkeys(void); + virtual void Clear(void); + bool SelectableItem(int idx); + void SetCurrent(cOsdItem *Item); + void RefreshCurrent(void); + void DisplayCurrent(bool Current); + void CursorUp(void); + void CursorDown(void); + void PageUp(void); + void PageDown(void); + void Mark(void); + eOSState HotKey(eKeys Key); + eOSState AddSubMenu(cOsdMenu *SubMenu); + eOSState CloseSubMenu(); + bool HasSubMenu(void) { return subMenu; } + void SetStatus(const char *s); + void SetTitle(const char *Title); + void SetHelp(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL); + virtual void Del(int Index); public: - cOsdBase(int x, int y); - // Initializes the OSD, starting at screen coordinates (x, y). - virtual ~cOsdBase(); - // Destroys all windows and shuts down the OSD. - tWindowHandle Create(int x, int y, int w, int h, int Bpp, bool ClearWithBackground = true, bool Tiled = true); - // Creates a window at coordinates (x, y), which are relative to the OSD's - // origin given in the constructor, with the given width, height and color - // depth. ClearWithBackground controls whether the window will be filled with - // clrBackground when it is cleared. Setting this to 'false' may be useful - // for windows that don't need clrBackground but want to save this color - // palette entry for a different color. Tiled controls whether this will - // be part of a multi section OSD (with several windows that all have - // different color depths and palettes and form one large OSD area), or - // whether this is a "standalone" window that will be drawn "in front" - // of any windows defined *after* this one (this can be used for highlighting - // certain parts of the OSD, as would be done in a 'cursor'). - // Returns a handle that can be used to identify this window. - void AddColor(eDvbColor Color, tWindowHandle Window = LAST_CREATED_WINDOW); - // Adds the Color to the color palette of the given window if it is not - // already contained in the palette (and if the palette still has free - // slots for new colors). The default value LAST_CREATED_WINDOW will - // access the most recently created window, without the need of explicitly - // using a window handle. - void Flush(void); - // Actually commits all data of all windows to the OSD. - void Clear(tWindowHandle Window = ALL_TILED_WINDOWS); - // Clears the given window. If ALL_TILED_WINDOWS is given, only the tiled - // windows will be cleared, leaving the standalone windows untouched. If - // ALL_WINDOWS is given, the standalone windows will also be cleared. - void Fill(int x1, int y1, int x2, int y2, eDvbColor Color, tWindowHandle Window = ALL_TILED_WINDOWS); - // Fills the rectangle defined by the upper left (x1, y2) and lower right - // (x2, y2) corners with the given Color. If a specific window is given, - // the coordinates are relative to that window's upper left corner. - // Otherwise they are relative to the upper left corner of the entire OSD. - // If all tiled windows are selected, only that window which contains the - // point (x1, y1) will actually be filled. - void SetBitmap(int x, int y, const cBitmap &Bitmap, tWindowHandle Window = ALL_TILED_WINDOWS); - // Sets the pixels within the given window with the data from the given - // Bitmap. See Fill() for details about the coordinates. - int Width(unsigned char c); - // Returns the width (in pixels) of the given character in the current font. - int Width(const char *s); - // Returns the width (in pixels) of the given string in the current font. - eDvbFont SetFont(eDvbFont Font); - // Sets the current font for subsequent Width() and Text() operations. - void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground, tWindowHandle Window = ALL_TILED_WINDOWS); - // Writes the given string at coordinates (x, y) with the given foreground - // and background color into the given window (see Fill() for details - // about the coordinates). - void Relocate(tWindowHandle Window, int x, int y, int NewWidth = -1, int NewHeight = -1); - // Moves the given window to the new location at (x, y). If NewWidth and - // NewHeight are also given, the window will also be resized to the new - // width and height. - void Hide(tWindowHandle Window); - // Hides the given window. - void Show(tWindowHandle Window); - // Shows the given window. + cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0); + virtual ~cOsdMenu(); + int Current(void) { return current; } + void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL); + void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL); + virtual void Display(void); + virtual eOSState ProcessKey(eKeys Key); }; #endif //__OSDBASE_H -- cgit v1.2.3