📄 phbook.c
字号:
WS_CHILD|BS_REGULAR,
LCD_WIDTH/2+LCD_HEIGHT/24+3,18,
LCD_HEIGHT/12,
LCD_HEIGHT/12,
browsewin,
0,
(char*)zi_last);
bt5 = CreateWindow( WNDCLASS_BUTTON,
"\\编辑态",
WS_CHILD|BS_REGULAR,
LCD_WIDTH/2+LCD_HEIGHT/8+6,18,
LCD_HEIGHT/12,
LCD_HEIGHT/12,
browsewin,
0,
(char*)zi_edit);
for(count = 0; count < DISP_NUM; count++)//XXX需要注意的是先暂时定显示为8行,以后需要加
{
bt[count] = CreateWindow(WNDCLASS_BUTTON,
NULL,
WS_CHILD|BS_REGULAR,
LCD_WIDTH/2-39,
(U16)(count * 21 + LCD_HEIGHT*68/240),
100,
21,
browsewin,
0,
NULL);
}
for(count = 0; count < DISP_NUM; count++)//XXX需要注意的是先暂时定显示为8行,以后需要加
{
st[count] = CreateWindow(WNDCLASS_STATIC,
NULL,
// WS_CHILD|BS_PEN_UP_CMD,
WS_CHILD|SS_TEXT,
LCD_WIDTH/2-79,
(U16)(count * 21 + LCD_HEIGHT*68/240),
40,
20,
browsewin,
0,
NULL);
}
low=0; //需要考虑是low=1 or low =0;
if(countall <= DISP_NUM)
{
high = 0;
endp=countall ;
}
else
{
high = countall -DISP_NUM;
endp=DISP_NUM;
}
startp=0;
hmenu = MAKELONG(low, high);
scroll = CreateWindow(WNDCLASS_SCROLL,
"Scroll",
WS_CHILD|SBS_VERT,
LCD_WIDTH/2+63,LCD_HEIGHT*68/240,
16,
146,
browsewin,
hmenu,
NULL);
if(countall >= DISP_NUM) //显示屏幕初始化
PhBookDetailDisplay(recordinf,cueinf,countall,0, DISP_NUM, bt,st);
else
PhBookDetailDisplay(recordinf,cueinf,countall,0, countall, bt,st);
if(isfirst == 1)//如果是第一条记录,则灰化第一和上条按键
{
EnableWindow(bt1,FALSE);
EnableWindow(bt2,FALSE);
}
if(islast == 1)////如果是最后一条记录,则灰化最后和下条按键
{
EnableWindow(bt3,FALSE);
EnableWindow(bt4,FALSE);
}
GroupOff(hGC,1, 1, LCD_WIDTH-1,LCD_HEIGHT-1);
while(!quit)
{
ASIXGetMessage(&msg, NULL, 0, 0);
switch(msg.message)
{
// 在此用户加入自己的消息处理
case WM_COMMAND:
if ( msg.lparam == bt1 )
{
// * thumbtype = TURN_TO_FIRST;
// quit = 1;
thisptr = head;
isneedfreshscr =1;
} else
if ( msg.lparam == bt2 )
{
// * thumbtype = TURN_BACK;
// quit = 1;
thisptr = thisptr->prev;
isneedfreshscr = 1;
} else
if ( msg.lparam == bt3 )
{
//* thumbtype = TURN_NEXT;
//quit = 1;
thisptr = thisptr->next;
isneedfreshscr = 1;
} else
if ( msg.lparam == bt4 )
{
// * thumbtype = TURN_TO_LAST;
// quit = 1;
thisptr = LinkJumpToPos(head,(S16)(len -1));
isneedfreshscr =1;
} else
if ( msg.lparam == bt5 )
{
*isturntoedit = 1;
*outputid = thisptr->ID;
quit = 1;
}
if(isneedfreshscr ==1)
{
memset( (P_VOID)recordinf, 0x0 , MAX_PHBOOKINFNUM*sizeof(P_S8));//初试化新的记录
memset( (P_VOID)cueinf, 0x0 , MAX_PHBOOKINFNUM*sizeof(P_S8));//初试化新的记录
EnableWindow(bt1,TRUE);
EnableWindow(bt2,TRUE);
EnableWindow(bt3,TRUE);
EnableWindow(bt4,TRUE);
ctel =0;cmob =0;cbp = 0;
isfirst = 0;islast = 0;
// thisptr = SearchThisidFrList(head,id);
if(thisptr->ID ==firstid)
isfirst = 1;
if(thisptr->ID == lastid)
islast = 1;
if(isfirst == 1)//如果是第一条记录,则灰化第一和上条按键
{
EnableWindow(bt1,FALSE);
EnableWindow(bt2,FALSE);
}
if(islast == 1)////如果是最后一条记录,则灰化最后和下条按键
{
EnableWindow(bt3,FALSE);
EnableWindow(bt4,FALSE);
}
nameptr = thisptr->name;
switch (thisptr->relation)
{
case FRIEND: relationptr = "朋友"; break;
case FAMILY: relationptr = "家人"; break;
case SCHMATE: relationptr = "同学"; break;
case COLLEAGUE: relationptr = "同事"; break;
case OTHERS: relationptr = "其他"; break;
default:break;
}
recordinf[0] = nameptr;
recordinf[1] = relationptr;
pos = 1;
for (count =0;count<(MAXTELNUM);count++)
{
if((P_S8)(*(thisptr->tel[count]))!= NULL)
{
ctel++;
pos++;
recordinf[pos] = thisptr->tel[count];
}
}
for (count =0;count<(MAXMOBNUM);count++)
{
if((P_S8)(*(thisptr->mobile[count]))!= NULL)
{
cmob++;
pos++;
recordinf[pos] = thisptr->mobile[count];
}
}
for (count =0;count<(MAXBPNUM);count++)
{
if((P_S8)(*(thisptr->bp[count]))!= NULL)
{
cbp++;
pos++;
recordinf[pos] = thisptr->bp[count];
}
}
countall = ctel + cmob + cbp +2;//表示有多少数据
//需要先初始化数组
cueinf[0] = "姓名:";
cueinf[1] = "关系:";
if(ctel != 0)
{
cueinf[2] = "固话:";
}
if(cmob != 0)
{
cueinf[2+ctel] = "手机:";
}
if(cbp != 0)
{
cueinf[2+ctel+cmob] = "寻呼:";
}
if(countall >= DISP_NUM) //显示屏幕初始化
PhBookDetailDisplay(recordinf,cueinf,countall,0, DISP_NUM, bt,st);
else
PhBookDetailDisplay(recordinf,cueinf,countall,0, countall, bt,st);
isneedfreshscr = 0;
}
//XXXXXXXXXXXXXXXXXXXXX
for(count = 0; count < DISP_NUM; count++) //处理显示记录button,进入状态机
{
if(msg.lparam == bt[count])
{
if((count+startp)>=2) //如果是点击姓名则不相应
{
// string = recordinf[count + startp];//点击记录的内容
stringlen = (U8)strlen( recordinf[count + startp]);
memcpy(string,recordinf[count+startp],stringlen);
string[stringlen] = '\0';
//消息框,提示发短信或者是电话,是选择框,还需要有确定按键
if(mode == INTER_ACCESS)
{
if((cmob>0)&&((count+startp)<(2+ctel+cmob))&&((count+startp)>=(2+ctel)))
{
ismobnum = 1;
}
DualOrSendSMS(string,recordinf[0],ismobnum);//XXXX debug later 09062000 DDDDD
ismobnum = 0;
}else
if(mode == EXTER_ACCESS) //如果是外部调用,则返回电话号码
{
returncall = string;
quit = 1;
}
}
break;
}
}
break;
case WM_VSCROLL:
if(msg.lparam == scroll)
{
if(startp == 0) topdir=TRUE;//表示第一次到starpos = 0,则需要刷新,后面,就不要
if(endp == countall) enddir=TRUE;
switch(msg.wparam)
{
case SB_LINEDOWN:
startp++;
endp++;
break;
case SB_LINEUP:
startp--;
endp--;
break;
case SB_PAGEDOWN:
startp += DISP_NUM;
endp += DISP_NUM;
break;
case SB_PAGEUP:
startp -= DISP_NUM;
endp-=DISP_NUM;
break;
case SB_ENDSCROLL :
startp = GetScrollPos(scroll,0,0,0);
endp=startp-DISP_NUM;
break;
default :
break;
}
//for(total_file_num=0;memo_file_index[total_file_num]!=INPUT_NULL;total_file_num++);
low = 0;
if(countall > DISP_NUM)
{
high = countall-DISP_NUM;
if((S8)(startp)<0) startp = 0;
if(startp>high) startp = high;
endp = startp+DISP_NUM;
}
else
{
high = 0;
startp = 0;
endp=countall;
}
if(topdir==TRUE)
if(startp!=0) topdir=FALSE;
if(enddir==TRUE)
if(endp!=countall) enddir=FALSE;
SetScrollRange(scroll,low,high);
if((topdir==FALSE)&&(enddir==FALSE))
{
SetScrollPos(scroll, startp, 0, 0);
PhBookDetailDisplay(recordinf, cueinf,countall, startp, endp, bt,st);
}
}
break;
// 关闭窗口的消息,建议用户不要更改该消息的处理
case WM_QUIT:
quit = 1;
returncall = NULL; //表示没有去找电话号码,返回的是NULL值
break;
}
DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam);
}
DestroyWindow( browsewin );
return returncall;
}
//需要改动,因为没有汉字和拼音查询,只有精确和模糊查询
PHONEBOOK* SearchPhoneBook(U16 *recordlen,U8 * isfindok,DBLACB *phbooklacb)//定义参数
{
MSG msg;
U32 hGC;
U32 searchwin,edit1,keyboard,bt1,bt2,lbox,tskbar;
//U32 vscroll;
U8 quit=0;
P_S8 string1 = "请输入查询数据";
P_S8 tmpbuf=NULL;
SEARCHSTYLE style = PHONETICISE;
U16 msgst;
struct LBOX_ITEM lboxitem[] =
{
ICON_ENABLE, UNDERLINE, "模糊查询",
ICON_ENABLE, UNDERLINE, "精确查询",
ICON_END, UNDERLINE, NULL
};
U16 len = 0;
// U32 *loadid;
PHONEBOOK * searchlst;
U8 flag=0;
hGC = GetGC();
searchwin = CreateWindow(WNDCLASS_WIN,
"查找",
WS_OVERLAPPEDWINDOW,
0,0,
PHY_LCD_W,PHY_LCD_H,
0,
0,
NULL);
tskbar = CreateWindow(WNDCLASS_TSKBAR, NULL, WS_CHILD|TBS_TYPICAL, 0, 0, 0, 0,searchwin, 0, NULL);
edit1 = CreateWindow( WNDCLASS_EDITOR,
NULL,
WS_CHILD|ES_SINGLE_REGULAR,
LCD_WIDTH/2-70,LCD_HEIGHT*5/32,
140,
20,
searchwin,
0,
NULL);
keyboard = CreateWindow( WNDCLASS_KEYBD,
NULL,
WS_CHILD|KBS_PINGYING|0xff,
LCD_WIDTH/6,LCD_HEIGHT*9/16,
LCD_WIDTH*3/4,LCD_HEIGHT*19/160,
searchwin,
0,
NULL);
lbox = CreateWindow( WNDCLASS_LIST,
"ListBox",
WS_CHILD|LBS_POPUP,
LCD_WIDTH/2-(LCD_WIDTH*15/64),LCD_HEIGHT*9/32,
LCD_WIDTH*15/32,
LCD_HEIGHT/15,
searchwin,
0,
lboxitem);
bt1 = CreateWindow( WNDCLASS_BUTTON,
"确定",
WS_CHILD|BS_REGULAR,
LCD_WIDTH/2-(LCD_WIDTH*5/16),LCD_HEIGHT*3/8,
LCD_WIDTH/4,
LCD_HEIGHT*3/32,
searchwin,
0,
NULL);
bt2 = CreateWindow( WNDCLASS_BUTTON,
" 取消",
WS_CHILD|BS_REGULAR,
LCD_WIDTH*9/16,LCD_HEIGHT*3/8,
LCD_WIDTH/4,
LCD_HEIGHT*3/32,
searchwin,
0,
NULL);
hGC = GetGC();
SetFocus( edit1 );
while(!quit)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -