📄 chat.c
字号:
r.h.bh=0;
int86(0x10,&r,&r);
}
/* Create assign scope border string */
void draw_border( int startx,int starty,int endx,int endy)
{
int i;
for(i=starty+1;i<endy;i++)
{
goto_xy(startx,i);
putchar(179);
goto_xy(endx,i);
putchar(179);
}
for(i=startx+1;i<endx;i++)
{
goto_xy(i,starty);
putchar(196);
goto_xy(i,endy);
putchar(196);
}
goto_xy(startx,starty);
putchar(218);
goto_xy(endx,starty);
putchar(191);
goto_xy(startx,endy);
putchar(192);
goto_xy(endx,endy);
putchar(217);
}
/* Create universal Three-Dimentsion window */
void Box3D(int x1,int y1,int x2,int y2,int ProminentBorder)
{
int i,j;
setfillstyle(1,DARKGRAY);
bar(x1,y1,x2+6,y2+6); //background color
setfillstyle(1,LIGHTGRAY);
bar(x1+2,y1+2,x2+6,y2+6); //background color
for(j=0;j<=5;j+=5) //margin distance in border
for(i=0;i<=1;i++) //margin thicken in border
{
if(ProminentBorder==1)
setcolor(15);
else
setcolor(8);
if(j==5&&ProminentBorder==1)
setcolor(8);
else
setcolor(15);
line(x1+i+j,y1+i+j,x1+i+j,y2-i-j+5); //left margin
line(x2+i+j,y1-i-j+6,x2+i+j,y2+i+j); //right margin
line(x1+i+j,y1+i+j,x2-i-j+5,y1+i+j); //top margin
line(x1-i-j+6,y2+i+j,x2+i+j,y2+i+j); //bottom margin
}
}
/* Create universal Three_Dimension prominent border */
void Border3D(int startx,int starty,int endx,int endy,int thick,int ProminentFlag)
{
if(ProminentFlag==1)
setcolor(BLACK);
else
setcolor(WHITE);
line(startx,starty,endx,starty);
line(startx,starty,startx,endy);
line(startx-thick,endy+thick,endx+thick,endy+thick);
line(endx+thick,starty-thick,endx+thick,endy+thick);
if(ProminentFlag==1)
setcolor(WHITE);
else
setcolor(BLACK);
line(startx,endy,endx,endy);
line(endx,starty,endx,endy);
line(startx-thick,starty-thick,endx+thick,startx-thick);
line(startx-thick,starty-thick,startx-thick,endy+thick);
}
/* Create universal Three-Dimension prominent font */
void List3DFont(int x,int y,int FontSize,int FontColor,int ProminentFlag,char *string)
{
settextstyle(DEFAULT_FONT,HORIZ_DIR,FontSize); /* Horizon direct font magnify four_time size */
if(ProminentFlag==1)
setcolor(BLACK);
else
setcolor(WHITE);
outtextxy(x,y,string);
if(ProminentFlag==1)
setcolor(WHITE);
else
setcolor(BLACK);
outtextxy(x-2,y-2,string);
setcolor(FontColor);
outtextxy(x-1,y-1,string);
}
/* Create Three-Dimension Horizon or vertical separator string */
void TDSeparator(int startx,int starty,int endx,int endy,int direct,int ProminentStatus)
{
if(ProminentStatus==1) /* prominent horizon line */
setcolor(WHITE);
else
setcolor(BLACK); /* obscure horizon line */
line(startx,starty,endx,endy);
if(ProminentStatus==1)
setcolor(BLACK);
else
setcolor(WHITE);
if(direct==1) /* Horizon direct line */
line(startx-1,starty+2,endx+1,endy+2);
else /* verticle direct line */
line(startx+2,starty-1,endx+2,endy+1);
}
/* Create universal Three-Dimension prominent button */
void Button3D(int startx,int starty,int endx,int endy,int ProminentFlag)
{
if(ProminentFlag==1)
{
setcolor(WHITE);
setfillstyle(1,DARKGRAY);
}
else
{
setcolor(DARKGRAY);
setfillstyle(1,WHITE);
}
line(startx,starty,endx,starty);
line(startx,starty,startx,endy);
bar(startx-1,endy+1,endx+1,endy+1);
bar(endx+1,starty-1,endx+1,endy+1);
if(ProminentFlag==1)
{
setcolor(DARKGRAY);
setfillstyle(1,WHITE);
}
else
{
setcolor(WHITE);
setfillstyle(1,DARKGRAY);
}
line(startx,endy,endx,endy);
line(endx,starty,endx,endy);
bar(startx-1,starty-1,endx-1,starty);
bar(startx-1,starty-1,startx-1,endy);
}
/* Up move menubar */
void upbar(int y)
{
int i;
typedef struct text_struct{
unsigned char ch;
unsigned char attr;
}text;
text t;
for(i=27;i<=53;i++)
{
gettext(i,y,i,y,&t);
t.attr=0x1f; /* white foreground & blue background */
puttext(i,y,i,y,&t);
if(y==12){
gettext(i,14,i,14,&t);
t.attr=0x4f;
puttext(i,14,i,14,&t);
gotoxy(3,14);
}
else{
gettext(i,y-1,i,y-1,&t);
t.attr=0x4f; /* white foreground & red background */
puttext(i,y-1,i,y-1,&t);
gotoxy(3,y-1);
}
}
return;
}
/* Down move menubar */
void downbar(int y)
{
int i;
typedef struct text_struct{
unsigned char ch;
unsigned char attr;
}text;
text t;
for(i=27;i<=53;i++)
{
gettext(i,y,i,y,&t);
t.attr=0x1f;
puttext(i,y,i,y,&t);
if(y==14){
gettext(i,12,i,12,&t);
t.attr=0x4f;
puttext(i,12,i,12,&t);
gotoxy(3,12);
}
else{
gettext(i,y+1,i,y+1,&t);
t.attr=0x4f;
puttext(i,y+1,i,y+1,&t);
gotoxy(3,y+1);
}
}
return;
}
/* Main menu program segment */
void main(int argn,char *args[])
{
int cls_key,ky,x,y;
int gdriver=DETECT,gmode;
char ch;
switch(argn)
{
case 1:
break;
case 2:
if(args[1][0]=='/'&&(toupper(args[1][1])=='?'||toupper(args[1][1])=='H'))
{
textattr(YELLOW);
cprintf(" Please refer to readme file! \n");
textcolor(15);
normvideo();
cprintf("\n\r");
exit(0);
}
else
if(args[1][0]=='/'&&toupper(args[1][1])=='V')
{
textcolor(YELLOW);
cprintf("CHAT freeware, Beta version 1.0.0. Written by ");
textattr(YELLOW+BLINK);
cprintf("Jingzhou Xu");
textattr(YELLOW);
cprintf("(Future Studio) 1998.06\n");
textcolor(WHITE);
normvideo();
cprintf("\n\r");
exit(0);
}
default:
textcolor(2);
cprintf("\rUsage:\n\r");
cprintf(" CHAT /v Display version information \n\r");
cprintf(" CHAT /? or /h Display help information \n\r");
cprintf(" CHAT / Display parameters information");
textcolor(15);
normvideo();
cprintf(" \n\r");
exit(0);
}
if(registerbgidriver(EGAVGA_driver)<0)
{
printf("MONITOR display is not EGAVGA graphics mode!");
exit(1);
}
initgraph(&gdriver,&gmode,"");
/* setfillstyle(1,CYAN);
bar(1,1,640,480);*/
/* Display Three-Dimension Window and Three-Dimension Font */
Box3D(5,10,625,305,1);
List3DFont(83,103,2,BLACK,1,"IPX/SPX COMMUNICATION PROGRAM");
List3DFont(80,100,2,YELLOW,1,"IPX/SPX COMMUNICATION PROGRAM");
/* Create Three-dimension button */
Button3D(65,80,555,130,0);
List3DFont(203,153,2,BLACK,1,"VERSION 1.0.0");
List3DFont(200,150,2,CYAN,1,"VERSION 1.0.0");
// Button3D(185,140,420,170,0);
TDSeparator(190,170,420,170,1,0);
List3DFont(158,203,2,BLACK,1,"AUTHOR: Jingzhou Xu");
List3DFont(155,200,2,GREEN,1,"AUTHOR: Jingzhou Xu");
// Button3D(140,190,470,220,0);
TDSeparator(140,220,470,220,1,0);
Box3D(80,330,560,375,1); /* Create prominent command button */
Button3D(86,336,560,375,1);
List3DFont(108,353,2,BLACK,0,"Press any key to continue...");
List3DFont(105,350,2,LIGHTBLUE,1,"Press any key to continue...");
// TDSeparator(8,350,450,350,1,0);
/* Create Three-Dimension prominent window */
Button3D(32,32,603,288,1); //Create Three-Dimension button
Border3D(30,30,605,290,2,1); //Create Three-Dimension border
/* Initializtion Mouse */
InitMouse();
if(mouse_installed==FALSE)
{
List3DFont(190,450,1,LIGHTRED,1,"Mouse or Mouse Drive not installed!");
getch();
}
else
{
ShowMouse();
while(!getch()) /* Pressed any key exit graphic mode */
{
GetMouseXY(&x,&y);
if(x>=86&&x<=560&&y>=336&&y<=375)
{
if(GetPressInfo(0)==1) /* Mouse left key pressed */
{
Button3D(86,336,560,375,0);
List3DFont(108,353,2,BLACK,0,"Press any key to continue...");
List3DFont(105,350,2,LIGHTBLUE,1,"Press any key to continue...");
}
if(GetReleaseInfo(0)==1) /* Mouse left key released */
{
Button3D(86,336,560,375,1);
List3DFont(108,353,2,BLACK,0,"Press any key to continue...");
List3DFont(105,350,2,LIGHTBLUE,1,"Press any key to continue...");
break;
}
}
}
}
closegraph();
do {
textmode(C80); /* 25 line && 80 column && textcolor mode */
textbackground(WHITE);
window(1,1,25,80);
clrscr();
highvideo(); /* Software description */
/* textattr(BLACK+(WHITE<<4));
gotoxy(45,6);
cprintf("1.0.0"); */
textcolor(BLACK);
textbackground(WHITE);
gotoxy(22,4);
cprintf("IPX/SPX PROTOCOL COMMUNICATION PROGRAM\r\n");
gotoxy(32,6);
cprintf("Beta Version 1.0.0");
gotoxy(37,8);
cprintf("1998.06");
normvideo();
textbackground(BLACK); /* addition black shadow shape */
window(27,11,57,16);
clrscr();
textbackground(MAGENTA); /* light magenta background */
textcolor(RED);
window(25,10,55,15);
clrscr();
textbackground(BLUE);
textcolor(1);
window(27,11,53,14);
clrscr();
textcolor(WHITE);
gotoxy(8,2);
cprintf(" Relay chat \r\n");
gotoxy(8,3);
cprintf(" Transfer file \r\n");
gotoxy(8,4);
cprintf(" Exit "); /* blue background & white foreground */
y=12;
downbar(y-1);
/* ShowMouse(); // show mouse cursor */
do {
highvideo();
if(y==12){
textbackground(4);
textcolor(4);
gotoxy(9,2);
textcolor(14);
cputs("R");
textbackground(1);
textcolor(1);
gotoxy(27,4); /* first letter addition highlight && iron out cursor display */
clreol();
}
else {
textbackground(1);
textcolor(1);
gotoxy(9,2);
textcolor(14);
cputs("R");
}
if(y==13){
textbackground(4);
textcolor(4);
gotoxy(9,3);
textcolor(14);
cputs("T");
textbackground(1);
textcolor(1);
gotoxy(27,4);
clreol();
}
else {
textbackground(1);
textcolor(1);
gotoxy(9,3);
textcolor(14);
cputs("T");
}
if(y==14){
textbackground(4);
textcolor(4);
gotoxy(9,4);
textcolor(14);
cputs("E");
textcolor(4);
gotoxy(27,4);
clreol();
}
else {
textbackground(1);
textcolor(1);
gotoxy(9,4);
textcolor(14);
cputs("E");
}
gotoxy(27,4);
normvideo();
/* GetMouseXY(&x,&y);
if(x>=27&&x<=53)
{
if(y==12)
{
upbar(13);
break;
}
else
if(y==13)
{
upbar(14);
break;
}
else
if(y==14)
{
downbar(13);
break;
}
} */
ky=in_key();
switch(ky) {
case KEY_R:
case KEY_r: { y=12;
ky=KEY_ENTER;
}
break;
case KEY_T:
case KEY_t:{
y=13;
ky=KEY_ENTER;
}
break;
case KEY_E:
case KEY_e:{
y=14;
ky=KEY_ENTER;
}
break;
case KEY_ESC:{
y=14;
ky=KEY_ENTER;
break;
}
case KEY_DOWN:
if(y<14){
downbar(y);
y+=1;
}
else {
downbar(14);
y=12;
}
break;
case KEY_UP:
if(y>12) {
upbar(y);
y-=1;
}
else {
upbar(12);
y=14;
}
break;
}
}while(ky!=KEY_ENTER);
switch(y)
{
case 12:
relay_chat();
break;
case 13:
file_T();
break;
case 14:
ch='%';
break;
}
if(ch=='%') break;
}while(1);
/* Randomize generation to call clean screen function */
randomize();
cls_key=random(4);
Select_ScrCls(cls_key);
/* Display chat software usage tip */
printf("\rUsage:\n\r");
printf(" CHAT /v Display version information \n\r");
printf(" CHAT /? or /h Display help information \n\r");
printf(" CHAT / Display parameters information\n\r");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -