#include "gType.h" #include "GraphLow.h" #include "GraphBase.h" #include "GlobalString.h" #include "RuntimeData.h" #include "Runtime.h" #include "PadInf.h" #define TextTopOffSet 6 #define ListLineCnt 10 #define IconVcnt 5 #define IconHcnt 10 #define HLineTextRight 780 #define HSpace 33 #define clOdd clMoneyGreen #define clEven clWhiteBlue const int LeftTitlePoint[8] ={ 20, 100, 200, 320, 420, 520, 620, 700 }; const int LeftTextPoint[8] ={ 20, 100, 200, 320, 420, 520, 620, 720 }; void TPadInf::Init() { Tag.Reset(); Items.Reset(); IsShow = 0; ViewingLevel = 0; } void TPadInf::RenderBackGround(void) { RectFillRender(ContentGeometry.Left, ContentGeometry.Top, ContentGeometry.Right, ContentGeometry.Bottom, ContentColor); } void TPadInf::RenderBackGround(unsigned int aClr) { RectFillRender(ContentGeometry.Left, ContentGeometry.Top, ContentGeometry.Right, ContentGeometry.Bottom, aClr); } void TPadInf::DrawSelf() { RectFillRender(Lv.Caption.Left, Lv.Caption.Top, Lv.Caption.Right, Lv.Caption.Bottom, CaptionColor); if(LanguageEnCn==0) TextRender_string24(Lv.Caption.Left + 10, Lv.Caption.Top +4, clNearWhite, CaptionColor, "手动控制盘->信息"); else TextRender_string24(Lv.Caption.Left + 10, Lv.Caption.Top +4, clNearWhite, CaptionColor, "Manual Control Unit->Information"); for(int i=0; i=3)return; } if(Items.Type[t] == 0){ aP0 = Items.Num[t]; UsingKeyCnt = HandCtlBoard[aP0].KeyCount; if(HandCtlBoard[aP0].PadIsProhibit == 0)tClr = clNearWhite; else tClr = clWhiteGray; //Draw Pad Type if(LanguageEnCn==0) TextRender_string24(LeftTextPoint[0], Lv.Grid.Top[i+2] + 4, tClr, ItemColor, "总线"); else TextRender_string24(LeftTextPoint[0], Lv.Grid.Top[i+2] + 4, tClr, ItemColor, "Bus"); //Draw Pad Num TextDigitRender2Right24(LeftTextPoint[1], Lv.Grid.Top[i+2] + 4, tClr, ItemColor, Items.Num[t]+1); if( (UsingKeyCnt != 48) && (UsingKeyCnt != 64) && (UsingKeyCnt != 128) ) { UsingKeyCnt = 48; } ExistCnt = 0; for(x=0; xBusPad->KeyIn(aKey); }else if(LoadedPad.Type == 1){ aMsg = this->DirectPad->KeyIn(aKey); } if(aMsg == guiMsgReturn){ return guiMsgReturn; } return guiMsgNone; } TGuiMsgReturn TPadInf::EditKeyIn(unsigned char aKey) { TGuiMsgReturn aMsg; //editting return guiMsgNone; } void TPadInf::ClearSelected(void) { int iT; iT = Tag.Inx + 2; if(iT > 9)return; RectFillRender(Lv.Grid.Left[iT], Lv.Grid.Top[iT], Lv.Grid.Left[iT] + Lv.Grid.Right[iT], Lv.Grid.Top[iT] + 3, ItemColor); //draw rectangle RectFillRender(Lv.Grid.Left[iT], Lv.Grid.Top[iT], Lv.Grid.Left[iT] + 3, Lv.Grid.Bottom[iT], ItemColor); //draw rectangle RectFillRender(Lv.Grid.Right[iT] -3, Lv.Grid.Top[iT], Lv.Grid.Right[iT], Lv.Grid.Bottom[iT], ItemColor); //draw rectangle RectFillRender(Lv.Grid.Left[iT], Lv.Grid.Bottom[iT] -3, Lv.Grid.Right[iT], Lv.Grid.Bottom[iT], ItemColor); //draw rectangle } void TPadInf::Check4Selected(void) { int iT; iT = Tag.Inx + 2; if(iT > 9)return; RectFillRender(Lv.Grid.Left[iT], Lv.Grid.Top[iT], Lv.Grid.Left[iT] + Lv.Grid.Right[iT], Lv.Grid.Top[iT] + 3, clBlue); //draw rectangle RectFillRender(Lv.Grid.Left[iT], Lv.Grid.Top[iT], Lv.Grid.Left[iT] + 3, Lv.Grid.Bottom[iT], clBlue); //draw rectangle RectFillRender(Lv.Grid.Right[iT] -3, Lv.Grid.Top[iT], Lv.Grid.Right[iT], Lv.Grid.Bottom[iT], clBlue); //draw rectangle RectFillRender(Lv.Grid.Left[iT], Lv.Grid.Bottom[iT] -3, Lv.Grid.Right[iT], Lv.Grid.Bottom[iT], clBlue); //draw rectangle } TGuiMsgReturn TPadInf::KeyIn(unsigned char aKey) { int ind,i,aIndex, Found; unsigned char aP0; TGuiMsgReturn aMsg = guiMsgNone; TGuiMsgReturn aMsg2Rtn = guiMsgNone; //Up or Down One Index___________________ if(ViewingLevel == 0){ if(VK_LEFT ==aKey){ }else if(VK_RIGHT == aKey){ }else if(VK_UP == aKey){ if(Tag.Inx >0){ ClearSelected(); Tag.Inx--; Items.Inx--; Check4Selected(); }else{ if(Items.Inx >0){ Items.Inx--; Items.TopInx--; DrawList(); } } }else if(VK_DOWN == aKey){ if(Tag.Inx < 7){ if(Items.Inx < (Items.Count-1)){ ClearSelected(); Tag.Inx++; Items.Inx++; Check4Selected(); } }else{ Tag.Inx = 7; if(Items.Inx < (Items.Count-1)){ Items.Inx++; Items.TopInx++; DrawList(); } } }else if(aKey == VK_TAB){ }else if(aKey == VK_EXECUTE){ //Open path Device if(Items.Count > 0){ if(Items.Inx < Items.Count){ if(Items.Type[Items.Inx] == 0){ LoadedPad.Type = 0; LoadedPad.Num = Items.Num[Items.Inx]; //设置总线盘联动编程 BusPadLnk.Init(1); BusPadLnk.aPanel = &CommonPanel; BusPadLnk.IList = &ItemList; BusPadLnk.Show(); BusPadLnk.SetPath(0,LoadedPad.Num+1,1); ViewingLevel = 1; }else if(Items.Type[Items.Inx] == 1){ LoadedPad.Type = 1; LoadedPad.Num = Items.Num[Items.Inx]; //设置多线盘 DirectPadCfg.Init(1); DirectPadCfg.aPanel = &CommonPanel; DirectPadCfg.IList = &ItemList; DirectPadCfg.Show(); DirectPadCfg.SetPath(0,LoadedPad.Num+1,1); ViewingLevel = 1; } } } }else if(aKey == VK_RETURN){ aMsg = guiMsgReturn; }else{ } }else if(ViewingLevel == 1){ if(LoadedPad.Type == 0){ if(this->BusPad == nullptr){ aMsg2Rtn = guiMsgReturn; }else{ aMsg2Rtn = this->BusPad->KeyIn(aKey); } }else{ if(this->DirectPad == nullptr){ aMsg2Rtn = guiMsgReturn; }else{ aMsg2Rtn = this->DirectPad->KeyIn(aKey); } } if(aMsg2Rtn == guiMsgReturn){ ViewingLevel = 0; RenderBackGround(); DrawSelf(); DrawTitle(); DrawDirectPadInf(); DrawBusPadInf(); DrawList(); Check4Selected(); } } //____________________________________________________________________<- List View return aMsg; } void TPadInf::LoadItem(void) { int i; Items.Count = 0; for(i=0; i= Items.Count){ Items.Inx = Items.Count-1; } } void TPadInf::ClearItem(void) { Items.Count = 0; }