📄 miscfunctions.c
字号:
g_pwron_is_image = TRUE;
res_type = FMGR_GROUP_IMAGE;
}
#if !defined (MMI_ON_WIN32)
else if (res_type == PHNSET_TYPE_DISP_VIDEO)
{
g_pwron_is_image = FALSE;
res_type = FMGR_GROUP_VIDEO;
}
#endif /* !defined (MMI_ON_WIN32) */
#ifdef __MMI_SWFLASH__
else if (res_type == PHNSET_TYPE_DISP_SWFLASH)
{
g_pwron_is_image = TRUE;
res_type = FMGR_GROUP_SWFLASH;
}
#endif /* __MMI_SWFLASH__ */
else
{
MMI_ASSERT(0);
}
}
#else /* defined(__MMI_POWER_ON_OFF_DISPLAY__) */
/* play from internal build in resource */
g_pwron_is_image = TRUE;
#ifdef __MMI_POWER_ON_OFF_DISPLAY__ /* Cylen 0926, customize display char */
disp_id = IMG_ID_PHNSET_ON_0;
#else
disp_id = IMG_ID_PHNSET_ON_ANIMATION_DEFAULT;
#endif
filename_ptr = NULL;
#endif /* defined(__MMI_POWER_ON_OFF_DISPLAY__) */
/*******************************************/
/* Start to play */
/*******************************************/
if (res_type == FMGR_GROUP_IMAGE)
{
/* Play GIF animation or still image */
if (ExitCategoryFunction != NULL)
{
ExitCategoryFunction();
}
ShowCategory166Screen(disp_id, filename_ptr, mmi_pwron_show_image_callback);
#ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
if (!IsClamClose())
{
ShowCategory310Screen(get_string(STR_GLOBAL_LOGO));
}
else
#endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */
ShowCategory313Screen(IMG_SUBLCD_POWER_ON_SCR, NULL);
/* play power on tone */
playRequestedTone(POWER_ON_TONE);
}
else if (res_type == FMGR_GROUP_VIDEO)
{
/* Play video clip */
#if defined(__MMI_VIDEO_PLAYER__)
/* check silent mode */
play_audio = (gcurrentprofile.toneSetup.powerOnTone != POWERON_SILENT) ? TRUE : FALSE;
/* set volume as ring tone volume */
mdi_audio_set_volume(MDI_VOLUME_MEDIA, GetRingVolumeLevel());
/* add sublcd screen in history */
/*
* this is when Categry224 play finish, it's sublcd will go back history,
* If we go back to root sublcd screen, sometimes it might draw an empty
* screen due to sim or network not ready.
* So we have to let it back to a dummy screen, whihc will draw nothing .
*/
sub_history.entryFuncPtr = mmi_pwron_draw_sublcd_dummy_screen;
AddSubLCDHistory(&sub_history);
/* entry video play screen */
ShowCategory224Screen(
disp_id, /* video id */
filename_ptr, /* filename */
0, /* repeat_count *//* 0 means infinite */
TRUE, /* is_visaul_update */
play_audio, /* is_play_audio */
FALSE, /* is_lcd_sleep *//* already in non-sleep mode */
GDI_COLOR_BLACK, /* bg_color */
mmi_pwron_play_video_callback, /* (*play_finish_callback)(S16) */
NULL); /* gui_buffer */
#else /* defined(__MMI_VIDEO_PLAYER__) */
MMI_ASSERT(0);
#endif /* defined(__MMI_VIDEO_PLAYER__) */
}
#ifdef __MMI_SWFLASH__
else if (res_type == FMGR_GROUP_SWFLASH)
{
ShowCategory229Screen(
0, /* title_str */
0, /* title_icon */
0, /* lsk_str */
0, /* lsk_icon */
0, /* rsk_str */
0, /* rsk_icon */
disp_id, /* resource_id */
filename_ptr, /* resource_filename */
1, /* repeat_count */
MMI_TRUE, /* is_play_audio */
0, /* is_vibrate_on */
0, /* is_interaction_on */
0, /* is_lcd_no_sleep */
MMI_TRUE, /* is_full_screen */
GDI_COLOR_WHITE, /* bg_color */
mmi_pwron_show_image_callback,
NULL);
}
#endif
#if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
SetKeyHandler(KeyPatternIdentifier, KEY_POUND, KEY_EVENT_DOWN);
SetKeyHandler(KeyPatternIdentifier, KEY_STAR, KEY_EVENT_DOWN);
SetKeyHandler(KeyPatternIdentifier, KEY_0, KEY_EVENT_DOWN);
SetKeyHandler(KeyPatternIdentifier, KEY_1, KEY_EVENT_DOWN);
SetKeyHandler(KeyPatternIdentifier, KEY_2, KEY_EVENT_DOWN);
SetKeyHandler(KeyPatternIdentifier, KEY_3, KEY_EVENT_DOWN);
SetKeyHandler(KeyPatternIdentifier, KEY_4, KEY_EVENT_DOWN);
SetKeyHandler(KeyPatternIdentifier, KEY_5, KEY_EVENT_DOWN);
SetKeyHandler(KeyPatternIdentifier, KEY_6, KEY_EVENT_DOWN);
SetKeyHandler(KeyPatternIdentifier, KEY_7, KEY_EVENT_DOWN);
SetKeyHandler(KeyPatternIdentifier, KEY_8, KEY_EVENT_DOWN);
SetKeyHandler(KeyPatternIdentifier, KEY_9, KEY_EVENT_DOWN);
#endif /* defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__) */
StartLEDPatternPowerOn();
ReplaceNewScreenHandler(SCR_OPEN_SCREEN_ID, mmi_pwron_exit_animation_screen, mmi_pwron_entry_animation_screen);
/* this timer is used to avoid gif/video play too long, will force to enter idle */
ReadValue(NVRAM_POWER_ON_FORCE_STOP_TIME, &force_stop_time, DS_SHORT, &error);
/* not set in NVRAM, use defulat 20 sec limit */
if (force_stop_time == 0xffff)
{
force_stop_time = 20000;
}
/* POWER ON time have NVRAM-timer interlace problem, so put time at last to eliminate this problem */
gui_start_timer(force_stop_time, mmi_pwron_froce_terminate_display);
g_pwron_is_terminate_diplay = FALSE;
}
/*****************************************************************************
* FUNCTION
* mmi_pwron_exception_check_display
* DESCRIPTION
* this function is for exception power on to check wether need to restore
* power on diplay to default or not.
* we cant 100% guarantee decoder will work for all image/video from file, we
* use this method to restore back if decoder has assert or fatal error.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_pwron_exception_check_display(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S16 error;
U16 pwron_flag;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Valid power on display restoration checking */
ReadValue(NVRAM_POWER_ON_DISPLAY_SUCCESS, &pwron_flag, DS_SHORT, &error);
/* this means exception happened during previous decoding process */
if (pwron_flag == PWRON_DISPLAY_PLAYING)
{
#if defined(__MMI_POWER_ON_OFF_DISPLAY__)
PhnsetRstPwrOnDisplayDefault();
#endif
}
}
/*****************************************************************************
* FUNCTION
* mmi_pwron_exit_animation_screen
* DESCRIPTION
* exit power on animation screen
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_pwron_exit_animation_screen(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 pwron_flag;
S16 error;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POWER_ON_LEAVE_ANIMATION));
// wangbei add start 20071010
#ifdef __NEW_STATUS_ICONS_STYLE__
g_is_need_draw_statusicons=TRUE;
#endif
// wangbei add end
TurnOffBacklight(); /* To start backlight timer */
ExitSubLCDIdleScr(); /* Add idle screen to sub-lcd history if power on animation is interrupted */
/* if is force stopped by MT call, treat this recource as play successfully */
if (GetActiveScreenId() == ITEMSCR_INCOMING_CALL)
{
pwron_flag = PWRON_DISPLAY_SUCCESS;
WriteValue(NVRAM_POWER_ON_DISPLAY_SUCCESS, &pwron_flag, DS_SHORT, &error);
}
gui_cancel_timer(mmi_pwron_froce_terminate_display);
}
/***************************************************************************
*
* Analog Clock
*
***************************************************************************/
/* Analog clock implementation: Must be moved to a different file later */
#define ANALOG_CLOCK_DRAW_POLYGON_HANDS 1
#define ANALOG_CLOCK_SMOOTHEN_LINES 1
/* PMT HIMANSHU START 20050625 */
#ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
/* PMT HIMANSHU START 20050721 */
#if defined(__MMI_MAINLCD_176X220__)
/* PMT HIMANSHU END 20050721 */
#define ANALOG_CLOCK_HOURS_HAND_LENGTH 12
#define ANALOG_CLOCK_MINUTES_HAND_LENGTH 16
/* PMT HIMANSHU START 20050721 */
#elif defined(__MMI_MAINLCD_240X320__)
#define ANALOG_CLOCK_HOURS_HAND_LENGTH 15
#define ANALOG_CLOCK_MINUTES_HAND_LENGTH 20
#endif
/* PMT HIMANSHU END 20050721 */
#else /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
// wangbei modify start 20070703
#ifdef __MT118_A_UI_STYLE__
#define ANALOG_CLOCK_HOURS_HAND_LENGTH (MAIN_LCD_DEVICE_HEIGHT/6-10) /* 20 */
#define ANALOG_CLOCK_MINUTES_HAND_LENGTH (ANALOG_CLOCK_HOURS_HAND_LENGTH+8) /* 28 */
#else
#define ANALOG_CLOCK_HOURS_HAND_LENGTH (MAIN_LCD_DEVICE_HEIGHT/6) /* 20 */
#define ANALOG_CLOCK_MINUTES_HAND_LENGTH (ANALOG_CLOCK_HOURS_HAND_LENGTH+8) /* 28 */
#endif
// wangbei modify end
#endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
/* PMT HIMANSHU END */
#define ANALOG_CLOCK_SECONDS_HAND_LENGTH (ANALOG_CLOCK_HOURS_HAND_LENGTH+12) /* 32 */
/* PMT HIMANSHU START 20050721 */
#ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
// wangbei modify start 20070601
#ifndef __MT170_UI_STYLE__
#define ANALOG_CLOCK_HOURS_HAND_COLOR { 255,255,255,100 }
#define ANALOG_CLOCK_MINUTES_HAND_COLOR { 255,255,255,100 }
#define ANALOG_CLOCK_SECONDS_HAND_COLOR { 255,255,255,100 }
#else
#define ANALOG_CLOCK_HOURS_HAND_COLOR { 0,128,192,100 }
#define ANALOG_CLOCK_MINUTES_HAND_COLOR { 0,128,192,100 }
#define ANALOG_CLOCK_SECONDS_HAND_COLOR { 0,128,192,100 }
#endif
// wangbei modify end
#else /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
#if defined(__MMI_SUBLCD_COLOR__)
#define ANALOG_CLOCK_HOURS_HAND_COLOR { 0,0,93,100 }
#define ANALOG_CLOCK_MINUTES_HAND_COLOR { 0,0,93,100 }
#define ANALOG_CLOCK_SECONDS_HAND_COLOR { 255,0,0,100 }
#else /* defined(__MMI_SUBLCD_COLOR__) */
//zx modify begin 20070410
#ifdef __MMI_BLACK_UI_STYLE__
#define ANALOG_CLOCK_HOURS_HAND_COLOR { 255,255,255,100 }
#define ANALOG_CLOCK_MINUTES_HAND_COLOR { 255,255,255,100 }
#define ANALOG_CLOCK_SECONDS_HAND_COLOR { 255,255,255,100 }
#else
#define ANALOG_CLOCK_HOURS_HAND_COLOR { 0,0,0,100 }
#define ANALOG_CLOCK_MINUTES_HAND_COLOR { 0,0,0,100 }
#define ANALOG_CLOCK_SECONDS_HAND_COLOR { 0,0,0,100 }
#endif
//zx modify end
#endif /* defined(__MMI_SUBLCD_COLOR__) */
#endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
/* PMT HIMANSHU END 20050721 */
/*
* Moved to MiscFunctions.h
* #define ANALOG_CLOCK_DIAL_WIDTH 77
* #define ANALOG_CLOCK_DIAL_HEIGHT 77
*/
S32 ANALOG_CLOCK_DIAL_X = 26;
S32 ANALOG_CLOCK_DIAL_Y = 26;
S32 ANALOG_CLOCK_CENTER_X = 64;
S32 ANALOG_CLOCK_CENTER_Y = 64;
#define ANALOG_CLOCK_DRAW_POLYGON_HANDS 1
#define ANALOG_CLOCK_SMOOTHEN_LINES 1
#define SUB_ANALOG_CLOCK_HOURS_HAND_LENGTH (SUB_LCD_DEVICE_WIDTH/4)
#define SUB_ANALOG_CLOCK_MINUTES_HAND_LENGTH (SUB_ANALOG_CLOCK_HOURS_HAND_LENGTH+4)
#define SUB_ANALOG_CLOCK_SECONDS_HAND_LENGTH (SUB_ANALOG_CLOCK_HOURS_HAND_LENGTH+6)
#define SUB_ANALOG_CLOCK_DIAL_WIDTH SUB_LCD_DEVICE_WIDTH
#define SUB_ANALOG_CLOCK_DIAL_HEIGHT SUB_LCD_DEVICE_HEIGHT
#ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
S32 SUB_ANALOG_CLOCK_DIAL_X = 2;
S32 SUB_ANALOG_CLOCK_DIAL_Y = 2;
S32 SUB_ANALOG_CLOCK_CENTER_X = SUB_LCD_DEVICE_WIDTH >> 1;
S32 SUB_ANALOG_CLOCK_CENTER_Y = SUB_LCD_DEVICE_HEIGHT >> 1;
#endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */
PU8 analog_clock_background_image = NULL;
const float acm_sine_table[] =
{
(float)-0.99999820, (float)-0.99431727, (float)-0.97773360, (float)-0.95042917, (float)-0.91270313,
(float)-0.86496924, (float)-0.80775119, (float)-0.74167587,
(float)-0.66746803, (float)-0.58594175, (float)-0.49799022, (float)-0.40457821, (float)-0.30673042,
(float)-0.20551889, (float)-0.10205382, (float)0.00000000,
(float)0.10457040, (float)0.20799418, (float)0.30913729, (float)0.40689072, (float)0.50018258, (float)0.58798990,
(float)0.66934994, (float)0.74337050,
(float)0.80923998, (float)0.86623616, (float)0.91373403, (float)0.95121274, (float)0.97826142, (float)0.99458343,
(float)0.99999980, (float)0.99445115,
(float)0.97799831, (float)0.95082172, (float)0.91321931, (float)0.86560342, (float)0.80849624, (float)0.74252372,
(float)0.66840956, (float)0.58696629,
(float)0.49908672, (float)0.40573486, (float)0.30793410, (float)0.20675662, (float)0.10331227, (float)-0.00126490,
(float)-0.10582843, (float)-0.20923132,
(float)-0.31033998, (float)-0.40804598, (float)-0.50127753, (float)-0.58901256, (float)-0.67028925,
(float)-0.74421601, (float)-0.80998244, (float)-0.86686752,
(float)-0.91424734, (float)-0.95160225, (float)-0.97852297, (float)-0.99471414,
};
const float acm_cosine_table[] =
{
(float)0.00189735, (float)0.10645731, (float)0.20984996, (float)0.31094114, (float)0.40862330, (float)0.50182489,
(float)0.58952354, (float)0.67075845,
(float)0.74463846, (float)0.81035318, (float)0.86718264, (float)0.91450340, (float)0.95179643, (float)0.97865315,
(float)0.99477888, (float)1.00000000,
(float)0.99451749, (float)0.97813006, (float)0.95101742, (float)0.91347684, (float)0.86591997, (float)0.80886827,
(float)0.74294728, (float)0.66887989,
(float)0.58747821, (float)0.49963478, (float)0.40631283, (float)0.30853576, (float)0.20737548, (float)0.10394131,
(float)-0.00063245, (float)-0.10519940,
(float)-0.20861283, (float)-0.30973870, (float)-0.40746839, (float)-0.50073018, (float)-0.58850135,
(float)-0.66981977, (float)-0.74379342, (float)-0.80961137,
(float)-0.86655204, (float)-0.91399082, (float)-0.95140769, (float)-0.97839241, (float)-0.99464897,
(float)-0.99999920, (float)-0.99438440, (float)-0.97786617,
(float)-0.95062563, (float)-0.91296138, (float)-0.86528656, (float)-0.80812388, (float)-0.74209994,
(float)-0.66793902, (float)-0.58645414, (float)-0.49853857,
(float)-0.40515651, (float)-0.30733233, (float)-0.20613779, (float)-0.10268295,
};
#if(ANALOG_CLOCK_DRAW_POLYGON_HANDS)
extern void flat_triangle_fill(polygon_vertex vertices[], color c);
void polygon_draw(polygon_vertex vertices[], S32 n_vertices, color c);
#elif(ANALOG_CLOCK_SMOOTHEN_LINES)
extern void UI_antialiased_line(S32 x1, S32 y1, S32 x2, S32 y2, color c);
#endif
/* PMT HIMANSHU START 20050625 */
#ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
/* PMT HIMANSHU START 20050721 */
#if defined(__MMI_MAINLCD_176X220__)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -