if(ch==13)break;
};
return ret;
};//*/
int View(int corr)
{
HideMouse();
setfillstyle(1,1);
bar(0,0,getmaxx(),getmaxy());
setcolor(4);
line(0,270,640,270);
line(0,0,7,7);
line(633,7,640,0);
line(0,270,7,263);
line(633,263,640,270);
line(0,270,7,277);
line(633,277,640,270);
line(0,480,7,473);
line(633,473,640,480);
rectangle(7,7,633,263);
rectangle(7,277,633,473);
setfillstyle(1,2);
bar(601,279,631,471);
settextstyle(0,0,3);
outtextxy(608,290,"F");
outtextxy(608,335,"I");
outtextxy(608,380,"N");
outtextxy(608,425,"D");
settextstyle(0,0,0);
rectangle(600,278,632,472);
rectangle(601,277,633,473);
setfillstyle(1,3);
bar(8,8,632,261);
bar(8,278,599,472);
bar(8,435,599,472);
setcolor(4);
int exitPrg=0,ret=0;
char cr;
int i=1,newi=1,botton, x, y;
Nadpis(1,1);
ShowMouse();
line(8,450,599,450);
while(exitPrg==0){
while(!kbhit()){Mousebut(&botton, &x, &y);
if(botton>0)
if((x>601)&&(x<631))
if((y>279)&&(y<471)){
i=Find();newi=i;i=1;};
};
cr=getch(); HideMouse();
switch(cr){
case 72:{i--;
if(i<1) {
i=1;
if(newi>1){newi--;};
};
Nadpis(newi,i);
break;};
case 80:{i++;if(i>8){i=8;newi++;};
Nadpis(newi,i);
break; };
case 62:i=Find();newi=i;i=1;break;
case 27:exitPrg=1;ret=-1;break;
case 13:{delay(300);ret=(newi+i-1);exitPrg=1;
break;};
};
textbackground(2); setfillstyle(1,10); ShowMouse();
};
HideMouse();
settextstyle(0,0,0);
return ret;
};
void deleteZap(void)
{
int exitdel=0;
char ch;
while (exitdel==0)
{
int t=View(2);
if(t==-1)break;
setbkcolor(1);
bar(100,100,500,200);
ch=getch();
if(ch==13){
for(int i=t; i<=nzap; i++){ Zap[i]=Zap[i+1];exitdel=1;};
};
};
}; //*/
void Correct(void)
{
int t=View(1);
setbkcolor(1);
if((t!=0)&&(t!=-1))
Zap[t].NewZap(1,t);
};
void EnterHandle(int regim)
{
cleardevice();
switch (regim)
{
case 1: Zap[nzap].NewZap(0,nzap);nzap++; break;
case 2: View(0); break;
case 3: Correct();break;
case 4: deleteZap();nzap--; break;
case 5: exitp=1; break;
};
cleardevice();
DrawMain(regim);
};
void Timeout()
{
setcolor(1);
lt=time(NULL);
outtextxy(445,460,mch);
mch=ctime(<);
setcolor(11);
outtextxy(445,460,mch);
setcolor(1);
};
int main()
{
int driver,mode,r;
int regim=1;
driver=DETECT;
mode=0;
LoadZap();
initgraph(&driver,&mode,"c:\borlandc\bgi");
setbkcolor(8);
DrawMain(regim);
ShowMouse();
exitp=0;
int x,y,button,timeR=0;
Mousebut(&button,&x,&y);
while (exitp==0)
{
timeR++;
if(timeR==-10) { Timeout();timeR=0; };
if (kbhit()) switch (getch())
{
case 27: exitp=1;
break;
case 80:regim=regim % 5 +1; DrawMain(regim);
break;
case 72:regim=regim==1?5:regim-1; DrawMain(regim);
break;
case 13:EnterHandle(regim);
};
Mousebut(&button,&x,&y);
if (button>0)
if ((x>555)&&(x<630))
if ((y>0)&&(y<80)) Information();
if (button>0)
{
if((x>255)&&(x<340))
{
if((y>100)&&(y<125))regim=1;
if((y>165)&&(y<185))regim=2;
if((y>225)&&(y<245))regim=3;
if((y>285)&&(y<305))regim=4;
if((y>345)&&(y<365))regim=5;
EnterHandle(regim);
};
};
};
SaveZap();
HideMouse();
restorecrtmode();
return 0;
};
void Mousebut(int *cbb,int *xx,int *yy)
{
int cb,x,y;
asm{
mov ax,05h
mov bx,0
int 33h
mov cb,bx
mov x,cx
mov y,dx
};
*xx=x;*yy=y;*cbb=cb;
};
Приложение В
Блок-схема