?? input_p.c
字號:
#include <string.h>
#include <stdlib.h>
#include <graphics.h>
#include <key.inc>
#include <bio.inc>
#include <menu.inc>
#include "feedef.h"
/* function : get the start point(phone no.) and length to be operated
* called by :
* caller:
* date : 1993.9.22
*/
UC inp_phid_num(UL *no, UI *num, UC opflg1, UC opflg2)
{
UC flag;
TABLE_STRUCT phid_num_tbl = {H_BX+10, H_BY-40, 40, 40, 2, 2, {130, 100}, 7};
message_disp(8,"↓↑選擇 Enter 輸入 F1 確認(rèn) ESC 取消"); /* Up,Dn: move,Enter: switch */
pop_back(H_BX, H_BY-45, H_BX+255, H_BY+100, 7);
draw_table(&phid_num_tbl);
disp_phid_num(opflg1, opflg2);
set_finger_color(Dsp_clr.fng_clr);
locate_finger(0, 1);
flag = input_proc(no, num, opflg2);
message_end();
rid_pop();
return(flag);
}
/* function : display all the HZ for inputing phoneid and number
* called by : input_phid_num()
* date : 1993.11.5
*/
void disp_phid_num(UC opflg1, UC opflg2)
{
int i, j;
UI x, y;
UNIT_STRUCT cur_unit;
if( opflg1 == PRINT )
hz16_disp(H_BX+58, H_BY-25,"設(shè) 定 打 印 范 圍",BLACK);
else
hz16_disp(H_BX+58, H_BY-25,"設(shè) 定 查 詢 范 圍",BLACK);
j = 0;
for(i=0; i<2; i++)
{
cur_unit.unit_x = i;
cur_unit.unit_y = j;
get_certain(&cur_unit);
x = cur_unit.dot_sx+5;
y = cur_unit.dot_sy+8;
switch(i)
{
case 0: /* start point of phone no */
if(opflg2 == PHONE_NO)
outf(x, y, 7, BLACK, "起始分機(jī)號碼");
else if(opflg2 == DEPT_NO)
outf(x, y, 7, BLACK, "起始戶頭號碼");
else
outf(x-8, y, 7, BLACK, "起始授權(quán)用戶號碼");
break;
case 1: /* phone number */
if( opflg1 == PRINT )
{
if(opflg2 == PHONE_NO)
outf(x, y, 7, BLACK, "打印分機(jī)數(shù)量");
else if(opflg2 == DEPT_NO)
outf(x, y, 7, BLACK, "打印戶頭數(shù)量");
else
outf(x-8, y, 7, BLACK, "打印授權(quán)用戶數(shù)量");
}
else
{
if(opflg2 == PHONE_NO)
outf(x, y, 7, BLACK, "查詢分機(jī)數(shù)量");
else if(opflg2 == DEPT_NO)
outf(x, y, 7, BLACK, "查詢戶頭數(shù)量");
else
outf(x-8, y, 7, BLACK, "查詢授權(quán)用戶數(shù)量");
}
break;
default:
break;
}
}
j = 1;
for(i=0; i<2; i++)
{
cur_unit.unit_x = i;
cur_unit.unit_y = j;
get_certain(&cur_unit);
x = cur_unit.dot_sx+5;
y = cur_unit.dot_sy+8;
switch(i)
{
case 0:
draw_back(x, y-4, x+90, y+22, 11);
break;
case 1:
draw_back(x, y-4, x+90, y+22, 11);
break;
}
}
return;
}
/* function :
* called by :
* date : 1993.11.5
*/
UC input_proc(UL *no, UI *num, UC opflg1)
{
UC result=0;
UC esc=0, flag;
UC pflg=0, nflg=0;
UC back_in=5;
UC number[7]="";
UC phone[10]="";
UC usrno[5]="";
UI input, x, y;
PHONE_STRUCT *tbl;
AUTHCD_STRUCT *atbl;
UNIT_STRUCT cur_unit;
USERS_STRUCT *utbl;
while(1)
{
input=get_key1();
get_current(&cur_unit);
switch(input)
{
case ESC:
esc = 1;
break;
case F1:
esc = 2;
break;
case UP: /* GO TO THE LAST ROW */
move_finger(0,1);
break;
case DOWN: /* GO TO THE NEXT ROW */
move_finger(1,1);
break;
case ENTER:
x = cur_unit.dot_sx+10;
y = cur_unit.dot_sy+8;
switch(cur_unit.unit_x)
{
case 0:
do
{
hide_finger();
if(opflg1 == PHONE_NO)
result = get_no(x, y, 18, 60, back_in,8,phone,0x00);
else if(opflg1 == AUTH_CD)
result = get_no(x, y, 18, 60, back_in,4,phone,0x00);
else
result = get_no(x, y, 18, 60, back_in,4,usrno,0x00);
echo_finger();
}while(!result);
if(result) /* valid input */
{
pflg=1;
move_finger(1,1);
}
else
{
pflg=0;
}
break;
case 1:
do
{
hide_finger();
result = get_no(x,y,18,60,back_in,6,number,0x00);
echo_finger();
}while(!result);
if(result) /* valid input */
{
nflg=1;
move_finger(0,1);
}
else
{
nflg=0;
}
break;
default:
sound_alarm();
break;
} /* end of "switch(cur_unit.unit_x)" */
break; /* ENTER */
default:
sound_bell();
break;
} /* end of switch(input) */
if(esc != 0) break;
} /* END OF WHILE */
if(esc == 1)
{
message(CANCEL_INPUT);
return(esc);
}
else if(pflg != 0)
{
if(opflg1 == PHONE_NO)
{
load_phone_tbl();
Newlen = phone_tbl_len();
/* judge whether the phone number exists or not */
tbl = binary_search(phone);
if(tbl == NULL) /* can not find the phone_number */
{
unload_phone_tbl();
message(NO_NOT_EXIST);
return(1);
}
*no = atol(phone);
unload_phone_tbl();
if(nflg == 0)
*num = 1;
else
*num = atoi(number);
return(2);
}
else if(opflg1 == DEPT_NO)
{
load_user_tbl();
UNewlen = user_tbl_len();
if(UNewlen == 0)
{
unload_user_tbl();
message(USER_FILE_ERR);
return(1);
}
*no = atol(usrno);
utbl = binary_user(*no);
if(utbl == NULL)
{
unload_user_tbl();
message(UNO_NOT_EXIST);
return(1);
}
unload_user_tbl();
if(nflg == 0)
*num = 1;
else
*num = atoi(number);
return(2);
}
else if(opflg1 == AUTH_CD)
{
flag = load_authcd_tbl(0);
if(flag == 0) /* charge.pho does not exist */
{
message(AUTHCD_FILE_ERR);
return(1); /* cancel */
}
ANewlen = authcd_tbl_len();
*no = atol(phone);
atbl = binary_authcd(*no);
if(atbl == NULL) /* can not find the phone_number */
{
unload_authcd_tbl();
message(AUTHCD_NOT_EXIST);
return(1);
}
unload_authcd_tbl();
if(nflg == 0)
*num = 1;
else
*num = atoi(number);
return(2);
}
}
else
{
message(INVALID_INPUT);
return(1);
}
return(1);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -