#include	<stdio.h>
#include	<string.h>
#include	<egb.h>
#include	<fmc.h>
#include	"KEYBOARD.H"
#include	"CONSOL.H"
#include    "OAKLIB.H"
#include    "OAK2.H"
#include	"LEDIT.H"
#include	"GRAPHIC.H"
#include	"XFONT.H"

char work[EgbWorkSize];

void main()
{
	int  j;
	char yn;
	static char str[81];
	static BLOCK *savebox=NULL;

	EGB_init(work,EgbWorkSize);
	EGB_resolution(work,0,3);
	EGB_resolution(work,1,3);
	EGB_displayPage(work,1,3);

	copen();

	strcpy(str,"");
	KAN_open(putstr, putsys, putmode);
	cursor_off;
	do {
		DSP_linebf(0, 0, 639, 479, 7, 0);

		color(14, 1);
		put_str(21,2,"★★★　キー入力ルーチンテスト　★★★");
		color(14, 7);
		put_str(57, 23, "By Trouble･MakerのＪ.Ｊ");
		EGB_textZoom(work, 1, 32, 24);
		DSP_msg("文字列入力",240,95,0x05,9,15,0);
		EGB_textZoom(work, 1, 16, 16);

		DSP_rbox(40, 8*16, 600, 20*16, 9, 15);
		color(0, 15);
	put_str(15, 8,"指定座標（Ｘ＝０〜７９　Ｙ＝０〜２４）で、");
	put_str(15, 9,"最大８０文字まで入力修正することが出来ます。");
	put_str(15,10,"（実際は、そんなに長くは、必要無いと思いますが・・・）");
	put_str(15,11,"これは、X=10,Y=10,LEN=60になっています。");
	put_str(15,12,"挿入ｷｰで、上書と挿入を切替えます。ﾃﾞﾌｫﾙﾄは、挿入です。");
	put_str(15,13,"SHIFTｷｰを押しながら、左矢印で先頭にｶｰｿﾙが移動します。");
	put_str(15,14,"SHIFTｷｰを押しながら、右矢印で最後にｶｰｿﾙが移動します。");
	put_str(15,15,"SHIFTｷｰを押しながら、削除ｷｰでｶｰｿﾙ以降を削除します。");

		savebox=DSP_push_vram(9*8-4, 9*19-4, 72*8+4, 13*19+4);
		text_box( 9, 9, 70, 11, 13,  0, 0);
		j=LineEdit(10, 10, str, 60, 15, 0);
		DSP_pop_vram(savebox);
		savebox = NULL;

		color(15, 7);
		put_str(10,18,"入力データの確認");
		color(15, 1);
		put_str(10,20,str);
		color(15, 7);
		put_str(10,22,"続けますか (Y/N) ?");
		yn=getch(0);

	} while(yn=='Y'||yn=='y');

	KAN_close();
	DSP_linebf(0, 0, 639, 479, 0, 0);
}

