⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3kmenu7.c

📁 嵌入式开发 嵌入式开发 嵌入式开发
💻 C
📖 第 1 页 / 共 5 页
字号:
/********************
 Filename: 3KMENU7.C
 History&Datetime:
 DateTime: 2007-2-7 
 JOB-TODO: 标记排列,标准色序,波门宽度,通道点击的范围偏小 将其鼠标点击范围在menu()函数中
 放大为Button + Edit 都可点击响应
 DateTime: 2007-3-26 17:18
 JOB-TODO: 在系统配置页加入对0#命令数据长度的判断,解决误报号的问题
********************/
#include "ST3000.H"
#include "STRUC_3K.H"
#include "CORE_VGA.H"
#include "CORE_COM.H"
#include "3KDEFN.H"

/**************** local variables ****************/
static char *szptr_m7_1[][2] = {
    {"标记排列", "MK-ARRAY"},
    {"标准色序", "STD-ORD"},
    {"波门宽度", "GATE WIDTH"},
    {"标准设置", "STD SET"},
    {"马达正反转", "MOTO CW/CCW"},
    {"横向开关", "H-SWITCH"},
    {"系统配置", "SYSTEM CONFIG"},
    {"恢复出厂参数", "RESTORE PARAM"},
    {"二次印刷", "REPRINT"},
    {"屏幕保护", "SCR PROTECT"}
};

static char *szptr_m7_3[][2] = {
    {"色序加","COR ADD"},
    {"色序减","COR SUB"},
    {"色标间距","MK-DIS"}
};

static char *szptr_m7_2[][2] = {
    {"标准选择","STD SELE"},
    {"A系列","SER A"},
    {"B系列","SER B"},
    {"标记角度","MARK ANG"},
    {"标准1","STD1"},
    {"标准2","STD2"}
};

static char *szptr_m7_turns[][2] = {
    {"纵顺","V-FOR"},
    {"纵逆","V-REV"},
    {"单标记","SINGLE"},
    {"横顺","H-FOR"},
    {"横逆","H-REV"}
};

/**************** local variables ****************/
unsigned char vItemSEL7;
    /* 专用于系统配置表 和 系统机械参数的光标选择 */
unsigned char vSErSEL7=1;
unsigned char vNewPNoSEL7=1,vOldPNoSEL7=1;
int vNewPageSEL7,vOldPageSEL7;
int vNewUnitSEL7,vOldUnitSEL7;

/**************** extern contants ****************/
extern const _tagMenuAttr MenuAttr;
extern const _tagInstAttr InstAttr;
extern const _tagSizeAttr SizeAttrB;
extern const _tagSizeAttr SizeAttrE;
extern const _tagSizeAttr SizeConfig;

/**************** extern variables ****************/
extern struct setupnum system1[];
extern MSG_STRUCT smsg1,rmsg1;
extern CheckBuffer checkbuffer[];

/**************** extern functions ****************/
extern int GetEntireTurns(const int iSER);
extern int GetEntireAuto(const int iSER);
extern void SetEntireFlags(const int iCNL, const unsigned char iSAT, const int iVAL);
extern void ClearEntireFlags(void);
extern void ReSortCURecv(void);

extern void _Query_jzCmdList(void);
extern int REC_sub1com;
/******************************
描述: 本屏幕的所有页牵扯到
PD值、报警值、微调值、平均值等等
需要即改即发 或者换页 换屏发送处理函数
2007-3-16 15:58 应为在
******************************/
void SyncCMD_M7(void)
{
    int t;
    for(t=1; t<VarST3000.UnitCounts; t++)
    {
        if( CmdFlags[t].bits.bit0 ) {   SendCnlData(t, 0x06);}
    }
    delay(20);
    for(t=1; t<VarST3000.UnitCounts; t++)
    {
        if( CmdFlags[t].bits.bit1 ) {   SendCnlData(t, 0x07);}
    }
    delay(20);
    for(t=1; t<VarST3000.UnitCounts; t++)
    {
        if( CmdFlags[t].bits.bit2 ) {   SendCnlData(t, 0x08);}
    }
    delay(20);
    for(t=1; t<VarST3000.UnitCounts; t++)
    {
        if( CmdFlags[t].bits.bit3 ) {   SendCnlData(t, 0x09);}
    }
    delay(20);
    for(t=1; t<VarST3000.UnitCounts; t++)
    {
        if( CmdFlags[t].bits.bit4 ) {   SendCnlData(t, 0x0a);}
    }
    delay(20);
    for(t=1; t<VarST3000.UnitCounts; t++)
    {
        if( CmdFlags[t].bits.bit5 ) {   SendCnlData(t, 0x0b);}
    }
}

/******************************
 描述: 专用键盘 用来修改系统配置表的
******************************/
void SimKB_MS78(const int Lx, const int Ty)
{
    // 专用键盘 (MS78: Menu Subitem 7th Menu . 8th Subitem.
    int  kys;
    int  xkys,ykys;
    int  wkys=60,hkys=60;
    int  inskys=20;
    char szchar[5]={0};
    for(kys=0; kys<14; kys++)
    {
        ykys=Ty+(kys/4)*(hkys+inskys);
        if(kys<10)
        {   //0~9
            xkys=Lx+(kys%4)*(wkys+inskys);
            szchar[0]=0x30+kys;
            szchar[1]=0x00;
            Button(xkys, ykys, wkys, hkys, 0x81, szchar, 192, 192, 192);
        }
        else if(kys==10)
        {   xkys=Lx+(kys%4)*(wkys+inskys);
            Button(xkys, ykys, wkys, hkys, 0x81, "Del", 192, 192, 192);
        }
        else if(kys==11)
        {   xkys=Lx+(kys%4)*(wkys+inskys);
            Button(xkys, ykys, wkys, hkys, 0x81, "Bac", 192, 192, 192);
        }
        else if(kys==12)
        {   xkys=Lx+(kys%4)*(wkys+inskys)*2;
            Button(xkys, ykys, wkys*2+inskys, hkys, 0x81, "Ent", 192, 192, 192);
        }
        else if(kys==13)
        {   xkys=Lx+(kys%4)*(wkys+inskys)*2;
            Button(xkys, ykys, wkys*2+inskys, hkys, 0x81, "Ok", 192, 192, 192);
        }
    }
}

/******************************
 描述: 仿真键盘输入到屏幕上
******************************/
int SimKB_MS78_Resp(const int Lx, const int Ty)
{
    int  iNUM=100;
    int  kys;
    int  xkys,ykys;
    int  wkys=60,hkys=60;
    int  inskys=20;
    char szchar[5]={0};
    for(kys=0; kys<14; kys++)
    {
        ykys=Ty+(kys/4)*(hkys+inskys);
        if(kys<12)
        {
            xkys=Lx+(kys%4)*(wkys+inskys);
            if( (ClickCol>xkys && ClickCol<xkys+wkys) &&
                (ClickRow>ykys && ClickRow<ykys+hkys) )
            {
                if(kys<10)
                {   //0~9
                    szchar[0]=0x30+kys;
                    szchar[1]=0x00;
                    Button(xkys, ykys, wkys, hkys, 0x91, szchar, 192, 192, 192);
                    delay(15);
                    Button(xkys, ykys, wkys, hkys, 0x81, szchar, 192, 192, 192);
                }
                else if(kys==10)
                {
                    Button(xkys, ykys, wkys, hkys, 0x91, "Del", 192, 192, 192);
                    delay(15);
                    Button(xkys, ykys, wkys, hkys, 0x81, "Del", 192, 192, 192);
                }
                else if(kys==11)
                {
                    Button(xkys, ykys, wkys, hkys, 0x91, "Bac", 192, 192, 192);
                    delay(15);
                    Button(xkys, ykys, wkys, hkys, 0x81, "Bac", 192, 192, 192);
                }
                iNUM=kys;   break;
            }
        }
        else
        {
            xkys=Lx+(kys%4)*(wkys+inskys)*2;
            if( (ClickCol>xkys && ClickCol<xkys+wkys*2+inskys) &&
                (ClickRow>ykys && ClickRow<ykys+hkys) )
            {
                if(kys==12)
                {   xkys=Lx+(kys%4)*(wkys+inskys)*2;
                    Button(xkys, ykys, wkys*2+inskys, hkys, 0x91, "Ent", 192, 192, 192);
                    delay(15);
                    Button(xkys, ykys, wkys*2+inskys, hkys, 0x81, "Ent", 192, 192, 192);
                }
                else if(kys==13)
                {   xkys=Lx+(kys%4)*(wkys+inskys)*2;
                    Button(xkys, ykys, wkys*2+inskys, hkys, 0x91, "Ok", 192, 192, 192);
                    delay(15);
                    Button(xkys, ykys, wkys*2+inskys, hkys, 0x81, "Ok", 192, 192, 192);
                }
                iNUM=kys;   break;
            }
        }
    }
    return(iNUM);
}

/******************************
 描述: 对输入内容进行处理
******************************/
void SimKB_MS78_Proc(const int val)
{
    if(val<10)
    {   //0~9
        if(strlen(Dispbuf)<g_Klength)
        {
            memset(Dispbuf+strlen(Dispbuf), (char)(0x30+val), 1);
        }
    }
    else if(val==10)
    {   //DEL
        ClearKBuffer();
    }
    else if(val==11)
    {   //BAC
        if(strlen(Dispbuf)!=NULL)
        {   memset(Dispbuf+strlen(Dispbuf)-1, 0x00, 1);}
    }
    //ENT .and. OK 放在调用处处理
}

/******************************
 描述: 画出表格及填写单元编号
******************************/
void DrawCfgTable(const int Lx, const int Ty)
{
    char    vchar[10];
    char    *sztchar[2]={"系统配置表","SYSTEM CONFIG TABLE"};
    int i,xNew,yNew,xEach;
    vItemSEL7=0;
    xNew=Lx+(SizeConfig.w-(int)strlen(sztchar[VarST3000.Language])*8)/2;
    yNew=Ty-35;
    if(VarST3000.Language)
    {   ShowASCMemX(xNew, yNew, 1, 2, sztchar[1], 0, 0, 0);}
    else
    {   ShowGB2312X(xNew, yNew, 1, 2, sztchar[0], 0, 0, 0);}
    xEach=SizeConfig.w/5;
    Bar(Lx, Ty+27, Lx+SizeConfig.w, Ty+SizeConfig.h-2, 255, 255, 255);
    MoveTo(Lx, Ty+SizeConfig.h);
    LineTo(Lx, Ty, 128, 128, 128);
    LineTo(Lx+SizeConfig.w, Ty, 128, 128, 128);
    LineTo(Lx+SizeConfig.w, Ty+SizeConfig.h, 255, 255, 255);
    LineTo(Lx, Ty+SizeConfig.h, 255, 255, 255);
    MoveTo(Lx+1, Ty+25);
    LineTo(Lx+SizeConfig.w-1, Ty+25, 255, 255, 255);
    MoveTo(Lx+xEach*4, Ty+26);
    LineTo(Lx+xEach*4, Ty+SizeConfig.h-1, 192, 192, 192);
    if(VarST3000.Language)
    {
        Button(Lx+1, Ty+1, xEach*4-2, 25, 0x01, "RELEASE NUM", 192, 192, 192);
        Button(Lx+xEach*4+1, Ty+1, xEach-1, 25, 0x01, "MACH NUM", 192, 192, 192);
    }
    else
    {
        Button(Lx+1, Ty+1, xEach*4-2, 25, 0x03, "出厂编号", 192, 192, 192);
        Button(Lx+xEach*4+1, Ty+1, xEach-2, 25, 0x03, "机组号", 192, 192, 192);
    }
    for(i=1; i<13; i++)
    {
        Line(Lx+1, Ty+25+i*30, Lx+SizeConfig.w-1, Ty+25+i*30, 192, 192, 192);
    }
    xEach=(SizeConfig.w-xEach)/3;
    for(i=1; i<=VarST3000.UnitActuals; i++)
    {
        ShowASCMem(Lx+xEach, Ty+i*30, ".", 0, 0, 0);
        ShowASCMem(Lx+xEach*2, Ty+i*30, ".", 0, 0, 0);
        memset(vchar, 0, 10);
        sprintf(vchar, "%02d", checkbuffer[i].buffer[4]);
        ShowGB2312(Lx+(xEach-(int)strlen(vchar)*16)/2, Ty+3+i*30, vchar, 0, 0, 0);
        memset(vchar, 0, 10);
        sprintf(vchar, "%02d", checkbuffer[i].buffer[5]);
        ShowGB2312(Lx+xEach+(xEach-(int)strlen(vchar)*16)/2, Ty+3+i*30, vchar, 0, 0, 0);
        memset(vchar, 0, 10);
        sprintf(vchar, "%03d", checkbuffer[i].buffer[6]);
        ShowGB2312(Lx+xEach*2+(xEach-(int)strlen(vchar)*16)/2, Ty+3+i*30, vchar, 0, 0, 0);
        memset(vchar, 0, 10);
        sprintf(vchar, "%02d", checkbuffer[i].buffer[3]+1);
        if(i==1)
        {   Bar(Lx+xEach*3+5, Ty+i*30-1, Lx+SizeConfig.w-2, Ty+i*30+23, 255, 0, 0);
            ShowGB2312(Lx+SizeConfig.w-(int)strlen(vchar)*16, Ty+3+i*30, vchar, 255, 255, 255);
            vItemSEL7=1;
        }
        else
        {   ShowGB2312(Lx+SizeConfig.w-(int)strlen(vchar)*16, Ty+3+i*30, vchar, 0, 0, 0);}
    }
    //系统编号区域
    Rect(Lx, Ty+SizeConfig.h+40, SizeConfig.w, 35, 1);
    Button(Lx+1, Ty+SizeConfig.h+41, SizeConfig.w/3, 33,
            (VarST3000.Language?0x01:0x03), (VarST3000.Language?"SYSTEM NUMBER":"系统编号"), 192, 192, 192);
    Bar(Lx+SizeConfig.w/3+2, Ty+SizeConfig.h+41,
            Lx+SizeConfig.w-2, Ty+SizeConfig.h+74, 255, 255, 255);
    ShowASCMem(Lx+SizeConfig.w/3+SizeConfig.w*2/9-5, Ty+SizeConfig.h+45, ".", 0, 0, 0);
    ShowASCMem(Lx+SizeConfig.w/3+SizeConfig.w*4/9-6, Ty+SizeConfig.h+45, ".", 0, 0, 0);
    //系统编号区域
    if(!vItemSEL7)  {   vItemSEL7=120;}
    xEach=(SizeConfig.w*2/3)/3;
    i=Lx+SizeConfig.w/3+3;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -