mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed font for system commands
This commit is contained in:
parent
3e04208de3
commit
ca42f7c8f1
1
HISTORY
1
HISTORY
@ -281,6 +281,7 @@ Video Disk Recorder Revision History
|
||||
- There can now be a configuration file named 'commands.conf' that defines
|
||||
commands that can be executed through the "Main" menu's "Commands" option
|
||||
(see FORMATS for details on how to define these commands).
|
||||
- Added a 'fixed' font for use with the output of system commands.
|
||||
- The 'Priority' parameter of the timers is now also used to interrupt a low
|
||||
priority timer recording if a higher priority timer wants to record.
|
||||
- A timer recording on a DVB card with a CAM module will now be interrupted
|
||||
|
3
MANUAL
3
MANUAL
@ -295,7 +295,8 @@ Video Disk Recorder User's Manual
|
||||
enter the necessary command definition into 'commands.conf' and implement
|
||||
the actual command that will be called. Such a command can typically be a
|
||||
shell script or a Perl program. Anything that command writes to stdout will
|
||||
be displayed on a result screen after executing the command. In order to
|
||||
be displayed on a result screen after executing the command. This screen will
|
||||
use a 'fixed' font so that you can generate formatted output. In order to
|
||||
avoid error messages going to stderr, command definitions should redirect
|
||||
stderr to stdout (see FORMATS).
|
||||
|
||||
|
15
Makefile
15
Makefile
@ -4,7 +4,7 @@
|
||||
# See the main source file 'vdr.c' for copyright information and
|
||||
# how to reach the author.
|
||||
#
|
||||
# $Id: Makefile 1.15 2000/11/11 09:59:56 kls Exp $
|
||||
# $Id: Makefile 1.16 2000/11/18 14:58:10 kls Exp $
|
||||
|
||||
DVBDIR = ../DVB
|
||||
|
||||
@ -13,6 +13,7 @@ OBJS = config.o dvbapi.o dvbosd.o eit.o font.o i18n.o interface.o menu.o osd.o\
|
||||
recording.o remote.o svdrp.o thread.o tools.o vdr.o videodir.o
|
||||
|
||||
OSDFONT = -adobe-helvetica-medium-r-normal--23-*-100-100-p-*-iso8859-1
|
||||
FIXFONT = -adobe-courier-bold-r-normal--25-*-100-100-m-*-iso8859-1
|
||||
|
||||
ifndef REMOTE
|
||||
REMOTE = KBD
|
||||
@ -25,8 +26,8 @@ DEFINES += -DDEBUG_OSD
|
||||
endif
|
||||
|
||||
all: vdr
|
||||
font: genfontfile fontosd.c
|
||||
@echo "font file created."
|
||||
font: genfontfile fontfix.c fontosd.c
|
||||
@echo "font files created."
|
||||
|
||||
# Implicit rules:
|
||||
|
||||
@ -39,7 +40,7 @@ config.o : config.c config.h dvbapi.h dvbosd.h eit.h font.h i18n.h interface.h
|
||||
dvbapi.o : dvbapi.c config.h dvbapi.h dvbosd.h eit.h font.h interface.h remote.h svdrp.h thread.h tools.h videodir.h
|
||||
dvbosd.o : dvbosd.c dvbosd.h font.h tools.h
|
||||
eit.o : eit.c eit.h thread.h tools.h
|
||||
font.o : font.c font.h fontosd.c tools.h
|
||||
font.o : font.c font.h fontfix.c fontosd.c tools.h
|
||||
i18n.o : i18n.c config.h dvbapi.h dvbosd.h eit.h font.h i18n.h thread.h tools.h
|
||||
interface.o: interface.c config.h dvbapi.h dvbosd.h eit.h font.h i18n.h interface.h remote.h svdrp.h thread.h tools.h
|
||||
menu.o : menu.c config.h dvbapi.h dvbosd.h eit.h font.h i18n.h interface.h menu.h osd.h recording.h remote.h svdrp.h thread.h tools.h
|
||||
@ -57,8 +58,10 @@ videodir.o : videodir.c tools.h videodir.h
|
||||
vdr: $(OBJS)
|
||||
g++ -g -O2 $(OBJS) -lncurses -ljpeg -lpthread -o vdr
|
||||
|
||||
# The font file:
|
||||
# The font files:
|
||||
|
||||
fontfix.c:
|
||||
genfontfile "cFont::tPixelData FontFix" $(FIXFONT) > $@
|
||||
fontosd.c:
|
||||
genfontfile "cFont::tPixelData FontOsd" $(OSDFONT) > $@
|
||||
|
||||
@ -74,4 +77,4 @@ genfontfile: genfontfile.o
|
||||
clean:
|
||||
-rm -f $(OBJS) vdr genfontfile genfontfile.o
|
||||
CLEAN: clean
|
||||
-rm -f fontosd.c
|
||||
-rm -f fontfix.c fontosd.c
|
||||
|
11
dvbapi.c
11
dvbapi.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbapi.c 1.38 2000/11/18 13:46:46 kls Exp $
|
||||
* $Id: dvbapi.c 1.39 2000/11/18 15:30:57 kls Exp $
|
||||
*/
|
||||
|
||||
#include "dvbapi.h"
|
||||
@ -1632,6 +1632,15 @@ int cDvbApi::WidthInCells(const char *s)
|
||||
#endif
|
||||
}
|
||||
|
||||
eDvbFont cDvbApi::SetFont(eDvbFont Font)
|
||||
{
|
||||
#ifdef DEBUG_OSD
|
||||
return Font;
|
||||
#else
|
||||
return osd->SetFont(Font);
|
||||
#endif
|
||||
}
|
||||
|
||||
void cDvbApi::Text(int x, int y, const char *s, eDvbColor colorFg, eDvbColor colorBg)
|
||||
{
|
||||
if (x < 0) x = cols + x;
|
||||
|
3
dvbapi.h
3
dvbapi.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbapi.h 1.24 2000/11/18 13:46:10 kls Exp $
|
||||
* $Id: dvbapi.h 1.25 2000/11/18 15:30:09 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __DVBAPI_H
|
||||
@ -131,6 +131,7 @@ public:
|
||||
int CellWidth(void);
|
||||
int Width(unsigned char c);
|
||||
int WidthInCells(const char *s);
|
||||
eDvbFont SetFont(eDvbFont Font);
|
||||
void Text(int x, int y, const char *s, eDvbColor colorFg = clrWhite, eDvbColor colorBg = clrBackground);
|
||||
void Flush(void);
|
||||
|
||||
|
14
dvbosd.c
14
dvbosd.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbosd.c 1.5 2000/11/05 12:53:09 kls Exp $
|
||||
* $Id: dvbosd.c 1.6 2000/11/18 15:36:51 kls Exp $
|
||||
*/
|
||||
|
||||
#include "dvbosd.h"
|
||||
@ -21,6 +21,7 @@ cBitmap::cBitmap(int Width, int Height)
|
||||
width = Width;
|
||||
height = Height;
|
||||
bitmap = NULL;
|
||||
fontType = fontOsd;
|
||||
font = NULL;
|
||||
if (width > 0 && height > 0) {
|
||||
bitmap = new char[width * height];
|
||||
@ -42,10 +43,15 @@ cBitmap::~cBitmap()
|
||||
delete bitmap;
|
||||
}
|
||||
|
||||
void cBitmap::SetFont(eDvbFont Font)
|
||||
eDvbFont cBitmap::SetFont(eDvbFont Font)
|
||||
{
|
||||
delete font;
|
||||
font = new cFont(Font);
|
||||
eDvbFont oldFont = fontType;
|
||||
if (fontType != Font || !font) {
|
||||
delete font;
|
||||
font = new cFont(Font);
|
||||
fontType = Font;
|
||||
}
|
||||
return oldFont;
|
||||
}
|
||||
|
||||
bool cBitmap::Dirty(void)
|
||||
|
5
dvbosd.h
5
dvbosd.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbosd.h 1.3 2000/11/05 12:53:31 kls Exp $
|
||||
* $Id: dvbosd.h 1.4 2000/11/18 15:25:25 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __DVBOSD_H
|
||||
@ -45,6 +45,7 @@ enum eDvbColor {
|
||||
class cBitmap {
|
||||
private:
|
||||
cFont *font;
|
||||
eDvbFont fontType;
|
||||
protected:
|
||||
int width, height;
|
||||
char *bitmap;
|
||||
@ -53,7 +54,7 @@ protected:
|
||||
public:
|
||||
cBitmap(int Width, int Height);
|
||||
virtual ~cBitmap();
|
||||
void SetFont(eDvbFont Font);
|
||||
eDvbFont SetFont(eDvbFont Font);
|
||||
bool Dirty(void);
|
||||
void SetPixel(int x, int y, eDvbColor Color);
|
||||
int Width(unsigned char c);
|
||||
|
16
font.c
16
font.c
@ -4,21 +4,27 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: font.c 1.1 2000/10/01 15:01:49 kls Exp $
|
||||
* $Id: font.c 1.2 2000/11/18 15:16:08 kls Exp $
|
||||
*/
|
||||
|
||||
#include "font.h"
|
||||
#include "tools.h"
|
||||
|
||||
#include "fontfix.c"
|
||||
#include "fontosd.c"
|
||||
|
||||
cFont::cFont(eDvbFont Font)//XXX
|
||||
cFont::cFont(eDvbFont Font)
|
||||
{
|
||||
|
||||
#define FONTINDEX(Name)\
|
||||
case font##Name: for (int i = 0; i < NUMCHARS; i++)\
|
||||
data[i] = (tCharData *)&Font##Name[i < 32 ? 0 : i - 32];\
|
||||
break;
|
||||
|
||||
switch (Font) {
|
||||
default:
|
||||
case fontOsd: for (int i = 0; i < NUMCHARS; i++)
|
||||
data[i] = (tCharData *)&FontOsd[i < 32 ? 0 : i - 32];
|
||||
break;
|
||||
FONTINDEX(Osd);
|
||||
FONTINDEX(Fix);
|
||||
// TODO others...
|
||||
}
|
||||
}
|
||||
|
3
font.h
3
font.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: font.h 1.1 2000/10/01 15:00:35 kls Exp $
|
||||
* $Id: font.h 1.2 2000/11/18 14:51:45 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __FONT_H
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
enum eDvbFont {
|
||||
fontOsd,
|
||||
fontFix,
|
||||
/* TODO as soon as we have the font files...
|
||||
fontTtxSmall,
|
||||
fontTtxLarge,
|
||||
|
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: interface.c 1.31 2000/11/11 12:13:35 kls Exp $
|
||||
* $Id: interface.c 1.32 2000/11/18 15:28:50 kls Exp $
|
||||
*/
|
||||
|
||||
#include "interface.h"
|
||||
@ -136,6 +136,11 @@ void cInterface::SetCols(int *c)
|
||||
}
|
||||
}
|
||||
|
||||
eDvbFont cInterface::SetFont(eDvbFont Font)
|
||||
{
|
||||
return cDvbApi::PrimaryDvbApi->SetFont(Font);
|
||||
}
|
||||
|
||||
char *cInterface::WrapText(const char *Text, int Width, int *Height)
|
||||
{
|
||||
// Wraps the Text to make it fit into the area defined by the given Width
|
||||
|
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: interface.h 1.19 2000/11/01 15:27:23 kls Exp $
|
||||
* $Id: interface.h 1.20 2000/11/18 15:27:59 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __INTERFACE_H
|
||||
@ -43,6 +43,7 @@ public:
|
||||
void Fill(int x, int y, int w, int h, eDvbColor color = clrBackground);
|
||||
void Flush(void);
|
||||
void SetCols(int *c);
|
||||
eDvbFont SetFont(eDvbFont Font);
|
||||
char *WrapText(const char *Text, int Width, int *Height);
|
||||
void Write(int x, int y, const char *s, eDvbColor FgColor = clrWhite, eDvbColor BgColor = clrBackground);
|
||||
void WriteText(int x, int y, const char *s, eDvbColor FgColor = clrWhite, eDvbColor BgColor = clrBackground);
|
||||
|
20
menu.c
20
menu.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: menu.c 1.50 2000/11/18 14:10:10 kls Exp $
|
||||
* $Id: menu.c 1.51 2000/11/18 15:42:39 kls Exp $
|
||||
*/
|
||||
|
||||
#include "menu.h"
|
||||
@ -757,8 +757,9 @@ private:
|
||||
char *text;
|
||||
int x, y, w, h, lines, offset;
|
||||
eDvbColor fgColor, bgColor;
|
||||
eDvbFont font;
|
||||
public:
|
||||
cMenuTextItem(const char *Text, int X, int Y, int W, int H = -1, eDvbColor FgColor = clrWhite, eDvbColor BgColor = clrBackground);
|
||||
cMenuTextItem(const char *Text, int X, int Y, int W, int H = -1, eDvbColor FgColor = clrWhite, eDvbColor BgColor = clrBackground, eDvbFont Font = fontOsd);
|
||||
~cMenuTextItem();
|
||||
int Height(void) { return h; }
|
||||
void Clear(void);
|
||||
@ -770,7 +771,7 @@ public:
|
||||
virtual eOSState ProcessKey(eKeys Key);
|
||||
};
|
||||
|
||||
cMenuTextItem::cMenuTextItem(const char *Text, int X, int Y, int W, int H, eDvbColor FgColor, eDvbColor BgColor)
|
||||
cMenuTextItem::cMenuTextItem(const char *Text, int X, int Y, int W, int H, eDvbColor FgColor, eDvbColor BgColor, eDvbFont Font)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
@ -778,8 +779,11 @@ cMenuTextItem::cMenuTextItem(const char *Text, int X, int Y, int W, int H, eDvbC
|
||||
h = H;
|
||||
fgColor = FgColor;
|
||||
bgColor = BgColor;
|
||||
font = Font;
|
||||
offset = 0;
|
||||
eDvbFont oldFont = Interface->SetFont(font);
|
||||
text = Interface->WrapText(Text, w - 1, &lines);
|
||||
Interface->SetFont(oldFont);
|
||||
if (h < 0)
|
||||
h = lines;
|
||||
}
|
||||
@ -798,6 +802,7 @@ void cMenuTextItem::Display(int Offset, eDvbColor FgColor, eDvbColor BgColor)
|
||||
{
|
||||
int l = 0;
|
||||
char *t = text;
|
||||
eDvbFont oldFont = Interface->SetFont(font);
|
||||
while (*t) {
|
||||
char *n = strchr(t, '\n');
|
||||
if (l >= offset) {
|
||||
@ -815,6 +820,7 @@ void cMenuTextItem::Display(int Offset, eDvbColor FgColor, eDvbColor BgColor)
|
||||
if (++l >= h + offset)
|
||||
break;
|
||||
}
|
||||
Interface->SetFont(oldFont);
|
||||
// scroll indicators use inverted color scheme!
|
||||
if (CanScrollUp()) Interface->Write(x + w - 1, y, "^", bgColor, fgColor);
|
||||
if (CanScrollDown()) Interface->Write(x + w - 1, y + h - 1, "v", bgColor, fgColor);
|
||||
@ -854,14 +860,14 @@ eOSState cMenuTextItem::ProcessKey(eKeys Key)
|
||||
|
||||
class cMenuText : public cOsdMenu {
|
||||
public:
|
||||
cMenuText(const char *Title, const char *Text);
|
||||
cMenuText(const char *Title, const char *Text, eDvbFont Font = fontOsd);
|
||||
virtual eOSState ProcessKey(eKeys Key);
|
||||
};
|
||||
|
||||
cMenuText::cMenuText(const char *Title, const char *Text)
|
||||
cMenuText::cMenuText(const char *Title, const char *Text, eDvbFont Font)
|
||||
:cOsdMenu(Title)
|
||||
{
|
||||
Add(new cMenuTextItem(Text, 1, 2, MenuColumns - 2, MAXOSDITEMS));
|
||||
Add(new cMenuTextItem(Text, 1, 2, MenuColumns - 2, MAXOSDITEMS, clrWhite, clrBackground, Font));
|
||||
}
|
||||
|
||||
eOSState cMenuText::ProcessKey(eKeys Key)
|
||||
@ -1596,7 +1602,7 @@ eOSState cMenuCommands::Execute(void)
|
||||
if (command) {
|
||||
const char *Result = command->Execute();
|
||||
if (Result)
|
||||
return AddSubMenu(new cMenuText(command->Title(), Result));
|
||||
return AddSubMenu(new cMenuText(command->Title(), Result, fontFix));
|
||||
}
|
||||
return osContinue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user