Initial commit
This commit is contained in:
873
MyCode/Gui/LiteIconOverView.cpp
Normal file
873
MyCode/Gui/LiteIconOverView.cpp
Normal file
@@ -0,0 +1,873 @@
|
||||
#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<Hcnt1; i++){
|
||||
// View1.x1List[i] = aLeft + (39 * i) ;
|
||||
// View1.x2List[i] = aLeft + (39 * (i + 1) - 4) ;
|
||||
//}
|
||||
for(i=0; i<Vcnt1; i++){
|
||||
View1.y1List[i] = aTop + (25 * i) ;
|
||||
View1.y2List[i] = aTop + (25 * (i + 1) - 4) ;
|
||||
}
|
||||
}
|
||||
|
||||
void TLiteIconOverView::RenderBackGround(void)
|
||||
{
|
||||
RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color);
|
||||
}
|
||||
|
||||
void TLiteIconOverView::RenderBackGround(unsigned int aClr)
|
||||
{
|
||||
RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, aClr);
|
||||
}
|
||||
|
||||
void TLiteIconOverView::RenderContent(void)
|
||||
{
|
||||
#define FixColColor clMedGray
|
||||
#define OddColor clNearMoneyGreen
|
||||
unsigned int x,y, y2, clr;
|
||||
RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color);
|
||||
}
|
||||
|
||||
void TLiteIconOverView::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 TLiteIconOverView::DrawCaption(void)
|
||||
{
|
||||
if(LanguageEnCn==0)TMyString::sFromStr(" 回路->设备状态概览 ", 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; i<ItemsP0Count; i++){
|
||||
idx = ItemsP0[i].Path;
|
||||
aState = 0;
|
||||
if(idx){
|
||||
if(idx == 0)return;
|
||||
if(idx < 41){
|
||||
aP0 = idx-1;
|
||||
for(iz=0; iz<256; iz++){
|
||||
if(Port[aP0].StateTable[iz] & dEpStateBitFire){
|
||||
aState = dEpStateBitFire;
|
||||
aClr = dfColor_Fire;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(aState == 0){
|
||||
for(iz=0; iz<256; iz++){
|
||||
if(Port[aP0].StateTable[iz] & dEpStateBitFault){
|
||||
aState = dEpStateBitFault;
|
||||
aClr = dfColor_Fault;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(aState == 0){
|
||||
for(iz=0; iz<256; iz++){
|
||||
if(Port[aP0].StateTable[iz] & dEpStateBitStart){
|
||||
aState = dEpStateBitStart;
|
||||
aClr = dfColor_Start;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(aState == 0){
|
||||
aClr = dfColor_Normal;
|
||||
}
|
||||
x = (idx -1) % 10;
|
||||
y = (idx -1) / 10;
|
||||
}else
|
||||
if(idx < 49){
|
||||
x = (idx -1) % 10 +2;
|
||||
y = 4;
|
||||
idx = idx - 40;
|
||||
if(1){
|
||||
aClr = dfColor_Normal;
|
||||
}
|
||||
}else
|
||||
if(idx < 57){
|
||||
x = (idx -1 +2) % 10 +2;
|
||||
y = 5;
|
||||
idx = idx - 48;
|
||||
if(1){
|
||||
aClr = dfColor_Normal;
|
||||
}
|
||||
}
|
||||
|
||||
RectFillRender( svGridX[x] + 4, svGridY[y] + 4, svGridX2[x] - 4, svGridY2[y] - 4, aClr);
|
||||
TMyString::sClear(Text);
|
||||
TMyString::sAddOn2Dg(idx, Text);
|
||||
TextRender_string24(svGridX[x] + 5,svGridY[y] + 5, clNearWhite, Text);
|
||||
}
|
||||
}
|
||||
}else
|
||||
if(ViewPath == 1){
|
||||
//if(View1.ItemsCount < 1)return;
|
||||
DrawStateIdf_1();
|
||||
if(SelRootType == dgTYPE_PORT){
|
||||
for(i=0; i<dEP_MAX_COUNT_PER_PORT; i++){
|
||||
aP0 = SelPath0 - 1;
|
||||
if( Port[aP0].ExistTable[i] == 0xA5 ){
|
||||
if(Port[aP0].StateTable[i] & dEpStateBitFire){
|
||||
aClr = dfColor_Fire;
|
||||
}else
|
||||
if(Port[aP0].StateTable[i] & dEpStateBitFault){
|
||||
aClr = dfColor_Fault;
|
||||
}else
|
||||
if( (Port[aP0].StateTable[i] & dEpStateBitStart) && (Port[aP0].StateTable[i] & dEpStateBitFeedBack) ){
|
||||
aClr = dfColor_StartFb;
|
||||
}else
|
||||
if(Port[aP0].StateTable[i] & dEpStateBitStart){
|
||||
aClr = dfColor_Start;
|
||||
}else
|
||||
if(Port[aP0].StateTable[i] & dEpStateBitFeedBack){
|
||||
aClr = dfColor_Fb;
|
||||
}else
|
||||
if(Port[aP0].StateTable[i] & dEpStateBitMask){
|
||||
aClr = dfColor_Mask;
|
||||
}else{
|
||||
aClr = dfColor_Normal;
|
||||
}
|
||||
|
||||
x = i % 20;
|
||||
y = i /20;
|
||||
RectFillRender( svGrid1X[x], View1.y1List[y], svGrid1X2[x], View1.y2List[y], aClr);
|
||||
TMyString::sFrom3Dg(i+1, Text);
|
||||
lcd_draw_str_8x16( svGrid1X[x]+6, View1.y1List[y]+5, clNearWhite, Text);
|
||||
}
|
||||
}
|
||||
}else
|
||||
if(SelRootType == dgTYPE_HAND_CTL){
|
||||
aP0 = SelPath0 - 41;
|
||||
for(i=0; i< HandCtlBoard[aP0].fData.HandCtl.ResistedCount; i++){
|
||||
//aState = EpDev[aP0][i].DynamicsFlag;
|
||||
if(1){
|
||||
aClr = dfColor_Normal;
|
||||
}
|
||||
x = i % 20;
|
||||
y = i /20;
|
||||
RectFillRender( svGrid1X[x], View1.y1List[y], svGrid1X2[x], View1.y2List[y], aClr);
|
||||
TMyString::sFrom3Dg(i+1, Text);
|
||||
lcd_draw_str_8x16( svGrid1X[x]+6, View1.y1List[y]+5, clNearWhite, Text);
|
||||
}
|
||||
}else
|
||||
if(SelRootType == dgTYPE_DIRECT_CTL){
|
||||
aP0 = SelPath0 - 49;
|
||||
for(i=0; i< DirectCtlBoard[aP0].fData.DirectCtl.ResistedCount; i++){
|
||||
//aState = EpDev[aP0][i].DynamicsFlag;
|
||||
if(1){
|
||||
aClr = dfColor_Normal;
|
||||
}
|
||||
x = i % 20;
|
||||
y = i /20;
|
||||
RectFillRender( svGrid1X[x], View1.y1List[y], svGrid1X2[x], View1.y2List[y], aClr);
|
||||
TMyString::sFrom3Dg(i+1, Text);
|
||||
lcd_draw_str_8x16( svGrid1X[x], View1.y1List[y]+5, clNearWhite, Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TLiteIconOverView::Show(void)
|
||||
{
|
||||
DrawSelf();
|
||||
Caption.Enable = 1;
|
||||
DrawCaption();
|
||||
DrawList();
|
||||
FindNearP0();
|
||||
CalcSelPath0();
|
||||
DrawSel();
|
||||
}
|
||||
|
||||
void TLiteIconOverView::ReDraw(void)
|
||||
{
|
||||
Caption.Enable = 1;
|
||||
DrawCaption();
|
||||
DrawList();
|
||||
if(ViewPath ==0){
|
||||
//DrawRootItemsCount();
|
||||
DrawSel();
|
||||
}
|
||||
}
|
||||
|
||||
void TLiteIconOverView::FullRedraw(int Prm)
|
||||
{
|
||||
if(Prm == 0){
|
||||
DrawSelf();
|
||||
Caption.Enable = 1;
|
||||
DrawCaption();
|
||||
DrawList();
|
||||
if(ViewPath == 0)DrawSel();
|
||||
}else
|
||||
if(Prm == 1){
|
||||
RectFillRender(GuiRedrawDataList[1][0], GuiRedrawDataList[1][1], GuiRedrawDataList[1][2], GuiRedrawDataList[1][3], Color);
|
||||
Caption.Enable = 1;
|
||||
DrawCaption();
|
||||
DrawList();
|
||||
if(ViewPath == 0)DrawSel();
|
||||
}
|
||||
}
|
||||
|
||||
void TLiteIconOverView::ClearPath(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TLiteIconOverView::ClearPath1(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TLiteIconOverView::LoadPath0(void)
|
||||
{
|
||||
int i,x,y;
|
||||
unsigned int aIndex =0;
|
||||
unsigned char pCnt =0;
|
||||
unsigned char hCnt =0;
|
||||
unsigned char dCnt =0;
|
||||
for(i=0; i<10;i++){
|
||||
for(x=0; x<10; x++)
|
||||
ExistTab[i][x] = 0;
|
||||
}
|
||||
for(i=0; i<dPORT_MAX_COUNT; i++){
|
||||
if(MainCtl.fData.Split.ExistTablePort[i] == 0xA5){
|
||||
if(aIndex <128){
|
||||
ItemsP0[aIndex].iType = Port[i].fData.Common.dType;
|
||||
ItemsP0[aIndex].Path = i+1;
|
||||
aIndex++;
|
||||
pCnt++;
|
||||
}
|
||||
x = i % 10;
|
||||
y = i / 10;
|
||||
ExistTab[y][x] = 1;
|
||||
}
|
||||
}
|
||||
for(i=0; i<dHANDCTL_MAX_COUNT; i++){
|
||||
if(MainCtl.fData.Split.ExistTableHandCtl[i] == 0xA5){
|
||||
if(aIndex <128){
|
||||
ItemsP0[aIndex].iType = HandCtlBoard[i].fData.Common.dType;
|
||||
ItemsP0[aIndex].Path = i+41;
|
||||
aIndex++;
|
||||
hCnt++;
|
||||
}
|
||||
x = i % 10 + 2;
|
||||
y = i / 10 + 4;
|
||||
ExistTab[y][x] = 1;
|
||||
}
|
||||
}
|
||||
for(i=0; i<dDIRECTCTL_MAX_COUNT; i++){
|
||||
if(MainCtl.fData.Split.ExistTableDirectCtl[i] == 0xA5){
|
||||
if(aIndex <128){
|
||||
ItemsP0[aIndex].iType = DirectCtlBoard[i].fData.Common.dType;
|
||||
ItemsP0[aIndex].Path = i+49;
|
||||
aIndex++;
|
||||
dCnt++;
|
||||
}
|
||||
x = i % 10 + 2;
|
||||
y = i / 10 + 5;
|
||||
ExistTab[y][x] = 1;
|
||||
}
|
||||
}
|
||||
for(i=0; i<dCOMMBOARD_MAX_COUNT; i++){
|
||||
if(MainCtl.fData.Split.ExistTableCommBrd[i] == 0xA5){
|
||||
if(aIndex <128){
|
||||
ItemsP0[aIndex].iType = CommBoard[i].fData.Common.dType;
|
||||
aIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ItemsP0Count = aIndex;
|
||||
RootCircuitCount = pCnt;
|
||||
}
|
||||
|
||||
void TLiteIconOverView::LoadPath1(void)
|
||||
{
|
||||
unsigned int i, px, aRegCnt;
|
||||
unsigned char aType, aPst;
|
||||
unsigned char aCnt;
|
||||
|
||||
if(SelPath0 == 0)return;
|
||||
if(SelPath0 < 41){
|
||||
aPst = SelPath0 -1;
|
||||
aType = dgTYPE_PORT;
|
||||
}else
|
||||
if(SelPath0 < 49){
|
||||
aPst = SelPath0 -41;
|
||||
aType = dgTYPE_HAND_CTL;
|
||||
}else
|
||||
if(SelPath0 < 57){
|
||||
aPst = SelPath0 -49;
|
||||
aType = dgTYPE_DIRECT_CTL;
|
||||
}
|
||||
|
||||
switch(aType){
|
||||
case dgTYPE_PORT:
|
||||
aRegCnt = 0;
|
||||
if(MainCtl.fData.Split.ExistTablePort[aPst] == 0xA5){
|
||||
for(i=0; i< dEP_MAX_COUNT_PER_PORT; i++){
|
||||
if(Port[aPst].ExistTable[i] == 0xA5){
|
||||
aRegCnt++;
|
||||
}
|
||||
}
|
||||
View1.ItemsCount = Port[aPst].fData.Port.ResistedCount;
|
||||
}
|
||||
if(LanguageEnCn==0){
|
||||
TMyString::sAddOnStr(" 回路", Caption.Text);
|
||||
TMyString::sAddOn2Dg(aPst+1, Caption.Text);
|
||||
TMyString::sAddOnStr(" 已注册:", Caption.Text);
|
||||
TMyString::sAddOn3Dg(aRegCnt, Caption.Text);
|
||||
}else{
|
||||
TMyString::sAddOnStr(" Loops:", Caption.Text);
|
||||
TMyString::sAddOn2Dg(aPst+1, Caption.Text);
|
||||
TMyString::sAddOnStr(" Registered:", Caption.Text);
|
||||
TMyString::sAddOn3Dg(aRegCnt, Caption.Text);
|
||||
}
|
||||
break;
|
||||
case dgTYPE_HAND_CTL:
|
||||
TMyString::sFromStr("总线盘", Caption.Text);
|
||||
TMyString::sAddOn2Dg(aPst+1, Caption.Text);
|
||||
TMyString::sAddOnStr(" 已登记", Caption.Text);
|
||||
TMyString::sAddOn3Dg(HandCtlBoard[aPst].fData.HandCtl.ResistedCount, Caption.Text);
|
||||
break;
|
||||
case dgTYPE_DIRECT_CTL:
|
||||
TMyString::sFromStr("多线盘", Caption.Text);
|
||||
TMyString::sAddOn2Dg(aPst+1, Caption.Text);
|
||||
TMyString::sAddOnStr(" 已登记", Caption.Text);
|
||||
TMyString::sAddOn3Dg(DirectCtlBoard[aPst].fData.DirectCtl.ResistedCount, Caption.Text);
|
||||
break;
|
||||
case dgTYPE_COMM_CAN:
|
||||
|
||||
break;
|
||||
case dgTYPE_COMM_MULTI:
|
||||
|
||||
break;
|
||||
case dgTYPE_MOTHER_BOARD:
|
||||
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
Caption.Show();
|
||||
}
|
||||
|
||||
void TLiteIconOverView::CalcSelPath0()
|
||||
{
|
||||
if(cy <4){
|
||||
SelPath0 = cy * 10 + cx + 1;
|
||||
SelRootType = dgTYPE_PORT;
|
||||
}else
|
||||
if(cy == 4){
|
||||
SelPath0 = cy * 10 + cx -1;
|
||||
SelRootType = dgTYPE_HAND_CTL;
|
||||
}else
|
||||
if(cy == 5){
|
||||
SelPath0 = cy * 10 + cx -3;
|
||||
SelRootType = dgTYPE_DIRECT_CTL;
|
||||
}
|
||||
}
|
||||
|
||||
void TLiteIconOverView::FindNearP0()
|
||||
{
|
||||
int aCx, aCy, Found;
|
||||
Found = 0;
|
||||
for(aCx=0; aCx<10; aCx++){
|
||||
for(aCy=0; aCy<6; aCy++){
|
||||
if(ExistTab[aCy][aCx]){
|
||||
cy = aCy;
|
||||
cx = aCx;
|
||||
Found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(Found)break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TGuiMsgReturn TLiteIconOverView::KeyIn(unsigned char aKey)
|
||||
{
|
||||
int ind,i,aIndex;
|
||||
TGuiMsgReturn aMsg = guiMsgNone;
|
||||
int aCx, aCy, Found;
|
||||
|
||||
//Up or Down One Index___________________
|
||||
Found = 0;
|
||||
if(aKey == VK_TAB){
|
||||
|
||||
}
|
||||
if(1){
|
||||
if(VK_UP == aKey){
|
||||
if(ViewPath ==0){
|
||||
if(cy>0){
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user