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

📄 callcard.c

📁 基于东南大学开发的SEP3203的ARM7中的所有驱动
💻 C
📖 第 1 页 / 共 5 页
字号:
   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] = "邮编:";
    }
	GroupOn(hGC);
 	browsewin = 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,browsewin, 0, NULL);

      

	bt1 = CreateWindow( WNDCLASS_BUTTON,
						"\\第一条",
						WS_CHILD|BS_REGULAR,
						LCD_WIDTH/2-LCD_HEIGHT*5/24-6,18,
						LCD_HEIGHT/12,
						LCD_HEIGHT/12,
						browsewin,
						0,
						(char*)zi_first);
	bt2 = CreateWindow( WNDCLASS_BUTTON,
						"\\上一条",
						WS_CHILD|BS_REGULAR,
						LCD_WIDTH/2-LCD_HEIGHT/8-3,18,
						LCD_HEIGHT/12,
						LCD_HEIGHT/12,
						browsewin,
						0,
						(char*)zi_prev);
	bt3 = CreateWindow( WNDCLASS_BUTTON,
						"\\下一条",
						WS_CHILD|BS_REGULAR,
						LCD_WIDTH/2-LCD_HEIGHT/24,18,
						LCD_HEIGHT/12,
						LCD_HEIGHT/12,
						browsewin,
						0,
						(char*)zi_next);
	bt4 = CreateWindow( WNDCLASS_BUTTON,
						"\\最后一条",
						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)      //显示屏幕初始化
		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);
	}


	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 = CardLinkJumpToPos(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_CARDINFNUM*sizeof(P_S8));//初试化新的记录
				memset( (P_VOID)cueinf, 0x0 , MAX_CARDINFNUM*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];
					}
				}
					     

				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] = "邮编:";
				}
				if(countall >= DISP_NUM)      //显示屏幕初始化
					CardDetailDisplay(recordinf,cueinf,countall,0, DISP_NUM, bt,st);
				else
					CardDetailDisplay(recordinf,cueinf,countall,0, countall, bt,st);
												
				isneedfreshscr = 0;
			}





//XXXXXXXXXXXXXXXXXXXXX
				for(count = 0; count < DISP_NUM; count++)    //处理显示记录button,进入状态机
				{
					if(msg.lparam == bt[count])
					{ 
						stringlen = (U8)strlen( recordinf[count + startp]);
						memcpy(string,recordinf[count+startp],stringlen);
						string[stringlen] = '\0';
						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(string,recordinf[0],ismobnum);
						  ismobnum = 0;
                        }
                       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;
				
				}
						

⌨️ 快捷键说明

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