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

📄 mmidc_review_wintab.c

📁 手机Camera部分上层软件代码
💻 C
📖 第 1 页 / 共 2 页
字号:
			else if (s_st_review_info.e_review_type == REVIEW_WHOLE_PHOTO)
			{
				//init globle
				total_photo_num = DCSaveInfo_GetPotoTotalNum();
				if (s_photo_index >= 1)
				{
					s_photo_index--;
				}
				else
				{
					s_photo_index = total_photo_num - 1;
				}
				//change list selected item
	            GUILISTBOX_SetCurItemIndex(MMIDC_ALBUM_LISTBOX_CTRL_ID, total_photo_num - 1 - s_photo_index);

				s_is_read_done = FALSE;

                		s_st_review_info.photo_len = DCSaveInfo_GetPhotoSize(s_photo_index);
                            if (s_st_review_info.photo_len > MMIDC_MAX_PHOTO_SIZE)
                            {
                                e_read_result = DC_FFS_READ_TOOBIG;
                            }
                            else
                            {
        				//read file
        				e_read_result = DCSaveInfo_AsyRead(
        					win_id,
        					s_photo_index,
        					s_st_review_info.photo_ptr,
        					s_st_review_info.photo_len
        					);
                            }

				if (e_read_result == DCFFS_READ_SUCCEED)
				{
					SCI_ASSERT(FALSE);
				}
				else if (e_read_result == DCFFS_READ_FAIL)
				{
					MMIDC_OpenPhotoOptionWin(FALSE, FALSE, s_photo_index, s_st_review_info.photo_ptr, s_st_review_info.photo_len);
					MMK_CloseWin(win_id);
				}
				else if (e_read_result == DC_FFS_READ_TOOBIG)
				{
					MMIDC_OpenPhotoOptionWin(FALSE, FALSE, s_photo_index, s_st_review_info.photo_ptr, s_st_review_info.photo_len);
					MMK_CloseWin(win_id);
				}
				else if (e_read_result == DCFFS_READ_PANDING)
				{
					//do nothing
				}

				AlertReadResult(e_read_result);
			}
		}
		
		break;

	case MSG_APP_UP:
		if (s_is_read_done)
		{
			if (s_st_review_info.e_review_type == REVIEW_PART_PHOTO)
			{
				if (s_st_review_info.y_start >= PHOTO_REVIEW_MOVE_STEP)
				{
					s_st_review_info.y_start -= PHOTO_REVIEW_MOVE_STEP;
					MMIDC_ReviewPhoto(&s_st_review_info);
				}
			}
			else if (s_st_review_info.e_review_type == REVIEW_WHOLE_PHOTO)
			{
				//init globle
				total_photo_num = DCSaveInfo_GetPotoTotalNum();
				s_photo_index++;
				if (s_photo_index >= total_photo_num)
				{
					s_photo_index = 0;
				}
				//change list selected item
	            GUILISTBOX_SetCurItemIndex(MMIDC_ALBUM_LISTBOX_CTRL_ID, total_photo_num - 1 - s_photo_index);

				s_is_read_done = FALSE;
                
                		s_st_review_info.photo_len = DCSaveInfo_GetPhotoSize(s_photo_index);
                            if (s_st_review_info.photo_len > MMIDC_MAX_PHOTO_SIZE)
                            {
                                e_read_result = DC_FFS_READ_TOOBIG;
                            }
                            else
                            {
        				//read file
        				e_read_result = DCSaveInfo_AsyRead(
        					win_id,
        					s_photo_index,
        					s_st_review_info.photo_ptr,
        					s_st_review_info.photo_len
        					);
                            }

				if (e_read_result == DCFFS_READ_SUCCEED)
				{
					SCI_ASSERT(FALSE);
				}
				else if (e_read_result == DCFFS_READ_FAIL)
				{
					MMIDC_OpenPhotoOptionWin(FALSE, FALSE, s_photo_index, s_st_review_info.photo_ptr, s_st_review_info.photo_len);
					MMK_CloseWin(win_id);
				}
				else if (e_read_result == DC_FFS_READ_TOOBIG)
				{
					MMIDC_OpenPhotoOptionWin(FALSE, FALSE, s_photo_index, s_st_review_info.photo_ptr, s_st_review_info.photo_len);
					MMK_CloseWin(win_id);
				}
				else if (e_read_result == DCFFS_READ_PANDING)
				{
					//do nothing
				}

				AlertReadResult(e_read_result);

			}
		}
		break;

        case MSG_APP_RIGHT:
            if (s_is_read_done && s_st_review_info.e_review_type == REVIEW_PART_PHOTO)
            {
                if (s_st_review_info.x_start + PHOTO_REVIEW_MOVE_STEP + MMIDC_MAINSCREEN_WIDTH <= s_photo_width)
                {
                    s_st_review_info.x_start += PHOTO_REVIEW_MOVE_STEP;
                    MMIDC_ReviewPhoto(&s_st_review_info);
                }
            }
            break;

        case MSG_APP_LEFT:
            if (s_is_read_done && s_st_review_info.e_review_type == REVIEW_PART_PHOTO)
            {
                if (s_st_review_info.x_start >= PHOTO_REVIEW_MOVE_STEP)
                {
                    s_st_review_info.x_start -= PHOTO_REVIEW_MOVE_STEP;
                    MMIDC_ReviewPhoto(&s_st_review_info);
                }
            }
            break;

        case MSG_LOSE_FOCUS:
            //dc is closed
            DCAdap_DCClose();
            //free read buffer
            if (s_st_review_info.photo_ptr != PNULL)
            {
                FreeJpegMemory(s_st_review_info.photo_ptr);
                s_st_review_info.photo_ptr = PNULL;
            }

            MMIDEFAULT_AllowBackLight(TRUE); //允许背光关闭 
            break;

        case MSG_GET_FOCUS:
            MMISET_StopAllRing(FALSE);
            MMIDEFAULT_SetBackLight(TRUE); //点亮背光
            MMIDEFAULT_AllowBackLight(FALSE); // 需要,黑屏影响严重
                                      // 需要长亮,否则背光点亮时只会显示请稍后的界面
            //dc is opened
            DCAdap_DCOpen();

            //alloc jpg file cache
            s_photo_index = (uint32)MMK_GetWinAddDataPtr(win_id);
            s_st_review_info.photo_len = DCSaveInfo_GetPhotoSize(s_photo_index);
            s_st_review_info.photo_ptr = MMIDC_AllocJpegMemory(s_st_review_info.photo_len);

            //read file
            e_read_result = DCSaveInfo_AsyRead(
                                                                        win_id,
                                                                        s_photo_index,
                                                                        s_st_review_info.photo_ptr,
                                                                        s_st_review_info.photo_len
                                                                        );

            if (e_read_result == DCFFS_READ_SUCCEED)
            {
                SCI_ASSERT(FALSE);
            }
            else if (e_read_result == DCFFS_READ_FAIL)
            {
                MMIDC_OpenPhotoOptionWin(FALSE, FALSE, s_photo_index, s_st_review_info.photo_ptr, s_st_review_info.photo_len);
                MMK_CloseWin(win_id);
            }
            else if (e_read_result == DC_FFS_READ_TOOBIG)
            {
                MMIDC_OpenPhotoOptionWin(FALSE, FALSE, s_photo_index, s_st_review_info.photo_ptr, s_st_review_info.photo_len);
                MMK_CloseWin(win_id);
            }
            else if (e_read_result == DCFFS_READ_PANDING)
            {
                //do nothing
            }

            AlertReadResult(e_read_result);
            break;

	case MSG_APP_OK:
		if (s_is_read_done)
		{
			album_open_from_ptr = GetAlbumOpenStatus();
			if (album_open_from_ptr->is_from_mms)
			{
				SCI_TRACE_LOW("mmidc:HandleReviewWinMsg, TO MMS ptr=%p, len=%d", s_st_review_info.photo_ptr, s_st_review_info.photo_len);
				
				return_info.buf_ptr		= s_st_review_info.photo_ptr;
				return_info.memory_size = s_st_review_info.photo_len;
				return_info.type = ANIM_JPG;

				if ((return_info.memory_size > 0) && (return_info.memory_size < album_open_from_ptr->max_siz))
				{
					//MMK_SendMsg() function is in a sync way
					MMK_SendMsg(
						album_open_from_ptr->win_id, //MMIMMS_EDIT_CONTENT_MENU_WIN_ID,// MMIMMS_EDIT_MENU_WIN_ID,	fnh modify 0307
						MSG_MULTIM_SELECTED_RETURN,
						(void*)&return_info
						);
				}
				else
				{
					// 彩信过大
					SCI_TRACE_LOW("HandleReviewWinMsg: the mms is too large!");
					PUBWIN_OpenPromptAlertWin(
						PUBWIN_SOFTKEY_ONE,
						TXT_MESSAGE_MMS_TOO_BIG,
						IMAGE_PROMPT_ICON_FAIL,
						MMI_3SECONDS,
						PNULL);
				}

				//close album window
				MMK_CloseWin(MMIDC_ALBUM_WIN_ID);
				MMK_CloseWin(win_id);
			}
			else
			{
				MMIDC_OpenPhotoOptionWin(FALSE, TRUE, s_photo_index, s_st_review_info.photo_ptr, s_st_review_info.photo_len);
			}
		}
		break;

    case MSG_APP_CANCEL:
        MMK_CloseWin(win_id);
        break;

    case MSG_CLOSE_WINDOW:
        MMK_FreeSpecialButtonAction(win_id);
        s_is_in_dc_review = FALSE;
        //free read buffer
        if (s_st_review_info.photo_ptr != PNULL)
        {
            FreeJpegMemory(s_st_review_info.photo_ptr);
            s_st_review_info.photo_ptr = PNULL;
        }

        //DC_Close
        if(!DCAdap_DCClose())
        {
            SCI_TRACE_LOW("mmidc.c HandleReviewWinMsg()");
        }
        MMIDEFAULT_AllowBackLight(TRUE); //允许背光关闭 

        //显示相片窗口关闭时,恢复mp3的播放
#ifdef	MMI_BLUETOOTH_A2DP
        MMIMP3_BtContinuePlayMp3();
#else
        MMIMP3_ContinuePlayMp3();
#endif
        break;    

        default:
            recode = MMI_RESULT_FALSE;
            break;
    }

    return recode;
}

/*****************************************************************************/
// 	Description : is in dc review win
//	Global resource dependence : 
//  Author:
//	Note: 
/*****************************************************************************/
PUBLIC BOOLEAN MMIDC_IsInDCReviewWin(void)
{
    return s_is_in_dc_review;
}

/*****************************************************************************/
// 	Description : alert read result
//	Global resource dependence : 
//  Author:
//	Note: 
/*****************************************************************************/
LOCAL void AlertReadResult(MMIDC_FFS_READ_RESULT_E e_read_result)
{

	if (e_read_result == DCFFS_READ_SUCCEED)
	{
		//need not to alert
	}
	else if (e_read_result == DC_FFS_READ_TOOBIG)
	{
		//not enough space
		PUBWIN_OpenPromptAlertWin(
			PUBWIN_SOFTKEY_ONE, 
			TXT_DC_PICTOO_LARGE, 
			IMAGE_PROMPT_ICON_WRONG, 
			MMI_3SECONDS, 
			PNULL
			);
	}
	else if (e_read_result == DCFFS_READ_FAIL)
	{
		//read failed
		PUBWIN_OpenPromptAlertWin(
			PUBWIN_SOFTKEY_ONE, 
			TXT_DC_LOADPHOTO_FAIL, 
			IMAGE_PROMPT_ICON_WRONG, 
			MMI_3SECONDS, 
			PNULL
			);
	}
	else
	{
		//do nothing
	}

}

/*****************************************************************************/
// 	Description : Handle_TP_Button_Register
//         
//	Global resource dependence : 
//   Author:        bown.zhang
//	Note:   
/*****************************************************************************/
LOCAL void Handle_TP_Button_Register(MMI_WIN_ID_T	win_id)
{
    MMI_SPECIAL_BUTTON_T special_button_ok = {0};
    MMI_SPECIAL_BUTTON_T special_button_cancel = {0};

    MMI_RECT_T rect_ok = {0};
    MMI_RECT_T rect_cancel = {0};
    
    rect_ok.left = (MMI_MAINSCREEN_WIDTH - s_osd_char_disp_rect.w_width) / 2;
    rect_ok.top = (MMI_MAINSCREEN_HEIGHT + s_osd_char_disp_rect.w_height) / 2 - MMIDC_REVIEW_OK_TEXT_HEIGHT;
    rect_ok.right = rect_ok.left + MMIDC_REVIEW_OK_TEXT_WIDTH;
    rect_ok.bottom = (MMI_MAINSCREEN_HEIGHT + s_osd_char_disp_rect.w_height) / 2;

    rect_cancel.left = (MMI_MAINSCREEN_WIDTH + s_osd_char_disp_rect.w_width) / 2 - MMIDC_REVIEW_CANCEL_TEXT_WIDTH;
    rect_cancel.top = (MMI_MAINSCREEN_HEIGHT + s_osd_char_disp_rect.w_height) / 2 - MMIDC_REVIEW_OK_TEXT_HEIGHT;
    rect_cancel.right = (MMI_MAINSCREEN_WIDTH + s_osd_char_disp_rect.w_width) / 2;
    rect_cancel.bottom = (MMI_MAINSCREEN_HEIGHT + s_osd_char_disp_rect.w_height) / 2;
    
    //register * button
    special_button_cancel.type = MMI_SPECIAL_RECT;
    special_button_cancel.rect = rect_cancel;
    special_button_cancel.callback_msg_id = MSG_APP_CANCEL;

    MMK_SetSpecialButtonAction(win_id, &special_button_cancel);

    //register = button
    special_button_ok.type = MMI_SPECIAL_RECT;
    special_button_ok.rect = rect_ok;
    special_button_ok.callback_msg_id = MSG_APP_OK;

    MMK_SetSpecialButtonAction(win_id, &special_button_ok);
	
}

//#endif	//_MMIDC_REVIEW_WINTAB_C_

⌨️ 快捷键说明

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