[comp.windows.news] A NeWS Class Browser

bvs%sun@Sun.COM (Bruce V. Schwartz) (06/15/88)

This file contains a NeWS server class browser.  It is a good way to
roam through the classes loaded into the server.  Although it has
many deficiencies, (searching, following references), it is generally
quite useful.

The browser has 5 panes.  It is similar in appearance to the Smalltalk
browser.  The first pane on the top of the window contains the list of
classes in the server.  The next 3 contain the list of methods, class
variables, and instance variables associated with the selected class in
the first pane.  The bottom pane is used to display information about
the current selection.  Make selections by clicking on any text in the
top panes with the left button.

This code was mostly written in August 1987 but was revised to work with
NeWS 1.1 in May 1988.  Feel free to use it as you will.  Suggestions
(or improvements!) welcomed.

Bruce V. Schwartz
Sun Microsystems
bvs@sun.com

NOTE:  Normally, the following would be divided into 2 files, but I've
appended them here to make it more fail safe.  You can deppend them
if you like.  In that case, however, the files must be located as:
	~/NeWS/browse/pw.ps and ~/NeWS/browse/browse.ps
if you want to run them without modification.  The file pw.ps contains
the classes used by browse.ps.  I suggest using the browser to examine
those classes!!


%--------cut here----------pw.ps-------------------
%% $Header: pw.ps,v 1.3 88/06/14 17:17:52 bvs Locked $

%  This file contains the classes used by the class browser.
%  The classes included are:
%     Picture   --  an Item similar in concept to the NeWS1.1 textcanvas
%     PicWindow --  a LiteWindow that holds Pictures
%     PicScroll --  a SimpleScrollbar with a few modifications (auto scrolling)
%
%  This code was mostly written in August 1987 but was revised to work with
%  NeWS 1.1 in May 1988.  Feel free to use it as you will.
%
%  Bruce V. Schwartz
%  Sun Microsystems
%  bvs@sun.com
%  

systemdict begin
    systemdict /Item known not { (NeWS/liteitem.ps) run } if
    systemdict /SimpleScrollbar known not { (NeWS/liteitem.ps) run } if
end

%% This file contains classes:  PicWindow Picture PicScroll
/PicWindow LiteWindow
dictbegin
    /PicArray []  def
    /BorderRight 1 def
    /BorderLeft 1 def
    /BorderBottom 1 def
dictend
classbegin
    /PaintIcon
    {
        1 fillcanvas
        .8 setgray
        IconWidth 2 div 1 sub IconHeight 4 div 5 sub 5 Sunlogo
    } def
    /PaintClient
    {
        %% (paint client %\n) [ PicArray ] dbgprintf
        %% PicArray { (    %\n) [ 3 2 roll ] dbgprintf } forall
        PicArray paintitems
    } def
    /setpicarray
    {
        /PicArray exch def
    } def
    /destroy
    {
        %% (destroying arrays\n) [] dbgprintf
        PicArray { /destroy exch send } forall
        %% (destroying window\n) [] dbgprintf
        /destroy super send
        %% (destroyed window\n) [] dbgprintf
    } def
classend
def

/PicScrollbar SimpleScrollbar
dictbegin
    /Owner            null     def
    /MouseInItem?    false    def
    /ScrollMonitor    null    def
    /ScrollProcess    null    def
    /ScrollDelay    1 60 div 20 div def    % 1/10 second
    /LastX            null    def
    /LastY            null    def
dictend
classbegin
    /new {
        /new super send
        begin
            /ScrollMonitor createmonitor def
            currentdict
        end
    } def
    /setowner {
        /Owner exch def
    } def

    /ClientDown { % - => -
        CurrentEvent begin XLocation YLocation end
        /LastY exch def
        /LastX exch def
        SetScrollMotion
        /MouseInItem? true def
        HiliteItem
        DoScroll
        ScrollProcess null ne
            { ScrollMonitor { ScrollProcess killprocess } monitor }
        if
        /ScrollProcess { InteractiveScroll } fork def
    } def

    /InteractiveScroll {
        {
            ScrollDelay sleep
            ScrollMonitor { EventInItem? { DoScroll } if } monitor
        } loop 
    } def

    /ClientUp { % - => - 
        ScrollMonitor { ScrollProcess killprocess } monitor
        /ScrollProcess null def
        /MouseInItem? false def
        UnhiliteItem
        ItemValue ItemInitialValue ne { /Notify Owner send } if
    } def

    /ClientDrag { % - => -
        CurrentEvent begin XLocation YLocation end
        /LastY exch def
        /LastX exch def
        CheckItem
    } def

    /PaintBar { } def
    /EraseBox { } def
    /PaintButtons {
        BarViewPercent 1 gt { /PaintButtons super send } if
    } def

    /PaintBox { % - => - (paint box)
        %(PaintBox %\n) [ BarViewPercent ] dbgprintf
        %(pause...) [] dbgprintf 1 60 div sleep (!!\n) [] dbgprintf
        gsave
        10 dict begin

        /x 1 def
        /w ItemWidth 2 sub def

        BarViewPercent 1 le
        {
            .5 setgray
            x ButtonSize w ItemHeight ButtonSize dup add sub rectpath fill
        }
        {
            1 1 BarViewPercent div sub 1 ItemValue sub mul
                ItemHeight ButtonSize dup add sub mul ButtonSize add
            /y exch def

            1 BarViewPercent div ItemHeight ButtonSize dup add sub mul 
            /h exch def

            %
            % do the normal bar
            %
            ItemFillColor setcolor
            x ButtonSize w y ButtonSize sub rectpath fill
            x y h add w ItemHeight ButtonSize sub y sub h sub rectpath fill

            %
            % do the big scroll box
            %
            /ybut ItemValue ValueToY def
            .5 setgray
            x y w ybut y sub rectpath fill
            x ybut ButtonSize add w h ButtonSize sub ybut sub y add rectpath fill
            %
            % do the little scroll box
            %
            ItemValue BoxPath
            BoxFillColor setcolor gsave fill grestore
            ItemBorderColor setcolor eofill
        } ifelse
        end
        /ItemPaintedValue ItemValue def
        grestore
        
        /Notify Owner send
    } def

    /EventInItem? {    % - => bool
        ScrollMotion
        {
            /ScrollAbsolute { false }
            /ScrollPageForward    % top
            {
                LastX dup 0 ge exch ButtonSize le
                LastY ItemValue ValueToY ButtonSize add ge
                LastY ItemHeight ButtonSize sub le
                and and and
            }
            /ScrollPageBackward    % bottom
            {
                LastX dup 0 ge exch ButtonSize le
                LastY ButtonSize ge
                LastY ItemValue ValueToY le
                and and and
            }
            /ScrollLineForward    % top
            {
                LastX 0 ge
                LastX ButtonSize le
                LastY ItemHeight ButtonSize sub ge
                LastY ItemHeight le
                and and and
            }
            /ScrollLineBackward    % bottom
            {
                LastX 0 ge
                LastX ButtonSize le
                LastY 0 ge
                LastY ButtonSize le
                and and and
            }
        } case
        BarViewPercent 1 le { pop false } if
    } def 

    /CheckItem {
        ScrollMotion
        {
            /ScrollAbsolute {DoScroll}
            /ScrollPageForward    % top
            {
                /MouseInItem? EventInItem? def
            }
            /ScrollPageBackward    % bottom
            {
                /MouseInItem? EventInItem? def
            }
            /ScrollLineForward    % top
            {
                EventInItem? dup
                    { MouseInItem? not { HiliteItem } if }
                    { MouseInItem? { UnhiliteItem } if }
                ifelse
                /MouseInItem? exch def
            }
            /ScrollLineBackward    % bottom
            {
                EventInItem? dup
                    { MouseInItem? not { HiliteItem } if }
                    { MouseInItem? { UnhiliteItem } if }
                ifelse
                /MouseInItem? exch def
            }
        } case
    } def 

    /HiliteItem {
        ScrollMotion
        {
            /ScrollAbsolute { }
            /ScrollPageForward { }
            /ScrollPageBackward { }
            /ScrollLineForward    % top
            {
                0 ItemHeight ButtonSize ButtonSize neg rectpath
                5 setrasteropcode fill
            }
            /ScrollLineBackward    % bottom
            {
                0 0 ButtonSize ButtonSize rectpath
                5 setrasteropcode fill
            }
        } case
    } def


    /UnhiliteItem {
        gsave
        ScrollMotion
        {
            /ScrollAbsolute    {}
            /ScrollPageForward    {}
            /ScrollPageBackward    {}
            /ScrollLineForward    % top
            {
                0 ItemHeight ButtonSize sub ButtonSize ButtonSize rectpath
                clip
                PaintButtons
            }
            /ScrollLineBackward    % bottom
            {
                0 0 ButtonSize ButtonSize rectpath
                clip
                PaintButtons
            }
        } case
        grestore
    } def

classend
def


/Picture Item
dictbegin
    /BufferCanvas    null    def
    /BufferWidth    0        def
    /BufferHeight    0        def

    /HScrollbar        null    def
    /VScrollbar        null    def
    /HScrollbar?    true    def
    /VScrollbar?    true    def
    /HScrollWidth    0        def
    /VScrollWidth    0        def

    /ScrollWidth    16        def
    /ZoomFactor        1        def

    /NotifyUserDown        { pop pop }    def    % x y => -
    /NotifyUserUp        { pop pop }    def    % x y => -
    /NotifyUserDrag        { pop pop }    def    % x y => -
    /NotifyUserEnter    { pop pop }    def    % x y => -
    /NotifyUserExit        { pop pop }    def    % x y => -

dictend
classbegin
    /new {    % parentcanvas width height => instance
        % (new begin\n) [] dbgprintf
        /new super send
        begin
            /BufferHeight    ItemHeight    def
            /BufferWidth    ItemWidth    def
            CreateScrollbars
            CreateBuffer
            currentdict
        end
        % (new end\n) [] dbgprintf
    } def

    /destroy {
        HScrollbar null ne { null /setowner HScrollbar send } if
        VScrollbar null ne { null /setowner VScrollbar send } if
        %% BufferCanvas /Mapped false put
        %% /BufferCanvas null def
    } def


    /setzoom { % zoomfactor => -
        /ZoomFactor exch def
    } def


    /reshape { % x y w h => -
        /reshape super send
        ReshapeScrollbars
    } def

    /reshapebuffer { % w h => -
        /BufferHeight exch def
        /BufferWidth exch def
        ReshapeBuffer
        ReshapeScrollbars
    } def

    /getcanvas {
        BufferCanvas
    } def

    /updatecanvas {
        PaintBuffer
    } def

    /makestartinterests { 
        /makestartinterests HScrollbar send
        /makestartinterests VScrollbar send
        [ exch aload length 2 add -1 roll aload pop ]    % join 2 arrays
        /makestartinterests super send
        [ exch aload length 2 add -1 roll aload pop ]    % join 2 arrays
    } def

    /PaintItem {
        %% (PaintItem begin\n) [] dbgprintf
        %% ItemCanvas setcanvas .9 fillcanvas
        PaintBuffer
        /paint VScrollbar send
        /paint HScrollbar send
        %% (PaintItem end\n) [] dbgprintf
    } def

    /Notify {
        % (picture got notified\n) [] dbgprintf
        NotifyUser
        PaintBuffer
    } def

    /PaintBuffer {
        % (PaintBuffer begin \n) [ ] dbgprintf
        gsave
        ItemCanvas setcanvas

        %
        % compute clipping region
        %
        0
        HScrollWidth
        ItemWidth VScrollWidth sub
        ItemHeight HScrollWidth sub
        rectpath
        % (clip to % % % %\n) [ pathbbox ] dbgprintf
        clip

        %
        % compute translation
        %
        BufferWidth ZoomFactor mul ItemWidth sub VScrollWidth add neg
        dup 0 lt
        {
            1 /getvalue HScrollbar send sub
            mul
        }
        { pop 0 } ifelse

        BufferHeight ZoomFactor mul ItemHeight sub HScrollWidth add neg
        dup 0 lt
        {
            1 /getvalue VScrollbar send sub
            mul
        }
        { } ifelse
        HScrollWidth add

        % 2 copy (translate by % %\n) [ 4 2 roll ] dbgprintf
        translate

        BufferWidth BufferHeight 
        % 2 copy (scale by % %\n) [ 4 2 roll ] dbgprintf
        scale
        ZoomFactor dup scale

        pause
        BufferCanvas imagecanvas
        pause
        grestore
        % (PaintBuffer end\n) [ ] dbgprintf
    } def

    /CreateBuffer { % - => -
        /BufferCanvas framebuffer newcanvas def
        BufferCanvas /Retained true put
        BufferCanvas /Opaque true put

        ReshapeBuffer
    } def

    /ReshapeBuffer { % - => -
        gsave
        framebuffer setcanvas
        0 0 BufferWidth BufferHeight
        rectpath
        BufferCanvas reshapecanvas
        grestore
    } def

    /CreateScrollbars { % - => - 
        % (begin CreateScrollbars\n) [] dbgprintf
        /HScrollWidth HScrollbar? { ScrollWidth } { 0 } ifelse def
        /VScrollWidth VScrollbar? { ScrollWidth } { 0 } ifelse def

        ItemWidth VScrollWidth le { /VScrollWidth ScrollWidth 2 div def } if
        ItemHeight HScrollWidth le { /HScrollWidth ScrollWidth 2 div def } if

        /HScrollbar
            [1 0 .01 .1 BufferWidth ItemWidth VScrollWidth sub div ]
            1 {} ItemCanvas
            /new PicScrollbar send
            dup /BarVertical? false put
        def
        /VScrollbar
            [1 0 .01 .1 BufferHeight ItemHeight HScrollWidth sub div ]
            1 {} ItemCanvas
            /new PicScrollbar send
        def

        self /setowner HScrollbar send
        self /setowner VScrollbar send
        % (end CreateScrollbars\n) [] dbgprintf
    } def

    /ReshapeScrollbars {
        /HScrollWidth HScrollbar? { ScrollWidth } { 0 } ifelse def
        /VScrollWidth VScrollbar? { ScrollWidth } { 0 } ifelse def
        10 dict begin
            /h ItemHeight def /w ItemWidth def
            /s ScrollWidth def
                
            [1 0 .01 .1 BufferWidth ItemWidth VScrollWidth sub div ]
            /setrange HScrollbar send
            [1 0 .01 .1 BufferHeight ItemHeight HScrollWidth sub div ]
            /setrange VScrollbar send


            HScrollbar?
                { 0 0 w VScrollWidth sub s }
                { 0 0 0 0 }
            ifelse
            % 4 copy (hscroll % % % %\n) [ 6 2 roll ] dbgprintf
            /reshape HScrollbar send

            VScrollbar?
                {  w s sub HScrollWidth s h HScrollWidth sub }
                { 0 0 0 0 }
            ifelse
            % 4 copy (vscroll % % % %\n) [ 6 2 roll ] dbgprintf
            /reshape VScrollbar send
        end
    } def

    /ClientDown {
        % (Picture ClientDown\n) [] dbgprintf

        % compute translation
        %
        BufferWidth ZoomFactor mul ItemWidth sub VScrollWidth add neg
        dup 0 lt
        {
            1 /getvalue HScrollbar send sub
            mul
        }
        { pop 0 } ifelse

        BufferHeight ZoomFactor mul ItemHeight sub HScrollWidth add neg
        dup 0 lt
        {
            1 /getvalue VScrollbar send sub
            mul
        }
        { } ifelse
        HScrollWidth add

        % translatex translatey
        CurrentEvent /YLocation get sub neg exch
        CurrentEvent /XLocation get sub neg exch
		% (n: %\n) [ NotifyUserDown ] dbgprintf
        { NotifyUserDown } fork

    } def

    /ClientUp {
        % (Picture ClientUp\n) [] dbgprintf
        CurrentEvent begin XLocation YLocation end
        NotifyUserUp
    } def

    /ClientDrag    {
        % (client drag\n) [] dbgprintf
        CurrentEvent begin XLocation YLocation end
        NotifyUserDrag
    } def

    /ClientEnter {
        %% (client enter\n) [] dbgprintf
        CurrentEvent begin XLocation YLocation end NotifyUserEnter
    } def

    /ClientExit    {
        %% (client exit\n) [] dbgprintf
        CurrentEvent begin XLocation YLocation end NotifyUserExit
    } def

classend
def
%--------cut here----------browse.ps-------------------
%!

%% $Header: browse.ps,v 1.2 88/06/14 17:17:45 bvs Locked $

%
%  This file contains a NeWS server class browser.
%
%  The browser is built on the classes defined in pw.ps.  The class
%  browser has 5 panes.  It is similar in appearance to the Smalltalk
%  browser.  The first pane on the top of the window contains the list of
%  classes in the server.  The next 3 contain the list of methods, class
%  variables, and instance variables associated with the selected class in
%  the first pane.  The bottom pane is used to display information about
%  the current selection.
%
%  This code was mostly written in August 1987 but was revised to work with
%  NeWS 1.1 in May 1988.  Feel free to use it as you will.
%
%  Bruce V. Schwartz
%  Sun Microsystems
%  bvs@sun.com
%  


% you will have to alter the following line unless you keep this program
% in ~/NeWS/browse.

userdict /PicWindow known not { (NeWS/browse/pw.ps) run } if

userdict begin

/Font15 /Times-Roman findfont 15 scalefont def

/StartWait {
    userdict begin
    /SaveCursor [ currentcanvas getcanvascursor ] def
    /hourg /hourg_m fboverlay setstandardcursor
    end
} def

/EndWait {
    userdict begin
    SaveCursor aload pop setcanvascursor
    end
} def

/DoubleBubbleSort     % keyarray valuearray => - (sorts in place)
{
    %% 2 copy (double % %\n) [ 4 2 roll ] dbgprintf
    %% StartWait
    20 dict begin
        /values exch def
        /keys exch def
        /bound keys length 1 sub def
        /check 0 def
        {
            /t -1 def
            0 1 bound 1 sub
            {
                /i exch def
                /j i 1 add def
                /keysi keys i get def
                /keysj keys j get def
                keysi keysj gt 
                {
                    keys i keysj put
                    keys j keysi put
                    /valuesi values i get cvlit def
                    /valuesj values j get cvlit def
                    values i valuesj put
                    values j valuesi put
                    /t j def
                } if
            } for
            t -1  eq 
                { exit }
                { /bound t def }
            ifelse
            pause
        } loop
    end
    %% EndWait
} def


/PicArray [ ] def
/win framebuffer /new PicWindow send def
{
    /FrameLabel (Class Browser -- make selections with left button) def
} /doit win send
100 100 800 517 /reshape win send
/map win send

/ClassKeys [] def
/InstKeys [] def
/MethodKeys [] def
/VarKeys [] def

/ClassPic   win /ClientCanvas get 300 1000 /new Picture send def  % classes
/MethodPic  win /ClientCanvas get 300 1000 /new Picture send def  % methods
/VarPic     win /ClientCanvas get 300 1000 /new Picture send def  % class var
/InstPic    win /ClientCanvas get 300 1000 /new Picture send def  % ints var
/TextPic    win /ClientCanvas get 800  600 /new Picture send def  % text

/PicArray [ ClassPic InstPic MethodPic VarPic TextPic ] def
PicArray /setpicarray win send

ClassPic /HScrollbar? false put
InstPic /HScrollbar? false put
MethodPic /HScrollbar? false put
VarPic /HScrollbar? false put
TextPic /HScrollbar? false put

000 200 200 300 /reshape ClassPic send
200 200 200 300 /reshape MethodPic send
400 200 200 300 /reshape VarPic send
600 200 200 300 /reshape InstPic send
0   0   800 200 /reshape TextPic send

0 /setvalue ClassPic  /VScrollbar get send
0 /setvalue InstPic   /VScrollbar get send
0 /setvalue MethodPic /VScrollbar get send
0 /setvalue VarPic    /VScrollbar get send
0 /setvalue TextPic   /VScrollbar get send

/ClassColor 1 .8 .8 rgbcolor def
/InstColor 1 .8 1 rgbcolor def
/MethodColor .8 1 .8 rgbcolor def
/VarColor .8 .8 1 rgbcolor def
/TextColor .8 .8 .8 rgbcolor def

/getcanvas ClassPic send setcanvas
ClassColor fillcanvas
0 0 0 rgbcolor strokecanvas

/getcanvas InstPic send setcanvas
InstColor fillcanvas
0 0 0 rgbcolor strokecanvas
0 280 moveto (Class Insts) show

/getcanvas MethodPic send setcanvas
MethodColor fillcanvas
0 0 0 rgbcolor strokecanvas
0 280 moveto (Class Methods) show

/getcanvas VarPic send setcanvas
VarColor fillcanvas
0 0 0 rgbcolor strokecanvas
0 280 moveto (Class Vars) show

/getcanvas TextPic send setcanvas
TextColor fillcanvas
0 0 0 rgbcolor strokecanvas
0 180 moveto (Text) show
PicArray forkitems pop

/ShowArray {    % array color pic
    10 dict begin
        /pic exch def
        /color exch def
        /a exch def

        Font15 setfont
        %% 300 a length 18 mul 15 add /reshapebuffer pic send

        /getcanvas pic send setcanvas
        color fillcanvas

        0 0 0 rgbcolor setcolor
        /k pic /BufferHeight get def
        a
        {
            /k k 18 sub def
            5 k
            moveto
            show
        } forall
    /updatecanvas pic send
    end
} def

%[] ClassColor ClassPic ShowArray
%[] MethodColor MethodPic ShowArray
%[] VarColor VarPic ShowArray
%[] InstColor InstPic ShowArray
%[] TextColor TextPic ShowArray


/DoClasses {
    /getcanvas ClassPic send setcanvas
    10 dict    begin
        /ClassKeys [] def
        /ClassVals [] def

        [ systemdict userdict ]
        {
            {
                /val exch cvlit def
                /key exch cvlit def
                val type /dicttype eq
                {
                    val /ClassName known 
                        {
				/ClassKeys ClassKeys 999 key 256 string cvs arrayinsert def
				/ClassVals ClassVals 999 val arrayinsert def
                        }
                    if
                } 
                if
                pause
            } forall
        } forall
        ClassKeys
        ClassVals
    end

    /ClassVals exch def
    /ClassKeys exch def
    ClassKeys ClassVals DoubleBubbleSort
    ClassKeys ClassColor ClassPic ShowArray
} def

/DoMethods { % classdict => -
    10 dict    begin
        /classdict exch def
        /MethodKeys [] def
        /MethodVals [] def
        classdict
        {
            /val exch def
            /key exch def
            /val load type /arraytype eq
            /val load xcheck
            and
            {
                /MethodKeys MethodKeys 999 key 256 string cvs arrayinsert def
                /MethodVals MethodVals 999 /val load cvlit arrayinsert def
            } 
            if
            pause
        } forall
        MethodKeys
        MethodVals
    end

    userdict begin
    /MethodVals exch def
    /MethodKeys exch def
    MethodKeys MethodVals DoubleBubbleSort

    MethodKeys MethodColor MethodPic ShowArray
    end

} def

/DoVars { % classdict => -
    10 dict    begin
        /classdict exch def
        /VarKeys [] def
        /VarVals [] def
        classdict
        {
            /val exch def
            /key exch def
            /val load type /arraytype eq
            /val load xcheck
            and not
            {
                /VarKeys VarKeys 999 key 256 string cvs arrayinsert def
                /VarVals VarVals 999 /val load cvlit arrayinsert def
            } 
            if
            pause
        } forall
        VarKeys
        VarVals
    end

    userdict begin
    /VarVals exch def
    /VarKeys exch def
    VarKeys VarVals DoubleBubbleSort

    VarKeys VarColor VarPic ShowArray
    end

} def

/DoInsts { % classdict => -
    %(DoInsts begin***\n) [] dbgprintf
    10 dict    begin
        /classdict exch def
        /InstKeys [] def
        /InstVals [] def
        classdict /InstanceVarDict get
        dup null eq { pop [] } if
        {
            /val exch def
            /key exch def
            /InstKeys InstKeys 999 key 256 string cvs arrayinsert def
            /InstVals InstVals 999 /val load arrayinsert def
            pause
        } forall
        InstKeys
        InstVals
    end

    userdict begin
    /InstVals exch def
    /InstKeys exch def
    InstKeys InstVals DoubleBubbleSort

    InstKeys InstColor InstPic ShowArray
    end

    %(DoInsts end***\n) [] dbgprintf
} def


/LastClassPick null def
/ClassPick    % x y => -
{
    userdict begin
    Font15 setfont
    LastClassPick null ne
    { 
        null SetMethodPick
        null SetVarPick
        null SetInstPick
        gsave
        %(unhilite %\n) [ LastClassPick ] dbgprintf
        /getcanvas ClassPic send setcanvas
        0 1000 LastClassPick 1 add 18 mul sub 3 sub 300 18 rectpath
            ClassColor setcolor fill
        0 0 0 rgbcolor setcolor
        5 1000 LastClassPick 1 add 18 mul sub moveto ClassKeys
            LastClassPick get show
        grestore
    } if

    10 dict begin
    /y exch def
    /x exch def

    %% put scroll bars back to top
    0 /setvalue InstPic        /VScrollbar get send
    0 /setvalue MethodPic    /VScrollbar get send
    0 /setvalue VarPic        /VScrollbar get send
    0 /setvalue TextPic        /VScrollbar get send

    /k 1000 y sub 18 div floor def
    %(pick is % \n ) [ k ] dbgprintf
    k ClassKeys length 1 sub le
    {
        %(pick is % \n ) [ ClassKeys k get ] dbgprintf
        /getcanvas ClassPic send setcanvas
        %(hilite %\n) [ k ] dbgprintf
        0 1000 k 1 add 18 mul sub 3 sub 300 18 rectpath
			0 0 0 rgbcolor setcolor fill
        ClassColor setcolor
        0 5 1000 k 1 add 18 mul sub moveto ClassKeys k get show
        /updatecanvas ClassPic send
        [] MethodColor MethodPic ShowArray
        [] VarColor VarPic ShowArray
        [] InstColor InstPic ShowArray
        [] TextColor TextPic ShowArray
        [
            (CLASS  ") ClassKeys k get 256 string cvs (") append append
            ClassVals k get /ParentDictArray known
            {
                ClassVals k get /ParentDictArray get    % ParentDictArray
                {
                    /ClassName get 256 string cvs (    ) exch append
                } forall
            } if
        ] TextColor TextPic ShowArray
        ClassVals k get DoMethods
        ClassVals k get DoVars
        ClassVals k get DoInsts
        k
    }
    {    
        /updatecanvas ClassPic send
        null
    } ifelse
    end
    /LastClassPick exch def

    end
} def
ClassPic /NotifyUserDown { userdict /ClassPick get exec } put

/SetInstPick {pop} def
/LastInstPick null def
/SetInstPick %  newpick => -
{
    userdict begin
    Font15 setfont
    LastInstPick null ne
    { 
        gsave
        /getcanvas InstPic send setcanvas
        0 1000 LastInstPick 1 add 18 mul sub 3 sub 300 18 rectpath
            InstColor setcolor fill
        0 0 0 rgbcolor setcolor
        5 1000 LastInstPick 1 add 18 mul sub moveto
            InstKeys LastInstPick get show
        grestore
    } if
    /LastInstPick exch def    % pick up newpick
    %% (new InstPick is % \n ) [ LastInstPick ] dbgprintf
    LastInstPick null ne
    {
        /getcanvas InstPic send setcanvas
        0 1000 LastInstPick 1 add 18 mul sub 3 sub 300 18 rectpath
            0 0 0 rgbcolor setcolor fill
        InstColor setcolor
        0 5 1000 LastInstPick 1 add 18 mul sub moveto
            InstKeys LastInstPick get show
    } if
    /updatecanvas InstPic send
    LastInstPick null ne
    {
        [] TextColor TextPic ShowArray
        [
            (INSTANCE  VARIABLE)
            (    ") InstKeys LastInstPick get 256 string cvs (")
                append append append
            InstVals LastInstPick get type
            {
                /arraytype { () InstVals LastInstPick get ExpandArray }
                /dicttype { () InstVals LastInstPick get ExpandDict }
                /Default {() InstVals LastInstPick get 256 string cvs append}
            }
            case
        ] TextColor TextPic ShowArray
    } if
    end
} def
/InstPick
{
    null SetMethodPick
    null SetVarPick
    userdict begin

    10 dict begin
    /y exch def
    /x exch def
    /k 1000 y sub 18 div floor def
    %% (pick is % \n ) [ k ] dbgprintf
    k dup
    end
    InstKeys length 1 sub le
        { SetInstPick }
        { pop }
    ifelse
    end
} def
InstPic /NotifyUserDown { userdict /InstPick get exec } put

/ArrayDepth 0 def
/ExpandArray {    % string array => strings
    /ArrayDepth ArrayDepth 1 add def
    exch ({) append exch
    () ArrayDepth { (    ) append } repeat exch
    {
        dup type /arraytype eq
        {
            ExpandArray
        }
        {
            cvlit 256 string cvs append (  ) append
            dup stringwidth pop 700 gt {
                () ArrayDepth { (    ) append } repeat
            } if
        } ifelse
    } forall
    /ArrayDepth ArrayDepth 1 sub def
    () ArrayDepth { (    ) append } repeat (}  ) append
} def

/ExpandDict {    % dict => strings
    {
        256 string cvs (    ) exch append exch
        256 string cvs (    ) exch append
        { dup stringwidth pop 250 lt { ( ) append } { exit } ifelse } loop
        exch append
    } forall
} def

/LastMethodPick null def
/SetMethodPick %  newpick => -
{
    userdict begin
    Font15 setfont
    LastMethodPick null ne
    { 
        gsave
        /getcanvas MethodPic send setcanvas
        0 1000 LastMethodPick 1 add 18 mul sub 3 sub 300 18 rectpath
            MethodColor setcolor fill
        0 0 0 rgbcolor setcolor
        5 1000 LastMethodPick 1 add 18 mul sub moveto
            MethodKeys LastMethodPick get show
        grestore
    } if
    /LastMethodPick exch def    % pick up newpick
    %% (new MethodPick is % \n ) [ LastMethodPick ] dbgprintf
    LastMethodPick null ne
    {
        /getcanvas MethodPic send setcanvas
        0 1000 LastMethodPick 1 add 18 mul sub 3 sub 300 18 rectpath
            0 0 0 rgbcolor setcolor fill
        MethodColor setcolor
        0 5 1000 LastMethodPick 1 add 18 mul sub moveto
            MethodKeys LastMethodPick get show
    } if
    /updatecanvas MethodPic send
    LastMethodPick null ne
    {
        [] TextColor TextPic ShowArray
        [
            (METHOD  ") MethodKeys LastMethodPick get
                256 string cvs (") append append
            () MethodVals LastMethodPick get ExpandArray
        ] TextColor TextPic ShowArray
    } if
    end
} def
/MethodPick
{
    null SetVarPick
    null SetInstPick
    userdict begin

    10 dict begin
    /y exch def
    /x exch def
    /k 1000 y sub 18 div floor def
    %% (pick is % \n ) [ k ] dbgprintf
    k dup
    end
    MethodKeys length 1 sub le
        { SetMethodPick }
        { pop }
    ifelse
    end
} def
MethodPic /NotifyUserDown { userdict /MethodPick get exec } put

/LastVarPick null def
/SetVarPick %  newpick => -
{
    userdict begin
    Font15 setfont
    LastVarPick null ne
    { 
        gsave
        /getcanvas VarPic send setcanvas
        0 1000 LastVarPick 1 add 18 mul sub 3 sub 300 18 rectpath
            VarColor setcolor fill
        0 0 0 rgbcolor setcolor
        5 1000 LastVarPick 1 add 18 mul sub moveto
            VarKeys LastVarPick get show
        grestore
    } if
    /LastVarPick exch def    % pick up newpick
    %% (new VarPick is % \n ) [ LastVarPick ] dbgprintf
    LastVarPick null ne
    {
        /getcanvas VarPic send setcanvas
        %(hilite %\n) [ LastVarPick ] dbgprintf
        0 1000 LastVarPick 1 add 18 mul sub 3 sub 300 18 rectpath
            0 0 0 rgbcolor setcolor fill
        VarColor setcolor
        0 5 1000 LastVarPick 1 add 18 mul sub moveto
            VarKeys LastVarPick get show
    } if
    /updatecanvas VarPic send
    LastVarPick null ne
    {
        [] TextColor TextPic ShowArray
        [
            (CLASS  VARIABLE)
            (    ") VarKeys LastVarPick get 256 string cvs (")
                append append append
            VarVals LastVarPick get type
            %dup (type was %\n) [ 3 2 roll ] dbgprintf
            {
                /arraytype { () VarVals LastVarPick get ExpandArray }
                /dicttype { () VarVals LastVarPick get ExpandDict }
                /Default { () VarVals LastVarPick get 256 string cvs append }
            }
            case
        ] TextColor TextPic ShowArray
    } if
    end
} def
/VarPick
{
    null SetMethodPick
    null SetInstPick

    userdict begin
    10 dict begin
    /y exch def
    /x exch def
    /k 1000 y sub 18 div floor def
    %% (pick is % \n ) [ k ] dbgprintf
    k dup
    end

    VarKeys length 1 sub le
        { SetVarPick }
        { pop }
    ifelse
    end
} def
VarPic /NotifyUserDown { userdict /VarPick get exec } put

DoClasses
end

jefu@pawl17.pawl.rpi.edu (Jeffrey Putnam) (06/17/88)

In article <56572@sun.uucp> bvs@sun.UUCP (Bruce Schwartz) writes:
>This file contains a NeWS server class browser.  It is a good way to
>roam through the classes loaded into the server.  Although it has
>many deficiencies, (searching, following references), it is generally
>quite useful.

Looks interesting, but...  The copy that got here has the following as
the last few lines: 

>    /makestartinterests { 
>        /makestartinterests HScrollbar send
>        /makestartinterests VScrollbar send
>        [ exch aload length 2 add -1 roll aload pop ]    % join 2 arrays
>        /makestartinterests super send
>        [ exch aload lenQUIT

This would seem to indicate that someone, somewhere got mad and zapped
the file.  Is this stuff available somewhere for anonymous ftp?   
Please do _not_ send me a copy as I have no disk space - and for things
like this need to ftp it each time i need it (sort of a _big_ slow
network file system that requires manual intervention to get every file).


jeff putnam  
jefu@pawl.rpi.edu -or- jeff_putnam%rpitsmts@itsgw.rpi.edu
"People would rather believe a simple lie than the complex truth."

jfjr@mitre-bedford.ARPA (Jerome Freedman) (06/30/88)

   I am writing a NeWS application on a Sun 3.  I need a way to
automatically start a UNIX program and have the output go to 
the new specific window I'm creating using psterm for a vt100
emulation.  I have tried all derivations of the psterm arguments
and have yet to find a way to do so.  Each attempt results in
the output being directed to /dev/null.


    

Jerry Freedman, Jr       "Does Unix have
jfjr@mitre-bedford.arpa      a Buddha nature?"
(617)271-4563