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

Made the width and height of the OSD configurable

This commit is contained in:
Klaus Schmidinger 2001-07-27 11:51:42 +02:00
parent 81919a6647
commit d008680ad7
12 changed files with 70 additions and 33 deletions

View File

@ -98,6 +98,7 @@ J
Stefan Huelswitt <huels@iname.com>
for fixing the repeat function with LIRC
for making the position of the channel display configurable
for making the width and height of the OSD configurable
Ulrich Röder <dynamite@efr-net.de>
for pointing out that there are channels that have a symbol rate higher than

View File

@ -582,3 +582,4 @@ Video Disk Recorder Revision History
Röder).
- Made the position of the channel display configurable (thanks to Stefan
Huelswitt).
- Made the width and height of the OSD configurable (thanks to Stefan Huelswitt).

3
MANUAL
View File

@ -369,6 +369,9 @@ Video Disk Recorder User's Manual
0 = bottom
1 = top
OSDwidth = 52 The width and height of the OSD .
OSDheight = 18 The valid ranges are width=40...56, height=12...21.
* Executing system commands
The "Main" menu option "Commands" allows you to execute any system commands

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.c 1.50 2001/07/27 10:43:40 kls Exp $
* $Id: config.c 1.51 2001/07/27 11:27:27 kls Exp $
*/
#include "config.h"
@ -774,6 +774,8 @@ cSetup::cSetup(void)
DefaultLifetime = 50;
VideoFormat = VIDEO_FORMAT_4_3;
ChannelInfoPos = 0;
OSDwidth = 52;
OSDheight = 18;
CurrentChannel = -1;
}
@ -801,6 +803,8 @@ bool cSetup::Parse(char *s)
else if (!strcasecmp(Name, "DefaultLifetime")) DefaultLifetime = atoi(Value);
else if (!strcasecmp(Name, "VideoFormat")) VideoFormat = atoi(Value);
else if (!strcasecmp(Name, "ChannelInfoPos")) ChannelInfoPos = atoi(Value);
else if (!strcasecmp(Name, "OSDwidth")) OSDwidth = atoi(Value);
else if (!strcasecmp(Name, "OSDheight")) OSDheight = atoi(Value);
else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value);
else
return false;
@ -863,6 +867,8 @@ bool cSetup::Save(const char *FileName)
fprintf(f, "DefaultLifetime = %d\n", DefaultLifetime);
fprintf(f, "VideoFormat = %d\n", VideoFormat);
fprintf(f, "ChannelInfoPos = %d\n", ChannelInfoPos);
fprintf(f, "OSDwidth = %d\n", OSDwidth);
fprintf(f, "OSDheight = %d\n", OSDheight);
fprintf(f, "CurrentChannel = %d\n", CurrentChannel);
f.Close();
isyslog(LOG_INFO, "saved setup to %s", FileName);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 1.53 2001/07/27 10:42:30 kls Exp $
* $Id: config.h 1.54 2001/07/27 11:28:49 kls Exp $
*/
#ifndef __CONFIG_H
@ -26,6 +26,11 @@
#define MAXPRIORITY 99
#define MAXLIFETIME 99
#define MINOSDWIDTH 40
#define MAXOSDWIDTH 56
#define MINOSDHEIGHT 12
#define MAXOSDHEIGHT 21
enum eKeys { // "Up" and "Down" must be the first two keys!
kUp,
kDown,
@ -278,6 +283,7 @@ public:
int DefaultPriority, DefaultLifetime;
int VideoFormat;
int ChannelInfoPos;
int OSDwidth, OSDheight;
int CurrentChannel;
cSetup(void);
bool Load(const char *FileName);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbapi.c 1.88 2001/07/27 10:49:51 kls Exp $
* $Id: dvbapi.c 1.89 2001/07/27 11:43:16 kls Exp $
*/
#include "dvbapi.h"
@ -1847,7 +1847,7 @@ void cDvbApi::SetColor(eDvbColor colorFg, eDvbColor colorBg)
void cDvbApi::Open(int w, int h)
{
int d = (h < 0) ? MenuLines + h : 0;
int d = (h < 0) ? Setup.OSDheight + h : 0;
h = abs(h);
cols = w;
rows = h;
@ -1870,8 +1870,8 @@ void cDvbApi::Open(int w, int h)
w *= charWidth;
h *= lineHeight;
d *= lineHeight;
int x = (720 - (MenuColumns - 1) * charWidth) / 2; //TODO PAL vs. NTSC???
int y = (576 - MenuLines * lineHeight) / 2 + d;
int x = (720 - (Setup.OSDwidth - 1) * charWidth) / 2; //TODO PAL vs. NTSC???
int y = (576 - Setup.OSDheight * lineHeight) / 2 + d;
//XXX
osd = new cDvbOsd(fd_osd, x, y);
//XXX TODO this should be transferred to the places where the individual windows are requested (there's too much detailed knowledge here!)
@ -1883,8 +1883,8 @@ void cDvbApi::Open(int w, int h)
}
else if (d == 0) { //XXX full menu
osd->Create(0, 0, w, lineHeight, 2);
osd->Create(0, lineHeight, w, (MenuLines - 3) * lineHeight, 2, true, clrBackground, clrCyan, clrWhite, clrBlack);
osd->Create(0, (MenuLines - 2) * lineHeight, w, 2 * lineHeight, 4);
osd->Create(0, lineHeight, w, (Setup.OSDheight - 3) * lineHeight, 2, true, clrBackground, clrCyan, clrWhite, clrBlack);
osd->Create(0, (Setup.OSDheight - 2) * lineHeight, w, 2 * lineHeight, 4);
}
else { //XXX progress display
/*XXX

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbapi.h 1.41 2001/07/22 11:48:15 kls Exp $
* $Id: dvbapi.h 1.42 2001/07/27 11:40:38 kls Exp $
*/
#ifndef __DVBAPI_H
@ -36,9 +36,6 @@ typedef struct CRect {
signed short x, y, width, height;
};
#define MenuLines 18
#define MenuColumns 52
const char *IndexToHMSF(int Index, bool WithFrame = false);
// Converts the given index to a string, optionally containing the frame number.
int HMSFToIndex(const char *HMSF);

18
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: i18n.c 1.24 2001/07/27 10:55:52 kls Exp $
* $Id: i18n.c 1.25 2001/07/27 11:30:02 kls Exp $
*
* Slovenian translations provided by Miha Setina <mihasetina@softhome.net>
* Italian translations provided by Alberto Carraro <bertocar@tin.it>
@ -802,6 +802,22 @@ const tPhrase Phrases[] = {
"", // TODO
"", // TODO
},
{ "OSDwidth",
"OSD Breite",
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
},
{ "OSDheight",
"OSD Höhe",
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
},
// The days of the week:
{ "MTWTFSS",
"MDMDFSS",

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: interface.c 1.37 2001/07/22 12:26:28 kls Exp $
* $Id: interface.c 1.38 2001/07/27 11:39:53 kls Exp $
*/
#include "interface.h"
@ -44,9 +44,14 @@ cInterface::~cInterface()
void cInterface::Open(int NumCols, int NumLines)
{
if (!open++)
if (!open++) {
if (NumCols == 0)
NumCols = Setup.OSDwidth;
if (NumLines == 0)
NumLines = Setup.OSDheight;
cDvbApi::PrimaryDvbApi->Open(width = NumCols, height = NumLines);
}
}
void cInterface::Close(void)
{
@ -289,7 +294,7 @@ void cInterface::Status(const char *s, eDvbColor FgColor, eDvbColor BgColor)
void cInterface::Info(const char *s)
{
Open(MenuColumns, -1);
Open(Setup.OSDwidth, -1);
isyslog(LOG_INFO, "info: %s", s);
Status(s, clrWhite, clrGreen);
Wait();
@ -299,7 +304,7 @@ void cInterface::Info(const char *s)
void cInterface::Error(const char *s)
{
Open(MenuColumns, -1);
Open(Setup.OSDwidth, -1);
esyslog(LOG_ERR, "ERROR: %s", s);
Status(s, clrWhite, clrRed);
Wait();

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: interface.h 1.21 2000/12/09 10:48:41 kls Exp $
* $Id: interface.h 1.22 2001/07/27 11:38:01 kls Exp $
*/
#ifndef __INTERFACE_H
@ -32,7 +32,7 @@ private:
public:
cInterface(int SVDRPport = 0);
~cInterface();
void Open(int NumCols = MenuColumns, int NumLines = MenuLines);
void Open(int NumCols = 0, int NumLines = 0);
void Close(void);
int Width(void) { return width; }
int Height(void) { return height; }

24
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.82 2001/07/27 10:54:21 kls Exp $
* $Id: menu.c 1.83 2001/07/27 11:51:42 kls Exp $
*/
#include "menu.h"
@ -874,7 +874,7 @@ public:
cMenuText::cMenuText(const char *Title, const char *Text, eDvbFont Font)
:cOsdMenu(Title)
{
Add(new cMenuTextItem(Text, 1, 2, MenuColumns - 2, MAXOSDITEMS, clrWhite, clrBackground, Font));
Add(new cMenuTextItem(Text, 1, 2, Setup.OSDwidth - 2, MAXOSDITEMS, clrWhite, clrBackground, Font));
}
eOSState cMenuText::ProcessKey(eKeys Key)
@ -1143,20 +1143,20 @@ cMenuEvent::cMenuEvent(const cEventInfo *EventInfo, bool CanSwitch)
// like all the others? Well, at least like those who actually send the full range
// of information (like, e.g., 'Sat.1'). Some stations (like 'RTL') don't even
// bother sending anything but the 'Title'...
if (isempty(ExtendedDescription) && !isempty(Subtitle) && strlen(Subtitle) > 2 * MenuColumns) {
if (isempty(ExtendedDescription) && !isempty(Subtitle) && int(strlen(Subtitle)) > 2 * Setup.OSDwidth) {
ExtendedDescription = Subtitle;
Subtitle = NULL;
}
if (!isempty(Title)) {
Add(item = new cMenuTextItem(Title, 1, Line, MenuColumns - 2, -1, clrCyan));
Add(item = new cMenuTextItem(Title, 1, Line, Setup.OSDwidth - 2, -1, clrCyan));
Line += item->Height() + 1;
}
if (!isempty(Subtitle)) {
Add(item = new cMenuTextItem(Subtitle, 1, Line, MenuColumns - 2, -1, clrYellow));
Add(item = new cMenuTextItem(Subtitle, 1, Line, Setup.OSDwidth - 2, -1, clrYellow));
Line += item->Height() + 1;
}
if (!isempty(ExtendedDescription))
Add(new cMenuTextItem(ExtendedDescription, 1, Line, MenuColumns - 2, Height() - Line - 2, clrCyan), true);
Add(new cMenuTextItem(ExtendedDescription, 1, Line, Setup.OSDwidth - 2, Height() - Line - 2, clrCyan), true);
SetHelp(tr("Record"), NULL, NULL, CanSwitch ? tr("Switch") : NULL);
}
}
@ -1627,6 +1627,8 @@ void cMenuSetup::Set(void)
Add(new cMenuEditIntItem( tr("DefaultLifetime"), &data.DefaultLifetime, 0, MAXLIFETIME));
Add(new cMenuEditBoolItem(tr("VideoFormat"), &data.VideoFormat, "4:3", "16:9"));
Add(new cMenuEditBoolItem(tr("ChannelInfoPos"), &data.ChannelInfoPos, tr("bottom"), tr("top")));
Add(new cMenuEditIntItem( tr("OSDwidth"), &data.OSDwidth, MINOSDWIDTH, MAXOSDWIDTH));
Add(new cMenuEditIntItem( tr("OSDheight"), &data.OSDheight, MINOSDHEIGHT, MAXOSDHEIGHT));
}
eOSState cMenuSetup::ProcessKey(eKeys Key)
@ -1803,7 +1805,7 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched, bool Group)
lines = 0;
oldNumber = number = 0;
cChannel *channel = Group ? Channels.Get(Number) : Channels.GetByNumber(Number);
Interface->Open(MenuColumns, Setup.ChannelInfoPos ? 5 : -5);
Interface->Open(Setup.OSDwidth, Setup.ChannelInfoPos ? 5 : -5);
if (channel) {
DisplayChannel(channel);
DisplayInfo();
@ -1817,7 +1819,7 @@ cDisplayChannel::cDisplayChannel(eKeys FirstKey)
oldNumber = cDvbApi::CurrentChannel();
number = 0;
lastTime = time_ms();
Interface->Open(MenuColumns, Setup.ChannelInfoPos ? 5 : -5);
Interface->Open(Setup.OSDwidth, Setup.ChannelInfoPos ? 5 : -5);
ProcessKey(FirstKey);
}
@ -1838,7 +1840,7 @@ void cDisplayChannel::DisplayChannel(const cChannel *Channel)
snprintf(buffer, BufSize, "%d%s %s", Channel->number, number ? "-" : "", Channel->name);
else
snprintf(buffer, BufSize, "%s", Channel ? Channel->name : tr("*** Invalid Channel ***"));
Interface->Fill(0, 0, MenuColumns, 1, clrBackground);
Interface->Fill(0, 0, Setup.OSDwidth, 1, clrBackground);
Interface->Write(0, 0, buffer);
time_t t = time(NULL);
struct tm *now = localtime(&t);
@ -1876,7 +1878,7 @@ void cDisplayChannel::DisplayInfo(void)
if (Lines > lines) {
const int t = 6;
int l = 1;
Interface->Fill(0, 1, MenuColumns, Lines, clrBackground);
Interface->Fill(0, 1, Setup.OSDwidth, Lines, clrBackground);
if (!isempty(PresentTitle)) {
Interface->Write(0, l, Present->GetTimeString(), clrYellow, clrBackground);
Interface->Write(t, l, PresentTitle, clrCyan, clrBackground);
@ -2177,7 +2179,7 @@ void cReplayControl::ClearLastReplayed(const char *FileName)
void cReplayControl::Show(void)
{
if (!visible) {
Interface->Open(MenuColumns, -3);
Interface->Open(Setup.OSDwidth, -3);
needsFastResponse = visible = true;
shown = ShowProgress(true);
}

4
osd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.h 1.21 2001/06/02 09:04:19 kls Exp $
* $Id: osd.h 1.22 2001/07/27 11:33:30 kls Exp $
*/
#ifndef __OSD_H
@ -14,7 +14,7 @@
#include "interface.h"
#include "tools.h"
#define MAXOSDITEMS (MenuLines - 4)
#define MAXOSDITEMS (Setup.OSDheight - 4)
enum eOSState { osUnknown,
osMenu,