home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / lang / mpw_asm_ / TrackPopUp.pit / TrackPopUp.a.lst < prev    next >
Encoding:
File List  |  1987-05-13  |  28.2 KB  |  483 lines

  1.                                    ; TrackPopUp.a
  2.                                    ; by Steve Brecher
  3.                                    ; Copyright 1987 Software Supply
  4.                                    ; All Publication Rights Reserved
  5.                                    ; Permission is hereby granted to translate this source code work to
  6.                                    ; computer-executable object or machine code and to distribute the translation
  7.                                    ; without restriction.  However, this work may not be published in printed
  8.                                    ; form without express permission of the copyright holder.
  9.                                    ; If this routine is incorporated in a software product, the author would
  10.                                    ; appreciate (but does not require) credit where feasible.
  11.  
  12.                                    ; Set tabs to 10
  13.  
  14.                                        Load    'MacDefs.d'    ;all of the Apple-supplied EQUates
  15.  
  16.                                    ; This code makes extensive use of "Pascal-ish" macros.  The macros are
  17.                                    ; identical to those which are supplied in the ProgStructMacs.a file that
  18.                                    ; comes with MPW 2.0 (forthcoming as of May 1987) with a couple of exceptions:
  19.                                    ; I use "Subr" instead of "Procedure"; and my version of the "Call" macro
  20.                                    ; automatically generates an Import for any routine which is undefined.
  21.                                    ; Refer to the MPW Asm listing output file to see the macro expansions.
  22.                                    ; The Asm listing will also supply (in the object code portion) the values
  23.                                    ; of symbols and that might not be defined in older EQUate files.
  24.  
  25.                                        Load    'SBMacs.d'
  26.  
  27.                                    ;
  28.                                    ; function TrackPopUp(MHndl:       MenuHandle;
  29.                                    ;          thePt:       Point;      {starting cursor location}
  30.                                    ;          crsrItem:  integer; {item# of item to be initially under cursor}
  31.                                    ;         ): integer;      {item# of selected item, 0 if none}
  32.                                    ;
  33.                                    ; Call this routine when the user clicks on something which should present a
  34.                                    ; pop-up menu.  Pass the global location of the click in thePt.  If the menu is
  35.                                    ; to be drawn such that the cursor is initially in the first item, pass 1 in
  36.                                    ; crsrItem; if in the second item, pass 2, etc.
  37.                                    ;
  38.                                    ; Notes:
  39.                                    ; --This code will work on all Macintosh products from 128K to Mac II, including
  40.                                    ;   Mac XL.  If the large menu bar option is enabled with a Radius FPD, the
  41.                                    ;   pop up menu will use the special 16-point FPD font.
  42.                                    ; --CalcMenuSize(MHndl) must have been called prior to calling TrackPopUp (it need be
  43.                                    ;   called only once at program startup if the items aren't changed).
  44.                                    ; --PopUpMenuSelect is used only on a Mac II even if the trap is otherwise
  45.                                    ;   available.  This is because PopUpMenuSelect is perceptibly slower than our
  46.                                    ;   own code when running on, e.g., a Mac Plus.  PopUpMenuSelect is available
  47.                                    ;   on any Mac running System 4.1 or later; this routine can be shortened by
  48.                                    ;   about half if altered to assume the trap is always available.
  49.                                    ; --The code tests for the existence of the PopUpMenuSelect trap and an
  50.                                    ;   up-to-date MDEF even when running on a Mac II, for historical reasons.
  51.                                    ; --If there is insufficient memory to create a handle for saving the bits under
  52.                                    ;   the menu, MemErr will be set, no menu will display, and 0 will be returned.
  53.                                    ;   This doesn't apply when the _PopUpMenuSelect trap is used; the trap is smart
  54.                                    ;   enough to cause an update event for the area under the menu if it can't get
  55.                                    ;   RAM for saving the bits.
  56.                                    ; --thePt is assumed to be on the main screen (i.e., within screenBits.bounds).
  57.                                    ; --Menu edges are guaranteed to be at least 1 pixel from the sides of the screen
  58.                                    ;   and at least 2 pixels from the menu bar or bottom of the screen.  The
  59.                                    ;   crsrItem argument will not be honored if the menu has to be moved up/down
  60.                                    ;   more than half an item in order fulfill the 2-pixel guarantee.  The 2-pixel
  61.                                    ;   margin is necessary for compatibility with the PopUpMenuSelect trap.
  62.  
  63.                                    ; --The Control Panel setting for chosen item flashes is overridden by the
  64.                                    ;   following value if the Panel setting is larger.  To honor the Panel setting,
  65.                                    ;   set the following value to 128.
  66.         0000 0080                  MaxFlashes    Equ    128    ;limit flashes of chosen item to this
  67.  
  68.                                    Export    Function    TrackPopup(MHndl:L, thePt: L, crsrItem):W
  69. 00000                         2    TrackPopup FUNC      Export
  70. 00000                         2    SF#0002   RECORD    {FramePtr},Decr
  71. 00000                         2    TrackPopup DS.W      0
  72. FFFFC                         3    MHndl     DS.L      1
  73. FFFF8                         3    thePt     DS.L      1
  74. FFFF6                         3    crsrItem  DS.W      1
  75. FFFF2                         2    RetAddr   DS.L      1
  76. FFFF2                                  Var    theBitMap:bitMapRec, SavePort:L, saveItem
  77. FFFEE                         1    LinkA6    DS.L      1
  78. FFFEE   FFEE                  1    FramePtr  EQU       *
  79. FFFE0                         2    theBitMap DS.B      1*14
  80. FFFDC                         2    SavePort  DS.L      1
  81. FFFDA                         2    saveItem  DS.W      1
  82. FFFDA                                   Var    ColorMenu, SaveRGBBackColor:6
  83. FFFD8                         2    ColorMenu DS.W      1
  84. FFFD2                         2    SaveRGBBackColor DS.B      1*6
  85. FFFD2                                  Begin    Save=D3-D6/A2-A4
  86. FFFD2                         1    LocalSize DS.W      0
  87. FFFD2                         1              ENDR
  88. 00000                         1              WITH      SF#0002
  89. 00000   4E56 FFE4             1              LINK      A6,#LocalSize
  90. 00004   A6                    1    FP        SET       A6
  91. 00004   48E7 1E38             1              MOVEM.L   D3-D6/A2-A4,-(A7)
  92. 00008
  93. 00008                              ; This code will make use of an application global, MenuBarHt: integer, which
  94. 00008                              ; contains the menu bar height.  If the application does not supply such
  95. 00008                              ; a global, comment out the following line, and conditional assembly directives
  96. 00008                              ; below will adapt to its absence.
  97. 00008                                  Import    MenuBarHt:Data    ;remove if not available in appl globals
  98. 00008
  99. 00008   7800                            MoveQ    #0,D4
  100. 0000A   382D 0000                      Move    MenuBarHt(A5),D4
  101. 0000E   31C4 0A0A                       Move    D4,TopMenuItem    ;needed for new MDEF, doesn't hurt old
  102. 00012
  103. 00012                                  Call    _GetPort(SavePort(FP):A)
  104. 00012   486E FFEE             1              PEA       SavePort(FP)
  105. 00016   A874                  1              _GetPort
  106. 00018 G 2478 09DE                      Move.L    WmgrPort,A2
  107. 0001C                                  Call    _SetPort(A2:L)
  108. 0001C   2F0A                  1              MOVE.L    A2,-(A7)
  109. 0001E   A873                  1              _SetPort
  110. 00020
  111. 00020                                  Call    FPDHndl        ;Radius FPD info handle in A0 <> nil?
  112. 00020                         1             Import    FPDHndl
  113. 00020   4EBA 0000             1              JSR       FPDHndl
  114. 00024   6722            00048          Beq.S    CalcPos        ;no
  115. 00026 G 2050                           Move.L    (A0),A0        ;yes...
  116. 00028   0828 0005 0001                 Btst    #5,1(A0)        ;FPD big menu bar in use?
  117. 0002E   6718            00048          Beq.S    CalcPos        ;no
  118. 00030                                  Call    SetFPD(#$0100)    ;yes, set largeFontEnable:=true, dontReposition=false
  119. 00030   3F3C 0100             1              MOVE.W    #$0100,-(A7)
  120. 00034                         1             Import    SetFPD
  121. 00034   4EBA 0000             1              JSR       SetFPD
  122. 00038   357C 0010 004A                 Move    #16,txSize(A2)    ;use special 16 point Chicago
  123. 0003E   70FF                           MoveQ    #-1,D0
  124. 00040   31C0 0988                      Move    D0,CurFMFamily    ;invalidate FM cache...
  125. 00044   31C0 0BC6                      Move    D0,FONDID
  126. 00048
  127. 00048                              CalcPos    Call    _CountMItems:W(MHndl(FP):L),D2
  128. 00048   554F                  1              SUBQ.W    #2,A7
  129. 0004A   2F2E 000E             1              MOVE.L    MHndl(FP),-(A7)
  130. 0004E   A950                  1              _CountMItems
  131. 00050   341F                  1              MOVE.W       (A7)+,D2
  132. 00052 G 206E 000E                      Move.L    MHndl(FP),A0
  133. 00056 G 2050                           Move.L    (A0),A0
  134. 00058   2228 0002                      Move.L    menuWidth(A0),D1    ;D1.hi=width, D1.lo=height
  135. 0005C   7000                           MoveQ    #0,D0
  136. 0005E   3001                           Move    D1,D0        ;height
  137. 00060   80C2                           Divu    D2,D0        ;height per item
  138. 00062   3600                           Move    D0,D3
  139. 00064   946E 0008                      Sub    crsrItem(FP),D2    ;number of items to be below cursor
  140. 00068   C0C2                           Mulu    D2,D0        ;height of items below cursor
  141. 0006A   3403                           Move    D3,D2
  142. 0006C   E24A                           Lsr    #1,D2        ;D2 = half of an item's height
  143. 0006E   D042                           Add    D2,D0        ;height below cursor
  144. 00070   9240                           Sub    D0,D1        ;height above cursor
  145. 00072   7402                           MoveQ    #2,D2        ;const for later
  146. 00074   202E 000A                      Move.L    thePt(FP),D0
  147. 00078   4840                           Swap    D0
  148. 0007A   9081                           Sub.L    D1,D0        ;left, top of rect
  149. 0007C   4840                           Swap    D0        ;top, left of rect
  150. 0007E   5040                           AddQ    #8,D0        ;shift it so cursor is 8 in from right
  151. 00080   B042                           Cmp    D2,D0        ;too far left? (min margin 1 to left of frame)
  152. 00082   6C02            00086          Bge.S    @0        ;no
  153. 00084   3002                           Move    D2,D0        ;yes, shift it right: left=2, frame at 1
  154. 00086   47EE FFF8                  @0    Lea    theBitMap+bounds(FP),A3
  155. 0008A   90B8 0A02                      Sub.L    OneOne,D0        ;top left of frame
  156. 0008E   2680                           Move.L    D0,(A3)
  157. 00090   2228 0002                      Move.L    menuWidth(A0),D1
  158. 00094   4841                           Swap    D1        ;height, width
  159. 00096 G 0681 0003 000B                 Add.L    #$30003+8,D1    ;height, width incl. frame & shadow
  160. 0009C                                              ;and extra right margin for balance
  161. 0009C   D081                           Add.L    D1,D0        ;bot,right of shadow
  162. 0009E G 2055                           Move.L    (A5),A0
  163. 000A0   2428 FF90                      Move.L    screenBits+bounds+botRight(A0),D2
  164. 000A4   5542                           SubQ    #2,D2
  165. 000A6   9440                           Sub    D0,D2        ;margin of at least 1 to right?
  166. 000A8   6A06            000B0          Bpl.S    @1        ;yes
  167. 000AA   D042                           Add    D2,D0        ;no, move left...
  168. 000AC   D56B 0002                      Add    D2,left(A3)
  169. 000B0   4842                       @1    Swap    D2        ;screenBits.bounds.bottom
  170. 000B2   5742                           SubQ    #3,D2
  171. 000B4   4840                           Swap    D0        ;right, bot of frame
  172. 000B6   9440                           Sub    D0,D2        ;margin of at least 2 on bottom?
  173. 000B8   6A04            000BE          Bpl.S    @2        ;yes
  174. 000BA   D042                           Add    D2,D0        ;no, move up...
  175. 000BC   D553                           Add    D2,top(A3)
  176. 000BE   4840                       @2    Swap    D0
  177. 000C0   2740 0004                      Move.L    D0,botRight(A3)    ;bot, right of shadow
  178. 000C4   342D 0000                      Move    MenuBarHt(A5),D2
  179. 000C8   5442                           AddQ    #2,D2
  180. 000CA   9453                           Sub    top(A3),D2    ;too high?
  181. 000CC   6F06            000D4          Ble.S    @3        ;no, ok
  182. 000CE   D553                           Add    D2,top(A3)    ;yes, move down
  183. 000D0   D56B 0004                      Add    D2,bottom(A3)
  184. 000D4
  185. 000D4 G 0C78 3FFF 028E             @3    Cmp    #$3FFF,ROM85    ;Mac II or later?
  186. 000DA   53EE FFEA                      Sls    ColorMenu(A6)    ;tentatively, true if color Mac
  187. 000DE   625E            0013E          Bhi.S    @5        ;earlier than Mac II
  188. 000E0   303C 009F                      Move    #$9F,D0        ;unimplemented core routine
  189. 000E4   A746                           _GetTrapAddress NewTool
  190. 000E6 G 2248                           Move.L    A0,A1
  191. 000E8   700B                           MoveQ    #$0B,D0
  192. 000EA   A746                           _GetTrapAddress NewTool    ;_PopUpMenuSelect installed?
  193. 000EC G B3C8                           Cmp.L    A0,A1
  194. 000EE   674E            0013E          Beq.S    @5        ;no
  195. 000F0   6100 01E0       002D2          Bsr    MDEFHandle
  196. 000F4 G 2050                           Move.L    (A0),A0
  197. 000F6 G 0C68 000A 000A                 Cmp    #10,10(A0)    ;got the right MDEF for PopUpMenuSelect?
  198. 000FC G 6540            0013E          Blo.S    @5        ;no
  199. 000FE   594F                           SubQ    #4,SP        ;yes, use _PopUpMenuSelect; result space
  200. 00100                                  Push.L    MHndl(FP)
  201. 00100   2F2E 000E             1          Move.L      MHndl(FP),-(SP)
  202. 00104                                  Call    _InsertMenu((SP):L, #-1) ;must be "hierarchical"
  203. 00104   2F17                  1              MOVE.L    (SP),-(A7)
  204. 00106   3F3C FFFF             1              MOVE.W    #-1,-(A7)
  205. 0010A   A935                  1              _InsertMenu
  206. 0010C   7401                           MoveQ    #1,D2
  207. 0010E   D453                           Add    top(A3),D2    ;top excl frame
  208. 00110   302E 000A                      Move    thePt+v(FP),D0
  209. 00114   9042                           Sub    D2,D0        ;height above cursor
  210. 00116   48C0                           Ext.L    D0
  211. 00118   80C3                           Divu    D3,D0        ;items above one cursor is to be in
  212. 0011A   3200                           Move    D0,D1
  213. 0011C   C0C3                           Mulu    D3,D0        ;height above top of cursor's item
  214. 0011E   D042                           Add    D2,D0        ;top of cursor's item
  215. 00120                                  Push    D0
  216. 00120   3F00                  1          Move.W      D0,-(SP)
  217. 00122                                  Push    left(A3)
  218. 00122   3F2B 0002             1          Move.W      left(A3),-(SP)
  219. 00126   5257                           AddQ    #1,(SP)        ;excl frame
  220. 00128   5241                           AddQ    #1,D1
  221. 0012A                                  Push    D1        ;cursor's item
  222. 0012A   3F01                  1          Move.W      D1,-(SP)
  223. 0012C   A80B                           _PopUpMenuSelect
  224. 0012E                                  Pop    TrackPopUp(FP)
  225. 0012E   3D5F 0012             1        Move.W      (SP)+,TrackPopUp(FP)
  226. 00132                                  Pop    A0
  227. 00132 G 305F                  1        Move.W      (SP)+,A0
  228. 00134   6704            0013A          Beq.S    @4
  229. 00136   3D48 0012                      Move    A0,TrackPopUp(FP)
  230. 0013A   6000 015A       00296      @4    Bra    Done
  231. 0013E
  232. 0013E   426E 0012                  @5    Clr    TrackPopUp(FP)
  233. 00142 G 0641 000F                      Add    #15,D1        ;calc shadowed rowbytes...
  234. 00146   E849                           Lsr    #4,D1
  235. 00148   D241                           Add    D1,D1
  236. 0014A   3001                           Move    D1,D0        ;D0 = rowbytes
  237. 0014C   3740 FFFE                      Move    D0,rowBytes-bounds(A3)
  238. 00150   4841                           Swap    D1        ;D1 = height
  239. 00152   C0C1                           Mulu    D1,D0        ;byte size
  240. 00154   A122                           _NewHandle        ;get handle for saved bits
  241. 00156   6600 0128       00280          Bne    RstFPD        ;whoops
  242. 0015A                                  Push.L    A0        ;save handle on stack for later
  243. 0015A   2F08                  1          Move.L      A0,-(SP)
  244. 0015C   2750 FFFA                      Move.L    (A0),baseAddr-bounds(A3) ;save the pixels in the menu's area...
  245. 00160                                  Call    _CopyBits(portBits(A2):A, baseAddr-bounds(A3):A, A3:L, A3:L, #srcCopy, #0:L)
  246. 00160   486A 0002             1              PEA       portBits(A2)
  247. 00164   486B FFFA             1              PEA       baseAddr-bounds(A3)
  248. 00168   2F0B                  1              MOVE.L    A3,-(A7)
  249. 0016A   2F0B                  1              MOVE.L    A3,-(A7)
  250. 0016C G 4267                  1              MOVE.W    #srcCopy,-(A7)
  251. 0016E G 42A7                  1              MOVE.L    #0,-(A7)
  252. 00170   A8EC                  1              _CopyBits
  253. 00172
  254. 00172   4A2E FFEA                      Tst.B    ColorMenu(FP)    ;color Mac?
  255. 00176   6724            0019C          Beq.S    @7        ;no
  256. 00178                                  Call    _GetMCEntry:L(#0:L),D3 ;color menu?
  257. 00178   594F                  1              SUBQ.W    #4,A7
  258. 0017A G 42A7                  1              MOVE.L    #0,-(A7)
  259. 0017C   AA64                  1              _GetMCEntry
  260. 0017E   261F                  1              MOVE.L       (A7)+,D3
  261. 00180   56EE FFEA                      Sne    ColorMenu(FP)    ;remember to restore backcolor if so
  262. 00184   6716            0019C          Beq.S    @7        ;no
  263. 00186 G 2478 0D2C                      Move.L    WMgrCPort,A2    ;yes, use color WMgrPort for drawing
  264. 0018A                                  Call    _SetPort(A2:L)
  265. 0018A   2F0A                  1              MOVE.L    A2,-(A7)
  266. 0018C   A873                  1              _SetPort
  267. 0018E                                  Call    _GetBackColor(SaveRGBBackColor(FP):A) ;save old backcolor
  268. 0018E   486E FFE4             1              PEA       SaveRGBBackColor(FP)
  269. 00192   AA1A                  1              _GetBackColor
  270. 00194 G 2043                           Move.L    D3,A0        ;menu color table's menubar entry
  271. 00196                                  Call    _RGBBackColor(mctRGB2(A0):A)
  272. 00196   4868 000A             1              PEA       mctRGB2(A0)
  273. 0019A   AA15                  1              _RGBBackColor
  274. 0019C
  275. 0019C                              @7    Call    _ClipRect(portRect(A2):A)
  276. 0019C   486A 0010             1              PEA       portRect(A2)
  277. 001A0   A87B                  1              _ClipRect
  278. 001A2   2638 0A02                      Move.L    OneOne,D3
  279. 001A6   97AB 0004                      Sub.L    D3,botRight(A3)    ;rect sans shadow
  280. 001AA                                  Call    _EraseRect(A3:L)
  281. 001AA   2F0B                  1              MOVE.L    A3,-(A7)
  282. 001AC   A8A3                  1              _EraseRect
  283. 001AE                                  Call    _FrameRect(A3:L)
  284. 001AE   2F0B                  1              MOVE.L    A3,-(A7)
  285. 001B0   A8A1                  1              _FrameRect
  286. 001B2                                  Push    right(A3)        ;draw shadow...
  287. 001B2   3F2B 0006             1          Move.W      right(A3),-(SP)
  288. 001B6                                  Push    top(A3)
  289. 001B6   3F13                  1          Move.W      top(A3),-(SP)
  290. 001B8   5657                           AddQ    #3,(SP)
  291. 001BA                                  Push.L    botRight(A3)
  292. 001BA   2F2B 0004             1          Move.L      botRight(A3),-(SP)
  293. 001BE                                  Push    left(A3)
  294. 001BE   3F2B 0002             1          Move.W      left(A3),-(SP)
  295. 001C2   5657                           AddQ    #3,(SP)
  296. 001C4                                  Push    bottom(A3)
  297. 001C4   3F2B 0004             1          Move.W      bottom(A3),-(SP)
  298. 001C8   A893                           _MoveTo
  299. 001CA   A891                           _LineTo
  300. 001CC   A891                           _LineTo
  301. 001CE                                  Call    _InsetRect(A3:L, D3:L) ;rect sans frame
  302. 001CE   2F0B                  1              MOVE.L    A3,-(A7)
  303. 001D0   2F03                  1              MOVE.L    D3,-(A7)
  304. 001D2   A8A9                  1              _InsetRect
  305. 001D4
  306. 001D4   9853                           Sub    top(A3),D4    ;D4 = -(dist from top of popup to menu bar)
  307. 001D6   4844                           Swap    D4
  308. 001D8                                  Call    _SetOrigin(D4:L)    ;fool MDEF, which draws top at v=menubar ht
  309. 001D8   2F04                  1              MOVE.L    D4,-(A7)
  310. 001DA   A878                  1              _SetOrigin
  311. 001DC                                  Call    _OffsetRect(A3:L, D4:L) ;and adjust our rect accordingly
  312. 001DC   2F0B                  1              MOVE.L    A3,-(A7)
  313. 001DE   2F04                  1              MOVE.L    D4,-(A7)
  314. 001E0   A8A8                  1              _OffsetRect
  315. 001E2                                  Call    _ClipRect(A3:L)    ;clip to inside of frame
  316. 001E2   2F0B                  1              MOVE.L    A3,-(A7)
  317. 001E4   A87B                  1              _ClipRect
  318. 001E6
  319. 001E6   7000                           MoveQ    #mDrawMsg,D0    ;draw the items
  320. 001E8   6100 00CC       002B6          Bsr    CallMDEF
  321. 001EC
  322. 001EC                              TrackIt:    Call    _GetMouse(thePt(FP):A)
  323. 001EC   486E 000A             1              PEA       thePt(FP)
  324. 001F0   A972                  1              _GetMouse
  325. 001F2   7001                           MoveQ    #mChooseMsg,D0
  326. 001F4   6100 00C0       002B6          Bsr    CallMDEF
  327. 001F8                                  Call    _WaitMouseUp:B(),CC
  328. 001F8   554F                  1              SUBQ.W    #2,A7
  329. 001FA   A977                  1              _WaitMouseUp
  330. 001FC   4A1F                  1               TST.B       (A7)+
  331. 001FE   66EC            001EC          Bne.S    TrackIt
  332. 00200
  333. 00200   3D6E 0012 FFEC             MouseUp:    Move    TrackPopUp(FP),saveItem(FP)
  334. 00206   672E            00236          Beq.S    NoFlash
  335. 00208   3838 0A24                      Move    menuFlash,D4
  336. 0020C   6728            00236          Beq.S    NoFlash
  337. 0020E   2A2E 000A                      Move.L    thePt(FP),D5
  338. 00212   5344                           SubQ    #1,D4        ;adjust menu flash for DBra
  339. 00214 G 0C44 007F                      Cmp    #MaxFlashes-1,D4    ;limit per EQU (after Dbra adjust)
  340. 00218   6302            0021C          Bls.S    @0
  341. 0021A   787F                           MoveQ    #MaxFlashes-1,D4
  342. 0021C   42AE 000A                  @0    Clr.L    thePt(FP)
  343. 00220   6100 0088       002AA          Bsr    Flasher
  344. 00224   2D45 000A                      Move.L    D5,thePt(FP)
  345. 00228   6100 0080       002AA          Bsr    Flasher
  346. 0022C G 51CC FFEE       0021C          Dbra    D4,@0
  347. 00230   3D6E FFEC 0012                 Move    saveItem(FP),TrackPopUp(FP)
  348. 00236
  349. 00236                              NoFlash:    Call    _SetOrigin(#0:L)    ;restore WMgr(C)Port's origin
  350. 00236 G 42A7                  1              MOVE.L    #0,-(A7)
  351. 00238   A878                  1              _SetOrigin
  352. 0023A                                  Call    _ClipRect(portRect(A2):A) ;and restore its clipRgn
  353. 0023A   486A 0010             1              PEA       portRect(A2)
  354. 0023E   A87B                  1              _ClipRect
  355. 00240   4244                           Clr    D4
  356. 00242   4484                           Neg.L    D4
  357. 00244                                  Call    _OffsetRect(A3:L, D4:L) ;restore rect to 0-origin basis
  358. 00244   2F0B                  1              MOVE.L    A3,-(A7)
  359. 00246   2F04                  1              MOVE.L    D4,-(A7)
  360. 00248   A8A8                  1              _OffsetRect
  361. 0024A                                  Call    _InsetRect(A3:L, #-1:D0) ;restore bits, incl frame
  362. 0024A   2F0B                  1              MOVE.L    A3,-(A7)
  363. 0024C   70FF                  1              MOVEQ     #-1,D0
  364. 0024E   2F00                  1              MOVE.L    D0,-(A7)
  365. 00250   A8A9                  1              _InsetRect
  366. 00252   D7AB 0004                      Add.L    D3,botRight(A3)    ;and incl shadow
  367. 00256   4A2E FFEA                      Tst.B    ColorMenu(FP)    ;restore back color if we changed it...
  368. 0025A   670E            0026A          Beq.S    @0
  369. 0025C                                  Call    _RGBBackColor(SaveRGBBackColor(FP):A)
  370. 0025C   486E FFE4             1              PEA       SaveRGBBackColor(FP)
  371. 00260   AA15                  1              _RGBBackColor
  372. 00262 G 2478 09DE                      Move.L    WMgrPort,A2    ;revert to old style port for CopyBits
  373. 00266                                  Call    _SetPort(A2:L)
  374. 00266   2F0A                  1              MOVE.L    A2,-(A7)
  375. 00268   A873                  1              _SetPort
  376. 0026A                              @0    Call    _CopyBits(baseAddr-bounds(A3):A, portBits(A2):A, A3:L, A3:L, #srcCopy, #0:L)
  377. 0026A   486B FFFA             1              PEA       baseAddr-bounds(A3)
  378. 0026E   486A 0002             1              PEA       portBits(A2)
  379. 00272   2F0B                  1              MOVE.L    A3,-(A7)
  380. 00274   2F0B                  1              MOVE.L    A3,-(A7)
  381. 00276 G 4267                  1              MOVE.W    #srcCopy,-(A7)
  382. 00278 G 42A7                  1              MOVE.L    #0,-(A7)
  383. 0027A   A8EC                  1              _CopyBits
  384. 0027C                                  Pop.L    A0        ;bits handle
  385. 0027C G 205F                  1        Move.L      (SP)+,A0
  386. 0027E   A023                           _DisposHandle
  387. 00280
  388. 00280                              RstFPD:    Call    SetFPD(#0)    ;if FPD, largeFontEnable := false
  389. 00280 G 4267                  1              MOVE.W    #0,-(A7)
  390. 00282   4EBA 0000             1              JSR       SetFPD
  391. 00286   670E            00296          Beq.S    Done        ;no FPD
  392. 00288   426A 004A                      Clr    txSize(A2)    ;must clear after DisposHandle if FPD
  393. 0028C   70FF                           MoveQ    #-1,D0
  394. 0028E   31C0 0988                      Move    D0,CurFMFamily    ;invalidate FM cache...
  395. 00292   31C0 0BC6                      Move    D0,FONDID
  396. 00296
  397. 00296                              Done:    Call    _SetPort(savePort(FP):L) ;restore port
  398. 00296   2F2E FFEE             1              MOVE.L    savePort(FP),-(A7)
  399. 0029A   A873                  1              _SetPort
  400. 0029C                                  Return
  401. 0029C   4CDF 1C78             1              MOVEM.L   (A7)+,D3-D6/A2-A4
  402. 002A0   4E5E                  1              UNLK      A6
  403. 002A2   205F                  1        MOVEA.L   (A7)+,A0
  404. 002A4   4FEF 000A             1        LEA       10(A7),A7
  405. 002A8   4ED0                  1        JMP       (A0)
  406. 002AA                         1
  407. 002AA
  408. 002AA   7001                       Flasher    MoveQ    #mChooseMsg,D0
  409. 002AC   6108            002B6          Bsr.S    CallMDEF
  410. 002AE G 307C 0003                      Move    #3,A0
  411. 002B2   A03B                           _Delay
  412. 002B4   4E75                           Rts
  413. 002B6
  414. 002B6                              CallMDEF:    Push    D0        ;msg
  415. 002B6   3F00                  1          Move.W      D0,-(SP)
  416. 002B8   6118            002D2          Bsr.S    MDefHandle    ;A0 = MDEF Handle, A1 = MenuHandle
  417. 002BA   A029                           _HLock
  418. 002BC G 2050                           Move.L    (A0),A0
  419. 002BE                                  Push.L    A1        ;menu handle
  420. 002BE   2F09                  1          Move.L      A1,-(SP)
  421. 002C0                                  Push.L    A3        ;rect
  422. 002C0   2F0B                  1          Move.L      A3,-(SP)
  423. 002C2                                  Push.L    thePt(FP)
  424. 002C2   2F2E 000A             1          Move.L      thePt(FP),-(SP)
  425. 002C6   486E 0012                      Pea    TrackPopUp(FP)
  426. 002CA   4E90                           Jsr    (A0)
  427. 002CC   6104            002D2          Bsr.S    MDefHandle
  428. 002CE   A02A                           _HUnlock
  429. 002D0   4E75                           Rts
  430. 002D2
  431. 002D2                              MDefHandle:
  432. 002D2 G 226E 000E                      Move.L    MHndl(FP),A1
  433. 002D6 G 2051                           Move.L    (A1),A0
  434. 002D8 G 2068 0006                      Move.L    menuDefHandle(A0),A0
  435. 002DC   4E75                           Rts
  436. 002DE
  437. 002DE                                  EndP
  438.  
  439. 00000                              FPDHndl    Proc    Export    ;sets A0 = Radius INFO handle, CCR Z flag reflects
  440. 00000
  441. 00000                                  Call    _GetNamedResource:L(#'INFO':L, FPDName:A),D0
  442. 00000   594F                  1              SUBQ.W    #4,A7
  443. 00002   2F3C 494E 464F        1              MOVE.L    #'INFO',-(A7)
  444. 00008   487A 0032       0003C 1              PEA       FPDName
  445. 0000C   A9A1                  1              _GetNamedResource
  446. 0000E   201F                  1              MOVE.L       (A7)+,D0
  447. 00010 G 2040                           Move.L    D0,A0
  448. 00012   4E75                           Rts
  449. 00014
  450. 00014   0000 0014                      Export    SetFPD
  451. 00014
  452. 00014                              ; Procedure SetFPD(Bytes4And5: integer)
  453. 00014                              ; if FPD exists, set values of byte 4 = largeFontEnable and byte 5 = dontReposition
  454. 00014                              ; Sets Z flag if no FPD (Beq NoFPD)
  455. 00014
  456. 00014   61EA            00000      SetFPD:    Bsr.S    FPDHndl
  457. 00016   671E            00036          Beq.S    @0
  458. 00018                                  Push.L    A0
  459. 00018   2F08                  1          Move.L      A0,-(SP)
  460. 0001A G 2050                           Move.L    (A0),A0
  461. 0001C   316F 0008 0004                 Move    4+4(SP),4(A0)
  462. 00022   42A8 0006                      Clr.L    6(A0)        ;always use FPD default cursor routine
  463. 00026                                  Push.L    #'INFO'
  464. 00026   2F3C 494E 464F        1          Move.L      #'INFO',-(SP)
  465. 0002C                                  Push0
  466. 0002C   4267                  1        Clr.W    -(SP)
  467. 0002E   487A 000C       0003C          Pea    FPDName
  468. 00032   A9AB                           _AddResource
  469. 00034   70FF                           MoveQ    #-1,D0        ;clear Z flag
  470. 00036                              @0    Pop.L    A0
  471. 00036 G 205F                  1        Move.L      (SP)+,A0
  472. 00038   544F                           AddQ    #2,SP
  473. 0003A   4ED0                           Jmp    (A0)
  474. 0003C
  475. 0003C                                  String    Pascal
  476. 0003C   0E526164697573             FPDName:    DC.B    'Radius Display'
  477. 0004B
  478. 0004B                                  End
  479.  
  480. Elapsed time: 32.35 seconds.
  481.  
  482. Assembly complete - no errors found.  3145 lines.
  483.