window:
	res:
		windowType	wstandard
	endres:
endwindow:
close:
	res:
		bitmapPath	$(bitmaps)
		bitmapFile	CLOSE::CBM
	endres:
endclose:
title:
	res:
		leftLabel	ʏ̐VKo^
		leftKanjiFont	$(kanjiFont)
		leftFont	$(kanaFont)
		rightLabel	$(ALIASES)
		rightKanjiFont	$(kanjiFont)
		rightFont	$(kanaFont)
		switch $(COLOR)
			case MONO:
				bitmapPath	$(bitmaps)
				backgroundFile	GRAY3
				transparent	false
				break
		endswitch
	endres:
endtitle:
dialog: dialogs
	res:
		defaultDistance		#(fWidth)
		dialogType		modeless
		defaultButton		next_alias		
	endres:
	ditem: name_label
		res:
			itemType	bitmap
			leftLabel	ʏ
			leftKanjiFont	$(kanjiFont)
			leftFont	$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
	endditem:
	ditem: name
		res:
			itemType	text
			fromVert	name_label
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
			length		32
			width		#(fWidth)+1*32
			height		#(fHeight)
			shadowWidth	0
			borderWidth	2
			focus
		endres:
		act:
			put $(alias_name_new)
		endact:
	endditem:
	ditem: alias_label
		res:
			itemType	bitmap
			fromVert	name
			label		AhXO|v
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)*2
			horizDistance	#(fWidth)
		endres:
	endditem:
	ditem: alias
		res:
			itemType	text
			fromVert	alias_label
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
			length		32
			width		#(fWidth)+1*32
			height		#(fHeight)
			shadowWidth	0
			borderWidth	2
			focus
		endres:
		act:
			put $(alias_new)
		endact:
	endditem:
	ditem: alias_list
		res:
			itemType	scrtext
			fromVert	alias
			width		#(fWidth)+1*32
			height		#(lHeight)*10+8
			vertDistance	2
			horizDistance	#(fWidth)
			length		998
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			file		/dev/null
			bind1		delete1
			bind2		delete2
		endres:
		act:
			put $(alias_tmp)
		endact:
	endditem:
	ditem: next_alias
		res:
			itemType	button
			label		mdws
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			fromVert	alias
			fromHoriz	alias_list
			vertDistance	2
			horizDistance	#(fWidth)
		endres:
		act:
			switch $(alias_new)
				case '':
					buzzer
					quit
			endswitch
			echo $(alias_new) >> $(alias)
			put '' $(alias_new)
			setval alias string $(alias_new)
			job list_init
		endact:
	endditem:
	ditem: del_alias
		res:
			itemType	button
			label		' @ '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			fromVert	next_alias
			fromHoriz	alias_list
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
		act:
			job delete
		endact:
	endditem:
	ditem: clr_alias
		res:
			itemType	button
			label		' NA '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			fromVert	del_alias
			fromHoriz	alias_list
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
		act:
			echo -n > $(alias)
			job list_init
		endact:
	endditem:
	ditem: res_alias
		res:
			itemType	button
			label		' @A '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			fromVert	clr_alias
			fromHoriz	alias_list
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
		act:
			cp $(alias_org) $(alias)
			job list_init
		endact:
	endditem:
	ditem: set
		res:
			itemType	button
			label		' o@^ '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			fromHoriz	name
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
		act:
			switch $(alias_name_new)
				case '':
					put 1 $(err_no)
					job err
					quit
			endswitch
			test -s $(alias)
			switch #(status)
				case 0:
					break
				default:
					put 2 $(err_no)
					job err
					quit
			endswitch
			job set
		endact:
	endditem:
enddialog:
proc: pre
	$(TMP) = mktemp
	put /tmp/$(TMP) $(alias_org)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(alias)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(TMP_LIST)
	put 0 $(menu_no)
	put on $(mapped)
	put off $(opened)
	put off $(CHANGE_ALIAS)
endproc:
proc: close
	job off
	close
endproc:
proc: off
	switch #(menu_no)
		case 10:
			close $(err)
			break
	endswitch
	rm -f $(alias_org) $(alias) $(TMP_LIST)
endproc:
proc: open
	switch $(alias_name)
		case '':
			put ʏ̐VKo^ $(cmdName)
			setval title leftLabel ʏ̐VKo^
			setval set label ' o@^ '
			echo -n > $(alias_org)
			break
		default:
			put ʏ̕ύX $(cmdName)
			setval title leftLabel ʏ̕ύX
			setval set label ' ρ@X '
			$(etc)/Mail/Salias.sh init $(alias_name) > $(alias_org)
			break
	endswitch
	setval name string $(alias_name)
	cp $(alias_org) $(alias)
	job list_init
endproc:
proc: delete1
	switch $(alias_tmp)
		case '':
			quit
	endswitch
	setval del_alias sensitive true
endproc:
proc: delete2
	switch $(alias_tmp)
		case '':
			quit
	endswitch
	setval del_alias selected true
	job delete
	setval del_alias selected false
endproc:
proc: delete
	put $(alias_tmp) > $(TMP_LIST)
	$(bin)/Sfile_db -d -i $(TMP_LIST) -o $(alias)
	job list_init
endproc:
proc: list_init
	setval alias_list file $(alias)
	setval del_alias sensitive false
endproc:
proc: set
	put 101 $(menu_no)
	put on $(ONRUN)
	$(onrun) = sub $(commonPath)/onrun ++48++48
	switch $(alias_name)
		case '':
			$(pid) = bg $(etc)/Mail/Salias.sh add $(alias_name_new) $(alias)
			break
		default:
			$(pid) = bg $(etc)/Mail/Salias.sh chg $(alias_name) $(alias_name_new) $(alias)
			break
	endswitch
	$(bgstat) = trap $(pid) cmd_end
endproc:
proc: cmd_end
	buzzer $(main)
	close $(onrun)
	put 102 $(menu_no)
	switch $(mapped)
		case on:
			job bgdone
			break
		case off:
			put on $(opened)
			break
	endswitch
endproc:
proc: err
	put 10 $(menu_no)
	switch $(err_no)
		case 1:
			put ʏ̂w肵ĉB $(confirm_msg1)
			break
		case 2:
			put AhXO|vw肵ĉB $(confirm_msg1)
			break
		case 3:
			put ʏ́u$(alias_name_new)v͊ɎgpĂ܂B $(confirm_msg1)
			break
	endswitch
	$(err) = sub $(commonPath)/error1 ++48++48
	trap $(err) end_err
endproc:
proc: end_err
	put 0 $(menu_no)
endproc:
proc: n_end
	put off $(ONRUN)
	put 0 $(menu_no)
	put on $(CHANGE_ALIAS)
	job close
endproc:
proc: unmap
	switch #(menu_no)
		case 10:
			unmap $(err)
			break
		case 101:
			unmap $(onrun)
			break
		case 102:
			unmap $(n_end)
			break
	endswitch
	put off $(mapped)
endproc:
proc: map
	switch #(menu_no)
		case 10:
			move $(err)
			raise $(err)
			map $(err)
			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: move
	switch #(menu_no)
		case 10:
			move $(err)
			break
		case 101:
			move $(onrun)
			break
		case 102:
			move $(n_end)
			break
	endswitch
endproc:
proc: up
	switch #(menu_no)
		case 10:
			raise $(err)
			break
		case 101:
			raise $(onrun)
			break
		case 102:
			raise $(n_end)
			break
	endswitch
endproc:
proc: bgdone
	switch #(bgstat)
		case 0:
			$(n_end) = sub $(commonPath)/normalEnd ++48++48
			trap $(n_end) n_end
			quit
	endswitch
	put off $(ONRUN)
	put 3 $(err_no)
	job err
endproc:
