(DEFINE-FILE-INFO PACKAGE "IL" READTABLE "INTERLISP" BASE 10)
(FILECREATED "11-May-93 10:59:55" {DSK}<usr>local>lde>loops>library-src>GAUGEDIGIMETER.;2 9573   

      changes to%:  (CLASSES DigiMeter)
                    (VARS GAUGEDIGIMETERCOMS)
                    (PROPS (GAUGEDIGIMETER MAKEFILE-ENVIRONMENT))

      previous date%: "15-Aug-90 16:17:13" {DSK}<usr>local>lde>loops>library-src>GAUGEDIGIMETER.;1)


(* ; "
Copyright (c) 1986, 1987, 1988, 1990, 1993 by Venue & Xerox Corporation.  All rights reserved.
")

(PRETTYCOMPRINT GAUGEDIGIMETERCOMS)

(RPAQQ GAUGEDIGIMETERCOMS
       ((DECLARE%: DONTCOPY (PROP MAKEFILE-ENVIRONMENT GAUGEDIGIMETER))
        (FILES (FROM VALUEOF LOOPSLIBRARYDIRECTORY)
               GAUGEMETERS GAUGEALPHANUMERICS)
        (CLASSES DigiMeter)
        (METHODS DigiMeter.ComputeScale DigiMeter.Set DigiMeter.SetParameters DigiMeter.Shape 
               DigiMeter.ShowReading)
        (FILES (FROM VALUEOF LOOPSLIBRARYDIRECTORY)
               GAUGESCALES)
        (CLASSES DigiScale)
        (METHODS DigiScale.Set DigiScale.SetParameters DigiScale.ShowReading)))
(DECLARE%: DONTCOPY 

(PUTPROPS GAUGEDIGIMETER MAKEFILE-ENVIRONMENT (:PACKAGE "IL" :READTABLE "INTERLISP" :BASE 10))
)

(FILESLOAD (FROM VALUEOF LOOPSLIBRARYDIRECTORY)
       GAUGEMETERS GAUGEALPHANUMERICS)

(DEFCLASSES DigiMeter)
(DEFCLASS DigiMeter
   (MetaClass Class doc "A combination Meter and LCD, for both analog and digital readout." Edited%:
                                                         (* RBGMartin "29-Apr-86 14:25"))
   (Supers Meter LCDMixin)
   (InstanceVariables (spaceForLCD 30 doc "this is the vertical space required for the LCD in the window. It is dependent upon the font and is set by SetParameters."
                             )))


(\BatchMethodDefs)
(METH DigiMeter  ComputeScale (min max labelScale)
      "Compute scale for both dial and alphaDisplay" (category (Instrument)))


(METH DigiMeter  Set (reading)
      "set both on dial and on digits" (category (Meter)))


(METH DigiMeter  SetParameters NIL
      "Set all params" (category (Internal)))


(METH DigiMeter  Shape (newRegion noUpdateFlg)
      "Shapes outside of region to specified shape. If newRegion is bound, make sure it is at least the minimum required size. If it is not specified, prompt for a new region based upon minimum size."
      (category (Public)))


(METH DigiMeter  ShowReading (reading)
      "Show displayVal both on dial and on digits" (category (RoundScale)))



(Method ((DigiMeter ComputeScale) self min max labelScale)
                                                             (* ; "dgb: 10-JUN-83 11:53")
   "Compute scale for both dial and alphaDisplay"
   (_SuperFringe
    self ComputeScale min max labelScale))

(Method ((DigiMeter Set) self reading)                   (* ; "dgb: 10-JUN-83 11:53")
   "set both on dial and on digits"
   (_SuperFringe
    self Set reading))

(Method ((DigiMeter SetParameters) self)                 (* ; "edited: 28-Jan-87 22:46")
   "Set all params"
   [PROG ((window (@ window))
          (fontHeight (FONTHEIGHT (@ font)))
          border titleHeight)
         (_Super )
         (SETQ border (WINDOWPROP window 'BORDER))
         [SETQ titleHeight (PLUS border (COND
                                           ((@ title)
                                            (FONTHEIGHT (DSPFONT NIL WindowTitleDisplayStream)))
                                           (T 0]

         (* first determine height for meter, then add to it the height for the LCD.
       Height of meter is same as the width.)

         (_@ spaceForLCD (PLUS 3 border fontHeight))
         (_@ height (HEIGHTIFWINDOW (PLUS (@ yc)
                                          (ShowRayLabelLength self (@ radius))
                                          (IQUOTIENT fontHeight 2)
                                          (@ spaceForLCD))
                           (@ title)))
         (_@ height%:,min (PLUS (@ height%:,min)
                                (@ spaceForLCD)))
         (_@ readingY (IDIFFERENCE (@ height)
                             (PLUS titleHeight (@ spaceForLCD))))
                                                             (* set up small reading region)
         (_ self SmallRegion)
         (_@ width%:,min (MAX (@ width%:,min)
                              (fetch WIDTH of (@ precision%:,readingRegion))))
         (_@ width (MAX (@ width)
                        (@ width%:,min)))])

(Method ((DigiMeter Shape) self newRegion noUpdateFlg)   (* ; "RBGMartin 28-Jan-87 17:12")
   "Shapes outside of region to specified shape. If newRegion is bound, make sure it is at least the minimum required size. If it is not specified, prompt for a new region based upon minimum size."
   (_Super self Shape (if newRegion
                          then (GetMinRegion newRegion self)
                        else (GETREGION (@ width%:,min)
                                        (@ height%:,min)
                                        (WINDOWPROP (@ window)
                                               'REGION)
                                        (FUNCTION DigiMeterNEWREGIONfn)
                                        self))
                noUpdateFlg))

(Method ((DigiMeter ShowReading) self reading)           (* ; "dgb: 28-OCT-83 11:30")
   "Show displayVal both on dial and on digits"
   (_SuperFringe
    self ShowReading reading))

(\UnbatchMethodDefs)

(FILESLOAD (FROM VALUEOF LOOPSLIBRARYDIRECTORY)
       GAUGESCALES)

(DEFCLASSES DigiScale)
(DEFCLASS DigiScale
   (MetaClass Class doc "Combines a numeric display with an unlabelled proportional horizontal scale"
          Edited%:                                       (* dgb%: " 6-JUN-83 17:55"))
   (Supers HorizontalScale LCDMixin)
   (InstanceVariables (ticks NIL tickLength NIL doc 
      "ticks on the instrument; value is number or NIL; smallTicks is number between each large tick"
                             )
          (scaleHeight 6 doc "height of scale")
          (scaleLeft 6 doc "left edge of scale")
          (height 24 doc "a window high enough for 11 labels")
          (width 70)
          (spaceForLCD 30 doc "this is the vertical space required for the LCD in the window. It is dependent upon the font and is set by SetParameters."
                 )))


(\BatchMethodDefs)
(METH DigiScale  Set (reading)
      "Combined method for Set" (category (HorizontalScale)))


(METH DigiScale  SetParameters NIL
      "Set parameters for unscaled horizontal gauge combined with LCD on top" (category (Internal)))


(METH DigiScale  ShowReading NIL
      "dgb:  9-JUN-83 21:34" (category (HorizontalScale)))



(Method ((DigiScale Set) self reading)                   (* ; "dgb: 10-JUN-83 11:54")
   "Combined method for Set"
   (_SuperFringe
    self Set reading))

(Method ((DigiScale SetParameters) self)                 (* ; "edited: 28-Jan-87 23:21")
   "Set parameters for unscaled horizontal gauge combined with LCD on top"
   [PROG ((window (@ window))
          (fontHeight (FONTHEIGHT (@ font)))
          border titleHeight)
         (_Super )
         (SETQ border (WINDOWPROP window 'BORDER))
         [SETQ titleHeight (PLUS border (COND
                                           ((@ title)
                                            (FONTHEIGHT (DSPFONT NIL WindowTitleDisplayStream)))
                                           (T 0]
         (_@ spaceForLCD (PLUS 3 border fontHeight))
         (_@ scaleHeight (QUOTIENT fontHeight 2))
         (_@ scaleBottom fontHeight)
         (_@ height%:,min (HEIGHTIFWINDOW (IPLUS (@ scaleBottom)
                                                 (@ scaleHeight)
                                                 (COND
                                                    ((@ ticks)
                                                             (* add 8 to tickLength for extra 
                                                           space on each end of tick.)
                                                     (PLUS 8 (@ ticks%:,tickLength)))
                                                    (T (QUOTIENT fontHeight 3)))
                                                 (@ spaceForLCD))
                                 (@ title)))
         (_@ height (MAX (@ height)
                         (@ height%:,min)))
         (_@ readingY [IPLUS (@ scaleBottom)
                             (@ scaleHeight)
                             (COND
                                ((@ ticks)                   (* add 8 to tickLength for extra 
                                                           space on each end of tick.)
                                 (PLUS 8 (@ ticks%:,tickLength)))
                                (T (QUOTIENT fontHeight 3])
         (_ self SmallRegion)
         (_@ width%:,min (MAX (@ width%:,min)
                              (fetch WIDTH of (@ precision%:,readingRegion))))
         (_@ width (MAX (@ width)
                        (@ width%:,min)))])

(Method ((DigiScale ShowReading) self)                   (* ; "dgb: 10-JUN-83 11:54")
   "dgb:  9-JUN-83 21:34"                                    (* ; "Combined method for ShowReading")
   (_SuperFringe
    self ShowReading))

(\UnbatchMethodDefs)
(PUTPROPS GAUGEDIGIMETER COPYRIGHT ("Venue & Xerox Corporation" 1986 1987 1988 1990 1993))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL)))
STOP
