]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2003-09-19 03:51:29 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Fri, 19 Sep 2003 03:51:29 +0000 (03:51 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Fri, 19 Sep 2003 03:51:29 +0000 (03:51 +0000)
minor fixes, widget.c added

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@245 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

Makefile.am
Makefile.in
TODO
icon.c
widget.c [new file with mode: 0644]
widget.h [new file with mode: 0644]

index e219b5fe01d0102fc8d8c4d8aa6185a273c0fcfe..b00622fb13bf78f6e96a87a31e52a3a3f0d8791d 100644 (file)
@@ -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 \
index 230443b65a0a2224a411d8bf445b418574990fd8..32a1c2972a3c69727530d6156f46d1670bc89c5b 100644 (file)
@@ -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 aead6e445d417976b1f8041efc8fdcd0de5829bd..285a735ebb3d8fb33e407754d1659846fd3d35e6 100644 (file)
--- 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 <markus@norad.de>
+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 b52fe95c30c8a06ffd17245a6fcdffe858530111..6e312760e6b9f44a86edac789edc0452dee20955 100644 (file)
--- 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<icons; n++) {
     Bitmap[n].nData=1;
     Bitmap[n].lData=0;
diff --git a/widget.c b/widget.c
new file mode 100644 (file)
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 (file)
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