mirror of
https://github.com/antoinevignau/source.git
synced 2024-10-01 20:57:22 +00:00
1 line
16 KiB
Plaintext
1 line
16 KiB
Plaintext
|
load 'macros.dump'
include 'driver.equ'
include 'wp.equ'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
IMPORT D_AlertBox
IMPORT D_BeachBall
IMPORT W_CalcDocRect
IMPORT W_CalcPages
IMPORT W_CurDoc
IMPORT W_DeleteText
IMPORT W_EndLine
IMPORT W_EndOffset
IMPORT W_EndPar
IMPORT W_FindLine
IMPORT W_GetAddr
IMPORT W_GotoBeg
IMPORT W_GotoEnd
IMPORT W_InvSelect
IMPORT D_IsLetter
IMPORT W_MakeLines
IMPORT D_MemoryError
IMPORT W_PasteAscii
IMPORT W_PasteStr
IMPORT W_SelectOff
IMPORT W_SelectText
IMPORT D_SetCursor
IMPORT W_UpdateAfter
IMPORT W_UpdateDoc
IMPORT W_WordBounds
IMPORT W_Char
IMPORT W_def_replace
IMPORT W_def_search
IMPORT W_firstline
IMPORT W_firstoff
IMPORT W_firstpar
import W_foundonce
IMPORT W_ignoreValue
IMPORT W_LastP
IMPORT W_lastline
IMPORT W_lastoff
IMPORT W_lastpar
IMPORT W_oldslin
IMPORT Q_Rect
IMPORT W_Selected
IMPORT W_StartLine
IMPORT W_StartOffset
IMPORT W_StartPar
IMPORT D_State
IMPORT W_target
IMPORT D_ToLowerTable
IMPORT D_ToUpperTable
IMPORT W_visRect
IMPORT W_wholeValue
;-----------------------------------------------
;
; Forward addresses and entries
;
;-----------------------------------------------
ENTRY W_GetTarget
ENTRY W_JustFind
ENTRY W_SameChar
****************************************************************
* ;
* The real word of Find/Replace ;
*______________________________________________________________*
* ;
* CONTENTS: ;
* W_FindIt ;
* W_ReplaceIt ;
* W_ReplaceFind ;
* W_ReplaceAll ;
* W_StartOver ;
* ;
****************************************************************
********************************************************************
* Includes...
*
* Monday, May 1, 1989 2:06:56 AM
********************************************************************
****************************************************************
*
* W_FindIt -- Find and select the next (or previous) occurrence
* of the target string.
*
****************************************************************
W_FindIt PROC EXPORT
;Using WPGlobals
;Using W_FRdlgData
;Using W_FRData
begin
jsl W_GetTarget ; Get the D_New W_target.
jsl W_JustFind ; and find it, if possible
jcc gotit
*--------------------------------------------------------------*
* If it isn't there, put up an alert, and redraw the WP ;
* window contents after the alert's gone ;
*--------------------------------------------------------------*
nomore spaceword
pushword #1 ; just OK
pushlong #tooBad
jsl D_AlertBox
pla
pushlong W_CurDoc
_SetPort
pushlong W_CurDoc ; set the visRgn...
_BeginUpdate
pushlong W_CurDoc ; ...redraw...
jsl W_UpdateDoc
pushlong W_CurDoc ; ...and eat the D_Update event!
_EndUpdate
brl exit
*--------------------------------------------------------------*
* If it IS there, the hilite it and make it visible ;
*--------------------------------------------------------------*
gotit pushlong W_CurDoc
_SetPort
jsl W_SelectOff
spaceword
pushword W_lastpar
pushword W_lastoff
jsl W_FindLine
pullword W_lastline
spaceword
pushword W_firstpar
pushword W_firstoff
jsl W_FindLine
pullword W_firstline
pushword W_firstpar ; select the new text
pushword W_firstline
pushword W_firstoff
pushword W_lastpar
pushword W_lastline
pushword W_lastoff
pushlong #W_visRect
jsl W_SelectText ; (in tools)
jsl W_InvSelect
inc W_foundonce
exit pushword #arrowCursor
jsl D_SetCursor
return
*--------------------------------------------------------------*
* Useful Stuff ;
*--------------------------------------------------------------*
TooBad str 'No more occurrences found.'
ENDP
****************************************************************
*
* W_GetTarget -- extract the target text from the search line
*
|