/* Savedot.e, by Doug Bauman, (412)-256-2598 Used to save and restore the windows/file names such that when you exit epsilon, and later come back, the windows should look pretty much the way they were when you left. Even if it is a few days later. It uses the functions 'start_up' and 'finish_up' to accomplish this automatically. The file c:\epsilon.dot is used to store the file names and window locations. Also, Alt-TAB will expand a window to full screen, or bring back the screens alternatly. */ #include "eel.h" int toggle_savedot_mode=0; int toggle_save_window=0; command toggle_savedot() on reg_tab[ALT(CTRL('i'))] { if (toggle_savedot_mode) {toggle_savedot_mode=0; to_buffer("main"); drop_buffer("epsilon.dot"); one_window(); load_file_point(); window_number=toggle_save_window; } else {toggle_savedot_mode=1; toggle_save_window=window_number; save_file_point(); one_window(); } } pointname(space) char *space; {char *tmp = getenv("INCLUDE"); strcpy(space,""); if (tmp) { strcpy(space,tmp); tmp=index(space,':'); if (tmp) { tmp++; *tmp= '\0'; } else strcpy(space,""); } strcat(space,"\\epsilon.dot"); } /* user routine to remember the point to a file */ int remember_point(pointfile) char *pointfile; { int err; iter = 0; if (!*pointfile) return 0; if (err = file_write(pointfile, strip_returns)) file_error(err,pointfile,"write error"); else say("%s written.", pointfile); return err; } finish_up() { save_file_point(); term_position(0, screen_lines-1); } char pn[168],sb[168]; command save_file_point() {char save_buf[138],save_file[138]; int save_point,count; int orig_num=window_number; char msg[120]; strcpy(save_buf,bufname); delete_buffer("epsilon.dot"); window_number=0; count=0; do { if (*filename && strncmp(bufname,"epsilon.dot",11)) {count++; strcpy(pn,bufname); strcpy(save_file,filename); save_point=point; to_buffer("epsilon.dot"); point=0; bprintf("%s %d\n",save_file,save_point); to_buffer(pn); } window_number++; } while(window_number); window_number = orig_num; to_buffer("epsilon.dot"); if (count) { pointname(pn); strcpy(msg," Recalling saved information from file "); strcat(msg,pn); sayput(msg); remember_point(pn); } to_buffer(save_buf); } start_up() { load_file_point(); } command load_file_point() {char save_buf[138],save_org[138],*ptr; int save_num,i,j,l,count; int k; int orig_num=window_number; pointname(pn); if (strcmp(bufname,"main")) { delete_file(pn); return; } strcpy(save_org,bufname); find_it(pn,1); point=0; count=0; while(point11) ptr= &save_buf[strlen(save_buf)-11]; else ptr=save_buf; if (i && strncmp(ptr,"epsilon.dot",11)) {count++; strcpy(sb,bufname); save_num=window_number; if (count==3) { previous_window(); for(l=0; l<5; l++) shrink_window(); next_window(); } if (count>=3) for(l=0; l<4; l++) enlarge_window(); split_window(); find_it(save_buf,1); point=k; window_number=save_num; to_buffer(sb); } point++; } if (count<1) { to_buffer(save_org); one_window(); } else window_kill(); delete_file(pn); }