#include /* Kinescope for X windows */ #include #include #include #include #include #include #include #ifdef MKAVI int mkavi__FiiiiiiPUc(int f,int q,int h,int r,int i ,int t, unsigned char *ii); #endif extern Display *display; extern Window draw_win,main_win,info_pop; extern int DCURY; extern GC gc_graph; #define MAXFILM 250 int ks_ncycle=1; int ks_speed=50; extern char *info_message,*kin_hint[]; extern int screen; int mov_ind; typedef struct { unsigned int h,w; Pixmap xi; } MOVIE; MOVIE movie[MAXFILM]; do_movie() { char ch; #ifdef MKAVI static char *list[]={"(C)apture","(R)eset","(P)layback","(A)utoplay","(S)ave","(M)ake AVI"}; static char key[]="crpasm"; #else static char *list[]={"(C)apture","(R)eset","(P)layback","(A)utoplay","(S)ave"}; static char key[]="crpas"; #endif static char title[]="Kinescope"; Window temp=main_win; #ifdef MKAVI ch=(char)pop_up_list(&temp,title,list,key,6,11,0,10,8*DCURY+8, kin_hint,info_pop,info_message); #else ch=(char)pop_up_list(&temp,title,list,key,5,11,0,10,8*DCURY+8, kin_hint,info_pop,info_message); #endif /* 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; case 's': save_kine(); break; #ifdef MKAVI case 'm': make_avi(); break; #endif } } 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=XCreatePixmap(display,RootWindow(display,screen),w,h, DefaultDepth(display,screen)); XCopyArea(display,draw_win,movie[mov_ind].xi,gc_graph,0,0,w,h,0,0); 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(h0) save_movie(base,fmat); } #ifdef MKAVI make_avi() { int i=0; int x,y; unsigned char *out; Window root; unsigned int h,w,bw,d; XGetGeometry(display,draw_win,&root,&x,&y,&w,&h,&bw,&d); if(mov_ind==0)return; if(h0) { XNextEvent(display,&ev); switch(ev.type){ case ButtonPress: return; break; case KeyPress: key=get_key_press(&ev); if(key==27)return; if(key==','){ ks_speed-=dt; if(ks_speedsmax)ks_speed=smax; } break; } } /* done checking now increment pix */ waitasec(ks_speed); i++; if(i>=mov_ind){cycle++; i=0;} if(h=ks_ncycle)return; } /* Big loop */ } too_small() { respond_box(main_win,0,0,"Okay","Window too small for film!"); }