Specifications

CONSTRUCTION
RemoveMenu(MenuID);
return(0);
}
else
{
if(prevMenu!=NONE)
{
RemoveMenu(MenuID);
return(ShowMenu(prevMenu));
}
}
break;
case RIGHT_ARROW:
if(subMenu[CurSelect]!=NONE)
{
RetVal=ShowMenu(subMenu[CurSelect]);
if(RetVal!=0)
{
RemoveMenu(MenuID);
return(RetVal);
}
}
else
{
if(nextMenu!=NONE)
{
RemoveMenu(MenuID);
return(ShowMenu(nextMenu));
}
}
break;
case DOWN_ARROW:
textbackground(LIGHTGRAY);
if(Enabled[CurSelect])
textcolor(BLACK);
else
textcolor(BROWN);
gotoxy(StartX+1,StartY+CurSelect+1);
cprintf(“ ”);
for(j=0;j<longLength+1;j++)
if(j<strlen(String[CurSelect]))
cprintf(“%c”,String[CurSelect][j]);
else
cprintf(“ ”);
CurSelect++;
if(CurSelect==num_items) CurSelect=0;
while(String[CurSelect][0]==’-’)
{
if(CurSelect==num_items)
CurSelect=0;
else
CurSelect++;
}
break;
case UP_ARROW:
textbackground(LIGHTGRAY);
if(Enabled[CurSelect])
textcolor(BLACK);
else
textcolor(BROWN);
gotoxy(StartX+1,StartY+CurSelect+1);
cprintf(“ ”);
for(j=0;j<longLength+1;j++)
if(j<strlen(String[CurSelect]))
cprintf(“%c”,String[CurSelect][j]);
else
cprintf(“ ”);
CurSelect—;
if(CurSelect<0) CurSelect=num_items-1;
while(String[CurSelect][0]==’-’)
{
if(CurSelect<0)
CurSelect=num_items-1;
else
CurSelect—;
}
break;
}
}
}
void ButtonDisplay(int x1,int y1,char state
char *caption)
{
text_info tinfo;
gettextinfo(&tinfo);
int i;
if(state==ENABLE_NOTACTIVE) textcolor
(YELLOW);
if(state==ENABLE_ACTIVE) textcolor(WHITE);
if(state==DISABLE) textcolor(LIGHTGRAY);
textbackground(CYAN);
gotoxy(x1,y1);cprintf(“ %s ”,caption);
textbackground(LIGHTGRAY);textcolor(YELLOW);
cprintf(“%c”,220);
gotoxy(x1+1,y1+1);for(i=0;i<8;i++)cprintf(“%c”,223);
textattr(tinfo.attribute);
}
void ButtonPushed(int x1,int y1,char *caption)
{
text_info tinfo;
gettextinfo(&tinfo);
int i;
textbackground(LIGHTGRAY);textcolor(WHITE);
gotoxy(x1,y1);cprintf(“ ”);
gotoxy(x1,y1+1);cprintf(“ ”);
textbackground(CYAN);
gotoxy(x1+1,y1);cprintf(“ %s ”,caption);
delay(250);
gotoxy(x1,y1);cprintf(“ %s ”,caption);
textbackground(LIGHTGRAY);textcolor(YELLOW);
cprintf(“%c”,220);
gotoxy(x1,y1+1);cprintf(“ ”);for(i=0;i<8;i++)
cprintf(“%c”,223);
textattr(tinfo.attribute);
}
BOOL DisplayDialog(char mode)
{
int Control=0,ch;
int x=29,y=5,i=0,N=0;
char TempStr[40];TempStr[0]=0;
switch(mode)
{
case FILE_OPEN: Window(10,3,70,9,“Open
File”,LIGHTGRAY,YELLOW);break;
case FILE_SAVE: Window(10,3,70,9,“Save
File”,LIGHTGRAY,YELLOW);break;
case PLAYBACK_RATE: Window(10,3,70,9,”
Playback Rate”,LIGHTGRAY,YELLOW);break;
}
ButtonDisplay(25,7,ENABLE_NOTACTIVE,“
Ok ”);
ButtonDisplay(45,7,ENABLE_NOTACTIVE,“Cancel”);
textbackground(LIGHTGRAY);textcolor(YELLOW);
gotoxy(13,5);
if(mode==FILE_OPEN || mode==FILE_SAVE)
{
cprintf(“Enter Filename: ”);
strcpy(TempStr,sFileName);
N=39;
}
else
{
cprintf(“Playback Rate : ”);
strcpy(TempStr,sPlayBackRate);
N=5;
}
textbackground(BLUE);textcolor(WHITE);
cprintf(“ ”);
gotoxy(29,5);cprintf(“%s”,TempStr);
i=strlen(TempStr);
x+=i;
for(;;)
{
switch(Control)
{
case 0:
_setcursortype(_NORMALCURSOR);
textbackground(BLUE);textcolor(WHITE);
ButtonDisplay(45,7,ENABLE_NOTACTIVE,“Cancel”);
gotoxy(x,y);
break;
case 1:
_setcursortype(_NOCURSOR);
ButtonDisplay(25,7,ENABLE_ACTIVE,“ Ok ”);
break;
case 2:
ButtonDisplay(45,7,ENABLE_ACTIVE,“Cancel”);
ButtonDisplay(25,7,ENABLE_NOTACTIVE,“
Ok ”);
break;
}
ch=getch();
if(ch==0) ch=getch()+300;
ch+=300;
switch(ch)
{
case TAB:
Control=(++Control)%3;
break;
case ESCAPE:
_setcursortype(_NOCURSOR);
ButtonPushed(45,7,“Cancel”);
ch=1; Control=2;
break;
case ENTER:
_setcursortype(_NOCURSOR);
ButtonPushed(25,7,“ Ok “);
ch=1;Control=1;
break;
case SPACE:
if(Control==2){_setcursortype(_NOCURSOR);
ButtonPushed(45,7,“Cancel”);ch=1;}
if(Control==1){_setcursortype(_NOCURSOR);
ButtonPushed(25,7,“ Ok ”);ch=1;}
break;
case BACK_SPACE:
if(Control==0 && i>0)
{
gotoxy(—x,y);
cprintf(“ ”);
i—;
TempStr[i]=0;
gotoxy(29,5);
cprintf(“%s”,TempStr);
}
break;
default:
ch-=300;
if(ch<300 && i<N)
{
TempStr[i++]=(char)ch;
TempStr[i]=0;
gotoxy(29,5);
cprintf(“%s”,TempStr);
x++;
}
break;
}
if(ch==1) break;
}
textbackground(BLUE);textcolor(WHITE);
for(ch=3;ch<=9;ch++)
}
gotoxy(10,ch);
for(i=10;i<=70;i++)
cprintf(“ ”);
}
if(Control==1)
{
if(mode==FILE_SAVE || mode==FILE_OPEN)
strcpy(sFileName,TempStr);
if(mode==PLAYBACK_RATE)strcpy(sPlayBackRate,
TempStr);
return(TRUE);
}
return(FALSE);
}
79