/* DIVIDE_START=searchid.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winb.h>
#include <te.h>
#include <fntb.h>
#include <gui.h>
#include	<egb.h>
#include	<file_dlg.h>

#include	"var.h"

	int	SearchIdSayAlert = -1 ;
	int	SearchIdSayTextId = -1 ;
	int	SearchIdSayTextDir = -1 ;
	int	SearchIdSayDButtonOK = -1 ;
	int	SearchIdSayDButtonNO = -1 ;

static	char	SearchIdSayDir[ 256 ];
static	char	SearchIdSayId[ 256 ];

/*	initDataSEARCHID:SearchIdSayDButtonOK:MJ_DBUTTONL40の呼び出し関数	*/
/*	initDataSEARCHID:SearchIdSayDButtonNO:MJ_DBUTTONL40の呼び出し関数	*/
int		SearchIdSayFunc( int kobj )
{
	if ( kobj == SearchIdSayDButtonOK ) {
		MMI_SendMessage( SearchIdSayAlert, MM_ERASE , 0 );
		MMI_SendMessage( SearchIdSayAlert, MM_DETACH , 0 );
		// 実行する
		MMI_SendMessage(SearchIdSayTextDir,MM_GETTEXT,3,SearchIdSayDir,256,FALSE);
		strcpy( SearchIdSayId, SearchID );
		MMI_SendMessage(SearchIdSayTextId,MM_GETTEXT,3,SearchID,256,FALSE);
		SearchIdSayMain( SearchIdSayDir );		// ..\common.c
		if ( get_yesno( "\n検索するＩＤを詳細設定に記録しますか？" ) != YES ) {
			// 元に戻しておく
			strcpy( SearchID, SearchIdSayId );
		};
	} else if ( kobj == SearchIdSayDButtonNO ) {
		MMI_SendMessage( SearchIdSayAlert, MM_ERASE , 0 );
		MMI_SendMessage( SearchIdSayAlert, MM_DETACH , 0 );
	} else {
		MMI_SendMessage(SearchIdSayTextDir,MM_SETTEXT,3,OutDir,128,FALSE);
		MMI_SendMessage(SearchIdSayTextId,MM_SETTEXT,3,SearchID,128,FALSE);
		/*	オブジェクトをダイアログに取り付ける	*/
		MMI_SendMessage( SearchIdSayAlert, MM_ATTACH, 1, TopMenuHyperDialog);
		MMI_SendMessage( SearchIdSayAlert, MM_SHOW, 0);
	};
	return NOERR ;
}

/*	initDataSEARCHID:NULL:MJ_ICONL40の呼び出し関数	*/
int		SearchIdSayGetPathName( )
{
	char	str[ MAX_DIRS ] ;

	MMI_SendMessage(SearchIdSayTextDir,MM_GETTEXT,3,str,MAX_DIRS,FALSE);
	if ( GetPluralPath( str,"検索するファイルまたはディレクトリ", YES ) > 0 ) {
		MMI_SendMessage(SearchIdSayTextDir,MM_SETTEXT,3,str,strlen(str),FALSE);
		MMI_SendMessage(SearchIdSayTextDir,MM_SHOW,0);
	};
	return NOERR ;
}

/* DIVIDE_END */
