aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-06-08 21:46:38 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-06-08 21:46:38 +0000
commit382e529a22b88e5c2b438bdcee8b5a5717bc0389 (patch)
tree7981f76cbf56177d11e09610cf649f19c149cec1
parentdcc21331db8a298cc58df1d5187e7d6c3802c698 (diff)
downloadlcd4linux-382e529a22b88e5c2b438bdcee8b5a5717bc0389.tar.gz
[lcd4linux @ 2004-06-08 21:46:38 by reinelt]
splash screen for X11 driver (and generic graphic driver) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@470 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-rw-r--r--Makefile.in3
-rw-r--r--drv_X11.c19
-rw-r--r--drv_generic_graphic.c118
-rw-r--r--drv_generic_graphic.h18
-rw-r--r--lcd4linux.conf.sample4
5 files changed, 131 insertions, 31 deletions
diff --git a/Makefile.in b/Makefile.in
index 1f6bfaf..8021108 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -129,7 +129,8 @@ CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
Makefile.am Makefile.in NEWS TODO aclocal.m4 config.guess config.h.in \
-config.sub configure configure.in install-sh missing mkinstalldirs
+config.sub configure configure.in install-sh ltmain.sh missing \
+mkinstalldirs
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
diff --git a/drv_X11.c b/drv_X11.c
index 9deed93..db34906 100644
--- a/drv_X11.c
+++ b/drv_X11.c
@@ -1,4 +1,4 @@
-/* $Id: drv_X11.c,v 1.4 2004/06/06 06:51:59 reinelt Exp $
+/* $Id: drv_X11.c,v 1.5 2004/06/08 21:46:38 reinelt Exp $
*
* new style X11 Driver for LCD4Linux
*
@@ -26,6 +26,10 @@
*
*
* $Log: drv_X11.c,v $
+ * Revision 1.5 2004/06/08 21:46:38 reinelt
+ *
+ * splash screen for X11 driver (and generic graphic driver)
+ *
* Revision 1.4 2004/06/06 06:51:59 reinelt
*
* do not display end splash screen if quiet=1
@@ -69,6 +73,7 @@
#include "debug.h"
#include "cfg.h"
+#include "qprintf.h"
#include "timer.h"
#include "plugin.h"
#include "widget.h"
@@ -351,7 +356,7 @@ int drv_X11_init (char *section, int quiet)
int ret;
// real worker functions
- drv_generic_graphic_real_blit = drv_X11_blit;
+ drv_generic_graphic_real_blit = drv_X11_blit;
// start display
if ((ret=drv_X11_start (section))!=0)
@@ -362,8 +367,18 @@ int drv_X11_init (char *section, int quiet)
return ret;
// initially expose window
+ drv_generic_graphic_clear();
drv_X11_expose (0, 0, dimx+2*border, dimy+2*border);
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet (buffer, NULL)) {
+ sleep (3);
+ drv_generic_graphic_clear();
+ }
+ }
+
// register text widget
wc=Widget_Text;
wc.draw=drv_generic_graphic_draw;
diff --git a/drv_generic_graphic.c b/drv_generic_graphic.c
index 2edc558..de9bf06 100644
--- a/drv_generic_graphic.c
+++ b/drv_generic_graphic.c
@@ -23,6 +23,10 @@
*
*
* $Log: drv_generic_graphic.c,v $
+ * Revision 1.8 2004/06/08 21:46:38 reinelt
+ *
+ * splash screen for X11 driver (and generic graphic driver)
+ *
* Revision 1.7 2004/06/01 06:45:30 reinelt
*
* some Fixme's processed
@@ -136,7 +140,7 @@ static void drv_generic_graphic_resizeFB (int rows, int cols)
if (cols<LCOLS) cols=LCOLS;
// allocate new Layout FB
- newFB=malloc(cols*rows*sizeof(char));
+ newFB = malloc(cols*rows*sizeof(char));
memset (newFB, 0, rows*cols*sizeof(char));
// transfer contents
@@ -155,38 +159,112 @@ static void drv_generic_graphic_resizeFB (int rows, int cols)
}
-int drv_generic_graphic_draw (WIDGET *W)
+int drv_generic_graphic_clear (void)
{
- WIDGET_TEXT *Text=W->data;
- unsigned char *txt;
- int row, col, len;
- int x, y;
+ memset(drv_generic_graphic_FB, 0, DCOLS*DROWS*sizeof(*drv_generic_graphic_FB));
+ drv_generic_graphic_real_blit (0, 0, DROWS * YRES, DCOLS * XRES);
+ return 0;
+}
+
+
+// ****************************************
+// *** generic text handling ***
+// ****************************************
- row=YRES*W->row;
- col=XRES*W->col;
- txt=Text->buffer;
- len=strlen(txt);
+static void drv_generic_graphic_render (int row, int col, unsigned char *txt)
+{
+ int c, r, x, y;
+ int len = strlen(txt);
// maybe grow layout framebuffer
- drv_generic_graphic_resizeFB (row+YRES, col+XRES*len);
+ drv_generic_graphic_resizeFB (row + YRES, col + XRES * len);
+ r = row;
+ c = col;
+
// render text into layout FB
- while (*txt!='\0') {
- int c=*txt;
- for (y=0; y<YRES; y++) {
- int mask=1<<XRES;
- for (x=0; x<XRES; x++) {
- mask>>=1;
- drv_generic_graphic_FB[(row+y)*LCOLS+col+x] = Font_6x8[c][y]&mask ? 1:0;
+ while (*txt != '\0') {
+ for (y = 0; y < YRES; y++) {
+ int mask = 1 << XRES;
+ for (x = 0; x < XRES; x++) {
+ mask >>= 1;
+ drv_generic_graphic_FB[(r+y) * LCOLS + c + x] = Font_6x8[*txt][y]&mask ? 1:0;
}
}
- col+=XRES;
+ c += XRES;
txt++;
}
// flush area
- drv_generic_graphic_real_blit (YRES*W->row, XRES*W->col, YRES, XRES*len);
+ drv_generic_graphic_real_blit (row, col, YRES, XRES*len);
+
+}
+
+
+// say hello to the user
+int drv_generic_graphic_greet (char *msg1, char *msg2)
+{
+ char *line1[] = { "* LCD4Linux " VERSION " *",
+ "LCD4Linux " VERSION,
+ "* LCD4Linux *",
+ "LCD4Linux",
+ "L4Linux",
+ NULL };
+
+ char *line2[] = { "http://lcd4linux.sourceforge.net",
+ "lcd4linux.sourceforge.net",
+ "http://lcd4linux.sf.net",
+ "lcd4linux.sf.net",
+ NULL };
+ int i;
+ int flag = 0;
+
+ int cols = DCOLS/XRES;
+ int rows = DROWS/YRES;
+
+ for (i = 0; line1[i]; i++) {
+ if (strlen(line1[i]) <= cols) {
+ drv_generic_graphic_render (YRES * 0 , XRES * (cols-strlen(line1[i]))/2, line1[i]);
+ flag = 1;
+ break;
+ }
+ }
+
+ if (rows >= 2) {
+ for (i = 0; line2[i]; i++) {
+ if (strlen(line2[i]) <= cols) {
+ drv_generic_graphic_render (YRES * 1, XRES * (cols-strlen(line2[i]))/2, line2[i]);
+ flag = 1;
+ break;
+ }
+ }
+ }
+
+ if (msg1 && rows >= 3) {
+ int len = strlen(msg1);
+ if ( len <= cols) {
+ drv_generic_graphic_render (YRES * 2, XRES * (cols-len)/2, msg1);
+ flag = 1;
+ }
+ }
+
+ if (msg2 && rows >= 4) {
+ int len = strlen(msg2);
+ if ( len <= cols) {
+ drv_generic_graphic_render (YRES * 3, XRES * (cols-len)/2, msg2);
+ flag = 1;
+ }
+ }
+
+ return flag;
+}
+
+
+int drv_generic_graphic_draw (WIDGET *W)
+{
+ WIDGET_TEXT *Text = W->data;
+ drv_generic_graphic_render (YRES * W->row, XRES * W->col, Text->buffer);
return 0;
}
diff --git a/drv_generic_graphic.h b/drv_generic_graphic.h
index 3faef01..ef7ee5a 100644
--- a/drv_generic_graphic.h
+++ b/drv_generic_graphic.h
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_graphic.h,v 1.3 2004/06/01 06:45:30 reinelt Exp $
+/* $Id: drv_generic_graphic.h,v 1.4 2004/06/08 21:46:38 reinelt Exp $
*
* generic driver helper for graphic displays
*
@@ -23,6 +23,10 @@
*
*
* $Log: drv_generic_graphic.h,v $
+ * Revision 1.4 2004/06/08 21:46:38 reinelt
+ *
+ * splash screen for X11 driver (and generic graphic driver)
+ *
* Revision 1.3 2004/06/01 06:45:30 reinelt
*
* some Fixme's processed
@@ -59,10 +63,12 @@ extern unsigned char *drv_generic_graphic_FB;
void (*drv_generic_graphic_real_blit)(int row, int col, int height, int width);
// generic functions and widget callbacks
-int drv_generic_graphic_init (char *section, char *driver);
-int drv_generic_graphic_draw (WIDGET *W);
-int drv_generic_graphic_icon_draw (WIDGET *W);
-int drv_generic_graphic_bar_draw (WIDGET *W);
-int drv_generic_graphic_quit (void);
+int drv_generic_graphic_init (char *section, char *driver);
+int drv_generic_graphic_clear (void);
+int drv_generic_graphic_greet (char *msg1, char *msg2);
+int drv_generic_graphic_draw (WIDGET *W);
+int drv_generic_graphic_icon_draw (WIDGET *W);
+int drv_generic_graphic_bar_draw (WIDGET *W);
+int drv_generic_graphic_quit (void);
#endif
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index 8af79d0..903072a 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -593,7 +593,7 @@ Layout testMySQL {
#Display 'LK204'
#Display 'MI240'
#Display 'CW12232'
-Display 'HD44780-20x4'
+#Display 'HD44780-20x4'
#Display 'M50530-24x8'
#Display 'CF631'
#Display 'CF632'
@@ -601,7 +601,7 @@ Display 'HD44780-20x4'
#Display 'Curses'
#Display 'USBLCD'
#Display 'T6963-240x64'
-#Display 'XWindow'
+Display 'XWindow'
#Display 'Image'
Layout 'Default'