Initial commit
This commit is contained in:
276
MyCode/Gui/OnTimeCheck.cpp
Normal file
276
MyCode/Gui/OnTimeCheck.cpp
Normal file
@@ -0,0 +1,276 @@
|
||||
#include "RuntimeData.h"
|
||||
#include "OnTimeCheck.h"
|
||||
#include "DevMask.h"
|
||||
|
||||
extern "C"{
|
||||
//#include "user_norflash.h"
|
||||
#include "user_eeprom.h"
|
||||
#include "uart_key_drv.h"
|
||||
}
|
||||
|
||||
void TOnTimeCheck::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);
|
||||
|
||||
RectPanel.Set(Left + 420,Top + CH, Right - 4, Top + CH + 6 + 284);
|
||||
Color = aColor;
|
||||
#undef CH
|
||||
|
||||
CtlIndex =0;
|
||||
IsProgram = 0;
|
||||
|
||||
Caption.Border.Color = clGray;
|
||||
}
|
||||
|
||||
void TOnTimeCheck::RenderBackGround(void)
|
||||
{
|
||||
RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color);
|
||||
}
|
||||
|
||||
void TOnTimeCheck::RenderBackGround(unsigned int aClr)
|
||||
{
|
||||
RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, aClr);
|
||||
}
|
||||
|
||||
void TOnTimeCheck::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 TOnTimeCheck::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 TOnTimeCheck::DrawCaption(void)
|
||||
{
|
||||
TMyString::sFromStr("->", Caption.Text);
|
||||
Caption.Show();
|
||||
}
|
||||
|
||||
void TOnTimeCheck::Show()
|
||||
{
|
||||
DrawSelf();
|
||||
DrawCaption();
|
||||
TextRender_string24(80, 354 ,clNearBlack, "1.");
|
||||
TextRender_string24(80, 384 ,clNearBlack, "2.");
|
||||
TextRender_string24(80, 414 ,clNearBlack, "3.");
|
||||
}
|
||||
|
||||
void TOnTimeCheck::FullRedraw(int Prm)
|
||||
{
|
||||
int i, x, y;
|
||||
if(Prm == 0){
|
||||
Show();
|
||||
}else
|
||||
if(Prm == 1){
|
||||
RectFillRender(GuiRedrawDataList[1][0], GuiRedrawDataList[1][1], GuiRedrawDataList[1][2], GuiRedrawDataList[1][3], Color);
|
||||
}
|
||||
aPanel->Show();
|
||||
aPanel->ReDrawItems();
|
||||
ShowPath();
|
||||
}
|
||||
|
||||
void TOnTimeCheck::DelayMs(unsigned int aMs)
|
||||
{
|
||||
volatile unsigned int mTick;
|
||||
volatile unsigned int Tick;
|
||||
for(Tick=0; Tick<aMs; Tick++){
|
||||
for(mTick=0; mTick<160000; mTick++);
|
||||
sys_error_led_task();
|
||||
}
|
||||
}
|
||||
|
||||
void TOnTimeCheck::Check4Selected(void)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<12; i++){
|
||||
aPanel->Edit[i].Selected = 0;
|
||||
}
|
||||
if( (CtlIndex > -1) && (CtlIndex < 12) ){
|
||||
aPanel->Edit[CtlIndex].Selected = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void TOnTimeCheck::InitPanel(void)
|
||||
{
|
||||
int x,y,x2,y2, aW,aH,i, yt;
|
||||
|
||||
RectPanel.Set(80,76, 720, 350);
|
||||
|
||||
x = RectPanel.Left;
|
||||
y = RectPanel.Top;
|
||||
x2 = RectPanel.Right;
|
||||
y2 = RectPanel.Bottom;
|
||||
aW = RectPanel.Width;
|
||||
aH = RectPanel.Height;
|
||||
|
||||
yt = y+6;
|
||||
|
||||
aPanel->Init(x,y,aW,aH,0,0,clFrmFace, bvRaised);
|
||||
|
||||
aPanel->Caption.Init(1,1,aW-3,32,x,y,clFrmFace,clFrmFace);
|
||||
|
||||
aPanel->SText[0].Init(6,4,70,36,x,0,clNearBlack,clFrmFace);
|
||||
TMyString::sFromStr("总线盘号: 按键数量: 按键号:", aPanel->SText[0].Text);
|
||||
aPanel->SText[17].Init(20,0,300,30,x,yt,clNearBlack,clFrmFace);
|
||||
|
||||
aPanel->SText[0].Enable = 0;
|
||||
aPanel->SText[4].Enable = 0;
|
||||
|
||||
|
||||
aPanel->Edit[ 0].Init(0,0,48,30,x,yt,clNearBlack,clNearWhite);
|
||||
|
||||
|
||||
for(i=0; i<1;i++){
|
||||
aPanel->Edit[i].Enable = 1;
|
||||
aPanel->Edit[i].Visible = 1;
|
||||
aPanel->Edit[i].SetInputMaskEn();
|
||||
aPanel->Edit[i].SetMaxLen(3);
|
||||
aPanel->Edit[i].Str.FromStr("000");
|
||||
aPanel->Edit[i].Pst = 2;
|
||||
aPanel->Edit[i].Selected = 0;
|
||||
}
|
||||
|
||||
Check4Selected();
|
||||
aPanel->ReDrawItems();
|
||||
}
|
||||
|
||||
void TOnTimeCheck::ShowPath()
|
||||
{
|
||||
//TextDigitRender2Right24(212, 124, clNearBlack, clFrmFace, Loaded.P0 +1);
|
||||
//TextDigitRender2Right24(360, 124, clNearBlack, clFrmFace, Loaded.Key +1);
|
||||
}
|
||||
|
||||
|
||||
void TOnTimeCheck::SaveData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
TGuiMsgReturn TOnTimeCheck::KeyIn(unsigned char aKey)
|
||||
{
|
||||
TGuiMsgReturn aMsg = guiMsgNone;
|
||||
int uKey;
|
||||
unsigned char aIndex;
|
||||
char LastChr;
|
||||
const char *p;
|
||||
int i;
|
||||
if(1){
|
||||
switch(aKey){
|
||||
case VK_DELETE:
|
||||
|
||||
break;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
|
||||
break;
|
||||
case VK_UP:
|
||||
break;
|
||||
case VK_DOWN:
|
||||
break;
|
||||
case VK_LEFT:
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
break;
|
||||
case VK_TAB:
|
||||
break;
|
||||
case dfKEY_ENCN:
|
||||
break;
|
||||
case dfKEY_SETUP:
|
||||
break;
|
||||
case dfKEY_QUERY:
|
||||
break;
|
||||
case VK_EXECUTE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(aKey == VK_RETURN){
|
||||
aMsg = guiMsgReturn;
|
||||
|
||||
}
|
||||
return aMsg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user