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

📄 mmidialogs.c

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

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

					CONDAT (UK)

********************************************************************************                                                                              

 This software product is the property of Condat (UK) Ltd and may not be
 disclosed to any third party without the express permission of the owner.                                 
                                                                              
********************************************************************************

 $Project name:	Basic MMI                                                      
 $Project code:	BMI (6349)                                                           
 $Module:		MmiDialogs
 $File:		    MmiDialogs.c
 $Revision:		1.0                                                       
                                                                              
 $Author:		Condat(UK)                                                         
 $Date:		    25/10/00                                                      
                                                                               
********************************************************************************
                                                                              
 Description:MMI Information dialogue handling.
 

                        
********************************************************************************

 $History: MmiDialogs.c

	25/10/00			Original Condat(UK) BMI version.	
	   
 $End

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


/*******************************************************************************
                                                                              
                                Include Files
                                                                              
*******************************************************************************/
#define ENTITY_MFW

/* includes */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#if defined (NEW_FRAME)

#include "typedefs.h"
#include "vsi.h"
#include "pei.h"
#include "custom.h"
#include "gsm.h"

#else

#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"

#endif


#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
/* SPR#1428 - SH - New Editor changes */
#ifndef NEW_EDITOR
#include "mfw_edt.h"
#endif
#include "mfw_tim.h"
#include "mfw_phb.h"
#include "mfw_sms.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_lng.h"
#include "mfw_sat.h"
#include "mfw_kbd.h"
#include "mfw_nm.h"

#include "dspl.h"

#include "ksd.h"
#include "psa.h"

#include "MmiMain.h"
#include "MmiDummy.h"
//JVJE #include "MmiMsgsEdit.h"
//#include "MmiLists.h"
#include "MmiMmi.h"

#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"

/* JF Modified
*/
#include "MmiBookController.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"

#include "mmiColours.h"

void dlg_initDisplayData_type( T_DISPLAY_DATA *displayInfo, U32 displayCol, int dlgType, T_BITMAP* dlgBitmap , int dlgSKFormat );

/*
 * START NEW PART
 */


typedef struct
{
  T_MMI_CONTROL   mmi_control;
  T_MFW_HND       parent_win;
  T_MFW_HND       info_win;
  T_MFW_HND       info_tim;
  T_MFW_HND       info_kbd;
  T_MFW_HND       info_kbd_long;
  T_MFW_HND       icon;  
	/*
   * animation fields
   */
  UBYTE			   number_of_frames;
  UBYTE			   current_frame;
  T_MFW_HND		   anim_time;
  MfwIcnAttr        *icon_array;  
  MfwIcnAttr        *current_icon;  
  T_MFW_HND       animation_timer;  

	/*
   * internal data
   */
  char          *TextString;
  USHORT		LeftSoftKey;
  USHORT		RightSoftKey;
  char			*LSKString;		// SH - text for left soft key
  char			*RSKString;		// SH - text for right soft key
  BOOL			SoftKeyStrings;		// SH - TRUE if using text rather than IDs for soft keys
  UBYTE			WrapStrings;	// GW - bits 0,1 set=wrap string 1,2
  ULONG        Time;
  T_MFW_EVENT  KeyEvents;
  USHORT       TextId;
  USHORT       Identifier;
  char *        TextString2;
  USHORT       TextId2;
  T_VOID_FUNC  Callback;

  U32		dlgCol;
  U32		dlgType;
  T_BITMAP	*dlgBgdBitmap;
  int		dlgSkFormat;
} T_dialog_info;

static T_MFW_HND   dialog_info_create    (T_MFW_HND  parent_win);
static void        dialog_info_destroy   (T_MFW_HND  own_window);
static void        dialog_info           (T_MFW_HND  win,
                                          USHORT event, SHORT value, void * parameter);

static int         dialog_info_win_cb    (T_MFW_EVENT event, T_MFW_WIN * win);
static int 	dialog_info_win_resize_cb (T_MFW_EVENT event, T_MFW_WIN * win);

static T_MFW_CB    dialog_info_tim_cb    (T_MFW_EVENT event, T_MFW_TIM * tc);
static int         dialog_info_kbd_cb    (T_MFW_EVENT event, T_MFW_KBD * keyboard);
static int         dialog_info_kbd_long_cb (T_MFW_EVENT event, T_MFW_KBD * keyboard);
void mmi_dialogs_insert_animation_CB (T_MFW_EVENT event, T_MFW_TIM *tc);
void mmi_dialogs_animation_new_CB (T_MFW_EVENT event, T_MFW_TIM *tc);


MfwRect calcLayout( int dlgType, int dataSx, int dataSy, int bmpSx, int bmpSy)
{
	MfwRect area;
	int px,py;
	int sx,sy;

	TRACE_EVENT_P5("dlgType,= %d, dataSx = %d, dataSy = %d, bmpSx = %d, bmpSy = %d", dlgType, dataSx, dataSy, bmpSx, bmpSy);

	/*Adjust area available for drawing by the border */
	switch (dlgType & DLG_BORDER_VERTICAL)
	{
		case DLG_BORDER_VERTICAL_0:	sx =bmpSx;			break;
		case DLG_BORDER_VERTICAL_1:	sx =bmpSx*6/8;		break;
		case DLG_BORDER_VERTICAL_2:	sx =bmpSx*4/8;		break;
		case DLG_BORDER_VERTICAL_3:	sx =bmpSx*3/8;		break;
	}
	if (sx < dataSx)
		sx = dataSx;
	px = 0;

	switch (dlgType & DLG_BORDER_HORIZONTAL)
	{
		case DLG_BORDER_HORIZONTAL_0:	sy =bmpSy;			break;
		case DLG_BORDER_HORIZONTAL_1:	sy =bmpSy*6/8;		break;
		case DLG_BORDER_HORIZONTAL_2:	sy =bmpSy*4/8;		break;
		case DLG_BORDER_HORIZONTAL_3:	sy =bmpSy*3/8;		break;
	}
	if (sy < dataSy)
		sy = dataSy;
	py = 0;

	switch (dlgType & (DLG_INFO_LAYOUT_LEFT	| DLG_INFO_LAYOUT_RIGHT))
	{
		case DLG_INFO_LAYOUT_CENTRE:	//display info in centre of display
			px = px + (sx-dataSx)/2;
			sx = dataSx;
			break;
		case DLG_INFO_LAYOUT_RIGHT:	//all info is displayed at the foot of trhe display
			px = px+(sx-dataSx);
			sx = dataSx;
			break;
		case DLG_INFO_LAYOUT_LEFT:		//display all info at the top of the bitmap
			sx = dataSx;
			break;
		default:						//display info over entire area					
			break;
	}
	
	switch (dlgType & (DLG_INFO_LAYOUT_BOTTOM	| DLG_INFO_LAYOUT_TOP))
	{
		case DLG_INFO_LAYOUT_CENTRE:							//display info in centre of display
			py = py + (sy-dataSy)/2;
			sy = dataSy;
			break;
		case DLG_INFO_LAYOUT_BOTTOM:	//all info is displayed at the foot of trhe display
			py = py+(sy-dataSy);
			sy = dataSy;
			break;
		case DLG_INFO_LAYOUT_TOP:		//display all info at the top of the bitmap
			sy = dataSy;
			break;
		default:						//display info over entire area					
			break;
	}
	area.px = px;	area.py = py;
	area.sx = sx;	area.sy = sy;	//Area sx/sy must be no smaller than dataSx/Sy
	return (area);
}


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

 $Function:    	info_dialog

 $Description:	Common information dialog
 
 $Returns:		Dialogue info win

 $Arguments:	parent win, display info
 
*******************************************************************************/
T_MFW_HND info_dialog (T_MFW_HND        parent_win,
                       T_DISPLAY_DATA * display_info)
{
  T_MFW_HND win;

  display_info->SoftKeyStrings = FALSE;
  
  win = dialog_info_create (parent_win);

  if (win NEQ NULL)
  {
    SEND_EVENT (win, DIALOG_INIT, 0, display_info);
  }
  return win;
}


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

 $Function:    	info_dialog_softkeystrings

 $Description:	Common information dialog, sets "softkeystrings" to TRUE
 
 $Returns:		Dialogue info win

 $Arguments:	parent win, display info, leftsoftkey, rightsoftkey
 
*******************************************************************************/
T_MFW_HND info_dialog_softkeystrings (T_MFW_HND parent_win, T_DISPLAY_DATA * display_info)
{
  T_MFW_HND win;

  display_info->SoftKeyStrings = TRUE;
  win = dialog_info_create (parent_win);

  if (win NEQ NULL)
  {
    SEND_EVENT (win, DIALOG_INIT, 0, display_info);
  }
  return win;
}


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

 $Function:    	dialog_info_create

 $Description:	Creation of an information dialog
 
 $Returns:		Dialogue info win

 $Arguments:	parent win
 
*******************************************************************************/
static T_MFW_HND dialog_info_create (T_MFW_HND parent_win)
{
  T_MFW_WIN     * win_data;
  T_dialog_info *  data = (T_dialog_info *)ALLOC_MEMORY (sizeof (T_dialog_info));
  TRACE_FUNCTION ("dialog_info_create()");

  data->info_win = win_create (parent_win, 0, E_WIN_VISIBLE, (T_MFW_CB)dialog_info_win_resize_cb);

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

  /*
   * Create window handler
   */
  data->mmi_control.dialog   = (T_DIALOG_FUNC)dialog_info;
  data->mmi_control.data     = data;
  data->parent_win           = parent_win;
  win_data                   = ((T_MFW_HDR *)data->info_win)->data;
  win_data->user             = (void *)data;

  /*
   * return window handle
   */
  return data->info_win;
}


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

 $Function:    	dialog_info_destroy

 $Description:	Destruction of an information dialog
 
 $Returns:		void

 $Arguments:	win
 
*******************************************************************************/
void dialog_info_destroy (T_MFW_HND own_window)
{
  T_MFW_WIN     * win  = ((T_MFW_HDR *)own_window)->data;
  T_dialog_info * data = (T_dialog_info *)win->user;

  TRACE_FUNCTION ("dialog_info_destroy()");

  if (own_window == NULL)
  {
	TRACE_EVENT ("Error :- Called with NULL Pointer");
	return;
  }
	
  if (data)
  {
    /*
     * Exit TIMER & KEYBOARD Handle
     */
    kbd_delete (data->info_kbd);
    tim_delete (data->info_tim);

    if(data->animation_timer != 0)
    {
    	timDelete(data->animation_timer);

    	if (data->icon != 0)
    		icnDelete(data->icon);
    }

    /*
     * Delete WIN Handler
     */
    win_delete (data->info_win);
    /*
     * Free Memory
     */
    FREE_MEMORY ((void *)data, sizeof (T_dialog_info));
  }
}

void dlg_zeroDisplayData( T_DISPLAY_DATA *displayInfo)
{

	TRACE_EVENT("dlg_zeroDisplayData()");
	if (displayInfo == NULL)
		return;
	displayInfo->LeftSoftKey 	= 0;
	displayInfo->RightSoftKey 	= 0;
	displayInfo->LSKString 		= NULL;
	displayInfo->RSKString 		= NULL;
	displayInfo->TextString 	= NULL;
	displayInfo->TextString2 	= NULL;
	
    displayInfo->WrapStrings 	= 0;
	
    displayInfo->TextId       	= 0;
    displayInfo->TextId2      	= 0;
    
	displayInfo->SoftKeyStrings	= FALSE;
	
    displayInfo->Identifier   	= 0;
	displayInfo->anim_time		= 0;
	displayInfo->number_of_frames	= 0;
	displayInfo->current_frame		= 0;

	dlg_initDisplayData_events( displayInfo, NULL, 0, 0);
    
	dlg_initDisplayData_type( displayInfo, COLOUR_POPUP, 0, NULL, 0 );
    
}

void dlg_initDisplayData_TextId( T_DISPLAY_DATA *displayInfo, int lsk, int rsk, int str1, int str2, int colId)
{
	if (displayInfo == NULL)
		return;
	dlg_zeroDisplayData(displayInfo);
	displayInfo->LeftSoftKey	= (USHORT)lsk;
	displayInfo->RightSoftKey	= (USHORT)rsk;
	displayInfo->TextId 		= str1;
	displayInfo->TextId2 		= str2;
	displayInfo->displayCol 	= colId ;
	

⌨️ 快捷键说明

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