From: Brendan Hansen Date: Tue, 11 Jan 2022 20:12:09 +0000 (-0600) Subject: changes X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=a0292ef969d0a0f5dd975f4802ab872ccd490ca6;p=sent.git changes --- diff --git a/sent.c b/sent.c index 585e47b..4728dd3 100644 --- a/sent.c +++ b/sent.c @@ -56,6 +56,7 @@ typedef struct { int *invert; Image *img; char *embed; + int imagesplit; } Slide; /* Purely graphic info */ @@ -93,7 +94,7 @@ static void fffree(Image *img); static void ffload(Slide *s); static void ffprepare(Image *img); static void ffscale(Image *img); -static void ffdraw(Image *img); +static void ffdraw(Image *img, int half); static void getfontsize(Slide *s, unsigned int *width, unsigned int *height); static void cleanup(int slidesonly); @@ -313,7 +314,7 @@ ffscale(Image *img) } void -ffdraw(Image *img) +ffdraw(Image *img, int half) { int xoffset = (xw.w - img->ximg->width) / 2; int yoffset = (xw.h - img->ximg->height) / 2; @@ -413,7 +414,7 @@ load(FILE *fp) static size_t size = 0; size_t blen, maxlines; char buf[BUFSIZ], *p; - int inverted = 0; + int inverted; Slide *s; /* read each line from fp and add it to the item list */ @@ -440,10 +441,13 @@ load(FILE *fp) if (buf[0] == '#') continue; + blen = strlen(buf); inverted = 0; if (buf[0] == '$') { - buf[0] = ' '; inverted = 1; + blen -= 1; + memmove(buf, buf + 1, blen); + buf[blen] = '\0'; } /* grow lines array */ @@ -457,7 +461,6 @@ load(FILE *fp) s->invert[s->linecount] = inverted; - blen = strlen(buf); if (!(s->lines[s->linecount] = strdup(buf))) die("sent: Unable to strdup:"); if (s->lines[s->linecount][blen-1] == '\n') @@ -466,6 +469,10 @@ load(FILE *fp) /* mark as image slide if first line of a slide starts with @ */ if (s->linecount == 0 && s->lines[0][0] == '@') s->embed = &s->lines[0][1]; + else if (blen > 2 && buf[0] == '@' && buf[1] == '@') { + s->embed = &s->lines[0][2]; + s->imagesplit = 1; + } if (s->lines[s->linecount][0] == '\\') memmove(s->lines[s->linecount], &s->lines[s->linecount][1], blen); @@ -572,7 +579,7 @@ xdraw() } else { if (!(im->state & SCALED)) ffprepare(im); - ffdraw(im); + ffdraw(im, 0); } }