ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhdisp.c
(Generate patch)

Comparing ray/src/hd/rhdisp.c (file contents):
Revision 3.11 by gregl, Tue Dec 9 17:12:15 1997 UTC vs.
Revision 3.16 by gregl, Thu Dec 18 18:14:15 1997 UTC

# Line 14 | Line 14 | static char SCCSid[] = "$SunId$ SGI";
14   #include "selcall.h"
15   #include <ctype.h>
16  
17 + #ifndef VIEWHISTLEN
18 + #define VIEWHISTLEN     4       /* number of remembered views */
19 + #endif
20 +
21   HOLO    *hdlist[HDMAX+1];       /* global holodeck list */
22  
23   char    cmdlist[DC_NCMDS][8] = DC_INIT;
# Line 54 | Line 58 | char   *argv[];
58                  rdy = disp_wait();
59                  if (rdy & RDY_DEV) {            /* user input from driver */
60                          inp = dev_input();
61 <                        if (inp & DEV_PUTVIEW)
58 <                                printview();
59 <                        if (inp & DEV_NEWVIEW)
61 >                        if (inp & DFL(DC_SETVIEW))
62                                  new_view(&odev.v);
63 <                        if (inp & DEV_SHUTDOWN)
64 <                                serv_request(DR_SHUTDOWN, 0, NULL);
65 <                        if (inp & DEV_REDRAW) {
66 <                                imm_mode = 1;   /* preempt updates */
67 <                                beam_sync();
63 >                        if (inp & DFL(DC_GETVIEW))
64 >                                printview();
65 >                        if (inp & DFL(DC_LASTVIEW))
66 >                                new_view(NULL);
67 >                        if (inp & DFL(DC_RESUME)) {
68 >                                serv_request(DR_NOOP, 0, NULL);
69 >                                pause = 0;
70                          }
71 <                        if (inp & DEV_WAIT)
71 >                        if (inp & DFL(DC_PAUSE))
72                                  pause = 1;
73 <                        if (inp & DEV_RESUME) {
74 <                                serv_request(DR_NOOP, 0, NULL);
73 >                        if (inp & DFL(DC_REDRAW))
74 >                                imm_mode = beam_sync() > 0;
75 >                        if (inp & DFL(DC_KILL)) {
76 >                                serv_request(DR_KILL, 0, NULL);
77                                  pause = 0;
78                          }
79 +                        if (inp & DFL(DC_CLOBBER))
80 +                                serv_request(DR_CLOBBER, 0, NULL);
81 +                        if (inp & DFL(DC_RESTART)) {
82 +                                serv_request(DR_RESTART, 0, NULL);
83 +                                pause = 0;
84 +                        }
85 +                        if (inp & DFL(DC_QUIT))
86 +                                serv_request(DR_SHUTDOWN, 0, NULL);
87                  }
88                  if (rdy & RDY_SIN)              /* user input from sstdin */
89                          switch (usr_input()) {
# Line 78 | Line 92 | char   *argv[];
92                                  break;
93                          case DC_RESUME:
94                                  serv_request(DR_NOOP, 0, NULL);
95 +                                /* fall through */
96 +                        case DC_KILL:
97 +                        case DC_RESTART:
98                                  pause = 0;
99                                  break;
100                          }
# Line 190 | Line 207 | register PACKHEAD      *p;
207  
208  
209   new_view(v)                     /* change view parameters */
210 < VIEW    *v;
210 > register VIEW   *v;
211   {
212 +        static VIEW     viewhist[VIEWHISTLEN];
213 +        static unsigned nhist;
214          char    *err;
215 <
216 <        do {
217 <                if ((err = setview(v)) != NULL) {
218 <                        error(COMMAND, err);
219 <                        return;
220 <                }
221 <                if (v->type == VT_PAR) {
222 <                        error(COMMAND, "cannot handle parallel views");
223 <                        return;
224 <                }
225 <                dev_view(v);            /* update display driver */
226 <                dev_flush();            /* update screen */
227 <        } while (!beam_view(v));        /* update beam list */
215 >                                /* restore previous view? */
216 >        if (v == NULL) {
217 >                if (nhist > 1)          /* get one before last setting */
218 >                        nhist--;
219 >                else                    /* else go to end of list */
220 >                        while (nhist < VIEWHISTLEN && viewhist[nhist].type)
221 >                                nhist++;
222 >                v = viewhist + ((nhist-1)%VIEWHISTLEN);
223 >        } else if ((err = setview(v)) != NULL) {
224 >                error(COMMAND, err);
225 >                return;
226 >        }
227 > again:
228 >        if (v->type == VT_PAR) {
229 >                error(COMMAND, "cannot handle parallel views");
230 >                return;
231 >        }
232 >        if (!dev_view(v))       /* update display driver */
233 >                goto again;
234 >        dev_flush();            /* update screen */
235 >        if (!beam_view(v))      /* update beam list */
236 >                goto again;
237 >                                /* record new view */
238 >        if (v < viewhist || v >= viewhist+VIEWHISTLEN) {
239 >                copystruct(viewhist + (nhist%VIEWHISTLEN), v);
240 >                nhist++;
241 >        }
242   }
243  
244  
# Line 246 | Line 279 | usr_input()                    /* get user input and process it */
279          case DC_GETVIEW:                /* print the current view */
280                  printview();
281                  break;
282 +        case DC_LASTVIEW:               /* restore previous view */
283 +                new_view(NULL);
284 +                break;
285          case DC_PAUSE:                  /* pause the current calculation */
286          case DC_RESUME:                 /* resume the calculation */
287                  /* handled in main() */
288 +                break;
289 +        case DC_REDRAW:                 /* redraw from server */
290 +                imm_mode = beam_sync() > 0;
291 +                break;
292 +        case DC_KILL:                   /* kill rtrace process(es) */
293 +                serv_request(DR_KILL, 0, NULL);
294 +                break;
295 +        case DC_CLOBBER:                /* clobber holodeck */
296 +                serv_request(DR_CLOBBER, 0, NULL);
297 +                break;
298 +        case DC_RESTART:                /* restart rtrace */
299 +                serv_request(DR_RESTART, 0, NULL);
300                  break;
301          case DC_QUIT:                   /* quit request */
302                  serv_request(DR_SHUTDOWN, 0, NULL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines