#include "LiteListViewMask.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 TextTopOffSet 6 #define ListLineCnt 10 void TLiteListViewMask::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-20, Bottom); VScrollBarBox.Set(Right-20 +1, Top+CH + 33, Right, Bottom); Color = aColor; #undef CH ActiveLineNum=0; ListView.ColHeight = 33; ListView.TopIndex=0; ListView.RowCount = 9; ListView.FixColTop = Content.Top; ListView.FixColBottom = ListView.FixColTop + ListView.ColHeight; ListView.ColTop[0] = ListView.FixColBottom + 1; ListView.ColBottom[0] = ListView.ColTop[0] + ListView.ColHeight -1; ListView.ColLeft[0] = 1; ListView.ColRight[0] = ListView.ColWidth[0] +1; for(i=1; i<12; i++){ ListView.ColTop[i] = ListView.ColTop[i -1] + ListView.ColHeight; ListView.ColBottom[i] = ListView.ColBottom[i-1] + ListView.ColHeight; } for(i=1;i Content.Bottom)y2 = Content.Bottom; if(x == ListView.SelectedCol){ RectFillRender(Content.Left, y, Content.Right, y2, SelectedColor); }else{ if(x & 1){ RectFillRender(Content.Left, y, Content.Right, y2, OddColor); }else{ RectFillRender(Content.Left, y, Content.Right, y2, Color); } } y = y2 + 1; if(y>Content.Bottom)break; } } void TLiteListViewMask::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 TLiteListViewMask::DrawCaption(void) { Caption.Show(); } void TLiteListViewMask::DrawVertScrollBar(void) { TVScrollBar::sDrawBySize(VScrollBarBox.Left, VScrollBarBox.Top, VScrollBarBox.Width, VScrollBarBox.Height, clMedGray, clGray, EntryCount, 10, ListView.TopIndex); } void TLiteListViewMask::DrawList(void) { int i, index, BGClr, TextClr, aTop; unsigned int aClr, aAddr, aP0,aP1;; if(EntryCount < 1)return; RenderContent(); aTop = ListView.FixColTop + TextTopOffSet; SetListColWidth(30,90,100,150,100,100,1,1,1); TextRender_string24(ListView.ColLeft[1],aTop,TextColor, " 序号" ); TextRender_string24(ListView.ColLeft[2],aTop,TextColor, " 路径"); TextRender_string24(ListView.ColLeft[3],aTop,TextColor, "设备类型"); TextRender_string24(ListView.ColLeft[4],aTop,TextColor, " 描述 "); for(i=0; i-1; j--){ if(Port[i].ExistTable[j] == 0xA5){ if(Port[i].StateTable[j] & (dEpStateBitMask)){ EntryFound.Path0 = i + dADDR_OFFSET_PORT; EntryFound.Path1 = j +1; EntryFound.iType0 = dgTYPE_PORT; EntryFound.iType1 = EpDev[i][j].fData.Split.dType; FoundNew = 1; break; } } } } //is Port; Find All Next Port Sub Items if(FoundNew)break; i = sPath0 -1 -1; for(; i>-1; i--){ if(MainCtl.fData.Split.ExistTablePort[i] == 0xA5){ j = dEP_MAX_COUNT_PER_PORT -1; for(; j>-1; j--){ if(Port[i].ExistTable[j] == 0xA5){ if(Port[i].StateTable[j] & (dEpStateBitMask)){ EntryFound.Path0 = i + dADDR_OFFSET_PORT; EntryFound.Path1 = j +1; EntryFound.iType0 = dgTYPE_PORT; EntryFound.iType1 = EpDev[i][j].fData.Split.dType; FoundNew = 1; break; } } } if(FoundNew)break; } } } }while(0); if(FoundNew){ for(i=9; i>0; i--){ Entry[i].Path0 = Entry[i-1].Path0; Entry[i].Path1 = Entry[i-1].Path1; Entry[i].iType0 = Entry[i-1].iType0; Entry[i].iType1 = Entry[i-1].iType1; Entry[i].Loaded = Entry[i-1].Loaded; } Entry[point].Path0 = EntryFound.Path0; Entry[point].Path1 = EntryFound.Path1; Entry[point].iType0 = EntryFound.iType0; Entry[point].iType1 = EntryFound.iType1; Entry[point].Loaded = 1; ListView.TopIndex--; } } void TLiteListViewMask::EntryTotalize(void) { unsigned int i,j; EntryCount = 0; for(i=0; i已屏蔽设备", Caption.Text); } TGuiMsgReturn TLiteListViewMask::KeyIn(unsigned char aKey) { int ind,i,aIndex; TGuiMsgReturn aMsg = guiMsgNone; //Up or Down One Index___________________ if(aKey == VK_TAB){ } if(1){ if(VK_UP == aKey){ if(ListView.SelectedCol >0){ ListView.SelectedCol--; DrawList(); }else{ if(ListView.TopIndex >0){ EntryLoadBackward(); DrawList(); } } }else if(VK_DOWN == aKey){ if((ListView.TopIndex + ListView.SelectedCol) < (EntryCount-1) ){ if( ListView.SelectedCol < (ListLineCnt -1) ){ ListView.SelectedCol++; DrawList(); }else{ if( (ListView.TopIndex + ListLineCnt) < EntryCount ){ EntryLoadForward(); DrawList(); } } } } } if(aKey == VK_EXECUTE){ //Open path Device }else if(aKey == VK_F2){ }else if(aKey == VK_RETURN){ aMsg = guiMsgReturn; } return aMsg; }