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
		defaultButton		set
	endres:
	ditem: name_label
		res:
			itemType	bitmap
			label		'ݥ̾'
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
	endditem:
	ditem: name
		res:
			itemType	text
			fromHoriz	name_label
			vertDistance	#(fWidth)
			horizDistance	4
			length		16
			height		#(fHeight)
			width		#(fWidth)*16+4
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			shadowWidth	0
			borderWidth	2
			focus
		endres:
		act:
			put $(NEW_NAME)
			put $(NEW_NAME)@1 $(NEW_NAME1)
			put $(NEW_NAME)@0 $(NEW_NAME)
		endact:
	endditem:
	ditem: id_label
		res:
			itemType	bitmap
			fromVert	name_label
			label		'ɣġ'
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
	endditem:
	ditem: id
		res:
			itemType	numtext
			fromVert	name_label
			fromHoriz	id_label
			vertDistance	#(fWidth)
			horizDistance	4
			length		5
			height		#(fHeight)
			width		#(fWidth)*5+4
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			shadowWidth	0
			borderWidth	2
			focus
		endres:
		act:
			put $(NEW_ID)
		endact:
	endditem:
	ditem: exec
		res:
			itemType	button
			fromHoriz	name
			label		' ѡ '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
		endres:
		act:
			switch $(NEW_NAME1)
				case '':
					break
				default:
					put 2 $(err_no)
					job err
					quit
			endswitch
			switch $(GROUP_NAME)
				case $(NEW_NAME):
					break
				default:
					switch $(NEW_NAME)
						case '':
							put 1 $(err_no)
							job err
							quit
					endswitch
					$(bin)/Sname_check group $(NEW_NAME)
					switch #(status)
						case 0x100:
							put 2 $(err_no)
							job err
							quit
					endswitch
					$(bin)/Sgrp_check -g $(NEW_NAME)
					switch #(status)
						case 0:
							put 4 $(err_no)
							job err
							quit
					endswitch
					break
			endswitch
			switch #(GROUP_ID)
				case #(NEW_ID):
					break
				default:
					test $(NEW_ID) -gt 32767
					switch #(status)
						case 0:
							put 3 $(err_no)
							job err
							quit
					endswitch
					$(bin)/Sgrp_check -i $(NEW_ID)
					switch #(status)
						case 0:
							put 5 $(err_no)
							job err
							quit
					endswitch
					break
			endswitch
			job chgproc
		endact:
	endditem:
	ditem: reset
		res:
			itemType	button
			fromVert	exec
			fromHoriz	name
			label		'  '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
		endres:
		act:
			job reset
		endact:
	endditem:
enddialog:
proc: pre
	put on $(mapped)
	put off $(opened)
	put 0 $(menu_no)
endproc:
proc: close
	switch $(ONRUN)
		case on:
			quit
	endswitch
	job off
	close
endproc:
proc: off
	switch #(menu_no)
		case 10:
			close $(err)
			break
	endswitch
endproc:
proc: open
	job reset
endproc:
proc: reset
	put $(GROUP_NAME) $(NEW_NAME)
	put $(GROUP_ID) $(NEW_ID)
	setval name string $(NEW_NAME)
	setval id string $(NEW_ID)
endproc:
proc: chgproc
	put on $(ONRUN)
	put 101 $(menu_no)
	$(onrun) = sub $(commonPath)/onrun ++48++48
	$(pid) = bg $(etc)/Group/Sgroup.sh chg $(GROUP_NAME) $(NEW_NAME) $(NEW_ID)
	$(bgstat) = trap $(pid) exec_end
endproc:
proc: home_end
	put 0 $(menu_no)
	switch #(NEW_HOMEDIR)
		case 0:
			quit
	endswitch
	job chgproc
endproc:
proc: exec_end
	buzzer $(main)
	close $(onrun)
	switch $(mapped)
		case on:
			job bgdone
			break
		case off:
			put on $(opened)
			break
	endswitch
	put 102 $(menu_no)
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
				case off:
					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 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
			put on $(CHANGE_GROUP)
			break
	endswitch
	trap $(n_end) n_end
endproc:
proc: n_end
	put off $(ONRUN)
	put 0 $(menu_no)
	job close
endproc:
proc: nonstand_end
	put 0 $(menu_no)
endproc:
proc: err
	put 10 $(menu_no)
	switch #(err_no)
		case 1:
			put 'ݥ̾ꤷƲ' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 2:
			put 'ݥ̾ˤϱѻ-_. ޤˡ' $(confirm_msg1)
			put 'ӿǻꤷƲ' $(confirm_msg2)
			$(err) = sub $(commonPath)/error2 ++48++48
			break
		case 3:
			put 'ݥףɣĤˤ 0-32767 ͤꤷƲ' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 4:
			put 'ݥ̾$(NEW_NAME)פϴ˻ѤƤޤ' $(confirm_msg1)
			put '̤Υݥ̾ꤷƤ' $(confirm_msg2)
			$(err) = sub $(commonPath)/error2 ++48++48
			break
		case 5:
			put 'ݥףɣġ$(NEW_ID)פϴ˻ѤƤޤ' $(confirm_msg1)
			put '̤ΥݥףɣĤꤷƲ' $(confirm_msg2)
			
			$(err) = sub $(commonPath)/error2 ++48++48
			break
	endswitch
	buzzer
	trap $(err) err_end
endproc:
proc: err_end
	put 0 $(menu_no)
endproc:
