[comp.sys.sgi] Fixed 4Dgifts window.ps for 3.2.1

msc@ramoth.esd.sgi.com (Mark Callow) (12/28/89)

I changed the title bar painting in release 3.2.1 to make it faster and
to stop the flashing.  In doing so I broke the code in window.ps in 4Dgifts
that paints stripes instead of a solid block in the title bar.

Now that I've learned of this codes existence, I've fixed it.  Here is the
correct window.ps file for release 3.2.1

== cut here ==== ~4Dgifts/.4sight/window.ps for release 3.2.1 === cut here ==

systemdict begin
%
% This is used to draw the stripes on the title bar.  Args are:
%	lslope,rslope	slope [0-1] of edge of stripe on left and right side
%	step		number of pixels between stripes
%	x, y		lower left of area to be striped
%	w, h		size of area to be striped
%
/fillslanted { % lslope rslope step x y w h => -
% gsave 4 copy 0 1 0 setrgbcolor rectpath fill grestore
    7 dict begin
	/h exch def /w exch def
	/y exch def /x exch def
	/step exch def
	/rslope exch step mul def /lslope exch step mul def

	0 step h step sub {
	    /y y step add def
	    dup lslope mul x add
	    y
	    moveto
	    dup x w add exch h exch sub rslope mul sub
	    y lineto
	    stroke
	    pop
	} for
    end
} def

SGIWindow begin
    /KeyFocusColor	1.0 0.0 0.0 rgbcolor def
    /BannerColor	0.1 0.1 0.1 rgbcolor def
    /FrameFont		/Times-BoldItalic findfont 14 scalefont def
    /IconFont		/Times-BoldItalic findfont 14 scalefont def

    /Slantiness		.3 def			% how slanty are the stripes
						% (0 == not, 1 == most)
    /StripeSpacing	2 def			% spacing of stripes on the
						% title bar (in pixels )

    /PaintFrameLabel { % true/false => - (Paint frame text label)
        %
        % This should only be called by paintframelabel which does a gsave
        % and sets the canvas, color and font.
        %
        % set up clipping
        BannerButtonMargin BannerButtonWidth add
        TitleSideMargin add                             % t/f x1
        dup FrameHeight BannerHeight sub 0.3753 sub     % t/f x1 x1 y1
        2 copy moveto
        dup 3 1 roll                                    % t/f x1 y1 x1 y1
        FrameWidth TitleSideMargin sub
        NoQuit? NoClose? or not {
            BannerButtonMargin BannerButtonWidth add sub
        } if                                            % t/f x1 y1 x1 y1 x2
        2 index max
        1 index lineto                                  % t/f x1 y1 x1 y1
        0 BannerHeight rlineto
        BannerHeight add lineto                         % t/f x1 y1
        0 BannerHeight neg rlineto
        clip                                            % t/f x1 y1

        3 -1 roll {
            %
            % Label already exists.
            %    clear banner to make way for a different length title

            0 exch
            FrameWidth BannerHeight
            bulbousrect
            PaintFocus
        } { pop } ifelse                                % x1

        TitleSideMargin add
        TitleCapHeight dup add add			% x1'
        CloseControl getcanvaslocation exch pop         % x1' y
        currentfont fontheight 0.085 mul add    % x1' y' XXX show paints
too low
        moveto                                          % -
        FrameLabel show
    } def

    /PaintFocus {
        gsave
        FrameCanvas setcanvas
        FrameFont setfont
        KeyFocus? {KeyFocusColor} {BannerColor} ifelse setcolor
	Slantiness 0 StripeSpacing xfc div		% lslope rslope step
        CloseControl getcanvaslocation exch pop         % ls rs st y1

	0 Slantiness StripeSpacing xfc div		% ... y1 ls' rs' st'
        NoStow? {
            BannerButtonMargin 4 index			% ... y1 ls' rs' st' x y
	    BannerButtonWidth TitleSideMargin dup add add
            TitleCapHeight dup add add			% ... ls' rs' st' x y w
	} {
	    BannerButtonMargin BannerButtonWidth add
	    TitleSideMargin add 4 index			% ... ls' rs' st' x y
	    TitleCapHeight dup add
        } ifelse					% ... ls' rs' st' x y w
        TitleCapHeight fillslanted			% ls rs st y1
        BannerButtonMargin BannerButtonWidth add
	TitleCapHeight dup add add
        TitleSideMargin dup dup add add add
	FrameLabel stringwidth pop add 			% ... y1 x1'
        exch                          			% ... x1 y1
        FrameWidth TitleSideMargin sub
        NoQuit? NoClose? or not {
            BannerButtonMargin BannerButtonWidth add sub
        } if                                            % ... x1 y1 x2
        2 index max                                     % ... x1 y1 x2
        2 index sub TitleCapHeight			% ... x1 y1 w h
	fillslanted
        grestore
    } def
end
end

== cut here ================== end of file ===================== cut here ==
--
From the TARDIS of Mark Callow
msc@ramoth.sgi.com, ...{ames,decwrl}!sgi!msc
"There is much virtue in a window.  It is to a human being as a frame is to
a painting, as a proscenium to a play.  It strongly defines its content."

" ratcliffe) (12/28/89)

In article <2269@odin.SGI.COM> msc@sgi.com writes:
>I changed the title bar painting in release 3.2.1 to make it faster and
>to stop the flashing.  In doing so I broke the code in window.ps in 4Dgifts
>that paints stripes instead of a solid block in the title bar.
>
>Now that I've learned of this codes existence, I've fixed it.  Here is the
>correct window.ps file for release 3.2.1
>
the only problem is one line that ended in a comment that wrapped around 
to the next line and was cut into 2 lines.  this will break the server 
upon trying to login.  calling the line

>systemdict begin

line # 1, you will find that line # 78 needs to be re-joined to line # 77:
(instead of)

>        currentfont fontheight 0.085 mul add    % x1' y' XXX show paints
>too low

(make these two lines be one line):

>        currentfont fontheight 0.085 mul add    % x1' y' XXX show paints too low


                                            daveus rattus   

                                   yer friendly neighborhood ratman