include	doszip/doszip.inc
include	string.inc
include	conio.inc
include	dir.inc

	public	cmhelp
	public	cmabout
	public	view_readme

_DATA	SEGMENT

CP_COPYING db	'COPYING',0
CP_DZTXT   db	'DOSZIP.TXT',0
Offset_README   label word
	dw	0	; DZ.TXT
	dw	1397	; Memory
	dw	2556	; Compress
	dw	3216	; View
	dw	7167	; Extension
	dw	8119	; Environ
	dw	9036	; Windows
	dw	10218	; Install
	dw	10733	; Tools
	dw	12082	; FF
	dw	12827	; Filter
	dw	14871	; Shortkey

M_WZIP	macro val, count
	db 0F0h or ((count and 0FF00h) shr 8)
	db count and 00FFh
	db val
	endm

;******** Resource begin DZABOUT *
;	{ 0x005C,   2,   0, {15, 7,50,10} },
;	{ 0x0000,   0, 'O', {20, 8, 8, 1} },
;	{ 0x400A,   0, 'L', {17, 5,28, 1} },
;******** Resource data  *******************
DZABOUT_RC label word
	dw 	1116		; Alloc size
	S_OOBJ 	<005Ch,2,0,15,7,50,10>
	S_OOBJ 	<_O_PBUTT,0,'O',20,8,8,1>
	S_OOBJ 	<_O_TBUTT or _O_CHILD,0,'L',17,5,28,1>
	M_WZIP	50h,50
	M_WZIP	2Ah,50*7+20
	M_WZIP	50h,3
	db	5Ch
	M_WZIP	50h,4
	M_WZIP	2Ah,50*2+20
	M_WZIP	' About',22
	M_WZIP	' The Doszip Commander Version ',78
	db	VERS?
	M_WZIP	' Copyright (c) 1997-2012 Hjort Nidudsson',17
	M_WZIP	' ',11
	M_WZIP	'Ä',39
	M_WZIP	' License:     GNU General Public License',11
%	M_WZIP	' Build Date:  &@Date    Time: &@Time',11
	M_WZIP	' OK   ',79
	db	'Ü'
	M_WZIP	' ',42
	M_WZIP	'ß',8
	M_WZIP	' ',21
;******** Resource end   DZABOUT *

_DATA	ENDS

_DZIP	SEGMENT

view_doszip proc pascal f:dword, o:dword
local path[WMAXPATH]:byte
	invoke strfcat, addr path, addr configpath, f
  ifdef __TV__
	invoke tview, dx::ax, o
  else
	invoke load_tview, dx::ax, 0
  endif
	ret
view_doszip endp

view_readme proc dist
	sub dx,dx
	invoke view_doszip, addr CP_DZTXT, dx::ax
	ret
view_readme endp

view_license proc dist
	invoke view_doszip, addr CP_COPYING, 16090
	ret
view_license endp

cmabout	proc dist
	invoke rsopen, addr DZABOUT_RC
	.if ax
	    fpmov es:[bx.to_proc+32],view_license
	    invoke dlmodal, dx::ax
	.endif
	ret
cmabout endp

cmhelp	proc dist
	push si
	push di
	.if func(rsopen, IDD_DZHelp)
	    mov si,dx
	    mov di,ax
	    mov ax,offset cmabout
	    fpmov es:[bx.to_proc+14*16],cmabout
	    LPUSH cs
	    push ax
	    call thelp_set
	    .repeat
		invoke rsevent, IDD_DZHelp, si::di
		.break .if ax <= 0
		dec ax
		add ax,ax
		mov bx,ax
		mov ax,[bx+Offset_README]
		call view_readme
	    .until 0
	    invoke dlclose, si::di
	    call thelp_pop
	    mov ax,1
	.endif
	pop di
	pop si
	ret
cmhelp	endp

_DZIP	ENDS

	END
