From 955c709b2271e3ab54ca5095e2d94199aa94fbc7 Mon Sep 17 00:00:00 2001 From: reinelt <> Date: Fri, 19 Sep 2003 03:51:29 +0000 Subject: [lcd4linux @ 2003-09-19 03:51:29 by reinelt] minor fixes, widget.c added --- Makefile.am | 1 + Makefile.in | 8 ++--- TODO | 4 +++ icon.c | 21 +++++-------- widget.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ widget.h | 41 ++++++++++++++++++++++++ 6 files changed, 160 insertions(+), 17 deletions(-) create mode 100644 widget.c create mode 100644 widget.h diff --git a/Makefile.am b/Makefile.am index e219b5f..b00622f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,6 +32,7 @@ filter.c filter.h \ udelay.c udelay.h \ display.c display.h \ pixmap.c pixmap.h \ +widget.c widget.h \ bar.c bar.h \ icon.c icon.h \ fontmap.c fontmap.h \ diff --git a/Makefile.in b/Makefile.in index 230443b..32a1c29 100644 --- a/Makefile.in +++ b/Makefile.in @@ -88,7 +88,7 @@ lcd4linux_LDFLAGS = $(X_LIBS) lcd4linux_LDADD = @DRIVERS@ @DRVLIBS@ lcd4linux_DEPENDENCIES = @DRIVERS@ -lcd4linux_SOURCES = lcd4linux.c debug.c debug.h cfg.c cfg.h lock.c lock.h pid.c pid.h parser.c parser.h processor.c processor.h system.c system.h isdn.c isdn.h mail.c mail.h seti.c seti.h battery.c battery.h dvb.c dvb.h filter.c filter.h udelay.c udelay.h display.c display.h pixmap.c pixmap.h bar.c bar.h icon.c icon.h fontmap.c fontmap.h exec.c exec.h mail2.c socket.c socket.h +lcd4linux_SOURCES = lcd4linux.c debug.c debug.h cfg.c cfg.h lock.c lock.h pid.c pid.h parser.c parser.h processor.c processor.h system.c system.h isdn.c isdn.h mail.c mail.h seti.c seti.h battery.c battery.h dvb.c dvb.h filter.c filter.h udelay.c udelay.h display.c display.h pixmap.c pixmap.h widget.c widget.h bar.c bar.h icon.c icon.h fontmap.c fontmap.h exec.c exec.h mail2.c socket.c socket.h EXTRA_lcd4linux_SOURCES = parport.c parport.h BeckmannEgle.c Crystalfontz.c Cwlinux.c HD44780.c M50530.c T6963.c USBLCD.c MatrixOrbital.c PalmPilot.c Raster.c SIN.c Skeleton.c XWindow.c Text.c @@ -113,8 +113,8 @@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ lcd4linux_OBJECTS = lcd4linux.o debug.o cfg.o lock.o pid.o parser.o \ processor.o system.o isdn.o mail.o seti.o battery.o dvb.o filter.o \ -udelay.o display.o pixmap.o bar.o icon.o fontmap.o exec.o mail2.o \ -socket.o +udelay.o display.o pixmap.o widget.o bar.o icon.o fontmap.o exec.o \ +mail2.o socket.o CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -137,7 +137,7 @@ DEP_FILES = .deps/BeckmannEgle.P .deps/Crystalfontz.P .deps/Cwlinux.P \ .deps/fontmap.P .deps/icon.P .deps/isdn.P .deps/lcd4linux.P \ .deps/lock.P .deps/mail.P .deps/mail2.P .deps/parport.P .deps/parser.P \ .deps/pid.P .deps/pixmap.P .deps/processor.P .deps/seti.P \ -.deps/socket.P .deps/system.P .deps/udelay.P +.deps/socket.P .deps/system.P .deps/udelay.P .deps/widget.P SOURCES = $(lcd4linux_SOURCES) $(EXTRA_lcd4linux_SOURCES) OBJECTS = $(lcd4linux_OBJECTS) diff --git a/TODO b/TODO index aead6e4..285a735 100644 --- a/TODO +++ b/TODO @@ -133,3 +133,7 @@ don't know if displays support this feature... at least one of my HD44780 displays use an inverted "P" instead of a full block. Therefore a bar my look strange. Make the ASCII code of the full block configurable... + +2003-09-14 Markus +change %t tokens from Byte/sec to kB/sec, ith one decimal places. +Either make it configurabel, or add new tokens. diff --git a/icon.c b/icon.c index b52fe95..6e31276 100644 --- a/icon.c +++ b/icon.c @@ -1,4 +1,4 @@ -/* $Id: icon.c,v 1.7 2003/09/11 04:09:53 reinelt Exp $ +/* $Id: icon.c,v 1.8 2003/09/19 03:51:29 reinelt Exp $ * * generic icon and heartbeat handling * @@ -20,6 +20,9 @@ * * * $Log: icon.c,v $ + * Revision 1.8 2003/09/19 03:51:29 reinelt + * minor fixes, widget.c added + * * Revision 1.7 2003/09/11 04:09:53 reinelt * minor cleanups * @@ -143,28 +146,20 @@ int icon_init (int rows, int cols, int xres, int yres, int chars, int icons, CHARS=chars, ICONS=icons; - if (Screen) { - free (Screen); - } - if ((Screen=malloc(ROWS*COLS*sizeof(*Screen)))==NULL) { - error ("icon buffer allocation failed: out of memory"); + error ("icon buffer allocation failed: out of memory?"); return -1; } - icon_clear(); - - if (Bitmap) { - free (Bitmap); - } - if ((Bitmap=malloc(icons*sizeof(*Bitmap)))==NULL) { - error ("icon allocation failed: out of memory"); + error ("icon allocation failed: out of memory?"); return -1; } Defchar=defchar; + icon_clear(); + for (n=0; n +#include +#include + +#include "debug.h" +#include "cfg.h" +#include "widget.h" + +static int ROWS=0; +static int COLS=0; +static int XRES=0; +static int YRES=0; + +static int *Screen=NULL; +static WIDGET *Widget=NULL; +static int nWidget=0; + + +int widget_init (int rows, int cols, int xres, int yres) +{ + if (rows<1 || cols<1) + return -1; + + ROWS=rows; + COLS=cols; + XRES=xres; + YRES=yres; + + if ((Screen=malloc(ROWS*COLS*sizeof(*Screen)))==NULL) { + error ("widget buffer allocation failed: out of memory?"); + return -1; + } + + nWidget=0; + Widget=NULL; +return 0; +} + + +void widget_clear (void) +{ + int n; + + for (n=0; n