⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cardedit.c

📁 国家ASIC工程中心使用的嵌入式操作系统
💻 C
📖 第 1 页 / 共 2 页
字号:
        	if(cmob<0)  break;
              else{
                 for(count=1+ctel+(U8)select;count<(countall-1);count++)
                 {
                   	 recordinf[count] = recordinf[count+1];  //内容上移//可以不用考虑将最后的清空
                   	 cueinf[count]=cueinf[count+1];//提示内容上移  //,因为已经完全移动完,而且是多余的都是零
                 }
                 if((select == SEL_FIRST)&&(cmob>=2))//如果是选择第一项,就要把第一项提示重新显示
                 {
                     cueinf[2+ctel]="手机:";  
                 }
             }
        	 break;
        case BP:
        	if(cbp<0)  break;
             else{
                 for(count=1+ctel+cmob+(U8)select;count<(countall-1);count++)
                 {
                   	 recordinf[count] = recordinf[count+1];  //内容上移//可以不用考虑将最后的清空
                   	 cueinf[count]=cueinf[count+1];//提示内容上移  //,因为已经完全移动完,而且是多余的都是零
                 }
                 if((select == SEL_FIRST)&&(cbp>=2))//如果是选择第一项,就要把第一项提示重新显示
                 {
                     cueinf[2+ctel+cmob]="寻呼:";  
                 }
             }
        	 break;
        case  FAX:
            if(cfax<0)  break;
             else{
                 for(count=1+ctel+cmob+cbp+(U8)select;count<(countall-1);count++)
                 {
                   	 recordinf[count] = recordinf[count+1];  //内容上移//可以不用考虑将最后的清空
                   	 cueinf[count]=cueinf[count+1];//提示内容上移  //,因为已经完全移动完,而且是多余的都是零
                 }
                 if((select == SEL_FIRST)&&(cfax>=2))//如果是选择第一项,就要把第一项提示重新显示
                 {
                     cueinf[2+ctel+cmob+cbp]="传真:";  
                 }
             }
        	break;
        case  UNIT:
             if(cunit<0)  break;
             else{
                 for(count=1+ctel+cmob+cbp+cfax+(U8)select;count<(countall-1);count++)
                 {
                   	 recordinf[count] = recordinf[count+1];  //内容上移//可以不用考虑将最后的清空
                   	 cueinf[count]=cueinf[count+1];//提示内容上移  //,因为已经完全移动完,而且是多余的都是零
                 }
                 if((select == SEL_FIRST)&&(cunit>=2))//如果是选择第一项,就要把第一项提示重新显示
                 {
                     cueinf[2+ctel+cmob+cbp+cfax]="单位:";  
                 }
             }
        	break;
        case  EMAIL:
            if(cemail<0)  break;
             else{
                 for(count=1+ctel+cmob+cbp+cfax+cunit+(U8)select;count<(countall-1);count++)
                 {
                   	 recordinf[count] = recordinf[count+1];  //内容上移//可以不用考虑将最后的清空
                   	 cueinf[count]=cueinf[count+1];//提示内容上移  //,因为已经完全移动完,而且是多余的都是零
                 }
                 if((select == SEL_FIRST)&&(cemail>=2))//如果是选择第一项,就要把第一项提示重新显示
                 {
                     cueinf[2+ctel+cmob+cbp+cfax+cunit]="EMAIL:";  
                 }
             }
        	break;
        case  ADDRESS:
           if(caddress<0)  break;
             else{
                 for(count=1+ctel+cmob+cbp+cfax+cunit+cemail+(U8)select;count<(countall-1);count++)
                 {
                   	 recordinf[count] = recordinf[count+1];  //内容上移//可以不用考虑将最后的清空
                   	 cueinf[count]=cueinf[count+1];//提示内容上移  //,因为已经完全移动完,而且是多余的都是零
                 }
                 if((select == SEL_FIRST)&&(caddress>=2))//如果是选择第一项,就要把第一项提示重新显示
                 {
                     cueinf[2+ctel+cmob+cbp+cfax+cunit+cemail]="地址:";  
                 }
             }
        	break;
        case  QQ:
            if(cQQ<0)  break;
             else{
                 for(count=1+ctel+cmob+cbp+cfax+cunit+cemail+caddress+(U8)select;count<(countall-1);count++)
                 {
                   	 recordinf[count] = recordinf[count+1];  //内容上移//可以不用考虑将最后的清空
                   	 cueinf[count]=cueinf[count+1];//提示内容上移  //,因为已经完全移动完,而且是多余的都是零
                 }
                 if((select == SEL_FIRST)&&(cQQ>=2))//如果是选择第一项,就要把第一项提示重新显示
                 {
                     cueinf[2+ctel+cmob+cbp+cfax+cunit+cemail+caddress]="QQ:";  
                 }
             }
        	break;
        case  HABIT:
            if(chabit<0)  break;
             else{
                 for(count=1+ctel+cmob+cbp+cfax+cunit+cemail+caddress+cQQ+(U8)select;count<(countall-1);count++)
                 {
                   	 recordinf[count] = recordinf[count+1];  //内容上移//可以不用考虑将最后的清空
                   	 cueinf[count]=cueinf[count+1];//提示内容上移  //,因为已经完全移动完,而且是多余的都是零
                 }
                 if((select == SEL_FIRST)&&(chabit>=2))//如果是选择第一项,就要把第一项提示重新显示
                 {
                     cueinf[2+ctel+cmob+cbp+cfax+cunit+cemail+caddress+cQQ]="爱好:";  
                 }
             }
        	break;
        case  POSTALCODE:
           if(cpostalcode<0)  break;
             else{
                 for(count=1+ctel+cmob+cbp+cfax+cunit+cemail+caddress+cQQ+chabit+(U8)select;count<(countall-1);count++)
                 {
                   	 recordinf[count] = recordinf[count+1];  //内容上移//可以不用考虑将最后的清空
                   	 cueinf[count]=cueinf[count+1];//提示内容上移  //,因为已经完全移动完,而且是多余的都是零
                 }
                 if((select == SEL_FIRST)&&(cpostalcode>=2))//如果是选择第一项,就要把第一项提示重新显示
                 {
                     cueinf[2+ctel+cmob+cbp+cfax+cunit+cemail+caddress+cQQ+chabit]="邮编:";  
                 }
             }
        	break;
        default:        
        	break;
    }
}




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)
{
	U8  count;
	U32 hGC;
	hGC = GetGC();
	GroupOn(hGC);
	for(count = 0; count < CARD_INDEXNUM; count++)
	{
		SetWindowText(*btindex, NULL, NULL);
		EnableWindow(*btindex,FALSE);
		btindex++;
	}
	btindex -=CARD_INDEXNUM;
	if(state ==NEW_ITEM)
	{  
		EnableWindow(*btindex,TRUE);
		SetWindowText(*btindex++, "\\固话", (char*)zi_phone);  //注意将来是需要贴图XXXX
		EnableWindow(*btindex,TRUE);
		SetWindowText(*btindex++, "\\手机",(char*)zi_mobile);
		EnableWindow(*btindex,TRUE);
		SetWindowText(*btindex++, "\\寻呼",(char*)zi_bp);
		EnableWindow(*btindex,TRUE);
		SetWindowText(*btindex++, "\\传真", (char*)zi_fax);  //注意将来是需要贴图XXXX
		EnableWindow(*btindex,TRUE);
		SetWindowText(*btindex++, "\\单位",(char*)zi_office);
		EnableWindow(*btindex,TRUE);
		SetWindowText(*btindex++, "\\EMAIL",(char*)zi_email);
		EnableWindow(*btindex,TRUE);
		SetWindowText(*btindex++, "\\地址", (char*)zi_home);  //注意将来是需要贴图XXXX
		EnableWindow(*btindex,TRUE);
		SetWindowText(*btindex++, "\\QQ",(char*)zi_qq);
		EnableWindow(*btindex,TRUE);
		SetWindowText(*btindex++, "\\爱好",(char*)zi_hobby);
		EnableWindow(*btindex,TRUE);
		SetWindowText(*btindex++, "\\邮编",(char*)zi_number);
		EnableWindow(*btindex,FALSE);
		SetWindowText(*btindex++, "\\姓名",(char*)zi_name);
		EnableWindow(*btindex,FALSE);
		SetWindowText(*btindex++, "\\关系",(char*)zi_relation);
	}else
	if(state ==DEL_ITEM)  //如果是存在此记录
	{
		SetWindowText(*btindex,"\\固话", (char*)zi_phone);  //注意将来是需要贴图XXXX
		if(ctel !=0)
		{   
		  EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\手机",(char*)zi_mobile);
		if(cmob != 0)
		{
		  EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\寻呼",(char*)zi_bp);
		if(cbp != 0)
		{
			EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex,"\\传真", (char*)zi_fax);  //注意将来是需要贴图XXXX
		if(cfax !=0)
		{   
		  EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\单位",(char*)zi_office);
		if(cunit != 0)
		{
		  EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\EMAIL",(char*)zi_email);
		if(cemail != 0)
		{
			EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex,"\\地址", (char*)zi_home);  //注意将来是需要贴图XXXX
		if(caddress !=0)
		{   
		  EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\QQ",(char*)zi_qq);
		if(cQQ != 0)
		{
		  EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\爱好",(char*)zi_hobby);
		if(chabit != 0)
		{
			EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\邮编",(char*)zi_number);
		if(cpostalcode!= 0)
		{
			EnableWindow(*btindex,TRUE);
		}
		btindex++;
		EnableWindow(*btindex,FALSE);
		SetWindowText(*btindex++, "\\姓名",(char*)zi_name);
		EnableWindow(*btindex,FALSE);
		SetWindowText(*btindex++, "\\关系",(char*)zi_relation);
	}else
	if(state == EDIT_ITEM)
	{
		SetWindowText(*btindex,"\\固话", (char*)zi_phone);  //注意将来是需要贴图XXXX
		if(ctel !=0)
		{   
		  EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\手机",(char*)zi_mobile);
		if(cmob != 0)
		{
		  EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\寻呼",(char*)zi_bp);
		if(cbp != 0)
		{
			EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex,"\\传真", (char*)zi_fax);  //注意将来是需要贴图XXXX
		if(cfax !=0)
		{   
			EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\单位",(char*)zi_office);
		if(cunit != 0)
		{
			EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\EMAIL",(char*)zi_email);
		if(cemail != 0)
		{
			EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex,"\\地址", (char*)zi_home);  //注意将来是需要贴图XXXX
		if(caddress !=0)
		{   
			EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\QQ",(char*)zi_qq);
		if(cQQ != 0)
		{
			EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\爱好",(char*)zi_hobby);
		if(chabit != 0)
		{
			EnableWindow(*btindex,TRUE);
		}
		btindex++;
		SetWindowText(*btindex, "\\邮编",(char*)zi_number);
		if(cpostalcode!= 0)
		{
			EnableWindow(*btindex,TRUE);
		}
		btindex++;
		EnableWindow(*btindex,TRUE);
		SetWindowText(*btindex++, "\\姓名",(char*)zi_name);
		EnableWindow(*btindex,TRUE);
		SetWindowText(*btindex++, "\\关系",(char*)zi_relation);
	}
	GroupOff(hGC, 1, 1,LCD_WIDTH-1, LCD_HEIGHT-1);
}










//是在编辑模块中调用
STATUS	CardEditDisplay(P_S8 * recordinf,P_S8 * cueinf, U16 len, S16 startpos, S16 endpos, U32 *editor,U32 *st)
                              //  displaylist是现在需要显示的记录类,listlen是此记录的长度,
                             //startpos,endpos 分别是链表显示信息的起始和终止记录
                             //bt是显示记录button的ID,

{
	U16		count;
	for(count = 0; count < DISP_EDIT_NUM; count++)
	{
	//status = GetWindowStatus ( *editor, &btstatus );
	  if(*editor != 0)   //如果是此记录的控件存在
		{
		SetWindowText(*editor, NULL, NULL);
		}
	SetWindowText(*st, "", NULL);
	EnableWindow(*editor,FALSE);
	editor++;
	st++;
	}
	editor -= DISP_EDIT_NUM;//XXXX需要注意暂时先显示8个记录,以后要变成9个
	st -= DISP_EDIT_NUM;
	if(len <= 0)   
	{
		SetWindowText(*editor, " 此记录为空", NULL);
		return		ASIX_OK;
	}

	for(count = startpos; count < endpos; count++)
	{

		// status = GetWindowStatus ( *editor, &btstatus );
		if(*editor != 0)   //如果是此记录的控件存在
		{
			EnableWindow(*editor, TRUE);
			SetWindowText(*editor, *(recordinf+count), NULL);
		}
		SetWindowText(*st, *(cueinf+count),NULL);
		editor++;		
		st++;
	}
	return	ASIX_OK;
}





void  CardSaveEditorToReord(U32 *editor,P_S8 *recordinf,U16 startp)
{
    U8 	i;
    S8 	buf[100];
    U8 	len;
    U8 	flag=0;
    memset(buf,0x0,50);
    for(i = 0;i<DISP_EDIT_NUM;i++)
    {
    	if((void*)editor[i]!= NULL)
    	{
	        if( GetEditorStr(editor[i],buf,50) == NULL ) 
				return;
	          else{
	          	if((void*)(*buf )!= NULL) 
				{
					len = (U8)strlen(buf)+1;
					//  strcpy(recordinf[startp+i],buf);//注意需要保证recordinf是有足够的空间用于拷贝
					memcpy(recordinf[i+startp],buf,len);
				}
	        }                                                 //所以在开缓冲区的时候需要考虑
    	} else{
    		flag=1;
    	}       
    }
}




void  EditCardDetail(CALLCARD * thisptr, ACCESSSTYLE  mode ,U8 PhStyle, P_S8 * num ,U8 *wintext,SAVEMODE savemode) 
{

	U32 editwin,bt1,bt2,bt3,bt4,bt5,bt6,editor[DISP_EDIT_NUM],lbox = 0,scroll;//,st1,st2;
	U32        st[DISP_EDIT_NUM];
	U32        btindex[CARD_INDEXNUM];
	U32        keyboard = 0;
	MSG       msg;
	U32       hGC;
  
	struct LBOX_ITEM	lboxitem[] =
	{     //"全部"没有加上
		ICON_ENABLE,	UNDERLINE,	"其他",
		ICON_ENABLE,	UNDERLINE,	"朋友",
		ICON_ENABLE,	UNDERLINE,	"家人",
		ICON_ENABLE,	UNDERLINE,	"同学",
		ICON_ENABLE,	UNDERLINE,	"同事",
		ICON_END,	UNDERLINE,	NULL
	};
	U8		quit=0;


   CARDBUFRECORDINF   bufrecordinf;
   CARDBUFRECORDINF *bufrecord = &bufrecordinf;  //主要是用于填入数据结构,因为入口参数太多
   //设计的时候数据结构没有设计好
   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;
   U8          relationpos;
   U8		topdir=FALSE,enddir=FALSE;//标志滚动滑块在页首和页尾,用于阻止相同页面的重刷  
   S16		startp = 0,endp = 0,high = 0,low = 0;
   S16        startpbefore = 0;
   U32        hmenu;
   U32		liststatus = 0;
   INDEXSTATE    indexstate;
   INDEXSTATE    oldindexst;
   U32       keybstatus =0;
   U32       btstatus = 0;
  // S16       status;
   CARDINFSTYLE  selphstyle;
   SELECTITEM   selitem = SEL_FIRST;
   U8 isjumptokeyb = 0;
   P_S8    string1 = "选择编辑信息";
   P_S8    string2 = "选择删除信息";
   P_S8    string3 = "姓名尚未输入,所编辑信息将不保存,是否退出编辑

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -