📄 tt8.c
字号:
while(*s)
{ offset1=(long)(*s)*16;
s+=1;
j=0;
for(i=0;i<=15;i++)
{ dot[i][j]=ASC16[offset1+i];
mask=0x80;
for(k=0;k<=7;k++)
{if (dot[i][j]&mask)
{for(nn=0;nn<n;nn++)
{for(mm=0;mm<m;mm++)
drwpoint(mode,col,x+(j*8+k)*n+nn,y+i*m+mm);
}
}
mask=mask>>1;
}
}
x+=8*n;
}
}
int drwhzstr(char *s,int x,int y,int m,int n,
int col,int mode)
{ unsigned char dot[16][2],qm,wm;
long offset1;
register i,j,k,mm,nn,mask;
FILE *fpHZ;
if((fpHZ=fopen("hzk16","rb"))==0)
{printf("Error: HZK16 can't open.\n");
return FALSE;
}
while(*s)
{ qm=(unsigned char)(s[0]-0xa1);
s+=1;
wm=(unsigned char)(s[0]-0xa1);
offset1=((long)qm*94+(long)wm)*32;
s+=1;
fseek(fpHZ,offset1,SEEK_SET);
for(i=0;i<=15;i++)
{for(j=0;j<2;j++)
{ dot[i][j]=fgetc(fpHZ);
mask=0x80;
for(k=0;k<=7;k++)
{if (dot[i][j]&mask)
{for(nn=0;nn<n;nn++)
{for(mm=0;mm<m;mm++)
drwpoint(mode,col,x+(j*8+k)*n+nn,y+i*m+mm);
}
}
mask=mask>>1;
}
}
}
x+=16*n;
}
fclose(fpHZ);
}
void lmtspeedinit(void)
{
int i,j;
double dtmp;
FILE *fp;
if((fp=fopen("cutoff.ini","rb"))==NULL)
{
printf("File CUTOFF.INI no found.Use default data.");
iCOM=1;
dCIR=935.0;
dANG=75.0;
dSYN=90.0;
dMAX=15.0;
dRAT=5.88;
dACC=150.0;
DAT=10L;
}
else
{i=0;
while(i<8)
{if(fgets(buf1,80,fp)!=NULL)
{if(i==0) j=atoi(buf1+6);
else dtmp=atof(buf1+6);
switch(i)
{case 0:
if((j>=0)&&(j<=32)) iCOM=j;
else iCOM=1;
break;
case 1:
if(dtmp>750.0) dCIR=dtmp;
else dCIR=935.0;
break;
case 2:
if((dtmp>0.0)&&(dtmp<100.0)) dANG=dtmp;
else dANG=75.0;
case 3:
if((dtmp>0.0)&&(dtmp<=90.0)) dSYN=dtmp;
else dSYN=75.0;
case 4:
if((dtmp>0.0)&&(dtmp<100.0)) dMAX=dtmp;
else dMAX=15.0;
break;
case 5:
if((dtmp>0.0)&&(dtmp<20.0)) dRAT=dtmp;
else dRAT=5.88;
break;
case 6:
if((dtmp>0.0)&&(dtmp<1000.0)) dACC=dtmp;
else dACC=150.0;
break;
case 7:
DAT=(long int)dtmp;
break;
}
i++;
}
}
fclose(fp);
for(j=i;j<7;j++)
{if(j==0) iCOM=1;
else if(j==1) dCIR=935.0;
else if(j==2) dANG=75.0;
else if(j==3) dSYN=90.0;
else if(j==4) dMAX=15.0;
else if(j==5) dRAT=5.88;
else if(j==6) dACC=150.0;
}
}
}
unsigned char ReadChar(void)
{
union REGS regs;
regs.h.ah = 0;
int86(0x16,®s,®s);
return regs.h.al;
}
int CheckKeyBoard(void)
{
union REGS regs;
regs.h.ah = 1;
int86(0x16,®s,®s);
return (regs.x.cflag & 0x40) ? 0 : 1;
}
void hzstr(char *s,int x,int y)
{
int ilen;
int i,count11,count12;
char buff[2];
char buff1[3];
ilen=strlen(s);
count11=0;
count12=0;
for(i=0;i<ilen;i++)
{
if(s[i]<0)
{ buff1[0]=s[i];
buff1[1]=s[i+1];
buff1[2]='\0';
i++;
drwhzstr(buff1,x+2+count11*16+count12*8,y+4,1,1,WHITE,SET);
count11++;
}
else
if(s[i]>0)
{ buff[0]=s[i];
buff[1]='\0';
drwstr(buff,x+2+count11*16+count12*8,y+4,1,1,WHITE,SET);
count12++;
}
}
}
int msg1box(char *msg)
{int ilen;
int x,y,xn,yn,ikey;
int i,count11,count12;
char buff[2];
char buff1[3];
ilen=strlen(msg);
if(ilen<25) ilen=25;
count11=0;
count12=0;
x=400-ilen*4-7;
y=300-26;
xn=400+ilen*4+7;
yn=300+26;
strcpy(tmp1,"msgtmp.pcx");
pcxmake(x,y,xn,yn,tmp1);
drwfillbox(SET,GRAY,x,y,xn,yn);
drwfillbox(SET,YELLOW,x+2,y+2,xn-2,yn-2);
for(i=0;i<ilen;i++)
{
if (msg[i]<0)
{ buff1[0]=msg[i];
buff1[1]=msg[i+1];
buff1[2]='\0';
i++;
drwhzstr(buff1,x+15+count11*16+count12*8,y+7,1,1,RED,XOR);
count11++;
}
else
if (msg[i]>0)
{buff[0]=msg[i];
buff[1]='\0';
drwstr(buff,x+15+count11*16+count12*8,y+7,1,1,RED,XOR);
count12++;
}
}
strcpy(buff,"OK");
drwfillbox(SET,BLUE,400-21,300+3,400+21,300+19);
drwbox(XOR,RED,400-21,300+3,400+21,300+19);
drwstr(buff,400-16,300+3,1,2,GREEN,XOR);
ikey=getkey();
pcxput(SET,x,y,tmp1);
return ikey;
}
int drwhzstr2(char *s,int x,int y,int m,int n,
int col,int mode)
{ unsigned char dot[16][2],qm,wm;
long offset1;
int countw;
char l;
char str111[2];
register i,j,k,mm,nn,mask;
FILE *fpHZ;
if((fpHZ=fopen("hzk16","rb"))==0)
{printf("Error: HZK16 can't open.\n");
return FALSE;
}
l='0';
countw=0;
while(*s)
{ qm=(unsigned char)(s[0]-0xa1);
s+=1;
wm=(unsigned char)(s[0]-0xa1);
while (countw<10)
{
str111[0]=l;
str111[1]='.';
str111[2]='\0';
drwstr(str111,x,y,1,1,RED,mode);
x=x+16;
offset1=((long)qm*94+(long)wm+countw-6)*32;
s+=1;
fseek(fpHZ,offset1,SEEK_SET);
for(i=0;i<=15;i++)
{for(j=0;j<2;j++)
{ dot[i][j]=fgetc(fpHZ);
mask=0x80;
for(k=0;k<=7;k++)
{if (dot[i][j]&mask)
{for(nn=0;nn<n;nn++)
{for(mm=0;mm<m;mm++)
drwpoint(mode,col,x+(j*8+k)*n+nn,y+i*m+mm);
}
}
mask=mask>>1;
}
}
}
countw=countw+1;
l=l+1;
x+=16*n;
}
}
fclose(fpHZ);
}
void SetDisplayMode(unsigned char mode)
{
union REGS regs;
regs.h.ah = 0;
regs.h.al = mode;
int86(0x10,®s,®s);
}
void drwbutton(char *phstr,char *str,int x,int y,PixelMode i,int col11)
{
int k,j;
int xn,yn;
k=strlen(phstr);
j=strlen(str);
xn=x+j*8;
yn=y+2+16+14+16+2;
drwline(i,7,x,y,xn,y);
drwline(i,7,x,y-1,xn+1,y-1);
drwline(i,7,x,y-2,xn+2,y-2);
drwline(i,7,x,y-2,x,yn);
drwline(i,7,x-1,y-2,x-1,yn+1);
drwline(i,7,x-2,y-2,x-2,yn+2);
drwline(i,0,xn+2,y-1,xn+2,yn+2);
drwline(i,0,xn+1,y,xn+1,yn+2);
drwline(i,0,xn,y+1,xn,yn+2);
drwline(i,0,x-1,yn+2,xn+2,yn+2);
drwline(i,0,x,yn+1,xn+2,yn+1);
drwline(i,0,x+1,yn,xn+2,yn);
drwfillbox(i,col11,x+1,y+1,xn-1,yn-1);
drwstr(phstr,x+(xn-x)/2-k*16/2,y+4,1,2,BLACK,i); /*x+(j*16)/2-(8*k)/2,y+2,1,1,0,i);*/
/*drwstring(i,5,8,text7,732,554); */
drwhzstr(str,x+2,y+2+16+14,1,1,RED,i);
}
void borrow(int x1,int x2,int y1,int y2,int col,int high)
{
int ok;
int xs,ys,xe,ye;
ok=TRUE;
drwfillbox(SET,col,x1,y1,x2,y2);
xs=x2;
ys=y1-high;
xe=xs;
ye=y2+high;
while (ok)
{
drwline(SET,col,xs,ys,xs,ye);
xs=xs+1;
/* xe=xs; */
ys=ys+1;
ye=ye-1;
if (ys==ye)
{drwpoint(SET,col,xs,ys);
ok=FALSE;
}
}
}
void map(void)
{
char buf[80],buf1[80];
drwbox(SET,lPINK,0,0,800,600);
drwbox(SET,lPINK,1,1,799,599);
drwbox(SET,lPINK,2,2,798,598);
drwfillbox(SET,GRAY,3,3,797,597);
drwline(SET,lPINK,2,22,799,22);
drwline(SET,lPINK,2,22,799,22);
drwfillbox(SET,WHITE,3,3,798,21);
strcpy(buf,"瓦楞纸板生产线换单系统:横切机控制"); /*自动换单系统--横切机控制");*/
drwhzstr(buf,4,5,1,1,lBLUE,SET);
drwbox(SET,lYELLOW,5,25,795,80);
drwbox(SET,lYELLOW,6,26,794,79);
drwfillbox(SET,WHITE,7,27,793,78);
strcpy(buf,"湖北京山轻工机械股份有限公司");
drwhzstr(buf,202,36,1,2,lPINK,SET);
strcpy(buf,"地址:湖北省京山县新市镇轻机大道");
drwhzstr(buf,280,62,1,1,lPINK,SET);
strcpy(buf,"78");
drwstring(SET,lPINK,15,buf,536,64);
strcpy(buf,"号");
drwhzstr(buf,552,62,1,1,lPINK,SET);
drwbox(SET,lYELLOW,5,86,795,222);
drwbox(SET,lYELLOW,6,87,794,221);
drwfillbox(SET,lCYAN,7,88,793,220);
drwbox(SET,GREEN,9,90,116,148);
drwbox(SET,GREEN,10,91,115,147);
drwfillbox(SET,lBLUE,11,92,114,146);
strcpy(buf,"速");
drwhzstr(buf,16,103,2,3,WHITE,SET);
drwhzstr(buf,15,103,2,3,WHITE,SET);
strcpy(buf,"度");
drwhzstr(buf,66,103,2,3,WHITE,SET);
drwhzstr(buf,65,103,2,3,WHITE,SET);
/*生产数量*/
drwbox(SET,GREEN,119,90,389,148);
drwbox(SET,GREEN,120,91,388,147);
drwfillbox(SET,lBLUE,121,92,387,146);
strcpy(buf,"生产数量");
drwhzstr(buf,169,103,2,3,WHITE,SET);
drwhzstr(buf,168,103,2,3,WHITE,SET);
/*剩余数量*/
drwbox(SET,GREEN,392,90,650,148);
drwbox(SET,GREEN,393,91,649,147);
drwfillbox(SET,lBLUE,394,92,648,146);
strcpy(buf,"剩余数量");
drwhzstr(buf,428,103,2,3,WHITE,SET);
drwhzstr(buf,427,103,2,3,WHITE,SET);
/*废品*/
drwbox(SET,GREEN,653,90,793,148);
drwbox(SET,GREEN,654,91,792,147);
drwfillbox(SET,RED,655,92,791,146);
strcpy (buf,"废");
drwhzstr(buf,667,104,2,3,WHITE,SET);
drwhzstr(buf,666,103,2,3,WHITE,SET);
strcpy(buf,"品");
drwhzstr(buf,732,104,2,3,WHITE,SET);
drwhzstr(buf,731,103,2,3,WHITE,SET);
/************************************/
drwbox(SET,GREEN,9,152,116,215);
drwbox(SET,GREEN,10,153,115,214);
drwfillbox(SET,lBLUE,11,154,114,213);
drwbox(SET,GREEN,119,152,389,215);
drwbox(SET,GREEN,120,153,388,214);
drwfillbox(SET,lBLUE,121,154,387,213);
drwbox(SET,GREEN,392,152,650,215);
drwbox(SET,GREEN,393,153,649,214);
drwfillbox(SET,lBLUE,394,154,648,213);
drwbox(SET,GREEN,653,152,793,215);
drwbox(SET,GREEN,654,153,792,214);
drwfillbox(SET,RED,655,154,791,213);
drwbox(SET,RED,5,226,795,540);
drwbox(SET,RED,6,227,794,539);
drwfillbox(SET,BLACK,7,228,793,538);
drwfillbox(SET,CYAN,9,230,72,250);
strcpy(buf,"工号");
drwfillbox(SET,CYAN,74,230,115,250);
drwhzstr(buf,76,232,1,1,lPINK,SET);
strcpy(buf,"定单号");
drwfillbox(SET,CYAN,117,230,169,250);
drwhzstr(buf,119,232,1,1,lPINK,SET);
drwfillbox(SET,RED,9,260,72,280);
strcpy(buf,"已生产");
drwhzstr(buf,20,262,1,1,WHITE,SET);
drwfillbox(SET,GREEN,9,288,72,308);
strcpy(buf,"生产中");
drwhzstr(buf,20,290,1,1,lPINK,SET);
drwfillbox(SET,BLUE,9,316,72,336);
strcpy(buf,"待生产");
drwhzstr(buf,20,318,1,1,RED,SET);
strcpy(buf,"纸质");
drwfillbox(SET,CYAN,171,230,550,250);
drwhzstr(buf,353,232,1,1,lPINK,SET);
strcpy(buf,"纸宽");
drwfillbox(SET,CYAN,552,230,593,250);
drwhzstr(buf,555,232,1,1,lPINK,SET);
strcpy(buf,"长度");
drwfillbox(SET,CYAN,595,230,636,250);
drwhzstr(buf,600,232,1,1,lPINK,SET);
strcpy(buf,"数量");
drwfillbox(SET,CYAN,638,230,748,250);
drwhzstr(buf,678,232,1,1,lPINK,SET);
strcpy(buf,"限速");
drwfillbox(SET,CYAN,750,230,791,250);
drwhzstr(buf,757,232,1,1,lPINK,SET);
strcpy(buf1,"F1");
strcpy(buf,"定单输入");
drwbutton(buf1,buf,8,545,SET,44);
strcpy(buf1,"F2");
strcpy(buf,"强制换单");
drwbutton(buf1,buf,88,545,SET,44);
strcpy(buf1,"F3");
strcpy(buf,"定单保存");
drwbutton(buf1,buf,167,545,SET,44);
strcpy(buf1,"F4");
strcpy(buf,"定单浏览");
drwbutton(buf1,buf,247,545,SET,44);
strcpy(buf1,"F5");
strcpy(buf,"定单上载");
drwbutton(buf1,buf,326,545,SET,44);
strcpy(buf1,"F6");
strcpy(buf,"生产定单");
drwbutton(buf1,buf,406,545,SET,44);
strcpy(buf1,"F7");
strcpy(buf,"自动换单");
drwbutton(buf1,buf,485,545,SET,44);
strcpy(buf1,"F8");
strcpy(buf,"取消换单");
drwbutton(buf1,buf,565,545,SET,44);
strcpy(buf1,"+/-");
strcpy(buf,"废品计数");
drwbutton(buf1,buf,644,545,SET,44);
strcpy(buf1,"ESC");
strcpy(buf,"退出系统");
drwbutton(buf1,buf,725,545,SET,44);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -