#include #include #include "util.h" static int viewwidth=1900; static int viewheight=1000; static int imagewidth=100; static int imageheight=100; static const char *titleimg = NULL; static const char *titlecolor = "black"; void util_format_title ( const char *title) { int titlesize = 7+2; if (viewwidth < 1900){ titlesize = 5+2; } if (titleimg != NULL){ int height = util_get_titleheight(); printf ("
\n" ,viewwidth,height,titleimg,viewwidth,height); printf ("   %s\n" ,titlesize,titlecolor,title); printf ("
\n"); }else{ printf ("   %s\n" ,titlesize,titlecolor,title); } } int util_get_viewwidth() { return viewwidth; } int util_get_viewheight() { return viewheight; } int util_get_imagewidth() { return imagewidth; } int util_get_imageheight() { return imageheight; } const char *util_get_titleimg() { return titleimg; } /* Return the required title-image height when the constraint is the viewwidth */ int util_get_titleheight() { return((double)viewwidth/imagewidth)*imageheight; } /* Return the required title-image width when the constraint is the viewheight */ int util_get_titlewidth() { return((double)viewheight/imageheight)*imagewidth; } static const char *prevpage = "none"; static const char *nextpage = "none"; static int highlit = -1; #define NBSHOW_MAX 100 #define NBSHOW_LAST 99 // This tells we want to show the last step, without knowing what it is static int nbshow = NBSHOW_MAX; static bool showtitle = false; static bool showcomments = false; /* Record the number of steps in the current slide */ void navigation_setsteps(int nbsteps) { if (highlit == NBSHOW_LAST) highlit = nbsteps; if (nbshow == NBSHOW_LAST) nbshow = nbsteps; } int navigation_getnbshow() { return nbshow; } int navigation_gethighlit() { return highlit; } bool navigation_getshowtitle() { return showtitle; } bool navigation_getcomments() { return showcomments; } void presentation_setarg(_F_tlmpprogram___v2 *c) { c->setgrouparg ("Presentation"); c->setarg (' ',"viewwidth","View width",viewwidth,false); c->setarg (' ',"viewheight","View height",viewheight,false); c->setarg (' ',"titleimg","Title background image",titleimg,false); c->setarg (' ',"titlecolor","Title font color",titlecolor,false); c->setarg (' ',"imagewidth","Title image width",imagewidth,false); c->setarg (' ',"imageheight","Title image height",imageheight,false); } void navigation_setarg(_F_tlmpprogram___v2 *c) { c->setgrouparg ("Navigation"); c->setarg ('h',"highlit","Which item to highlit (1,2,...)",highlit,false); c->setarg ('s',"show","how many items to show",nbshow,false); c->setarg (' ',"prev","Previous page",prevpage,false); c->setarg (' ',"next","Next page",nextpage,false); c->setarg (' ',"showtitle","Print the title of the page",showtitle,false); c->setarg (' ',"showcomments","Print the comments of the page",showcomments,false); } void navigation_print (const char *currpage, int nbsteps) { debug_printf ("naviprint currpage=%s nbsteps=%d nbshow=%d\n",currpage,nbsteps,nbshow); int currstep = highlit; if (currstep == -1) currstep = nbshow; if (currstep > nbsteps) currstep = nbsteps; printf ("\n"); }