📄 mmienvironment.c
字号:
/********************************************************************************
$History: Mmienvironment.c
$12/07/02 Original BMI version.
$author: xsf (Mobile Innovation)
$End
*******************************************************************************/
/*******************************************************************************
modify hostory:mmienvironment.c
12/07/02 version 0.001 Original BMI version.
29/08/02 version 0.002 xsf modified for ajusting melody volume
*******************************************************************************/
/*******************************************************************************
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_sys.h"
#include "mfw_mfw.h"
#include "mfw_kbd.h"
#include "mfw_tim.h"
#include "mfw_lng.h"
#include "mfw_win.h"
#include "mfw_icn.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "mfw_edt.h"
#include "mfw_mnu.h"
#include "mfw_phb.h"
#include "mfw_sms.h"
#include "dspl.h"
#include "p_mmi.h"
#include "aci_cmh.h"
#include "mfw_mme.h"
#include "MmiMmi.h"
#include "MmiIcons.h"
#include "MmiPins.h"
#include "MmiMain.h"
#include "MmiDialogs.h"
#include "MmiIdle.h"
#include "MmiStart.h"
#include "MmiCall.h"
#include "MmiSimToolkit.h"
#include "gdi.h"
#include "Audio.h"
#include "MmiLists.h"
#include "MmiSounds.h"
#include "MmiResources.h"
#include "MmiTimeDate.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "MmiTimers.h"
#include "rv_general.h"
#include "Audio_api.h"
#include "Mmisounds.h"
#include "Mmiicons.h"
#include "mmiQQSwitch.h" //hxl add for check qq func
//#define TDTRACE 1
#include "mmiutilapi.h"
// 2004.3.18 WYJ add
#define RI_INIT 100
#define RI_DESTROY 101
#define RI_SELECT 102 //call in ring select
#define AL_SELECT 103 //alarm
#define SM_SELECT 104 //sms
#define PO_SELECT 105 //power on
#define PF_SELECT 106 //power off
#define HO_SELECT 107 //hall on
#define HF_SELECT 108 //hall off
#define GP_SELECT 109 //group
/* 2004/05/18 sunsj modify */
#if ( MAIN_LCD_SIZE==2 )
/* ring select pictures */
extern const unsigned char musicPlay0[];
extern const unsigned char musicPlay1_a[];
extern const unsigned char musicPlay1_b[] ;
extern const unsigned char musicPlay2_a[] ;
extern const unsigned char musicPlay2_b[] ;
extern const unsigned char musicPlay3[] ;
extern const unsigned char musicPlay4[] ;
extern const unsigned char musicPlay5_a[] ;
extern const unsigned char musicPlay5_b[] ;
#endif
static void envconfirm_dialog(void);
static MfwHnd l_timPlay; /* timer one second handle to begain play melody */
// 2004.4.1 wyj call no win
extern MfwHnd hRingVibStartTimer; /* timeout for vibrator then start of melody */
static UINT8 l_playing = INCALLPLAY; //xsf 2002.08.14
static MfwHnd LedStartTimer; /* 2004/03/18 sunsj add */
int isKeyRing = 0; //放音标志 1-禁止按键音wyj
int isOnOffMenuRing = 0; //放音标志 1-禁止按键音wyj
UINT8 Gu8_Envio_num = 0; //enter which enviroment flag
UINT8 melody_status = MELODY_IDLE;
UINT8 tone_status = TONE_IDLE;
UINT8 vibra_status = VIBRA_IDLE;
//2003.1.13 WYJ add 是否开机菜单
static UINT8 isOnRing = 0;
extern char currentringstr[20]; //xsf extern from mmisounds.c 2002.09.06
extern char oldringstr[20]; //xsf add 2002.09.06
extern T_call call_data;
extern UINT32 driverFlag; //wms added 02/12/28
extern BOOL call_win_flag;
#define SHOW_CONFIRM 3
#define ACTIVATE_CONFIRM 4 // mute activated
#define DEACTIVATE_CONFIRM 5
#define PLAYTONE 2 //xsf change (0xFF) to 2 2002.09.16
#define INFO_TEXT_X 10
#define INFO_TEXT_Y 10 //xsf add 2002.08.27
#define ModeIdle 0x001 /*in Idle Screen */
#define ModeCall 0x002 /*in during a call */
#define ModeIncomCall 0x004 /*in Incoming call */
#define ModeRingmnu 0x008
#define ModeVoicememo 0x010 /*in Dialling state */
#define ModeSms 0x020 /*in SMS */
#define ModeAlarm 0x040 /*in Alarm */
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND confirm_win; // MFW win handler
UBYTE local_status;
} T_Envconfirm;
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND volume_kbd_win;
T_MFW_HND kbd_handle;
//T_MFW_HND tim_out_handle;
UBYTE volume_status;
int curVol; //2004.3.24 WYJ current ring in volume adjuest
} T_ringvolume_kbd;
// 2004.2.17 WYJ add
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND ring_win;
MfwHnd ring_kbd;
MfwHnd ring_tim;
uint8 *ringtype;
uint8 *ringvolume;
SHORT eventType;
int index; //index of ring
int ringOffset; //off set of ring
int ringsum; //sum of ring
int txtOffset; //display string index;
} T_ring;
T_Envconfirm envconfirm;
int CurrentMode = ModeIdle; //add 2002.12.30
int stopvib2playmelody( MfwEvt e, MfwTim *tc );
void volume_destroy (T_MFW_HND own_window);
static int LedLightEvent( MfwEvt e, MfwTim *tc );
//glowing,2003-12-15, enable or disable play keytone flag
// that define in mmisounds.c
extern int gPlayKeytoneFlag;
//2004.2.12 WYJ Hall on/off menu flag
int gIsHallOnSet;
/* 2004/06/30 sunsj modify */
#ifdef SEVEN_COLORS_LED
extern MfwHnd ServiceLedTimer;
#endif
/* flag functiong for menu */
USHORT Stopplaying( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
{
//if(melody_status==MELODY_BUSY)
//{
//StopMelody2(oldringstr);
// StopPlayingMelody2( ); 2004.1.6 WYJ
//}
//if(tone_status==TONE_BUSY) 2004.1.6 WYJ
// StopTone();
static int oldindex = 0;
//2004.2.9 WYJ
static int aCursor = 0;
//只在菜单光标切换时做
if(m->lCursor[m->level] != aCursor)
{
MC_StopVibra(); // 2004.4.16 WYJ
aCursor = m->lCursor[m->level];
if(isKeyRing && !((int)mi->str>=TxtSmsRing1 && (int)mi->str<=TxtSmsRing5) )
{
StopPlayingMelody2( );
isKeyRing = 0;
}
}
/* 2004.1.6 WYJ
if((((int)mi->str==TxtRingmode)||((int)mi->str==TxtRingandVib) //add for KCD_LEFT 2003.01.14
||((int)mi->str==TxtVibramode) ||((int)mi->str==TxtVibraRing)||((int)mi->str==TxtMute))
&& (( m->lCursor[m->level] == 0)||( m->lCursor[m->level] == 3)))
driverFlag|=0x04;
else if((((int)mi->str==TxtSmsRing) ||((int)mi->str==TxtSpecialRing)
||((int)mi->str==TxtSmsVibra)||((int)mi->str==TxtSmsRVibra)||((int)mi->str==TxtSmsMute))
&& (( m->lCursor[m->level] == 0))) //||( m->lCursor[m->level] == 1)))
driverFlag|=0x04;
else if(((int)mi->str>=TxtSmsRing1) && ((int)mi->str<=TxtSmsRing5))
driverFlag|=0x04;
else if(((int)mi->str==TxtKeypadToneRing) || ((int)mi->str==TxtKeypadToneSpecialRing)) // 2003/12/08 sunsj
driverFlag|=0x04;
else
driverFlag&=0xFFFFFFFB;
*/
//2004.1.6 WYJ 修改短信音乐选择方式
if (gPlayKeytoneFlag == 0)
gPlayKeytoneFlag = 1;
if((((int)mi->str==TxtRingmode) && (FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].prompttype==RING))
||(((int)mi->str==TxtVibramode) && (FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].prompttype==VIBRA))
||(((int)mi->str==TxtVibraRing) && (FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].prompttype==VIBRARING))
||(((int)mi->str==TxtRingandVib) && (FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].prompttype==RINGANDVIBRA))
||(((int)mi->str==TxtMute) && (FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].prompttype==ALERTMUTE))
//for SMS prompt
||(((int)mi->str==TxtSmsRing) && (FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].SMSTone==SMSRING))
||(((int)mi->str==TxtSpecialRing) && ((FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].SMSTone>=SPECIALRING1)
&& (FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].SMSTone<=SPECIALRING1+SMS_SUM-1)))
||(((int)mi->str==TxtSmsVibra) && (FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].SMSTone==SMSVIBRA))
||(((int)mi->str==TxtSmsRVibra) && (FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].SMSTone==SMSRVIBRA))
||(((int)mi->str==TxtSmsMute) && (FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].SMSTone==SMSMUTE))
||(((int)mi->str==TxtKeypadToneRing) && (FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].KeypadTone==1))
||(((int)mi->str==TxtKeypadToneSpecialRing) && (FlashEnvironmentData.EnviroProfile[Gu8_Envio_num].KeypadTone==2))
) /* 2003/12/08 sunsj */
return FLAGFUNC_TRUE_ICON;
else
return FLAGFUNC_FALSE_ICON;
}
/*******************************************************************************
$Function: envconfirms
$Description: mute confirm dialog_CB
$Returns:
$Arguments:
*******************************************************************************/
void envconfirms (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
T_Envconfirm * data = (T_Envconfirm *)win_data->user;
TRACE_FUNCTION("envconfirms()");
switch(event)
{
case SHOW_CONFIRM:
envconfirm_dialog();
break;
}
}
/*******************************************************************************
$Function: envconfirm_win_cb
$Description: mute confirm
$Returns:
$Arguments:
*******************************************************************************/
static int envconfirm_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
{
/*
* Top Window has no output
*/
return 1;
}
/*******************************************************************************
$Function: envconfirm_create
$Description: mute confirm
$Returns:
$Arguments:
*******************************************************************************/
T_MFW_HND envconfirm_create (T_MFW_HND parent_window)
{
T_Envconfirm * data = &envconfirm;
T_MFW_WIN * win;
TRACE_FUNCTION ("envconfirm_create()");
data->confirm_win = win_create (parent_window, 0, 0, (T_MFW_CB)envconfirm_win_cb);
if(data->confirm_win EQ 0)
return 0;
/*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -