📄 callcard.c
字号:
//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);
CardDetailDisplay(recordinf, cueinf,countall, startp, endp, bt,st);
}
}
break;
// 关闭窗口的消息,建议用户不要更改该消息的处理
case WM_QUIT:
quit = 1;
break;
}
DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam);
}
DestroyWindow( browsewin );
}
/*
{
MSG msg;
CALLCARD *thisptr = head;
U32 browsewin,bt1,bt2,bt3,bt4,bt5,scroll;
U8 quit=0;
U8 ctel = 0,cmob = 0,cbp = 0,countall = 0;
U8 cfax = 0,cunit=0,cemail=0,caddress=0,cQQ=0,chabit=0,cpostalcode=0;
P_S8 nameptr,relationptr;
P_S8 recordinf[MAX_CARDINFNUM];
P_S8 cueinf[MAX_CARDINFNUM];
U8 count,pos;
U32 bt[DISP_NUM];
U32 st[DISP_NUM];
U8 topdir=FALSE,enddir=FALSE;//标志滚动滑块在页首和页尾,用于阻止相同页面的重刷
S16 startp,endp,high,low;
U32 hmenu;
P_S8 string;
U8 ismobnum = 0;
U32 hGC;
hGC = GetGC();
//XXX需要先让recordinf先初始化用memset
//首先是对输入的数据进行查询,有多少信息
//即就是有多少电话,手机,BP
memset( (P_VOID)recordinf, 0x0 , MAX_CARDINFNUM*sizeof(P_S8));//初试化新的记录
memset( (P_VOID)cueinf, 0x0 , MAX_CARDINFNUM*sizeof(P_S8));//初试化新的记录
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];
}
}
for (count =0;count<(MAXFAX);count++)
{
if((P_S8)(*(thisptr->fax[count]))!= NULL)
{
cfax++;
pos++;
recordinf[pos] = thisptr->fax[count];
}
}
for (count =0;count<(MAXUNIT);count++)
{
if((P_S8)(*(thisptr->unit[count]))!= NULL)
{
cunit++;
pos++;
recordinf[pos] = thisptr->unit[count];
}
}
for (count =0;count<(MAXEMAIL);count++)
{
if((P_S8)(*(thisptr->email[count]))!= NULL)
{
cemail++;
pos++;
recordinf[pos] = thisptr->email[count];
}
}
for (count =0;count<(MAXADDRESS);count++)
{
if((P_S8)(*(thisptr->address[count]))!= NULL)
{
caddress++;
pos++;
recordinf[pos] = thisptr->address[count];
}
}
for (count =0;count<(MAXQQ);count++)
{
if((P_S8)(*(thisptr->QQ[count]))!= NULL)
{
cQQ++;
pos++;
recordinf[pos] = thisptr->QQ[count];
}
}
for (count =0;count<(MAXHABIT);count++)
{
if((P_S8)(*(thisptr->habbit[count]))!= NULL)
{
chabit++;
pos++;
recordinf[pos] = thisptr->habbit[count];
}
}
for (count =0;count<(MAXPOSTALCODE);count++)
{
if((P_S8)(*(thisptr->postalcode[count]))!= NULL)
{
cpostalcode++;
pos++;
recordinf[pos] = thisptr->postalcode[count];
}
}
countall = ctel + cmob + cbp +2+cfax+cunit+cemail+caddress+cQQ+chabit+cpostalcode;//表示有多少数据
//需要先初始化数组
cueinf[0] = "姓名:";
cueinf[1] = "关系:";
if(ctel != 0)
{
cueinf[2] = "固话:";
}
if(cmob != 0)
{
cueinf[2+ctel] = "手机:";
}
if(cbp != 0)
{
cueinf[2+ctel+cmob] = "寻呼:";
}
if(cfax != 0)
{
cueinf[2+ctel+cmob+cbp] = "传真:";
}
if(cunit != 0)
{
cueinf[2+ctel+cmob+cfax+cbp] = "单位";
}
if(cemail != 0)
{
cueinf[2+ctel+cmob+cfax+cunit+cbp] = "EMAIL:";
}
if(caddress != 0)
{
cueinf[2+ctel+cmob+cfax+cunit+cemail+cbp] = "地址:";
}
if(cQQ != 0)
{
cueinf[2+ctel+cmob+cfax+cunit+cemail+caddress+cbp] = "QQ:";
}
if(chabit != 0)
{
cueinf[2+ctel+cmob+cfax+cunit+cemail+caddress+cQQ+cbp] = "爱好:";
}
if(cpostalcode != 0)
{
cueinf[2+ctel+cmob+cfax+cunit+cemail+caddress+cQQ+chabit+cbp] = "邮编:";
}
browsewin = CreateWindow(WNDCLASS_WIN,
"浏览名片",
WS_OVERLAPPEDWINDOW,
0,0,
PHY_LCD_W,PHY_LCD_H,
0,
0,
NULL);
bt1 = CreateWindow( WNDCLASS_BUTTON,
"第一条",
WS_CHILD|BS_REGULAR,
4,20,
20,
20,
browsewin,
0,
NULL);
bt2 = CreateWindow( WNDCLASS_BUTTON,
"上一条",
WS_CHILD|BS_REGULAR,
26,20,
20,
20,
browsewin,
0,
NULL);
bt3 = CreateWindow( WNDCLASS_BUTTON,
"下一条",
WS_CHILD|BS_REGULAR,
48,20,
20,
20,
browsewin,
0,
NULL);
bt4 = CreateWindow( WNDCLASS_BUTTON,
"最后一条",
WS_CHILD|BS_REGULAR,
70,20,
20,
20,
browsewin,
0,
NULL);
bt5 = CreateWindow( WNDCLASS_BUTTON,
"编辑态",
WS_CHILD|BS_REGULAR,
92,20,
20,
20,
browsewin,
0,
NULL);
for(count = 0; count < DISP_NUM; count++)//XXX需要注意的是先暂时定显示为8行,以后需要加
{
bt[count] = CreateWindow(WNDCLASS_BUTTON,
NULL,
WS_CHILD|BS_REGULAR,
42,
(U16)(count * 21 + 68),
100,
21,
browsewin,
0,
NULL);
}
for(count = 0; count < DISP_NUM; count++)//XXX需要注意的是先暂时定显示为8行,以后需要加
{
st[count] = CreateWindow(WNDCLASS_BUTTON,
NULL,
WS_CHILD| BS_PEN_UP_CMD,
// WS_CHILD|BS_TOOLBAR,
4,
(U16)(count * 21 + 68),
36,
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,
143,68,
16,
146,
browsewin,
hmenu,
NULL);
hGC = GetGC();
if(countall >= DISP_NUM) //显示屏幕初始化
CardDetailDisplay(recordinf,cueinf,countall,0, DISP_NUM, bt,st);
else
CardDetailDisplay(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);
}
while(!quit)
{
ASIXGetMessage(&msg, NULL, 0, 0);
switch(msg.message)
{
// 在此用户加入自己的消息处理
case WM_COMMAND:
if ( msg.lparam == bt1 )
{
* thumbtype = TURN_TO_FIRST;
quit = 1;
} else
if ( msg.lparam == bt2 )
{
* thumbtype = TURN_BACK;
quit = 1;
} else
if ( msg.lparam == bt3 )
{
* thumbtype = TURN_NEXT;
quit = 1;
} else
if ( msg.lparam == bt4 )
{
* thumbtype = TURN_TO_LAST;
quit = 1;
} else
if ( msg.lparam == bt5 )
{
*isturntoedit = 1;
quit = 1;
}
//XXXXXXXXXXXXXXXXXXXXX
for(count = 0; count < DISP_NUM; count++) //处理显示记录button,进入状态机
{
if(msg.lparam == bt[count])
{
string = recordinf[count + startp];//点击记录的内容
if(((count+startp)>=2)&&((count+startp)<(2+ctel+cmob+cbp))) //如果是点击姓名则不相应
{
//消息框,提示发短信或者是电话,是选择框,还需要有确定按键
if((cmob>0)&&((count+startp)<(2+ctel+cmob))&&((count+startp)>=(2+ctel)))
{
ismobnum = 1;
}
CardDualSMS(hGC,string,recordinf[0],ismobnum);
ismobnum = 0;
}
}
}
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)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -