📄 f_sm.c
字号:
Do_Clear_Screen(6,32,7,95); //clear the menu index field
break;
case 5: //cut number
PrevMenu=CurMenu;
CurMenu=MENU_BOOK_END;
CurPhoneNumLen=app_c2a(psmt->index[CurItem].peernum,12,CurPhoneNum);
CurText=tmpCurText;
CurTextLen=0;
err=EnterPhoneEdit();
if(err==1){
break;//return(1);
}
else if(err==2){
MFunc_InsertPhoneBookItem(CurText, CurTextLen, CurPhoneNum, CurPhoneNumLen, 0);
}
CurMenu=PrevMenu;
break;
}
}
}
if(CurItem >= SMTBLLEN){
Do_Clear_Screen(2,0,5,127);
app_printf(TextNoRecord,3,2,0);
}
break;
case KEY_FUNC2: //Cancel
return(0);
case KEY_C: //cancel
return(0);
case KEY_UP:
CurItem = psmt->index[CurItem].previous;
Ctr--;
for(i = 0;i<3;i++){
if(psmt->index[CurItem].peernum[0] == 0xff) {
CurItem = psmt->index[CurItem].previous;
Ctr = psmt->numofSM-1;
}
else{
break;
}
}
break;
case KEY_DOWN:
CurItem = psmt->index[CurItem].next;
Ctr++;
break;
}
}
}
INT8U MFunc_ReadSM(INT8U item,INT8U type){
INT8U cur,line,pos,len,i,FinishShowed,err,godown;
INT8U rom *ptr;
INT8U rom *ptr2;
INT8U fhdl;
SM_TBL * psmt;
fhdl = file_open(usrpri_file, (INT8U rom **)&psmt);
psmt = &((F_UserPrivate *)psmt)->SMTbl[type];
ptr = psmt->data[item].data;//&SystemFile.SMTbl[cur].SMContent[0];
line = 2;
pos = 0;
len = psmt->data[item].len;//SystemFile.SMTbl[cur].SMLength;
LenPtr = 0;
FinishShowed = FALSE;
godown = TRUE;
Display_Menu_Icon(0,&PIC_SELECTION);
Display_Menu_Icon(1,&PIC_RETURN);
Do_Clear_Screen(6,32,7,95); //clear the menu index field
for(;;){
if(godown == TRUE){
if(len == 0 ){
if(FinishShowed == FALSE){
Do_Clear_Screen(line,0,5,127);
app_printf(TextSmsOver,6,line,0);
LenSave[LenPtr] = 0; //save the num of word in corrent screen
LenPtr++;
FinishShowed = TRUE;
if(line == 2) line = 4;
else line = 2;
}
}
else{
Do_Clear_Screen(line,0,line+1,127);
//In SMTbl, the former byte is the higher half_word, and the latter is the lower one.
i = MFunc_DisplayString(line, psmt->index[item].property, len, ptr);//SystemFile.SMTbl[cur].chrProperty, len, ptr);
LenSave[LenPtr] = i; //save the num of word in corrent screen
LenPtr++;
len -= i;
ptr += i;
if(line == 2) line = 4;
else line = 2;
}
}
if(line == 2 || FinishShowed == TRUE){
switch(MFunc_WaitForInput(0)){
case 0xff:
return(1);
case KEY_FUNC1: //Enter
i = MFunc_OperateSM(OperSMItem1, 6);
Display_Menu_Icon(0,&PIC_SELECTION);
Display_Menu_Icon(1,&PIC_RETURN);
if(i == 0xff){ //due to message MSG_MENU_CANCEL
//CurMenu=MENU_ROOT;
//MenuDisplayKey(CurMenu);
//Do_Clear_Screen(6,32,7,95); //clear the menu index field
return (1);
}
else if(i == 0xfe){ //doe to cancel
if(line == 2){
LenPtr --;
len += LenSave[LenPtr];
ptr -= LenSave[LenPtr];
LenPtr --;
len += LenSave[LenPtr];
ptr -= LenSave[LenPtr];
}
else{
LenPtr --;
len += LenSave[LenPtr];
ptr -= LenSave[LenPtr];
}
FinishShowed = FALSE;
godown = TRUE;
line = 2;
}
else if (i < 6){ //zwm changed
return (0xf0+i);
}
break;
case KEY_FUNC2: //Cancel
return(0);
case KEY_C: //Cancel
return(0);
case KEY_UP:
if(LenPtr >=3){
if(line == 2){
for(i=0; i<4; i++){
LenPtr --;
len += LenSave[LenPtr];
ptr -= LenSave[LenPtr];
}
}
else{
for(i=0; i<3; i++){
LenPtr --;
len += LenSave[LenPtr];
ptr -= LenSave[LenPtr];
}
}
FinishShowed = FALSE;
godown = TRUE;
line = 2;
}
else godown = FALSE;
break;
case KEY_DOWN:
if(FinishShowed == FALSE){
line = 2;
godown = TRUE;
}
break;
}
}
}
}
INT8U MFunc_OperateSM(INT16U rom *pItems, INT8U Num){
INT8U changecontent,Focus,err,CurItem,pos,i,retval;
INT8U rom *pMsg;
Display_Menu_Icon(0,&PIC_ACKNOWLEDGE);
Display_Menu_Icon(1,&PIC_RETURN);
Do_Clear_Screen(6,32,7,95); //clear the menu index field
Do_Clear_Screen(2,0,5,127);
for(i=0; i<Num; i++){
ItemSave[i] = pItems;
do{
pItems++;
}while(*pItems != 0);
pItems++;
}
Focus = 0;
CurItem = 0;
changecontent = TRUE;
i = 0;
for(;;){
if(changecontent == TRUE){
pos = 32;
Do_Clear_Screen(2,32,5,95); //clear the menu
pItems = ItemSave[i];
do{
Disp_Word(2,pos,*pItems,PIX16);
pItems++;
pos += 16;
}while(*pItems != 0);
pItems++;
pItems = ItemSave[i+1];
pos = 32;
do{
Disp_Word(4,pos,*pItems,PIX16);
pItems++;
pos += 16;
}while(*pItems != 0);
pItems++;
}
MFunc_Set_Focus(Focus);
pMsg = OSQPend(peventMenu,0,&err);
if((INT24U)pMsg > PTR_MAX){
if((INT24U)pMsg == MSG_MENU_CANCEL){
return(0xff);
}
}
else{
retval = 0xff;
switch(((MSG_KEYPRESS *)pMsg)->Key){
case KEY_FUNC1: //Enter
retval = CurItem;
break;
case KEY_FUNC2: //Cancel
retval = 0xfe;
break;
case KEY_C: //Cancel
retval = 0xfe;
break;
case KEY_UP:
if(CurItem != 0){
CurItem--;
if(Focus == 1){
Focus = 0;
changecontent = FALSE;
}
else{ //Fucus == 0
changecontent = TRUE;
i = i-1;
}
}
else changecontent = FALSE;
break;
case KEY_DOWN:
if(CurItem < Num-1){
CurItem++;
if(Focus == 0){
Focus = 1;
changecontent = FALSE;
}
else{ //Fucus == 1
i++;
changecontent = TRUE;
}
}
else changecontent = FALSE;
break;
}
Func_Clear_Msg(pMsg);
if(retval != 0xff) return(retval);
}
}
}
//In SMTbl (UNICODE), the former byte is the higher half_word, and the latter is the lower one.
INT8U MFunc_DisplayString(INT8U X, INT8U coding, INT8U len, INT8U rom * ptr){
INT8U pos,i;
INT16U Temp;
pos = 0;
if(coding != SM_UNICODE){
for(i=0; i<len;){
//how to process '\r' '\n' ??
Disp_Word(X, pos, *ptr , PIX8);
ptr++;
pos +=8;
i++;
if(pos == 128) return (i);
}
return (i);
}
else{ //SM_UNICODE
for(i=0; i<len/2;){
Temp = *ptr;
Temp = Temp<<8;
ptr++;
Temp += *ptr;
ptr++;
if((Temp & 0xff00) == 0){ //8 point wide
if(pos>(128-8)) return (i*2);
Disp_Word(X, pos, Temp, PIX8);
pos +=8;
}
else{
if(pos>(128-16)) return (i*2);
Disp_Word(X, pos, Temp, PIX16);
pos +=16;
}
i++;
}
if(len != i*2) return(len);
else return (i*2);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -