home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / defproc / wprocasm.hqx / wprocasm.a
Encoding:
Text File  |  1990-03-05  |  46.2 KB  |  1,340 lines

  1. ;EASE$$$ READ ONLY COPY of file ╥wprocasm.a╙
  2. ; 1.0    CCH 11/16/1988 Added to EASE.
  3. ; END EASE MODIFICATION HISTORY 
  4. ;
  5. ;File wProcAsm.a
  6. ;--------------------------------------------------------------------------
  7. ;
  8. ;  Window Definition Routine for the
  9. ;        MacIntosh Window Manager
  10. ;
  11. ;  written by Andy Hertzfeld  Aug 4, 1982
  12. ;
  13. ;  (c) 1982-1986 by Apple Computer, Inc.  All rights reserved.
  14. ;
  15. ;     This file contains the window definition procedure
  16. ;  "DocumentProc", the standard Mac window type.  It is
  17. ;  a rectangular window with a title bar.  It is assembled
  18. ;  part of the window manager.
  19. ;
  20. ;  Modification History:
  21. ;
  22. ;     21-Aug-82    AJH  Made DocumentProc support rectangular windows only
  23. ;     30-Aug-82    AJH  Added growIcon hit detection, fixed hit to exclude perimeter drag
  24. ;     07-Sep-82    AJH  Added handler for grow message
  25. ;     12-Sep-82    AJH  Made it so proc doesn't have to calcRgns when not visible
  26. ;     20-Sep-82    AJH  Added go-away button drawing and hit-testing
  27. ;     25-Sep-82    AJH  Added cheap dialogBox window definition proc
  28. ;     28-Sep-82    AJH  New GoAway button; restructured goAway drawing
  29. ;     05-Oct-82    AJH  Removed Init message to save code
  30. ;     06-Oct-82    AJH  Fixed dialogBox dragRgn bug
  31. ;     10-Oct-82    AJH  Converted to QuickDraw trap interface
  32. ;     16-Oct-82    AJH  Fixed GoAway hit-test origin bug
  33. ;     17-OCt-82    AJH  Made both windowProcs preserve A1
  34. ;     07-Nov-82    AJH  Changed DocumentProc hiliting to Lisa way
  35. ;     14-Nov-82    AJH  Improved shape of Grow outline ala Lisa
  36. ;     16-Nov-82    AJH  Made branch table offset-based to save space
  37. ;     16-Nov-82    AJH  Special-cased hiliting of small windows
  38. ;     20-Dec-82    AJH  Changed title bar to 20 pixels tall
  39. ;     24-Dec-82    AJH  Made wProcAsm a separate assembly
  40. ;     17-Mar-83    AJH  Added third variant -- shadowless dBoxProc
  41. ;     27-Apr-83    AJH  only plot, hit-test goAway if window is active
  42. ;     25-Jul-83    SC     Fixed third variant -- frame was incorrect, see DrawDBox
  43. ;     06-Aug-83    AJH  changed hiliting to use pattern
  44. ;     09-Aug-83    AJH  added draw grow icon message receiver
  45. ;     20-Aug-83    AJH  made it only hit-test or draws goAway if window is active
  46. ;     29-Oct-83    AJH  new dBox border
  47. ;     10-Nov-83    AJH  added variant 4 -- just like variant 0, but no inGrow
  48. ;     24-Dec-83    AJH  fixed structRgn calc bug in variant 1
  49. ;     24-Feb-84    AJH  fixed hit-testing of go-away -- was off by 2
  50. ;     09-Jan-85    JTC  modified for MDS assembly: label DocumentProc changed
  51. ;                     to DocProc to avoid collision.
  52. ;     15-Jan-85    EHB  fixed erase of 3 pixels of content rgn in DrawFrame;
  53. ;                     prevented erase of top line in DoTitleString.
  54. ;     15-Jan-85    EHB  eliminated title flicker in CheckHilite; gnrl cleanup
  55. ;     30-Jan-85    EHB  fixed boundary testing of GoAwayBox
  56. ;     14-Feb-85    JTC  named rsrc.
  57. ;     16-May-85    EHB  For GrowBox hitTesting, changed D4=16 to D4=14
  58. ;v3  16-May-85    EHB  Check left of window title when no grow box too
  59. ;     29-Jul-85    EHB  converted back to porkshop
  60. ;v4   5-Aug-85    EHB  Allow variable size titles
  61. ;v5  29-Aug-85    EHB  Variant 8 knows how to zoom
  62. ;     18-Sep-85    EHB  Added routine ChkPoint to allow slop on large zoom size
  63. ;     09-Oct-85    EHB  Added designer zoom icon, restored old close mask
  64. ;     18-Oct-85    EHB  New Zoom positioning (avoid lawsuits). Needs title fixes too
  65. ;                     Add tempRgn to frame to save clip, to calc window's region
  66. ;     18-Oct-85    EHB  Only allow zooming on new ROMs (just in case)
  67. ;     21-Oct-85    EHB  In HitDoc, use BuildTBarRect to hit-test title bar.  The old
  68. ;                     way didn't work with null content regions.
  69. ;     03-Nov-85    EHB  Zoom was one pixel too far left (fix draw and hit)
  70. ;
  71. ;-Reno World------------------------------------------------------------------
  72. ;
  73. ;     <C59/30Jun86> DAF  Added color support on nuMac. Dropped Krispee stuff
  74. ;     <C117/25Sep86> DAF Updated defproc to use RGBForeColor/RGBBackColor
  75. ;     <C203/06Oct86> DAF Updated SetUpColor to look up window part color rather
  76. ;                        than assume part from position.  Changed textMode to
  77. ;                        srcOr for titleString.  Made window rgn square
  78. ;                        conditionally.
  79. ;     <A285/28Oct86> DAF    Changed SquareWindows conditional to be true on nuMac only.
  80. ;     <C407/16Nov86> DAF    Changed textMode to srcCopy, per Cary's recommendation
  81. ;      <C424/18Nov86> DAF    Added portToMap to correct problems in cWindows.
  82. ;     <C491/08Dec86> DAF Locked titleString handle before drawing (OLD BUG!)
  83. ;     <C666/22Jan87> DAF Universal defproc (version 10).  With the exception of 
  84. ;                        Square window flag, this defproc no longer has conditional 
  85. ;                        build sections (all system determination is dynamic)
  86. ;     <C700/26Jan87> DAF Square windows now supported dynamically
  87. ;
  88.  
  89.             BLANKS        ON
  90.             STRING        ASIS
  91.  
  92.             PRINT        OFF
  93.             LOAD        'inc.sum.d'
  94.             LOAD        'nEqu.d'
  95.             INCLUDE        'colorEqu.a'
  96.             PRINT        ON
  97.             
  98. WDEF0        PROC        EXPORT
  99.  
  100. ;
  101. ;  FUNCTION   DocProc(selector: INTEGER;
  102. ;                      window: WindowPtr,
  103. ;                      message: INTEGER;
  104. ;                      parameter: LongInt): LongInt
  105.  
  106. LinkSize    EQU        -34
  107. IsColor        EQU        -34            ; do we have colorQD and toolbox?  [boolean]
  108. Align        EQU        -33            ; a dead byte for IsColor            
  109. SavBkCol    EQU        -32            ; saved wmgrCPort RGBBackColor     (color only)
  110. SavFgCol    EQU        -26            ; saved wmgrCPort RGBForeColor     (color only)
  111. AuxCPtr        EQU        -20            ; pointer to auxCTable            (color only)
  112. AuxCTab        EQU        -16            ; handle to auxCTable            (color only)
  113. TempRgn     EQU     -12         ; <18Oct85>
  114. WInfoRec    EQU     -8            ; <1Aug85>
  115. WAscent     EQU     -8            ; <1Aug85>
  116. WDescent    EQU     -6            ; <1Aug85>
  117. WHeight     EQU     -4            ; <1Aug85>
  118. WBoxDelta    EQU     -2            ; <1Aug85>
  119.  
  120. message        EQU        12            ;                                <C666/22Jan87> DAF
  121.  
  122. HasZoom     EQU     3            ; bit 3 is zoom bit             <EHB 29Aug85>
  123. hasGrow     EQU     2            ; bit 2 is grow bit             <EHB 29Aug85>
  124. wZoom        EQU     wGoAway+1    ;                                <EHB 29Aug85>
  125.  
  126. DocProc
  127.             BRA.S    DP1
  128.  
  129. ; standard header
  130.  
  131.             DC.W    0                    ; flags word
  132.             DC.B    'WDEF'                ; resource type
  133.             DC.W    0                    ; resource ID
  134.             DC.W    10                    ; version number
  135.  
  136. DP1
  137.             LINK    A6,#LinkSize         ; set up a stack frame to address parameters
  138.             MOVEM.L D3-D7/A1-A4,-(SP)    ; save work registers
  139.             
  140. ; test if the message is in range
  141.  
  142.             CMP.W    #wGIconMsg,message(A6)    ; compare to highest value            <C666/22Jan87> DAF
  143.             BGT     OORange                    ; skip it, it's too high            <C666/22Jan87> DAF
  144.             CMP.W    #wDrawMsg,message(A6)    ;  compare to lowest value, too        <C666/22Jan87> DAF
  145.             BMI     OORange                    ;                                    <C666/22Jan87> DAF
  146.             
  147.  
  148.             MOVE.L    (A5),A0             ; get pointer to quickDraw globals            <7Aug85>
  149.             MOVE.L    (A0),-(SP)            ; save current port on stack                <7Aug85>
  150.  
  151. ; Determine type of system.  We need to know if we have color QuickDraw and a color
  152. ;    window manager port.
  153.     
  154.             CMP.W    #$3FFF,ROM85        ; do we have color QD? 
  155.             SLS        IsColor(A6)            ; set boolean depending on color or B&W system
  156.             BHI.S    @BWSys                ; no, this system has B&W QD
  157.  
  158. ; when using the wmgrCPort, it is the defproc's responsibility to reconcile
  159. ;     the wmgrPort and the wmgrCPort.  
  160.  
  161.             BSR     UpdateCPort            ; compare and update wmgrPorts, also set WMgrCPort
  162.  
  163.             BRA.S    @CommonSys            ; 
  164. @BWSys            
  165.             MOVE.L    WMgrPort,-(SP)        ; and set port to window manager port
  166.             _SetPort                    ; 
  167. @CommonSys
  168.  
  169. ; get the font info for this font.    Put the height of the title bar in D7 and wHeight(A6).
  170. ; put the distance of the top of the goaway box from the top of the bar in WBoxDelta(A6).
  171.  
  172. @1            LEA     WInfoRec(A6),A3     ; point to our info rec                     <5Aug85>
  173.             MOVE.L    A3,-(SP)            ; push a pointer                            <5Aug85>
  174.             _GetFontInfo                ; and get the font's info                   <5Aug85>
  175.             MOVE.W    (A3)+,D7            ; (rect inset by 1 when WAscent used)        <5Aug85>
  176.             ADD.W    (A3)+,D7            ; add descent                                <5Aug85>
  177.             ADDQ.W    #4,D7                ; get the height                            <5Aug85>
  178.             BSET    #0,D7                ; make height odd for symmetry                <5Aug85>
  179.             MOVEQ    #19,D1                ; get 19                                    <26Aug85>
  180.             CMP.W    D1,D7                ; force height to 19 min                    <26Aug85>
  181.             BGE.S    @3                    ; => not a tiny font                        <5Aug85>
  182.             SUB.W    D7,D1                ; how much less than 19 is it?                <26Aug85>
  183.             LSR.W    #1,D1                ; used for centering tiny fonts             <26Aug85>
  184.             ADD.W    D1,WAscent(A6)        ; make the ascent "bigger"                    <26Aug85>
  185.             MOVEQ    #19,D7                ;                                            <5Aug85>
  186. @3            MOVE.W    D7,(A3)+            ; WHeight = ascent+descent+2                <5Aug85>
  187.             MOVE.W    D7,D0                ; get height                                <EHB 29Aug85>
  188.             SUB.W    #13,D0                ; subtract height of box                    <5Aug85>
  189.             LSR.W    #1,D0                ; divide by 2                                <5Aug85>
  190.             MOVE.W    D0,(A3)             ; save delta to goAway box                    <5Aug85>
  191.  
  192. ; set up a temp region
  193.  
  194.             CLR.L    -(SP)                ; make room for result                        <EHB 18Oct85>
  195.             _NewRgn                     ; get a new region                            <EHB 18Oct85>
  196.             MOVE.L    (SP)+,TempRgn(A6)    ; and save in our frame                     <EHB 18Oct85>
  197.  
  198. ; save off the current port fore- & backcolors on color systems. 
  199.             
  200.             TST.B    IsColor(A6)            ; is it a color system?
  201.             BEQ.S    @NoColor1            ; nope, so skip this
  202.             
  203.             PEA        SavFgCol(A6)        ; push a pointer to save area
  204.             _GetForeColor                ; get the current color
  205.             PEA        SavBkCol(A6)        ; 
  206.             _GetBackColor                ;
  207.  
  208. ; also, find the auxWinRec and lock it down
  209.             
  210.             CLR.L    -(SP)                ; here's a space for the var handle
  211.             CLR.W    -(SP)                ; function return here
  212.             MOVE.L    14(A6),-(SP)        ; push window ptr 
  213.             PEA        6(SP)                ; a pointer to the space above
  214.             _GetAuxWin                    ; find the auxrec
  215.             ADDQ    #2,SP                ; pitch the boolean (it doesn't matter)
  216.             MOVE.L    (SP)+,A0            ; get the auxRecHandle
  217.             MOVE.L    (A0),A0                ; handle -> ptr
  218.             MOVE.L    winCTable(A0),A0    ; get the colortable handle
  219.             MOVE.L    A0,AuxCTab(A6)        ; save this handle
  220.             _HLock                        ; lock the table down in memory
  221.             MOVE.L    (A0),AuxCPtr(A6)    ; and get a pointer too!
  222.  
  223. @NoColor1                                ; END OF A COLOR-ONLY SECTION
  224.  
  225. ; fetch the parameters into registers
  226.  
  227.             LEA     8(A6),A0            ; get ptr to first parameter
  228.             MOVE.L    (A0)+,D3            ; get param in D3
  229.             MOVE.W    (A0)+,D0            ; get message
  230.             MOVE.L    (A0)+,A3            ; get the window pointer
  231.             MOVE.W    (A0)+,D5            ; get the selector integer
  232.             MOVE    D5,D6                ; keep copy in D6
  233.             AND     #3,D5                ; ignore "inGrow" variant
  234.             CLR.L    (A0)                ; clear out function result
  235.  
  236. ; case out on the message number
  237.  
  238.             ADD     D0,D0                ; double for word index
  239.             LEA     GoDocProc,A0        ; get jump table address
  240.             ADD.W    GODOCPROC(D0),A0    ; compute dispatch address
  241.             JSR     (A0)
  242.  
  243. ; we're done -- restore registers and return to caller
  244.  
  245.             MOVE.L    TempRgn(A6),-(SP)    ; dispose of temp region            <EHB 18Oct85>
  246.             _DisposRgn                    ;                                    <EHB 18Oct85>
  247.  
  248.             TST.B    IsColor(A6)            ; are we on a color system?            
  249.             BEQ.S    @NoColor2            ; if on B&W, then skip            
  250.             
  251.             MOVE.L    AuxCTab(A6),A0        ; get the colortable handle    <DAF 15-Apr-86>
  252.             _HUnlock                    ; release it                <DAF 15-Apr-86>
  253.             
  254. ; restore the fore- and backColors                                    <C203/08Oct86> DAF
  255.             PEA        savBkCol(A6)        ; pointer to RGBColor
  256.             _RGBBackColor                ;
  257.             PEA        savFgCol(A6)        ; pointer to RGBColor
  258.             _RGBForeColor                ;
  259.  
  260. @NoColor2                                ; END OF A COLOR-ONLY SECTION
  261.  
  262.             _SetPort                    ; the old port is on top of stack    <EHB 7Aug85>
  263. OORange                                    ; 'Out Of Range, of course'            <C666/22Jan87> DAF
  264.             MOVEM.L (SP)+,D3-D7/A1-A4    ; restore work registers
  265.             UNLK    A6                    ; unlink stack frame
  266.             MOVE.L    (SP)+,A0            ; get return address
  267.             ADD     #12,SP                ; strip parameters
  268.             JMP     (A0)                ; return to caller
  269.  
  270. ; DocumentProc dispatch table -- entries must be long branches!
  271.  
  272. GODOCPROC
  273.             DC.W    DrawDoc-GoDocProc    ; draw is message #0
  274.             DC.W    HitDoc-GoDocProc    ; hit test is message #1
  275.             DC.W    CalcDoc-GoDocProc    ; calc test is message #2
  276.             DC.W    InitDoc-GoDocProc    ; init is message #3
  277.             DC.W    DisposeDoc-GoDocProc   ; dispose is message #4
  278.             DC.W    GrowDoc-GoDocProc    ; grow message is #5
  279.             DC.W    DrawGIcon-GoDocProc ; draw grow icon is #6
  280.  
  281.  
  282. ; utility UpdateCPort 
  283. ;    This utility compares the pertinent fields of the wmgrPort and the wmgrCPort,
  284. ;    updating the wmgrCPort as necessary to match the wmgrPort.
  285.  
  286. UpdateCPort                                ; <C666/22Jan87> DAF    
  287.             MOVE.L    WmgrCPort,-(SP)        ; make the wmgrCPort the current port
  288.             _SetPort                    ; set it
  289.  
  290.             MOVE.L    WmgrPort,A0            ; get the wmgrPort addr
  291.             MOVE.L    WmgrCPort,A1        ; and the wmgrCPort too
  292.             
  293.             PEA        bkPat(A0)            ; push pointers to pattern for later
  294.             PEA        pnPat(A0)            ;
  295.  
  296. ; copy all fields from pnLoc to end of grafPort, excluding pnPixPat and fillPixPat
  297.  
  298.             LEA        pnLoc(A0),A0                    ; point at source
  299.             LEA        pnLoc(A1),A1                    ; point at dest
  300.             MOVE.L    (A0)+,(A1)+                        ; copy pnLoc
  301.             MOVE.L    (A0)+,(A1)+                        ; copy pnSize
  302.             MOVE.W    (A0)+,(A1)+                        ; copy pnMode
  303.             ADDQ    #8,A0                            ; skip pnPat (aka, pnPixPat,fillPixPat)
  304.             ADDQ    #8,A1                            ; 
  305.             MOVE.W    #((portRec-pnVis)/2)-1,D0        ; set up a counter (long sized)
  306. @1
  307.             MOVE.W    (A0)+,(A1)+                        ; copy it
  308.             DBRA    D0,@1                            ; loop
  309.             
  310. ; now set up the patterns in the wmgrCPort (which is thePort)
  311. ;    the parameters were pushed before the copying loop above
  312.  
  313.             _PenPat
  314.             _BackPat
  315.  
  316.             RTS                            ; <C666/22Jan87> DAF
  317.  
  318. ; InitDoc is used to initialize our zoom size
  319.  
  320. InitDoc     BTST    #hasZoom,D6         ; does it want a zoom box?        <EHB 29Aug85>
  321.             BEQ.S    noZoom                ; => nope, no zoom                <EHB 29Aug85>
  322.             CLR.B    wZoom(A3)            ; assume no zoom box            <EHB 29Aug85>
  323.             TST.W    ROM85                ; running on new roms?            <EHB 18Oct85>
  324.             BMI.S    noZoom                ; => no, use default            <EHB 18Oct85>
  325.             MOVEQ    #16,D0                ; space for 2 rects             <EHB 29Aug85>
  326.             _NewHandle ,CLEAR            ; allocate the space            <EHB 29Aug85>
  327.             BNE.S    noZoom                ; => not able to get space        <EHB 29Aug85>
  328.  
  329. ; set default zoom data.  Consists of 2 fields:  SmallSize, BigSize: Rect
  330.  
  331.             ADDQ.B    #1,wZoom(A3)        ; set zoom flag to TRUE         <EHB 29Aug85>
  332.             MOVE.L    A0,WDataHandle(A3)    ; save handle to data            <EHB 29Aug85>
  333.             MOVE.L    (A0),A4             ; point to data                 <EHB 29Aug85>
  334.             ADDQ.W    #8,A4                ; point to bigSize                <EHB 29Aug85>
  335.  
  336. ; get the size of the zoomed out window in global coordinates.    To do this,
  337. ; pull the screen size from screenbits.bounds and indent a little.
  338.  
  339.             MOVE.L    GrafGlobals(A5),A1    ; point to QuickDraw globals    <EHB 29Aug85>
  340.             MOVE.L    Screenbits+Bounds(A1),(A4)+     ; get topLeft        <EHB 29Aug85>
  341.             MOVE.L    Screenbits+Bounds+4(A1),(A4)+    ; get botRight        <EHB 29Aug85>
  342.             MOVEQ    #3,D0                            ; get indent        <EHB 29Aug85>
  343.             SUB.W    D0,-(A4)            ; indent right                    <EHB 29Aug85>
  344.             SUB.W    D0,-(A4)            ; indent bottom                 <EHB 29Aug85>
  345.             ADD.W    D0,-(A4)            ; indent left                    <EHB 29Aug85>
  346.             ADD.W    D0,-(A4)            ; indent top                    <EHB 29Aug85>
  347.             ADD.W    D7,(A4)             ; past menu bar                 <EHB 29Aug85>
  348.             ADD.W    D7,(A4)             ; and past window title         <EHB 29Aug85>
  349.  
  350.             MOVE.L    (A0),A4             ; A4 = smallsize                <EHB 29Aug85>
  351.  
  352. ; get current size into rect in A4
  353.  
  354. GetRect     MOVE.L    A4,-(SP)            ; push address of rect            <EHB 29Aug85>
  355.             MOVE.L    PortRect(A3),(A4)    ; get topLeft (local)            <EHB 29Aug85>
  356.             MOVE.L    PortRect+4(A3),4(A4)    ; get botRight (local)        <EHB 29Aug85>
  357.             MOVE.L    A3,A0                ; copy portPtr for PortToMap    <C424/18Nov86> DAF
  358.             BSR        PortToMap            ; get the rect pointer            <C424/18Nov86> DAF
  359.             MOVE.L    Bounds(A0),-(SP)    ; push offset locToGlob     <EHB 29Aug85>
  360.             NEG.W    (SP)                    ; make offset positive        <EHB 29Aug85>
  361.             NEG.W    2(SP)
  362.             _OffsetRect                 ; convert rect to global
  363. NoZoom        RTS
  364.  
  365. ; IsItSmall returns NE if the window has been resized or moved (NE if window "small")
  366. ; It updates smallsize if it has.  (If tab, only move small window).
  367. ;            Trashes A0,A1,A4
  368.  
  369. IsItSmall    SUBQ    #8,SP                ; make room for a rect            <EHB 29Aug85>
  370.             MOVE.L    SP,A4                ; point to it                    <EHB 29Aug85>
  371.             BSR.S    GetRect             ; A4 = curSize                    <EHB 29Aug85>
  372.             MOVE.L    wDataHandle(A3),A0    ; get data handle                <EHB 29Aug85>
  373.             MOVE.L    (A0),A2             ; A2 = bigSize                    <EHB 29Aug85>
  374.             ADDQ    #8,A2
  375.  
  376. ; the window is large if all corners are within 7 of their default positions
  377.  
  378.             BSR.S    ChkPoint            ; compare topleft                <EHB 18Sep85>
  379.             BNE.S    IsSmall             ; => not close enough            <EHB 29Aug85>
  380.             BSR.S    ChkPoint            ; compare botright                <EHB 18Sep85>
  381.             BEQ.S    NotSmall            ; => it's close enough          <EHB 29Aug85>
  382. IsSmall     MOVE.L    wDataHandle(A3),A0    ; get data handle                <EHB 29Aug85>
  383.             MOVE.L    (A0),A4             ; save window's current size    <EHB 29Aug85>
  384.             BSR.S    GetRect             ; get current size into A4        <EHB 29Aug85>
  385. SaySmall    MOVEQ    #1,D0                ; return NE!                    <EHB 29Aug85>
  386. NotSmall    ADDQ    #8,SP                ; strip rect from stack         <EHB 29Aug85>
  387.             RTS
  388.  
  389. ChkPoint    MOVE.L    (A2),-(SP)            ; make point into a rect        <EHB 18Sep85>
  390.             MOVE.L    (A2)+,-(SP)         ; by pushing twice                <EHB 18Sep85>
  391.             MOVE.L    SP,-(SP)            ; and insetting by 7            <EHB 18Sep85>
  392.             MOVE.L    #$FFF9FFF9,-(SP)    ;                                <EHB 18Sep85>
  393.             _InsetRect                    ;                                <EHB 18Sep85>
  394.             CLR.W    -(SP)                ; is cursize within 7 of        <EHB 18Sep85>
  395.             MOVE.L    (A4)+,-(SP)         ; that point?                    <EHB 18Sep85>
  396.             PEA     6(SP)                ;                                <EHB 18Sep85>
  397.             _PtInRect                    ;                                <EHB 18Sep85>
  398.             SUBQ.B    #1,(SP)             ; reverse sign of result        <EHB 18Sep85>
  399.             MOVE.B    (SP)+,D0            ;                                <EHB 18Sep85>
  400.             ADDQ    #8,SP                ; strip off the rect            <EHB 18Sep85>
  401.             RTS                         ; exit w/EQ if "Big"            <EHB 18Sep85>
  402.  
  403. ; IsThereZoom returns EQ if zoom not enabled
  404.  
  405. IsThereZoom BTST    #hasZoom,D6         ; zooming variant                <EHB 29Aug85>
  406.             BEQ.S     IsNoZoom            ; => no                         <EHB 29Aug85>
  407.             TST.B    wZoom(A3)            ; did we get the handle?        <EHB 29Aug85>
  408. IsNoZoom    RTS                         ; EQ if no Zoom                 <EHB 29Aug85>
  409.  
  410.  
  411.  
  412. ; DisposeDoc is called when the window is being closed.  All we need to do is
  413. ; give back the handle we borrowed.
  414.  
  415. DisposeDoc    BSR.S    IsThereZoom         ; is there a zoom box?            <EHB 29Aug85>
  416.             BEQ.S    InDisposed            ; => no, we're done             <EHB 29Aug85>
  417.             MOVE.L    wDataHandle(A3),A0    ; get handle to our data        <EHB 29Aug85>
  418.             _DisposHandle                ; release it, ignoring errors    <EHB 29Aug85>
  419. InDisposed    RTS
  420.  
  421.  
  422.  
  423. ; SetUpColor takes a window part identifier in D0, finds the corresponding
  424. ;    part in the AuxWinTable (the part code is in the .value field) and returns
  425. ;    a pointer to its RGB on the stack.  If the requested part is not found,
  426. ;    the first color table element is used (I'd use frameColor, but that might
  427. ;    not be there!).  Trashes A0/D0.        ; rewritten <C177/25Sep86> DAF
  428.  
  429. SetUpColor
  430.             MOVE.L    D1,-(SP)            ; save a register
  431.             MOVE.L    AuxCPtr(A6),A0        ; get the color table pointer
  432.             MOVE.W    CTSize(A0),D1        ; get the color table size
  433.             MULU    #8,D1                ; convert to color table index
  434. LegalIndex    
  435.             CMP.W    CTTable+value(A0,D1),D0    ; is this the one?
  436.             BEQ.S    FoundIt                ; if equal, then done
  437.             SUB.W    #8,D1                ; try the previous one
  438.             BGE.S    LegalIndex            ; loop while index positive
  439.             MOVEQ    #0,D1                ; OK, use the first one
  440. FoundIt        
  441.             LEA        CTTable+rgb(A0,D1),A0 ; get the address of the color to use
  442.             MOVE.L    A0,D0                ; we'll need A0 in a second
  443.             MOVE.L    (SP)+,D1            ; restore the register
  444.             MOVE.L    (SP)+,A0            ; get the return address
  445.             MOVE.L    D0,-(SP)            ; push the rgb addr on the stack
  446.             JMP        (A0)                ; return to caller
  447.             
  448.  
  449. PORTTOMAP                                        ; <C424/18Nov86> DAF
  450. ;----------------------------------------------------------
  451. ;
  452. ; Given a window pointer in A0, return the bitmap/pixmap pointer in A0
  453.  
  454.             ADDQ    #PORTBITS,A0                ;POINT TO BITMAP/PIXMAP HANDLE
  455.             TST        ROWBYTES(A0)                ;BITMAP OR PIXMAP HANDLE?
  456.             BPL.S    GOTBITMAP                    ;=>JUST A BITMAP
  457.             MOVE.L    BASEADDR(A0),A0                ;ELSE GET PORT'S PIXMAP HANDLE
  458.             MOVE.L    (A0),A0                        ;GET PIXMAP POINTER
  459. GOTBITMAP    RTS
  460.  
  461.                         
  462.             
  463. ;  DrawDoc -- draw the document window.   The windowPtr is in A3
  464.  
  465. DrawDoc
  466.             TST.B    WVISIBLE(A3)        ; is it visible?
  467.             BEQ     DoneDoc             ; if not, don't do anything
  468.  
  469. ; see if its a EORGoAway call and special case it
  470.  
  471.             CMP     #wInGoAway,D3        ; is it a goAway call?
  472.             BGE     EorStuff            ; if so, go handle it                <EHB 29Aug85>
  473.  
  474.             _PenNormal                    ; we want the normal pen
  475.             TST.W    D5                    ; test dialogBox flag
  476.             BNE     DrawDBox            ; dBox window has no title bar
  477.  
  478. ; derive the titleBar rectangle from the structRgn and keep it in TempRect
  479.  
  480.             BSR     BuildTBarRect
  481.  
  482. ; draw the title bar
  483.  
  484.             TST.B    IsColor(A6)            ; is it color?            
  485.             BEQ.S    @NoColor3            ; no, so skip this
  486.             
  487.             MOVE.W    #wFrameColor,D0        ; color to set                    <C203/08Oct86> DAF
  488.             BSR.S    SetUpColor            ; set it up                        <C203/08Oct86> DAF
  489.             _RGBForeColor                ;                                 <C203/08Oct86> DAF
  490.             
  491.             MOVE.W    #wTitleBarColor,D0     ;                                  <C203/08Oct86> DAF
  492.             BSR.S    SetUpColor            ;                                 <C203/08Oct86> DAF
  493.             _RGBBackColor                ;                                 <C203/08Oct86> DAF
  494.             
  495. @NoColor3                                ; END OF A COLOR-ONLY SECTION
  496.  
  497.             PEA     TEMPRECT            ; tempRect bounds the title bar
  498.             MOVE.L    (SP),-(SP)            ; make another copy of tempRect pointer
  499.             MOVE.L    (SP),-(SP)            ; and yet another
  500.             _FrameRect                    ; frame the title bar
  501.             MOVE.L    OneOne,-(SP)        ; push inset factor
  502.             _InsetRect
  503.             _EraseRect                    ; clear the inside
  504.  
  505.             BSR     DoTitleString        ;; and draw the centered Title
  506.  
  507. ; To prevent title flicker, DoTitleString returns the left edge of the
  508. ; title in D3 and the right edge in D4.  If the title bar needs to be
  509. ; highlighted, the highlighting is done in 2 sections, one on each side
  510. ; of the title.
  511.  
  512. CheckHilite
  513.             TST.B    WHILITED(A3)        ; is it hilited?
  514.             BEQ     DrawBody            ; => go draw the frame
  515.  
  516. DoHilite    
  517.             TST.B    IsColor(A6)            ; is it color?            
  518.             BEQ.S    @NoColor4            ; no, so skip this
  519.             
  520.             MOVE.W    #wTitleBarColor,D0    ; set up colors                        <C203/08Oct86> DAF
  521.             BSR     SetUpColor            ;
  522.             _RGBBackColor                ;
  523.             
  524.             MOVE.W    #wHiliteColor,D0    ;
  525.             BSR     SetUpColor            ;
  526.             _RGBForeColor                ;                                    <C203/08Oct86> DAF
  527. @NoColor4                                ; END OF A COLOR-ONLY SECTION
  528.  
  529.             PEA     TEMPRECT            ; push the title rect
  530.             MOVE.W    #1,-(SP)            ; push dh                            <5Aug85>
  531.             MOVE.W    WBoxDelta(A6),-(SP) ; push dv                            <5Aug85>
  532.             _InsetRect                    ; inset it some
  533.  
  534.             MOVE.W    TempRect+Right,-(SP)    ; save right of TempRect
  535.             MOVE.W    D3,TempRect+Right        ; new right = title left
  536.  
  537. ; used A4 instead of A0 to save a couple o'bytes (EHB)
  538.  
  539.             MOVE.L    TempRect,D0         ; get topLeft
  540.             AND.L    #$00070007,D0        ; only use mod 8
  541.             MOVE.L    (A5),A4             ; get globals, save in A4
  542.             MOVE.L    D0,PatAlign(A4)     ; set up patAlign
  543.             PEA     TempRect            ; fill this rect
  544.             PEA     HilitePattern        ; push the pattern address
  545.             _FillRect                    ; fill left half with the pattern
  546.  
  547.             BSR      IsThereZoom         ; is zooming allowed? (was .S)                <EHB 18-Oct-85>
  548.             BEQ.S    @1                    ; => no, use current d4             <EHB 18-Oct-85>
  549.             MOVE.W    (SP),D0             ; else get right edge of box        <EHB 18-Oct-85>
  550.             SUB.W    #26,D0                ; how much room is there?            <EHB 18-Oct-85>
  551.             CMP.W    D4,D0                ; need at least 26 pixels            <EHB 18-Oct-85>
  552.             BGE.S    @1                    ; => got 'em, use current d4        <EHB 18-Oct-85>
  553.             MOVE.W    D0,D4                ; else use right-26                 <EHB 18-Oct-85>
  554.  
  555. @1            MOVE.W    (SP)+,TempRect+Right    ; restore right of title box
  556.             MOVE.W    D4,TempRect+Left    ; set new left of title box
  557.             PEA     TempRect            ; fill this rect
  558.             PEA     HilitePattern        ; push the pattern address
  559.             _FillRect
  560.  
  561.             CLR.L    PatAlign(A4)
  562.  
  563. ; plot the goAway button
  564.  
  565. DoGoAway
  566.             TST.B    WGoAway(A3)         ; is there a goaway button?
  567.             BEQ.S    DoZoom                ; => if not, try for zoom        <EHB 29Aug85>
  568.  
  569.             BSR     BuildTBarRect
  570.             LEA     GoAwayData,A1        ; get the goAway symbol
  571.             MOVEQ    #srcCopy,D0         ; plot in srcCopy mode            <EHB 29Aug85>
  572.             BSR     PlotGoAway
  573.  
  574. DoZoom        BSR     IsThereZoom         ; is there a zoom box?            <EHB 29Aug85>
  575.             BEQ.S    DrawBody            ; => no, draw window frame        <EHB 29Aug85>
  576.  
  577.             BSR     BuildTBarRect        ; build a title bar rect        <EHB 29Aug85>
  578.  
  579.             LEA     ZoomData,A1         ; get the zoom data             <EHB 29Aug85>
  580.  
  581.             MOVEQ    #srcCopy,D0         ; plot in srcCopy mode            <EHB 29Aug85>
  582.             BSR     PlotZoom            ; and plot the symbol            <EHB 29Aug85>
  583.  
  584. DrawBody    MOVE.L    OneOne,D4            ; constant for shadowing
  585.  
  586. ; frame the body of the window
  587.  
  588. DrawFrame
  589.             TST.B    IsColor(A6)            ; is it color?
  590.             BEQ.S    @NoColor5            ; no, so skip this section
  591.             
  592.             MOVE.L    #wFrameColor,D0        ; set up colors <C203/08Oct86> DAF
  593.             BSR        SetUpColor            ;                 <C203/08Oct86> DAF
  594.             _RGBForeColor                ;                 <C203/08Oct86> DAF
  595.             MOVE.L    #wContentColor,D0    ; set up background too for variant 1     <CXXX/21Jan87> DAF
  596.             BSR        SetUpColor            ;                                         <CXXX/21Jan87> DAF
  597.             _RGBBackColor                ;                                         <CXXX/21Jan87> DAF
  598. @NoColor5                                ; END OF A COLOR-ONLY SECTION
  599.  
  600.             MOVE.L    STRUCTRGN(A3),A0    ; get region handle
  601.             MOVE.L    (A0),A0             ; get region ptr
  602.             LEA     RGNBBOX(A0),A4        ; point A4 at the bounding box
  603.             SUB     D4,Bottom(A4)        ; inset the bottom (ignore shadow)
  604.             SUB     D4,Right(A4)        ; inset the right to ignore shadow
  605.             MOVE.L    A4,-(SP)            ; push bounding box
  606.             _FrameRect                    ; frame the body
  607.  
  608. ; draw the drop shadow (for variant 0 and 3)
  609.  
  610.             CMP     #3,D5                ; variant 3?
  611.             BEQ.S    @3                    ; if so, paint it
  612.  
  613.             TST.W    D5                    ; variant 0?
  614.             BNE.S    @1                    ; if not, skip
  615. @3
  616.             BSR     PaintDropShadow     ; paint the drop shadow
  617.  
  618. ; draw fancy for dialog box ( only for variant 1)
  619.  
  620. @1
  621.             CMP     #1,D5                ; dialog box?
  622.             BNE.S    @2                    ; if not, skip
  623.  
  624.             MOVE.L    (A4),TempRect        ; copy bounds into tempRect
  625.             MOVE.L    4(A4),TempRect+4
  626.  
  627.             PEA     TempRect
  628.             MOVE.L    (SP),-(SP)            ; copy it
  629.             MOVE.L    (SP),-(SP)
  630.             MOVE.L    OneOne,-(SP)
  631.             _InsetRect                    ; inset it
  632.  
  633.             MOVE.L    #$00070007,-(SP)    ; erase to edge of content rgn
  634.             _PenSize
  635.             MOVE.L    (A5),A0
  636.             PEA     White(A0)
  637.             _PenPat
  638.             _FrameRect
  639.  
  640.             MOVE.L    (A5),A0
  641.             PEA     Black(A0)
  642.             _PenPat
  643.  
  644.             MOVE.L    #$00020002,-(SP)    ; push inset factor
  645.             MOVE.L    (SP),-(SP)            ;; push new pen size
  646.             _PenSize                    ; set new pen size
  647.             _InsetRect
  648.             PEA     TempRect
  649.             _FrameRect                    ; and frame it
  650.  
  651.             _PenNormal
  652.  
  653. @2            
  654.             MOVE.L    STRUCTRGN(A3),A4    ; get region handle again, for safety    <S369/25Jan88> DAF
  655.             MOVE.L    (A4),A4             ; get region ptr                        <S369/25Jan88> DAF
  656.             LEA     RGNBBOX(A4),A4        ; point A4 at the bounding box            <S369/25Jan88> DAF
  657.             
  658.             ADD     D4,Bottom(A4)
  659.             ADD     D4,Right(A4)
  660. DoneDoc
  661.             RTS
  662.  
  663. HilitePattern
  664.             DC.W    $FF00,$FF00,$FF00,$FF00
  665.  
  666.  
  667. ; BuildTBarRect builds a rectangle enclosing the titleBar in TempRect
  668.  
  669. BuildTBarRect
  670.             LEA     TEMPRECT,A0         ; get pointer to tempRect
  671.             MOVE.L    STRUCTRGN(A3),A1    ; get structure region handle
  672.             MOVE.L    (A1),A1             ; get strucRgn pointer
  673.             ADDQ    #RGNBBOX,A1         ; point A1 at the bounding box
  674.             MOVE.L    (A1)+,(A0)            ; copy bounding box into tempRect
  675.             MOVE.L    (A1),4(A0)
  676.  
  677. ;  make bottom := top + WHeight
  678.  
  679.             MOVE    Top(A0),D0            ; get top
  680.             ADD.W    D7,D0                ; add precomputed height                <29Aug85>
  681.             MOVE    D0,Bottom(A0)        ; update bottom
  682.             SUBQ    #1,Right(A0)        ; inset right
  683.             RTS                         ; return to caller
  684.  
  685. ; decide which icon needs hiliting
  686.  
  687. EORStuff    BEQ.S    EORGoAway            ; => it's the goAway                <EHB 29Aug85>
  688.             BSR     IsThereZoom         ; should we do zoom?                <EHB 29Aug85>
  689.             BEQ.S    NoGo                ; => no                             <EHB 29Aug85>
  690.  
  691. ; EORZoom hilites/unhilites the zoom button.  Falls into PlotZoom
  692.  
  693. EORZoom     BSR.S    BuildTBarRect        ; build the bounding rect            <EHB 29Aug85>
  694.  
  695.             LEA     ZoomData+32,A1        ; get the zoom data             <EHB 29Aug85>
  696.  
  697.             MOVEQ    #srcXOR,D0            ; set EOR as the plot mode            <EHB 29Aug85>
  698.  
  699. PlotZoom    LEA     TempRect,A0         ; start from titlebar rect            <EHB 29Aug85>
  700.             MOVE    right(A0),left(A0)    ; left := right-22                    <EHB 03Nov85>
  701.             MOVEQ    #-22,D1             ;                                    <EHB 03Nov85>
  702.             BRA.S    PlotIt                ; use common code to plot it        <EHB 29Aug85>
  703.  
  704. ; EORGoAway hilites/unhilites the goAway button.  It falls through into PlotGoAway
  705.  
  706. EorGoAway
  707.             BSR.S    BuildTBarRect        ; build the bounding rect
  708.             LEA     GoAwayData+32,A1    ; get the bitMap
  709.             MOVEQ    #srcXOR,D0            ; set EOR as the plot mode
  710.  
  711. ; PlotGoAway plots the goAway button.  A1 holds the symbol, D1 the plotting mode
  712.  
  713. PlotGoAway
  714. ; make Temprect into a 16x16 square for our little bitmap
  715.  
  716.             LEA     TempRect,A0         ; point to temprect                     <5Aug85>
  717.             MOVEQ    #7,D1                ; add margin to left                    <5Aug85>
  718.  
  719. PlotIt        ADD.W    D1,left(A0)         ; add offset to left                   <29Aug85>
  720.             MOVE.W    WBoxDelta(A6),D1    ; get offset from top to GABox            <5Aug85>
  721.             ADD.W    D1,(A0)             ; add offset to top                     <5Aug85>
  722.             SUBQ.W    #1,(A0)             ; align bitmap                            <5Aug85>
  723.             MOVE.L    (A0)+,(A0)            ; bottom/right = top/left                <5Aug85>
  724.             MOVEQ    #16,D1                ; get a constant                        <5Aug85>
  725.             ADD.W    D1,(A0)+            ; Bottom = top + 16                     <5Aug85>
  726.             ADD.W    D1,(A0)             ; Right = Left + 16                     <5Aug85>
  727.  
  728.             MOVE.L    #$00100010,D1
  729.             BSR     PlotSymbol            ; plot it in tempRect
  730. NoGo        RTS
  731.  
  732.  
  733. ; DialogBoxes have no title bar and extra shadow
  734.  
  735. DrawDBox
  736.             MOVE.L    #$00020002,D4        ; get shadow factor
  737.             CMP.W    #3,D5                ; does it have shadow?
  738.             BEQ      DrawFrame            ; if so, we're cool (was .S)
  739.             MOVEQ    #0,D4                ; otherwise no shadow
  740.             BRA     DrawFrame            ; go draw it (was .S)
  741.  
  742. ; DoTitleString is the common code that draws the title centered in tempRect.  Warning --
  743. ; it trashes D3.  On exit, the left edge of the title's box is in D3 and
  744. ; the right edge is in D4.
  745.  
  746. DoTitleString
  747.  
  748. ; compute indent factor based on GoAwayButton state
  749.  
  750. @1            MOVE.W    TempRect+Right,D4    ; get right into D4         <EHB 18-Oct-85>
  751.             MOVE.W    D4,D3                ;                            <EHB 18-Oct-85>
  752.             SUB.W    TempRect+Left,D3    ; compute width
  753.  
  754.             SUB.W    WTITLEWIDTH(A3),D3    ; compute extra x
  755.             ASR.W    #1,D3                ; divide by 2
  756.  
  757. ; if the string is too long, position left edge
  758.  
  759.             MOVEQ    #2,D0                ; start title at x = 2        <16-May-85 EHB>
  760.             TST.B    WGoAway(A3)         ; is there a go away button <16-May-85 EHB>
  761.             BEQ.S    @2                    ; skip if there's not       <16-May-85 EHB>
  762.             MOVEQ    #32,D0                ; start title at x = 32     <16-May-85 EHB>
  763. @2            CMP.W    D0,D3                ; to left of x?             <16-May-85 EHB>
  764.             BGE.S    @3                    ; => no, D3 is ok            <16-May-85 EHB>
  765.             MOVE.W    D0,D3
  766. @3
  767.             ADD.W    TempRect+Left,D3    ; compute x position
  768.             MOVE.W    D4,-(SP)            ; save right across clip    <EHB 18-Oct-85>
  769.             BSR     IsThereZoom         ; is there a zoom box?        <EHB 18-Oct-85>
  770.             BEQ.S    @4                    ; => no, edge ok            <EHB 18-Oct-85>
  771.             SUB.W    #32,D4                ; get default right edge    <EHB 18-Oct-85>
  772. @4
  773. ; set clip to d3..d4
  774.  
  775.             MOVE.L     TempRgn(A6),-(SP)    ; get our temp region        <EHB 18-Oct-85>
  776.             MOVE.L     (SP),-(SP)         ; copy for SectRgn            <EHB 18-Oct-85>
  777.             _GetClip                    ; and save for restore        <EHB 18-Oct-85>
  778.  
  779.             MOVE.W    D4,TempRect+Right    ; set right for clipping    <EHB 18-Oct-85>
  780.             PEA     TempRect            ; point to tempRect         <EHB 18-Oct-85>
  781.             _ClipRect                    ; set clipping to it        <EHB 18-Oct-85>
  782.  
  783.             MOVE.L    (A5),A0             ; get globals                <EHB 18-Oct-85>
  784.             MOVE.L    (A0),A0             ; get port                    <EHB 18-Oct-85>
  785.             MOVE.L    ClipRgn(A0),-(SP)    ; and the rect region        <EHB 18-Oct-85>
  786.             MOVE.L    (SP),-(SP)            ; and use clip as dest        <EHB 18-Oct-85>
  787.             _SectRgn                    ; get the intersection        <EHB 18-Oct-85>
  788.  
  789.             MOVE.W    (SP)+,TempRect+Right    ; restore tempRect        <EHB 18-Oct-85>
  790.  
  791.             MOVE.W    D3,-(SP)            ; push left for MoveTo
  792.             MOVE.W    TempRect+Top,D0     ; get top                        <EHB 5Aug85>
  793.             ADD.W    WAscent(A6),D0        ; move down to baseline         <EHB 5Aug85>
  794.             ADDQ.W    #1,D0                ; leave 2 pixels white space    <EHB 7Aug85>
  795.             MOVE.W    D0,-(SP)            ; push baseline                 <EHB 5Aug85>
  796.             _MoveTo
  797.  
  798.             TST.B    IsColor(A6)            ; is it on a color system?    
  799.             BEQ.S    @NoColor6
  800.  
  801.             MOVE.W    #wTitleBarColor,D0    ; set up drawing colors
  802.             BSR        SetUpColor            ;
  803.             _RGBBackColor
  804.             MOVE.W    #wTextColor,D0        ;        
  805.             BSR        SetUpColor            ; 
  806.             _RGBForeColor                ;
  807.             
  808.             MOVE.W    #srcOR,-(SP)        ; set the mode to source OR        <C407/16Nov86> DAF
  809.             _TextMode                    ;                                <C407/16Nov86> DAF            
  810. @NoColor6                                ; END OF A COLOR ONLY SECTION
  811.             
  812.             MOVE.L    WTITLEHANDLE(A3),A0 ; get titleHandle
  813.             _HLock                        ; lock the title down            <C491/08Dec86> DAF
  814.             MOVE.L    (A0),-(SP)            ; push title pointer
  815.             _DrawString                 ; draw it
  816.             MOVE.L    WTitleHandle(A3),A0    ; get the handle again            <C491/08Dec86> DAF
  817.             _HUnlock                    ; release it                    <C491/08Dec86> DAF
  818.             
  819.             MOVE.L    TempRgn(A6),-(SP)    ; push the old clip             <EHB 18-Oct-85>
  820.             _SetClip                    ; and restore it                <EHB 18-Oct-85>
  821.  
  822. ; now calculate the size of the clear area needed for the title
  823. ; (only used if the window is highlighted).
  824.  
  825.             MOVE.W    D3,D0                ; left in D3, calc right in D0
  826.             SUBQ    #6,D3                ; indent to the left
  827.             ADD.W    WTitleWidth(A3),D0    ; add in the length             <EHB 18-Oct-85>
  828.             CMP.W    D4,D0                ; was title longer than space?    <EHB 18-Oct-85>
  829.             BGE.S    @5                    ; => yes, use D4                <EHB 18-Oct-85>
  830.             MOVE.W    D0,D4                ;                                <EHB 18-Oct-85>
  831. @5            ADD.W    #6,D4                ; indent on right                <EHB 18-Oct-85>
  832.             RTS                         ; Left in D3, right in D4
  833.  
  834. ; old arrow zoom data
  835.  
  836. ;ZoomData     .WORD     $0000,$0000,$0078,$0038
  837. ;             .WORD     $0078,$00E8,$01C0,$0380
  838. ;             .WORD     $0700,$2E00,$3C00,$3800
  839. ;             .WORD     $3C00,$0000,$0000,$0000
  840. ; mask
  841. ;             .WORD     $0000,$0000,$0078,$0038
  842. ;             .WORD     $0198,$0008,$0020,$0820
  843. ;             .WORD     $0800,$2000,$3300,$3800
  844. ;             .WORD     $3C00,$0000,$0000,$0000
  845.  
  846. ; Snazzy new zoom data
  847.  
  848. ZoomData    DC.W    $0000,$0000,$BFFB,$2088
  849.             DC.W    $A08B,$2088,$A08B,$2088
  850.             DC.W    $BF8B,$2008,$A00B,$2008
  851.             DC.W    $BFFB,$0000,$0000,$0000
  852. ; mask
  853.             DC.W    $0000,$0000,$0000,$0180
  854.             DC.W    $09A0,$05C0,$0080,$1CF0
  855.             DC.W    $1F80,$0540,$0920,$0100
  856.             DC.W    $0000,$0000,$0000,$0000
  857.  
  858. ; BitMap for default GoAway button
  859.  
  860. GoAwayData
  861.  
  862. ; This is the real goAway Data
  863.  
  864.             DC.W    $0000,$0000,$BFFB,$2008
  865.             DC.W    $A00B,$2008,$A00B,$2008
  866.             DC.W    $A00B,$2008,$A00B,$2008
  867.             DC.W    $BFFB,$0000,$0000,$0000
  868.  
  869. ; starburst mask
  870.  
  871.            DC.W    $0000,$0000,$0000,$0100
  872.            DC.W    $0920,$0540,$0000,$1C70
  873.            DC.W    $0000,$0540,$0920,$0100
  874.            DC.W    $0000,$0000,$0000,$0000
  875.  
  876. ;  Mask for goAway button (concentric squares)
  877.  
  878. ;             .WORD     $0000,$0000,$0000,$0000
  879. ;             .WORD     $0FE0,$0820,$0BA0,$0AA0
  880. ;             .WORD     $0BA0,$0820,$0FE0,$0000
  881. ;             .WORD     $0000,$0000,$0000,$0000
  882.  
  883. ; HitDoc -- perform a hit test on the document.  On entry, D3 contains the mousePoint
  884. ; in global coordinates while A3 holds the window pointer
  885.  
  886. HitDoc
  887.             CLR.W    -(SP)                ; make room for function result
  888.             MOVE.L    D3,-(SP)            ; push the mouse point
  889.             MOVE.L    CONTRGN(A3),-(SP)    ; push content region handle
  890.             _PtInRgn                    ; is the point in the content region?
  891.             TST.B    (SP)+                ; well, is it?
  892.             BEQ.S    NotInContent        ; if not, go check out drag region
  893.  
  894. ; it's in the content region -- see if its in the grow icon area
  895.  
  896.             TST.W    D5                    ; is it a dialogBox?
  897.             BNE.S    justContent         ; if so, its only in the content
  898.             BTST    #hasGrow,D6               ; inGrow enabled?                   <EHB 29Aug85>
  899.             BGT.S    justContent         ; if not, skip
  900.  
  901.             TST.B    WHilited(A3)        ; is it active?
  902.             BEQ.S    justContent         ; if not, it cant be in grow
  903.  
  904.             MOVE.L    ContRgn(A3),A0        ; get region handle
  905.             MOVE.L    (A0),A0             ; get region ptr
  906.             MOVE.L    RgnBBox+botRight(A0),D0 ; get bottom left of content
  907.  
  908. ; first consider the x coordinate <16-May-85 EHB>
  909.  
  910.             MOVEQ    #14,D4                ; keep 14 in a register to save code
  911.  
  912.             SUB     D4,D0                ; offset x by 14
  913.             CMP     D0,D3                ; if <, just in content
  914.             BLT.S    justContent
  915.  
  916. ; its within range on x so try y
  917.  
  918.             SWAP    D0
  919.             SUB     D4,D0                ; check out y dimension
  920.             SWAP    D3
  921.             CMP     D0,D3                ; compare y coordinates
  922.             BLT.S    justContent
  923.  
  924.             MOVEQ    #wInGrow,D0         ; flag in grow Icon
  925.             BRA     DoneHitDoc
  926.  
  927. ; the point is in the content region so return a '1'
  928.  
  929. justContent
  930.             MOVEQ    #wInContent,D0        ; return in content
  931.             BRA      DoneHitDoc            ; go store function result and return
  932.  
  933. ; its not in the content -- see if its in the dragRgn (content extended by titleBar)
  934.  
  935. NotInContent
  936.  
  937.             TST     D5                    ; is it a dialogBox?
  938.             BNE       DoneHit1            ; dBoxes have no drag region
  939.  
  940.             BSR     BuildTBarRect        ; get the title bar rect into A0    <EHB 21-Oct-85>
  941.             CLR.W    -(SP)                ; make room for function result
  942.             MOVE.L    D3,-(SP)            ; push the mouse point
  943.             MOVE.L    A0,-(SP)            ; and push the rect                 <EHB 21-Oct-85>
  944.             _PtInRect                    ; is the point in the title bar?
  945.  
  946.             TST.B    (SP)+                ; examine result
  947.             BEQ.S    DoneHit1            ; if not, return 0 (do nothing)
  948.  
  949.             TST.B    WHilited(A3)        ; is it hilited?
  950.             BEQ.S    ItsInDrag            ; if not, can't be in GoAway
  951.  
  952. ; test vertical for goAway and Zoom since they're the same
  953.  
  954.             MOVE.L    D3,D0                ; check vertical                <EHB 29Aug85>
  955.             SWAP    D0                    ; which is high word of D3        <EHB 29Aug85>
  956.             MOVE.L    A3,A0                ; convert the pointer if its a pixmap <C424/18Nov86> DAF
  957.             BSR        PortToMap            ; convert                        <C424/18Nov86> DAF
  958.             ADD.W    Bounds+Top(A0),D0    ; convert to local            <EHB 29Aug85>
  959.             SUB.W    PortRect+Top(A3),D0     ; compensate for origin     <EHB 29Aug85>
  960.  
  961.             ADD.W    WBoxDelta(A6),D0        ; below box?                <5Aug85>
  962.             BPL.S    ItsInDrag                ; => yes                    <5Aug85>
  963.             ADD.W    #11,D0                    ; in box?                    <5Aug85>
  964.             BMI.S    ItsInDrag                ; => no                     <5Aug85>
  965.  
  966.             TST.B    WGoAway(A3)         ; is there a goAway button?
  967.             BEQ.S    HitZoom             ; => no, hit-test zoom            <EHB 29Aug85>
  968.  
  969.             MOVE.L    D3,D0                ; get mousePt
  970.             ADD     Bounds+Left(A0),D0    ; convert to local (A0 still valid) <C424/18Nov86> DAF
  971.             SUB     PortRect+Left(A3),D0    ; compensate for origin
  972.             CMP     #18,D0                ; is it too far right?
  973.             BGT.S    HitZoom             ; if so, its in drag            <EHB 29Aug85>
  974.             SUBQ.W    #8,D0                ; it must be at least 7
  975.             BMI.S    ItsInDrag
  976.  
  977. ; its in the goAway button so signal it
  978.  
  979.             MOVEQ    #wInGoAway,D0
  980.             BRA.S    DoneHitDoc
  981.  
  982. HitZoom     BSR     IsThereZoom         ; is zooming permitted?         <EHB 29Aug85>
  983.             BEQ.S    ItsInDrag            ; => not in these here parts    <EHB 29Aug85>
  984.  
  985.             MOVE.W    D3,D0                    ; get mousePt                <EHB 29Aug85>
  986.             MOVE.L    A3,A0                    ; convert the pointer if its a pixmap <C424/18Nov86> DAF
  987.             BSR        PortToMap                ; convert                    <C424/18Nov86> DAF
  988.             ADD.W    Bounds+Left(A0),D0    ; convert to local            <EHB 29Aug85>
  989.             SUB.W    PortRect+Right(A3),D0    ; make right edge = 0        <EHB 29Aug85>
  990.             CMP.W    #-19,D0                 ; too far left?             <EHB 03Nov85>
  991.             BLT.S    ItsInDrag                ; => if so, it's in drag    <EHB 29Aug85>
  992.             CMP.W    #-9,D0                    ; too far right?            <EHB 03Nov85>
  993.             BGT.S    ItsInDrag                ; => if so, it's in drag    <EHB 18Oct85>
  994.  
  995.             BSR     IsItSmall                ; is window big?            <EHB 29Aug85>
  996.             BEQ.S    @1                        ; => oh boy, right again    <EHB 29Aug85>
  997.             MOVEQ    #wInZoomOut,D0            ; say window small            <EHB 29Aug85>
  998.             BRA.S    DoneHitDoc                ; und scram-muller            <EHB 29Aug85>
  999.  
  1000. @1            MOVEQ    #wInZoomIn,D0            ; say window big            <EHB 29Aug85>
  1001.             BRA.S    DoneHitDoc                ; and muller out of here    <EHB 29Aug85>
  1002.  
  1003. ItsInDrag    MOVEQ    #wInDrag,D0         ; flag in drag region
  1004.  
  1005. DoneHitDoc    MOVE.L    D0,20(A6)            ; update function result
  1006.  
  1007. DoneHit1    RTS
  1008.  
  1009.  
  1010. ; CalcDoc  -- calculate the structure and content regions for the window pointed
  1011. ; to by A3.  First update size for zooming if necessary
  1012.  
  1013. CalcDoc     BSR     IsThereZoom         ; zoom feature enabled?         <EHB 29Aug85>
  1014.             BEQ.S    @1                    ; => no                         <EHB 29Aug85>
  1015.             BSR     IsItSmall            ; update window size            <EHB 29Aug85>
  1016. @1
  1017.             LEA     TEMPRECT,A0         ; get a pointer to the work rectangle
  1018.             MOVE.L    A0,-(SP)            ; push for later offset
  1019.             MOVE.L    PORTRECT(A3),(A0)+    ; copy topLeft of portRect
  1020.             MOVE.L    PORTRECT+4(A3),(A0) ; copy botLeft of portRect
  1021.  
  1022. ; offset it to global coordinates
  1023.  
  1024.             MOVE.L    A3,A0                ; convert the pointer if its a pixmap <C424/18Nov86> DAF
  1025.             BSR        PortToMap            ; convert                        <C424/18Nov86> DAF
  1026.             MOVE.L    BOUNDS(A0),-(SP)    ; push topLeft of port.portBits.bounds <C424/18Nov86> DAF
  1027.             NEG     0(SP)                ; negate offset
  1028.             NEG     2(SP)                ; both words
  1029.             _OffsetRect                 ; offset tempRect to global coordinates
  1030.  
  1031. ;  make the rectangular content region
  1032.  
  1033.             MOVE.L    CONTRGN(A3),-(SP)    ; content region gets the result
  1034.             PEA     TempRect            ; tempRect is the rectangle
  1035.             _RectRgn                    ; go make the region into content region
  1036.  
  1037. ; now do the structure region.    First correct the bounding rectangle (tempRect) for
  1038. ; structure instead of content
  1039.  
  1040.             MOVE.L    #$00020002,D4        ; get the shadow factor for DBox
  1041.             MOVE.L    STRUCTRGN(A3),-(SP) ; push the structRgn for later
  1042.             PEA     TEMPRECT            ; push a pointer to the rect
  1043.             MOVE.L    (SP),-(SP)            ; make two copies
  1044.             MOVE.L    MinusOne,-(SP)        ; make 1 pixel bigger, all around
  1045.             _InsetRect                    ; make it bigger
  1046.  
  1047.             TST.W    D5                    ; is it dBox?
  1048.             BNE.S    DoDBoxCalc            ; skip if it is
  1049.  
  1050.             MOVE.W    D7,D0                ; move up to top of window                <29Aug85>
  1051.             SUBQ.W    #1,D0                ; tweak it                                <5Aug85>
  1052.             SUB.W    D0,TempRect+Top     ; and set top of struct region            <5Aug85>
  1053.  
  1054.             LSR.L    #1,D4                ; adjust shadow factor
  1055. CalcCommon
  1056.             _RectRgn                    ; RectRgn(structRgn,tempRect)
  1057.  
  1058. ; now add in the 1 or 2 pixel drop shadow (if necessary)
  1059.  
  1060.             TST     D5
  1061.             BEQ.S    @1                    ; if so, it has shadow
  1062.  
  1063.             CMP     #3,D5                ; is it variant 3?
  1064.             BNE.S    NoDropShadow        ; if not, no shadow
  1065. @1
  1066.             TST.B    IsColor(A6)            ; are we on a multi-bit Mac?
  1067.             BEQ.S    NormShadow            ; if not, then do normal shadows
  1068.             TST.W    D5                    ; if it's a dialog box, do a normal shadow also
  1069.             BNE.S    NormShadow            ;
  1070.             
  1071.             ADD.L    D4,TempRect+botright ; increase rect by shadow size
  1072.             MOVE.L    StructRgn(A3),-(SP)    ; push the regionHandle
  1073.             PEA        TempRect            ; and the rect
  1074.             _RectRgn                    ; and set it
  1075.             BRA.S    CommShadow            ; and continue
  1076. NormShadow
  1077.             MOVE.L    TempRgn(A6),-(SP)    ; get temp region                    <EHB 18Oct85>
  1078.             PEA     TempRect            ; push tempRect
  1079.             MOVE.L    (SP),-(SP)            ; save another copy
  1080.             MOVE.L    D4,-(SP)            ; push shadow factor
  1081.             _OffsetRect                 ; offset it
  1082.             _RectRgn
  1083.  
  1084.             MOVE.L    StructRgn(A3),-(SP)
  1085.             MOVE.L    TempRgn(A6),-(SP)    ; get temp region                    <EHB 18Oct85>
  1086.             MOVE.L    StructRgn(A3),-(SP) ; structure gets the result
  1087.             _UnionRgn                    ; add it in
  1088. CommShadow
  1089.  
  1090. ; all done with CalcDocRgns
  1091.  
  1092. NoDropShadow
  1093.             RTS
  1094.  
  1095. DoDBoxCalc
  1096.             CMP     #1,D5                ; is it variant 1?
  1097.             BNE.S    CalcCommon
  1098.  
  1099.             PEA     TempRect            ; push our rectangle
  1100.             MOVE.L    #$FFF9FFF9,-(SP)    ; push (-7,-7)
  1101.             _InsetRect                    ; inset it
  1102.             BRA.S    CalcCommon            ; use common code for the rest
  1103.  
  1104.  
  1105. ; GrowDoc handles the grow message by drawing a grow outline based on the rectangle
  1106. ; passed in D3
  1107.  
  1108. GrowDoc
  1109.  
  1110. ; first make it one pixel bigger to jibe with the structure
  1111.  
  1112.             MOVE.L    D3,-(SP)            ; push the rect
  1113.             MOVE.L    MinusOne,-(SP)        ; push (-1,-1)
  1114.             _InsetRect
  1115.             MOVE.L    D3,A3                ; get rect ptr
  1116.             MOVE.L    Top(A3),-(SP)        ; save topleft for below            <5Aug85>
  1117.             MOVE.W    D7,D0                ; adjust for title                    <29Aug85>
  1118.             SUB.W    #1,D0                ; and tweak it                        <5Aug85>
  1119.             SUB.W    D0,Top(A3)            ; and save it                        <5Aug85>
  1120.  
  1121.             MOVE.L    D3,-(SP)            ; push the rectangle
  1122.             _FrameRect                    ; frame it
  1123.  
  1124. ;  now that the rectangle is drawn, draw the lower horizontal line
  1125.  
  1126.             MOVE.W    Left(A3),-(SP)        ; push left
  1127.             MOVE.W    Bottom(A3),-(SP)    ; push bottom
  1128.             SUB     #16,(SP)            ; really 16 pixels above bottom
  1129.             MOVE.L    (SP),-(SP)            ; make a copy of this point
  1130.             _MoveTo                     ; move to it
  1131.             MOVE.W    Right(A3),2(SP)     ; now go to the right edge
  1132.             _LineTo                     ; draw the horizontal line
  1133.  
  1134. ; draw the upper horizontal line
  1135.  
  1136.             MOVE.L    (SP),Top(A3)        ; restore topLeft, leave on stack    <5Aug85>
  1137.             MOVE.L    (SP),-(SP)            ; make a copy of this point
  1138.             _MoveTo                     ; move to it
  1139.             MOVE.W    Right(A3),2(SP)     ; now go to the right edge
  1140.             _LineTo                     ; draw the horizontal line
  1141.  
  1142. ; draw the vertical line
  1143.  
  1144.             MOVE.W    Right(A3),-(SP)     ; push right
  1145.             SUB     #16,(SP)            ; really want right - 16
  1146.             MOVE.W    Top(A3),-(SP)        ; push top
  1147.             MOVE.L    (SP),-(SP)            ; make a copy of this point
  1148.             _MoveTo                     ; and move to it
  1149.             MOVE.W    Bottom(A3),(SP)     ; now go to bottom edge
  1150.             _LineTo                     ; draw the vertical line
  1151.  
  1152. ; restore the rect back to how it was when we got it
  1153.  
  1154.             MOVE.L    D3,-(SP)            ; push the rect
  1155.             MOVE.L    OneOne,-(SP)        ; push (1,1)
  1156.             _InsetRect
  1157.             RTS                         ; all done!
  1158.  
  1159. ;  Utility PaintDropShadow -- drop shadows the rectangle in A4, by the amount in D4
  1160.  
  1161. PaintDropShadow
  1162.             MOVE.L    D4,-(SP)            ; push shadow factor
  1163.             _PenSize                    ; make penSize = shadow factor
  1164.  
  1165.             MOVE    RIGHT(A4),D0        ; get right of menuRect
  1166.             MOVE    D0,-(SP)            ; push right
  1167.             MOVE    TOP(A4),-(SP)        ; push top
  1168. ;+++        IF not SquareWind THEN            ;                     <C203/06Oct86> DAF
  1169. ;+++            ADD     D4,(SP)             ; want top+shadow
  1170. ;+++        ENDIF                            ;                     <C203/06Oct86> DAF
  1171.             MOVE    D0,-(SP)            ; push right
  1172.             MOVE    BOTTOM(A4),D0        ; get bottom
  1173.             MOVE    D0,-(SP)            ; push bottom
  1174.             MOVE    LEFT(A4),-(SP)        ; push left
  1175. ;+++        IF not SquareWind THEN            ;                     <C203/06Oct86> DAF
  1176. ;+++            ADD     D4,(SP)             ; want left+shadow
  1177. ;+++        ENDIF                            ;                     <C203/06Oct86> DAF
  1178.             MOVE    D0,-(SP)            ; push bottom
  1179.  
  1180.             TST.B    IsColor(A6)            ; are we on a multi-bit Mac?
  1181.             BNE.S    NOffSh                ; if so, then don't offset shadow
  1182.             TST.W    D5                    ; 
  1183.             BEQ.S    NOffSh                ;
  1184.             
  1185. ; adjust shadow line ends            
  1186.             
  1187.             ADD        D4,2(SP)            ; want left+shadow
  1188.             ADD        D4,8(SP)            ; want top+shadow
  1189.                         
  1190. NOffSh
  1191.  
  1192. ; colors are OK here
  1193.  
  1194.             _MoveTo                     ; MoveTo(left+shadow,bottom)
  1195.             _LineTo                     ; LineTo(right,bottom)
  1196.             _LineTo                     ; LineTo(right,top+shadow)
  1197.  
  1198.             _PenNormal                    ; restore normal pen
  1199.             RTS
  1200.  
  1201.  
  1202. ;  PlotSymbol -- plot the little 16 by 16 symbol bitmap pointed to by A1 into the rectangle
  1203. ;  pointed held in TempRect. D0 holds the mode.
  1204.  
  1205. PlotSymbol
  1206.             LEA     IconBitMap,A0        ; get pointer to source bitmap
  1207.             MOVE.L    A1,(A0)+            ; update base address of bitMap
  1208.             MOVE    #2,(A0)+            ; update rowBytes
  1209.             CLR.L    (A0)+                ; topLeft is zero, zero
  1210.             MOVE.L    D1,(A0)             ; adjust boundsRect
  1211.  
  1212. ; push parameters for CopyBits call to transfer arrow bitMap
  1213.  
  1214.             PEA     IconBitMap            ; push pointer source bitmap
  1215.             MOVE.L    (SP),A0             ; remember in A0, too
  1216.             MOVE.L    GrafGlobals(A5),A1        ; get lisaGraf global baseaddress
  1217.             MOVE.L    THEPORT(A1),A1        ; get thePort
  1218.             PEA     PORTBITS(A1)        ; that's the destination bitmap
  1219.  
  1220.             PEA     BOUNDS(A0)            ; boundsRect of bitmap is source
  1221.             PEA     TempRect            ; tempRect is the destination
  1222.             MOVE.W    D0,-(SP)            ; theMode is in D0
  1223.             CLR.L    -(SP)                ; no mask region
  1224.  
  1225. ; the colors should be OK here                                        <DAF 16-Apr-86>
  1226.  
  1227. ; transfer the bitMap (stretching as necessary...)
  1228.  
  1229.             _CopyBits                    ; let Bill stretch those bits
  1230.  
  1231.             RTS                         ; return to caller
  1232.  
  1233.  
  1234.  
  1235. ;  Draw the grow icon.    First make this window the current grafPort
  1236.  
  1237. DrawGIcon
  1238.             MOVE.L    GrafGlobals(A5),A0    ; get the current port and save it <C203> DAF
  1239.             MOVE.L    thePort(A0),-(SP)    ;                                   <C203> DAF
  1240.             
  1241.             MOVE.L    A3,-(SP)            ; push the window's port
  1242.             _SetPort                    ; make that the port
  1243.             
  1244.             
  1245. ; save the foreground and background of the user port & set new colors    <DAF 16-Apr-86>
  1246.  
  1247.             TST.B    IsColor(A6)            ; is this a color system?
  1248.             BEQ.S    @NoColor7            ; nope, so skip this stuff
  1249.             
  1250.             SUBQ    #6,SP                ; make room for rgbColor on stack    <C???/11Jan87> DAF
  1251.             MOVE.L    SP,-(SP)            ; push pointer to placeholder        <C???/11Jan87> DAF
  1252.             _GetForeColor                ; get the window port's foreColor    <C???/11Jan87> DAF
  1253.             
  1254.             SUBQ    #6,SP                ; make room for the backColor too    <C???/11Jan87> DAF
  1255.             MOVE.L    SP,-(SP)            ; push pointer to placeholder        <C???/11Jan87> DAF
  1256.             _GetBackColor                ; get the window port's backColor    <C???/11Jan87> DAF
  1257.  
  1258.             MOVE.W    #wContentColor,D0    ; get the drawing color
  1259.             BSR        SetUpColor            ; 
  1260.             _RGBBackColor                ;                                    <C117/25Sep86> DAF
  1261.  
  1262.             MOVE.W    #wFrameColor,D0        ;
  1263.             BSR        SetUpColor            ;
  1264.             _RGBForeColor                ;                                    <C117/25Sep86> DAF
  1265. @NoColor7                                ; END OF COLOR-ONLY SECTION
  1266.  
  1267. ;  compute the grow icon rectangle in tempRect
  1268.  
  1269.             LEA     TempRect,A4         ; get pointer to tempRect
  1270.             MOVE.L    PortRect+4(A3),4(A4)    ; copy in botRight of tempRect
  1271.             MOVE.L    4(A4),(A4)            ; into the topLeft, too
  1272.             SUB.W    #15,Top(A4)
  1273.             SUB.W    #15,Left(A4)        ; and left, too
  1274.  
  1275. ; plot the grow icon
  1276.  
  1277.             TST.B    WHilited(A3)        ; is it hilited?
  1278.             BEQ.S    ClearGoAway         ; if not, go clear it
  1279.  
  1280.             LEA     GrowBits,A1         ; get pointer to the bits
  1281.             MOVEQ    #0,D0                ; use srcCopy
  1282.             MOVE.L    #$00100010,D1
  1283.             BSR      PlotSymbol            ; plot it
  1284.  
  1285. ; plot the    boundary lines
  1286.  
  1287. PlotBoundary
  1288.             MOVE.W    Left(A4),-(SP)        ; push tempRect.left
  1289.             MOVE.W    (SP),-(SP)            ; copy it again for later
  1290.             MOVE    PortRect+Top(A3),-(SP)    ; push portRect.top
  1291.             _MoveTo                     ; move to it
  1292.             MOVE    PortRect+Bottom(A3),-(SP)    ; push portRect.bottom
  1293.             _LineTo                     ; draw the vertical line
  1294.  
  1295. ; now draw the horizontal line
  1296.  
  1297.             MOVE.W    PortRect+Left(A3),-(SP) ; push portRect.left
  1298.             MOVE.W    Top(A4),-(SP)        ; push tempRect.top
  1299.             _MoveTo
  1300.             MOVE.W    PortRect+right(A3),-(SP)    ; push portRect.right
  1301.             MOVE.W    Top(A4),-(SP)        ; push tempRect.top
  1302.             _LineTo
  1303.  
  1304. ; all done with DrawDocGrow
  1305.  
  1306. DoneDDG
  1307.             TST.B    IsColor(A6)            ; is it a color system?
  1308.             BEQ.S    @NoColor8            ; no, so skip this restore
  1309.             
  1310.             MOVE.L    SP,-(SP)            ; push ptr to rgbColor previously saved on top of stack     <C117/25Sep86> DAF    
  1311.             _RGBBackColor                ;                                 <C117/25Sep86> DAF    
  1312.             ADDQ    #6,SP                ; trash backcolor                <C117/25Sep86> DAF    
  1313.             MOVE.L    SP,-(SP)            ;                                 <C117/25Sep86> DAF    
  1314.             _RGBForeColor                ;                                <C117/25Sep86> DAF    
  1315.             ADDQ    #6,SP                ;                                <C117/25Sep86> DAF    
  1316. @NoColor8                                ; END OF A COLOR-ONLY SECTION
  1317.         
  1318.             _SetPort                    ; restore the incoming port (saved above) <C203> DAF
  1319.                                         
  1320.             RTS
  1321.  
  1322. ClearGoAway
  1323.             PEA     TempRect
  1324.             _EraseRect
  1325.             BRA.S    PlotBoundary
  1326.  
  1327.  
  1328. ; BitMap for GrowIcon
  1329.  
  1330. GrowBits
  1331.             DC.W    $0000,$0000,$0000,$1FE0
  1332.             DC.W    $1020,$103E,$1022,$1022
  1333.             DC.W    $1022,$1022,$1FE2,$0402
  1334.             DC.W    $0402,$0402,$07FE,$0000
  1335.  
  1336.             END 
  1337.  
  1338. ; end of Window DefProc #0
  1339.  
  1340.