📄 mmidc_preview_wintab.c
字号:
default:
break;
}
break;
case MSG_CTL_CANCEL:
MMK_CloseWin(win_id);
break;
#ifdef _MMI_OCR
case MSG_APP_WEB: //display help window@annie.an
GUIMENU_GetRetID(MMIDC_MENU_CTRL_ID, &group_id, &menu_id);
switch(menu_id)
{
case ID_DC_OCR:
MMIOCR_OpenHelpWin();
break;
default:
recode = MMI_RESULT_FALSE;
break;
}
break;
#endif
default:
recode = MMI_RESULT_FALSE;
break;
}
return recode;
}
/*****************************************************************************/
// Description : handle the message of preview window
// Global resource dependence : none
// Author: bruce.chi
// Note:
/*****************************************************************************/
#define LOSE_FOCUS_APP_CAMERA (1)
#define LOSE_FOCUS_OTHER_WIN (1<< 1)
PUBLIC MMI_RESULT_E MMIDC_HandlePreviewWinMsg(
MMI_WIN_ID_T win_id,
MMI_MESSAGE_ID_E msg_id,
DPARAM param
) //LW 2007.8.15
{
MMI_RESULT_E recode = MMI_RESULT_TRUE;
BOOLEAN is_flip_up = FALSE;
int img_osd_menu_cur_index = 0;
int img_osd_menu_left_index = 0;
int i_osd_max_num = 0;
int is_from_dc = 0;
OSD_MENU_E osd_menu_type = 0;
PUBLIC PREV_WIN_MODE_E e_preview_win_mode = 0;
RECT_T trim_rect = {0}; //this is useless
RECT_T disp_rect = {0}; //this is useful
int osd_num_in1screen = 0;
MMIDC_CIRCLE_E e_dc_circle = 0;
int i_overtime_cnt = 0;
static uint8 s_timer_id = 0;
static PREV_WIN_MODE_E s_e_winmode_flip = PREVIEW_WIN_FULLSCREEN_CHAR_OSDMENU;
//这个变量是为了:
//filp的时候,能判断出flip之前的预览的状态。
static uint32 s_lose_focus_reason = 0; //这个变量是为了:
//APP_CAMERA的时候(这个也会导致LOSE_FOCUS),不能DC_Close。而其他原因LOSE_FOCUS的时候需要DC_Close
static BOOLEAN s_has_dc_opened = FALSE; //这个变量是为了:
//DC_OPEN失败的话,不响应按键消息。
static uint8 zoom_level = 0;
BOOLEAN ret=TRUE;
switch(msg_id)
{
case MSG_OPEN_WINDOW:
//打开照相preview将mp3背景播放挂起
MMIDC_SuspendMp3();
SCI_TRACE_LOW("LW TRACE:TEST 添加的打印信息!");
//get flip status
is_flip_up = MMIDEFAULT_GetFlipStatus();
DCAdap_SetZoomLevel(0);
zoom_level = 0;
//dc open
s_has_dc_opened = FALSE;
if (!DCAdap_DCOpen())
{
SCI_TRACE_LOW("mmidc_preview_wintab.c:HandlePreviewWinMsg_openwin, DC_Open error");
AlertDCStartPreviewWrong();
MMK_CloseWin(win_id);
break;
}
//DCAdap_DCOpen(); 无法显示函数内打印信息
SCI_TRACE_LOW("rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr");
SCI_TRACE_LOW("RRRRRRRRRRRRRRRRRRRRRRRR DCAdap_DCOpen Value=%d",DCAdap_DCOpen());
//set default dc/dv setting
is_from_dc = (int)MMK_GetWinAddDataPtr(win_id);
if (is_from_dc != 0)
{
DCSetting_SetDefaultValue(MMIDC_GetSettingInfo());
}
else
{
DVSetting_SetDefaultValue(MMIDC_GetSettingInfo());
}
//注册触摸屏软键行
Handle_TP_Button_Register(win_id);
//save the window mode
SCI_TRACE_LOW("mmidc: open_window flip_status =%d", is_flip_up);
SCI_TRACE_LOW("MMIDC_OPEN_WINDOW FLIP_STATUS_LW4");
//check flip status
if (is_flip_up)//value is true lw
{
SCI_TRACE_LOW("LW TRACE:MMIDC_HandlePreViewWinMsg___is flip up=1");
//set preivew status to MAINLCD
DCSetting_SetPreviewWinMode(PREVIEW_WIN_FULLSCREEN_CHAR_OSDMENU);
//allow sublcd to update and update sublcd
MMISUB_IsPermitUpdate(TRUE);
}
else
{
SCI_TRACE_LOW("LW TRACE:MMIDC_HandlePreViewWinMsg___is flip up=0");
//set preview status to SUBLCD
DCSetting_SetPreviewWinMode(PREVIEW_WIN_SUBLCD_NO_OSD);
//forbid sub lcd to update
MMISUB_IsPermitUpdate(FALSE);
}
//set preivew all parameters
if (!DCAdap_SetAllPreviewParam())//DCAdap_SetAllPreviewParam==1
{
SCI_TRACE_LOW("mmidc_preview_wintab.c:HandlePreviewWinMsg_openwin, DCAdap_SetAllPreviewParam error");
AlertDCStartPreviewWrong();
MMK_CloseWin(win_id);
break;
}
SCI_TRACE_LOW("LW TRACE:20035950 !");
//draw default background
if (is_flip_up)
{
DrawDefaultBackGroud(MAIN_LCD_ID);
}
else
{
DrawDefaultBackGroud(SUB_LCD_ID);
}
//init global
DCSetting_SetPreviewImgOSDMenuIndex(0, 0);
s_timer_id = 0;
s_lose_focus_reason = 0;
//start preview
#ifdef _MMI_OCR
if (!MMIOCR_Is_From_OCR())
{
ret = DCAdap_StartPreview();
}
else
{
ret = !OCR_StartPreview();
}
#else
ret = DCAdap_StartPreview();
SCI_TRACE_LOW("Mmi_preview_wintab_MMIDC_△△△△△△△");
#endif
if (!ret)
{
SCI_TRACE_LOW("mmidc_preview_wintab.c:HandlePreviewWinMsg_openwin, DCAdap_StartPreview error");
AlertDCStartPreviewWrong();
MMK_CloseWin(win_id);
break;
}
//avoid that user press the capture key too quickly
SCI_Sleep(MMIDC_PREVIEW_TO_CAP_PROTECT_TIME);
s_has_dc_opened = TRUE;
SCI_TRACE_LOW("LW TRACE: DigitalCamera Startup FINISH!");
break;
case MSG_LOSE_FOCUS:
SCI_TRACE_LOW("mmidc:MMIDC_HandlePreviewWinMsg, MSG_LOSE_FOCUS");
//enable key ring
MMIDEFAULT_EnableKeyRing(TRUE);
//stop timer
if (0 < s_timer_id)
{
MMK_StopTimer(s_timer_id);
s_timer_id = 0;
}
//stop preview
#ifdef _MMI_OCR
if (MMIOCR_Is_From_OCR())
{ SCI_TRACE_LOW("ocr_focus1,LOSE_FOCUS_APP_CAMERA:%d",s_lose_focus_reason);
DC_CloseSingleModeAF();
SCI_TRACE_LOW("mmidc_preview_wintab.c:ocr after DC_CloseSingleModeAF");
}
#endif
DCAdap_StopPreview(); //include process dc and ocr stop preveiw.
//save lose focus reason
SCI_TRACE_LOW("ocr_focus2,LOSE_FOCUS_APP_CAMERA:%d",s_lose_focus_reason);
s_lose_focus_reason |= LOSE_FOCUS_OTHER_WIN;
SCI_TRACE_LOW("ocr_focus3,LOSE_FOCUS_APP_CAMERA:%d",s_lose_focus_reason);
if ((s_lose_focus_reason & LOSE_FOCUS_APP_CAMERA) != 0)
{
//this means lose_focus's reason is APP_CAMERA, do not need to DC_Close
SCI_TRACE_LOW("ocr lose focus reason is camera");
}
else
{
#ifdef _MMI_OCR
if (MMIOCR_Is_From_OCR())
{
OCR_Close();
MMIDC_SetDCPreviewStatus(FALSE);
}
else
#endif
{
DCAdap_DCClose();
}
MMISUB_IsPermitUpdate(TRUE);
}
//do not allow enter sleep
MMIDEFAULT_AllowBackLight(FALSE);
break;
case MSG_GET_FOCUS:
MMISET_StopAllRing(FALSE);
DCAdap_SetZoomLevel(0);
zoom_level = 0;
is_flip_up = MMIDEFAULT_GetFlipStatus();
SCI_TRACE_LOW("mmidc: get_focus flip_status =%d", is_flip_up);
//check flip status
if (is_flip_up)
{
//set preivew status to MAINLCD
e_preview_win_mode = DCSetting_GetPreviewWinMode();
switch(e_preview_win_mode)
{
case PREVIEW_WIN_FULLSCREEN_CHAR_OSDMENU:
DCSetting_SetPreviewWinMode(PREVIEW_WIN_FULLSCREEN_CHAR_OSDMENU);
SCI_TRACE_LOW("e_preview_win_mode:1");
break;
case PREVIEW_WIN_FULLSCREEN_IMAGE_OSDMENU:
DCSetting_SetPreviewWinMode(PREVIEW_WIN_FULLSCREEN_IMAGE_OSDMENU);
break;
case PREVIEW_WIN_PARTSCREEN_CIRCLE_OSD:
DCSetting_SetPreviewWinMode(PREVIEW_WIN_PARTSCREEN_CIRCLE_OSD);
break;
case PREVIEW_WIN_SUBLCD_NO_OSD:
DCSetting_SetPreviewWinMode(PREVIEW_WIN_FULLSCREEN_CHAR_OSDMENU);
break;
default:
DC_ASSERT_LOW(0);
break;
}
//allow sublcd to update and update sublcd
MMISUB_IsPermitUpdate(TRUE);
MMISUB_UpdateDisplaySubLcd();
}
else
{
is_from_dc = (int)MMK_GetWinAddDataPtr(win_id);
if (is_from_dc != 0)
{
//set preview status to SUBLCD
DCSetting_SetPreviewWinMode(PREVIEW_WIN_SUBLCD_NO_OSD);
//forbid sub lcd to update
MMISUB_IsPermitUpdate(FALSE);
}
else
{
SCI_TRACE_LOW("mmidc:MMIDC_HandlePreviewWinMsg dv preview and subwin get_focus ");
MMK_CloseWin(win_id);
break;
}
}
//get former lose focus reason
s_has_dc_opened = FALSE;
if ((s_lose_focus_reason & LOSE_FOCUS_APP_CAMERA) != 0)
{
//lose focus because of APP_CAMERA, need DC_Close then DC_Open
#ifdef _MMI_OCR
if (MMIOCR_Is_From_OCR())
{
SCI_TRACE_LOW("ocr get focus 1");
OCR_Close();
}
else
#endif
{
DCAdap_DCClose();
}
if (!DCAdap_DCOpen())
{
AlertDCStartPreviewWrong();
MMK_CloseWin(win_id);
break;
}
}
else
{
if (!DCAdap_DCOpen())
{
AlertDCStartPreviewWrong();
MMK_CloseWin(win_id);
break;
}
}
s_lose_focus_reason = 0;
//set all parameter
if (!DCAdap_SetAllPreviewParam())
{
AlertDCStartPreviewWrong();
MMK_CloseWin(win_id);
break;
}
//draw default background
if (is_flip_up)
{
DrawDefaultBackGroud(MAIN_LCD_ID);
}
else
{
DrawDefaultBackGroud(SUB_LCD_ID);
}
//start preview
#ifdef _MMI_OCR
if (MMIOCR_Is_From_OCR())
{
if (OCR_StartPreview())
{ SCI_TRACE_LOW("ocr get focus 2");
AlertDCStartPreviewWrong();
MMK_CloseWin(win_id);
break;
}
}
else
#endif
{
if (!DCAdap_StartPreview())
{
AlertDCStartPreviewWrong();
MMK_CloseWin(win_id);
break;
}
}
//forbid enter sleep mode
MMIDEFAULT_AllowBackLight(FALSE);
//avoid that user press the capture key too quickly
SCI_Sleep(MMIDC_PREVIEW_TO_CAP_PROTECT_TIME);
s_has_dc_opened = TRUE;
break;
case MSG_FULL_PAINT:
//forbid enter sleep mode
MMIDEFAULT_AllowBackLight(FALSE);
//disable key ring
MMIDEFAULT_EnableKeyRing(FALSE);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -