/* DIVIDE_START=var.h */
//	メインで使う広域変数

#ifndef		VAR_H		// ２重に読み込むのを防ぐ
#define		VAR_H

#include	"..\common.h"
#include	"gui_var.h"		// GUIで使う変数の宣言

/*	構造体の定義							*/
typedef struct {
				int		windowId ;		/*	ウィンドウのID			*/
				int		vscrollId ;		/*	縦スクロールバーのID	*/
				int		textId ;		/*	テキストのID			*/
				char	name[20] ;		/*	ウィンドウのタイトル	*/
				char	FileName[ MAX_FILENAME_LEN ];
} TEXTWIN ;

#define TXTWIN		20		/*	最大ウィンドウ数	*/
#define BAR_SIZE	16		/*	スクロールバーの幅	*/
#define	MAX_GAMEN_KANJI_LEN	( ( 640 - 6 ) / 12 )

struct	CopyInsideVarChar	{
			char	*insideVar;
			int		*detailsVar;	// GUI 変数名
			int		*FDlg;			// ファイルダイヤログの番号
};
struct	CopyInsideVarBool	{
			int		*insideVar;
			int		*detailsVar;	// GUI 変数名
			char	*YesMes;		// YES の場合のメッセージ
			char	*NoMes; 		// NO の場合のメッセージ
};
struct	CopyInsideVarIntData	{
			int		*insideVar;
			int		*detailsVar;	// GUI 変数名
};

#ifdef	MAIN
	int		YesNoSw;

struct	CopyInsideVarChar	CopyInsideVarChar[] = {
	/******** 検索指定 ********/
	//	ＦＡＰＸがあるディレクトリ
	{	FAPXDir,			&DetailsText[0],		&DetailsIcon[0]	},
	//	入力ディレクトリ
	{	InDir,				&DetailsText[1],		&DetailsIcon[1]	},
	//	検索するファイル or ディレクトリ
	{	SearchFile,			&DetailsText[2],		&DetailsIcon[2]	},
	//	検索しないファイル or ディレクトリ
	{	WithoutSearchFile,	&DetailsText[3],		&DetailsIcon[3]	},
	//	検索するＩＤ
	{	SearchID,			&DetailsText[4],		NULL			},
	//	検索開始日時
	{	SearchStartDate,	&DetailsText[5],		NULL			},
	//	検索終了日時
	{	SearchEndDate,		&DetailsText[6],		NULL			},
	//	検索する発言の種類
	{	WithoutSearchMesType,		&DetailsText[8],		NULL			},
	/******** 出力指定 ********/
	//	出力ディレクトリ
	{	OutDir,				&DetailsText[9],		&DetailsIcon[4]	},
	//	ＤＬのリストを出力するディレクトリ
	{	DLDir,				&DetailsText[10],		&DetailsIcon[5]	},
	//	インデックスのディレクトリ
	{	IndexDir,			&DetailsText[11],		&DetailsIcon[6]	},
	//	ＴＭＰディレクトリ
	{	TmpDir,				&DetailsText[12],		&DetailsIcon[7]	},
	/******** その他 ********/
	//	ＣＡＴＬＯＧのメッセージ保存ファイル
	{	CatlogMesFileName,	&DetailsText[13],		&DetailsIcon[8]	},
	//	エディタの起動コマンド
	{	EditorCommand,		&DetailsText[14],		NULL			},
	//	エディタの起動コマンド
	{	LhaCommand,			&DetailsText[15],		NULL			},
	//	終わり
	{	NULL,				NULL,					NULL			}
};

struct	CopyInsideVarBool	CopyInsideVarBool[] = {
	//	インデックス・モード
	{	&IndexModeSw,		&DetailsTIcon[0],
		"ディレクトリ毎にインデックスを作ります。",
		"全体で１個のインデックスを作ります。"
	},
	//	x001で新ファイルを作る
	{	&NewFileSw,			&DetailsTIcon[1],
		"発言番号の下３桁が 001 になる毎に新しい整理済ファイルを作ります。",
		"発言番号の下３桁が 001 になっても新しい整理済ファイルを作りません。"
	},
	//	ＭＡＩＬを１つにまとめる
	{	&Mail1Sw,			&DetailsTIcon[2],
		"メールを１個のファイルにまとめて整理します。",
		"メールはＩＤ毎に１個のファイルに整理します。"
	},
	//	今日より古い生ログ・ファイルを削除する
	{	&DeleteOldFileSw,	&DetailsTIcon[3],
		"今日より古い生ログ・ファイルを削除します。",
		"生ログ・ファイルは削除しません。"
	},
	//	生ログ・ファイルをLZHファイルに保存する
	{	&StoreLZHSw,		&DetailsTIcon[4],
		"生ログ・ファイルをＬＺＨファイルに保存します。",
		"生ログ・ファイルをＬＺＨファイルに保存しません。"
	},
	//	自動実行する
	{	&CatlogAutoRunSw, 	&DetailsTIcon[5],
		"以後、ＣＡＴＬＯＧ起動時は CATLOG2.DEF の設定で発言の検索・整理を自動実行します。",
		"以後、ＣＡＴＬＯＧ起動時は CATLOG2.DEF の設定を読み込むだけにします。"
	},
	//	自動終了する
	{	&CatlogAutoEndSw, 	&DetailsTIcon[6],
		"メニュー画面を表示せず、ＣＡＴＬＯＧを終了します。",
		"メニュー画面を表示します。"
	},
	//	内部状態を表示する
	{	&Display,			&DetailsTIcon[7],
		"内部の実行状態を表示します。",
		"内部の実行状態を表示しません。"
	},
	//	LZH ファイル解凍する
	{	&ReStoreLZHSw,		&DetailsTIcon[8],
		"発言の検索の際、ＬＺＨファイルを解凍して、そのファイルからも検索します。",
		"拡張子がＬＺＨのファイルは無視します。"
	},
	//	音声メッセージを出す
	{	&OutSoundMes,		&DetailsTIcon[9],
		"音声メッセージを出力します。",
		"音声メッセージは出力しません。"
	},
	{	NULL,				NULL,
		NULL,				NULL
	}
};

struct	CopyInsideVarIntData	CopyInsideVarIntData[] = {
	//	整理後ファイルの最大サイズ
	{	&MaxCatlogFileSize,	&DetailsText[7]			},
	{	NULL,				NULL					}
};

	TEXTWIN		window[TXTWIN] = -1 ;
	int		PrintMessageWindowId ;
	int		PrintMessageWindowSw = FALSE;

#else	// MAIN
	extern	int		YesNoSw;

	extern	struct	CopyInsideVarChar		CopyInsideVarChar[];
	extern	struct	CopyInsideVarBool		CopyInsideVarBool[];
	extern	struct	CopyInsideVarIntData	CopyInsideVarIntData[];
	extern	TEXTWIN		window[TXTWIN] ;
	extern	int		PrintMessageWindowId ;
	extern	int		PrintMessageWindowSw ;

#endif	// MAIN

extern	void	CloseCATLOGMessageFile();						// message.c
extern	void	RemoveCATLOGMessageFile();						// message.c
extern	void	WriteCATLOGMessage( const char *mes );			// message.c
extern	void	PrintMessage( const char *mes );				// message.c
extern	void	print_now_time();								// main.c
extern	void	er_open(const char *file,int mode,char *mes );	// main.c
extern	void	error_bug( const char *mes );					// main.c
extern	void	gui_error( int err );							// main.c
extern	int		LoadDefFile( int fileLoadSw );					// topmenu.c
extern	int		showKakunin( );									// message.c
extern	int		get_yesno( char *message );						// topmenu.c
extern	void	SaveDefFile();									// topmenu.c
extern	void	CopyInside2Details();							// details.c
extern	void	GetDetails();									// details.c
extern	int		getFAPXSET( char *path );						// getpath.c
extern	char	*GetPathName( char *path );						// getpath.c
extern	int		GetPluralPath( char *path, const char *mes, int pluralSw );
																// getpath.c
extern	char	*KanStrCpy( char *trg, char *src, int klen );	// details.c

extern	int		geneWindow( char *winName, char *fileName );	// window.c
extern	void	SetLineHelpAlert( char *mes );					// details.c

#endif		// VAR_H
/* DIVIDE_END */
