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.14 by gregl, Fri Dec 12 11:13: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     2       /* 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();
66 <                        }
67 <                        if (inp & DEV_WAIT)
63 >                        if (inp & DFL(DC_GETVIEW))
64 >                                printview();
65 >                        if (inp & DFL(DC_LASTVIEW))
66 >                                new_view(NULL);
67 >                        if (inp & DFL(DC_PAUSE))
68                                  pause = 1;
69 <                        if (inp & DEV_RESUME) {
69 >                        if (inp & DFL(DC_RESUME)) {
70                                  serv_request(DR_NOOP, 0, NULL);
71                                  pause = 0;
72                          }
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 +                        if (inp & DFL(DC_CLOBBER))
78 +                                serv_request(DR_CLOBBER, 0, NULL);
79 +                        if (inp & DFL(DC_RESTART))
80 +                                serv_request(DR_RESTART, 0, NULL);
81 +                        if (inp & DFL(DC_QUIT))
82 +                                serv_request(DR_SHUTDOWN, 0, NULL);
83                  }
84                  if (rdy & RDY_SIN)              /* user input from sstdin */
85                          switch (usr_input()) {
# Line 190 | Line 200 | register PACKHEAD      *p;
200  
201  
202   new_view(v)                     /* change view parameters */
203 < VIEW    *v;
203 > register VIEW   *v;
204   {
205 +        static VIEW     viewhist[VIEWHISTLEN];
206 +        static unsigned nhist;
207          char    *err;
208 <
209 <        do {
210 <                if ((err = setview(v)) != NULL) {
211 <                        error(COMMAND, err);
208 >                                /* restore previous view? */
209 >        if (v == NULL) {
210 >                if (nhist < 2) {
211 >                        error(COMMAND, "no previous view");
212                          return;
213                  }
214 <                if (v->type == VT_PAR) {
215 <                        error(COMMAND, "cannot handle parallel views");
216 <                        return;
217 <                }
218 <                dev_view(v);            /* update display driver */
219 <                dev_flush();            /* update screen */
220 <        } while (!beam_view(v));        /* update beam list */
214 >                nhist--;        /* get one before last setting */
215 >                v = viewhist + ((nhist-1)%VIEWHISTLEN);
216 >        } else if ((err = setview(v)) != NULL) {
217 >                error(COMMAND, err);
218 >                return;
219 >        }
220 > again:
221 >        if (v->type == VT_PAR) {
222 >                error(COMMAND, "cannot handle parallel views");
223 >                return;
224 >        }
225 >        if (!dev_view(v))       /* update display driver */
226 >                goto again;
227 >        dev_flush();            /* update screen */
228 >        if (!beam_view(v))      /* update beam list */
229 >                goto again;
230 >                                /* record new view */
231 >        if (v < viewhist || v >= viewhist+VIEWHISTLEN) {
232 >                copystruct(viewhist + (nhist%VIEWHISTLEN), v);
233 >                nhist++;
234 >        }
235   }
236  
237  
# Line 246 | Line 272 | usr_input()                    /* get user input and process it */
272          case DC_GETVIEW:                /* print the current view */
273                  printview();
274                  break;
275 +        case DC_LASTVIEW:               /* restore previous view */
276 +                new_view(NULL);
277 +                break;
278          case DC_PAUSE:                  /* pause the current calculation */
279          case DC_RESUME:                 /* resume the calculation */
280                  /* handled in main() */
281 +                break;
282 +        case DC_REDRAW:                 /* redraw from server */
283 +                imm_mode = beam_sync() > 0;
284 +                break;
285 +        case DC_KILL:                   /* kill rtrace process(es) */
286 +                serv_request(DR_KILL, 0, NULL);
287 +                break;
288 +        case DC_CLOBBER:                /* clobber holodeck */
289 +                serv_request(DR_CLOBBER, 0, NULL);
290 +                break;
291 +        case DC_RESTART:                /* restart rtrace */
292 +                serv_request(DR_RESTART, 0, NULL);
293                  break;
294          case DC_QUIT:                   /* quit request */
295                  serv_request(DR_SHUTDOWN, 0, NULL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines