mirror of
https://github.com/antoinevignau/source.git
synced 2024-07-27 19:29:06 +00:00
1 line
8.6 KiB
Plaintext
1 line
8.6 KiB
Plaintext
|
load 'macros.dump'
include 'driver.equ'
include 'scrap.equ'
include 'dbsc.equ'
IMPORT D_AlertBox
IMPORT X_AsciiFilter
IMPORT X_CacheRefcon
IMPORT X_CacheType
IMPORT X_CompareHandles
IMPORT X_ConvertScrap
IMPORT X_CopyScrap
IMPORT X_DisposeScrap
IMPORT D_DrawClip
IMPORT D_FixPaste
IMPORT X_KillCacheScrap
IMPORT X_KillOldScrap
IMPORT D_NeedHand
IMPORT X_ScrapRefCon
IMPORT X_ScrapType
ENTRY X_CheckDBPict
entry X_PostScrap
entry X_GetScrap
entry X_CheckScrap
;*********************************************************************
;
; X_ReadStandardScrap - Takes what is off of the public clipboard
; and puts it on the internal.
;
;*********************************************************************
X_ReadStandardScrap PROC EXPORT
;Using X_ClipData
local ScrapSize:l,Handle:l,TempHand:l
error err
begin +b
stz err
; Check for Q_Text scrap. There is no get scrap call in the scrap manager
SpaceLong
PushWord #AppleText
_GetScrapSize
sta err
PullLong ScrapSize
jcc Text_Scrap
lda err
cmp #$1610 ;See if scrap of type
jeq PictScrap
brl exit
;We have a Q_Text scrap, so make handle and get it
text_scrap
lda ScrapSize
ora ScrapSize+2
jeq PictScrap
SpaceLong
PushLong ScrapSize
jsl D_NeedHand ;Leave result on stack
jcs mem_err
MoveLong 1:s,Handle ;
PushWord #AppleText ;for this call
_GetScrap
jcc noerr
sta err
brl exit
noerr Cmpw X_CacheType,#AsciiText
bne nocache1
MoveLong X_CacheRefcon,TempHand
Cpzl [TempHand]
beq nocache1
SpaceWord
PushLong Handle
PushLong X_CacheRefcon
jsl X_CompareHandles
pla
jeq exit
nocache1
PushLong Handle ; So we don't get control chars
jsl X_AsciiFilter ; in the word processor
PushWord #AsciiText
PushLong Handle
jsl X_PostScrap
brl exit
mem_err sta err ;Store the error and return
pla
pla
brl exit
;We have a pict. Do the same thing.
pictscrap
SpaceLong
PushWord #ApplePict
_GetScrapSize
sta err
PullLong ScrapSize
jcc dopict
brl exit
dopict lda ScrapSize
ora ScrapSize+2
jeq exit
SpaceLong
PushLong ScrapSize
jsl D_NeedHand ;Leave result on stack
jcs mem_err
MoveLong 1:s,Handle
PushWord #ApplePict ;for this call
_GetScrap
jcc noerrpict
sta err
brl exit
noerrpict
Cmpw X_CacheType,#PICT
bne nocache2
MoveLong X_CacheRefcon,TempHand
Cpzl [TempHand]
beq nocache2
SpaceWord
PushLong Handle
PushLong X_CacheRefcon
jsl X_CompareHandles
pla
jeq exit
nocache2
PushWord #PICT
PushLong Handle
jsl X_PostScrap
exit _ZeroScrap
return err
ENDP
;*********************************************************************
;
; X_WriteStandardScrap - Takes the internal clipboard and puts it on the
; standard clipboard
;
;*********************************************************************
X_WriteStandardScrap PROC EXPORT
;Using X_ClipData
local RefCon:l,Type:w
error err
begin +b
stz err
lda X_ScrapType ;If there is no scrap, go away
cmp #X_NullScrap
jeq exit
SpaceWord
SpaceLong
PushLong #StandardScraps
jsl X_GetScrap
sta err
PullLong Refcon
PullWord Type
jcc doit
_ZeroScrap
SpaceWord
SpaceLong
PushLong #StandardScraps
jsl X_GetScrap
sta err
PullLong Refcon
PullWord Type
bcc doit
SpaceWord
PushWord #OKBox
PushLong #CantWriteStr
jsl D_AlertBox
pla
MoveWord #-1,err
brl exit
CantWriteStr
STR 'Not enough memory to convert the clipboard',CR,'for use with other applications.'
doit
lda Type
beq Exit
_ZeroScrap
SpaceLong
PushLong RefCon
_GetHandleSize ;Leave result on stack for next call
lda Type
cmp #PICT
bne Q_Text
PushWord #ApplePict
bra goon
Q_Text PushWord #AppleText
goon PushLong [Refcon]
_PutScrap
sta err
PushWord Type
PushLong Refcon
jsl X_DisposeScrap
exit return err
StandardScraps
DC.W PICT
DC.W AsciiText
DC.W 0
ENDP
;*********************************************************************
;
; X_PostScrap(Type:w,Refcon:l)
;
;*********************************************************************
X_PostScrap PROC EXPORT
;Using X_ClipData
input Type:w,Refcon:l
local Message:l,Mptr:l
begin +b
lda X_ScrapType
cmp #-1
beq po
|