diff options
author | abial <abial@FreeBSD.org> | 1998-10-23 19:34:50 +0000 |
---|---|---|
committer | abial <abial@FreeBSD.org> | 1998-10-23 19:34:50 +0000 |
commit | b6645c8564d8d0860377c26f24fbc8d326e5c58c (patch) | |
tree | e31ca34fa80ed6d731f120b65621ef251423a93a /release/picobsd/tinyware | |
parent | 5525376a914c914c882106dbd9a853b715235d60 (diff) | |
download | FreeBSD-src-b6645c8564d8d0860377c26f24fbc8d326e5c58c.zip FreeBSD-src-b6645c8564d8d0860377c26f24fbc8d326e5c58c.tar.gz |
Added ability to auto-run a presentation.
Diffstat (limited to 'release/picobsd/tinyware')
-rw-r--r-- | release/picobsd/tinyware/view/view.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/release/picobsd/tinyware/view/view.c b/release/picobsd/tinyware/view/view.c index 0c2ad26..0255a6b 100644 --- a/release/picobsd/tinyware/view/view.c +++ b/release/picobsd/tinyware/view/view.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: view.c,v 1.1.1.1 1998/08/27 17:38:45 abial Exp $ + * $Id: view.c,v 1.2 1998/10/09 12:42:56 abial Exp $ */ /* @@ -88,6 +88,7 @@ int max_screen_colors=15; int quit,changed; char **pres; int nimg=0; +int auto_chg=0; int cur_img=0; char act; FILE *log; @@ -401,6 +402,7 @@ int kbd_action(int x, int y, char key) { changed=0; + if(key!='n') auto_chg=0; switch(key) { case 'q': quit=1; @@ -440,15 +442,23 @@ kbd_action(int x, int y, char key) break; case '\n': case 'n': - if((nimg>0) && (cur_img<nimg-1)) { - cur_img++; + if(nimg>0) { + if(cur_img<nimg-1) { + cur_img++; + } else { + cur_img=0; + } png_load(pres[cur_img]); changed++; } break; case 'p': - if((nimg>0) && (cur_img>0)) { - cur_img--; + if(nimg>0) { + if(cur_img>0) { + cur_img--; + } else { + cur_img=nimg-1; + } png_load(pres[cur_img]); changed++; } @@ -509,7 +519,6 @@ main(int argc, char *argv[]) fprintf(log,"VGL initialised\n"); #endif VGLSavePalette(); - VGLMouseInit(VGL_MOUSEHIDE); if(argc>optind) { res=png_load(argv[optind]); } else { @@ -524,10 +533,14 @@ main(int argc, char *argv[]) fprintf(log,"Trying script %s\n",argv[optind]); #endif fgets(buf,99,fsc); - if(strcmp("VIEW SCRIPT\n",buf)!=NULL) { + buf[strlen(buf)-1]='\0'; + if(strncmp("VIEW SCRIPT",buf,11)!=NULL) { VGLEnd(); usage(); } + if(strlen(buf)>12) { + auto_chg=atoi(buf+12); + } fgets(buf,99,fsc); buf[strlen(buf)-1]='\0'; nimg=atoi(buf); @@ -548,6 +561,7 @@ main(int argc, char *argv[]) #endif png_load(pres[cur_img]); } + VGLMouseInit(VGL_MOUSEHIDE); /* Prepare the keyboard */ tcgetattr(0,&t_old); memcpy(&t_new,&t_old,sizeof(struct termios)); @@ -582,7 +596,12 @@ main(int argc, char *argv[]) display(&pic,pal_red,pal_green,pal_blue,&a); changed=0; } - pause(); + if(auto_chg) { + sleep(auto_chg); + kbd_action(x,y,'n'); + } else { + pause(); + } VGLMouseStatus(&x,&y,&buttons); if(buttons & MOUSE_BUTTON3DOWN) { #ifdef DEBUG |