window:
	res:
		windowType	wstandard
	endres:
endwindow:
close:
	res:
		bitmapPath	$(bitmaps)
		bitmapFile	CLOSE::CBM
	endres:
endclose:
title:
	res:
		leftLabel	|ݒ
		leftKanjiFont	$(kanjiFont)
		leftFont	$(kanaFont)
		switch $(COLOR)
			case MONO:
				bitmapPath	$(bitmaps)
				backgroundFile	GRAY3
				transparent	false
				break
		endswitch
	endres:
endtitle:
dialog: dialogs
	res:
		defaultDistance		#(fWidth)
		dialogType		modeless
	endres:
	ditem: msg_mode
		res:
			itemType	bitmap
			leftLabel	݂̐ݒ
			leftKanjiFont	$(kanjiFont)
			leftFont	$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
	endditem:
	ditem: info_mode
		res:
			itemType	text
			string		'^p^CvF'
			fromVert	msg_mode
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*3
			length		200
			width		#(fWidth)+1*32
			height		#(lHeight)*3+8
			sensitive	false
			shadowWidth	0
			borderWidth	2
		endres:
	endditem:
	ditem: chg_mode
		res:
			itemType	button
			label		' ρ@X '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			fromVert	msg_mode
			fromHoriz	info_mode
			vertDistance	#(fHeight)*2
			horizDistance	#(fWidth)
		endres:
		act:
			put 1 $(menu_no)
			$(sub) = sub $(menu)/mode ++48++48
			trap $(sub) mode
		endact:
	endditem:
	ditem: msg_alias
		res:
			itemType	bitmap
			fromVert	info_mode
			label		ʏ̃Xg
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)*2
			horizDistance	#(fWidth)
		endres:
	endditem:
	ditem: info_alias
		res:
			itemType	scrtext
			fromVert	msg_alias
			width		#(fWidth)+1*32
			height		#(lHeight)*10+8
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*3
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			bind1		select
			file		/dev/null
		endres:
		act:
			put $(line)
			put $(line)@0 $(ALIAS_NAME)
		endact:
	endditem:
	ditem: new_alias
		res:
			itemType	button
			label		' V@K '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			fromVert	msg_alias
			fromHoriz	info_alias
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
		act:
			put 1 $(menu_no)
			put '' $(alias_name)
			$(sub) = sub $(menu)/alias ++48++48
			trap $(sub) alias
		endact:
	endditem:
	ditem: chg_alias
		res:
			itemType	button
			label		' ρ@X '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			fromVert	new_alias
			fromHoriz	info_alias
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
		act:
			switch $(ALIAS_NAME)
				case '':
					quit
			endswitch
			put 1 $(menu_no)
			put $(ALIAS_NAME) $(alias_name)
			$(sub) = sub $(menu)/alias ++48++48
			trap $(sub) alias
		endact:
	endditem:
	ditem: del_alias
		res:
			itemType	button
			label		' @ '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			fromVert	chg_alias
			fromHoriz	info_alias
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
		act:
			switch $(ALIAS_NAME)
				case '':
					quit
			endswitch
			put $(ALIAS_NAME) $(alias_name)
			put ʏ̓o^ $(cmdName)
			put 2 $(menu_no)
			put 'ʏ́u$(alias_name)vo^܂B' $(confirm_msg1)
			$(confirm) = sub $(commonPath)/confirm1 ++48++48
			trap $(confirm) confirm
		endact:
	endditem:
	ditem: adr_alias
		res:
			itemType	button
			label		AhX
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			fromVert	del_alias
			fromHoriz	info_alias
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
		act:
			switch $(ALIAS_NAME)
				case '':
					quit
			endswitch
			put 1 $(menu_no)
			put $(ALIAS_NAME) $(alias_name)
			$(sub) = sub $(menu)/address ++48++48
			trap $(sub) address
		endact:
	endditem:
enddialog:
proc: pre
	put $(menuPath)/Mail $(menu)
	put $(icons) $(okPath)
	put Mail $(okFile)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(aliases_name)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(aliases)
	$(TMP) = mktemp
	put 0 $(menu_no)
	put 0 $(cmd)
	global $(alias_name)
	global $(CHANGE_ALIAS)
	global $(MAILDOMAIN)
	put on $(mapped)
	put off $(opened)
	/bin/domainname
	put $(stdout) $(MAILDOMAIN)
	switch $(MAIL_MODE)
		case main:
		case sub:
			/usr/ucb/grep '^Dm' $(SENDMAIL_CF)
			switch #(status)
				case 0:
					sh -c 'echo $(stdout) | sed "s/^Dm//"'
					put $(stdout)@0 $(MAILDOMAIN)
					break
			endswitch
			break
	endswitch
endproc:
proc: close
	switch $(ONRUN)
		case on:
			quit
	endswitch
	job off
	close
endproc:
proc: off
	switch #(menu_no)
		case 1:
			close $(sub)
			break
		case 2:
			close $(confirm)
			break
	endswitch
	local $(alias_name)
	local $(CHANGE_ALIAS)
	local $(MAILDOMAIN)
	rm -f $(aliases) $(aliases_name)
endproc:
proc: open
	job mode_init
	job alias_init
	job btn_init
endproc:
proc: mode_init
	switch $(MAIL_MODE)
		case main:
			setval info_mode string '  ^p^CvF  |(C)\n  hCF  $(MAILDOMAIN)'
			break
		case sub:
			$(bin)/Snet_check -A mailhost
			switch #(status)
				case 0:
					put $(stdout)@0 $(mailhost)
					break
				default:
					put ------- $(mailhost)
					break
			endswitch
			setval info_mode string '  ^p^CvF  |(Tu)\n  C@@F  $(mailhost)\n  hCF  $(MAILDOMAIN)'
			break
		default:
			setval info_mode string '  ^p^CvF  ݒ'
			break
	endswitch
endproc:
proc: mode
	put 0 $(menu_no)
	job mode_init
endproc:
proc: alias_init
	$(bin)/Sprintcap -Ln0 -i $(ALIASES) > $(aliases_name)
	cp $(ALIASES) $(aliases)
	setval info_alias file $(aliases_name)
	put off $(CHANGE_ALIAS)
endproc:
proc: alias
	put 0 $(menu_no)
	switch $(CHANGE_ALIAS)
		case on:
			job alias_init
			job btn_init
			break
	endswitch
endproc:
proc: address
	put 0 $(menu_no)
endproc:
proc: btn_init
	setval chg_alias sensitive false
	setval del_alias sensitive false
	setval adr_alias sensitive false
	switch #(uid)
		case 0:
			setval chg_mode sensitive true
			setval new_alias sensitive true
			break
		default:
			setval chg_mode sensitive false
			setval new_alias sensitive false
			break
	endswitch
endproc:
proc: select
	switch $(ALIAS_NAME)
		case '':
			quit
	endswitch
	switch #(uid)
		case 0:
			setval chg_alias sensitive true
			setval del_alias sensitive true
			break
	endswitch
	setval adr_alias sensitive true
endproc:
proc: confirm
	switch $(answer)
		case cancel:
			put 0 $(menu_no)
			quit
	endswitch
	put 101 $(menu_no)
	put on $(ONRUN)
	$(onrun) = sub $(commonPath)/onrun ++48++48
	$(pid) = bg $(etc)/Mail/Salias.sh del $(alias_name)
	trap $(pid) cmd_end
endproc:
proc: cmd_end
	buzzer $(main)
	close $(onrun)
	put 102 $(menu_no)
	switch $(mapped)
		case on:
			job bgdone
			break
		default:
			put on $(opened)
			break
	endswitch
endproc:
proc: bgdone
	$(n_end) = sub $(commonPath)/normalEnd ++48++48
	trap $(n_end) n_end
endproc:
proc: n_end
	put off $(ONRUN)
	job alias_init
	job btn_init
	put 0 $(menu_no)
endproc:
proc:unmap
	switch #(menu_no)
		case 1:
			unmap $(sub)
			break
		case 2:
			unmap $(confirm)
			break
		case 101:
			unmap $(onrun)
			break
		case 102:
			unmap $(n_end)
			break
	endswitch
	put off $(mapped)
endproc:
proc: map
	switch #(menu_no)
		case 1:
			raise $(sub)
			map $(sub)
			break
		case 2:
			move $(confirm)
			raise $(confirm)
			map $(confirm)
			break
		case 101:
			move $(onrun)
			raise $(onrun)
			map $(onrun)
			break
		case 102:
			switch $(opened)
				case on:
					job bgdone
					break
				default:
					move $(n_end)
					raise $(n_end)
					map $(n_end)
					break
			endswitch
	endswitch
	put on $(mapped)
	put off $(opened)
endproc:
proc: title
	job move
	job up
endproc:
proc: raise
	job up
endproc:
proc: move
	switch #(menu_no)
		case 2:
			move $(confirm)
			break
		case 101:
			move $(onrun)
			break
		case 102:
			move $(n_end)
			break
	endswitch
endproc:
proc: up
	switch #(menu_no)
		case 2:
			raise $(confirm)
			break
		case 101:
			raise $(onrun)
			break
		case 102:
			raise $(n_end)
			break
	endswitch
endproc:
