antoine-source/appleworksgs/WP/Src/MergeDlg.aii

1 line
10 KiB
Plaintext
Raw Normal View History

2023-03-04 02:45:20 +00:00
load 'macros.dump' include 'driver.equ' include 'wp.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_BLForgetLists IMPORT D_BLGetSel IMPORT D_BLMakeList IMPORT D_BLModalDialog IMPORT D_BLSelect IMPORT CaretOff IMPORT D_CloseDialog IMPORT D_EscFilter IMPORT D_FastMult IMPORT W_GetDsString IMPORT D_GetNewModalDialog IMPORT D_GrowHandle IMPORT W_indexPtr IMPORT W_MakeCaret IMPORT D_MemoryError IMPORT W_MergeDlg IMPORT W_MergeDocName IMPORT W_MergeDocWin IMPORT D_NeedHand IMPORT W_NoDBs IMPORT D_NumWins IMPORT W_PasteStr IMPORT D_SendMessage IMPORT D_StringBuffer IMPORT D_UnLock IMPORT W_UpdateAfter IMPORT W_WhichDBlen IMPORT W_WhichDBname IMPORT D_WinNameTable IMPORT D_WinPtrTable IMPORT W_dbNames IMPORT W_DbSelectDlg IMPORT W_dsBobList IMPORT W_dsDialog IMPORT W_dsNumItems IMPORT W_EndLine IMPORT W_EndOffset IMPORT W_EndPar IMPORT W_mfBobList IMPORT W_mfDialog IMPORT W_mfNumItems IMPORT W_Selected IMPORT W_StartLine IMPORT W_StartOffset IMPORT W_StartPar ******************************************************************** * * Includes... * * * * * Monday, May 1, 1989 7:29:57 AM ******************************************************************** **************************************************************** * * W_StripDBName * **************************************************************** W_StripDBName PROC EXPORT input srcstr:l,dststr:l BEGIN lda [srcstr] and #$00FF SubWord a,#7,[dststr] tay addwl #1,srcstr ; copy the string (w/o W_Leading space) shortm loop lda [srcstr],y sta [dststr],y dey bne loop longm RETURN ENDP **************************************************************** * * W_PickMergeDB -- choose a merge database document * **************************************************************** W_PickMergeDB PROC EXPORT ;Using D_WindowData ;Using W_PMergeData ;Using W_MergeDlgData local ArraySize:w,Index:w,DBIndex:w,WinsSeen:w,Item:w local WinArrayHand:l,WinArrayPtr:l,StrArrayHand:l,StrArrayPtr:l local DvrString:l,MyString:l,WinPtr:l error err BEGIN +b stz err stz Index stz DBIndex stz WinsSeen MoveWord #0,>W_dsNumItems ; First delete the old Merge Database. lda W_MergeDocWin ora W_MergeDocWin+2 beq makeArrays tool _DisposeHandle,in=(W_MergeDocName:l) stzl W_MergeDocName stzl W_MergeDocWin ; Allocate 2 arrays, one for the window ptrs and one for the window strings. makeArrays lda >D_NumWins mul4 a sta ArraySize call D_NeedHand,in=(#0:w,ArraySize:w),out=(WinArrayHand:l),err=err jcs exit call D_NeedHand,in=(#0:w,ArraySize:w),out=(StrArrayHand:l),err=err jcs cleanup1 ; Cycle through the windows and make a list of all the DB windows. ; Our lists will be similar to the driver's. winloop moveLong >D_WinPtrTable:Index,WinPtr cpzl WinPtr jeq nextwin2 tool _GetWRefCon,in=(WinPtr:l),out=(a:l) and #$FF00 cmp #$0300 jne nextwin lda >W_dsNumItems inc a sta >W_dsNumItems ; allocate handle for window string tool _GetWTitle,in=(WinPtr:l),out=DvrString:l lda [DvrString] and #$00FF SubWord a,#6,a ; -6 = -7 + 1 call D_NeedHand,in=(#0:w,a:w),out=(MyString:l),err=err jcs cleanup2 Call W_StripDBName,in=(DvrString:l,[MyString]:l) MoveLong [WinArrayHand],WinArrayPtr MoveLong [StrArrayHand],StrArrayPtr ldx Index ldy DBIndex MoveWord MyString,[StrArrayPtr]:y MoveWord >D_WinPtrTable:x,[WinArrayPtr]:y iny iny MoveWord MyString+2,[StrArrayPtr]:y MoveWord >D_WinPtrTable+2:x,[WinArrayPtr]:y iny iny sty DBIndex nextwin inc WinsSeen nextwin2 AddWord Index,#4,Index CmpWord WinsSeen,>D_NumWins jlt winloop ; We've built our arrays, did we find any DB windows? If not warn user that no DB's were found. lda >W_dsNumItems bne somethere call D_AlertBox,in=(#OkBox:w,#W_NoDBs:l),out=(x:w) inc err brl cleanup2 ; Found at least one DB window. Save string handle. Put up select DB dialog. somethere MoveLong StrArrayHand,>W_dbNames Call D_GetNewModalDialog,in=(#W_DbSelectDlg:l),o