📄 cardedit.c
字号:
/**********************************************************
*
*Copyright ? 2001-2003 National ASIC Center, All right Reserved
*
* FILE NAME: CallEdit.c
* PROGRAMMER: Christian-ren
* Date of Creation: 2002/08/28
*
* DESCRIPTION: Card module,focus on edit
*
* NOTE:
*------------------------------------------------------------------
* FUNCTIONS LIST:
* -- PUBLIC FUNCTIONS --
*
*------------------------------------------------------------------
* -- LOCAL FUNCTIONS --
* void CardSelectCall(U32 hGC,P_S8 text,P_S8 inf1,P_S8 inf2,P_S8 inf3,P_S8 inf4,SELECTITEM * selitemptr)
* void CardAddRecordItem(P_S8 *recordinf,P_S8 *cueinf,CARDINFSTYLE phonstyle,U8 ctel,U8 cmob,U8 cbp,U8 cfax,U8 cunit,U8 cemail,U8 caddress,U8 cQQ,U8 chabit,U8 cpostalcode)
* void CardDelRecordItem(P_S8 *recordinf,P_S8 *cueinf,CARDINFSTYLE phonstyle,U8 ctel,U8 cmob,U8 cbp,U8 cfax,U8 cunit,U8 cemail,U8 caddress,U8 cQQ,U8 chabit,U8 cpostalcode,SELECTITEM select)//在某个位置之后添加
* void DispCardIndex(U32 *btindex,INDEXSTATE state,U8 ctel,U8 cmob,U8 cbp,U8 cfax,U8 cunit,U8 cemail,U8 caddress,U8 cQQ,U8 chabit,U8 cpostalcode)
* STATUS CardEditDisplay(P_S8 * recordinf,P_S8 * cueinf, U16 len, S16 startpos, S16 endpos, U32 *editor,U32 *st)
* void CardSaveEditorToReord(U32 *editor,P_S8 *recordinf,U16 startp)
* void EditCardDetail(CALLCARD * thisptr, ACCESSSTYLE mode ,U8 PhStyle, P_S8 * num ,U8 *wintext,SAVEMODE savemode,U32 hGC)
*
*------------------------------------------------------------------
*
* GLOBAL VARS LIST:
* DBLACB *cardlacb; //定义一个数据库控制块的变量
*-------------------------------------------------------------------
*
* MODIFICATION HISTORY
*
*
* 2002/08/28 by Christian-ren Create the file
*
*************************************************************/
#include <string.h>
#include <asixwin.h>
#include <asixapp.h>
#include <asixwin\asix_lb.h>
#include <asixwin\asix_ed.h>
#include <asixwin\button.h>
#include <resource\bitmap.h>
#include "callcard.h"
#include <database\carddb.h>
extern DBLACB *cardlacb;
extern void CardCompareModSrc(CALLCARD *thisptr,CARDBUFRECORDINF * inf,U8 * ismodfptr);
extern STATUS CardSaveModfToSrc(CALLCARD*thisptr,CARDBUFRECORDINF * inf);
extern void CardAddRecordToDB(CALLCARD*thisptr,SAVEMODE mode);
STATUS CardDispSetSelCallItem(U32 *bt,P_S8 inf1,P_S8 inf2,P_S8 inf3,P_S8 inf4)
{
U8 count;
for(count = 0; count < SELCALLNUM; count++)
{
SetWindowText(*bt, NULL, NULL);
EnableWindow(*bt,FALSE);
bt++;
}
bt -= SELCALLNUM;
//if((inf1 !=NULL)&&(*inf1!=NULL))
if(inf1 !=NULL)
{
EnableWindow(*bt,TRUE);
SetWindowText(*bt, inf1, NULL);
}
bt++;
// if((inf2 !=NULL)&&(*inf2!=NULL))
if(inf2 !=NULL)
{
EnableWindow(*bt,TRUE);
SetWindowText(*bt, inf2, NULL);
}
bt++;
// if((inf3 !=NULL)&&(*inf3!=NULL))
if(inf3 !=NULL)
{
EnableWindow(*bt,TRUE);
SetWindowText(*bt, inf3, NULL);
}
bt++;
// if((inf4 !=NULL)&&(*inf4!=NULL))
if(inf4 !=NULL)
{
EnableWindow(*bt,TRUE);
SetWindowText(*bt, inf4, NULL);
}
return ASIX_OK;
}
//输入选择是下拉框,以后需要用选择框XXXXX
void CardSelectCall(P_S8 text,P_S8 inf1,P_S8 inf2,P_S8 inf3,P_S8 inf4,SELECTITEM * selitemptr)
{
//可以考虑添加参数输入号码的记录
MSG msg;
U32 hGC;
U32 selcallwin,bt1,bt2,st;
U8 quit = 0;
SELECTITEM tmpselect;
U32 bt[SELCALLNUM];
U8 count;
U8 sel_bt = SELCALLNUM;
U32 tskbar; // 任务栏
hGC = GetGC();
// GroupOn(hGC);
selcallwin = 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,selcallwin, 0, NULL);
bt1 = CreateWindow( WNDCLASS_BUTTON,
"确定",
WS_CHILD|BS_REGULAR,
35,180,
30,
20,
selcallwin,
0,
NULL);
bt2 = CreateWindow( WNDCLASS_BUTTON,
"取消",
WS_CHILD|BS_REGULAR,
80,180,
30,
20,
selcallwin,
0,
NULL);
st = CreateWindow(WNDCLASS_STATIC, //提示信息
text,
WS_CHILD|SS_TEXT|SS_MULTILINE,
35,36,
100,
22,
selcallwin,
0,
NULL);
for(count = 0; count < SELCALLNUM; count++)
{
bt[count] = CreateWindow(WNDCLASS_BUTTON,
NULL,
WS_CHILD|BS_TOOLBAR,
10,
(U16)(count * 21 + 68),
138,
21,
selcallwin,
0,
NULL);
}
hGC = GetGC();
EnableWindow(bt1, FALSE);
CardDispSetSelCallItem(bt,inf1,inf2,inf3,inf4);
while(!quit)
{
ASIXGetMessage(&msg, NULL, 0, 0);
switch(msg.message)
{
case WM_COMMAND:
if ( msg.lparam == bt1 )
{
*selitemptr = tmpselect;
quit = 1;
} else
if( msg.lparam == bt2 )
{
*selitemptr = CANCEL_SEL;
quit = 1;
}
for(count=0;count<SELCALLNUM;count++)
{
if(msg.lparam == bt[count])
{
if(sel_bt == SELCALLNUM)
{
//
}else{
//RepaintWindow(bt[sel_bt], BS_INVERT);
RepaintWindow(bt[sel_bt], BS_INVERT); //选中则返黑
}
tmpselect = count+1;
EnableWindow( bt1, TRUE);
sel_bt=count;
break;
}
}
break;
case WM_QUIT:
quit = 1;
break;
}
DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam);
}
DestroyWindow( selcallwin );
}
//不仅需要在记录内容中添加数据
//而且需要在提示框中添加空的数据
void CardAddRecordItem(P_S8 *recordinf,P_S8 *cueinf,CARDINFSTYLE phonstyle,U8 ctel,U8 cmob,U8 cbp,U8 cfax,U8 cunit,U8 cemail,U8 caddress,U8 cQQ,U8 chabit,U8 cpostalcode)//在某个位置之后添加
{
U8 count;
U8 pos;
P_S8 *tmpptr =recordinf;
U8 countall = ctel + cmob + cbp +2+cfax+cunit+cemail+caddress+cQQ+chabit+cpostalcode;
switch(phonstyle)
{
case TELEPHONE:
if(ctel>=MAXTELNUM) break;
else{
pos = 1+ctel+1;
for(count=(countall);count>(pos-1);count--)//需要确定是>= or >
{
*(cueinf+count) = *(cueinf+count-1); //需要注意,这是因为他们的数据都一样XXX
strcpy(recordinf[count],recordinf[count-1]);//added on 0920
}
memset((recordinf[pos]),0x0,MAXNAMELEN);//空的内容,需要添加
*(cueinf+pos) = NULL;
if(ctel ==0)
{
*(cueinf+pos) = "固话:";
}
}
break;
case MOBILE :
if(cmob>=MAXMOBNUM) break;
else{
pos = 1+ctel+cmob+1;
for(count=(countall);count>(pos-1);count--)//需要确定是>= or >
{
*(cueinf+count) = *(cueinf+count-1);
strcpy(recordinf[count],recordinf[count-1]);
}
memset((recordinf[pos]),0x0,MAXNAMELEN);
*(cueinf+pos) = NULL;
if(cmob == 0)
{
*(cueinf+pos) = "手机:";
}
}
break;
case BP:
if(cbp>=MAXBPNUM) break;
else{
pos = 1+ctel+cmob+cbp+1;
for(count=(countall);count>(pos-1);count--)//需要确定是>= or >
{
strcpy(recordinf[count],recordinf[count-1]);
*(cueinf+count) = *(cueinf+count-1);
}
memset((recordinf[pos]),0x0,MAXNAMELEN);
*(cueinf+pos) = NULL;
if(cbp == 0)
{
*(cueinf+pos) = "寻呼:";
}
}
break;
case FAX:
if(cfax>=MAXFAX) break;
else{
pos = 1+ctel+cmob+cbp+cfax+1;
for(count=(countall);count>(pos-1);count--)//需要确定是>= or >
{
strcpy(recordinf[count],recordinf[count-1]);
*(cueinf+count) = *(cueinf+count-1);
}
memset((recordinf[pos]),0x0,MAXNAMELEN);
*(cueinf+pos) = NULL;
if(cfax == 0)
{
*(cueinf+pos) = "传真:";
}
}
break;
case UNIT:
if(cunit>=MAXUNIT) break;
else{
pos = 1+ctel+cmob+cbp+cfax+cunit +1;
for(count=(countall);count>(pos -1);count--)//需要确定是>= or >
{
strcpy(recordinf[count],recordinf[count-1]);
*(cueinf+count) = *(cueinf+count-1);
}
memset((recordinf[pos]),0x0,MAXNAMELEN);
*(cueinf+pos) = NULL;
if(cunit == 0)
{
*(cueinf+pos) = "单位:";
}
}
break;
case EMAIL:
if(cemail>=MAXEMAIL) break;
else{
pos = 1+ctel+cmob+cbp+cfax+cunit+cemail +1;
for(count=(countall);count>(pos -1);count--)//需要确定是>= or >
{
strcpy(recordinf[count],recordinf[count-1]);
*(cueinf+count) = *(cueinf+count-1);
}
memset((recordinf[pos]),0x0,MAXNAMELEN);
*(cueinf+pos) = NULL;
if(cemail == 0)
{
*(cueinf+pos) = "EMAIL";
}
}
break;
case ADDRESS:
if(caddress>=MAXADDRESS) break;
else{
pos = 1+ctel+cmob+cbp+cfax+cunit+cemail+caddress+1;
for(count=(countall);count>(pos-1);count--)//需要确定是>= or >
{
strcpy(recordinf[count],recordinf[count-1]);
*(cueinf+count) = *(cueinf+count-1);
}
memset((recordinf[pos]),0x0,MAXNAMELEN);
*(cueinf+pos) = NULL;
if(caddress== 0)
{
*(cueinf+pos) = "地址:";
}
}
break;
case QQ:
if(cQQ>=MAXQQ) break;
else{
pos = 1+ctel+cmob+cbp+cfax+cunit+cemail+caddress+cQQ+1;
for(count=(countall);count>(pos-1);count--)//需要确定是>= or >
{
strcpy(recordinf[count],recordinf[count-1]);
*(cueinf+count) = *(cueinf+count-1);
}
memset((recordinf[pos]),0x0,MAXNAMELEN);
*(cueinf+pos) = NULL;
if(cQQ== 0)
{
*(cueinf+pos) = "QQ:";
}
}
break;
case HABIT:
if(chabit>=MAXHABIT) break;
else{
pos = 1+ctel+cmob+cbp+cfax+cunit+cemail+caddress+cQQ+chabit+1;
for(count=(countall);count>(pos-1);count--)//需要确定是>= or >
{
strcpy(recordinf[count],recordinf[count-1]);
*(cueinf+count) = *(cueinf+count-1);
}
memset((recordinf[pos]),0x0,MAXNAMELEN);
*(cueinf+pos) = NULL;
if(chabit== 0)
{
*(cueinf+pos) = "爱好:";
}
}
break;
case POSTALCODE:
if(cpostalcode>=MAXPOSTALCODE) break;
else{
pos = 1+ctel+cmob+cbp+cfax+cunit+cemail+caddress+cQQ+chabit+cpostalcode+1;
for(count=(countall);count>(pos-1);count--)//需要确定是>= or >
{
strcpy(recordinf[count],recordinf[count-1]);
*(cueinf+count) = *(cueinf+count-1);
}
memset((recordinf[pos]),0x0,MAXNAMELEN);
*(cueinf+pos) = NULL;
if(cpostalcode== 0)
{
*(cueinf+pos) = "邮编:";
}
}
break;
default:
break;
}
}
void CardDelRecordItem(P_S8 *recordinf,P_S8 *cueinf,CARDINFSTYLE phonstyle,U8 ctel,U8 cmob,U8 cbp,U8 cfax,U8 cunit,U8 cemail,U8 caddress,U8 cQQ,U8 chabit,U8 cpostalcode,SELECTITEM select)//在某个位置之后添加
{
U8 count;
U8 countall = ctel + cmob + cbp +2+cfax+cunit+cemail+caddress+cQQ+chabit+cpostalcode;
switch(phonstyle)
{
case TELEPHONE:
if(ctel<=0) break;
else{
for(count=1+(U8)select;count<(countall-1);count++)
{
recordinf[count] = recordinf[count+1]; //内容上移//可以不用考虑将最后的清空
cueinf[count]=cueinf[count+1];//提示内容上移 //,因为已经完全移动完,而且是多余的都是零
}
if((select == SEL_FIRST)&&(ctel>=2))//如果是选择第一项,就要把第一项提示重新显示
{
cueinf[2]="固话:";
}
}
break;
case MOBILE :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -