#include /* Kinescope for X windows */ #include #include #include #include #include #include #include extern Display *display; extern Window draw_win,main_win,info_pop; extern int DCURY; extern GC gc_graph; #define MAXFILM 250 extern char *info_message,*kin_hint[]; int mov_ind; typedef struct { unsigned int h,w; XImage *xi; } MOVIE; MOVIE movie[MAXFILM]; do_movie() { char ch; static char *list[]={"(C)apture","(R)eset","(P)layback","(A)utoplay"}; static char key[]="crpa"; static char title[]="Kinescope"; Window temp=main_win; ch=(char)pop_up_list(&temp,title,list,key,4,11,0,10,8*DCURY+8, kin_hint,info_pop,info_message); /* XDestroyWindow(display,temp); */ draw_help(); XFlush(display); switch(ch){ case 27: break; case 'c': if(film_clip()==0) respond_box(main_win,0,0,"Okay","Out of film!"); break; case 'r': reset_film(); break; case 'p': play_back(); break; case 'a': auto_play(); break; } } reset_film() { int i; if(mov_ind==0)return; for(i=0;i=MAXFILM)return(0); XGetGeometry(display,draw_win,&root,&x,&y,&w,&h,&bw,&d); movie[mov_ind].h=h; movie[mov_ind].w=w; movie[mov_ind].xi=XGetImage(display,draw_win,0,0,w,h,AllPlanes,XYPixmap); mov_ind++; return 1; } play_back() { int x,y; unsigned int h,w,bw,d; char ch; Window root; XEvent ev; int i=0; XGetGeometry(display,draw_win,&root,&x,&y,&w,&h,&bw,&d); if(mov_ind==0)return; if(h=mov_ind)i=0; if(hinterval)break; } /* time loop */ /* check for events */ if(XPending(display)>0) { XNextEvent(display,&ev); switch(ev.type){ case ButtonPress: if(ev.xbutton.button==Button1){ interval+=dt; if(interval>2.0)interval=2.0; } else{ interval-=dt; if(interval<=dmin)interval=dmin; } break; case KeyPress: if(get_key_press(&ev)==27)return; break; } } /* done checking now increment pix */ i++; if(i>=mov_ind)i=0; if(h