#include "gType.h"
#include "GraphLow.h"
#include "GraphBase.h"
#include "GlobalString.h"
#include "MainCtl.h"
#include "RuntimeData.h"
#include "Runtime.h"
#include "Gui.h"
#include "QueryMessage.h"

#define TextTopOffSet	6
#define ListLineCnt	4
#define ColHeight 	33

#define FixTop	69
#define MsgX0	6
#define DescpX0	270	//90

#define dLineMaxLen	64

const char cFireCfm[24] = 				"火警确认              ";
const char cFaultCfm[24] = 				"故障确认              ";
const char cFireRemoteCfm[24] = 			"火警远程确认          ";
const char cFaultRemoteCfm[24] = 			"故障远程确认          ";

const char cFireSimCfm[24] = 				"模拟火警确认          ";
const char cFireSimRemoteCfm[24] = 			"模拟火警远程确认      ";

const char cFireCfmEn[24] = 				"Confirmed Fire        ";
const char cFaultCfmEn[24] = 				"Confirmed Fault       ";
const char cFireRemoteCfmEn[24] = 			"Confirmed-Far Fire    ";
const char cFaultRemoteCfmEn[24] = 			"Confirmed-Far Fault   ";

const char cFireSimCfmEn[24] = 			"Confirmed Sim-Fire    ";
const char cFireSimRemoteCfmEn[24] = 		"Confirmed-Far Sim-Fire";	//Length = 22

const char cMask[24] = 					"屏蔽部件              "; 
const char cMaskEn[24] = 				"Blocked Device        ";
const char cUnMask[24] = 				"取消屏蔽部件          "; 
const char cUnMaskEn[24] = 				"Blocked Device Cancel ";

const static unsigned short stAllTop[10] = {
	80, 120, 160, 200, 240, 
	280, 320, 360, 400, 440
};

static const short qmFixCol[8] = {
	20,100,160,240,   320,400,520,600
};

void TQueryMsgOperate::Init(int x1, int y1, int aW, int aH, int OwnerX, int OwnerY, u32 aColor)
{
	#define CH	30	//Caption Height
	unsigned short Left,Right, Top, Bottom, Width, Height, i;
	Bound.SetBySize(OwnerX + x1, OwnerY + y1, aW, aH);
	Left = Bound.Left +3;
	Top = Bound.Top+3;
	Width = aW - 7;
	Height = aH - 7;
	Right = Bound.Right -4;
	Bottom = Bound.Bottom -4;
	Caption.Init(Left,Top,Width, CH, 0, 0, clWhite, clMaroon);
	Content.Set(Left, Top+CH, Right, Bottom);
	BoxBoundTime.Set(Left+170, Top+80, Right-170, Bottom-30);
	GoPrint.Set(Left+170, Top+150, Right-170, Bottom-130);
	Color = aColor;
	#undef CH
	

	Caption.Border.Color = clGray;
	
	FixColColor = clMaroon;
	FixColTextColor = clNearWhite;
	
	TextColor = clNearBlack;
	SelectedColor = clBlue;
	SelectedTextColor = clNearWhite;
	
	Count=0;
	SelectedIndex=0;
	SelectedIndex  = 0;
	TopIndex = 0;
	
	IsInputTime = 0;
	IsGoPrint = 0;
	IsAllTime = 1;
	TimeEditFrom = -1;
	TimeIndex =0;
	IsEditing = 0;
	PrintWhat = 0;
	ReStoreP0 = 0;
	ReStoreP1 = 0;
}

void TQueryMsgOperate::InitBackEnd()
{
	Count=0;
	SelectedIndex=0;
	SelectedIndex  = 0;
	TopIndex = 0;
	
	IsInputTime = 0;
	IsGoPrint = 0;
	IsAllTime = 1;
	TimeEditFrom = -1;
	TimeIndex =0;
	IsEditing = 0;
	PrintWhat = 0;
	ReStoreP0 = 0;
	ReStoreP1 = 0;
}

void TQueryMsgOperate::SetListColWidth(int w0, int w1, int w2, int w3, int w4,int w5,int w6, int w7, int w8)
{

}

void TQueryMsgOperate::RenderBackGround(void)
{
	RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color);
}

void TQueryMsgOperate::RenderBackGround(unsigned int aClr)
{
	RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, aClr);
}

void TQueryMsgOperate::RenderContent(void)
{
	#define FixColColor	clMedGray
	#define OddColor		clNearMoneyGreen
	RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color);	
}

void TQueryMsgOperate::DrawSelf(void)
{
	unsigned int x, y, x2, y2, w, h;
	
	VertLineRender(Bound.Left,		Bound.Top, 			Bound.Height -1,			0xFFFFFFFF);
	VertLineRender(Bound.Right -1,	Bound.Top +1,		Bound.Height -2,			0xFF808080);
	VertLineRender(Bound.Right,		Bound.Top,			Bound.Height,			0xFF404040);
	
	HorizLineRender(Bound.Left, 		Bound.Top, 			Bound.Width - 1, 			0xFFFFFFFF);
	HorizLineRender(Bound.Left +1, 	Bound.Bottom -1,  	Bound.Width - 2, 			0xFF808080);
	HorizLineRender(Bound.Left,		Bound.Bottom,		Bound.Width,			0xFF404040);
	
	x = Bound.Left +2 ;	
	x2 = Bound.Right -2;
	y = Bound.Top +2;
	y2 = Bound.Bottom - 2;
	w = Bound.Width -4;
	h = Bound.Height - 4;
	VertLineRender	(x,		y, 		h-1,	0xFF808080);
	HorizLineRender	(x,		y, 		w-1,	0xFF808080);
		
	VertLineRender	(x+1,		y+1, 		h-2,	0xFF404040);
	HorizLineRender	(x+1,		y+1, 		w-2,	0xFF404040);
	
	VertLineRender	(x2-1,	y+1, 		h-2,	0xFFD4D0C8);
	HorizLineRender	(x+1,		y2-1, 	w-2,	0xFFD4D0C8);

	VertLineRender	(x2,		y, 	  	h,	0xFFFFFFFF);
	HorizLineRender	(x,		y2, 		w,	0xFFFFFFFF);
	
	RenderContent();
}

void TQueryMsgOperate::DrawCaption(void)
{	
	if(LanguageEnCn==0)TMyString::sFromStr("历史记录->查询操作信息", Caption.Text); 
	else TMyString::sFromStr("Recorded Info->Query Operations", Caption.Text);
		
	Caption.Show();
	DrawCaption2();
}

void TQueryMsgOperate::DrawCaption2(void)
{	

}

void TQueryMsgOperate::RenderWarningWait(void)
{
	int x,y,x2,y2, aW,aH;
	x = 200;
	y = 160;
	x2 = 600;
	y2 = 290;
	aW = x2 - x +1;
	aH = y2 - y +1;
	VertLineRender(x,			y, 		aH-1,			0xFFFFFFFF);
	VertLineRender(x2 -1,		y+1,		aH -2,		0xFF808080);
	VertLineRender(x2,		y,		aH,			0xFF404040);
	
	HorizLineRender(x, 		y, 		aW - 1, 		0xFFFFFFFF);
	HorizLineRender(x +1, 		y2 -1,  	aW - 2, 		0xFF808080);
	HorizLineRender(x,		y2,		aW,			0xFF404040);
	
	RectFillRender(x+1,y+1,x2-2,y+30,clNavy);
	RectFillRender(x+1,y+31,x2-2,y2-2,clGray);
	if(LanguageEnCn==0){
		TextRender_string24(x+8, y+6, clNearWhite, "提示信息");
		TextRender_string24(x+66, y+36, clNearBlack, "正在读取,请等待");
	}else{
		TextRender_string24(x+8, y+6, clNearWhite, "Message");
		TextRender_string24(x+66, y+36, clNearBlack, "Reading,Please Wait");
	}
}

void TQueryMsgOperate::DrawItemCount(int aCount)
{
	TextDigitRender6Left24(500,Caption.Bound.Top +3, clNearWhite, Caption.Color, Count);
	TextDigitRender6Left24(720,Caption.Bound.Top +3, clNearWhite, Caption.Color, aCount);
	if(LanguageEnCn==0){
		TextRender_string24(400, Caption.Bound.Top +3, clNearWhite, "总数量:");
		TextRender_string24(600, Caption.Bound.Top +3, clNearWhite, "查看数量:");
	}else{
		TextRender_string24(400, Caption.Bound.Top +3, clNearWhite, "Total:");
		TextRender_string24(600, Caption.Bound.Top +3, clNearWhite, "Display:");
	}
}

void TQueryMsgOperate::DrawBoxTimeOutLine()
{
	RectFillRender(BoxBoundTime.Left, 	BoxBoundTime.Top, BoxBoundTime.Right, BoxBoundTime.Bottom, clFrmFace);
	
	VertLineRender(BoxBoundTime.Left,		BoxBoundTime.Top, 		BoxBoundTime.Height -1,			0xFFFFFFFF);
	VertLineRender(BoxBoundTime.Right -1,	BoxBoundTime.Top +1,		BoxBoundTime.Height -2,			0xFF808080);
	VertLineRender(BoxBoundTime.Right,		BoxBoundTime.Top,			BoxBoundTime.Height,			0xFF404040);
	
	HorizLineRender(BoxBoundTime.Left, 		BoxBoundTime.Top, 		BoxBoundTime.Width - 1, 		0xFFFFFFFF);
	HorizLineRender(BoxBoundTime.Left +1, 	BoxBoundTime.Bottom -1,  	BoxBoundTime.Width - 2, 		0xFF808080);
	HorizLineRender(BoxBoundTime.Left,		BoxBoundTime.Bottom,		BoxBoundTime.Width,			0xFF404040);
	
	if(LanguageEnCn==0)	TStaticText::sShow(BoxBoundTime.Left+2, BoxBoundTime.Top+2, BoxBoundTime.Right-2, BoxBoundTime.Top+32, clNearWhite, clBlue,  "设置日期时间段,按确认键开始查询");	
	else TStaticText::sShow(BoxBoundTime.Left+2, BoxBoundTime.Top+2, BoxBoundTime.Right-2, BoxBoundTime.Top+32, clNearWhite, clBlue,  "Set Date And Time,OK Key:Start The Query");	
}

void TQueryMsgOperate::DrawTimeEntry(void)
{
	int x,y,w,h;
	int i;
	unsigned char aHex0, aHex1;
	
	unsigned int aClr;
	if(IsAllTimeTemp){
		aClr = clSilver;
	}else{
		aClr = clNearBlack;
	}
	
	w = 36;
	h = 32;
	
	vtValueFrom[0] = DateTime.Date.Split.Year;
	vtValueFrom[1] = DateTime.Date.Split.Month;
	vtValueFrom[2] = DateTime.Date.Split.Day;
	
	vtValueFrom[3] = DateTime.Time.Split.Hour;
	vtValueFrom[4] = DateTime.Time.Split.Minute;
	vtValueFrom[5] = DateTime.Time.Split.Second;
	
	vtValueTo[0] =vtValueFrom[0];
	vtValueTo[1] =vtValueFrom[1];
	vtValueTo[2] =vtValueFrom[2];
	vtValueTo[3] =vtValueFrom[3];
	vtValueTo[4] =vtValueFrom[4];
	vtValueTo[5] =vtValueFrom[5];
	
	
	for(i=0; i<6; i++){
		x = BoxBoundTime.Left + 80 + (i * 48);
		y = BoxBoundTime.Top + 140 + (0 * 112);
		
		aHex0 = vtValueFrom[i] / 16 % 10;
		aHex1 = vtValueFrom[i] % 16 % 10;
		vtTextFrom[i][0] = aHex0 + '0';
		vtTextFrom[i][1] = aHex1 + '0';
		vtTextFrom[i][2] = 0;
		RectFillRender(x, y, x+w-1, y+h-1, clFrmFace);
		TextRender_string24(x+3, y+3, aClr, vtTextFrom[i]);
	}
	
	for(i=0; i<6; i++){
		x = BoxBoundTime.Left + 80 + (i * 48);
		y = BoxBoundTime.Top + 140 + (1 * 112);
		
		aHex0 = vtValueTo[i] / 16 % 10;
		aHex1 = vtValueTo[i] % 16 % 10;
		vtTextTo[i][0] = aHex0 + '0';
		vtTextTo[i][1] = aHex1 + '0';
		vtTextTo[i][2] = 0;
		RectFillRender(x, y, x+w-1, y+h-1, clFrmFace);
		TextRender_string24(x+3, y+3, aClr, vtTextTo[i]);
	}
}


void TQueryMsgOperate::DrawTimeEntryNoUpdate(void)
{
	int x,y,w,h;
	int i;
	unsigned char aHex0, aHex1;
	
	unsigned int aClr;
	if(IsAllTimeTemp){
		aClr = clSilver;
	}else{
		aClr = clNearBlack;
	}
	
	w = 36;
	h = 32;
	
	for(i=0; i<6; i++){
		x = BoxBoundTime.Left + 80 + (i * 48);
		y = BoxBoundTime.Top + 140 + (0 * 112);
		
		aHex0 = vtValueFrom[i] / 16 % 10;
		aHex1 = vtValueFrom[i] % 16 % 10;
		vtTextFrom[i][0] = aHex0 + '0';
		vtTextFrom[i][1] = aHex1 + '0';
		vtTextFrom[i][2] = 0;
		RectFillRender(x, y, x+w-1, y+h-1, clFrmFace);
		TextRender_string24(x+3, y+3, aClr, vtTextFrom[i]);
	}
	
	for(i=0; i<6; i++){
		x = BoxBoundTime.Left + 80 + (i * 48);
		y = BoxBoundTime.Top + 140 + (1 * 112);
		
		aHex0 = vtValueTo[i] / 16 % 10;
		aHex1 = vtValueTo[i] % 16 % 10;
		vtTextTo[i][0] = aHex0 + '0';
		vtTextTo[i][1] = aHex1 + '0';
		vtTextTo[i][2] = 0;
		RectFillRender(x, y, x+w-1, y+h-1, clFrmFace);
		TextRender_string24(x+3, y+3, aClr, vtTextTo[i]);
	}
}

void TQueryMsgOperate::DrawIfAllTime(void)
{
	unsigned int aClr, bClr;
	if(TimeEditFrom == -1){
		aClr = clNearWhite;
		bClr = clBlue;
	}else{
		aClr = clNearBlack;
		bClr = clFrmFace;
	}
	TTriangleLeftRight::sDrawLeftByHight(BoxBoundTime.Left + 150 - 20, BoxBoundTime.Top + 44, 20, clBlue);
	TTriangleLeftRight::sDrawRightByHight(BoxBoundTime.Left + 150 + 106, BoxBoundTime.Top + 44, 20, clBlue);
	if(LanguageEnCn==0){
		if(IsAllTimeTemp){
			TextRender_string24(BoxBoundTime.Left + 150, BoxBoundTime.Top + 42, aClr, bClr, "全部条目");
		}else{
			TextRender_string24(BoxBoundTime.Left + 150, BoxBoundTime.Top + 42, aClr, bClr, "按时间段");
		}
	}else{
		if(IsAllTimeTemp){
			TextRender_string24(BoxBoundTime.Left + 150, BoxBoundTime.Top + 42, aClr, bClr, "   All  ");
		}else{
			TextRender_string24(BoxBoundTime.Left + 150, BoxBoundTime.Top + 42, aClr, bClr, "Segments");
		}
	}
}

void TQueryMsgOperate::DrawBoxTimeString(void)
{
	unsigned int aClr;
	if(IsAllTimeTemp){
		aClr = clSilver;
	}else{
		aClr = clNearBlack;
	}
	if(LanguageEnCn==0){
		TextRender_string24(BoxBoundTime.Left + 52, BoxBoundTime.Top + 74, aClr,  "开始时间");
		TextRender_string24(BoxBoundTime.Left + 82, BoxBoundTime.Top + 108, aClr, "年  月  日  时  分  秒");
		TextRender_string24(BoxBoundTime.Left + 52, BoxBoundTime.Top + 187, aClr, "结束时间");
		TextRender_string24(BoxBoundTime.Left + 82, BoxBoundTime.Top + 219, aClr, "年  月  日  时  分  秒");
	}else{
		TextRender_string24(BoxBoundTime.Left + 52, BoxBoundTime.Top + 74, aClr, "Begin");
		TextRender_string24(BoxBoundTime.Left + 82, BoxBoundTime.Top + 108, aClr, " Y   M   D   H   M   S");
		TextRender_string24(BoxBoundTime.Left + 52, BoxBoundTime.Top + 187, aClr, "End");
		TextRender_string24(BoxBoundTime.Left + 82, BoxBoundTime.Top + 219, aClr, " Y   M   D   H   M   S");
	}
}

void TQueryMsgOperate::DrawBoxTime(void)
{
	DrawBoxTimeOutLine();
	DrawBoxTimeString();
	DrawIfAllTime();
	DrawTimeEntry();
}

void TQueryMsgOperate::DrawGoPrintOutLine()
{
	RectFillRender(GoPrint.Left, 	GoPrint.Top, GoPrint.Right, GoPrint.Bottom, clFrmFace);
	
	VertLineRender(GoPrint.Left,		GoPrint.Top, 		GoPrint.Height -1,		0xFFFFFFFF);
	VertLineRender(GoPrint.Right -1,	GoPrint.Top +1,		GoPrint.Height -2,		0xFF808080);
	VertLineRender(GoPrint.Right,		GoPrint.Top,		GoPrint.Height,			0xFF404040);
	
	HorizLineRender(GoPrint.Left, 	GoPrint.Top, 		GoPrint.Width - 1, 		0xFFFFFFFF);
	HorizLineRender(GoPrint.Left +1, 	GoPrint.Bottom -1,  	GoPrint.Width - 2, 		0xFF808080);
	HorizLineRender(GoPrint.Left,		GoPrint.Bottom,		GoPrint.Width,			0xFF404040);
	
	if(LanguageEnCn==0)TStaticText::sShow(GoPrint.Left+2, GoPrint.Top+2, GoPrint.Right-2, GoPrint.Top+32, clNearWhite, clBlue,  "按确认键开始打印并返回");	
	else TStaticText::sShow(GoPrint.Left+2, GoPrint.Top+2, GoPrint.Right-2, GoPrint.Top+32, clNearWhite, clBlue,  "Confirm Print Or Return");	
}

void TQueryMsgOperate::DrawPrintWhat()
{
	if(LanguageEnCn==0)TextRender_string24(GoPrint.Left + 150, GoPrint.Top + 66, clNearBlack, clFrmFace, "打印当前选定条目");
	else TextRender_string24(GoPrint.Left + 150, GoPrint.Top + 66, clNearBlack, clFrmFace, "Print Current Item");
	return;
	if(PrintWhat == 0){
		TextRender_string24(GoPrint.Left + 150, GoPrint.Top + 66, clNearBlack, clTeal, "当前选定条目");
	}else
	if(PrintWhat == 1){
		TextRender_string24(GoPrint.Left + 150, GoPrint.Top + 66, clNearBlack, clTeal, "  当前页面  ");
	}else{
		TextRender_string24(GoPrint.Left + 150, GoPrint.Top + 66, clNearBlack, clTeal, "  全部信息  ");
	}
}

void TQueryMsgOperate::Show(void)
{
	DrawSelf();
	Caption.Enable = 1;
	DrawCaption();
	if(IsInputTime){
		DrawBoxTime();
	}else{
		if(IsAllTime){
			DrawListAll();
		}else{
			DrawListInTime();
		}
	}
	DrawItemCount(Count);
	ShowTip();
}

void TQueryMsgOperate::ReDraw(void)
{
	Caption.Enable = 1;
	//DrawCaption();
	if(IsInputTime){
		DrawBoxTime();
	}else{
		if(IsAllTime){
			DrawListAll();
		}else{
			DrawListInTime();
		}
	}	
}


void TQueryMsgOperate::FullRedraw(int Prm)
{
	if(Prm == 0){
		DrawSelf();
		Caption.Enable = 1;
		DrawCaption();
		if(IsAllTime){
			DrawListAll();
		}else{
			DrawListInTime();
		}
		if(IsInputTime){
			DrawBoxTimeOutLine();
			DrawBoxTimeString();
			DrawIfAllTime();
			DrawTimeEntryNoUpdate();
			if(TimeEditFrom > -1){
				SetEditStart();
			}else{
				DrawBoxTimeString();
				DrawIfAllTime();
				DrawTimeEntry();
			}
		}else
		if(IsGoPrint){
			DrawGoPrintOutLine();
			DrawPrintWhat();
		}
		DrawItemCount(Count);
		ShowTip();
	}else
	if(Prm == 1){
		RectFillRender(GuiRedrawDataList[1][0], GuiRedrawDataList[1][1], GuiRedrawDataList[1][2], GuiRedrawDataList[1][3], Color);
		if(IsAllTime){
			DrawListAll();
		}else{
			DrawListInTime();
		}
		if(IsInputTime){
			DrawBoxTimeOutLine();
			DrawBoxTimeString();
			DrawIfAllTime();
			DrawTimeEntryNoUpdate();
			if(TimeEditFrom > -1){
				SetEditStart();
			}else{
				DrawBoxTimeString();
				DrawIfAllTime();
				DrawTimeEntry();
			}
		}else
		if(IsGoPrint){
			DrawGoPrintOutLine();
			DrawPrintWhat();
		}
		ShowTip();
	}
}


void TQueryMsgOperate::ShowTip()
{
	if(LanguageEnCn==0){
		if(  (IsInputTime == 0) && (IsGoPrint == 0) ){
			//TextRender_string24(40, 410, clNearBlack, Color, "左右键翻页, 上下键加减一条目, 设置键设定时间段, TAB键去打印");
			TextRender_string24(40, 410, clNearBlack, Color, "左右键翻页, 上下键加减一条目, TAB键去打印");
		}
		if(IsInputTime){
			TextRender_string24(40, 410, clNearBlack, Color, "上下左右键切换或编辑条目, 数字键删除键编辑                 ");
		}else
		if(IsGoPrint){
			TextRender_string24(40, 410, clNearBlack, Color, "按确定键打印当前条目                                       ");
		}
	}else{
		if(  (IsInputTime == 0) && (IsGoPrint == 0) ){
			//TextRender_string24(40, 410, clNearBlack, Color, "左右键翻页, 上下键加减一条目, 设置键设定时间段, TAB键去打印");
			TextRender_string24(40, 410, clNearBlack, Color, "Left,Right,Up,Down:Switch item; TAB To Print              ");
		}
		if(IsInputTime){
			TextRender_string24(40, 410, clNearBlack, Color, "Left,Right,Up,Down To Switch Item To Edit; Num Key To Edit");
		}else
		if(IsGoPrint){
			TextRender_string24(40, 410, clNearBlack, Color, "Press The OK Key To Print The Current Item                ");
		}
	}
}

void TQueryMsgOperate::SetEditStart(void)
{
	int x,y,w,h;
	
	IsEditing =1;
	
	ReStoreP0 = TimeEditFrom;
	ReStoreP1 = TimeIndex;
	
	x = BoxBoundTime.Left + 80 + (ReStoreP1 * 48);
	y = BoxBoundTime.Top + 140 + (ReStoreP0 * 112);
	w = 36;
	h = 32;
	
	vEdit.Init(x,y,w,h,0,0,1,clTeal);
	vEdit.Color = clTeal;
	vEdit.SetMaxLen(2);
	if(ReStoreP0 ==0){
		vEdit.Str.Text[0] = vtTextFrom[ReStoreP1][0];
		vEdit.Str.Text[1] = vtTextFrom[ReStoreP1][1];
		vEdit.Str.Text[2] = 0;
	}else
	if(ReStoreP0 ==1){
		vEdit.Str.Text[0] = vtTextTo[ReStoreP1][0];
		vEdit.Str.Text[1] = vtTextTo[ReStoreP1][1];
		vEdit.Str.Text[2] = 0;
	}
	vEdit.Pst = -1;
	vEdit.Show();
	vEdit.ShowCursor(clNearWhite);
}

void TQueryMsgOperate::RestoreFromEdit(void)
{
	int x,y,w,h;
	
	if(IsEditing == 0)return;
	
	x = BoxBoundTime.Left + 80 + (ReStoreP1 * 48);
	y = BoxBoundTime.Top + 140 + (ReStoreP0 * 112);
	w = 36;
	h = 32;
	
	RectFillRender(x, y, x+w-1, y+h-1, clFrmFace);
	if(ReStoreP0 == 0){
		vtTextFrom[ReStoreP1][0] = vEdit.Str.Text[0];
		vtTextFrom[ReStoreP1][1] = vEdit.Str.Text[1];
		vtTextFrom[ReStoreP1][2] = 0;
		TextRender_string24(x+3, y+3, clNearBlack, vtTextFrom[ReStoreP1]);
	}else
	if(ReStoreP0 == 1){
		vtTextTo[ReStoreP1][0] = vEdit.Str.Text[0];
		vtTextTo[ReStoreP1][1] = vEdit.Str.Text[1];
		vtTextTo[ReStoreP1][2] = 0;
		TextRender_string24(x+3, y+3, clNearBlack, vtTextTo[ReStoreP1]);
	}
	IsEditing = 0;
}

void TQueryMsgOperate::FillTextWithDateTime()
{
	int aLen;
	aLen = TMyString::sGetLen(Text.Text);
	if(aLen < 40){
		CoverDateTimeIllegal(EntryTmp.fData.Body, &DateTimeCovered);
		Text.Text[aLen + 0] = DateTimeCovered.Year / 16 % 10 + '0';
		Text.Text[aLen + 1] = DateTimeCovered.Year % 16 % 10+ '0';
		Text.Text[aLen + 2] = '/';
		Text.Text[aLen + 3] = DateTimeCovered.Month / 16 % 10 + '0';
		Text.Text[aLen + 4] = DateTimeCovered.Month % 16 % 10 + '0';
		Text.Text[aLen + 5] = '/';
		Text.Text[aLen + 6] = DateTimeCovered.Day / 16 % 10 + '0';
		Text.Text[aLen + 7] = DateTimeCovered.Day % 16 % 10 + '0';
		Text.Text[aLen + 8] = ' ';
		Text.Text[aLen + 9] = DateTimeCovered.Hour / 16 % 10 + '0';
		Text.Text[aLen + 10] = DateTimeCovered.Hour % 16 % 10 + '0';
		Text.Text[aLen + 11] = ':';
		Text.Text[aLen + 12] = DateTimeCovered.Minute / 16 % 10 + '0';
		Text.Text[aLen +13] = DateTimeCovered.Minute % 16 % 10 + '0';
		Text.Text[aLen +14] = ':';
		Text.Text[aLen +15] = DateTimeCovered.Second / 16 % 10 + '0';
		Text.Text[aLen +16] = DateTimeCovered.Second % 16 % 10 + '0';
		
		Text.Text[aLen +17] = ' ';
		Text.Text[aLen +18] = '\0';
	}	
}

void TQueryMsgOperate::FillTextWithPath()
{
	int aLen;
	unsigned int data, d,e;
	aLen = TMyString::sGetLen(Text.Text);
	
	data = EntryTmp.fData.Body.Splite.PCtlNum;
	d = data/10;
	e = d % 10;
	Text.Text[aLen + 0] = e + '0';
	e = data % 10;
	Text.Text[aLen + 1] = e + '0';
	Text.Text[aLen + 2] = '-';
		
	data = EntryTmp.fData.Body.Splite.P0;
	d = data/10;
	e = d % 10;
	Text.Text[aLen + 3] = e + '0';
	e = data % 10;
	Text.Text[aLen + 4] = e + '0';
	Text.Text[aLen + 5] = '-';
		
	data = EntryTmp.fData.Body.Splite.P1;	
	d = data/100;
	e = d % 10;
	Text.Text[aLen + 6] = e + '0';
	d = data/10;
	e = d % 10;
	Text.Text[aLen + 7] = e + '0';
	e = data % 10;
	Text.Text[aLen + 8] = e + '0';
	Text.Text[aLen + 9] = ' ';
	
	Text.Text[aLen +10] = ' ';
	Text.Text[aLen +11] = '\0';
}

void TQueryMsgOperate::FillTextWithDType()
{
	unsigned char aType;
	aType = EntryTmp.fData.Body.Splite.dType;
	if(LanguageEnCn==0)TMyString::sAddOnStr(StrTypeShortName[aType],Text.Text);
	else TMyString::sAddOnStr(StrTypeShortNameEn[aType],Text.Text);
	TMyString::sAddOnStr(" ",Text.Text);
}

void TQueryMsgOperate::FillCtlNum()
{
	if(EntryTmp.fData.Body.Splite.PCtlNum == 0){
		if(LanguageEnCn==0)TMyString::sAddOnStr("本机 ",Text.Text);
		else TMyString::sAddOnStr("Local",Text.Text); 
	}else{
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.PCtlNum,Text.Text);
		TMyString::sAddOnStr(" ",Text.Text);
	}
}

void TQueryMsgOperate::FillCtlNumNoSpace()
{
	if(EntryTmp.fData.Body.Splite.PCtlNum == 0){
		if(LanguageEnCn==0)TMyString::sAddOnStr("本机 ",Text.Text);
		else TMyString::sAddOnStr("Local",Text.Text);
	}else{
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.PCtlNum,Text.Text);
	}
}

void TQueryMsgOperate::FillText4PowerOff()
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0)TMyString::sAddOnStr("关机  ",Text.Text);
	else TMyString::sAddOnStr("Power Off ",Text.Text);
}

void TQueryMsgOperate::FillText4PowerUp()
{
	
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0)TMyString::sAddOnStr("开机  ",Text.Text);
	else TMyString::sAddOnStr("Power On ",Text.Text);
}

void TQueryMsgOperate::FillText4MsgReset(unsigned char Data1)
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0){
		TMyString::sAddOnStr("手动复位 ",Text.Text);
		if(Data1){
			TMyString::sAddOnStr("集中机呼叫执行 ",Text.Text);
		}
	}else{
		TMyString::sAddOnStr("Manual Reset ",Text.Text);
		if(Data1){
			TMyString::sAddOnStr("Call By Master ",Text.Text);
		}
	}
}

void TQueryMsgOperate::FillText4MsgMute()
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0)TMyString::sAddOnStr("手动消音    ",Text.Text);
	else TMyString::sAddOnStr("Manual Mute ",Text.Text);
}

void TQueryMsgOperate::FillText4MsgMask()
{
	FillTextWithDateTime();
	FillCtlNum();
	FillTextWithPath();
	AddOnUserCode();
	FillTextWithDType();
}

void TQueryMsgOperate::FillText4MsgUnMask()
{
	FillTextWithDateTime();
	FillCtlNum();
	FillTextWithPath();
	AddOnUserCode();
	FillTextWithDType();
}

void TQueryMsgOperate::FillText4AllowSet()
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0){
		TMyString::sAddOnStr("设置允许状态    ",Text.Text);
		if(EntryTmp.fData.Body.Splite.Data1 & 0x01){
			TMyString::sAddOnStr("自动允许    ",Text.Text);
		}else{
			TMyString::sAddOnStr("自动禁止    ",Text.Text);
		}
		if(EntryTmp.fData.Body.Splite.Data1 & 0x02){
			TMyString::sAddOnStr("手动允许    ",Text.Text);
		}else{
			TMyString::sAddOnStr("手动禁止    ",Text.Text);
		}
	}else{
		TMyString::sAddOnStr("Set Operating    ",Text.Text);
		if(EntryTmp.fData.Body.Splite.Data1 & 0x01){
			TMyString::sAddOnStr("Auto            ",Text.Text);
		}else{
			TMyString::sAddOnStr("Not Auto        ",Text.Text);
		}
		if(EntryTmp.fData.Body.Splite.Data1 & 0x02){
			TMyString::sAddOnStr("Manual Allow    ",Text.Text);
		}else{
			TMyString::sAddOnStr("Manual Not Allow",Text.Text);
		}
	}
}

void TQueryMsgOperate::FillText4AlramSetOnOff()
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0){
		TMyString::sAddOnStr("警报声光 ",Text.Text);
		if(EntryTmp.fData.Body.Splite.Data1){
			TMyString::sAddOnStr("启动 ",Text.Text);
		}else{
			TMyString::sAddOnStr("停止 ",Text.Text);
		}
	}else{
		TMyString::sAddOnStr("Alarm SL ",Text.Text);
		if(EntryTmp.fData.Body.Splite.Data1){
			TMyString::sAddOnStr("Active ",Text.Text);
		}else{
			TMyString::sAddOnStr("Stop ",Text.Text);
		}
	}
}

void TQueryMsgOperate::FillText4MsgDateTimeSet()
{
	int aLen;
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0)TMyString::sAddOnStr("设置日期时间为 ",Text.Text);
	else TMyString::sAddOnStr("Set Datetime: ",Text.Text);
	
	aLen = TMyString::sGetLen(Text.Text);
	if(aLen < 46){
		Text.Text[aLen + 0] = EntryTmp.fData.Body.Splite.P0 / 16 % 10 + '0';
		Text.Text[aLen + 1] = EntryTmp.fData.Body.Splite.P0 % 16 % 10 + '0';
		Text.Text[aLen + 2] = '-';
		Text.Text[aLen + 3] = EntryTmp.fData.Body.Splite.P1 / 16 % 10 + '0';
		Text.Text[aLen + 4] = EntryTmp.fData.Body.Splite.P1 % 16 % 10 + '0';
		Text.Text[aLen + 5] = '-';
		Text.Text[aLen + 6] = EntryTmp.fData.Body.Splite.P2 / 16 % 10 + '0';
		Text.Text[aLen + 7] = EntryTmp.fData.Body.Splite.P2 % 16 % 10 + '0';
		Text.Text[aLen + 8] = ' ';
		Text.Text[aLen + 9] = EntryTmp.fData.Body.Splite.Data1 / 16 % 10 + '0';
		Text.Text[aLen +10] = EntryTmp.fData.Body.Splite.Data1 % 16 % 10 + '0';
		Text.Text[aLen +11] = ':';
		Text.Text[aLen +12] = EntryTmp.fData.Body.Splite.iByte0 / 16 % 10 + '0';
		Text.Text[aLen +13] = EntryTmp.fData.Body.Splite.iByte0 % 16 % 10 + '0';
		Text.Text[aLen +14] = ':';
		Text.Text[aLen +15] = EntryTmp.fData.Body.Splite.iByte1 / 16  % 10 + '0';
		Text.Text[aLen +16] = EntryTmp.fData.Body.Splite.iByte1 % 16 % 10 + '0';
		
		Text.Text[aLen +17] = ' ';
		Text.Text[aLen +18] = '\0';
	}
}

void TQueryMsgOperate::FillText4BusPadOn()
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0){
		TMyString::sAddOnStr("总线盘 ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		TMyString::sAddOnStr(" 按键 ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1,Text.Text);
		TMyString::sAddOnStr(" 手动启动 ",Text.Text);
	}else{
		TMyString::sAddOnStr("BusPad ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		TMyString::sAddOnStr(" Pad ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1,Text.Text);
		TMyString::sAddOnStr(" Active ",Text.Text);
	}
}

void TQueryMsgOperate::FillText4BusPadOff()
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0){
		TMyString::sAddOnStr("总线盘 ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		TMyString::sAddOnStr(" 按键 ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1,Text.Text);
		TMyString::sAddOnStr(" 手动关闭 ",Text.Text);
	}else{
		TMyString::sAddOnStr("BusPad ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		TMyString::sAddOnStr(" Pad ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1,Text.Text);
		TMyString::sAddOnStr(" DeActive ",Text.Text);
	}
}

void TQueryMsgOperate::FillText4DirectPadManualAllowOn()
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0){
		TMyString::sAddOnStr("多线盘 ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		TMyString::sAddOnStr(" 手动允许 ",Text.Text);
	}else{
		TMyString::sAddOnStr("DirectCtrl ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		TMyString::sAddOnStr(" Allowed ",Text.Text);
	}
}

void TQueryMsgOperate::FillText4DirectPadManualAllowOff()
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0){
		TMyString::sAddOnStr("多线盘 ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		TMyString::sAddOnStr(" 手动禁止 ",Text.Text);
	}else{
		TMyString::sAddOnStr("DirectCtrl ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		TMyString::sAddOnStr(" Locked ",Text.Text);
	}
}

void TQueryMsgOperate::FillText4DirectPadNodeOn()
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0){
		TMyString::sAddOnStr("多线盘 ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		TMyString::sAddOnStr(" 节点 ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1,Text.Text);
		TMyString::sAddOnStr(" 手动开启 ",Text.Text);
	}else{
		TMyString::sAddOnStr("DirectCtrl ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		TMyString::sAddOnStr(" Node ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1,Text.Text);
		TMyString::sAddOnStr(" Active ",Text.Text);
	}
}

void TQueryMsgOperate::FillText4DirectPadNodeOff()
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0){
		TMyString::sAddOnStr("多线盘 ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		TMyString::sAddOnStr(" 节点 ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1,Text.Text);
		TMyString::sAddOnStr(" 手动关闭 ",Text.Text);
	}else{
		TMyString::sAddOnStr("DirectCtrl ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		TMyString::sAddOnStr(" Node ",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1,Text.Text);
		TMyString::sAddOnStr(" Stop ",Text.Text);
	}
}

void TQueryMsgOperate::FillText4UserCheck()
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0)TMyString::sAddOnStr("检查 ",Text.Text); 
	else TMyString::sAddOnStr("User Check ",Text.Text);
}

void TQueryMsgOperate::FillText4LinkageGo(unsigned char Data1)
{
	FillTextWithDateTime();
	FillCtlNum();
	if(LanguageEnCn==0){
		TMyString::sAddOnStr("联动执行",Text.Text);
		if(Data1 == 0){
			TMyString::sAddOnStr("-区域机报告",Text.Text);
		}else
		if(Data1 == 1){
			TMyString::sAddOnStr("-本机执行",Text.Text);
		}else
		if(Data1 == 3){
			TMyString::sAddOnStr("-集中机呼叫执行",Text.Text);
		}
	}else{
		TMyString::sAddOnStr("Linkage Exe",Text.Text);
		if(Data1 == 0){
			TMyString::sAddOnStr("-Slave Reported",Text.Text);
		}else
		if(Data1 == 1){
			TMyString::sAddOnStr("-Self Execute",Text.Text);
		}else
		if(Data1 == 3){
			TMyString::sAddOnStr("-Call By Master",Text.Text);
		}
	}
}

void TQueryMsgOperate::AddOnUserCode()
{
	TMyString::sAddOn8Dg(EntryTmp.fData.UserCode, Text.Text);
	TMyString::sAddOnStr(" ",Text.Text);
}

void TQueryMsgOperate::AddOnFireMsg()
{
	unsigned char aType;
	FillCtlNumNoSpace();
	TMyString::sAddOnStr("-",Text.Text);
	TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
	TMyString::sAddOnStr("-",Text.Text);
	TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
	TMyString::sAddOnStr(" ",Text.Text);
	AddOnUserCode();
	
	aType = EntryTmp.fData.Body.Splite.dType;
	if(LanguageEnCn==0)TMyString::sAddOnStr(StrTypeShortName[aType],Text.Text);
	else TMyString::sAddOnStr(StrTypeShortNameEn[aType],Text.Text);
}

void TQueryMsgOperate::AddOnFaultMsg()
{
	unsigned char aType;
	if( (EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0xC0){
			FillCtlNum();
			if(LanguageEnCn==0){
				if( (EntryTmp.fData.Body.Splite.P1 >= dADDR_HANDPAD_START) && (EntryTmp.fData.Body.Splite.P1 <= dADDR_HANDPAD_END) ){
					TMyString::sAddOnStr("总线盘 ",Text.Text);
					TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1 -dADDR_HANDPAD_START +1,Text.Text);
					TMyString::sAddOnStr(" 离线",Text.Text);
				}
				if( (EntryTmp.fData.Body.Splite.P1 >= dADDR_DIRECTPAD_START) && (EntryTmp.fData.Body.Splite.P1 <= dADDR_DIRECTPAD_END) ){
					TMyString::sAddOnStr("多线盘 ",Text.Text);
					TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1 -dADDR_DIRECTPAD_START +1,Text.Text);
					TMyString::sAddOnStr(" 离线",Text.Text);
				}
			}else{
				if( (EntryTmp.fData.Body.Splite.P1 >= dADDR_HANDPAD_START) && (EntryTmp.fData.Body.Splite.P1 <= dADDR_HANDPAD_END) ){
					TMyString::sAddOnStr("BusPad Board ",Text.Text);
					TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1 -dADDR_HANDPAD_START +1,Text.Text);
					TMyString::sAddOnStr(" Offline",Text.Text);
				}
				if( (EntryTmp.fData.Body.Splite.P1 >= dADDR_DIRECTPAD_START) && (EntryTmp.fData.Body.Splite.P1 <= dADDR_DIRECTPAD_END) ){
					TMyString::sAddOnStr("Direct Ctrl Board ",Text.Text);
					TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1 -dADDR_DIRECTPAD_START +1,Text.Text);
					TMyString::sAddOnStr(" Offline",Text.Text);
				}
			}
	}else
	if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0xD0){
		FillCtlNum();
		if(LanguageEnCn==0)TMyString::sAddOnStr("设备故障 ",Text.Text);
		else TMyString::sAddOnStr("Device Fault ",Text.Text);
		aType = EntryTmp.fData.Body.Splite.P2;
		if(LanguageEnCn==0){
			if(aType < 32){
				TMyString::sAddOnStr(StrDevFaultType[aType],Text.Text);
			}else{
				TMyString::sAddOnStr("未知错误",Text.Text);
			}
		}else{
			if(aType < 32){
				TMyString::sAddOnStr(StrDevFaultTypeEn[aType],Text.Text);
			}else{
				TMyString::sAddOnStr("Unknown Fault",Text.Text);
			}
		}
		TMyString::sAddOnStr(" ",Text.Text);
		if( (aType == 15) || (aType == 16) ){
			Text.Text[28] = '\0';
			if(LanguageEnCn==0)TMyString::sAddOnStr(StrDevFaultType[aType],Text.Text);
			else TMyString::sAddOnStr(StrDevFaultTypeEn[aType],Text.Text);
			TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
			if(LanguageEnCn==0)TMyString::sAddOnStr("通讯故障",Text.Text);
			else TMyString::sAddOnStr("Offline",Text.Text);
			//if(EntryTmp.fData.Body.Splite.mType > 200){
			//	TMyString::sAddOnStr("通讯故障条目数:多于200",Text.Text);
			//}else{
			//	TMyString::sAddOnStr("通讯故障条目数:",Text.Text);
			//	TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.mType, Text.Text);
			//}
		}
	}else
	if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0xE0){
		FillCtlNum();
		TMyString::sAddOnStr("-",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0,Text.Text);
		if(LanguageEnCn==0)TMyString::sAddOnStr(" 回路故障",Text.Text);
		else TMyString::sAddOnStr(" Loop Fault",Text.Text);

	}else
	if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0xF0){
		//Board Error
		FillCtlNum();
		if(LanguageEnCn==0)TMyString::sAddOnStr("板卡故障 ",Text.Text);
		else TMyString::sAddOnStr("Board Fault",Text.Text); 
		aType = EntryTmp.fData.Body.Splite.P2;
		if(aType == 10){
			TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1,Text.Text);
			TMyString::sAddOnStr(" ",Text.Text);
		}
		if(LanguageEnCn==0){
			if(aType < 32){
				TMyString::sAddOnStr(StrBrdFaultType[aType],Text.Text);
			}else{
				TMyString::sAddOnStr("未知类型",Text.Text);
			}
		}else{
			if(aType < 32){
				TMyString::sAddOnStr(StrBrdFaultTypeEn[aType],Text.Text);
			}else{
				TMyString::sAddOnStr("Unknown Fault",Text.Text);
			}
		}
	}else{
		//EpError
		FillCtlNumNoSpace();
		TMyString::sAddOnStr("-",Text.Text);
		TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
		TMyString::sAddOnStr("-",Text.Text);
		TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
		TMyString::sAddOnStr(" ",Text.Text);
		AddOnUserCode();
		
		aType = EntryTmp.fData.Body.Splite.P2;
		if(LanguageEnCn==0){
			if(aType < 16){
				TMyString::sAddOnStr(StrEpFaultType[aType],Text.Text);
			}else{
				TMyString::sAddOnStr("未知故障",Text.Text);
			}
		}else{
			if(aType < 16){
				TMyString::sAddOnStr(StrEpFaultTypeEn[aType],Text.Text);
			}else{
				TMyString::sAddOnStr("Unknown Fault",Text.Text);
			}
		}
	}
}

int TQueryMsgOperate::FillTextCN(int aInx, int ShowInx)
{
	volatile unsigned int SdAddr, Addr;
	unsigned int d,e;
	unsigned int data;
	unsigned char aP0;
	unsigned char aP1;
	unsigned char aType;
	unsigned int ExpsInx;
	
	NeedDisplayDescp = 0;
	NeedDrawCfg = 0;
	
	//Operate History
	Addr = Record.Buf4Operate.SdramAddrStart + aInx * 64;
	if(Addr >= (dSdramOperateHistoryContentBaseAddr + dSdramHistoryBytesLength) )
		SdAddr = Addr - dSdramHistoryBytesLength;
	else
		SdAddr = Addr;
	for(d=2; d<14; d++){
		EntryTmp.D32[d] = *(volatile unsigned int *)(SdAddr + d * 4); 
	}
	
	data = ShowInx +1;
		
	d = data/100000;
	e = d % 10;
	Text.Text[0] = e + '0';
	
	d = data/10000;
	e = d % 10;
	Text.Text[1] = e + '0';

	d = data/1000;
	e = d % 10;
	Text.Text[2] = e + '0';
	
	d = data/100;
	e = d % 10;
	Text.Text[3] = e + '0';
	
	d = data/10;
	e = d % 10;
	Text.Text[4] = e + '0';
	
	e = data % 10;
	Text.Text[5] = e + '0';
	
	Text.Text[6] = ' ';
	Text.Text[7] = '\0';
	
	if(EntryTmp.fData.Body.Splite.mType == etOperate){
		switch(EntryTmp.fData.Body.Splite.Data0){
			case otPowerOff:
				FillText4PowerOff();
				break;
			case otPowerOn:
				FillText4PowerUp();
				break;
			case otReset:
				FillText4MsgReset(EntryTmp.fData.Body.Splite.Data1);
				break;
			case otMute:
				FillText4MsgMute();
				break;
			case otMask:
				FillText4MsgMask();
				NeedDisplayDescp =1;
				NeedDrawCfg =0xB1;
				break;
			case otUnMask:
				FillText4MsgUnMask();
				NeedDisplayDescp =1;
				NeedDrawCfg =0xB0;
				break;
			case otRegiste:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr("开始注册设备",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr("设备注册成功",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 3){
					TMyString::sAddOnStr("呼叫区域机注册",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 4){
					TMyString::sAddOnStr("集中机呼叫注册",Text.Text);
				}
				break;
			case otUnRegiste:
				
				
				break;
			case otSetCanNetwork:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr("设置本机为集中机:",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr("设置本机为区域机:",Text.Text);
				}else{
					TMyString::sAddOnStr("设置本机为单机:",Text.Text);
				}
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				break;
			case otCfgBoard:
				
				break;
			case otCfgCrt:
				
				break;
			case otCfgPriter:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 0){
					TMyString::sAddOnStr("打印机关闭",Text.Text);
				}else{
					TMyString::sAddOnStr("打印机开启",Text.Text);
				}
				if(1){
					TMyString::sAddOnStr("打印:",Text.Text);
					data = 0;
					if(EntryTmp.fData.Body.Splite.P0 & 0x01){
						TMyString::sAddOnStr("全部",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x02){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("火警",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x04){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("联动",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x08){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("监管",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x10){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("故障",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x20){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("屏蔽",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x40){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("操作",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x80){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("其他",Text.Text);
						data++;
					}
					if(data == 0){
						TMyString::sAddOnStr("全部类型信息不打印",Text.Text);
					}
				}
				break;
			case otCfgDevice:
				
				NeedDisplayDescp = 1;
				break;
			case otCfgDateTime:
				FillText4MsgDateTimeSet();
				break;
			case otCfgPermissionAllow:
				
				break;
			case otAllowSet:
				FillText4AllowSet();
				break;
			case otAlramSetOnOff:
				FillText4AlramSetOnOff();
				break;
			case otBusPadOn:
				FillText4BusPadOn();
				break;
			case otBusPadOff:
				FillText4BusPadOff();
				break;
			case otDirectPadManualAllowOn:
				FillText4DirectPadManualAllowOn();
				break;
			case otDirectPadManualAllowOff:
				FillText4DirectPadManualAllowOff();
				break;
			case otDirectPadNodeOn:
				FillText4DirectPadNodeOn();
				break;
			case otDirectPadNodeOff:
				FillText4DirectPadNodeOff();
				break;
			case otUserCheck:
				FillText4UserCheck();
				break;
			case otLinkageGo:
				FillText4LinkageGo(EntryTmp.fData.Body.Splite.Data1);
				break;
			case otSetNwTime:
				FillTextWithDateTime();
				FillCtlNum();
				TMyString::sAddOnStr("设置各区域机日期时间",Text.Text);
				break;
			case otReqNwTime:
				FillTextWithDateTime();
				FillCtlNum();
				TMyString::sAddOnStr("向集中机请求日期时间",Text.Text);
				break;
			case otSelfCheck:
				FillTextWithDateTime();
				FillCtlNum();
				TMyString::sAddOnStr("自检",Text.Text);
				break;
			case otSetManualAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1)TMyString::sAddOnStr("手动允许",Text.Text);
				else TMyString::sAddOnStr("手动禁止",Text.Text);
				break;
			case otSetAutoAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1)TMyString::sAddOnStr("自动允许",Text.Text);
				else TMyString::sAddOnStr("自动禁止",Text.Text);
				break;
			case otRemoteSetManualAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1)TMyString::sAddOnStr("手动允许-集中机呼叫执行",Text.Text);
				else TMyString::sAddOnStr("手动禁止--集中机呼叫执行",Text.Text);
				break;
			case otRemoteSetAutoAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1)TMyString::sAddOnStr("自动允许-集中机呼叫执行",Text.Text);
				else TMyString::sAddOnStr("自动禁止--集中机呼叫执行",Text.Text);
				break;
			case otReportManualAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1)TMyString::sAddOnStr("手动允许-区域机报告",Text.Text);
				else TMyString::sAddOnStr("手动禁止-区域机报告",Text.Text);
				break;
			case otReportAutoAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1)TMyString::sAddOnStr("自动允许-区域机报告",Text.Text);
				else TMyString::sAddOnStr("自动禁止-区域机报告",Text.Text);
				break;
			case otFireConfirm:
				FillTextWithDateTime();
				/*FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" ",Text.Text);
				AddOnUserCode();
				TMyString::sAddOnStr("火警确认 ",Text.Text);*/
				AddOnFireMsg();
				NeedDisplayDescp = 1;
				NeedDrawCfg =1;
				break;
			case otFireSimConfirm:
				FillTextWithDateTime();
				/*FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" ",Text.Text);
				AddOnUserCode();
				TMyString::sAddOnStr("火警确认 ",Text.Text);*/
				AddOnFireMsg();
				NeedDisplayDescp = 1;
				NeedDrawCfg =11;
				break;
			case otFireRemoteConfirm:
				FillTextWithDateTime();
				/*FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" ",Text.Text);
				AddOnUserCode();
				TMyString::sAddOnStr("火警远程确认 ",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.Data1, Text.Text);*/
				AddOnFireMsg();
				NeedDisplayDescp = 3;
				NeedDrawCfg = 3;
				break;
			case otFireSimRemoteConfirm:
				FillTextWithDateTime();
				/*FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" ",Text.Text);
				AddOnUserCode();
				TMyString::sAddOnStr("火警远程确认 ",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.Data1, Text.Text);*/
				AddOnFireMsg();
				NeedDisplayDescp = 3;
				NeedDrawCfg = 13;
				break;
			case otFaultConfirm:
				FillTextWithDateTime();
				if( (EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0){
					NeedDisplayDescp = 1;
				}
				AddOnFaultMsg();
				NeedDrawCfg = 2;
				break;
			case otFaultRemoteConfirm:
				FillTextWithDateTime();
				if( (EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0){
					NeedDisplayDescp = 1;
				}
				/*if( (EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0){
					FillCtlNumNoSpace();
					TMyString::sAddOnStr("-",Text.Text);
					TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
					TMyString::sAddOnStr("-",Text.Text);
					TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
					TMyString::sAddOnStr(" ",Text.Text);
					AddOnUserCode();
					TMyString::sAddOnStr("故障远程确认 ",Text.Text);
					//TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.Data1, Text.Text);
					NeedDisplayDescp = 1;
					NeedDrawCfg = 2;
				}else{
					FillCtlNum();
					TMyString::sAddOnStr(" 故障远程确认 ",Text.Text);
					//TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.Data1, Text.Text);
					NeedDrawCfg = 2;
				}*/
				AddOnFaultMsg();
				NeedDrawCfg = 4;
				break;
			case otSetSmokeSensViaCircuit:
				FillTextWithDateTime();
				FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				if(EntryTmp.fData.Body.Splite.Data1 == 0){
					//TMyString::sAddOnStr(" 回路烟感设置敏感度为 低",Text.Text);
					TMyString::sAddOnStr(" 回路烟感设置敏感度为 标准",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					//TMyString::sAddOnStr(" 回路烟感设置敏感度为 中",Text.Text);
					TMyString::sAddOnStr(" 回路烟感设置敏感度为 高",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					//TMyString::sAddOnStr(" 回路烟感设置敏感度为 高",Text.Text);
					TMyString::sAddOnStr(" 回路烟感设置敏感度为 未定义",Text.Text);
				}else{
					TMyString::sAddOnStr(" 回路烟感设置敏感度为 未定义",Text.Text);
				}
				break;
			case otSetSmokeSensViaAddr:
				FillTextWithDateTime();
				FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" ",Text.Text);
				AddOnUserCode();
				if(EntryTmp.fData.Body.Splite.Data1 == 0){
					//TMyString::sAddOnStr("烟感设置敏感度 低",Text.Text);
					TMyString::sAddOnStr("烟感设置敏感度 标准",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					//TMyString::sAddOnStr("回路烟感设置敏感度为 中",Text.Text);
					TMyString::sAddOnStr("烟感设置敏感度 高",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					//TMyString::sAddOnStr(" 回路烟感设置敏感度为 高",Text.Text);
					TMyString::sAddOnStr("烟感设置敏感度 未知",Text.Text);
				}else{
					TMyString::sAddOnStr("烟感设置敏感度 未知",Text.Text);
				}
				NeedDisplayDescp = 1;
				break;
			case otCleanUp:
				FillTextWithDateTime();
				FillCtlNum();
				//aPanel->Btn[0].Caption.FromStr("  清除回路终端设备的登记  ");
				//aPanel->Btn[1].Caption.FromStr("      清除总线盘配置      ");
				//aPanel->Btn[2].Caption.FromStr("      清除多线盘配置      ");
				//aPanel->Btn[3].Caption.FromStr("    清除所有联动表达式    ");
				//aPanel->Btn[4].Caption.FromStr("    清除本机终端设备注释  ");
				//aPanel->Btn[5].Caption.FromStr("       清除组网配置       ");
				//aPanel->Btn[6].Caption.FromStr("  清除网络加载的设备注释  ");
				//aPanel->Btn[7].Caption.FromStr("         预设描述         ");
			
				if(EntryTmp.fData.Body.Splite.Data1 == 0){
					TMyString::sAddOnStr("清除回路注册",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr("清除总线盘配置",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr("清除多线盘配置",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 3){
					TMyString::sAddOnStr("清除所有联动表达式 ",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 4){
					TMyString::sAddOnStr("清除本机终端设备注释",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 5){
					TMyString::sAddOnStr("清除组网配置",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 6){
					TMyString::sAddOnStr("清除网络加载的设备注释",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 7){
					TMyString::sAddOnStr("清除用户码及指派类型",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 0xF0){
					TMyString::sAddOnStr("清除回路注册-中途退出",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 0xF3){
					TMyString::sAddOnStr("清除联动关系-中途退出",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 0xF4){
					TMyString::sAddOnStr("清除注释-中途退出",Text.Text);
				}
				break;
			case otLinkageExpsSaveRemove:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr("保存一个联动表达式 编号:",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 0){
					TMyString::sAddOnStr("删除一个联动表达式 编号:",Text.Text);
				}
				ExpsInx = EntryTmp.fData.Body.Splite.P0;
				ExpsInx = ExpsInx * 256;
				ExpsInx = ExpsInx + EntryTmp.fData.Body.Splite.P1;
				TMyString::sAddOn4Dg(ExpsInx, Text.Text);
				break;
			case otBusPadModify:
				FillTextWithDateTime();
				FillCtlNum();
				TMyString::sAddOnStr("总线盘:",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr(" 按键号:",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" 配置",Text.Text);
				break;
			case otDirectPadModify:
				FillTextWithDateTime();
				FillCtlNum();
				TMyString::sAddOnStr("多线盘:",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr(" 配置",Text.Text);
				break;
			case otDescpModify:
				FillTextWithDateTime();
				FillCtlNumNoSpace();
				if(EntryTmp.fData.Body.Splite.P0 <= dPORT_MAX_COUNT){
					TMyString::sAddOnStr("-",Text.Text);
					TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
					TMyString::sAddOnStr("-",Text.Text);
					TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
					TMyString::sAddOnStr(" ",Text.Text);
					AddOnUserCode();
					TMyString::sAddOnStr("设备描述更改 ",Text.Text);
					NeedDisplayDescp = 1;
				}else
				if(  (EntryTmp.fData.Body.Splite.P0 >= dADDR_DIRECTPAD_START) && (EntryTmp.fData.Body.Splite.P0 <= dADDR_DIRECTPAD_END) ){
					TMyString::sAddOnStr(" ",Text.Text);
					AddOnUserCode();
					TMyString::sAddOnStr("多线盘:",Text.Text);
					TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0-dADDR_DIRECTPAD_START+1, Text.Text);
					TMyString::sAddOnStr(" 节点:",Text.Text);
					TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
					TMyString::sAddOnStr(" 描述更改 ",Text.Text);
					NeedDisplayDescp = 1;
				}
				break;
			case otPassWdModify:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr(" 二级密码更改",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 3){
					TMyString::sAddOnStr(" 三级密码更改",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 12){
					TMyString::sAddOnStr(" 系统故障,二级密码写入失败",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 13){
					TMyString::sAddOnStr(" 系统故障,三级密码写入失败",Text.Text);
				}
				break;
			case otRegisterByManual:
				FillTextWithDateTime();
				FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" ",Text.Text);
				AddOnUserCode();
				if(EntryTmp.fData.Body.Splite.Data1){
					TMyString::sAddOnStr("手动注册,类型:",Text.Text);
					TMyString::sAddOnStr(StrTypeShortName[EntryTmp.fData.Body.Splite.dType],Text.Text);
				}else{
					TMyString::sAddOnStr("手动注册,删除",Text.Text);
				}
				
				break;
			case otAddRemoveNwCtl:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr(" 手动添加区域机 ",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr(" 手动删除区域机 ",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 3){
					TMyString::sAddOnStr(" 手动添加集中机 ",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 4){
					TMyString::sAddOnStr(" 手动删除集中机 ",Text.Text);
				}
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				break;
			case otRegCanNetwork:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					if(EntryTmp.fData.Body.Splite.P1){
						TMyString::sAddOnStr("本集中机注册区域机数量:",Text.Text);
						TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
					}else{
						TMyString::sAddOnStr("本集中机清除联机区域机",Text.Text);
					}
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					if(EntryTmp.fData.Body.Splite.P1){
						TMyString::sAddOnStr("本区域机联机注册,集中机号:",Text.Text);
						TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
					}else{
						TMyString::sAddOnStr("本区域机联机清除,集中机号:",Text.Text);
						TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
					}
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 3){
					if(EntryTmp.fData.Body.Splite.P1){
						TMyString::sAddOnStr("设置网络共存集中机数量:",Text.Text);
						TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
					}else{
						TMyString::sAddOnStr("清除网络共存集中机:",Text.Text);
						TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
					}
				}
				break;
			case  otClearNetworkCfg:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr("清除所有区域机",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr("清除挂载的集中机",Text.Text);
				}
				break;
			case  otBroadcastVa:
				FillTextWithDateTime();
				FillCtlNum();
				TMyString::sAddOnStr("设置广播与声光 路径:",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				if(EntryTmp.fData.Body.Splite.Data1 == 0){
					TMyString::sAddOnStr(" 并行模式",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr(" 交替模式",Text.Text);
				}
				break;
			
			case otSetAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 3)TMyString::sAddOnStr("自动允许-手动允许",Text.Text);
				else if(EntryTmp.fData.Body.Splite.Data1 == 1)TMyString::sAddOnStr("自动允许-手动禁止",Text.Text);
				else if(EntryTmp.fData.Body.Splite.Data1 == 2)TMyString::sAddOnStr("自动禁止-手动允许",Text.Text);
				else TMyString::sAddOnStr("自动禁止-手动禁止",Text.Text);
				break;
			case otRemoteSetAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 3)TMyString::sAddOnStr("自动允许-手动允许-集中机呼叫执行",Text.Text);
				else if(EntryTmp.fData.Body.Splite.Data1 == 1)TMyString::sAddOnStr("自动允许-手动禁止-集中机呼叫执行",Text.Text);
				else if(EntryTmp.fData.Body.Splite.Data1 == 2)TMyString::sAddOnStr("自动禁止-手动允许-集中机呼叫执行",Text.Text);
				else TMyString::sAddOnStr("自动禁止-手动禁止-集中机呼叫执行",Text.Text);
				break;
			case otReportAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(LanguageEnCn==0){
					if(EntryTmp.fData.Body.Splite.Data1 == 3)TMyString::sAddOnStr("自动允许-手动允许-区域机报告",Text.Text);
					else if(EntryTmp.fData.Body.Splite.Data1 == 1)TMyString::sAddOnStr("自动允许-手动禁止-区域机报告",Text.Text);
					else if(EntryTmp.fData.Body.Splite.Data1 == 1)TMyString::sAddOnStr("自动禁止-手动允许-区域机报告",Text.Text);
					else TMyString::sAddOnStr("自动禁止-手动禁止-区域机报告",Text.Text);
				}else{
					if(EntryTmp.fData.Body.Splite.Data1 == 3)TMyString::sAddOnStr("自动允许-手动允许-区域机报告",Text.Text);
					else if(EntryTmp.fData.Body.Splite.Data1 == 1)TMyString::sAddOnStr("自动允许-手动禁止-区域机报告",Text.Text);
					else if(EntryTmp.fData.Body.Splite.Data1 == 1)TMyString::sAddOnStr("自动禁止-手动允许-区域机报告",Text.Text);
					else TMyString::sAddOnStr("自动禁止-手动禁止-区域机报告",Text.Text);
				}
				break;
		}
	}
	if(0){
		data = ShowInx +1;
		
		d = data/100000;
		e = d % 10;
		Text.Text[0] = e + '0';
		
		d = data/10000;
		e = d % 10;
		Text.Text[1] = e + '0';

		d = data/1000;
		e = d % 10;
		Text.Text[2] = e + '0';
		
		d = data/100;
		e = d % 10;
		Text.Text[3] = e + '0';
		
		d = data/10;
		e = d % 10;
		Text.Text[4] = e + '0';
		
		e = data % 10;
		Text.Text[5] = e + '0';
		
		Text.Text[6] = ' ';
		
		Text.Text[7] = EntryTmp.fData.Body.Splite.Month / 16 % 10 + '0';
		Text.Text[8] = EntryTmp.fData.Body.Splite.Month % 16 + '0';
		Text.Text[9] = '-';
		Text.Text[10] = EntryTmp.fData.Body.Splite.Day / 16 % 10 + '0';
		Text.Text[11] = EntryTmp.fData.Body.Splite.Day % 16 + '0';
		Text.Text[12] = ' ';
		Text.Text[13] = EntryTmp.fData.Body.Splite.Hour / 16 % 10 + '0';
		Text.Text[14] = EntryTmp.fData.Body.Splite.Hour % 16 + '0';
		Text.Text[15] = ':';
		Text.Text[16] = EntryTmp.fData.Body.Splite.Minute / 16 % 10 + '0';
		Text.Text[17] = EntryTmp.fData.Body.Splite.Minute % 16 + '0';
		Text.Text[18] = ':';
		Text.Text[19] = EntryTmp.fData.Body.Splite.Second / 16  % 10 + '0';
		Text.Text[20] = EntryTmp.fData.Body.Splite.Second % 16 + '0';
		Text.Text[21] = ' ';
		
		data = EntryTmp.fData.Body.Splite.PCtlNum;
		d = data/10;
		e = d % 10;
		Text.Text[22] = e + '0';
		e = data % 10;
		Text.Text[23] = e + '0';
		Text.Text[24] = '-';
		
		data = EntryTmp.fData.Body.Splite.P0;
		d = data/10;
		e = d % 10;
		Text.Text[25] = e + '0';
		e = data % 10;
		Text.Text[26] = e + '0';
		Text.Text[27] = '-';
		
		data = EntryTmp.fData.Body.Splite.P1;	
		d = data/100;
		e = d % 10;
		Text.Text[28] = e + '0';
		d = data/10;
		e = d % 10;
		Text.Text[29] = e + '0';
		e = data % 10;
		Text.Text[30] = e + '0';
		Text.Text[31] = ' ';

		aP0 = EntryTmp.fData.Body.Splite.P0;
		aP1 = EntryTmp.fData.Body.Splite.P1;

		if( (aP0 >0) && (aP0 < 64) ){
			if(aP1 >0){
				if(aP0 < 40){
					aP0--;
					data = Port[aP0].UcList[aP1-1].Full;
				}
			}
		}
		d = data/10000;
		e = d % 10;
		Text.Text[32] = e + '0';
		d = data/1000;
		e = d % 10;
		Text.Text[33] = e + '0';
		d = data/100;
		e = d % 10;
		Text.Text[34] = e + '0';
		d = data/10;
		e = d % 10;
		Text.Text[35] = e + '0';
		e = data % 10;
		Text.Text[36] = e + '0';
		Text.Text[37] = ' ';

		Text.Text[38] = 0;
		
		aType = EntryTmp.fData.Body.Splite.dType;
		TMyString::sAddOnStr(StrTypeShortName[aType],Text.Text);
		//TMyString::sAddOnStr(" ",Text);
		//TMyString::sAddOnStrL32(EntryTmp.fData.Descp, Text);
	}
	return NeedDisplayDescp;
}


int TQueryMsgOperate::FillTextEN(int aInx, int ShowInx)
{
	volatile unsigned int SdAddr, Addr;
	unsigned int d,e;
	unsigned int data;
	unsigned char aP0;
	unsigned char aP1;
	unsigned char aType;
	unsigned int ExpsInx;
	
	NeedDisplayDescp = 0;
	NeedDrawCfg = 0;
	
	//Operate History
	Addr = Record.Buf4Operate.SdramAddrStart + aInx * 64;
	if(Addr >= (dSdramOperateHistoryContentBaseAddr + dSdramHistoryBytesLength) )
		SdAddr = Addr - dSdramHistoryBytesLength;
	else
		SdAddr = Addr;
	for(d=2; d<14; d++){
		EntryTmp.D32[d] = *(volatile unsigned int *)(SdAddr + d * 4); 
	}
	
	data = ShowInx +1;
		
	d = data/100000;
	e = d % 10;
	Text.Text[0] = e + '0';
	
	d = data/10000;
	e = d % 10;
	Text.Text[1] = e + '0';

	d = data/1000;
	e = d % 10;
	Text.Text[2] = e + '0';
	
	d = data/100;
	e = d % 10;
	Text.Text[3] = e + '0';
	
	d = data/10;
	e = d % 10;
	Text.Text[4] = e + '0';
	
	e = data % 10;
	Text.Text[5] = e + '0';
	
	Text.Text[6] = ' ';
	Text.Text[7] = '\0';
	
	if(EntryTmp.fData.Body.Splite.mType == etOperate){
		switch(EntryTmp.fData.Body.Splite.Data0){
			case otPowerOff:
				FillText4PowerOff();
				break;
			case otPowerOn:
				FillText4PowerUp();
				break;
			case otReset:
				FillText4MsgReset(EntryTmp.fData.Body.Splite.Data1);
				break;
			case otMute:
				FillText4MsgMute();
				break;
			case otMask:
				FillText4MsgMask();
				NeedDisplayDescp =1;
				NeedDrawCfg =0xB1;
				break;
			case otUnMask:
				FillText4MsgUnMask();
				NeedDisplayDescp =1;
				NeedDrawCfg =0xB0;
				break;
			case otRegiste:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr("Start Register",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr("Regist Succeed",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 3){
					TMyString::sAddOnStr("Call Slaver To Register",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 4){
					TMyString::sAddOnStr("Do Register Call By Master",Text.Text);
				}
				break;
			case otUnRegiste:
				
				
				break;
			case otSetCanNetwork:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr("Set To Master:",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr("Set To Slaver:",Text.Text);
				}else{
					TMyString::sAddOnStr("Set To Single:",Text.Text);
				}
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				break;
			case otCfgBoard:
				
				break;
			case otCfgCrt:
				
				break;
			case otCfgPriter:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 0){
					TMyString::sAddOnStr("Print Off ",Text.Text);
				}else{
					TMyString::sAddOnStr("Print On ",Text.Text);
				}
				if(1){
					TMyString::sAddOnStr("Print:",Text.Text);
					data = 0;
					if(EntryTmp.fData.Body.Splite.P0 & 0x01){
						TMyString::sAddOnStr("All",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x02){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("Fire",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x04){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("Link",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x08){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("Supv",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x10){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("Fail",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x20){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("Mask",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x40){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("OPR.",Text.Text);
						data++;
					}
					if(EntryTmp.fData.Body.Splite.P0 & 0x80){
						if(data)TMyString::sAddOnStr("+",Text.Text);
						TMyString::sAddOnStr("Oth.",Text.Text);
						data++;
					}
					if(data == 0){
						TMyString::sAddOnStr("Not Print Any Type",Text.Text);
					}
				}
				break;
			case otCfgDevice:
				
				NeedDisplayDescp = 1;
				break;
			case otCfgDateTime:
				FillText4MsgDateTimeSet();
				break;
			case otCfgPermissionAllow:
				
				break;
			case otAllowSet:
				FillText4AllowSet();
				break;
			case otAlramSetOnOff:
				FillText4AlramSetOnOff();
				break;
			case otBusPadOn:
				FillText4BusPadOn();
				break;
			case otBusPadOff:
				FillText4BusPadOff();
				break;
			case otDirectPadManualAllowOn:
				FillText4DirectPadManualAllowOn();
				break;
			case otDirectPadManualAllowOff:
				FillText4DirectPadManualAllowOff();
				break;
			case otDirectPadNodeOn:
				FillText4DirectPadNodeOn();
				break;
			case otDirectPadNodeOff:
				FillText4DirectPadNodeOff();
				break;
			case otUserCheck:
				FillText4UserCheck();
				break;
			case otLinkageGo:
				FillText4LinkageGo(EntryTmp.fData.Body.Splite.Data1);
				break;
			case otSetNwTime:
				FillTextWithDateTime();
				FillCtlNum();
				TMyString::sAddOnStr("Set Salver Datetime",Text.Text);
				break;
			case otReqNwTime:
				FillTextWithDateTime();
				FillCtlNum();
				TMyString::sAddOnStr("Req Datetime To Master",Text.Text);
				break;
			case otSelfCheck:
				FillTextWithDateTime();
				FillCtlNum();
				TMyString::sAddOnStr("Selfcheck",Text.Text);
				break;
			case otSetManualAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1)TMyString::sAddOnStr("Enable Manual",Text.Text);
				else TMyString::sAddOnStr("Disable Manual",Text.Text);
				break;
			case otSetAutoAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1)TMyString::sAddOnStr("Enable Auto",Text.Text);
				else TMyString::sAddOnStr("Disable Auto",Text.Text);
				break;
			case otRemoteSetManualAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1)TMyString::sAddOnStr("Enable Manual(Master Call)",Text.Text);
				else TMyString::sAddOnStr("Disable Manual(Master Call)",Text.Text);
				break;
			case otRemoteSetAutoAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1)TMyString::sAddOnStr("Enable Auto(Master Call)",Text.Text);
				else TMyString::sAddOnStr("Disable Auto(Master Call)",Text.Text);
				break;
			case otReportManualAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1)TMyString::sAddOnStr("Enable Manual(Slaver Report)",Text.Text);
				else TMyString::sAddOnStr("Disable Manual(Slaver Report)",Text.Text);
				break;
			case otReportAutoAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1)TMyString::sAddOnStr("Enable Auto(Slaver Report)",Text.Text);
				else TMyString::sAddOnStr("Disable Auto(Slaver Report)",Text.Text);
				break;
			case otFireConfirm:
				FillTextWithDateTime();
				/*FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" ",Text.Text);
				AddOnUserCode();
				TMyString::sAddOnStr("火警确认 ",Text.Text);*/
				AddOnFireMsg();
				NeedDisplayDescp = 1;
				NeedDrawCfg =1;
				break;
			case otFireSimConfirm:
				FillTextWithDateTime();
				/*FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" ",Text.Text);
				AddOnUserCode();
				TMyString::sAddOnStr("火警确认 ",Text.Text);*/
				AddOnFireMsg();
				NeedDisplayDescp = 1;
				NeedDrawCfg =11;
				break;
			case otFireRemoteConfirm:
				FillTextWithDateTime();
				/*FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" ",Text.Text);
				AddOnUserCode();
				TMyString::sAddOnStr("火警远程确认 ",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.Data1, Text.Text);*/
				AddOnFireMsg();
				NeedDisplayDescp = 3;
				NeedDrawCfg = 3;
				break;
			case otFireSimRemoteConfirm:
				FillTextWithDateTime();
				/*FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" ",Text.Text);
				AddOnUserCode();
				TMyString::sAddOnStr("火警远程确认 ",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.Data1, Text.Text);*/
				AddOnFireMsg();
				NeedDisplayDescp = 3;
				NeedDrawCfg = 13;
				break;
			case otFaultConfirm:
				FillTextWithDateTime();
				if( (EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0){
					NeedDisplayDescp = 1;
				}
				AddOnFaultMsg();
				NeedDrawCfg = 2;
				break;
			case otFaultRemoteConfirm:
				FillTextWithDateTime();
				if( (EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0){
					NeedDisplayDescp = 1;
				}
				/*if( (EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0){
					FillCtlNumNoSpace();
					TMyString::sAddOnStr("-",Text.Text);
					TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
					TMyString::sAddOnStr("-",Text.Text);
					TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
					TMyString::sAddOnStr(" ",Text.Text);
					AddOnUserCode();
					TMyString::sAddOnStr("故障远程确认 ",Text.Text);
					//TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.Data1, Text.Text);
					NeedDisplayDescp = 1;
					NeedDrawCfg = 2;
				}else{
					FillCtlNum();
					TMyString::sAddOnStr(" 故障远程确认 ",Text.Text);
					//TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.Data1, Text.Text);
					NeedDrawCfg = 2;
				}*/
				AddOnFaultMsg();
				NeedDrawCfg = 4;
				break;
			case otSetSmokeSensViaCircuit:
				FillTextWithDateTime();
				FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				if(EntryTmp.fData.Body.Splite.Data1 == 0){
					TMyString::sAddOnStr(" Set Smoke detector:Std",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr(" Set Smoke detector:High",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr(" Set Smoke detector:ExHigh",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 3){
					TMyString::sAddOnStr(" Set Smoke detector:Ultra",Text.Text);
				}else{
					TMyString::sAddOnStr(" Set Smoke detector:Unknow",Text.Text);
				}
				break;
			case otSetSmokeSensViaAddr:
				FillTextWithDateTime();
				FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" ",Text.Text);
				AddOnUserCode();
				if(EntryTmp.fData.Body.Splite.Data1 == 0){
					TMyString::sAddOnStr("Set Smoke detector:Std",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr("Set Smoke detector:High",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr("Set Smoke detector:ExHigh",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 3){
					TMyString::sAddOnStr("Set Smoke detector:Ultra",Text.Text);
				}else{
					TMyString::sAddOnStr("Set Smoke detector:Unknow",Text.Text);
				}
				NeedDisplayDescp = 1;
				break;
			case otCleanUp:
				FillTextWithDateTime();
				FillCtlNum();
				//aPanel->Btn[0].Caption.FromStr("  清除回路终端设备的登记  ");
				//aPanel->Btn[1].Caption.FromStr("      清除总线盘配置      ");
				//aPanel->Btn[2].Caption.FromStr("      清除多线盘配置      ");
				//aPanel->Btn[3].Caption.FromStr("    清除所有联动表达式    ");
				//aPanel->Btn[4].Caption.FromStr("    清除本机终端设备注释  ");
				//aPanel->Btn[5].Caption.FromStr("       清除组网配置       ");
				//aPanel->Btn[6].Caption.FromStr("  清除网络加载的设备注释  ");
				//aPanel->Btn[7].Caption.FromStr("         预设描述         ");
			
				if(EntryTmp.fData.Body.Splite.Data1 == 0){
					TMyString::sAddOnStr("Clear Loop Regist",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr("Clear Bus Pnl Config",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr("Clear Direct Config",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 3){
					TMyString::sAddOnStr("Clear All Linkage Expression ",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 4){
					TMyString::sAddOnStr("Clear All Endpoint Description",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 5){
					TMyString::sAddOnStr("Clear LAN Config",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 6){
					TMyString::sAddOnStr("Clear LAN Description",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 7){
					TMyString::sAddOnStr("Clear Usercode & Assigntype",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 0xF0){
					TMyString::sAddOnStr("Blocking,Clear Loop Regist",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 0xF3){
					TMyString::sAddOnStr("Blocking,Clear All Linkage Expressions",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 0xF4){
					TMyString::sAddOnStr("Blocking,Clear Descriptions",Text.Text);
				}
				break;
			case otLinkageExpsSaveRemove:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr("Save Linkage Exp. Num:",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 0){
					TMyString::sAddOnStr("Delete Linkage Exp. Num:",Text.Text);
				}
				ExpsInx = EntryTmp.fData.Body.Splite.P0;
				ExpsInx = ExpsInx * 256;
				ExpsInx = ExpsInx + EntryTmp.fData.Body.Splite.P1;
				TMyString::sAddOn4Dg(ExpsInx, Text.Text);
				break;
			case otBusPadModify:
				FillTextWithDateTime();
				FillCtlNum();
				TMyString::sAddOnStr("BusPnl:",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr(" Key:",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" Config",Text.Text);
				break;
			case otDirectPadModify:
				FillTextWithDateTime();
				FillCtlNum();
				TMyString::sAddOnStr("Direct:",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr(" Config",Text.Text);
				break;
			case otDescpModify:
				FillTextWithDateTime();
				FillCtlNumNoSpace();
				if(EntryTmp.fData.Body.Splite.P0 <= dPORT_MAX_COUNT){
					TMyString::sAddOnStr("-",Text.Text);
					TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
					TMyString::sAddOnStr("-",Text.Text);
					TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
					TMyString::sAddOnStr(" ",Text.Text);
					AddOnUserCode();
					TMyString::sAddOnStr("Changed Device Descp ",Text.Text);
					NeedDisplayDescp = 1;
				}else
				if(  (EntryTmp.fData.Body.Splite.P0 >= dADDR_DIRECTPAD_START) && (EntryTmp.fData.Body.Splite.P0 <= dADDR_DIRECTPAD_END) ){
					TMyString::sAddOnStr(" ",Text.Text);
					AddOnUserCode();
					TMyString::sAddOnStr("Direct:",Text.Text);
					TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0-dADDR_DIRECTPAD_START+1, Text.Text);
					TMyString::sAddOnStr(" Node:",Text.Text);
					TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
					TMyString::sAddOnStr(" Changed Descp ",Text.Text);
					NeedDisplayDescp = 1;
				}
				break;
				break;
			case otPassWdModify:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr(" Change Password II",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 3){
					TMyString::sAddOnStr(" Change Password III",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 12){
					TMyString::sAddOnStr(" Sys Fault,Fail Password II",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 13){
					TMyString::sAddOnStr(" Sys Fault,Fail Password III",Text.Text);
				}
				break;
			case otRegisterByManual:
				FillTextWithDateTime();
				FillCtlNumNoSpace();
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				TMyString::sAddOnStr(" ",Text.Text);
				AddOnUserCode();
				if(EntryTmp.fData.Body.Splite.Data1){
					TMyString::sAddOnStr("Manual Reg Type:",Text.Text);
					TMyString::sAddOnStr(StrTypeShortNameEn[EntryTmp.fData.Body.Splite.dType],Text.Text);
				}else{
					TMyString::sAddOnStr("Manual Reg Delete",Text.Text);
				}
				
				break;
			case otAddRemoveNwCtl:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr(" Manual Add Slaver ",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr(" Manual Del Slaver ",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 3){
					TMyString::sAddOnStr(" Manual Add Master ",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 4){
					TMyString::sAddOnStr(" Manual Del Master ",Text.Text);
				}
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				break;
			case otRegCanNetwork:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					if(EntryTmp.fData.Body.Splite.P1){
						TMyString::sAddOnStr("Slaver Count In Master:",Text.Text);
						TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
					}else{
						TMyString::sAddOnStr("Cleared Slavers In Master",Text.Text);
					}
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					if(EntryTmp.fData.Body.Splite.P1){
						TMyString::sAddOnStr("Inject Num Of Master::",Text.Text);
						TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
					}else{
						TMyString::sAddOnStr("Cleared Master Conection",Text.Text);
						TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
					}
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 3){
					if(EntryTmp.fData.Body.Splite.P1){
						TMyString::sAddOnStr("Set Master Count:",Text.Text);
						TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
					}else{
						TMyString::sAddOnStr("Clear iConnected Master",Text.Text);
						TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
					}
				}
				break;
			case  otClearNetworkCfg:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr("Clear All Slaver",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 2){
					TMyString::sAddOnStr("Clear Link Master",Text.Text);
				}
				break;
			case  otBroadcastVa:
				FillTextWithDateTime();
				FillCtlNum();
				TMyString::sAddOnStr("Set BCT & SL Path:",Text.Text);
				TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P0, Text.Text);
				TMyString::sAddOnStr("-",Text.Text);
				TMyString::sAddOn3Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
				if(EntryTmp.fData.Body.Splite.Data1 == 0){
					TMyString::sAddOnStr(" Parallel Mode",Text.Text);
				}else
				if(EntryTmp.fData.Body.Splite.Data1 == 1){
					TMyString::sAddOnStr(" Alternate Mode",Text.Text);
				}
				break;
			
			case otSetAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 3)TMyString::sAddOnStr("En Auto,En Manual",Text.Text);
				else if(EntryTmp.fData.Body.Splite.Data1 == 1)TMyString::sAddOnStr("En Auto,Dis Manual",Text.Text);
				else if(EntryTmp.fData.Body.Splite.Data1 == 2)TMyString::sAddOnStr("Dis Auto,En Manual",Text.Text);
				else TMyString::sAddOnStr("Dis Auto,Dis Manual",Text.Text);
				break;
			case otRemoteSetAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 3)TMyString::sAddOnStr("En Auto,En Manual(Master Call)",Text.Text);
				else if(EntryTmp.fData.Body.Splite.Data1 == 1)TMyString::sAddOnStr("En Auto,Dis Manual(Master Call)",Text.Text);
				else if(EntryTmp.fData.Body.Splite.Data1 == 2)TMyString::sAddOnStr("Dis Auto,En Manual(Master Call)",Text.Text);
				else TMyString::sAddOnStr("Dis Auto,Dis Manual(Master Call)",Text.Text);
				break;
			case otReportAllowState:
				FillTextWithDateTime();
				FillCtlNum();
				if(EntryTmp.fData.Body.Splite.Data1 == 3)TMyString::sAddOnStr("En Auto,En Manual(Slaver Report)",Text.Text);
				else if(EntryTmp.fData.Body.Splite.Data1 == 1)TMyString::sAddOnStr("En Auto,Dis Manual(Slaver Report)",Text.Text);
				else if(EntryTmp.fData.Body.Splite.Data1 == 1)TMyString::sAddOnStr("Dis Auto,En Manual(Slaver Report)",Text.Text);
				else TMyString::sAddOnStr("Dis Auto,Dis Manual(Slaver Report)",Text.Text);
				break;
		}
	}
	if(0){
		data = ShowInx +1;
		
		d = data/100000;
		e = d % 10;
		Text.Text[0] = e + '0';
		
		d = data/10000;
		e = d % 10;
		Text.Text[1] = e + '0';

		d = data/1000;
		e = d % 10;
		Text.Text[2] = e + '0';
		
		d = data/100;
		e = d % 10;
		Text.Text[3] = e + '0';
		
		d = data/10;
		e = d % 10;
		Text.Text[4] = e + '0';
		
		e = data % 10;
		Text.Text[5] = e + '0';
		
		Text.Text[6] = ' ';
		
		Text.Text[7] = EntryTmp.fData.Body.Splite.Month / 16 % 10 + '0';
		Text.Text[8] = EntryTmp.fData.Body.Splite.Month % 16 + '0';
		Text.Text[9] = '-';
		Text.Text[10] = EntryTmp.fData.Body.Splite.Day / 16 % 10 + '0';
		Text.Text[11] = EntryTmp.fData.Body.Splite.Day % 16 + '0';
		Text.Text[12] = ' ';
		Text.Text[13] = EntryTmp.fData.Body.Splite.Hour / 16 % 10 + '0';
		Text.Text[14] = EntryTmp.fData.Body.Splite.Hour % 16 + '0';
		Text.Text[15] = ':';
		Text.Text[16] = EntryTmp.fData.Body.Splite.Minute / 16 % 10 + '0';
		Text.Text[17] = EntryTmp.fData.Body.Splite.Minute % 16 + '0';
		Text.Text[18] = ':';
		Text.Text[19] = EntryTmp.fData.Body.Splite.Second / 16  % 10 + '0';
		Text.Text[20] = EntryTmp.fData.Body.Splite.Second % 16 + '0';
		Text.Text[21] = ' ';
		
		data = EntryTmp.fData.Body.Splite.PCtlNum;
		d = data/10;
		e = d % 10;
		Text.Text[22] = e + '0';
		e = data % 10;
		Text.Text[23] = e + '0';
		Text.Text[24] = '-';
		
		data = EntryTmp.fData.Body.Splite.P0;
		d = data/10;
		e = d % 10;
		Text.Text[25] = e + '0';
		e = data % 10;
		Text.Text[26] = e + '0';
		Text.Text[27] = '-';
		
		data = EntryTmp.fData.Body.Splite.P1;	
		d = data/100;
		e = d % 10;
		Text.Text[28] = e + '0';
		d = data/10;
		e = d % 10;
		Text.Text[29] = e + '0';
		e = data % 10;
		Text.Text[30] = e + '0';
		Text.Text[31] = ' ';

		aP0 = EntryTmp.fData.Body.Splite.P0;
		aP1 = EntryTmp.fData.Body.Splite.P1;

		if( (aP0 >0) && (aP0 < 64) ){
			if(aP1 >0){
				if(aP0 < 40){
					aP0--;
					data = Port[aP0].UcList[aP1-1].Full;
				}
			}
		}
		d = data/10000;
		e = d % 10;
		Text.Text[32] = e + '0';
		d = data/1000;
		e = d % 10;
		Text.Text[33] = e + '0';
		d = data/100;
		e = d % 10;
		Text.Text[34] = e + '0';
		d = data/10;
		e = d % 10;
		Text.Text[35] = e + '0';
		e = data % 10;
		Text.Text[36] = e + '0';
		Text.Text[37] = ' ';

		Text.Text[38] = 0;
		
		aType = EntryTmp.fData.Body.Splite.dType;
		TMyString::sAddOnStr(StrTypeShortNameEn[aType],Text.Text);
		//TMyString::sAddOnStr(" ",Text);
		//TMyString::sAddOnStrL32(EntryTmp.fData.Descp, Text);
	}
	return NeedDisplayDescp;
}

int TQueryMsgOperate::FillText(int aInx, int ShowInx)
{
	if(LanguageEnCn==0){
		return FillTextCN(aInx, ShowInx);
	}else{
		return FillTextEN(aInx, ShowInx);
	}
}


void TQueryMsgOperate::FillDescpText(int aInx)
{
	volatile unsigned int SdAddr, Addr;
	unsigned int d,e;
	unsigned int data;
	unsigned char aP0;
	unsigned char aP1;
	unsigned char aType;
	const char * tText;
	
	if(NeedDrawCfg == 1){
		if(LanguageEnCn==0)tText=cFireCfm; else tText=cFireCfmEn;
		for(d=0; d<22; d++)Text.Text[d] = tText[d];
		Text.Text[22] = '\0';
		/*if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0x0){
			TMyString::sAddOnStr(" ",Text.Text);
			aP0 = EntryTmp.fData.Body.Splite.P0;
			if( (aP0 >0) && (aP0 <=40) ){
				aType = EntryTmp.fData.Body.Splite.dType;
				TMyString::sAddOnStr(StrTypeShortName[aType],Text.Text);
			}else
			if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <=dADDR_DIRECTPAD_START) ){
				TMyString::sAddOnStr("多线盘节点 ",Text.Text);
			}
		}*/
		TMyString::sFillFixLen(Text.Text, 28);
	}else
	if(NeedDrawCfg == 11){
		if(LanguageEnCn==0)tText=cFireSimCfm; else tText=cFireSimCfmEn;
		for(d=0; d<22; d++)Text.Text[d] = tText[d];
		Text.Text[22] = '\0';
		/*if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0x0){
			TMyString::sAddOnStr(" ",Text.Text);
			aP0 = EntryTmp.fData.Body.Splite.P0;
			if( (aP0 >0) && (aP0 <=40) ){
				aType = EntryTmp.fData.Body.Splite.dType;
				TMyString::sAddOnStr(StrTypeShortName[aType],Text.Text);
			}else
			if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <=dADDR_DIRECTPAD_START) ){
				TMyString::sAddOnStr("多线盘节点 ",Text.Text);
			}
		}*/
		TMyString::sFillFixLen(Text.Text, 28);
	}else
	if(NeedDrawCfg == 2){
		if(LanguageEnCn==0)tText=cFaultCfm; else tText=cFaultCfmEn;
		for(d=0; d<22; d++)Text.Text[d] = tText[d];
		Text.Text[22] = '\0';
		/*if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0x0){
			TMyString::sAddOnStr(" ",Text.Text);
			aP0 = EntryTmp.fData.Body.Splite.P0;
			if( (aP0 >0) && (aP0 <=40) ){
				aType = EntryTmp.fData.Body.Splite.dType;
				TMyString::sAddOnStr(StrTypeShortName[aType],Text.Text);
			}else
			if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <=dADDR_DIRECTPAD_START) ){
				TMyString::sAddOnStr("多线盘节点 ",Text.Text);
			}
		}*/
		TMyString::sFillFixLen(Text.Text, 28);
	}else
	if(NeedDrawCfg == 3){
		if(LanguageEnCn==0)tText=cFireRemoteCfm; else tText=cFireRemoteCfmEn;
		for(d=0; d<22; d++)Text.Text[d] = tText[d];
		Text.Text[22] = '\0';
		/*if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0x0){
			TMyString::sAddOnStr(" ",Text.Text);
			aP0 = EntryTmp.fData.Body.Splite.P0;
			if( (aP0 >0) && (aP0 <=40) ){
				aType = EntryTmp.fData.Body.Splite.dType;
				TMyString::sAddOnStr(StrTypeShortName[aType],Text.Text);
			}else
			if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <=dADDR_DIRECTPAD_START) ){
				TMyString::sAddOnStr("多线盘节点 ",Text.Text);
			}
		}*/
		TMyString::sFillFixLen(Text.Text, 28);
	}else
	if(NeedDrawCfg == 13){
		if(LanguageEnCn==0)tText=cFireSimRemoteCfm;else tText=cFireSimRemoteCfmEn;
		for(d=0; d<22; d++)Text.Text[d] = tText[d];
		Text.Text[22] = '\0';
		/*if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0x0){
			TMyString::sAddOnStr(" ",Text.Text);
			aP0 = EntryTmp.fData.Body.Splite.P0;
			if( (aP0 >0) && (aP0 <=40) ){
				aType = EntryTmp.fData.Body.Splite.dType;
				TMyString::sAddOnStr(StrTypeShortName[aType],Text.Text);
			}else
			if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <=dADDR_DIRECTPAD_START) ){
				TMyString::sAddOnStr("多线盘节点 ",Text.Text);
			}
		}*/
		TMyString::sFillFixLen(Text.Text, 28);
	}else
	if(NeedDrawCfg == 4){
		if(LanguageEnCn==0)tText=cFaultRemoteCfm;else tText=cFaultRemoteCfmEn;
		for(d=0; d<22; d++)Text.Text[d] = tText[d];
		Text.Text[22] = '\0';
		/*if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0x0){
			TMyString::sAddOnStr(" ",Text.Text);
			aP0 = EntryTmp.fData.Body.Splite.P0;
			if( (aP0 >0) && (aP0 <=40) ){
				aType = EntryTmp.fData.Body.Splite.dType;
				TMyString::sAddOnStr(StrTypeShortName[aType],Text.Text);
			}else
			if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <=dADDR_DIRECTPAD_START) ){
				TMyString::sAddOnStr("多线盘节点 ",Text.Text);
			}
		}*/
		TMyString::sFillFixLen(Text.Text, 28);
	}else
	if(NeedDrawCfg == 0xB1){
		if(LanguageEnCn==0)tText=cMask;else tText=cMaskEn;
		for(d=0; d<22; d++)Text.Text[d] = tText[d];
		Text.Text[22] = '\0';
		/*if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0x0){
			TMyString::sAddOnStr(" ",Text.Text);
			aP0 = EntryTmp.fData.Body.Splite.P0;
			if( (aP0 >0) && (aP0 <=40) ){
				aType = EntryTmp.fData.Body.Splite.dType;
				TMyString::sAddOnStr(StrTypeShortName[aType],Text.Text);
			}else
			if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <=dADDR_DIRECTPAD_START) ){
				TMyString::sAddOnStr("多线盘节点 ",Text.Text);
			}
		}*/
		TMyString::sFillFixLen(Text.Text, 28);
	}else
	if(NeedDrawCfg == 0xB0){
		if(LanguageEnCn==0)tText=cUnMask;else tText=cUnMaskEn;
		for(d=0; d<22; d++)Text.Text[d] = tText[d];
		Text.Text[22] = '\0';
		/*if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0x0){
			TMyString::sAddOnStr(" ",Text.Text);
			aP0 = EntryTmp.fData.Body.Splite.P0;
			if( (aP0 >0) && (aP0 <=40) ){
				aType = EntryTmp.fData.Body.Splite.dType;
				TMyString::sAddOnStr(StrTypeShortName[aType],Text.Text);
			}else
			if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <=dADDR_DIRECTPAD_START) ){
				TMyString::sAddOnStr("多线盘节点 ",Text.Text);
			}
		}*/
		TMyString::sFillFixLen(Text.Text, 28);
	}else{
		Text.D32[0] = 0x20202020;
		Text.D32[1] = 0x20202020;
		Text.D32[2] = 0x20202020;
		Text.D32[3] = 0x20202020;
		Text.D32[4] = 0x20202020;
		Text.D32[5] = 0x20202020;
		Text.D32[6] = 0x20202020;
		Text.D32[7] = 0x20202020;
		Text.D32[8] = 0;
	}
	
	if(NeedDisplayDescp){
		//Operate History
		Addr = Record.Buf4Operate.SdramAddrStart + aInx * 64;
		if(Addr >= (dSdramOperateHistoryContentBaseAddr + dSdramHistoryBytesLength) )
			SdAddr = Addr - dSdramHistoryBytesLength;
		else
			SdAddr = Addr;
		for(d=7; d<15; d++){
			Text.D32[d] = *(volatile unsigned int *)(SdAddr + d * 4); 
		}
		Text.D32[15] =0;
		TMyString::sFillFixLen(Text.Text, dLineMaxLen);
	}
	
	TMyString::sFillFixLen(Text.Text, dLineMaxLen);
}

void TQueryMsgOperate::FillDescpTextEmpty()
{
	Text.Text[0] = ' ';
	Text.Text[1] = '\0';
	TMyString::sFillFixLen(Text.Text, dLineMaxLen);
}

void TQueryMsgOperate::DrawListAll(void)
{
	volatile unsigned int i, aLen;
	int aInx, aTopInx;
	volatile unsigned int TextClr, bClr, Wrote;
	
	aInx = TopIndex;
	Wrote = 0;
	for(i=0;i<ListLineCnt;i++){
		aTopInx = i*2;
		if(aInx > (Count-1))break;
		if(SelectedIndex != aInx){
			bClr = Color;
			TextClr = clNearBlack;
		}else{
			bClr = clBlue;
			TextClr = clNearWhite;
		}
		NeedDisplayDescp = FillText(aInx, aInx);
		TMyString::sFillFixLen(Text.Text, dLineMaxLen);
		TMyString::sBrokeFixLen(Text.Text, dLineMaxLen);
		RectFillRender(MsgX0, stAllTop[aTopInx] + 24, MsgX0 +  767, stAllTop[aTopInx +1]-6-1, bClr);
		TextRender_string24(MsgX0, 	stAllTop[aTopInx +0], TextClr, bClr, Text.Text); 
		FillDescpText(aInx);
		//else FillDescpTextEmpty();
		TextRender_string24(MsgX0, 	stAllTop[aTopInx +1]-6, TextClr, bClr, Text.Text);
		aInx++;
		Wrote++;
	}
	for(i=Wrote; i<ListLineCnt; i++){
		Text.Text[0] = ' ';
		Text.Text[1] = 0;
		TMyString::sFillFixLen(Text.Text, dLineMaxLen);
		aTopInx = i*2;
		RectFillRender(MsgX0, stAllTop[aTopInx] + 24, MsgX0 +  767, stAllTop[aTopInx +1]-6-1, Color);
		TextRender_string24(MsgX0, 	stAllTop[aTopInx +0], 	clWhite, Color, Text.Text);
		TextRender_string24(MsgX0, 	stAllTop[aTopInx +1]-6, clNearBlack, Color, Text.Text);
	}
	aInx = TopIndex;
	if(aInx <0)aInx = 0;
	TVScrollBar::sDrawByPoint(777, stAllTop[0], 795, stAllTop[7] + 24, clBlue , clGray , Count, 8, TopIndex);
}

void TQueryMsgOperate::DrawListInTime(void)
{
	volatile unsigned int i, aLen;
	int aInx, aTopInx;
	volatile unsigned int TextClr, bClr, Wrote;
	
	Wrote = 0;
	if(InTimeCount >0){
		i = InTimeTopIndex;
		for(;i<(InTimeStopIndex+1);i++){
			if(InTimeSelectedIndex != (InTimeTopIndex + Wrote)){
				bClr = Color; 
				TextClr = clNearBlack;
			}else{ 
				bClr = clBlue;
				TextClr = clNearWhite;
			}
			aInx = InTimeTopIndex - InTimeStartIndex + Wrote;
			NeedDisplayDescp = FillText(i, aInx);
			TMyString::sFillFixLen(Text.Text, dLineMaxLen);
			TMyString::sBrokeFixLen(Text.Text, dLineMaxLen);
			aTopInx = Wrote *2;
			RectFillRender(MsgX0, stAllTop[aTopInx] + 24, MsgX0 +  767, stAllTop[aTopInx +1]-6-1, bClr);
			TextRender_string24(MsgX0, 	stAllTop[aTopInx +0], TextClr, bClr, Text.Text); 
			FillDescpText(i);
			//else FillDescpTextEmpty();
			TextRender_string24(DescpX0, 	stAllTop[aTopInx +1]-6, TextClr, bClr, Text.Text); 

			Wrote++;
			if(Wrote >= ListLineCnt){
				break;
			}
		}
	}
	for(i=Wrote; i<ListLineCnt; i++){
		Text.Text[0] = ' ';
		Text.Text[1] = 0;
		TMyString::sFillFixLen(Text.Text, dLineMaxLen);
		aTopInx = i *2;
		RectFillRender(MsgX0, stAllTop[aTopInx] + 24, MsgX0 +  767, stAllTop[aTopInx +1]-6-1, Color);
		TextRender_string24(MsgX0, 	stAllTop[aTopInx +0], clWhite, Color, Text.Text);
		FillDescpTextEmpty();
		TextRender_string24(DescpX0, 	stAllTop[aTopInx +1]-6, clWhite, Color, Text.Text);
	}
	aInx = InTimeTopIndex - InTimeStartIndex;
	if(aInx <0)aInx = 0;
	TVScrollBar::sDrawByPoint(777, stAllTop[0], 795, stAllTop[7] + 24, clBlue , clGray , InTimeCount, 8, aInx);
}

void TQueryMsgOperate::LoadData()
{
	Count = Record.Buf4Operate.Count;
	TopIndex = Count - ListLineCnt;
	if(TopIndex < 0)TopIndex = 0;
	if(Count >0){
		SelectedIndex = Count -1;
	}else{
		SelectedIndex = TopIndex;
	}
}

unsigned long long TQueryMsgOperate::aTimeGet(int aInx)
{
	volatile unsigned int SdAddr, Addr;

	//Operate History
	Addr = Record.Buf4Operate.SdramAddrStart + aInx * 64;
	if(Addr >= (dSdramOperateHistoryContentBaseAddr + dSdramHistoryBytesLength) )
		SdAddr = Addr - dSdramHistoryBytesLength;
	else
		SdAddr = Addr;
	alt.D32.Low4 =  *(volatile unsigned int *)(SdAddr + 12); 
	alt.D32.Hi2 =  *(volatile unsigned int *)(SdAddr + 16);
	alt.D8[6] = 0;
	alt.D8[7] = 0;
	return alt.D64;
}

void TQueryMsgOperate::GetStartStopTime()
{
	int i;

	RestoreFromEdit();
	for(i=0; i<6;i++){
		alt.D8[5-i] = (vtTextFrom[i][0] - '0') * 16;
		alt.D8[5-i] += (vtTextFrom[i][1] - '0');
	}
	alt.D8[6] = 0;
	alt.D8[7] = 0;
	StartTime = alt.D64;
	for(i=0; i<6;i++){
		alt.D8[5-i] = (vtTextTo[i][0] - '0') * 16;
		alt.D8[5-i] += (vtTextTo[i][1] - '0');
	}
	alt.D8[6] = 0;
	alt.D8[7] = 0;
	StopTime = alt.D64;
}

void TQueryMsgOperate::FindInTimeEntry()
{
	int i, aCnt, SatrtFound, StopFound;
	unsigned long long aT;
	SatrtFound = 0;
	StopFound = 0;
	InTimeStartIndex = 0;
	for(i=Count-1; i>-1; i--){
		aT = aTimeGet(i);
		if(aT < StartTime){
			InTimeStartIndex = i+1;
			if(InTimeStartIndex >(Count-1)){
				SatrtFound = 0;
			}else{
				SatrtFound = 1;
			}
			break;
		}
	}
	if(SatrtFound == 0){
		if(InTimeStartIndex == 0){
			SatrtFound  =1;
		}
	}
	if(SatrtFound){
		for(i=Count-1; i>-1; i--){
			aT = aTimeGet(i);
			if(aT <= StopTime){
				InTimeStopIndex = i;
				StopFound = 1;
				break;
			}
		}
		if(StopFound == 0){
			InTimeStopIndex = Count-1;
		}
		if(InTimeStopIndex < InTimeStartIndex){
			InTimeCount = 0;
		}else{
			aCnt = InTimeStopIndex - InTimeStartIndex + 1;
			if(aCnt <0)aCnt = 0;
			InTimeCount = aCnt;
		}
		
		InTimeTopIndex = InTimeStopIndex - ListLineCnt +1;
		if(InTimeTopIndex < InTimeStartIndex)InTimeTopIndex = InTimeStartIndex;
		InTimeSelectedIndex = InTimeTopIndex;
	}else{
		InTimeCount = 0;
		InTimeTopIndex = 0;
		InTimeStopIndex = 0;
	}
}

void TQueryMsgOperate::GetEntry4Print(int aInx)
{
	volatile unsigned int SdAddr, Addr;
	unsigned int d,e;
	unsigned int data;
	unsigned char aP0;
	unsigned char aP1;
	unsigned char aType;
	unsigned int NeedDescp;
	
	NeedDescp = 0;
	
	//Operate History
	Addr = Record.Buf4Operate.SdramAddrStart + aInx * 64;
	if(Addr >= (dSdramOperateHistoryContentBaseAddr + dSdramHistoryBytesLength) )
		SdAddr = Addr - dSdramHistoryBytesLength;
	else
		SdAddr = Addr;
	for(d=3; d<14; d++){
		EntryTmp.D32[d] = *(volatile unsigned int *)(SdAddr + d * 4); 
	}
	
	
	if(EntryTmp.fData.Body.Splite.mType == etOperate){
		switch(EntryTmp.fData.Body.Splite.Data0){
			case otMask:
				NeedDescp =1;
				break;
			case otUnMask:
				NeedDescp =1;
				break;
			case otCfgDevice:
				NeedDescp = 1;
				break;
			case otFireConfirm:
				NeedDescp = 1;
				break;
			case otFireRemoteConfirm:
				NeedDescp = 1;
				break;
			case otFaultConfirm:
				NeedDescp = 2;
				break;
			case otFaultRemoteConfirm:
				NeedDescp = 1;
				break;
			case otSetSmokeSensViaAddr:
				NeedDescp = 1;
				break;
			case otDescpModify:
				if(EntryTmp.fData.Body.Splite.P0 <= dPORT_MAX_COUNT){
					NeedDescp = 1;
				}else
				if(  (EntryTmp.fData.Body.Splite.P0 >= dADDR_DIRECTPAD_START) && (EntryTmp.fData.Body.Splite.P0 <= dADDR_DIRECTPAD_END) ){
					NeedDescp = 1;
				}
				break;
		}
	}

	if(NeedDescp){
		//Operate History
		for(d=7; d<15; d++){
			Text.D32[d] = *(volatile unsigned int *)(SdAddr + d * 4); 
		}
		Text.D32[15] =0;
	}else{
		Text.D32[7] = 0;
	}
}

TGuiMsgReturn TQueryMsgOperate::KeyIn(unsigned char aKey)
{
	int ind,i,aIndex;
	TGuiMsgReturn aMsg = guiMsgNone;
	//Up or Down One Index___________________
	
	if(  (IsInputTime == 0) && (IsGoPrint == 0) ){
		if(IsAllTime){
				if(aKey == VK_TAB){
					//Items.SelectedIndex = 0;
					//Lv.SelectedCol = 0;
					//Lv.TopIndex = 0;
					IsGoPrint = 1;
					DrawGoPrintOutLine();
					DrawPrintWhat();
					ShowTip();
				}else
				if(VK_LEFT == aKey){
					aIndex = TopIndex -ListLineCnt;
					if(aIndex > -1){
						TopIndex = aIndex;
						SelectedIndex -= ListLineCnt;
					}else{
						if(TopIndex > 0){
							TopIndex = 0;
							SelectedIndex = TopIndex;
						}else{
							TopIndex = Count - ListLineCnt;
							if(TopIndex < 0)TopIndex = 0;
							SelectedIndex =TopIndex;
						}
					}
					ReDraw();
				}else
				if(VK_RIGHT == aKey){
					aIndex = TopIndex +ListLineCnt;
					if(aIndex < Count){
						TopIndex = aIndex;
						SelectedIndex += ListLineCnt;
						if(SelectedIndex >= Count){
							SelectedIndex = Count-1;
						}
					}else{
						TopIndex = 0;
						SelectedIndex = TopIndex;
					}
					ReDraw();
				}else
				if(VK_UP == aKey){
					aIndex = SelectedIndex -1;
					if(aIndex > -1){
						SelectedIndex = aIndex;
						if(SelectedIndex < TopIndex){
							TopIndex = SelectedIndex;
						}
						ReDraw();
					}
				}else
				if(VK_DOWN == aKey){
					aIndex = SelectedIndex +1;
					if(aIndex < Count){
						SelectedIndex = aIndex;
						if(SelectedIndex > (TopIndex + ListLineCnt -1) ){
							TopIndex++;
						}
						ReDraw();
					}
				}else
				if(aKey == VK_F1 ){
					//Setup Device Property
					IsInputTime = 1;
					IsAllTimeTemp = IsAllTime;
					DrawBoxTimeOutLine();
					DrawBoxTimeString();
					DrawIfAllTime();
					DrawTimeEntry();
					ShowTip();
				}else
				if(aKey == VK_F2){
					//Query Device Property

				}else
				if(aKey == VK_RETURN){
					aMsg = guiMsgReturn;
				}
		}else{
				if(aKey == VK_TAB){
					//Items.SelectedIndex = 0;
					//Lv.SelectedCol = 0;
					//Lv.TopIndex = 0;
					IsGoPrint = 1;
					DrawGoPrintOutLine();
					DrawPrintWhat();
					ShowTip();
				}else
				if(VK_LEFT == aKey){
					aIndex = InTimeTopIndex -ListLineCnt;
					if(aIndex >= InTimeStartIndex){
						InTimeTopIndex = aIndex;
						InTimeSelectedIndex -= ListLineCnt;
					}else{
						if(InTimeTopIndex > InTimeStartIndex){
							InTimeTopIndex = InTimeStartIndex;
							InTimeSelectedIndex = InTimeStartIndex;
						}else{
							InTimeTopIndex = InTimeStopIndex - ListLineCnt;
							if(InTimeTopIndex < InTimeStartIndex)InTimeTopIndex = InTimeStartIndex;
							InTimeSelectedIndex = InTimeTopIndex;
						}
					}
					ReDraw();
				}else
				if(VK_RIGHT == aKey){
					aIndex = InTimeTopIndex +ListLineCnt;
					if(aIndex <= InTimeStopIndex){
						InTimeTopIndex = aIndex;
						InTimeSelectedIndex += ListLineCnt;
						if(InTimeSelectedIndex > InTimeStopIndex){
							InTimeSelectedIndex = InTimeStopIndex;
						}
					}else{
						InTimeTopIndex = InTimeStartIndex;
						InTimeSelectedIndex = InTimeStartIndex;
					}
					ReDraw();
				}else
				if(VK_UP == aKey){
					aIndex = InTimeSelectedIndex -1;
					if(aIndex >= InTimeStartIndex){
						InTimeSelectedIndex = aIndex;
						if(InTimeSelectedIndex < InTimeTopIndex){
							InTimeTopIndex = InTimeSelectedIndex;
						}
						ReDraw();
					}
				}else
				if(VK_DOWN == aKey){
					aIndex = InTimeSelectedIndex +1;
					if(aIndex <= InTimeStopIndex){
						InTimeSelectedIndex = aIndex;
						if(InTimeSelectedIndex > (InTimeTopIndex + ListLineCnt -1) ){
							InTimeTopIndex++;
						}
						ReDraw();
					}
				}else
				if(aKey == VK_F1 ){
					//Setup Device Property
					IsInputTime = 1;
					IsAllTimeTemp = IsAllTime;
					DrawBoxTimeOutLine();
					DrawBoxTimeString();
					DrawIfAllTime();
					DrawTimeEntry();
					ShowTip();
				}else
				if(aKey == VK_F2){
					//Query Device Property

				}else
				if(aKey == VK_RETURN){
					aMsg = guiMsgReturn;
				}
		}
	}
	
	if(IsInputTime){
		if(aKey == VK_UP){
			if(TimeEditFrom >0){
				RestoreFromEdit();
				TimeEditFrom =0;
				SetEditStart();
			}else{
				if(TimeEditFrom > -1){
					RestoreFromEdit();
					TimeEditFrom = -1;
					DrawIfAllTime();
				}
			}
		}else
		if(aKey == VK_DOWN){
			if(TimeEditFrom <1){
				if(IsAllTimeTemp == 0){
					if(TimeEditFrom == 0)RestoreFromEdit();
					TimeEditFrom ++;
					SetEditStart();
					DrawIfAllTime();
				}
			}
		}else
		if(aKey == VK_LEFT){
			if(TimeEditFrom > -1){
				if(TimeIndex >0){
					RestoreFromEdit();
					TimeIndex--;
					SetEditStart();
				}
			}else{
				if(IsAllTimeTemp){
					IsAllTimeTemp = 0;
				}else{
					IsAllTimeTemp = 1;
				}
				DrawBoxTimeString();
				DrawIfAllTime();
				DrawTimeEntry();
			}
		}else
		if(aKey == VK_RIGHT){
			if(TimeEditFrom > -1){
				if(TimeIndex <5){
					RestoreFromEdit();
					TimeIndex++;
					SetEditStart();
				}
			}else{
				if(IsAllTimeTemp){
					IsAllTimeTemp = 0;
				}else{
					IsAllTimeTemp = 1;
				}
				DrawBoxTimeString();
				DrawIfAllTime();
				DrawTimeEntry();
			}
		}else
		if(aKey == VK_EXECUTE){
			//Read Here
			if(IsAllTimeTemp){
				IsAllTime = IsAllTimeTemp;
				DrawItemCount(Count);
				ReDraw();
			}else{
				IsAllTime = IsAllTimeTemp;
				GetStartStopTime();
				FindInTimeEntry();
				DrawItemCount(InTimeCount);
				IsInputTime = 0;
				RenderContent();
				ReDraw();
			}
			ShowTip();
		}else
		if(aKey == VK_RETURN){
			IsInputTime = 0;
			RenderContent();
			ReDraw();
			ShowTip();			
		}else{
			if(IsAllTimeTemp == 0){
				if(IsEditing){
					switch(aKey){
						case '0':
						case '1':
						case '2':
						case '3':
						case '4':
						case '5':
						case '6':
						case '7':
						case '8':
						case '9':
						case VK_DELETE:
							vEdit.KeyIn(aKey);
							vEdit.Show();
							vEdit.ShowCursor(clNearWhite);
						break;
					}
				}
			}
		}
	}
	
	if(IsGoPrint){
		if(aKey == VK_LEFT){
			if(PrintWhat ==0)PrintWhat=1;
			else PrintWhat = 0;
			DrawPrintWhat();
		}else
		if(aKey == VK_RIGHT){
			if(PrintWhat ==0)PrintWhat=1;
			else PrintWhat = 0;
			DrawPrintWhat();
		}else
		if(aKey == VK_EXECUTE){
			//Print Here
			if(Count){
				if(SelectedIndex < Count){
					GetEntry4Print(SelectedIndex);
					RecordMsg.D32[0] = EntryTmp.fData.Body.D32[0];
					RecordMsg.D32[1] = EntryTmp.fData.Body.D32[1];
					RecordMsg.D32[2] = EntryTmp.fData.Body.D32[2];
					RecordMsg.D32[3] = EntryTmp.fData.Body.D32[3];
					RecordMsg.Splite.UserCode = EntryTmp.fData.UserCode;
					DoPrint.PrintHistory(4,RecordMsg, &Text.Text[28]);
				}
			}
			IsGoPrint = 0;
			RenderContent();
			ReDraw();
			ShowTip();
		}else
		if(aKey == VK_RETURN){
			IsGoPrint = 0;
			RenderContent();
			ReDraw();
			ShowTip();
		}
	}
	//____________________________________________________________________<- List View
	
	return aMsg;
}

void TQueryMsgOperate::Task1000Ms()
{
	if(IsShowing){
		if(Count != Record.Buf4Operate.Count){
			TopIndex = Count - ListLineCnt +1;
			if(TopIndex < 0)TopIndex = 0;
			SelectedIndex =TopIndex;
		}
	}
}

int TQueryMsgOperate::ExtRequst(unsigned char Prm)
{
	IsShowing = 0;
	return 0;
}
