summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Hammerschmid <linux@home.pages.at>2002-08-21 12:38:54 +0200
committerMartin Hammerschmid <linux@home.pages.at>2002-08-21 12:38:54 +0200
commit2a3f6ddb352317d0f23624ca24fb8240d1cb5026 (patch)
treec310bf28a596b8994397939e47b50825b1dc2b73
parentb49a01e5a6304aeb0b6ad20c4d74468e7d19ef47 (diff)
downloadvdr-plugin-lcdproc-2a3f6ddb352317d0f23624ca24fb8240d1cb5026.tar.gz
vdr-plugin-lcdproc-2a3f6ddb352317d0f23624ca24fb8240d1cb5026.tar.bz2
-rw-r--r--lcd.c33
-rw-r--r--lcd.h2
-rw-r--r--lcdproc.c2
3 files changed, 27 insertions, 10 deletions
diff --git a/lcd.c b/lcd.c
index abd3e74..950f484 100644
--- a/lcd.c
+++ b/lcd.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
@@ -70,6 +71,7 @@ bool cLcd::Connect( char *host, unsigned int port ) {
, &wid, &hgt, &cellwid, &cellhgt) ) connected=true;
if ((hgt < 4 ) || (wid < 16)) connected = false; // 4 lines are needed, may work with more than 4 though
+ if ( (hgt==2) && (wid>31) ) { connected = true; wid=wid/2; LineMode=0; } // 2x40
if (!connected) { cLcd::Close(); return connected; }
sock_send_string(sock,"screen_add VDR\n"); sock_recv(sock, istring, 1024);
@@ -230,10 +232,15 @@ if (!connected) return;
cLcd::SetLine(Vol,2," ");
cLcd::SetLine(Vol,3," ");
} else {
- cLcd::SetLine(Vol,0,tr("Volume "));
+ if (hgt==2) {
+ cLcd::SetLine(Vol,0,"|---|---|---|---|---|---|---|---|---|---");
+ cLcd::SetLine(Vol,3," ");
+ } else {
+ cLcd::SetLine(Vol,0,tr("Volume "));
+ cLcd::SetLine(Vol,3,"|---|---|---|---|---|---|---|---|---|---");
+ }
cLcd::SetLine(Vol,1,"|---|---|---|---|---|---|---|---|---|---");
cLcd::SetLine(Vol,2," ");
- cLcd::SetLine(Vol,3,"|---|---|---|---|---|---|---|---|---|---");
}
}
@@ -257,8 +264,8 @@ void cLcd::SetProgress(const char *begin, const char *end, int percent) {
sprintf(workstring+wid-endw,"%s", end);
cLcd::SetLine(LCDREPLAY,3,workstring);
BeginMutualExclusion();
- ThreadStateData.barx=beginw+1;
- ThreadStateData.bary=4;
+ ThreadStateData.barx=beginw+1+((hgt==2)?wid:0);
+ ThreadStateData.bary=((hgt==2)?1:4);
ThreadStateData.barl=(percent*cellwid*(wid-beginw-endw))/100;
EndMutualExclusion();
LastProgress = t;
@@ -443,8 +450,13 @@ void cLcd::Write(int line, const char *string) { // used for any text output to
char workstring[256];
unsigned int i,out;
-
- sprintf(workstring,"widget_set VDR line%d 1 %d \"",line,line);
+ if (hgt > 2) {
+ sprintf(workstring,"widget_set VDR line%d 1 %d \"",line,line);
+ } else if (LineMode==0) {
+ sprintf(workstring,"widget_set VDR line%d %d %d \"",line,(line==2||line==4)?wid+1:1,(line<3)?1:2 );
+ } else {
+ sprintf(workstring,"widget_set VDR line%d %d %d \"",line,(line==3||line==4)?wid+1:1,(line==1||line==4)?1:2);
+ }
out=strlen(workstring);
for (i=0;(i<strlen(string)) && (i<wid);i++)
workstring[out++] = LcdTransTbl[ (unsigned char) string[i] ]; // char mapping see lcdtranstbl.h
@@ -574,8 +586,8 @@ void cLcd::Action(void) { // LCD output thread
OutStateData.barx=1; OutStateData.bary=1; OutStateData.barl=0; volume=false;
} else {
volume=true;
- OutStateData.barx=1; OutStateData.bary=3;
- OutStateData.barl=(cellwid*wid*OutStateData.volume)/255;
+ OutStateData.barx=1; OutStateData.bary=((hgt==2)?2:3);
+ OutStateData.barl=(cellwid*((hgt==2)?2:1)*wid*OutStateData.volume)/255;
}
}
if (volume) OutStateData.State = Vol;
@@ -584,6 +596,7 @@ void cLcd::Action(void) { // LCD output thread
switch (OutStateData.State) {
case Menu: // display menu = 0
+ LineMode=1;
if (PrevState != Menu) for (i=0;i<4;i++) Lcddirty[LCDMENU][i]=true;
for (i=0;i<4;i++) if (Lcddirty[LCDMENU][i]) {
cLcd::Write(i+1,OutStateData.lcdbuffer[LCDMENU][i]);
@@ -593,6 +606,7 @@ void cLcd::Action(void) { // LCD output thread
break;
case Title: // Display 'titlescsreen' = 1
+ LineMode=0;
if ( (now.tv_usec < WakeUpCycle) || (PrevState != Title) ) {
cLcd::GetTimeDateStat(workstring,OutStateData.CardStat);
cLcd::Write(1,workstring);
@@ -606,6 +620,7 @@ void cLcd::Action(void) { // LCD output thread
break;
case Replay: // Display date/time during replaying = 2
+ LineMode=1;
if ( (now.tv_usec < WakeUpCycle) || (PrevState != Replay) ) {
cLcd::GetTimeDateStat(workstring,OutStateData.CardStat);
cLcd::Write(1,workstring);
@@ -619,6 +634,7 @@ void cLcd::Action(void) { // LCD output thread
break;
case Misc: // Display messages = 3
+ LineMode=0;
if (PrevState != Misc) for (i=0;i<4;i++) Lcddirty[LCDMISC][i]=true;
for (i=0;i<4;i++) if (Lcddirty[LCDMISC][i]) {
cLcd::Write(i+1,OutStateData.lcdbuffer[LCDMISC][i]);
@@ -628,6 +644,7 @@ void cLcd::Action(void) { // LCD output thread
break;
case Vol: // Display Volume = 4
+ LineMode=0;
if (PrevState != Vol) for (i=0;i<4;i++) Lcddirty[LCDVOL][i]=true;
for (i=0;i<4;i++) if (Lcddirty[LCDVOL][i]) {
cLcd::Write(i+1,OutStateData.lcdbuffer[LCDVOL][i]);
diff --git a/lcd.h b/lcd.h
index 95efecd..bc3a44b 100644
--- a/lcd.h
+++ b/lcd.h
@@ -19,7 +19,7 @@ class cLcd : public cThread {
cDevice *primaryDvbApi;
enum ThreadStates {Menu=0, Title=1, Replay=2, Misc=3, Vol=4};
ThreadStates LastState[LCDMAXSTATEBUF];
- int LastStateP;
+ int LastStateP,LineMode;
struct StateData {
char lcdbuffer[LCDMAXSTATES][4][LCDMAXWID+1];
bool lcddirty[LCDMAXSTATES][4], muted, showvolume;
diff --git a/lcdproc.c b/lcdproc.c
index d20ff80..e556d0b 100644
--- a/lcdproc.c
+++ b/lcdproc.c
@@ -13,7 +13,7 @@
#include <vdr/recording.h>
#include "lcd.h"
-static const char *VERSION = "0.0.1";
+static const char *VERSION = "0.0.2";
static const char *MAINMENUENTRY = NULL;
#ifdef LCD_hd44780
static const char *DESCRIPTION = "LCDproc using hd44780 output-mapping";