include	clib.inc
include	dos.inc
include	conio.inc
include	confirm.inc

	extrn	IDD_ConfirmDelete:DWORD
;
; ret:	0 Cancel
;	1 Delete
;	2 Delete All
;	3 Jump
;
_DATA	SEGMENT

cp_delselected	db "   You have selected %d file(s)",10
		db "Do you want to delete all the files",0
cp_delrdonly 	db "The following file is marked Read only.",0
cp_delsystem 	db "The following file is marked System.",0
cp_delflag 	db "Do you still wish to delete it?",0
cp_dodelete 	db "Do you wish to delete",0

_DATA	ENDS

_TEXT	SEGMENT

confirm_delete proc dist pascal public uses di info:dword, selected:word
local	DLG_ConfirmDelete:dword
	invoke rsopen, IDD_ConfirmDelete
	stom DLG_ConfirmDelete
	.if ax
	    invoke dlshow, dx::ax
	    mov bx,es:[bx+4]
	    mov di,bx
	    add bx,020Ch	; x + 12, y + 2
	    xor cx,cx
	    mov ax,selected
	    .if ax > 1 && ax < 8000h
		scputf@	bl, bh, ch, cl, offset cp_delselected, ax
	    .else
		.if ax == -2
		    scputf@ bl, bh, ch, cl, offset cp_delsystem
		    add bx,0202h
		    scputf@ bl, bh, ch, cl, offset cp_delflag
		.elseif ax == -1
		    sub bl,2
		    scputf@ bl, bh, ch, cl, offset cp_delrdonly
		    add bx,0204h
		    scputf@ bl, bh, ch, cl, offset cp_delflag
		.else
		    add bl,6
		    scputf@ bl, bh, ch, cl, offset cp_dodelete
		.endif
		mov bx,di
		add bx,0303h
		mov cx,53
		lodm info
		call @scenter
	    .endif
	    invoke beep, 50, 6
	    invoke rsevent, IDD_ConfirmDelete, DLG_ConfirmDelete
	    invoke dlclose, DLG_ConfirmDelete
	    mov ax,dx
	.endif
	ret
confirm_delete endp

_TEXT	ENDS

	END
