From 1b5ce6fb9be2a5e199442c5227bb456ee588a6d4 Mon Sep 17 00:00:00 2001 From: reinelt Date: Mon, 19 Aug 2002 09:43:43 +0000 Subject: [lcd4linux @ 2002-08-19 09:43:43 by reinelt] BeckmannEgle using new generic bar functions git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@163 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- BeckmannEgle.c | 318 +++++++++++---------------------------------------------- 1 file changed, 57 insertions(+), 261 deletions(-) diff --git a/BeckmannEgle.c b/BeckmannEgle.c index 0e744ce..3e8e4e0 100644 --- a/BeckmannEgle.c +++ b/BeckmannEgle.c @@ -1,4 +1,4 @@ -/* $Id: BeckmannEgle.c,v 1.8 2002/08/19 07:36:29 reinelt Exp $ +/* $Id: BeckmannEgle.c,v 1.9 2002/08/19 09:43:43 reinelt Exp $ * * driver for Beckmann+Egle mini terminals * @@ -20,6 +20,9 @@ * * * $Log: BeckmannEgle.c,v $ + * Revision 1.9 2002/08/19 09:43:43 reinelt + * BeckmannEgle using new generic bar functions + * * Revision 1.8 2002/08/19 07:36:29 reinelt * * finished bar.c, USBLCD is the first driver that uses the generic bar functions @@ -97,6 +100,8 @@ static char *Port=NULL; static int Device=-1; static int Type=-1; +static char Txt[4][40]; + static MODEL Model[]= {{ 16, 1, 0 }, { 16, 2, 1 }, { 16, 4, 2 }, @@ -112,12 +117,7 @@ static MODEL Model[]= {{ 16, 1, 0 }, { 40, 4, 12 }, { 0, 0, 0 }}; -static char Txt[4][40]; -static BAR Bar[4][40]; -static int nSegment=2; -static SEGMENT Segment[128] = {{ len1:0, len2:0, type:255, used:0, ascii:32 }, - { len1:255, len2:255, type:255, used:0, ascii:255 }}; static int BE_open (void) @@ -155,6 +155,7 @@ static int BE_open (void) return fd; } + static void BE_write (char *string, int len) { if (Device==-1) return; @@ -167,185 +168,30 @@ static void BE_write (char *string, int len) } } -static void BE_process_bars (void) -{ - int row, col; - int i, j; - - for (i=2; i=RES && Segment[j].len1=RES && Segment[j].len2RES) i1=RES; - i2=Segment[i].len2; if (i2>RES) i2=RES; - j1=Segment[j].len1; if (j1>RES) i1=RES; - j2=Segment[j].len2; if (j2>RES) i2=RES; - - return (i1-i2)*(i1-i2)+(j1-j2)*(j1-j2); -} - -static void BE_compact_bars (void) -{ - int i, j, r, c, min; - int pack_i, pack_j; - int pass1=1; - int deviation[nSegment][nSegment]; - - if (nSegment>CHARS+2) { - - for (i=2; iCHARS+2) { - min=65535; - pack_i=-1; - pack_j=-1; - for (i=2; imax) len1=max; - - if (len2<1) len2=1; - else if (len2>max) len2=max; - - switch (type) { - case BAR_L: - len1=max-len1; - len2=max-len2; - rev=1; - - case BAR_R: - while (max>0 && col<=Lcd.cols) { - Bar[row][col].type=type; - Bar[row][col].segment=-1; - if (len1>=XRES) { - Bar[row][col].len1=rev?0:XRES; - len1-=XRES; - } else { - Bar[row][col].len1=rev?XRES-len1:len1; - len1=0; - } - if (len2>=XRES) { - Bar[row][col].len2=rev?0:XRES; - len2-=XRES; - } else { - Bar[row][col].len2=rev?XRES-len2:len2; - len2=0; - } - max-=XRES; - col++; - } - break; - - case BAR_U: - len1=max-len1; - len2=max-len2; - rev=1; - - case BAR_D: - while (max>0 && row<=Lcd.rows) { - Bar[row][col].type=type; - Bar[row][col].segment=-1; - if (len1>=YRES) { - Bar[row][col].len1=rev?0:YRES; - len1-=YRES; - } else { - Bar[row][col].len1=rev?YRES-len1:len1; - len1=0; - } - if (len2>=YRES) { - Bar[row][col].len2=rev?0:YRES; - len2-=YRES; - } else { - Bar[row][col].len2=rev?YRES-len2:len2; - len2=0; - } - max-=YRES; - row++; - } - break; - - } - return 0; + return bar_draw (type, row, col, max, len1, len2); } + int BE_flush (void) { char buffer[256]="\033[y;xH"; char *p; - int s, row, col; + int c, row, col; - BE_process_bars(); - BE_compact_bars(); - BE_define_chars(); + bar_process(BE_define_char); - for (s=0; s