home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacApp / MacApp 3.0a2 / Libraries / UTabTEView.a < prev    next >
Encoding:
Text File  |  1991-05-01  |  6.0 KB  |  234 lines  |  [TEXT/MPS ]

  1. ; Copyright © 1987-1990 by Apple Computer, Inc.  All rights reserved.
  2. ; UTabTEView assembly language routines
  3.                 CASE     ON
  4.                 STRING    ASIS
  5.                 
  6.                 PRINT            OFF
  7.                 INCLUDE         'ToolEqu.a'
  8.                 INCLUDE         'QuickEqu.a'
  9.  
  10.                 INCLUDE         'Macros.a'
  11.                 LOAD            'ProgStrucMacs.d'
  12.                 LOAD            'FlowCtlMacs.d'
  13.                 PRINT            ON
  14.     
  15. **************************************************************************
  16. **                 Record templates and Global Data area                     **
  17. **************************************************************************
  18. GlobalData        RECORD EXPORT
  19.     ALIGN 4
  20.         EXPORT    curTabTEView, HookedCQDProcsPtrOffset, OldTEHooksRecOffset
  21.  
  22. HookedCQDProcsPtrOffset    DS.W        1            ; Offset in SELF of the Pointer to the
  23.                                                 ; HookedTheProcsPointer
  24. OldTEHooksRecOffset        DS.W        1            ; Offset in SELF of the Pointer to the
  25.                                                 ; OldTEHooksRec
  26. curTabTEView            DC.L        0            ; provides context from
  27.                                                 ; the TE Hooks to the Bottleneck procs
  28.                 ENDR
  29.  
  30. ; OldTEHooksRec structure
  31.  
  32. OldTEHooksRec        RECORD EXPORT
  33. drawHook          EQU         0                         ; [ProcPtr]
  34. widthHook          EQU         4                         ; [ProcPtr]
  35. hitTestHook      EQU         8                         ; [ProcPtr]
  36. EOLHook          EQU         $C                         ; [ProcPtr]
  37.                 ENDR
  38.  
  39.  
  40. ;========================================
  41. ; myTEDrawHook
  42. ;========================================
  43. ; on entry        A3: pointer to TERec
  44. ;                A1: Scratch
  45. ;
  46. EXPORT PROCEDURE MYTEDRAWHOOK
  47.     Seg         'TERes'
  48.     VAR oldGrafPort:L                ; the GrafPort found in the TE
  49.     VAR oldGrafProcs:L                ; the grafprocs pointer found in the TE's grafport
  50.     VAR oldCurTEView:L                ; the saved setting of the curTEView
  51.  
  52.     BEGIN with=GlobalData
  53.  
  54.                 MOVEM.L        A2/A4,-(SP)        ; we'll need this back
  55.  
  56. ; get SELF into A4 from the refcon
  57.                 MOVE.L        teFont(A3),A1    ;get handle
  58.                 MOVE.L        (A1),A1            ;first dereference
  59.                 MOVE.L        teRefCon(A1),A4
  60.  
  61. ; Make SELF available to the hooked grafprocs that will be invoked later
  62. ; save the old curTabTEView first
  63.                 MOVE.L        curTabTEView(A5), oldCurTEView(FP)
  64.                 MOVE.L        A4,curTabTEView(A5)
  65.  
  66. ; get pointer to our hooked grafprocs into A1
  67.                 MOVE.L        (A4),A1
  68.                 Add.W        HookedCQDProcsPtrOffset(A5), A1
  69.                 MOVE.L        (A1),A1
  70.  
  71. ; get the port in use by TE
  72.                 MOVEA.L        teGrafPort(A3),A2
  73.                 MOVE.L        A2,oldGrafPort(FP)    ;we'll need this back
  74.  
  75. ; save its old grafprocs pointer
  76.                 MOVE.L        grafProcs(A2),oldGrafProcs(FP)
  77.  
  78. ; stuff in the pointer to our grafprocs
  79.                 MOVE.L        A1,grafProcs(A2)
  80.  
  81. ; get pointer to the oldDrawHook
  82.                 MOVE.L        (A4),A1
  83.                 Add.W        OldTEHooksRecOffset(A5), A1
  84.                 MOVE.L        OldTEHooksRec.drawHook(A1),A1
  85.  
  86. ; restore the munged registers
  87.                 MOVEM.L        (SP)+,A2/A4
  88.  
  89.  
  90. ; Call through to the original routine
  91.                 JSR            (A1)
  92.                 
  93.  
  94. ; restore the old curTabTEView, grafprocs and flag that showed we were hooked in
  95.  
  96.                 MOVE.L        oldCurTEView(FP), curTabTEView(A5)
  97.                 MOVE.L        oldGrafPort(FP),A1
  98.                 MOVE.L        oldGrafProcs(FP),grafProcs(A1)
  99.  
  100.                 RETURN
  101.                 EndP
  102.  
  103.  
  104. ;========================================
  105. ; myTEWidthHook
  106. ;========================================
  107. ; on entry        A3: pointer to TERec
  108. ;                A1: Scratch
  109. ;
  110. EXPORT PROCEDURE MYTEWIDTHHOOK
  111.     Seg         'TERes'
  112.     VAR oldGrafPort:L                ; the GrafPort found in the TE
  113.     VAR oldGrafProcs:L                ; the grafprocs pointer found in the TE's grafport
  114.     VAR oldCurTEView:L                ; the saved setting of the curTEView
  115.  
  116.     BEGIN with=GlobalData
  117.  
  118.                 MOVEM.L        A2/A4,-(SP)        ; we'll need this back
  119.  
  120. ; get SELF into A4 from the refcon
  121.                 MOVE.L        teFont(A3),A1    ;get handle
  122.                 MOVE.L        (A1),A1            ;first dereference
  123.                 MOVE.L        teRefCon(A1),A4
  124.  
  125. ; Make SELF available to the hooked grafprocs that will be invoked later
  126. ; save the old curTabTEView first
  127.                 MOVE.L        curTabTEView(A5), oldCurTEView(FP)
  128.                 MOVE.L        A4,curTabTEView(A5)
  129.  
  130. ; get pointer to our hooked grafprocs into A1
  131.                 MOVE.L        (A4),A1
  132.                 Add.W        HookedCQDProcsPtrOffset(A5), A1
  133.                 MOVE.L        (A1),A1
  134.  
  135. ; get the port in use by TE
  136.                 MOVEA.L        teGrafPort(A3),A2
  137.                 MOVE.L        A2,oldGrafPort(FP)    ;we'll need this back
  138.  
  139. ; save its old grafprocs pointer
  140.                 MOVE.L        grafProcs(A2),oldGrafProcs(FP)
  141.  
  142. ; stuff in the pointer to our grafprocs
  143.                 MOVE.L        A1,grafProcs(A2)
  144.  
  145. ; get pointer to the oldDrawHook
  146.                 MOVE.L        (A4),A1
  147.                 Add.W        OldTEHooksRecOffset(A5), A1
  148.                 MOVE.L        OldTEHooksRec.widthHook(A1),A1
  149.  
  150. ; restore the munged registers
  151.                 MOVEM.L        (SP)+,A2/A4
  152.  
  153.  
  154. ; Call through to the original routine
  155.                 JSR            (A1)
  156.                 
  157.  
  158. ; restore the old curTabTEView, grafprocs and flag that showed we were hooked in
  159.  
  160.                 MOVE.L        oldCurTEView(FP), curTabTEView(A5)
  161.                 MOVE.L        oldGrafPort(FP),A1
  162.                 MOVE.L        oldGrafProcs(FP),grafProcs(A1)
  163.  
  164.                 RETURN
  165.                 EndP
  166.  
  167.  
  168. ;========================================
  169. ; myTEHitTestHook
  170. ;========================================
  171. ; on entry        A3: pointer to TERec
  172. ;                A1: Scratch
  173. ;
  174. ;
  175. ;
  176. ;
  177. EXPORT PROCEDURE MYTEHITTESTHOOK
  178.     Seg         'TERes'
  179.     VAR oldGrafPort:L                ; the GrafPort found in the TE
  180.     VAR oldGrafProcs:L                ; the grafprocs pointer found in the TE's grafport
  181.     VAR oldCurTEView:L                ; the saved setting of the curTEView
  182.  
  183.     BEGIN with=GlobalData
  184.  
  185.                 MOVEM.L        A2/A4,-(SP)        ; we'll need this back
  186.  
  187. ; get SELF into A4 from the refcon
  188.                 MOVE.L        teFont(A3),A1    ;get handle
  189.                 MOVE.L        (A1),A1            ;first dereference
  190.                 MOVE.L        teRefCon(A1),A4
  191.  
  192. ; Make SELF available to the hooked grafprocs that will be invoked later
  193. ; save the old curTabTEView first
  194.                 MOVE.L        curTabTEView(A5), oldCurTEView(FP)
  195.                 MOVE.L        A4,curTabTEView(A5)
  196.  
  197. ; get pointer to our hooked grafprocs into A1
  198.                 MOVE.L        (A4),A1
  199.                 Add.W        HookedCQDProcsPtrOffset(A5), A1
  200.                 MOVE.L        (A1),A1
  201.  
  202. ; get the port in use by TE into A2
  203.                 MOVEA.L        teGrafPort(A3),A2
  204.                 MOVE.L        A2,oldGrafPort(FP)    ;we'll need this back
  205.  
  206. ; save its old grafprocs pointer
  207.                 MOVE.L        grafProcs(A2),oldGrafProcs(FP)
  208.  
  209. ; stuff in the pointer to our grafprocs
  210.                 MOVE.L        A1,grafProcs(A2)
  211.  
  212. ; get pointer to the oldDrawHook
  213.                 MOVE.L        (A4),A1
  214.                 Add.W        OldTEHooksRecOffset(A5), A1
  215.                 MOVE.L        OldTEHooksRec.hitTestHook(A1),A1
  216.  
  217. ; restore the munged registers
  218.                 MOVEM.L        (SP)+,A2/A4
  219.  
  220.  
  221. ; Call through to the original routine
  222.                 JSR            (A1)
  223.                 
  224.  
  225. ; restore the old curTabTEView, grafprocs and flag that showed we were hooked in
  226.  
  227.                 MOVE.L        oldCurTEView(FP), curTabTEView(A5)
  228.                 MOVE.L        oldGrafPort(FP),A1
  229.                 MOVE.L        oldGrafProcs(FP),grafProcs(A1)
  230.  
  231.                 RETURN
  232.                 EndP
  233.  
  234.                 END