#include "gType.h" #include "GraphLow.h" #include "GraphBase.h" #include "GlobalString.h" #include "MainCtl.h" #include "RuntimeData.h" #include "Runtime.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 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 TQueryMessageFire::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 TQueryMessageFire::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 TQueryMessageFire::SetListColWidth(int w0, int w1, int w2, int w3, int w4,int w5,int w6, int w7, int w8) { } void TQueryMessageFire::RenderBackGround(void) { RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color); } void TQueryMessageFire::RenderBackGround(unsigned int aClr) { RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, aClr); } void TQueryMessageFire::RenderContent(void) { #define FixColColor clMedGray #define OddColor clNearMoneyGreen RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color); } void TQueryMessageFire::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 TQueryMessageFire::DrawCaption(void) { if(LanguageEnCn==0)TMyString::sFromStr("历史记录->查询火警信息", Caption.Text); else TMyString::sFromStr("Recorded Info->Query Fire Alarm", Caption.Text); Caption.Show(); DrawCaption2(); } void TQueryMessageFire::DrawCaption2(void) { } void TQueryMessageFire::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 TQueryMessageFire::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 TQueryMessageFire::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 TQueryMessageFire::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 TQueryMessageFire::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 TQueryMessageFire::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 TQueryMessageFire::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 TQueryMessageFire::DrawBoxTime(void) { DrawBoxTimeOutLine(); DrawBoxTimeString(); DrawIfAllTime(); DrawTimeEntry(); } void TQueryMessageFire::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 TQueryMessageFire::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 TQueryMessageFire::Show(void) { DrawSelf(); Caption.Enable = 1; DrawCaption(); if(IsInputTime){ DrawBoxTime(); }else{ if(IsAllTime){ DrawListAll(); }else{ DrawListInTime(); } } DrawItemCount(Count); ShowTip(); } void TQueryMessageFire::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 TQueryMessageFire::ReDraw(void) { Caption.Enable = 1; //DrawCaption(); if(IsInputTime){ DrawBoxTime(); }else{ if(IsAllTime){ DrawListAll(); }else{ DrawListInTime(); } } } void TQueryMessageFire::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 TQueryMessageFire::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 TQueryMessageFire::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 TQueryMessageFire::AddOnUserCode() { TMyString::sAddOn8Dg(EntryTmp.fData.UserCode, Text.Text); } int TQueryMessageFire::FillText(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; //Fire History NeedDisplayDescp = 0; Addr = Record.Buf4Fire.SdramAddrStart + aInx * 64; if(Addr >= (dSdramFireHistoryContentBaseAddr + 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] = ' '; CoverDateTimeIllegal(EntryTmp.fData.Body, &DateTimeCovered); Text.Text[7] = DateTimeCovered.Year / 16 % 10 + '0'; Text.Text[8] = DateTimeCovered.Year % 16 % 10 + '0'; Text.Text[9] = '/'; Text.Text[10] = DateTimeCovered.Month / 16 % 10 + '0'; Text.Text[11] = DateTimeCovered.Month % 16 % 10 + '0'; Text.Text[12] = '/'; Text.Text[13] = DateTimeCovered.Day / 16 % 10 + '0'; Text.Text[14] = DateTimeCovered.Day % 16 % 10 + '0'; Text.Text[15] = ' '; Text.Text[16] = DateTimeCovered.Hour / 16 % 10 + '0'; Text.Text[17] = DateTimeCovered.Hour % 16 % 10 + '0'; Text.Text[18] = ':'; Text.Text[19] = DateTimeCovered.Minute / 16 % 10 + '0'; Text.Text[20] = DateTimeCovered.Minute % 16 % 10 + '0'; Text.Text[21] = ':'; Text.Text[22] = DateTimeCovered.Second / 16 % 10 + '0'; Text.Text[23] = DateTimeCovered.Second % 16 % 10 + '0'; Text.Text[24] = ' '; data = EntryTmp.fData.Body.Splite.PCtlNum; 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.P0; d = data/10; e = d % 10; Text.Text[28] = e + '0'; e = data % 10; Text.Text[29] = e + '0'; Text.Text[30] = '-'; data = EntryTmp.fData.Body.Splite.P1; d = data/100; e = d % 10; Text.Text[31] = e + '0'; d = data/10; e = d % 10; Text.Text[32] = e + '0'; e = data % 10; Text.Text[33] = e + '0'; Text.Text[34] = ' '; Text.Text[35] = '\0'; aP0 = EntryTmp.fData.Body.Splite.P0; aP1 = EntryTmp.fData.Body.Splite.P1; AddOnUserCode(); TMyString::sAddOnStr(" ",Text.Text); if( (aP0) && (aP0<=dPORT_MAX_COUNT) ){ NeedDisplayDescp = 1; aType = EntryTmp.fData.Body.Splite.dType; if(LanguageEnCn==0)TMyString::sAddOnStr(StrTypeShortName[aType],Text.Text); else TMyString::sAddOnStr(StrTypeShortNameEn[aType],Text.Text); }else if( (aP0 >= dADDR_DIRECTPAD_START) && ( aP0 <= dADDR_DIRECTPAD_END)){ NeedDisplayDescp = 1; } if(EntryTmp.fData.Body.Splite.Data1){ IsFirst = 1; }else{ IsFirst = 0; } return NeedDisplayDescp; } void TQueryMessageFire::FillDescpText(int aInx) { volatile unsigned int SdAddr, Addr; unsigned int d,e; unsigned int data; unsigned char aP0; unsigned char aP1; unsigned char aType; Addr = Record.Buf4Fire.SdramAddrStart + aInx * 64; if(Addr >= (dSdramFireHistoryContentBaseAddr + dSdramHistoryBytesLength) ) SdAddr = Addr - dSdramHistoryBytesLength; else SdAddr = Addr; for(d=2; d<14; d++){ EntryTmp.D32[d] = *(volatile unsigned int *)(SdAddr + d * 4); } if(NeedDisplayDescp){ //Fire History if(EntryTmp.fData.Body.Splite.Data0 == TControlCenter::LinkInputTypeFireSimulate){ if(LanguageEnCn==0)TMyString::sFromStr("模拟",Text.Text); else TMyString::sFromStr(" SIM",Text.Text); }else{ Text.D32[0] = 0x20202020; } Text.D32[1] = 0x20202020; if(IsFirst){ Text.D32[2] = 0; if(LanguageEnCn==0)TMyString::sAddOnStr(" 首火警 ",Text.Text); else TMyString::sAddOnStr("Fire 1st",Text.Text); }else{ Text.D32[2] = 0x20202020; Text.D32[3] = 0x20202020; } Text.D32[4] = 0x20202020; Text.D32[5] = 0x20202020; Addr = Record.Buf4Fire.SdramAddrStart + aInx * 64; if(Addr >= (dSdramFireHistoryContentBaseAddr + dSdramHistoryBytesLength) ) SdAddr = Addr - dSdramHistoryBytesLength; else SdAddr = Addr; for(d=7; d<15; d++){ Text.D32[d-1] = *(volatile unsigned int *)(SdAddr + d * 4); } Text.D32[14] =0; TMyString::sFillFixLen(Text.Text, dLineMaxLen); }else{ if(EntryTmp.fData.Body.Splite.Data0 == TControlCenter::LinkInputTypeFireSimulate){ if(LanguageEnCn==0)TMyString::sFromStr("模拟",Text.Text); else TMyString::sFromStr(" SIM",Text.Text); }else{ Text.D32[0] = 0x20202020; } Text.D32[1] = 0x20202020; if(IsFirst){ Text.D32[2] = 0; if(LanguageEnCn==0)TMyString::sAddOnStr(" 首火警 ",Text.Text); else TMyString::sAddOnStr("Fire 1st",Text.Text); }else{ Text.D32[2] = 0x20202020; Text.D32[3] = 0x20202020; } Text.D32[4] = 0x20202020; Text.D32[5] = 0; TMyString::sFillFixLen(Text.Text, dLineMaxLen); } } void TQueryMessageFire::FillDescpTextEmpty() { Text.Text[0] = ' '; Text.Text[1] = '\0'; TMyString::sFillFixLen(Text.Text, dLineMaxLen); } void TQueryMessageFire::DrawListAll(void) { volatile unsigned int i, aLen; int aInx, aTopInx; volatile unsigned int TextClr, bClr, Wrote; int DrawDescp; aInx = TopIndex; Wrote = 0; for(i=0;i (Count-1))break; if(SelectedIndex != aInx){ bClr = Color; TextClr = clNearBlack; }else{ bClr = clBlue; TextClr = clNearWhite; } DrawDescp = 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); TextRender_string24(MsgX0, stAllTop[aTopInx +1]-6, TextClr, bClr, Text.Text); aInx++; Wrote++; } for(i=Wrote; i0){ i = InTimeTopIndex; for(;i<(InTimeStopIndex+1);i++){ if(InTimeSelectedIndex != (InTimeTopIndex + Wrote)){ bClr = Color; TextClr = clNearBlack; }else{ bClr = clBlue; TextClr = clNearWhite; } aInx = InTimeTopIndex - InTimeStartIndex + Wrote; 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); TextRender_string24(MsgX0, stAllTop[aTopInx +1]-6, TextClr, bClr, Text.Text); Wrote++; if(Wrote >= ListLineCnt){ break; } } } for(i=Wrote; i0){ SelectedIndex = Count -1; }else{ SelectedIndex = TopIndex; } } unsigned long long TQueryMessageFire::aTimeGet(int aInx) { volatile unsigned int SdAddr, Addr; //Fire History Addr = Record.Buf4Fire.SdramAddrStart + aInx * 64; if(Addr >= (dSdramFireHistoryContentBaseAddr + 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 TQueryMessageFire::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 TQueryMessageFire::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 TQueryMessageFire::GetEntry4Print(int aInx) { volatile unsigned int SdAddr, Addr; unsigned int d,e; unsigned int data; unsigned char aP0; unsigned char aP1; unsigned char NeedDescp; //Fire History NeedDescp = 0; Addr = Record.Buf4Fire.SdramAddrStart + aInx * 64; if(Addr >= (dSdramFireHistoryContentBaseAddr + dSdramHistoryBytesLength) ) SdAddr = Addr - dSdramHistoryBytesLength; else SdAddr = Addr; for(d=3; d<14; d++){ EntryTmp.D32[d] = *(volatile unsigned int *)(SdAddr + d * 4); } aP0 = EntryTmp.fData.Body.Splite.P0; aP1 = EntryTmp.fData.Body.Splite.P1; if( (aP0) && (aP0<=dPORT_MAX_COUNT) ){ NeedDescp = 1; }else if( (aP0 >= dADDR_DIRECTPAD_START) && ( aP0 <= dADDR_DIRECTPAD_END)){ NeedDescp = 1; } if(NeedDescp){ //Fire History for(d=7; d<15; d++){ Text.D32[d-1] = *(volatile unsigned int *)(SdAddr + d * 4); } Text.D32[14] =0; }else{ Text.D32[6] = 0; } } TGuiMsgReturn TQueryMessageFire::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(0, RecordMsg, &Text.Text[24]); } } IsGoPrint = 0; RenderContent(); ReDraw(); ShowTip(); }else if(aKey == VK_RETURN){ IsGoPrint = 0; RenderContent(); ReDraw(); ShowTip(); } } //____________________________________________________________________<- List View return aMsg; } void TQueryMessageFire::Task1000Ms() { if(IsShowing){ if(Count != Record.Buf4Fire.Count){ TopIndex = Count - ListLineCnt +1; if(TopIndex < 0)TopIndex = 0; SelectedIndex =TopIndex; } } } int TQueryMessageFire::ExtRequst(unsigned char Prm) { IsShowing = 0; return 0; }