From 0721eef3af26cd1152ab337a7c992141871a0921 Mon Sep 17 00:00:00 2001 From: GetAway Date: Sat, 3 Dec 2016 21:51:45 +0100 Subject: [PATCH] reactivate flashing text --- msgbox.c | 6 +++++- text.c | 22 ++++++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/msgbox.c b/msgbox.c index 674f1a0..bb70563 100644 --- a/msgbox.c +++ b/msgbox.c @@ -10,7 +10,7 @@ #include "gfx.h" #include "txtform.h" -#define M_VERSION 1.23 +#define M_VERSION 1.24 #define NCF_FILE "/var/tuxbox/config/neutrino.conf" #define HDF_FILE "/tmp/.msgbox_hidden" @@ -930,6 +930,10 @@ FILE *fh; } show_txt(1); break; + + default: + flash^=1; + break; } } time(&tm2); diff --git a/text.c b/text.c index f647870..ab8df36 100644 --- a/text.c +++ b/text.c @@ -6,6 +6,7 @@ int FSIZE_BIG=28; int FSIZE_MED=24; int FSIZE_SMALL=20; int TABULATOR=72; +extern int flash; static char *sc = "aouAOUzd", *su= "\xA4\xB6\xBC\x84\x96\x9C\x9F", @@ -273,9 +274,12 @@ int RenderChar(FT_ULong currentchar, int _sx, int _sy, int _ex, int color) { if (_sx + sbit->xadvance >= _ex) return -1; /* limit to maxwidth */ - + uint32_t fgcolor; uint32_t bgcolor = *(lbb + (sy + _sy - sbit->top) * stride + (sx + _sx)); - uint32_t fgcolor = bgra[color]; + if ( color == -2) /* flash */ + fgcolor = bgcolor; + else + fgcolor = bgra[color]; uint32_t *colors = lookup_colors(fgcolor, bgcolor); uint32_t *p = lbb + (sx + _sx + sbit->left + kerning.x) + stride * (sy + _sy - sbit->top - _d); uint32_t *r = p + (_ex - _sx); /* end of usable box */ @@ -336,6 +340,7 @@ int GetStringLen(int _sx, char *string, size_t size) *string=='B' || *string=='Y' || *string=='S' || + *string=='F' || *string=='C') { string+=1; } @@ -373,9 +378,9 @@ void CatchTabs(char *text) int RenderString(char *string, int _sx, int _sy, int maxwidth, int layout, int size, int color) { - int stringlen, _ex, charwidth,i; + int stringlen, _ex, charwidth, i, col; char rstr[BUFSIZE]={0}, *rptr=rstr; - int varcolor=color; + int varcolor=color, butcolor=color; //set size @@ -418,6 +423,15 @@ int RenderString(char *string, int _sx, int _sy, int maxwidth, int layout, int s case 'Y': varcolor=YELLOW; break; case 'B': varcolor=BLUE1; break; case 'S': varcolor=color; break; + case 'F': + if(butcolor == CMCST) + col = CMCIT; + else if(butcolor == CMCIT) + col = CMCST; + else + col = -2; + varcolor = flash ? col : varcolor; + break; case 't': _sx=TABULATOR*((int)(_sx/TABULATOR)+1); break; -- 2.39.5