Files
FireAlarmCtrlCn/MyCode/Gui/QueryMsgFault.cpp
2026-04-06 19:02:09 +08:00

1545 lines
41 KiB
C++

#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 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 TQueryMsgFault::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 TQueryMsgFault::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 TQueryMsgFault::SetListColWidth(int w0, int w1, int w2, int w3, int w4,int w5,int w6, int w7, int w8)
{
}
void TQueryMsgFault::RenderBackGround(void)
{
RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color);
}
void TQueryMsgFault::RenderBackGround(unsigned int aClr)
{
RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, aClr);
}
void TQueryMsgFault::RenderContent(void)
{
#define FixColColor clMedGray
#define OddColor clNearMoneyGreen
RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color);
}
void TQueryMsgFault::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 TQueryMsgFault::DrawCaption(void)
{
if(LanguageEnCn==0)TMyString::sFromStr("历史记录->查询故障信息", Caption.Text);
else TMyString::sFromStr("Recorded Info->Query Fault", Caption.Text);
Caption.Show();
DrawCaption2();
}
void TQueryMsgFault::DrawCaption2(void)
{
}
void TQueryMsgFault::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 TQueryMsgFault::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 TQueryMsgFault::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,Key OK:Query ");
}
void TQueryMsgFault::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 TQueryMsgFault::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 TQueryMsgFault::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 TQueryMsgFault::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 TQueryMsgFault::DrawBoxTime(void)
{
DrawBoxTimeOutLine();
DrawBoxTimeString();
DrawIfAllTime();
DrawTimeEntry();
}
void TQueryMsgFault::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 TQueryMsgFault::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 TQueryMsgFault::Show(void)
{
DrawSelf();
Caption.Enable = 1;
DrawCaption();
if(IsInputTime){
DrawBoxTime();
}else{
if(IsAllTime){
DrawListAll();
}else{
DrawListInTime();
}
}
DrawItemCount(Count);
ShowTip();
}
void TQueryMsgFault::ReDraw(void)
{
Caption.Enable = 1;
//DrawCaption();
if(IsInputTime){
DrawBoxTime();
}else{
if(IsAllTime){
DrawListAll();
}else{
DrawListInTime();
}
}
}
void TQueryMsgFault::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 TQueryMsgFault::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 TQueryMsgFault::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 TQueryMsgFault::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;
}
int TQueryMsgFault::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;
NeedDisplayDescp = 0;
TMyString::sClear(DescpText.Text);
if(LanguageEnCn==0)TMyString::sFromStr("故障 ", DescpText.Text);
else TMyString::sFromStr("FLT. ", DescpText.Text);
//Fault History
Addr = Record.Buf4Fault.SdramAddrStart + aInx * 64;
if(Addr >= (dSdramFaultHistoryContentBaseAddr + 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] = '-';
Text.Text[31] = '\0';
if( (EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0xC0){
Text.Text[27] = ' ';
Text.Text[28] = '\0';
if( (EntryTmp.fData.Body.Splite.P1 >= dADDR_HANDPAD_START) && (EntryTmp.fData.Body.Splite.P1 <= dADDR_HANDPAD_END) ){
if(LanguageEnCn==0)TMyString::sAddOnStr("总线盘 ",Text.Text);
else TMyString::sAddOnStr("BusPad Brd ",Text.Text);
TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1 -dADDR_HANDPAD_START +1,Text.Text);
if(LanguageEnCn==0){
if(EntryTmp.fData.Body.Splite.Data1 & 0x01)TMyString::sAddOnStr(" 离线",Text.Text);
else TMyString::sAddOnStr(" 恢复",Text.Text);
}else{
if(EntryTmp.fData.Body.Splite.Data1 & 0x01)TMyString::sAddOnStr(" OffLine",Text.Text);
else TMyString::sAddOnStr(" Recover",Text.Text);
}
}
if( (EntryTmp.fData.Body.Splite.P1 >= dADDR_DIRECTPAD_START) && (EntryTmp.fData.Body.Splite.P1 <= dADDR_DIRECTPAD_END) ){
if(LanguageEnCn==0)TMyString::sAddOnStr("多线盘 ",Text.Text);
else TMyString::sAddOnStr("DirectCtrl Brd ",Text.Text);
TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1 -dADDR_DIRECTPAD_START +1,Text.Text);
if(LanguageEnCn==0){
if(EntryTmp.fData.Body.Splite.Data1 & 0x01)TMyString::sAddOnStr(" 离线",Text.Text);
else TMyString::sAddOnStr(" 恢复",Text.Text);
}else{
if(EntryTmp.fData.Body.Splite.Data1 & 0x01)TMyString::sAddOnStr(" OffLine",Text.Text);
else TMyString::sAddOnStr(" Recover",Text.Text);
}
}
}else
if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0xD0){
Text.Text[27] = ' ';
Text.Text[28] = '\0';
if(LanguageEnCn==0)TMyString::sAddOnStr("设备故障 ",Text.Text);
else TMyString::sAddOnStr("DevFault ",Text.Text);
aType = EntryTmp.fData.Body.Splite.Data0;
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",Text.Text);
}
}
if( (EntryTmp.fData.Body.Splite.Data1 & 0x01) == 0){
TMyString::sAddOnStr(" ",Text.Text);
if( (aType == 15) || (aType == 16) ){
Text.Text[28] = '\0';
if(LanguageEnCn==0){
TMyString::sAddOnStr(StrDevFaultType[aType],Text.Text);
TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
TMyString::sAddOnStr(" 通讯故障",Text.Text);
}else{
TMyString::sAddOnStr(StrDevFaultTypeEn[aType],Text.Text);
TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
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( (aType == 19) || (aType == 20) || (aType == 21) || (aType == 23) ){
TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
}
if(LanguageEnCn==0)TMyString::sAddOnStr(" 恢复",Text.Text);
else TMyString::sAddOnStr(" Recovered",Text.Text);
}else{
TMyString::sAddOnStr(" ",Text.Text);
if( (aType == 15) || (aType == 16) ){
Text.Text[28] = '\0';
if(LanguageEnCn==0){
TMyString::sAddOnStr(StrDevFaultType[aType],Text.Text);
TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
TMyString::sAddOnStr(" 通讯故障",Text.Text);
}else{
TMyString::sAddOnStr(StrDevFaultTypeEn[aType],Text.Text);
TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
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( (aType == 19) || (aType == 20) || (aType == 21) || (aType == 23)|| (aType == 26)|| (aType == 27)){
TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1, Text.Text);
}
}
}else
if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0xE0){
//Cir Error
if(LanguageEnCn==0){
if( (EntryTmp.fData.Body.Splite.Data1 & 0x01) == 0){
TMyString::sAddOnStr("回路故障-恢复",Text.Text);
}else{
//TMyString::sAddOnStr("回路故障-发生",Text.Text);
TMyString::sAddOnStr("回路故障",Text.Text);
}
}else{
if( (EntryTmp.fData.Body.Splite.Data1 & 0x01) == 0){
TMyString::sAddOnStr("LoopFault-Recovered",Text.Text);
}else{
//TMyString::sAddOnStr("回路故障-发生",Text.Text);
TMyString::sAddOnStr("LoopFault",Text.Text);
}
}
}else
if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0xF0){
//Board Error
Text.Text[27] = ' ';
Text.Text[28] = '\0';
if(LanguageEnCn==0)TMyString::sAddOnStr("板卡故障 ",Text.Text);
else TMyString::sAddOnStr("BoardErr ",Text.Text);
aType = EntryTmp.fData.Body.Splite.Data0;
if( (aType == TBoardFaultType::LoopMotherBoard) ||
(aType == TBoardFaultType::RegisteredData) ||
(aType == TBoardFaultType::MaskedData) ||
(aType == TBoardFaultType::StorageEpDType) ||
(aType == TBoardFaultType::StorageEpAuxId) ||
(aType == TBoardFaultType::StorageEpArea) ||
(aType == TBoardFaultType::StorageEpAssignedType) ||
(aType == TBoardFaultType::StorageEpSignalType) ||
(aType == TBoardFaultType::StorageDirectPadCfg) ||
(aType == TBoardFaultType::StoragePortDpSet) ||
(aType == TBoardFaultType::StorageBusPadCfg) ){
TMyString::sAddOn2Dg(EntryTmp.fData.Body.Splite.P1,Text.Text);
TMyString::sAddOnStr(" ",Text.Text);
}else
if( (aType == TBoardFaultType::StorageLinkExpressionPart1) ||
(aType == TBoardFaultType::StorageLinkExpressionPart2) ||
(aType == TBoardFaultType::StorageLinkExpressionPart3) ||
(aType == TBoardFaultType::StorageLinkExpressionPart4) ||
(aType == TBoardFaultType::StorageLinkExpressionPart5) ||
(aType == TBoardFaultType::StorageLinkExpressionPart6) ||
(aType == TBoardFaultType::StorageLinkExpressionPart7) ||
(aType == TBoardFaultType::StorageLinkExpressionPart8) ||
(aType == TBoardFaultType::StorageLinkExpressionPart9) ){
unsigned short tInx = aType - static_cast<unsigned char>(TBoardFaultType::StorageLinkExpressionPart1);
tInx = tInx * 256 + EntryTmp.fData.Body.Splite.P1;
TMyString::sAddOn4Dg(tInx % 10000,Text.Text);
TMyString::sAddOnStr(" ",Text.Text);
}
if(aType < TBoardFaultType::MaxValue){
if(LanguageEnCn==0)TMyString::sAddOnStr(StrBrdFaultType[aType],Text.Text);
else TMyString::sAddOnStr(StrBrdFaultTypeEn[aType],Text.Text);
}else{
if(LanguageEnCn==0)TMyString::sAddOnStr("未知类型",Text.Text);
else TMyString::sAddOnStr("Unknown ",Text.Text);
}
if( (EntryTmp.fData.Body.Splite.Data1 & 0x01) == 0){
if(LanguageEnCn==0)TMyString::sAddOnStr(" 恢复",Text.Text);
else TMyString::sAddOnStr(" Recovered",Text.Text);
}else{
//TMyString::sAddOnStr(" 发生",Text.Text);
}
}else{
//EpError
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] = ' ';
aP0 = EntryTmp.fData.Body.Splite.P0;
aP1 = EntryTmp.fData.Body.Splite.P1;
data = EntryTmp.fData.UserCode;
d = data/1000'0000;
e = d % 10;
Text.Text[35] = e + '0';
d = data/100'0000;
e = d % 10;
Text.Text[36] = e + '0';
d = data/10'0000;
e = d % 10;
Text.Text[37] = e + '0';
d = data/10000;
e = d % 10;
Text.Text[38] = e + '0';
d = data/1000;
e = d % 10;
Text.Text[39] = e + '0';
d = data/100;
e = d % 10;
Text.Text[40] = e + '0';
d = data/10;
e = d % 10;
Text.Text[41] = e + '0';
e = data % 10;
Text.Text[42] = e + '0';
Text.Text[43] = ' ';
Text.Text[44] = 0;
aType = EntryTmp.fData.Body.Splite.Data0;
if(LanguageEnCn==0){
if(aType < 16){
TMyString::sAddOnStr(StrEpFaultType[aType],Text.Text);
}else{
TMyString::sAddOnStr("未知故障",Text.Text);
}
if(EntryTmp.fData.Body.Splite.Data1 == 0){
TMyString::sAddOnStr("-恢复",Text.Text);
}else{
//TMyString::sAddOnStr("-发生",Text.Text);
}
}else{
if(aType < 16){
TMyString::sAddOnStr(StrEpFaultTypeEn[aType],Text.Text);
}else{
TMyString::sAddOnStr("Unknown",Text.Text);
}
if(EntryTmp.fData.Body.Splite.Data1 == 0){
TMyString::sAddOnStr("-Recovered",Text.Text);
}else{
//TMyString::sAddOnStr("-发生",Text.Text);
}
}
NeedDisplayDescp = 1;
if(LanguageEnCn==0){
if( (aP0 >0) && (aP0 <=40) ){
aType = EntryTmp.fData.Body.Splite.dType;
TMyString::sAddOnStr(StrTypeShortName[aType],DescpText.Text);
}else
if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <=dADDR_DIRECTPAD_START) ){
TMyString::sAddOnStr("多线盘节点 ",DescpText.Text);
}
}else{
if( (aP0 >0) && (aP0 <=40) ){
aType = EntryTmp.fData.Body.Splite.dType;
TMyString::sAddOnStr(StrTypeShortNameEn[aType],DescpText.Text);
}else
if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <=dADDR_DIRECTPAD_START) ){
TMyString::sAddOnStr("Pad Of DirectCtrl ",DescpText.Text);
}
}
}
return NeedDisplayDescp;
}
void TQueryMsgFault::FillDescpText(int aInx)
{
volatile unsigned int SdAddr, Addr;
unsigned int d,e;
unsigned int data;
unsigned char aP0;
unsigned char aP1;
unsigned char aType;
if(NeedDisplayDescp){
//Fault History
TMyString::sFillFixLen(DescpText.Text, 34);
Addr = Record.Buf4Fault.SdramAddrStart + aInx * 64;
if(Addr >= (dSdramFaultHistoryContentBaseAddr + dSdramHistoryBytesLength) )
SdAddr = Addr - dSdramHistoryBytesLength;
else
SdAddr = Addr;
for(d=7; d<15; d++){
DescpText.D32[d] = *(volatile unsigned int *)(SdAddr + d * 4);
}
TMyString::sFillFixLen(DescpText.Text, dLineMaxLen);
}else{
TMyString::sFillFixLen(DescpText.Text, dLineMaxLen);
}
}
void TQueryMsgFault::FillDescpTextEmpty()
{
TMyString::sFillFixLen(DescpText.Text, dLineMaxLen);
}
void TQueryMsgFault::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++){
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);
aTopInx = i*2;
RectFillRender(MsgX0, stAllTop[aTopInx] + 24, MsgX0 + 767, stAllTop[aTopInx +1]-6-1, bClr);
TextRender_string24(MsgX0, stAllTop[aTopInx +0], TextClr, bClr, Text.Text);
if(NeedDisplayDescp)FillDescpText(aInx);
else FillDescpTextEmpty();
TextRender_string24(MsgX0, stAllTop[aTopInx +1]-6, TextClr, bClr, DescpText.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 TQueryMsgFault::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);
if(NeedDisplayDescp)FillDescpText(i);
else FillDescpTextEmpty();
TextRender_string24(MsgX0, stAllTop[aTopInx +1]-6, TextClr, bClr, DescpText.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(MsgX0, 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 TQueryMsgFault::LoadData()
{
Count = Record.Buf4Fault.Count;
TopIndex = Count - ListLineCnt;
if(TopIndex < 0)TopIndex = 0;
if(Count >0){
SelectedIndex = Count -1;
}else{
SelectedIndex = TopIndex;
}
}
unsigned long long TQueryMsgFault::aTimeGet(int aInx)
{
volatile unsigned int SdAddr, Addr;
//Fault History
Addr = Record.Buf4Fault.SdramAddrStart + aInx * 64;
if(Addr >= (dSdramFaultHistoryContentBaseAddr + 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 TQueryMsgFault::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 TQueryMsgFault::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 TQueryMsgFault::GetEntry4Print(int aInx)
{
volatile unsigned int SdAddr, Addr;
unsigned int d,e;
unsigned int data;
unsigned char aP0;
unsigned char aP1;
unsigned char NeedDescp;
NeedDescp = 0;
//Fault History
Addr = Record.Buf4Fault.SdramAddrStart + aInx * 64;
if(Addr >= (dSdramFaultHistoryContentBaseAddr + 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.Data1 & 0xF0) == 0xC0){
}else
if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0xD0){
}else
if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0xE0){
}else
if((EntryTmp.fData.Body.Splite.Data1 & 0xF0) == 0xF0){
}else{
NeedDisplayDescp = 1;
}
if(NeedDescp){
//Fault History
for(d=7; d<15; d++){
DescpText.D32[d] = *(volatile unsigned int *)(SdAddr + d * 4);
}
TMyString::sFillFixLen(DescpText.Text, dLineMaxLen);
}else{
DescpText.D32[7] =0;
}
}
TGuiMsgReturn TQueryMsgFault::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(3,RecordMsg, &DescpText.Text[28]);
}
}
IsGoPrint = 0;
RenderContent();
ReDraw();
ShowTip();
}else
if(aKey == VK_RETURN){
IsGoPrint = 0;
RenderContent();
ReDraw();
ShowTip();
}
}
//____________________________________________________________________<- List View
return aMsg;
}
void TQueryMsgFault::Task1000Ms()
{
if(IsShowing){
if(Count != Record.Buf4Fault.Count){
TopIndex = Count - ListLineCnt +1;
if(TopIndex < 0)TopIndex = 0;
SelectedIndex =TopIndex;
}
}
}
int TQueryMsgFault::ExtRequst(unsigned char Prm)
{
IsShowing = 0;
return 0;
}