#include "LiteIconOverView.h" #include "gType.h" #include "GraphLow.h" #include "GraphBase.h" #include "GlobalString.h" #include "MainCtl.h" #include "RuntimeData.h" #include "Runtime.h" #include "Gui.h" #define Hcnt0 10 #define Vcnt0 7 #define Hcnt1 20 #define Vcnt1 13 #define dfColor_Normal clMedGreen #define dfColor_Fire clRed #define dfColor_Fault clMedOrange #define dfColor_Start clDeepBlue #define dfColor_Fb clTeal #define dfColor_StartFb clAqua #define dfColor_Mask clNearBlack #define dfLine1_Top 100 #define dfLine2_Top 299 #define dfLine3_Top 349 static const short svGridX[10] = {40, 116, 192, 268, 344, 420, 496, 572, 648, 724}; static const short svGridY[6] = {105, 155, 205, 255, 305, 355}; static const short svGridX2[10] = {100, 176, 252, 328, 404, 480, 556, 632, 708, 784}; static const short svGridY2[6] = {145, 195, 245, 295, 345, 395}; static const short svGrid1X[20] = { 13, 52, 91, 130, 169, 208, 247, 286, 325, 364, 403, 442, 481, 520, 559, 598, 637, 676, 715, 754 }; static const short svGrid1X2[20] = { 48, 87, 126, 165, 204, 243, 282, 321, 360, 399, 438, 477, 516, 555, 594, 633, 672, 711, 750, 789 }; void TLiteIconOverView::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); Color = aColor; #undef CH View1.ItemsCount =0; View1.SelectedIndex =0; ViewPath = 0; Caption.Border.Color = clGray; cx =0; cy =0; RootCircuitCount = 0; } void TLiteIconOverView::SetIconPosition(void) { unsigned int i, aLeft, aTop; aLeft = Content.Left + 10; aTop = Content.Top + 32; aLeft = Content.Left + 10; aTop = Content.Top + 34; //for(i=0; i设备状态概览 ", Caption.Text); else TMyString::sFromStr(" Loop->Dev Status Overview ", Caption.Text); Caption.Show(); } void TLiteIconOverView::DrawStateIdf_0(void) { //正常 离线 报警 故障 屏蔽 重码 污染 输入开 输出开 #define GS 24 #define TS 60 unsigned int aLeft, aTop, aTopR; aLeft = Content.Left + 170; aTop = Content.Top +4; aTopR = Content.Top +6; if(LanguageEnCn==0){ TMyString::sFromStr(" 主机挂载回路 ", Text); TMyString::sAddOn2Dg(RootCircuitCount, Text); TextRender_string24(Content.Left + 6,120,clNearBlack, "回"); TextRender_string24(Content.Left + 6,150,clNearBlack, "路"); }else{ TMyString::sFromStr(" Mounted Loop(s) ", Text); TMyString::sAddOn2Dg(RootCircuitCount, Text); TextRender_string24(Content.Left + 6,aTop,clNearBlack, "Loop"); } TextRender_string24(Caption.Bound.Left + 400,Caption.Bound.Top+4,clNearWhite, Text); RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, dfColor_Normal); aLeft += GS; if(LanguageEnCn==0){ TextRender_string24(aLeft,aTop,clNearBlack, "正常"); }else{ TextRender_string24(aLeft,aTop,clNearBlack, "IDLE"); } aLeft += TS; RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, dfColor_Fire); aLeft += GS; if(LanguageEnCn==0){ TextRender_string24(aLeft,aTop,clNearBlack, "报警"); }else{ TextRender_string24(aLeft,aTop,clNearBlack, "FIRE"); } aLeft += TS; RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, dfColor_Fault); aLeft += GS; if(LanguageEnCn==0){ TextRender_string24(aLeft,aTop,clNearBlack, "故障"); }else{ TextRender_string24(aLeft,aTop,clNearBlack, "Fault"); aLeft+=12; } aLeft += TS; RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, dfColor_Start); aLeft += GS; if(LanguageEnCn==0){ TextRender_string24(aLeft,aTop,clNearBlack, "启动"); }else{ TextRender_string24(aLeft,aTop,clNearBlack, "Actived"); } aLeft += (TS + 40); if(LanguageEnCn==0){ TextRender_string24(aLeft,aTop,clNearBlack, "(子部件状态)"); }else{ //Sub component status TextRender_string24(aLeft,aTop,clNearBlack, "(Component Status)"); } //TextRender_string24(Content.Left + 6,svGridY[4] + 10,clNearBlack, "总线盘"); //TextRender_string24(Content.Left + 6,svGridY[5] + 10,clNearBlack, "多线盘"); #undef GS #undef TS } void TLiteIconOverView::DrawStateIdf_1(void) { //正常 离线 报警 故障 屏蔽 重码 污染 输入开 输出开 #define GS 24 #define TS 60 unsigned int aLeft, aTop, aTopR; aLeft = Content.Left +90; aTop = Content.Top +4; aTopR = Content.Top +6; RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, dfColor_Normal); aLeft += GS; if(LanguageEnCn==0){TextRender_string24(aLeft,aTop,clNearBlack, "正常");} else {TextRender_string24(aLeft,aTop,clNearBlack, "IDLE");} aLeft += TS; RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, dfColor_Fire); aLeft += GS; if(LanguageEnCn==0){TextRender_string24(aLeft,aTop,clNearBlack, "报警");} else {TextRender_string24(aLeft,aTop,clNearBlack, "Fire");} aLeft += TS; RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, dfColor_Fault); aLeft += GS; if(LanguageEnCn==0){TextRender_string24(aLeft,aTop,clNearBlack, "故障");} else {TextRender_string24(aLeft,aTop,clNearBlack, "Fault");aLeft += 12;} aLeft += TS; RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, dfColor_Start); aLeft += GS; if(LanguageEnCn==0){TextRender_string24(aLeft,aTop,clNearBlack, "启动");} else {TextRender_string24(aLeft,aTop,clNearBlack, "Act");} aLeft += TS; RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, dfColor_Fb); aLeft += GS; if(LanguageEnCn==0){TextRender_string24(aLeft,aTop,clNearBlack, "反馈");} else {TextRender_string24(aLeft,aTop,clNearBlack, "FB");} aLeft += TS; RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, dfColor_StartFb); aLeft += GS; if(LanguageEnCn==0){TextRender_string24(aLeft,aTop,clNearBlack, "启动+反馈");} else {TextRender_string24(aLeft,aTop,clNearBlack, "Act & FB");} aLeft += TS + 64; RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, dfColor_Mask); aLeft += GS; if(LanguageEnCn==0){TextRender_string24(aLeft,aTop,clNearBlack, "屏蔽");} else {TextRender_string24(aLeft,aTop,clNearBlack, "Blocking");} aLeft += TS; /* RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, clTeal); aLeft += GS; TextRender_string24(aLeft,aTop,clNearBlack, "输入开"); aLeft += TS + 24; RectFillRender( aLeft, aTopR, aLeft + 20, aTopR + 18, clOlive); aLeft += GS; TextRender_string24(aLeft,aTop,clNearBlack, "输出开"); aLeft += TS; */ #undef GS #undef TS LoadPath1(); } void TLiteIconOverView::DrawRootItemsCount() { TMyString::sFromStr(" 主机挂载", Caption.Text); TMyString::sAddOn2Dg(ItemsP0Count, Caption.Text); TMyString::sAddOnStr(" 回路", Caption.Text); TMyString::sAddOn2Dg(RootCircuitCount, Caption.Text); Caption.Show(); } void TLiteIconOverView::DrawSel() { int x,y, aV; int SelX, SelY; if(SelPath0 == 0)return; if(SelPath0 < 41){ aV = SelPath0 -1; SelX = aV % 10; SelY = aV / 10; }else if(SelPath0 < 49){ aV = SelPath0 -1; SelX = aV % 10 +2; SelY = 4; }else if(SelPath0 < 57){ aV = SelPath0 -1 +2; SelX = aV % 10 +2; SelY = 5; } for(y=0; y<4; y++){ for(x=0; x<10; x++){ if( (y == SelY) && (x == SelX) ){ RectRender(svGridX[x], svGridY[y], svGridX2[x], svGridY2[y], 4,clBlue); }else{ RectRender(svGridX[x], svGridY[y], svGridX2[x], svGridY2[y], 4,Color); } } } for(y=4; y<6; y++){ for(x=2; x<10; x++){ if( (y == SelY) && (x == SelX) ){ RectRender(svGridX[x], svGridY[y], svGridX2[x], svGridY2[y], 4,clBlue); }else{ RectRender(svGridX[x], svGridY[y], svGridX2[x], svGridY2[y], 4,Color); } } } } void TLiteIconOverView::DrawList(void) { int i,j; unsigned int idx, iz; unsigned int x,y, aP0; unsigned int aClr; unsigned char aState; if(1){ DrawCaption(); RectFillRender(Content.Left,Content.Top,Content.Right,Content.Bottom, Color); if(ViewPath == 0){ //if(View0.ItemsCount < 1)return; DrawStateIdf_0(); LineRender(10, dfLine1_Top, 788, dfLine1_Top, 1, clGray); LineRender(10, dfLine2_Top, 788, dfLine2_Top, 1, clGray); LineRender(10, dfLine3_Top, 788, dfLine3_Top, 1, clGray); for(i=0; i0){ aCy = cy-1; while(aCy > -1){ aCx = cx; while(aCx > -1){ if(ExistTab[aCy][aCx]){ cy = aCy; cx = aCx; Found = 1; CalcSelPath0(); break; } aCx--; } if(Found == 0){ aCx = cx; while(aCx <10){ if(ExistTab[aCy][aCx]){ cy = aCy; cx = aCx; Found = 1; CalcSelPath0(); break; } aCx++; } } if(Found)break; aCy--; } } if(Found){ DrawSel(); } } }else if(VK_DOWN == aKey){ if(ViewPath ==0){ if(cy<5){ aCy = cy+1; while(aCy <6){ aCx = cx; while(aCx > -1){ if(ExistTab[aCy][aCx]){ cy = aCy; cx = aCx; Found = 1; CalcSelPath0(); break; } aCx--; } if(Found == 0){ aCx = cx; while(aCx <10){ if(ExistTab[aCy][aCx]){ cy = aCy; cx = aCx; Found = 1; CalcSelPath0(); break; } aCx++; } } if(Found)break; aCy++; } } if(Found){ DrawSel(); } } }else if(VK_LEFT == aKey){ if(ViewPath ==0){ if(cx > -1){ aCy = cy; aCx = cx-1; while(aCx > -1){ if(ExistTab[aCy][aCx]){ cx = aCx; Found = 1; CalcSelPath0(); break; } aCx--; } } if(Found){ DrawSel(); } } }else if(VK_RIGHT == aKey){ if(ViewPath ==0){ if(cx < 10){ aCy = cy; aCx = cx+1; while(aCx < 10){ if(ExistTab[aCy][aCx]){ cx = aCx; Found = 1; CalcSelPath0(); break; } aCx++; } } if(Found){ DrawSel(); } } } } if(aKey == VK_EXECUTE){ //Open path Device if(ViewPath == 0){ ClearPath1(); ViewPath = 1; DrawList(); } }else if(aKey == VK_F2){ }else if(aKey == VK_RETURN){ if(ViewPath == 0){ ClearPath(); aMsg = guiMsgReturn; }else if(ViewPath == 1){ //ClearPath(); //LoadPath0(); ViewPath = 0; ReDraw(); }else if(ViewPath > 1){ ClearPath(); LoadPath0(); ViewPath = 0; ReDraw(); } } return aMsg; }