diff options
author | Thomas White <taw@bitwiz.me.uk> | 2019-03-21 23:21:41 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2019-03-21 23:21:41 +0100 |
commit | 891e3c9bff47bde012672aa699280400124d2447 (patch) | |
tree | f4b0cc1b5c996a181a4732646cefead6c1c765d0 /libstorycode/slide_priv.c | |
parent | 2d34695fd69d5c31f58cab56d135d487a6389267 (diff) |
Expose SlideItem as an opaque type
Diffstat (limited to 'libstorycode/slide_priv.c')
-rw-r--r-- | libstorycode/slide_priv.c | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/libstorycode/slide_priv.c b/libstorycode/slide_priv.c index f3cf14c..efe502b 100644 --- a/libstorycode/slide_priv.c +++ b/libstorycode/slide_priv.c @@ -24,83 +24,3 @@ #include "slide_priv.h" -static double lcalc(struct length l, double pd) -{ - if ( l.unit == LENGTH_UNIT ) { - return l.len; - } else { - return l.len * pd; - } -} - - -static enum style_element styel_for_slideitem(enum slide_item_type t) -{ - switch ( t ) { - - case SLIDE_ITEM_TEXT : - return STYEL_SLIDE_TEXT; - - case SLIDE_ITEM_IMAGE : - return STYEL_SLIDE_IMAGE; - - case SLIDE_ITEM_PRESTITLE : - return STYEL_SLIDE_PRESTITLE; - - case SLIDE_ITEM_SLIDETITLE : - return STYEL_SLIDE_SLIDETITLE; - - case SLIDE_ITEM_FOOTER : - return STYEL_SLIDE_FOOTER; - - } - - fprintf(stderr, "Invalid slide item %i\n", t); - return STYEL_SLIDE_TEXT; -} - - -void slide_item_get_geom(struct slide_item *item, Stylesheet *ss, - double *x, double *y, double *w, double *h, - double slide_w, double slide_h) -{ - struct frame_geom geom; - - if ( (item->type == SLIDE_ITEM_TEXT) - || (item->type == SLIDE_ITEM_IMAGE) ) - { - geom = item->geom; - } else { - if ( stylesheet_get_geometry(ss, styel_for_slideitem(item->type), &geom) ) { - *x = 0.0; *y = 0.0; - *w = 0.0; *h = 0.0; - return; - } - } - - *x = lcalc(geom.x, slide_w); - *y = lcalc(geom.y, slide_h); - *w = lcalc(geom.w, slide_w); - *h = lcalc(geom.h, slide_h); -} - - -void slide_item_get_padding(struct slide_item *item, Stylesheet *ss, - double *l, double *r, double *t, double *b, - double slide_w, double slide_h) -{ - struct length padding[4]; - double frx, fry, frw, frh; - - if ( stylesheet_get_padding(ss, styel_for_slideitem(item->type), padding) ) { - *l = 0.0; *r = 0.0; *t = 0.0; *b = 0.0; - return; - } - - slide_item_get_geom(item, ss, &frx, &fry, &frw, &frh, slide_w, slide_h); - - *l = lcalc(padding[0], frw); - *r = lcalc(padding[1], frh); - *t = lcalc(padding[2], frw); - *b = lcalc(padding[3], frh); -} |