%
% This file is a product of Sun Microsystems, Inc. and is provided for
% unrestricted use provided that this legend is included on all tape
% media and as a part of the software program in whole or part.  Users
% may copy or modify this file without charge, but are not authorized to
% license or distribute it to anyone else except as part of a product
% or program developed by the user.
% 
% THIS FILE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
% WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
% PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
% 
% This file is provided with no support and without any obligation on the
% part of Sun Microsystems, Inc. to assist in its use, correction,
% modification or enhancement.
% 
% SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
% INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS FILE
% OR ANY PART THEREOF.
% 
% In no event will Sun Microsystems, Inc. be liable for any lost revenue
% or profits or other special, indirect and consequential damages, even
% if Sun has been advised of the possibility of such damages.
% 
% Sun Microsystems, Inc.
% 2550 Garcia Avenue
% Mountain View, California  94043
%
%
% @(#)lines 23.2 90/06/19
%


/LinesCanvas ClassCanvas dictbegin
    /LineCount 20 def
dictend
classbegin

    /newinit {  % - => -
	/newinit super send
        /CreateMenu self send
    } def

    /CreateMenu { % - => -
	/CanvasMenu
	    [ (4) (8) (10) (20) (100) (250) (500) (1000) (2000) ]
	    [/Exclusive] {
		/valuething self send cvi
		/setvalue /sendtarget 4 -1 roll send
	    }
	framebuffer /newdefault ClassMenu send def
	true /setpinnable CanvasMenu send
	3 /setdefault CanvasMenu send		% 20
	3 /setvalue CanvasMenu send		% 20
	(Lines) /setlabel CanvasMenu send
    } def

    /minsize { % - => w h
	/minsize super send
	64 max exch
	64 max exch
    } def

    /preferredsize { % - => w h
	/preferredsize super send
	256 max exch
	256 max exch
    } def

    /setvalue {
	/LineCount exch store
	/paint self send
    } def

    /PaintCanvas {
	FillColor /FillCanvas self send
	/repaintproc {
	    currentprocess /ProcessName (Lines Repaint) put
	    clippath emptypath not {
		pathbbox scale translate
		ColorDisplay? {
		    0 2 LineCount div 1 {
			dup 1 1 sethsbcolor
			0 0 moveto 1 1 index lineto stroke
			0 0 moveto 1 lineto stroke
		    } for
		}{
		    StrokeColor setcolor
		    0 2 LineCount div 1 {
			0 0 moveto 1 1 index lineto stroke
			0 0 moveto 1 lineto stroke
		    } for
		} ifelse
	    } if
	} { newpath clipcanvas } refork
    } def

classend def

/win [LinesCanvas] [/Footer false]
    framebuffer /newdefault ClassBaseFrame send
def

{
gsave
    clippath emptypath not {
	pathbbox scale translate
	FillColor /FillCanvas self send
	ColorDisplay? {
	    0 .1 1 {
		dup 1 1 sethsbcolor
		0 0 moveto 1 1 index lineto stroke
		0 0 moveto 1 lineto stroke
	    } for
	}{
	    0 .1 1 {
		0 0 moveto 1 1 index lineto stroke
		0 0 moveto 1 lineto stroke
	    } for
	} ifelse
    } if
grestore
} /seticon win send

(Lines Demo) /setlabel win send
null /seticonlabel win send

/place win send
/activate win send
/map win send

newprocessgroup
currentfile closefile
