[lcd4linux @ 2001-03-16 16:40:17 by ltoetsch]

implemented time bar

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@127 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
This commit is contained in:
ltoetsch
2001-03-16 16:40:17 +00:00
parent 8cb47a24a9
commit 3d24b9bd46
12 changed files with 112 additions and 24 deletions
+2
View File
@@ -49,3 +49,5 @@ lcd4linux-0.98
- added another verbose level (-vvv) for debugging socket traffic
- added nntp support for count of news/unread messages in subscribed NGs
- implemented time series bar '$t'
+5 -2
View File
@@ -1,4 +1,4 @@
/* $Id: PalmPilot.c,v 1.4 2001/02/13 09:00:13 reinelt Exp $
/* $Id: PalmPilot.c,v 1.5 2001/03/16 16:40:17 ltoetsch Exp $
*
* driver for 3Com Palm Pilot
*
@@ -20,6 +20,9 @@
*
*
* $Log: PalmPilot.c,v $
* Revision 1.5 2001/03/16 16:40:17 ltoetsch
* implemented time bar
*
* Revision 1.4 2001/02/13 09:00:13 reinelt
*
* prepared framework for GPO's (general purpose outputs)
@@ -66,7 +69,7 @@
#include "display.h"
#include "pixmap.h"
#define BARS ( BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 )
#define BARS ( BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 | BAR_T)
static LCD Lcd;
static char *Port=NULL;
+6 -1
View File
@@ -1,5 +1,5 @@
#
# $Id: README,v 1.19 2001/03/15 14:25:05 ltoetsch Exp $
# $Id: README,v 1.20 2001/03/16 16:40:17 ltoetsch Exp $
#
This is the README file for lcd4linux
@@ -207,6 +207,11 @@ Display options:
(down). If you specify the direction in upper case, a logarithmic bar will
be created. note that the space occupied by a bar always grows from left
to right or from top to bottom, regardless of the direction!
'$t<height><token>,<width> will create a time series bar. The data are
displayed like '$u', but are shifted every second 1 pixel to the
left. Currently only displays based on the pixel-driver support this
bar type.
Tokens:
+5 -2
View File
@@ -1,4 +1,4 @@
/* $Id: Raster.c,v 1.17 2001/03/12 12:39:36 reinelt Exp $
/* $Id: Raster.c,v 1.18 2001/03/16 16:40:17 ltoetsch Exp $
*
* driver for raster formats
*
@@ -20,6 +20,9 @@
*
*
* $Log: Raster.c,v $
* Revision 1.18 2001/03/16 16:40:17 ltoetsch
* implemented time bar
*
* Revision 1.17 2001/03/12 12:39:36 reinelt
*
* reworked autoconf a lot: drivers may be excluded, #define's went to config.h
@@ -131,7 +134,7 @@
#include "display.h"
#include "pixmap.h"
#define BARS ( BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 )
#define BARS ( BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 | BAR_T )
static LCD Lcd;
+4 -3
View File
@@ -1,8 +1,9 @@
ToDo-List / Wishlist for lcd4linux
2000-04-04 Michael Reinelt <reinelt@eunet.at>
implement some sort of 'graphs', similar to bars, but with a time axis
can be filled (made up of bars) or not (needs raster graphics)
// 2000-04-04 Michael Reinelt <reinelt@eunet.at>
// implement some sort of 'graphs', similar to bars, but with a time axis
// can be filled (made up of bars) or not (needs raster graphics)
// done 2001-03-16 -lt.
// 2000-04-04 Michael Reinelt <reinelt@eunet.at>
// write a driver for PNG. This should be the first step towards a WWW-driver.
+5 -2
View File
@@ -1,4 +1,4 @@
/* $Id: Text.c,v 1.3 2001/03/16 09:28:08 ltoetsch Exp $
/* $Id: Text.c,v 1.4 2001/03/16 16:40:17 ltoetsch Exp $
*
* pure ncurses based text driver
*
@@ -20,6 +20,9 @@
*
*
* $Log: Text.c,v $
* Revision 1.4 2001/03/16 16:40:17 ltoetsch
* implemented time bar
*
* Revision 1.3 2001/03/16 09:28:08 ltoetsch
* bugfixes
*
@@ -77,7 +80,7 @@ extern int foreground;
static LCD Lcd;
static WINDOW *w;
WINDOW *err_win;
#define BARS ( BAR_R | BAR_H2 )
#define BARS ( BAR_R | BAR_H2 | BAR_T )
int err_rows;
int Text_clear (void)
+5 -2
View File
@@ -1,4 +1,4 @@
/* $Id: XWindow.c,v 1.24 2001/03/01 11:08:16 reinelt Exp $
/* $Id: XWindow.c,v 1.25 2001/03/16 16:40:17 ltoetsch Exp $
*
* X11 Driver for LCD4Linux
*
@@ -20,6 +20,9 @@
*
*
* $Log: XWindow.c,v $
* Revision 1.25 2001/03/16 16:40:17 ltoetsch
* implemented time bar
*
* Revision 1.24 2001/03/01 11:08:16 reinelt
*
* reworked configure to allow selection of drivers
@@ -148,7 +151,7 @@ union semun {
};
#endif
#define BARS ( BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 )
#define BARS ( BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 | BAR_T)
static LCD Lcd;
static Display *dp;
+7 -3
View File
@@ -1,4 +1,4 @@
/* $Id: display.c,v 1.27 2001/03/15 14:25:05 ltoetsch Exp $
/* $Id: display.c,v 1.28 2001/03/16 16:40:17 ltoetsch Exp $
*
* framework for device drivers
*
@@ -20,6 +20,9 @@
*
*
* $Log: display.c,v $
* Revision 1.28 2001/03/16 16:40:17 ltoetsch
* implemented time bar
*
* Revision 1.27 2001/03/15 14:25:05 ltoetsch
* added unread/total news
*
@@ -291,10 +294,11 @@ int lcd_bar (int type, int row, int col, int max, int len1, int len2)
{
if (row<1 || row>Lcd->rows) return -1;
if (col<1 || col>Lcd->cols) return -1;
if (!(type & (BAR_H2 | BAR_V2))) len2=len1;
if (!(type & (BAR_H2 | BAR_V2 | BAR_T))) len2=len1;
if (type & BAR_LOG) {
len1=(double)max*log(len1+1)/log(max);
len2=(double)max*log(len2+1)/log(max);
if (!(type & BAR_T))
len2=(double)max*log(len2+1)/log(max);
}
if (Lcd->put==NULL) return 0;
return Lcd->bar (type & BAR_HV, row-1, col-1, max, len1, len2);
+6 -2
View File
@@ -1,4 +1,4 @@
/* $Id: display.h,v 1.13 2001/02/14 07:40:16 reinelt Exp $
/* $Id: display.h,v 1.14 2001/03/16 16:40:17 ltoetsch Exp $
*
* framework for device drivers
*
@@ -20,6 +20,9 @@
*
*
* $Log: display.h,v $
* Revision 1.14 2001/03/16 16:40:17 ltoetsch
* implemented time bar
*
* Revision 1.13 2001/02/14 07:40:16 reinelt
*
* first (incomplete) GPO implementation
@@ -88,9 +91,10 @@
#define BAR_H2 (1<<4)
#define BAR_V2 (1<<5)
#define BAR_LOG (1<<6)
#define BAR_T (1<<7)
#define BAR_H (BAR_L | BAR_R)
#define BAR_V (BAR_U | BAR_D)
#define BAR_V (BAR_U | BAR_D | BAR_T)
#define BAR_HV (BAR_H | BAR_V)
typedef struct LCD {
+9 -2
View File
@@ -1,4 +1,4 @@
/* $Id: parser.c,v 1.15 2001/03/14 13:19:29 ltoetsch Exp $
/* $Id: parser.c,v 1.16 2001/03/16 16:40:17 ltoetsch Exp $
*
* row definition parser
*
@@ -20,6 +20,9 @@
*
*
* $Log: parser.c,v $
* Revision 1.16 2001/03/16 16:40:17 ltoetsch
* implemented time bar
*
* Revision 1.15 2001/03/14 13:19:29 ltoetsch
* Added pop3/imap4 mail support
*
@@ -181,6 +184,8 @@ static int bar_type (char tag)
return BAR_U;
case 'd':
return BAR_D;
case 't':
return BAR_T;
default:
return 0;
}
@@ -272,6 +277,8 @@ char *parse_row (char *string, int supported_bars, int usage[])
break;
}
}
else if (*s == ',' && (type & BAR_T))
token2=strtol(++s, &s, 10); /* get horizontal length */
*p++='$';
*p++=type;
*p++=len;
@@ -279,7 +286,7 @@ char *parse_row (char *string, int supported_bars, int usage[])
if (token>256) *p++=token>>8;
if (token2!=-1) {
*p++=token2&255;
if (token>256) *p++=token2>>8;
if (token>256 && !(type & BAR_T)) *p++=token2>>8;
}
break;
+50 -4
View File
@@ -1,4 +1,4 @@
/* $Id: pixmap.c,v 1.5 2000/03/26 18:46:28 reinelt Exp $
/* $Id: pixmap.c,v 1.6 2001/03/16 16:40:17 ltoetsch Exp $
*
* generic pixmap driver
*
@@ -20,6 +20,9 @@
*
*
* $Log: pixmap.c,v $
* Revision 1.6 2001/03/16 16:40:17 ltoetsch
* implemented time bar
*
* Revision 1.5 2000/03/26 18:46:28 reinelt
*
* bug in pixmap.c that leaded to empty bars fixed
@@ -67,10 +70,12 @@
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "display.h"
#include "pixmap.h"
#include "fontmap.h"
#include "debug.h"
static int ROWS=0;
static int COLS=0;
@@ -136,6 +141,10 @@ int pix_put (int row, int col, char *text)
int pix_bar (int type, int row, int col, int max, int len1, int len2)
{
int x, y, len, rev;
static int *valbuf = NULL;
static int init = 0;
static time_t old;
time_t now;
row*=YRES;
col*=XRES;
@@ -150,9 +159,24 @@ int pix_bar (int type, int row, int col, int max, int len1, int len2)
if (len1<1) len1=1;
else if (len1>max) len1=max;
if (len2<1) len2=1;
else if (len2>max) len2=max;
if (type == BAR_T) {
if (init == 0 && valbuf == 0) {
valbuf = calloc(len2, sizeof(int));
if (valbuf == NULL) {
error("Couldn't allocte valbuf");
init = -1;
return -1;
}
init = 1;
debug("valbuf ok, len2=%d", len2);
time(&old);
}
}
else {
if (len2<1) len2=1;
else if (len2>max) len2=max;
}
rev=0;
@@ -185,6 +209,28 @@ int pix_bar (int type, int row, int col, int max, int len1, int len2)
}
break;
case BAR_T:
len1=max-len1;
rev=1;
time(&now);
if (now == old) {
valbuf[len2-1] += len1;
valbuf[len2-1] /= 2;
}
else {
for (; old < now; old++)
for (x=1; x<len2; x++)
valbuf[x-1]=valbuf[x];
valbuf[len2-1] = len1;
}
for (x=0; x<len2; x++) {
len = valbuf[x];
for (y=0; y<max; y++) {
LCDpixmap[(row+y)*COLS+col+x]=y<len?!rev:rev;
}
}
break;
}
return 0;
}
+8 -1
View File
@@ -1,4 +1,4 @@
/* $Id: processor.c,v 1.23 2001/03/16 09:28:08 ltoetsch Exp $
/* $Id: processor.c,v 1.24 2001/03/16 16:40:17 ltoetsch Exp $
*
* main data processing
*
@@ -20,6 +20,9 @@
*
*
* $Log: processor.c,v $
* Revision 1.24 2001/03/16 16:40:17 ltoetsch
* implemented time bar
*
* Revision 1.23 2001/03/16 09:28:08 ltoetsch
* bugfixes
*
@@ -585,8 +588,12 @@ static char *process_row (int r)
if (token>T_EXTENDED) token += (*(unsigned char*)++s)<<8;
val2=query_bar(token);
}
else if (type & BAR_T)
val2 = *(unsigned char*)++s; /* width */
if (type & BAR_H)
lcd_bar (type, r, p-buffer+1, len*xres, val1*len*xres, val2*len*xres);
else if (type & BAR_T)
lcd_bar (type, r, p-buffer+1, len*xres, val1*len*yres, val2*xres);
else
lcd_bar (type, r, p-buffer+1, len*yres, val1*len*yres, val2*len*yres);