1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added cSkin::GetTextAreaWidth() and cSkin::GetTextAreaFont()

This commit is contained in:
Klaus Schmidinger 2006-02-05 15:09:51 +01:00
parent 36b720b1cf
commit c5a5f09845
6 changed files with 57 additions and 8 deletions

View File

@ -1611,6 +1611,7 @@ Alexander Rieger <Alexander.Rieger@inka.de>
for fixing handling color buttons in cMenuEditStrItem
for making the '.update' file in the video directory be touched when a recording is
added or deleted, so that other VDR instances can update their lists
for adding cSkin::GetTextAreaWidth() and cSkin::GetTextAreaFont()
Philip Prindeville <philipp_subx@redfish-solutions.com>
for updates to 'sources.conf'

View File

@ -4314,3 +4314,5 @@ Video Disk Recorder Revision History
- Made all font and image data 'const' (thanks to Darren Salt).
- Fixed scrolling with Up/Down in case there are non-selectable items at the
beginning or end of the menu (reported by Helmut Auer).
- Added cSkin::GetTextAreaWidth() and cSkin::GetTextAreaFont(), so that a plugin
that wants to do special text formatting can do so (thanks to Alexander Rieger).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skinclassic.c 1.13 2006/01/01 14:37:58 kls Exp $
* $Id: skinclassic.c 1.14 2006/02/05 14:51:39 kls Exp $
*/
#include "skinclassic.h"
@ -169,6 +169,8 @@ public:
virtual void SetEvent(const cEvent *Event);
virtual void SetRecording(const cRecording *Recording);
virtual void SetText(const char *Text, bool FixedFont);
virtual int GetTextAreaWidth(void) const;
virtual const cFont *GetTextAreaFont(bool FixedFont) const;
virtual void Flush(void);
};
@ -357,11 +359,20 @@ void cSkinClassicDisplayMenu::SetRecording(const cRecording *Recording)
void cSkinClassicDisplayMenu::SetText(const char *Text, bool FixedFont)
{
const cFont *font = cFont::GetFont(FixedFont ? fontFix : fontOsd);
textScroller.Set(osd, x0, y2, x1 - x0 - 2 * ScrollWidth, y3 - y2, Text, font, Theme.Color(clrMenuText), Theme.Color(clrBackground));
textScroller.Set(osd, x0, y2, GetTextAreaWidth(), y3 - y2, Text, GetTextAreaFont(FixedFont), Theme.Color(clrMenuText), Theme.Color(clrBackground));
SetScrollbar();
}
int cSkinClassicDisplayMenu::GetTextAreaWidth(void) const
{
return x1 - x0 - 2 * ScrollWidth;
}
const cFont *cSkinClassicDisplayMenu::GetTextAreaFont(bool FixedFont) const
{
return cFont::GetFont(FixedFont ? fontFix : fontOsd);
}
void cSkinClassicDisplayMenu::Flush(void)
{
cString date = DayDateTime();

12
skins.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skins.c 1.7 2006/01/08 11:40:18 kls Exp $
* $Id: skins.c 1.8 2006/02/05 14:53:04 kls Exp $
*/
#include "skins.h"
@ -108,6 +108,16 @@ const char *cSkinDisplayMenu::GetTabbedText(const char *s, int Tab)
return buffer;
}
int cSkinDisplayMenu::GetTextAreaWidth(void) const
{
return 0;
}
const cFont *cSkinDisplayMenu::GetTextAreaFont(bool) const
{
return NULL;
}
// --- cSkinDisplayReplay::cProgressBar --------------------------------------
cSkinDisplayReplay::cProgressBar::cProgressBar(int Width, int Height, int Current, int Total, const cMarks *Marks, tColor ColorSeen, tColor ColorRest, tColor ColorSelected, tColor ColorMark, tColor ColorCurrent)

15
skins.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skins.h 1.10 2006/01/08 11:40:21 kls Exp $
* $Id: skins.h 1.11 2006/02/05 14:59:57 kls Exp $
*/
#ifndef __SKINS_H
@ -160,6 +160,19 @@ public:
///< the Scroll() function will be called to drive scrolling that text if
///< necessary.
//XXX ??? virtual void SetHelp(const char *Help) = 0;
virtual int GetTextAreaWidth(void) const;
///< Returns the width in pixel of the area which is used to display text
///< with SetText(). The width of the area is the width of the central area
///< minus the width of any possibly displayed scroll-bar or other decoration.
///< The default implementation returns 0. Therefore a caller of this method
///< must be prepared to receive 0 if the plugin doesn't implement this method.
virtual const cFont *GetTextAreaFont(bool FixedFont) const;
///< Returns a pointer to the font which is used to display text with SetText().
///< The parameter FixedFont has the same meaning as in SetText(). The default
///< implementation returns NULL. Therefore a caller of this method must be
///< prepared to receive NULL if the plugin doesn't implement this method.
///< The returned pointer is valid a long as the instance of cSkinDisplayMenu
///< exists.
};
class cSkinDisplayReplay : public cSkinDisplay {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skinsttng.c 1.17 2006/02/05 13:46:37 kls Exp $
* $Id: skinsttng.c 1.18 2006/02/05 14:51:39 kls Exp $
*/
// Star Trek: The Next Generation® is a registered trademark of Paramount Pictures
@ -347,6 +347,8 @@ public:
virtual void SetEvent(const cEvent *Event);
virtual void SetRecording(const cRecording *Recording);
virtual void SetText(const char *Text, bool FixedFont);
virtual int GetTextAreaWidth(void) const;
virtual const cFont *GetTextAreaFont(bool FixedFont) const;
virtual void Flush(void);
};
@ -617,11 +619,21 @@ void cSkinSTTNGDisplayMenu::SetRecording(const cRecording *Recording)
}
void cSkinSTTNGDisplayMenu::SetText(const char *Text, bool FixedFont)
{
textScroller.Set(osd, x3, y3, GetTextAreaWidth(), y4 - y3, Text, GetTextAreaFont(FixedFont), Theme.Color(clrMenuText), Theme.Color(clrBackground));
SetScrollbar();
}
int cSkinSTTNGDisplayMenu::GetTextAreaWidth(void) const
{
return x4 - x3;
}
const cFont *cSkinSTTNGDisplayMenu::GetTextAreaFont(bool FixedFont) const
{
const cFont *font = cFont::GetFont(FixedFont ? fontFix : fontOsd);
font = cFont::GetFont(fontSml);//XXX -> make a way to let the text define which font to use
textScroller.Set(osd, x3, y3, x4 - x3, y4 - y3, Text, font, Theme.Color(clrMenuText), Theme.Color(clrBackground));
SetScrollbar();
return font;
}
void cSkinSTTNGDisplayMenu::Flush(void)