systemdict begin /KnobItem Item [ /KnobMax 1 def /KnobMin 10 def /KnobInc .00001 def /KnobWidth 75 def /KnobHeight 75 def /KnobRadis 25 def /KnobFrame 3 def /KnobValue 0 def ] classbegin /new { % min max initvalue notifyproc parent width hieght -> item /new super send begin /NotifyUser exch cvx def /ItemValue exch def /KnobMax exch def /KnobMin exch def currentdict end } def /KnobToValue { % (0...1) to value KnobMax KnobMin sub mul KnobMin add 1 KnobInc div mul round 1 KnobInc div div } def /ValueToKnob { % value to (0...1) KnobMin sub KnobMax KnobMin sub div } def /PaintItem { 0 0 ItemHeight ItemWidth ovalpath ItemFillColor setcolor fill KnobFrame 0 0 ItemHeight ItemWidth ovalframe ItemBorderColor setcolor eofill gsave ItemHeight 2 div ItemWidth 2 div translate ItemValue ItemBorderColor PaintKnobValue grestore } def /SetKnobValue { gsave /ItemValue CurrentEvent /XLocation get neg CurrentEvent /YLocation get neg atan 360 div KnobToValue store grestore } def /PaintKnobValue { setcolor /ItemPaintedValue exch store gsave -270 rotate -1 1 scale 0 0 moveto 0 0 KnobRadis ItemPaintedValue ValueToKnob 360 mul dup arc stroke 0 0 KnobRadis 0 360 arc stroke grestore 0 0 moveto ItemPaintedValue 16 string cvs cshow } def /ClientDown { gsave ItemHeight 2 div ItemWidth 2 div translate SetKnobValue ItemPaintedValue ItemFillColor PaintKnobValue ItemValue ItemBorderColor PaintKnobValue grestore } def /ClientDrag { ClientDown NotifyUser } def /ClientUp { ClientDown NotifyUser StopItem } def classend def end % systemdict