home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / execlib / exec_pipe_reader.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-16  |  2.6 KB  |  98 lines

  1. /*
  2. ### Read the input pending on the pipe ###
  3. */ 
  4.  
  5. #include <stdio.h>
  6. #include <suntool/sunview.h>
  7. #include <suntool/panel.h>
  8. #include <sunwindow/notify.h>
  9.  
  10. Notify_value exec_pipe_reader(item,fd)
  11. Panel_item item;
  12. int fd;
  13. {
  14.     int i,result,save_option_old,lock_interval_old;
  15.     extern int save_option,region_index,lock_interval;
  16.     extern int aux_max;
  17.     extern int *aux_on,*aux_win_mode;
  18.     extern char exec_file_name[],error_mess[],error_yes[],error_no[];
  19.     extern FILE *fp_fromchild;
  20.  
  21.     lock_interval_old = lock_interval;
  22.     lock_interval = 0;
  23.     if(region_index==2){
  24.         /* aux_win_i runs from 0 to aux_max-1 */
  25.         /* Count the number of open auxiliary windows */
  26.         for(i=0;i<aux_max;i++){
  27.             if(!aux_on[i]){
  28.                 /* Turn on aux_win_mode of chosed aux window */
  29.                 aux_win_mode[i]=1;
  30.  
  31.                 /* Create_aux_window turns on aux_on */
  32.                 (void) create_aux_windows(i);
  33.  
  34.                 /* Load data from a file pointer fp_fromchild
  35.                 This does the displaying and recording, too.  */
  36.                 load_data(fp_fromchild);
  37.  
  38.                 /* Refresh the panel items of aux panel */
  39.                 all_refresh();
  40.                 return(NOTIFY_DONE);
  41.             }
  42.         }
  43.         /* All the auxiliary windows are used up. Take over one. */
  44.         for(i=0;i<aux_max;i++){
  45.  
  46.             if(i==0){
  47.                 sprintf(error_mess,"No more aux windows. Take over aux_win[%d]?",i);
  48.                 sprintf(error_yes,"Confirm");
  49.                 if(i != aux_max-1){
  50.                     sprintf(error_no,"No. Move to next aux_win[%d]",i+1);
  51.                 }
  52.                 else {
  53.                     sprintf(error_no,"");
  54.                 }
  55.             }
  56.             else if(i<aux_max-1){
  57.                 sprintf(error_mess,"How about this aux_win[%d]?",i);
  58.                 sprintf(error_yes,"Confirm");
  59.                 sprintf(error_no,"Nope. Next!");
  60.             }
  61.             else {
  62.                 sprintf(error_mess,"This is the last chance. Do you want get aux_win[i]?",i);
  63.                 sprintf(error_yes,"Confirm");
  64.                 sprintf(error_no,"Cancel. Exit!");
  65.             }
  66.             result = (int) error_mess_proc(error_mess,error_yes,error_no);
  67.             if(result){
  68.                 /* Turn on aux_win_mode of chosed aux window */
  69.                 aux_win_mode[i]=1;
  70.                 (void) destroy_aux_windows(i);
  71.                 /* Create_aux_window turns on aux_on */
  72.                 (void) create_aux_windows(i);
  73.  
  74.                 /* Load data from a file pointer fp_fromchild
  75.                 This does the displaying and recording, too.  */
  76.                 load_data(fp_fromchild);
  77.  
  78.                 /* Refresh the panel items of aux panel */
  79.                 all_refresh();
  80.                 return(NOTIFY_DONE);
  81.             }
  82.         }
  83.     }
  84.     else {
  85.         /* Load_data may change the save option */
  86.         save_option_old = save_option;
  87.         if(save_option==0){
  88.             sytsem_mess_proc(1,"Change the save option to either 2-D data or Full data.");
  89.             return(NOTIFY_DONE);
  90.         }
  91.         load_data(fp_fromchild);
  92.         all_refresh();
  93.         save_option = save_option_old;
  94.     }
  95.     lock_interval = lock_interval_old;
  96.     return(NOTIFY_DONE);
  97. }
  98.