-/* $Id: Raster.c,v 1.26 2003/09/09 06:54:43 reinelt Exp $
+/* $Id: Raster.c,v 1.27 2003/09/10 14:01:52 reinelt Exp $
*
* driver for raster formats
*
*
*
* $Log: Raster.c,v $
+ * Revision 1.27 2003/09/10 14:01:52 reinelt
+ * icons nearly finished\!
+ *
* Revision 1.26 2003/09/09 06:54:43 reinelt
* new function 'cfg_number()'
*
#include "cfg.h"
#include "display.h"
#include "bar.h"
+#include "icon.h"
#include "pixmap.h"
static LCD Lcd;
static int rgap=0;
static int cgap=0;
static int border=0;
+static int icons;
static unsigned int foreground=0;
static unsigned int halfground=0;
return -1;
}
+ if (cfg_number("Icons", 0, 0, 8, &icons) < 0) return -1;
+ if (icons>0) {
+ info ("allocating %d icons", icons);
+ icon_init(rows, cols, xres, yres, 8, icons, pix_icon);
+ }
+
Self->rows=rows;
Self->cols=cols;
Self->xres=xres;
Self->yres=yres;
+ Self->icons=icons;
Lcd=*Self;
pix_clear();
return pix_bar (type, row, col, max, len1, len2);
}
+int Raster_icon (int num, int seq, int row, int col)
+{
+ return icon_draw (num, seq, row, col);
+}
+
LCD Raster[] = {
#ifdef WITH_PPM
xres: 0,
yres: 0,
bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 | BAR_T,
+ icons: 0,
gpos: 0,
init: Raster_init,
clear: Raster_clear,
put: Raster_put,
bar: Raster_bar,
+ icon: Raster_icon,
gpo: NULL,
flush: PPM_flush },
#endif
xres: 0,
yres: 0,
bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 | BAR_T,
+ icons: 0,
gpos: 0,
init: Raster_init,
clear: Raster_clear,
put: Raster_put,
bar: Raster_bar,
+ icon: Raster_icon,
gpo: NULL,
flush: PNG_flush },
#endif
-/* $Id: XWindow.c,v 1.33 2003/09/09 06:54:43 reinelt Exp $
+/* $Id: XWindow.c,v 1.34 2003/09/10 14:01:53 reinelt Exp $
*
* X11 Driver for LCD4Linux
*
*
*
* $Log: XWindow.c,v $
+ * Revision 1.34 2003/09/10 14:01:53 reinelt
+ * icons nearly finished\!
+ *
* Revision 1.33 2003/09/09 06:54:43 reinelt
* new function 'cfg_number()'
*
#include "cfg.h"
#include "display.h"
#include "bar.h"
+#include "icon.h"
#include "pixmap.h"
static int border=0; /*window border*/
static int rows=-1,cols=-1; /*rows+cols without background*/
static int xres=-1,yres=-1; /*xres+yres (same as self->...)*/
+static int icons; /* number of user-defined icons */
static int dimx,dimy; /*total window dimension in pixel*/
static int boxw,boxh; /*box width, box height*/
static int async_update(); /*PROTO*/
if (*rgbhg=='\\') rgbhg++;
if (pix_init(rows,cols,xres,yres)==-1) return -1;
+
+ if (cfg_number("Icons", 0, 0, 8, &icons) < 0) return -1;
+ if (icons>0) {
+ info ("allocating %d icons", icons);
+ icon_init(rows, cols, xres, yres, 8, icons, pix_icon);
+ }
+
if (init_x(rows,cols,xres,yres)==-1) return -1;
init_signals();
if (init_shm(rows*cols*xres*yres,&LCDpixmap2)==-1) return -1;
Self->cols=cols;
Self->xres=xres;
Self->yres=yres;
+ Self->icons=icons;
Lcd=*Self;
pix_clear();
}
-int xlcdput(int row,int col,char *text)
+int xlcdput(int row,int col, char *text)
{
return pix_put(row,col,text);
}
}
+int xlcdicon (int num, int seq, int row, int col)
+{
+ return icon_draw (num, seq, row, col);
+}
+
+
int xlcdflush() {
int dirty;
int row,col;
xres: 0,
yres: 0,
bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 | BAR_T,
+ icons: 0,
gpos: 0,
init: xlcdinit,
clear: xlcdclear,
put: xlcdput,
bar: xlcdbar,
+ icon: xlcdicon,
gpo: NULL,
flush: xlcdflush,
quit: xlcdquit
-/* $Id: icon.c,v 1.5 2003/09/10 03:48:23 reinelt Exp $
+/* $Id: icon.c,v 1.6 2003/09/10 14:01:53 reinelt Exp $
*
* generic icon and heartbeat handling
*
*
*
* $Log: icon.c,v $
+ * Revision 1.6 2003/09/10 14:01:53 reinelt
+ * icons nearly finished\!
+ *
* Revision 1.5 2003/09/10 03:48:23 reinelt
* Icons for M50530, new processing scheme (Ticks.Text...)
*
memset (Bitmap[n].Data, 0, YRES*sizeof(char));
icon_read_bitmap(n);
// icons use last ascii codes from userdef chars
- Defchar (CHARS-n-1, Bitmap[n].Data);
+ if (Defchar) Defchar (CHARS-n-1, Bitmap[n].Data);
}
return 0;
int icon_draw (int num, int seq, int row, int col)
{
+ if (row>=0 && col>=0) {
+ // icons use last ascii codes from userdef chars
+ Screen[row*COLS+col]=CHARS-num-1;
+ }
+
if (seq>=0) {
seq%=Bitmap[num].nData;
if (seq!=Bitmap[num].lData) {
Bitmap[num].lData=seq;
- Defchar (CHARS-num-1, Bitmap[num].Data+seq*YRES);
+ if (Defchar) Defchar (CHARS-num-1, Bitmap[num].Data+seq*YRES);
}
}
- if (row>=0 && col>=0) {
- // icons use last ascii codes from userdef chars
- Screen[row*COLS+col]=CHARS-num-1;
- }
-
return 0;
}
-/* $Id: pixmap.c,v 1.10 2002/08/19 04:41:20 reinelt Exp $
+/* $Id: pixmap.c,v 1.11 2003/09/10 14:01:53 reinelt Exp $
*
* generic pixmap driver
*
*
*
* $Log: pixmap.c,v $
+ * Revision 1.11 2003/09/10 14:01:53 reinelt
+ * icons nearly finished\!
+ *
* Revision 1.10 2002/08/19 04:41:20 reinelt
* introduced bar.c, moved bar stuff from display.h to bar.h
*
* int pix_bar (int type, int row, int col, int max, int len1, int len2);
* draws a bar into the pixmap
*
+ * void pix_icon (int ascii, char *buffer)
+ * used as the "define char" function for icons
+ *
*/
+
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "display.h"
#include "bar.h"
+#include "icon.h"
#include "pixmap.h"
#include "fontmap.h"
#include "debug.h"
unsigned char *LCDpixmap=NULL;
+
int pix_clear(void)
{
int i;
return 0;
}
+
int pix_init (int rows, int cols, int xres, int yres)
{
if (rows<1 || cols<1 || xres<1 || yres<1)
return pix_clear();
}
+
int pix_put (int row, int col, char *text)
{
int c, x, y, mask;
return 0;
}
+
#define N_BAR_T 10
int pix_bar (int type, int row, int col, int max, int len1, int len2)
return 0;
}
+
+void pix_icon (int ascii, char *buffer)
+{
+ // we have to peek the whole screen for this particular icon,
+ // and render it again
+
+ int row, col;
+ int x, y, mask;
+ int c;
+
+ for (row=0; row<ROWS/YRES; row++) {
+ for (col=0; col<COLS/XRES; col++) {
+ c=icon_peek(row, col);
+ if (c!=ascii) continue;
+ for (y=0; y<YRES; y++) {
+ mask=1<<XRES;
+ for (x=0; x<XRES; x++) {
+ mask>>=1;
+ LCDpixmap[(row*YRES+y)*COLS+col*XRES+x]=buffer[y]&mask?1:0;
+ }
+ }
+ }
+ }
+
+}
-/* $Id: pixmap.h,v 1.3 2000/03/26 19:03:52 reinelt Exp $
+/* $Id: pixmap.h,v 1.4 2003/09/10 14:01:53 reinelt Exp $
*
* generic pixmap driver
*
*
*
* $Log: pixmap.h,v $
+ * Revision 1.4 2003/09/10 14:01:53 reinelt
+ * icons nearly finished\!
+ *
* Revision 1.3 2000/03/26 19:03:52 reinelt
*
* more Pixmap renaming
extern unsigned char *LCDpixmap;
-int pix_clear (void);
-int pix_init (int rows, int cols, int xres, int yres);
-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 pix_clear (void);
+int pix_init (int rows, int cols, int xres, int yres);
+int pix_put (int row, int col, char *text);
+int pix_bar (int type, int row, int col, int max, int len1, int len2);
+void pix_icon (int ascii, char *buffer);
#endif
-/* $Id: processor.c,v 1.42 2003/09/10 08:37:09 reinelt Exp $
+/* $Id: processor.c,v 1.43 2003/09/10 14:01:53 reinelt Exp $
*
* main data processing
*
*
*
* $Log: processor.c,v $
+ * Revision 1.43 2003/09/10 14:01:53 reinelt
+ * icons nearly finished\!
+ *
* Revision 1.42 2003/09/10 08:37:09 reinelt
* icons: reorganized tick_* again...
*
if (type & BAR_H) {
for (i=0; i<len && p-buffer<cols; i++)
- *p++=' ';
+ *p++='\t';
} else {
- *p++=' ';
+ *p++='\t';
}
} else if (*s=='&') {
lcd_icon(*(++s)-'0', 0, row, p-buffer+1);
- *p++=' ';
+ *p++='\t';
} else {
*p++=*s;