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

📄 asixbox.c

📁 基于东南大学开发的SEP3203的ARM7中的所有驱动
💻 C
📖 第 1 页 / 共 2 页
字号:
						        }	

						}

						if(Msg.lparam == bt_newmail){

							mboxaction=5;//new mail

							NewMail(NULL,NEW_MAIL); 

							   //EnableWindow(bt_[0],FALSE,NULL);

							   EnableWindow(bt_[0],FALSE);

								//EnableWindow(bt_[1],FALSE,NULL);

								EnableWindow(bt_[1],FALSE);

								//EnableWindow(bt_[2],FALSE,NULL);

								EnableWindow(bt_[2],FALSE);

										cur = GetCurWindow(  );

										SysClearRec( gc, GPC_LIGHTGREY, 0, 20, 140, 200 , GPC_AND_STYLE);

					

						}

						if(Msg.lparam == bt_receivesend){

							mboxaction=2;//send&reicive

							//SendMail(); 

						}

						if(Msg.lparam == bt_exit1){

							 mboxaction=3;//quit

							

						}

						break;

					case	WM_QUIT:

				                mboxaction=3;//quit

				                break;	

 			     	     default:

 			     	      		break;	

				}DefWindowProc(Msg.message, Msg.lparam, Msg.data, Msg.wparam);

			}

		

		

		

			

									

       	Lfree(to);Lfree(date);



	

	

	//if(mboxaction==1) {

	//	NewMail(NULL,NEW_MAIL); 

	//} else if (mboxaction==2) {

		//SendMail(); 

	//} else if (mboxaction==3) {

	//	if(mode==OUTBOXLIST) DestroyWindow(sendwin);

	//	if(mode==SENTBOXLIST) DestroyWindow(sentwin);

	//	if(mode==INBOXLIST)  DestroyWindow(receivewin);

	//		return 0;

	//} 

		

  

  if(mboxaction==4|mboxaction==5)	goto mlist;

  if (mboxaction==3) {

  	if(mode==OUTBOXLIST) DestroyWindow(sendwin);

	if(mode==SENTBOXLIST) DestroyWindow(sentwin);

	if(mode==INBOXLIST)  DestroyWindow(receivewin);

  	return 0;

  }

  return 0;

}





U8 ReadMail(struct mail_head *mailhead, U8 mode)

{

	

	U8	quit=0;

//	U16	timeCount;

//	P_U8	lcdBuffer;

//	U32	size,XAreaId,areaId;

//	P_U16	data;



//	U32	CtrlIcon[3];

	const	char 	*title="读邮件";





	U16	HelpLen=0;

	char	*page[50];/*we allow the use has 50 pages	Lingming 11/11/1999*/

	U8	index=1;

	U8	rv,mchanged=FALSE;

	char 	*mailptr1;

        U32     gc,readwin,bt_1,bt_delete,bt_exit,bt_up,bt_down,i=0;

		static	    MSG	   Msg;

	

	

	if (mode!=INBOXLIST&&mode!=OUTBOXLIST&&mode!=SENTBOXLIST) return 1;

	

	//if ( (lcdBuffer=Lmalloc(LCD_WIDTH*LCD_HEIGHT*2/8))==NULL) return 1;

	

	//SaveRec((P_U8)lcdBuffer,0,0,LCD_WIDTH,LCD_HEIGHT,0);

	

	//ActiveListPush();

	//TurnOnLCD();

	//ActiveAreaEnable( (P_U32)&XAreaId,ICON_AREA,STROKE_MODE,0,0,LCD_WIDTH-1,LCD_HEIGHT-1);

	

	//ClearScreen(WHITE);

	//DrawRec(BLACK,0,0,LCD_WIDTH-1,LCD_HEIGHT-1,0,REPLACE_STYLE);

	//ClearIrptData();

	//DrawRec(BLACK,0,0,LCD_WIDTH-1,LCD_HEIGHT-1,0,REPLACE_STYLE);

	//DrawRec(BLACK,0,0,LCD_WIDTH-1,20,0,REPLACE_STYLE);

	

	

	//memset((char *)CtrlIcon,0x0, 3*sizeof(U32));

	

	//DrawTextIcon((P_U32)&CtrlIcon[0],1,220,52,19,GB_NORMAL_FONT,"删除",0,BLACK,PositionMiddle);

	//DrawTextIcon((P_U32)&CtrlIcon[2],105,220,53,19,GB_NORMAL_FONT,"返回",0,BLACK,PositionMiddle);

	

	InboxIndex=(struct inbox_index *)(Datatemp+INBOX_INDEX_HEAD);

	OutboxIndex=(struct outbox_index *)(Datatemp+OUTBOX_INDEX_HEAD);

	

	 if (mode==INBOXLIST){

		//sprintf(line,"%s%s",title,"-[收件箱]");

		//DrawTextIcon((P_U32)&CtrlIcon[1],53,220,52,19,GB_NORMAL_FONT,"回复",0,BLACK,PositionMiddle);

		

		if (mailhead->flag==MAILUNREADED){

			InboxIndex[mailhead->index].flag=MAILREADED;

			mchanged=TRUE;

			Mailed=TRUE;

		}

		mailptr1=Datatemp+INBOX_HEAD+InboxIndex[mailhead->index].headoff;

	

			

			

	}else if (mode==OUTBOXLIST){

		//sprintf(line,"%s%s",title,"-[发件箱]");

		//DrawTextIcon((P_U32)&CtrlIcon[1],53,220,52,19,GB_NORMAL_FONT,"修改",0,BLACK,PositionMiddle);

		

		mailptr1=Datatemp+OUTBOX_HEAD+OutboxIndex[mailhead->index].headoff;

	}else if (mode==SENTBOXLIST){

		//sprintf(line,"%s%s",title,"-[已发送]");

		//DrawTextIcon((P_U32)&CtrlIcon[1],53,220,52,19,GB_NORMAL_FONT,"重发",0,BLACK,PositionMiddle);

		

		mailptr1=Datatemp+OUTBOX_HEAD+OutboxIndex[mailhead->index].headoff;

		

	}

	

	//i=sizeof(mailptr)/50;

	//if(sizeof(mailptr)%50 != 0)i++;

	//for(j=0;j<i;j++)memcpy(page[j],mailptr+j*50,50);

	

		

	

	

	

	

	gc=GetGC();

	ClearScreen(gc,GPC_WHITE);

	if (mode==INBOXLIST){	

		readwin=CreateWindow(WNDCLASS_WIN,"邮件[收件箱]",WS_OVERLAPPEDWINDOW,0,0,159,239,0,0,NULL);

		bt_1=CreateWindow(WNDCLASS_BUTTON, "回复", WS_CHILD|BS_TOOLBAR,53,223,53,16,readwin,0,NULL);

	

        }else if (mode==OUTBOXLIST){

	        readwin=CreateWindow(WNDCLASS_WIN,"邮件[发件箱]",WS_OVERLAPPEDWINDOW,0,0,159,239,0,0,NULL);

		bt_1=CreateWindow(WNDCLASS_BUTTON, "修改", WS_CHILD|BS_TOOLBAR, 53,223,53,16,readwin,0,NULL);

	

        }else if (mode==SENTBOXLIST){

	readwin=CreateWindow(WNDCLASS_WIN,"邮件[已发送]",WS_OVERLAPPEDWINDOW,0,0,159,239,0,0,NULL);

		bt_1=CreateWindow(WNDCLASS_BUTTON, "重发", WS_CHILD|BS_TOOLBAR, 53,223,53,16,readwin,0,NULL);

	}	

	bt_delete=CreateWindow(WNDCLASS_BUTTON, "删除", WS_CHILD|BS_TOOLBAR, 0,223,53,16,readwin,0,NULL);		

	bt_up=CreateWindow(WNDCLASS_BUTTON, "上一页", WS_CHILD|BS_TOOLBAR, 130,163,53,16,readwin,0,NULL);

	bt_exit=CreateWindow(WNDCLASS_BUTTON, "返回", WS_CHILD|BS_TOOLBAR, 106,223,53,16,readwin,0,NULL);

	bt_down=CreateWindow(WNDCLASS_BUTTON, "下一页", WS_CHILD|BS_TOOLBAR, 130,208,53,16,readwin,0,NULL);					

	//Disp16StringCenter(line,0,LCD_WIDTH,2);

        //CtrlIconEnable(&UpId,3,3,PPSM_ICON_16_UP);

        //CtrlIconEnable(&DownId,139,3,PPSM_ICON_16_DOWN);

	



	//memset(Page,0x0,50*sizeof(char *));	

	//Page[0]=mailptr;

	//Page[1]=DisplayHelp(mailptr,5,22,158,204,WITHOUT_INVERT);

	//timeCount=timeOutLen;

	//Disp16String(mailptr1/*page[index-1]*/,0,40);

	//bt_text=CreateWindow(WNDCLASS_STATIC, mailptr1, WS_CHILD|SS_TEXT|SS_BOARD, 0,40,118,80,readwin,0,NULL);



	SysDrawText(gc, GPC_BLACK, 2, 40, 150, 180,mailptr1,GPC_REPLACE_STYLE);

	quit=0;

	while(!quit)

		{

		ASIXGetMessage(&Msg, NULL, 0, 0);

		

		                  switch ( Msg.message )

		                  {

			              case	ASIX_RTC:

				                break;



			              case	WM_COMMAND:               

				                if(Msg.lparam == bt_up){

				

                   			         				

                   				if (index>1) index--;

                   				else index=1;SysClearRec(gc,GPC_WHITE,0,40,120,80,GPC_PAINT_STYLE);

                   				Disp16String(page[index-1],0,40);                 				

                   				//Page[index]=DisplayHelp(Page[index-1],5,22,158,204,WITHOUT_INVERT);

                   			}else if (Msg.lparam == bt_down){

                   				if (index>=i) break;

                   		                 				

                   				index++;SysClearRec(gc,GPC_WHITE,0,40,120,80,GPC_PAINT_STYLE);

                   				

                   				Disp16String(page[index-1],1,40);  

                   				//Page[index]=DisplayHelp(Page[index-1],5,22,158,204,WITHOUT_INVERT);

                   			}else if (Msg.lparam == bt_exit){		

                   				quit=1;

                   			}else if (Msg.lparam == bt_delete){

                   				if (mode==INBOXLIST) {

                   					rv=DelMail(mailhead->index,DELINBOX,1);

                   				}else{ 

                   					rv=DelMail(mailhead->index,DELOUTBOX,1);

                   				}	

                   				if (rv==0) {

                   					quit=1;

                   					mchanged=TRUE;

                   				}	

                   			}else if (Msg.lparam == bt_1){

                   				if (mode==INBOXLIST){

                   					//ActiveListPush();

                   					rv=NewMail(mailhead,REPLY_MAIL);

                   					//ActiveListPop();

                   				}else if (mode==OUTBOXLIST){

                   					//ActiveListPush();

                   					rv=NewMail(mailhead,EDIT_MAIL);

                   					//ActiveListPop();

                   				}else if (mode==SENTBOXLIST){

                   					//ActiveListPush();

                   					rv=NewMail(mailhead,RESEND_MAIL);

                   					//ActiveListPop();

                   				}

                   				if (rv==0) 

                   					mchanged=TRUE;

                   				quit=1;	

                   			}				

                   						

                   					

                   			

                   		

                   			

                   				

				break;

		

				case	WM_QUIT:

				               	quit=1;

				                break;	

 			     	     default:

 			     	      		break;	

			}DefWindowProc(Msg.message, Msg.lparam, Msg.data, Msg.wparam);

		}

	

	//ActiveAreaDisable(UpId);

	//ActiveAreaDisable(DownId);

	//for (index=0;index<3;index++)

	//	if (CtrlIcon[index]!=0)

	//		ActiveAreaDisable(CtrlIcon[index]);

	//ActiveAreaDisable(XAreaId);

	

	//PutRec(lcdBuffer,0,0,LCD_WIDTH,LCD_HEIGHT,REPLACE_STYLE,0);

	//Lfree(lcdBuffer);

	//ActiveListPop();

	DestroyWindow(readwin);

	if (mchanged) { 

		return 2;

	}else{ 

		return 0;

	}		

	

}



/*char * rip1(s)

{

    char *cp;

    char *c;

    

	c=(char *)malloc(sizeof(s));

    if( c != NULL){

       	strcpy(c,s); 

	    if((cp = strchr(c,'\n')) != NULL)

		   *cp = '\0';

    	if((cp = strchr(c,'\r')) != NULL)

		   *cp = '\0';

	}

    return c;

}*/

void mailrip(void *s)

{

    char *cp;

        

	if((cp = strchr(s,'\n')) != NULL)

		*cp = '\0';

	if((cp = strchr(s,'\r')) != NULL)

		*cp = '\0';

}



void rip(void *s)

{

    char *cp;

        

	if((cp = strchr(s,'\n')) != NULL)

		*cp = '\0';

	if((cp = strchr(s,'\r')) != NULL)

		*cp = '\0';

}



char *readline(char *bufptr)

{



	static char buffer[259]; /* we define the buffer as a static array 11/26/1999 */

	register char *buffer2;

	register int i=0;

	

	buffer2=bufptr;

	if (buffer2==NULL||*buffer2=='\0') {

		buffer[0]='\0';

		return buffer;

	}

	

	while( (*buffer2!='\n') && ( i<256 ) ){/* we add the boundary check here. 11/26/1999*/

		buffer[i]=*buffer2;

		buffer2++;

		i++;

	}

	buffer[i++]='\n';

	buffer[i++]='\0';

	return buffer;

}

⌨️ 快捷键说明

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