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

Comparing ray/src/hd/rhd_x11.c (file contents):
Revision 3.28 by gwlarson, Thu Aug 27 19:32:27 1998 UTC vs.
Revision 3.31 by gwlarson, Fri Dec 18 11:56:10 1998 UTC

# Line 10 | Line 10 | static char SCCSid[] = "$SunId$ SGI";
10   */
11  
12   #include "standard.h"
13 #include "rhd_qtree.h"
14
13   #include  <X11/Xlib.h>
14   #include  <X11/cursorfont.h>
15   #include  <X11/Xutil.h>
16 <
16 > #include "rhd_qtree.h"
17   #include  "x11icon.h"
18  
19   #ifndef RAYQLEN
# Line 28 | Line 26 | static char SCCSid[] = "$SunId$ SGI";
26  
27   #define GAMMA           2.2             /* default gamma correction */
28  
29 + #define FRAMESTATE(s)   (((s)&(ShiftMask|ControlMask))==(ShiftMask|ControlMask))
30 +
31   #define MOVPCT          7               /* percent distance to move /frame */
32   #define MOVDIR(b)       ((b)==Button1 ? 1 : (b)==Button2 ? 0 : -1)
33   #define MOVDEG          (-5)            /* degrees to orbit CW/down /frame */
# Line 49 | Line 49 | static char SCCSid[] = "$SunId$ SGI";
49  
50   struct driver   odev;                   /* global device driver structure */
51  
52 + char odev_args[64];                     /* command arguments */
53 +
54   static XEvent  currentevent;            /* current event */
55  
56   static int  ncolors = 0;                /* color table size */
# Line 68 | Line 70 | static int     inpresflags;            /* input result flags */
70  
71   static int      headlocked = 0;         /* lock vertical motion */
72  
73 < static int  getpixels(), xnewcolr(), freepixels(), resizewindow(),
73 > static int  getpixels(), xnewcolr(), freepixels(), resizewindow(), getframe(),
74                  getevent(), getkey(), moveview(), getmove(), fixwindow();
75   static unsigned long  true_pixel();
76  
# Line 265 | Line 267 | VIEW   *nv;
267   }
268  
269  
270 + dev_section(ofn)                /* add octree for geometry rendering */
271 + char    *ofn;
272 + {
273 +        /* unimplemented */
274 + }
275 +
276 +
277   dev_auxcom(cmd, args)           /* process an auxiliary command */
278   char    *cmd, *args;
279   {
# Line 453 | Line 462 | getevent()                     /* get next event */
462                  getkey(levptr(XKeyPressedEvent));
463                  break;
464          case ButtonPress:
465 <                getmove(levptr(XButtonPressedEvent));
465 >                if (FRAMESTATE(levptr(XButtonPressedEvent)->state))
466 >                        getframe(levptr(XButtonPressedEvent));
467 >                else
468 >                        getmove(levptr(XButtonPressedEvent));
469                  break;
470          }
471   }
# Line 576 | Line 588 | int    dx, dy, mov, orb;
588  
589  
590   static
591 + getframe(ebut)                          /* get focus frame */
592 + XButtonPressedEvent     *ebut;
593 + {
594 +        int     startx = ebut->x, starty = ebut->y;
595 +        int     endx, endy;
596 +
597 +        XMaskEvent(ourdisplay, ButtonReleaseMask, levptr(XEvent));
598 +        endx = levptr(XButtonReleasedEvent)->x;
599 +        endy = levptr(XButtonReleasedEvent)->y;
600 +        if (endx == startx | endy == starty) {
601 +                XBell(ourdisplay, 0);
602 +                return;
603 +        }
604 +        if (endx < startx) {register int c = endx; endx = startx; startx = c;}
605 +        if (endy < starty) {register int c = endy; endy = starty; starty = c;}
606 +        sprintf(odev_args, "%.3f %.3f %.3f %.3f",
607 +                        (startx+.5)/odev.hres, 1.-(endy+.5)/odev.vres,
608 +                        (endx+.5)/odev.hres, 1.-(starty+.5)/odev.vres);
609 +        inpresflags |= DFL(DC_FOCUS);
610 + }
611 +
612 +
613 + static
614   getmove(ebut)                           /* get view change */
615   XButtonPressedEvent     *ebut;
616   {
# Line 620 | Line 655 | static
655   getkey(ekey)                            /* get input key */
656   register XKeyPressedEvent  *ekey;
657   {
658 +        Window  rootw, childw;
659 +        int     rootx, rooty, wx, wy;
660 +        unsigned int    statemask;
661          int  n;
662          char    buf[8];
663  
# Line 635 | Line 673 | register XKeyPressedEvent  *ekey;
673                  return;
674          case 'l':                       /* retrieve last view */
675                  inpresflags |= DFL(DC_LASTVIEW);
676 +                return;
677 +        case 'f':                       /* frame view position */
678 +                if (!XQueryPointer(ourdisplay, gwind, &rootw, &childw,
679 +                                &rootx, &rooty, &wx, &wy, &statemask))
680 +                        return;         /* on another screen */
681 +                sprintf(odev_args, "%.4f %.4f", (wx+.5)/odev.hres,
682 +                                1.-(wy+.5)/odev.vres);
683 +                inpresflags |= DFL(DC_FOCUS);
684 +                return;
685 +        case 'F':                       /* unfocus */
686 +                odev_args[0] = '\0';
687 +                inpresflags |= DFL(DC_FOCUS);
688                  return;
689          case 'p':                       /* pause computation */
690                  inpresflags |= DFL(DC_PAUSE);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines