diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | Makefile.in | 8 | ||||
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | icon.c | 21 | ||||
-rw-r--r-- | widget.c | 102 | ||||
-rw-r--r-- | widget.h | 41 |
6 files changed, 160 insertions, 17 deletions
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) @@ -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 <markus@norad.de> +change %t tokens from Byte/sec to kB/sec, ith one decimal places. +Either make it configurabel, or add new tokens. @@ -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<icons; n++) { Bitmap[n].nData=1; Bitmap[n].lData=0; diff --git a/widget.c b/widget.c new file mode 100644 index 0000000..0c01481 --- /dev/null +++ b/widget.c @@ -0,0 +1,102 @@ +/* $Id: widget.c,v 1.1 2003/09/19 03:51:29 reinelt Exp $ + * + * generic widget handling + * + * written 2003 by Michael Reinelt (reinelt@eunet.at) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * $Log: widget.c,v $ + * Revision 1.1 2003/09/19 03:51:29 reinelt + * minor fixes, widget.c added + * + */ + +/* + * exported functions: + * + * int widget_junk(void) + * does something + * + */ + + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#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<ROWS*COLS; n++) { + Screen[n]=-1; + } + +} + + +int widget_add () +{ + nWidget++; + Widget=realloc(Widget, nWidget*sizeof(*Widget)); + + return 0; +} + + +int widget_peek (int row, int col) +{ + if (Screen) + return Screen[row*COLS+col]; + else + return -1; +} diff --git a/widget.h b/widget.h new file mode 100644 index 0000000..aa5e257 --- /dev/null +++ b/widget.h @@ -0,0 +1,41 @@ +/* $Id: widget.h,v 1.1 2003/09/19 03:51:29 reinelt Exp $ + * + * generic widget handling + * + * written 2003 by Michael Reinelt (reinelt@eunet.at) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * $Log: widget.h,v $ + * Revision 1.1 2003/09/19 03:51:29 reinelt + * minor fixes, widget.c added + * + */ + + +#ifndef _WIDGET_H_ +#define _WIDGET_H_ + +typedef struct widget { + int x, y; + int w, h; + +} WIDGET; + +int widget_init (int rows, int cols, int xres, int yres); +void widget_clear(void); + +#endif |