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

📄 mmiidle.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 5 页
字号:

			idle_data.new_cbch = TRUE;
			break;

		/*NM p019*/
		case IdleNewSmsMessage:			
			if(cbch_string NEQ NULL)
			{
			/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
			if (!idle_data.editor)
				{
			       	idle_data.editor = ATB_edit_Create(&idle_data.editor_attr3,0);	
				}
				memset(idle_data.incoming_sms_msg, '\0',MAX_MSG_LEN_ARRAY);
				strcpy((char *)idle_data.incoming_sms_msg,  (char *)cbch_string);
				ATB_edit_Init(idle_data.editor);
			}
			else
			{
				if (idle_data.editor)
				{
					ATB_edit_Destroy(idle_data.editor);
				}

			
				idle_data.editor = 0;		
				memset(idle_data.incoming_sms_msg, '\0',MAX_MSG_LEN_ARRAY);
			}
#else /* NEW_EDITOR*/
			if (!idle_data.edt)
				{
			       	idle_data.edt = edtCreate  (idle_data.win,&idle_data.edt_attr3,0,0);	
				}
				memset(idle_data.incoming_sms_msg, '\0',MAX_MSG_LEN_ARRAY);
				strcpy((char *)idle_data.incoming_sms_msg,  (char *)cbch_string);

			}
			else
			{
				if (idle_data.edt)
				{
					edtDelete(idle_data.edt);
				}

			
				idle_data.edt = 0;		
				memset(idle_data.incoming_sms_msg, '\0',MAX_MSG_LEN_ARRAY);
			}
#endif /* NEW_EDITOR */
			break;

	}


}

/*******************************************************************************

 $Function:    	statusCBCH

 $Description:	if True -> keep it on the idle screen 
                if FALSE -> remove the message (CB or SMS)
                           and destroy the editor

 $Returns:		

 $Arguments:	
 				
*******************************************************************************/

void statusCBCH(UBYTE status)
{
	if(status)
	{

		windowsUpdate();

	}
	else
	{

		//Dont show the CB on the Idle screen

		idle_data.new_cbch = FALSE;
		/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
		if (idle_data.editor)
			ATB_edit_Destroy(idle_data.editor);
		idle_data.editor = 0;	

		//set the centralize for the cb message to default
		idle_data.editor_attr2.startFormat.attr = 0;
		
#else /* NEW_EDITOR */
		if (idle_data.edt)
			edtDelete(idle_data.edt);
		idle_data.edt = 0;	

		//set the centralize for the cb message to default
		idle_data.edt_attr2.win.px = WIN_DIALLING_ORG_X;
#endif /*NEW_EDITOR */
	}


}


/*******************************************************************************

 $Function:    	addSatMessage

 $Description:	Store a SAT message to display on the idle screen.
 				SPR759 - SH.

 $Returns:		

 $Arguments:	satMessage	- the text of the message
 				
*******************************************************************************/

void addSatMessage(char *satMessage)
{
	/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
	if(satMessage NEQ NULL)
	{
		if(!idle_data.editor_sat)
		{
			idle_data.editor_sat = ATB_edit_Create(&idle_data.editor_attr_sat,0);  /* Create the editor to hold it */
		}
		memset(idle_data.incoming_sat_msg, '\0',MAX_CBMSG_LEN);
		strcpy((char *)idle_data.incoming_sat_msg, (char *)satMessage);

		/* Centralize sat message if below 12 characters (so it doesn't look odd on the screen) */
		
		if ((strlen(satMessage)) < 12)
			idle_data.editor_attr.startFormat.attr |= DS_ALIGN_CENTRE;

		ATB_edit_Init(idle_data.editor);

	}
	else		/* If a null string is passed, get rid of the message */
	{
		if (idle_data.editor_sat)
		{
			ATB_edit_Destroy(idle_data.editor_sat);
		}

		//set the centralize for the cb message to default
		idle_data.editor_attr_sat.startFormat.attr = 0;

		idle_data.editor_sat = NULL;		
		memset(idle_data.incoming_sat_msg, '\0',MAX_CBMSG_LEN);
	}
#else /* NEW_EDITOR */
	if(satMessage NEQ NULL)
	{
		if(!idle_data.edt_sat)
		{
			idle_data.edt_sat = edtCreate(idle_data.win,&idle_data.edt_attr_sat,0,0);  // Create the editor to hold it
		}
		memset(idle_data.incoming_sat_msg, '\0',MAX_CBMSG_LEN);
		strcpy((char *)idle_data.incoming_sat_msg, (char *)satMessage);

		//Centralize sat message if below 12 characters (so it doesn't look odd on the screen)
		
		if ((strlen(satMessage)) < 12)
			idle_data.edt_attr_sat.win.px = (SCREEN_SIZE_X-strlen(idle_data.edt_attr_sat.text)*6)/2;
		else
			idle_data.edt_attr_sat.win.px = WIN_DIALLING_ORG_X;
	}
	else		// If a null string is passed, get rid of the message
	{
		if (idle_data.edt_sat)
		{
			edtDelete(idle_data.edt_sat);
		}

		//set the centralize for the cb message to default
		idle_data.edt_attr_sat.win.px = WIN_DIALLING_ORG_X;

		idle_data.edt_sat = NULL;		
		memset(idle_data.incoming_sat_msg, '\0',MAX_CBMSG_LEN);
	}
#endif /* NEW_EDITOR */
	return;
}

/*******************************************************************************

 $Function:    	idleDialBuffer

 $Description:	 
 
 $Returns:		

 $Arguments:	
 				
*******************************************************************************/


void idleDialBuffer(char* dialBuffer)
{
	memset(idle_data.edt_buf,'\0',sizeof(idle_data.edt_buf));
	strncpy((char*)idle_data.edt_buf,(char*)dialBuffer,sizeof(idle_data.edt_buf)-1);
	idle_dialling_start(idle_data.win,NULL);
}


/*******************************************************************************

 $Function:    	windowsUpdate

 $Description:	 
 
 $Returns:		

 $Arguments:	
 				
*******************************************************************************/


void windowsUpdate(void)
{
	TRACE_FUNCTION("Idle_update()");
	winShow(idle_data.win);						


}



/*******************************************************************************

 $Function:    	idle_dialling_create

 $Description:	 
 
 $Returns:		

 $Arguments:	
 				
*******************************************************************************/


T_MFW_HND idle_dialling_create (T_MFW_HND parent_window)
{
    T_MFW_WIN     * win;

    /*
     * This window is dynamic, for that reason the associated data are allocated in the mfw heap
     */

	T_idle_dialling *  data = (T_idle_dialling *)ALLOC_MEMORY (sizeof (T_idle_dialling));

	TRACE_FUNCTION ("idle_dialling_create");

    /*
     * Create window handler
     */

    data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)idle_dialling_win_cb);

    if (data->win EQ 0)
      return 0;

	 /*
     * These assignments are necessary to attach the data to the window, and to handle the mmi event communication.
     */

	data->mmi_control.dialog    = (T_DIALOG_FUNC)idle_dialling;
    data->mmi_control.data      = data;
    win                         = ((T_MFW_HDR *)data->win)->data;
    win->user                   = (void *) data;

    /*
    * Create any other handler
    */
	/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
	data->editor	= ATB_edit_Create(&idle_data.editor_attr, 0);
#else /* NEW_EDITOR */
	data->edt      = edtCreate  (data->win,&idle_data.edt_attr,0,0);
#endif /* NEW_EDITOR */
    data->kbd      = kbd_create (data->win,KEY_ALL,(T_MFW_CB)idle_dialling_kbd_cb);
    data->kbd_long = kbd_create (data->win,KEY_ALL|KEY_LONG,(T_MFW_CB)idle_dialling_kbd_long_cb);


  //winShow(data->win);
  /*
   * return window handle
   */
  return data->win;
}



/*******************************************************************************

 $Function:    	idle_dialling_destroy

 $Description:	 
 
 $Returns:		

 $Arguments:	
 				
*******************************************************************************/



void idle_dialling_destroy (T_MFW_HND own_window)
{
  T_MFW_WIN     * win;
  T_idle_dialling        * data;

	TRACE_FUNCTION("idle_dialling_destroy");

  if (own_window)
  {
    win  = ((T_MFW_HDR *)own_window)->data;
    data = (T_idle_dialling *)win->user;

    if (data)
    {
      /*
       * Exit Keyboard Handler
       */
      /*NM, 26.3.02*/
      /* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
      ATB_edit_Destroy(data->editor);
#else/* NEW_EDITOR */
	  edt_delete(data->edt);
#endif /* NEW_EDITOR */
      kbd_delete(data->kbd);
      kbd_delete(data->kbd_long);
      /*
       * Delete WIN Handler
       */
      win_delete (data->win);
    }

   /*
   *  In this case the data attached to window must be also deleted.
   */


	FREE_MEMORY ((void *)data, sizeof (T_idle_dialling));
  }
}


/*******************************************************************************

 $Function:    	idle_dialling_start

 $Description:	 This function just creates and inits the new dialog
 
 $Returns:		

 $Arguments:	
 				
*******************************************************************************/




T_MFW_HND idle_dialling_start (T_MFW_HND win_parent,char *character)
{


  T_MFW_HND win = idle_dialling_create (win_parent);

  TRACE_FUNCTION("idle_dialling_start");

  if (win NEQ NULL)
  {
		SEND_EVENT(win,IDLE_DIALLING_INIT,0,(char*)character);
  }
  return win;

}



/*******************************************************************************

 $Function:    	idle_dialling

 $Description:	 
 
 $Returns:		

 $Arguments:	
 				
*******************************************************************************/



void idle_dialling (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
{
    T_MFW_WIN      * win_data = ((T_MFW_HDR *) win)->data;
    T_idle_dialling         * data = (T_idle_dialling *)win_data->user;

    TRACE_FUNCTION ("idle_dialling()");
   /*
   *  In this case the communication is very simple (only one intern event)
   */

	//GW Use macros for screen size
    switch (event)
	{
		case IDLE_DIALLING_INIT:
		/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
			AUI_edit_SetAttr(&idle_data.editor_attr, WIN_DIALLING, COLOUR_EDITOR_XX, EDITOR_FONT, 0, ED_CURSOR_UNDERLINE, ATB_DCS_ASCII, (UBYTE*)idle_data.edt_buf,EDITOR_SIZE);

			ATB_edit_Init(data->editor);

			ATB_edit_Unhide(data->editor);
			ATB_edit_Char(data->editor, ctrlBottom, TRUE);
#else /* NEW_EDITOR */
			bookSetEditAttributes(WIN_DIALLING,COLOUR_EDITOR_XX,0,edtCurBar1,0,(char*)idle_data.edt_buf,EDITOR_SIZE,&idle_data.edt_attr);

			/* NM 13.03 fast-edit */
			editActivate (data->edt,FALSE);

			edtUnhide(data->edt);
			edtChar(data->edt,ecBottom);
#endif /* NEW_EDITOR */
			winShow(data->win);
		break;
	    default:
		return;
	}

}



/*******************************************************************************

 $Function:    	idle_dialling_win_cb

 $Description:	 
 
 $Returns:		

 $Arguments:	
 				
*******************************************************************************/


static int idle_dialling_win_cb (MfwEvt evt, MfwWin *win)
{
    T_idle_dialling         * data = (T_idle_dialling *)win->user;
    
    TRACE_FUNCTION ("idle_dialling_win_cb()");
	switch (evt)
    {
        case MfwWinVisible:
			/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
			/* If update is trivial, don't update what's underneath */
			if (data->editor->update!=ED_UPDATE_TRIVIAL)
			{
				idle_draw_main_idle();
				displaySoftKeys(TxtNames,TxtDelete);
			}
			ATB_edit_Show(data->editor);

			data->editor->update = ED_UPDATE_DEFAULT;
#else /* NEW_EDITOR */
			idle_draw_main_idle();
			edtShow(data->edt);
			displaySoftKeys(TxtNames,TxtDelete);
#endif /* NEW_EDITOR */
        break;
        default:
        return 0;
    }

    return 1;
}


/*******************************************************************************

 $Function:    	idle_dialling_kbd_cb

 $Description:	 
 
 $Returns:		

 $Arguments:	
 				
*******************************************************************************/


static int idle_dialling_kbd_cb (MfwEvt e, MfwKbd *k)
{
	/*
     * The following lines describe the common method to extract the data from the window. This mfw_parent(mfw_header())
	 * construction captures the current mfw handled window.
     */
	T_MFW_HND			win				= mfw_parent (mfw_header());
    T_MFW_WIN			*win_data		= ((T_MFW_HDR *)win)->data;
    T_idle_dialling		*data			= (T_idle_dialling *)win_data->user;
    T_MFW_SS_RETURN		ssRes;
	T_MFW_PHB_ENTRY		p_pEntry;    
	tMmiPhbData			*current		= (tMmiPhbData *)ALLOC_MEMORY (sizeof (tMmiPhbData ));
	U8 					finishedHere	= FALSE;	/* SH- used to skip out part of function */
	int					position		= 0;
	char				edt_bu

⌨️ 快捷键说明

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