mirror of
https://github.com/elliotnunn/sys7.1-doc-wip.git
synced 2024-12-12 04:29:09 +00:00
394 lines
16 KiB
Plaintext
394 lines
16 KiB
Plaintext
;
|
|
; File: TSMPrivate.a
|
|
;
|
|
; Contains: TSM private definitions.
|
|
;
|
|
; Written by: Kenny SC. Tung
|
|
;
|
|
; Copyright: © 1991-1992 by Apple Computer, Inc., all rights reserved.
|
|
;
|
|
; Change History (most recent first):
|
|
;
|
|
; <32> 8/4/92 DCL Moved InformTSM out of the public eye and into TSMPrivate.
|
|
; <31> 7/28/92 DCL Moving applicationFloatKind & systemFloatKind constants out of
|
|
; the public eye and into the private Layers header file. At the
|
|
; request of TechPubs, and with assistance from Dean, Greg and
|
|
; Kenny.
|
|
; <30> 7/16/92 KST #1034952 <Kda>: Added one new patchMask bit constant --
|
|
; kTSMEventBeenCalled.
|
|
; <29> 6/26/92 KST Just added a line of comment.
|
|
; <28> 6/26/92 KST #1033450,1033456,1031316 <JH>: Added a new mask bit
|
|
; 'kInTSMPopUpMenuSelectCall" for tsmPatchFlag to fix the drawing
|
|
; Balloon over floating window bug.
|
|
; <27> 6/18/92 KST <JH>: applicationFloatKind and systemFloatKind are defined in
|
|
; Windows.h but is not defined in any ainlude files. So I define
|
|
; them in here.
|
|
; <26> 6/17/92 KST #1030843 <JH>: Added one field in TSM global for
|
|
; __PopupMenuSelect patch.
|
|
; <25> 6/16/92 KST <JH>: Added one new patchMask bit constant and a new field in
|
|
; TSM document record.
|
|
; <24> 6/10/92 KST #1031142,1030881 <JH>: Added global tsmUseInputWindowDocID and a
|
|
; new bit for our patch flag -- kInTSMEventCallBit.
|
|
; <23> 6/2/92 JH <KST>: Added global tsmRealSystemMenuID.
|
|
; <22> 5/14/92 KST #1025797,<JH>: Added one new message selector 'kMsgHelpHELPMgr'
|
|
; to InformTSM.
|
|
; <21> 5/1/92 KST #1027482,<JH>: Added a constant -- kSWMJustSetCursor.
|
|
; <20> 5/1/92 KST #1028301,<JH>: JH,#1028301: kMaxTSMSelector has changed because
|
|
; SetTSMDialogState, RestoreTSMDialogState.. etc has been removed.
|
|
; <19> 5/1/92 JH Added a byte field to globals that is used to set bit flags that
|
|
; our SetCursor patch will use. Also a mask for testing the low
|
|
; bit.
|
|
; <18> 4/9/92 KST KST,Adding a control parameterblock for communicating with the
|
|
; swmdrvr. Adding 2 selectors for InformTSM.
|
|
; <17> 3/30/92 KST JH, 1025008, 1025009. First attempt to solve the pallete/menu
|
|
; bar flickering problem. Also, we synchronize the keyboard menu
|
|
; with the script of the TSM document.
|
|
; <16> 3/23/92 KST Code changed according to the comments from the code review.
|
|
; <15> 3/12/92 KST We store a refcon in each document record. Added refcon mapping
|
|
; cache in TSM globals.
|
|
; <14> 3/6/92 KST Added a new constant "kLog2PSNEntrySize".
|
|
; <13> 3/4/92 KST Added new fields "tsmSetCursorProc", and "tsmSavedCursorState"
|
|
; in TSM globals.
|
|
; <12> 3/3/92 KST kMaxTSMSelector is now 28.
|
|
; <11> 3/2/92 KST Moved kMaxTSMSelector to TSMPrivate.h, and added a new private
|
|
; trap selector "NewTSMDocument4SWM".
|
|
; <10> 2/28/92 KST Added a new field "tsmSavedLayer" in TSM globals.
|
|
; <9> 2/27/92 KST Add a signature in TSM aware PSN table for error detection.
|
|
; Added a field tsmKillApplicationP in TSM globals.
|
|
; <8> 2/11/92 DCL Changed the name of TSMEqu.[aph] to TextServices.[aph] for
|
|
; better read-ability.
|
|
; <7> 2/10/92 KST Moved TSM message selectors to TSMPrivate. 'inpm' resource now
|
|
; stores FEP ID for the old input method.
|
|
; <6> 2/3/92 KST TSM needs a flag to tell if we are using the old Japanese Input
|
|
; Method when JIM is changed.
|
|
; <5> 2/1/92 KST We don't have a global flag in TSM globals to indicate using
|
|
; bottom window. Change the byte to indicate the number of active
|
|
; text services for ease of debugging.
|
|
; <4> 1/29/92 KST We open one input method for each document. Each document
|
|
; contains a table of 4 opened input method instances for CCJK
|
|
; scripts.
|
|
; <3> 1/11/92 KST TSM globals now has an input method table to store the open
|
|
; default input methods for CJK scripts.
|
|
; <2> 1/9/92 KST If idocID == 0, it affects only one (•• current ••)
|
|
; application.
|
|
; <5> 12/31/91 KST Moved TSMPrivate.a from TextServiceMgr to Internal:ASM: folder.
|
|
; <4> 12/31/91 KST Added document table in PSN table to record open documents.
|
|
; <3> 12/20/91 KST Making progress toward Alpha. Changed "inline" to "TSM", and
|
|
; added new calls.
|
|
; <2> 12/10/91 KST Check in the first time.
|
|
;
|
|
;
|
|
|
|
|
|
; **********************************************************************************************
|
|
; File: "TSMPrivate.a"
|
|
;
|
|
; Written by Kenny SC. Tung
|
|
;
|
|
; Modification History:
|
|
; 10Dec91 KSCT New today.
|
|
;
|
|
; In the TSM globals, we record all the application's process serial number which claims itself
|
|
; as TSM aware. For each application, we also keep a table to record the document IDs it creates.
|
|
; The document keep track of all the open text services. When application terminates or crashes,
|
|
; we can use these tables to clean up the world. Initially, the table contains 10 slots, but will
|
|
; grow as needed.
|
|
; ***********************************************************************************************
|
|
|
|
|
|
IF &TYPE('__TSMAPrivate__') = 'UNDEFINED' THEN
|
|
__TSMAPrivate__ SET 1
|
|
|
|
|
|
INCLUDE 'TextServices.a'
|
|
INCLUDE 'Components.a'
|
|
|
|
|
|
TSMVersion EQU 1 ; version 1
|
|
|
|
swmdrvrRecordMenuIsDown EQU 0 ; from swmdrvr.h
|
|
|
|
|
|
;; messages to TSM ...
|
|
|
|
kMsgNoOP EQU 0 ; no op
|
|
kMsgBkgAppsPSN EQU 1 ; background application's PSN
|
|
kMsgKillTSMApp EQU 2 ; kill TSM aware application
|
|
kMsgChangeToOldJIM EQU 3 ; change to OLD Japanese Input Method
|
|
kMsgSuspendApp EQU 4 ; a non-TSM aware app got suspended
|
|
kMsgResumeApp EQU 5 ; RESUME a non-TSM aware app
|
|
kMsgHelpHELPMgr EQU 6 ; open Component's resource file for Help Mgr
|
|
|
|
kMaxMsgNumber EQU kMsgHelpHELPMgr
|
|
|
|
|
|
; (3) parameter for kMsgChangeToOldJIM -- record of 2 words:
|
|
|
|
sidScript EQU 0 ; script of this old input method
|
|
sidFEPID EQU 2 ; FEP ID
|
|
|
|
|
|
; (6) parameter for kMsgHelpHELPMgr -- record of 6 bytes:
|
|
tsmHelpRefnum EQU 0 ; > 0 if we opened IM's resource file
|
|
tsmHelpWindowPtr EQU 2 ; nil if no floating window
|
|
tsmHelpSavedLayer EQU 6 ; saved current layer (temp free storage)
|
|
tsmHelpRecSize EQU tsmHelpSavedLayer+4
|
|
|
|
|
|
|
|
kTSMSuspend EQU 0 ; suspend the app
|
|
kTSMResume EQU $FFFF ; resume the app
|
|
|
|
;; Private TSM traps ...
|
|
;; The last selector is kFindServiceWindow = 23 as defined in TextServices.h ...
|
|
|
|
kInformTSM equ 22 ; inform TSM with some messages
|
|
kNewTSMDocument4SWM equ 24 ; create new TSM aware document but don't activate input method <#11> <#12>
|
|
kTSMEventFromSWM equ 25 ; TSM event called by SWM <#24>
|
|
|
|
kMaxTSMSelector equ kTSMEventFromSWM
|
|
|
|
|
|
macro
|
|
_InformTSM
|
|
move.w #kInformTSM,d0
|
|
_TSMDispatch
|
|
endm
|
|
|
|
|
|
;;-------------------------------------------------------------------------;;
|
|
|
|
|
|
|
|
|
|
kSavedIMCount EQU 4 ; save 4 input methods (CCJK)
|
|
|
|
; default IM's Component and menu
|
|
ComponentMenuRec RECORD 0
|
|
gComponent ds.l 1 ;component instance
|
|
gMenu ds.l 1 ;input method menu if any
|
|
ComponentMenuSize equ * ;size of the beast
|
|
ENDR
|
|
|
|
; TSM globals ... (if you change something in here, be sure to change TSMPrivate.h too !)
|
|
|
|
|
|
; bits constant for tsmPatchFlags field ...
|
|
|
|
kIMJustSetCursorBit EQU 0 ; bit to test in SetCursor Patch
|
|
kSWMJustSetCursorBit EQU 1 ; bit to test in SetCursor Patch
|
|
kInTSMEventCallBit EQU 2 ; bit set when inside of TSMEvent call <#24>
|
|
kInTSMPopUpMenuSelectCall EQU 3 ; bit set when inside of PopUpMenuSelect call
|
|
kTSMEventBeenCalledBit EQU 4 ; set by _ModalDialogPatch in SWM, reset in TSMEvent
|
|
|
|
|
|
|
|
TSMVarsRec RECORD 0
|
|
tsmRecSize ds.w 1 ; size of this record
|
|
tsmIAPSNTablePtr ds.l 1 ; ptr to table of Inline aware application process serial numbers
|
|
tsmCurrentSLRec ds.b ScriptLanguageRec ; current text service language
|
|
tsmPreviousDocID ds.l 1 ; previous deactivated doc ID, which pallete has not been removed <#17>
|
|
tsmPreviousScript ds.w 1 ; the script which is running when we deactivate the ID above <#17>
|
|
tsmActiveDocID ds.l 1 ; the current active inline document if non-nil
|
|
tsmUseInputWindowDocID ds.l 1 ; the current document which is using the input window <#24>
|
|
tsmActiveTSCount ds.b 1 ; number of active text services for ease of debugging. <#5>
|
|
tsmPMgrActiveP ds.b 1 ; set if Process Manager is active
|
|
tsmUseOldJInputMethodP ds.b 1 ; true if we are using the old Japanese Input Method <#6>
|
|
tsmKillApplicationP ds.b 1 ; true if we are killing the TSM aware application (set by InformTSM) <#9>
|
|
tsmSWMHighPSN ds.l 1 ; background app's (SWM's) high PSN ID
|
|
tsmSWMLowPSN ds.l 1 ; background app's (SWM's) low PSN ID
|
|
tsmCurrentAppHighPSN ds.l 1 ; current app's high PSN ID
|
|
tsmCurrentAppLowPSN ds.l 1 ; current app's low PSN ID
|
|
tsmDefIMInfoTable ds.l kSavedIMCount*2 ; 4 components in SC, J, TC, K order (hard coded based on script code !!!!!!!)
|
|
; each one has a Component and a menu handle
|
|
tsmCacheInstance ds.l 1 ; this instance map ... <#15>
|
|
tsmCacheRefcon ds.l 1 ; ... to this refcon <#15>
|
|
|
|
tsmSWMDrvrRefNum ds.w 1 ; driver refnum
|
|
tsmSendAEProc ds.l 1 ; driver AppleEvent callback
|
|
doCloseSWMWindowCallBack ds.l 1 ; driver CloseWindow callback
|
|
tsmPatchFlags ds.b 1 ; flags for the helpmgr patch and the setcursor patch
|
|
tsmFiller ds.b 1 ; word align this
|
|
tsmRealSystemMenuID ds.w 1 ; original inputmethod ID
|
|
tsmUserProc ds.l 1 ; user proc for modal dialog patch
|
|
|
|
tsmPopUpReturnAddr ds.l 1 ; save return address <#26>
|
|
;tsmCalledUseInputWindow ds.b 1 ; true if TSM called UseInputWindow when there is no ducument <#26>
|
|
;tsmUseInputWindowState ds.b 1 ; the state before TSM called UseInputWindow <#26>
|
|
tsmMajorVersion ds.b 1 ; major version number <#24>
|
|
tsmMinorVersion ds.b 1 ; minor version number <#24>
|
|
tsmDebugSignature ds.l 1 ; signature for debugging
|
|
|
|
|
|
TSMVarsRecSize equ *
|
|
ENDR
|
|
|
|
|
|
|
|
|
|
kDefTableEntryN EQU 8 ; begin with 8 entries and increment by 8 every time
|
|
|
|
|
|
;;-------------------------------------------------------------------------;;
|
|
;; The structure of the table to record TSM aware application's
|
|
;; process serial numbers, stored in tsmIAPSNTablePtr of TSM globals.
|
|
;; Accessed thru Assembler only ....
|
|
|
|
iaAppCount EQU 0 ; (word) number of Inline aware application registered
|
|
iaTotalPSNEntryN EQU 2 ; (word) total number of entries (size) of the table
|
|
iaPSNStart EQU 4 ; start of PSN table array
|
|
|
|
;; Each entry in the array has a PSN, a flag, and a linked list of open documents ...
|
|
;; The entry is filled up when application calls InitTSMAwareApplication.
|
|
|
|
;; 07Jan91 Design changes:
|
|
;; If idocID == 0, it affects only one (•• current ••) application.
|
|
;; If idocID == valid doc ID, it applies to that document only.
|
|
|
|
PSNRecord RECORD 0 ; one record for each TSM aware application
|
|
|
|
psnHighID ds.l 1 ; long (OH! How I hated to use 64 bits PSN)
|
|
psnLowID ds.l 1 ; long
|
|
|
|
;; •• Note: the following 4 bytes has to be contiguous, because it is cleared as CLR.L psnAppUseInputWindowP(A1) in TSMDispatch.a ....
|
|
|
|
psnAppUseInputWindowP ds.b 1 ; byte, set if app should use floating input window
|
|
psnDocUseInputWindowP ds.b 1 ; byte, set if current document is using floating input window
|
|
psnTSMCalledUseIWP ds.b 1 ; byte, true if TSM called UseInputWindow when there is no ducument <#26>
|
|
psnUseInputWindowState ds.b 1 ; byte, the state before TSM called UseInputWindow <#26>
|
|
psnDocsTablePtr ds.l 1 ; long, open documents table pointer (could be nil)
|
|
|
|
kPSNEntrySize EQU * ; each PSN record is 16 bytes
|
|
|
|
ENDR
|
|
|
|
kLog2PSNEntrySize EQU 4 ; log2(PSN record entry size) = 4
|
|
|
|
psnDoWeReallyUseIW EQU PSNRecord.psnAppUseInputWindowP
|
|
; word, test both flags to see if we are using input window
|
|
; psnAppUseInputWindowP and psnDocUseInputWindowP
|
|
|
|
;; the total table size is:
|
|
kPSNTableDefSize EQU kDefTableEntryN * PSNRecord.kPSNEntrySize + iaPSNStart
|
|
;;-------------------------------------------------------------------------;;
|
|
|
|
|
|
|
|
|
|
;; The structure of the table to record document IDs, stored in "psnDocsTablePtr".
|
|
|
|
docIDCount EQU 0 ; (word) number of IDs recorded (excluding input methods)
|
|
docTableEntryN EQU 2 ; (word) total number of entries (size) of the table
|
|
docIDStart EQU 4 ; (long) start of doc IDs
|
|
|
|
;; Each entry has a long word for the ID
|
|
|
|
kDocEntrySize EQU 4 ; each ID is 4 bytes (= document ID)
|
|
kLog2DocEntrySize EQU 2 ; log2(document entry size) = 2
|
|
|
|
kDocTableDefSize EQU kDefTableEntryN * kDocEntrySize + docIDStart ; the table size
|
|
;;-------------------------------------------------------------------------;;
|
|
|
|
|
|
CIListRec RECORD 0
|
|
|
|
ciNextCIListRec ds.l 1 ; next CIListRecord
|
|
ciTheComponent; ds.l 1 ; a saved component
|
|
ciTS ds.l 1 ; a component instance
|
|
ciSLRecord; ds.l 1 ; the primary script.w/language.w
|
|
ciTakeActiveInputP ds.b 1 ; takes active input boolean
|
|
ciMenuVisibleP ds.b 1 ; true if the menu is visible
|
|
ciServiceMenu ds.l 1 ; an associated menu or nil
|
|
|
|
CIListRec equ * ; size
|
|
ENDR
|
|
|
|
|
|
;; TSM document record, this handle is used as TSM document ID
|
|
;; If you change something in here, be sure to change TSMPrivate.[hP] too !
|
|
|
|
TSMDocumentRecord RECORD 0 ; one record for each TSM document
|
|
|
|
iDocSignature ds.l 1 ; (long) signature for verifying the ID
|
|
iDocOpenTextServiceN ds.w 1 ; (word) number of open text services
|
|
iDocCIHead ds.l 1 ; (long) list of open text service Component Instances
|
|
iDocPSNID1 ds.l 1 ; (long) PSN ID 1
|
|
iDocPSNID2 ds.l 1 ; (long) PSN ID 2
|
|
iDocActiveP ds.b 1 ; (byte) true if active
|
|
iDocUseInputWindowP ds.b 1 ; (byte) true if using Input Window
|
|
iDocRefcon ds.l 1 ; (long) refcon <#15>
|
|
iDocUseThisScript ds.w 1 ; (word) the script used by this document <#17>
|
|
iDocGhostSignature ds.l 1 ; for TSM aware app. that has no document <#25>
|
|
iDocDefIMInstanceArray ds.l 16 ; local copy of the IM instances for CCJK scripts
|
|
; defined in TSMPrivate.h, each script uses 4 longs
|
|
iDocInterfaceN ds.w 1 ; (word) number of supported interface types
|
|
iDocOSTypeArray ds.l 1 ; (long) more than 1 record might follow
|
|
|
|
ENDR
|
|
;;-------------------------------------------------------------------------;;
|
|
|
|
|
|
|
|
;; default input method information resource ...
|
|
|
|
;; resource type for default input method saved in System file.
|
|
;; (if you change something in here, be sure to change TSMPrivate.a too !)
|
|
|
|
kTSMDefInputMethodType EQU kInputMethodService
|
|
kTSMDefInputMethodID EQU -8192
|
|
|
|
kINPMresourceSig EQU 'tsmr' ; $74736d72 saved default IM resource signature in "defRsrcSignature"
|
|
|
|
|
|
; one record for each script -- CCJK
|
|
|
|
IMInfoRecord RECORD 0 ; info about the default input method
|
|
imValidP ds.b 1 ; true if record contains valid info
|
|
imUseOldInputMethodP ds.b 1 ; true if user wants to use old input method as the default
|
|
imOldInputMethodFEPID ds.w 1 ; if imUseOldInputMethodP is true, then this is its FEP ID
|
|
imLanguage ds.w 1 ; language
|
|
imCDRec ds ComponentDescription; component description (just description, no component saved)
|
|
imRecSize EQU *
|
|
ENDR
|
|
|
|
|
|
DefIMRecord RECORD 0
|
|
defRsrcSignature DS.L 1 ; TSM resource signature
|
|
defUseFloatWindow DS.B 1 ; global falg - set if use input window (not used (should be 0))
|
|
defReserved DS.B 1 ; not used (should be 0)
|
|
defIMCount DS.W 1 ; number of input methods saved = 4
|
|
defSChineseIM DS IMInfoRecord ; simplified Chinese
|
|
defJapaneseIM DS IMInfoRecord ; Japanese
|
|
defTChineseIM DS IMInfoRecord ; traditional Chinese
|
|
defKoreanIM DS IMInfoRecord ; Korean
|
|
ENDR
|
|
|
|
kTSMSystemMenuID EQU 16500
|
|
;;-------------------------------------------------------------------------;;
|
|
|
|
|
|
|
|
|
|
WindowRecord RECORD 0
|
|
port DS.B $6C ; GrafPort
|
|
windowKind DS.W 1
|
|
visible DS.B 1
|
|
hilited DS.B 1
|
|
goAwayFlag DS.B 1
|
|
spareFlag DS.B 1
|
|
strucRgn DS.L 1
|
|
contRgn DS.L 1
|
|
updateRgn DS.L 1
|
|
windowDefProc DS.L 1
|
|
dataHandle DS.L 1
|
|
titleHandle DS.L 1
|
|
titleWidth DS.W 1
|
|
controlList DS.L 1
|
|
nextWindow DS.L 1
|
|
windowPic DS.L 1
|
|
refCon DS.L 1
|
|
ENDR
|
|
|
|
|
|
|
|
ENDIF ; ...already included |