window:
	res:
		windowType	wshadowbox
	endres:
endwindow:
dialog: dialogs
	res:
		defaultDistance		#(fWidth)
		dialogType		modal
		defaultButton		print
	endres:
	ditem: print_label
		res:
			itemType	bitmap
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
			label		Printer
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
	endditem:
	ditem: print_list
		res:
			itemType	scrtext
			fromVert	print_label
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
			width		#(fWidth)+1*20
			height		#(lHeight)*7+8
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			bind1		print_select1
			bind2		print_select2
			file		/dev/null
		endres:
		act:
			put $(line)
			put $(line)@0 $(TMP_PRINT1)
		endact:
	endditem:
	ditem: sheet_label
		res:
			itemType	bitmap
			fromVert	print_label
			fromHoriz	print_list
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
			label		Sheet:
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
	endditem:
	ditem: sheet
		res:
			itemType	numtext
			fromVert	print_label
			fromHoriz	sheet_label
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
			string		1
			length		2
			height		#(fHeight)
			width		#(fWidth)*2+4
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			shadowWidth	0
			borderWidth	2
			focus
		endres:
		act:
			put $(TMP_SHEET)
		endact:
	endditem:
	ditem: print
		res:
			itemType	button
			fromVert	print_label
			fromHoriz	print_list
			vertDistance	#(fHeight)*3
			horizDistance	#(fWidth)
			label		Print
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
		act:
			put $(TMP_PRINT1) $(TMP_PRINT)
			job print_select
		endact:
	endditem:
	ditem: cancel
		res:
			itemType	button
			fromVert	print
			fromHoriz	print_list
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
			label		Cancel
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
		act:
			job close
		endact:
	endditem:
enddialog:
proc: pre
	$(TMP) = mktemp
	put /tmp/$(TMP) $(LIST)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(SORT_LIST)
	put '' $(printer)
	$(bin)/Sprintcap -Ln -i /etc/printcap > $(SORT_LIST)
	sort -u $(SORT_LIST) > $(LIST)
endproc:
proc: close
	put '' $(printer)
	job off
	close
endproc:
proc: off
	rm -f $(LIST) $(SORT_LIST)
endproc:
proc: open
	setval print_list file $(LIST)
	setval print sensitive false
endproc:
proc: print_select1
	switch $(TMP_PRINT1)
		case '':
			quit
	endswitch
	setval print sensitive true
endproc:
proc: print_select2
	switch $(TMP_PRINT1)
		case '':
			quit
	endswitch
	setval print selected true
	put $(TMP_PRINT1) $(TMP_PRINT)
	job print_select
	setval print selected false
endproc:
proc: print_select
	switch #(TMP_SHEET)
		case 0:
			buzzer
			quit
	endswitch
	put $(TMP_PRINT) $(printer)
	put $(TMP_SHEET) $(print_count)
	job off
	close
endproc:
