mmimms_wintable.c
资源名称:MMS.rar [点击查看]
上传用户:tqh2500
上传日期:2014-05-09
资源大小:163k
文件大小:463k
源码类别:
手机彩信(MMS)编程
开发平台:
Visual C++
- MMIMMS_DeleteCurVideo(g_peditdoc);
- SCI_MEMSET(&composer_video,0,sizeof(composer_video));
- composer_video.VidBuf = mpeg4_return_info_ptr->buf_ptr;
- composer_video.size = mpeg4_return_info_ptr->memory_size;
- SCI_TRACE_LOW("FNH composer_viedo.size = %d",composer_video.size);
- composer_video.Type = mpeg4_return_info_ptr->type;
- // composer_video.Type = "video/mpeg";
- SCI_TRACE_LOW("FNH before add video");
- MMIMMS_AddVideo(&composer_video,g_peditdoc);
- break;
- #endif
- #ifdef HAVE_MP3
- case MSG_MP3_READ_FFS_DONE:
- SCI_ASSERT(param != NULL);
- SCI_TRACE_LOW("FNH enter MSG_MULTIM_SLEECTED_RETURN");
- mp3_return_info_ptr = (MMIMP3_TETURN_INFO_T *)param;
- if (PNULL == mp3_return_info_ptr->buf_ptr)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_EDIT_ADD_FAIL,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- break;
- }
- MMS_DelAudio(g_peditdoc->slide_cur, g_peditdoc);
- //insert the audio
- composer_audio.AudBuf = mp3_return_info_ptr->buf_ptr;
- composer_audio.size = mp3_return_info_ptr->memory_size;
- composer_audio.Type = COMPOSER_AUDIO_MP3;
- SCI_TRACE_LOW("FNH get music composer_audio.size = %d",composer_audio.size);
- SCI_TRACE_LOW("FNH multim_return_info->type = %d",composer_audio.Type);
- MMIMMS_AddAudio(&composer_audio,g_peditdoc);
- break;
- #endif
- case MSG_MULTIM_SELECTED_RETURN:
- SCI_TRACE_LOW("FNH enter MSG_MULTIM_SELECTED_RETURN");
- SCI_ASSERT(param != NULL);
- multim_return_info_ptr = (MMIMULTIM_SELECTED_RETURN_T *)param;
- // SCI_ASSERT(multim_return_info_ptr->buf_ptr != PNULL);
- // SCI_ASSERT(multim_return_info_ptr->memory_size != 0);
- if ((PNULL == multim_return_info_ptr->buf_ptr) || (0 == multim_return_info_ptr->memory_size))
- {
- // if (menu_id == ID_MMS_INSERT_DPIC || menu_id ==ID_MMS_INSERT_PHOTO )
- if (s_opt_menu_id == ID_MMS_INSERT_DPIC || s_opt_menu_id ==ID_MMS_INSERT_PHOTO )
- {
- //alert : not supported image
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_INVALID_PIC,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- // else if (menu_id == ID_MMS_EDIT_INSERT_RING )
- else if (s_opt_menu_id == ID_MMS_EDIT_INSERT_MUSIC)
- {
- //alert : not supported audio
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_INVALID_AUDIO,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- break;
- }
- SCI_MEMSET(&composer_img, 0, sizeof(composer_img));
- SCI_MEMSET(&composer_audio, 0, sizeof(composer_audio));
- // if (menu_id == ID_MMS_INSERT_DPIC || menu_id ==ID_MMS_INSERT_PHOTO )
- if (s_opt_menu_id == ID_MMS_INSERT_PHOTO || s_opt_menu_id == ID_MMS_INSERT_DPIC)
- {
- MMIMMS_DeleteCurImage(g_peditdoc);
- //insert the image
- composer_img.ImgBuf = multim_return_info_ptr->buf_ptr;
- composer_img.size = multim_return_info_ptr->memory_size;
- composer_img.Type = Edit_GetDeltaMMSImageType2(multim_return_info_ptr->type);
- composer_img.begin = 0;
- SCI_TRACE_LOW("FNH buf = %d,size = %d,type = %d",composer_img.ImgBuf,composer_img.size,multim_return_info_ptr->type);
- if (composer_img.Type != PNULL)
- {
- MMIMMS_AddImage(&composer_img,g_peditdoc);
- }
- else
- {
- //alert : not supported image
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_INVALID_PIC,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- }
- // else if (menu_id == ID_MMS_EDIT_INSERT_RING)
- else if (s_opt_menu_id == ID_MMS_EDIT_INSERT_MUSIC)
- {
- // MMS_DelAudio(p_cur_doc->slide_cur, p_cur_doc);
- MMS_DelAudio(g_peditdoc->slide_cur, g_peditdoc);
- //insert the audio
- composer_audio.AudBuf = multim_return_info_ptr->buf_ptr;
- composer_audio.size = multim_return_info_ptr->memory_size;
- composer_audio.Type = Edit_GetDeltaMMSAudioType(multim_return_info_ptr->type);
- // composer_audio.Type = COMPOSER_AUDIO_MIDI;
- SCI_TRACE_LOW("FNH get music composer_audio.size = %d",multim_return_info_ptr->memory_size);
- SCI_TRACE_LOW("FNH multim_return_info->type = %d",multim_return_info_ptr->type);
- SCI_TRACE_LOW("FNH composer_audio.Type = %s",composer_audio.Type);
- if (composer_audio.Type != PNULL)
- {
- MMIMMS_AddAudio(&composer_audio,g_peditdoc);
- }
- else
- {
- //alert : not supported audio
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_INVALID_AUDIO,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- }
- else
- {
- SCI_ASSERT(!"mmimms:Bad message.");
- }
- //free
- // if (menu_id != ID_MMS_INSERT_PHOTO )
- SCI_TRACE_LOW("MSG_MULTIM_SELECTED_RETURN s_opt_menu_id=%d,ID_MMS_INSERT_PHOTO=%d",s_opt_menu_id,ID_MMS_INSERT_PHOTO);
- if (s_opt_menu_id != ID_MMS_INSERT_PHOTO)
- {
- SCI_TRACE_LOW("MSG_MULTIM_SELECTED_RETURN multim_return_info_ptr->buf_ptr=%p",multim_return_info_ptr->buf_ptr);
- if (multim_return_info_ptr->buf_ptr != PNULL)
- {
- cms_free(multim_return_info_ptr->buf_ptr);
- multim_return_info_ptr->buf_ptr = NULL;
- }
- }
- break;
- case MSG_MMS_CLOSE_WAITING_WIN:
- break;
- case MSG_MMS_CLOSE_PREVIEW_WAITING_WIN:
- //create preview win
- MMK_CreateWin( (uint32*)MMIMMS_EDIT_PREVIEW_TAB, (ADD_DATA)g_peditdoc);
- //close waiting win
- //PUBWIN_CloseWaitingMessageWin(MMIMMS_EDIT_PREVIEW_WAITING_WIN_ID);
- PUBWIN_ClosePromptAlertWin();
- break;
- case MSG_SKB_ICON:
- // Edit_SaveMMSText(edit_contrl_id);
- // Edit_SetEditCtrlContent(edit_contrl_id);
- button_index = (uint32) param;
- switch(button_index)
- {
- case MMI_SOFTKEYBAR_LEFT_ICON:
- if (MMS_PrevSlide(g_peditdoc) == 1)
- {
- MmsStopPreviewRing();
- Edit_SetEditCtrlContent(edit_contrl_id,g_peditdoc);
- MMK_SetAtvCtrl(win_id, edit_contrl_id);
- MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
- }
- break;
- case MMI_SOFTKEYBAR_MIDDLE_ICON:
- MMI_GetLabelTextByLang( TXTSYS_WAITING, &prompt_str );
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXTSYS_WAITING,
- IMAGE_PROMPT_ICON_WAIT,
- 0,
- PNULL
- );
- play_or_preview = MMS_PREVIEW;
- //post close waiting win message
- MMK_PostMsg(win_id, MSG_MMS_CLOSE_PREVIEW_WAITING_WIN, PNULL, 0);
- break;
- case MMI_SOFTKEYBAR_RIGHT_ICON:
- if (MMS_NextSlide(g_peditdoc) == 1)
- {
- MmsStopPreviewRing();
- Edit_SetEditCtrlContent(edit_contrl_id,g_peditdoc);
- MMK_SetAtvCtrl(win_id, edit_contrl_id);
- MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
- }
- break;
- default:
- SCI_ASSERT(0);
- break;
- }
- break;
- case MSG_APP_OK:
- MMK_TrackPopupMenu(win_id);
- break;
- case MSG_CTL_OK:
- if ( MMIMMS_EDIT_MENU_CTRL_ID == (MMI_CTRL_ID_T)param )
- {
- //need to load former
- is_need_to_load_former_text = TRUE;
- GUIMENU_GetRetID((MMI_CTRL_ID_T)param, &group_id, &menu_id);
- //s_opt_menu_id = menu_id;
- MMK_WinGetActive(MMIMMS_EDIT_WIN_ID);
- switch( menu_id )
- {
- case ID_MMS_EDIT_SAVE:
- #ifndef WIN32
- g_filetype = MMICMS_GetCurrentFFS();
- if((g_filetype == FS_INVALID)||MMIMMS_GetManagerTotalNum() > (MMS_MAX_NUM-1)||!MMIMMS_IsMoreSpace())//modify liangliu 2005-12-14
- #else
- if(0)
- #endif
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_MEMORYFULL,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL);
- }
- else
- {
- if (g_peditdoc->slide_cur == NULL)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_EDIT_NO_CONTENT,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL
- );
- break;
- }
- else
- {
- SaveMmsMessage(SAVE_MMS_TO_DRAFTBOX,NULL);
- }
- }
- break;
- case ID_MMS_EDIT_SEND:
- if (CC_IsInCall()) //judge whether it's making a call
- {
- //alert : TXT_MMS_CANNOT_SEND_IN_CALL
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_CANNOT_SEND_IN_CALL,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- else if (! (MMISMS_IsReady() && MMISMS_IsOrderOk())) //judge whether sms_order ready
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXTSYS_WAITING,
- IMAGE_PROMPT_ICON_WAIT,
- MMISMS_3SECOND, PNULL
- );
- }
- else
- {
- if((g_p_mms_to == NULL)&&(g_p_mms_cc == NULL)&&(g_p_mms_bcc == NULL)
- &&(g_p_mms_to_group == NULL)&&(g_p_mms_cc_group == NULL)&&(g_p_mms_bcc_group == NULL))
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_EDIT_RECEIVER_NONE,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL);
- break;
- }
- SCI_TRACE_LOW("FNH before send messeage");
- if (g_peditdoc->slide_cur == NULL)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_EDIT_NO_CONTENT,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL
- );
- break;
- }
- MMIMMS_SendMMS_CreateSendingWin();
- g_netusing = MMS_MSG_NETUSING_STEP1;
- g_mailbox_status = SEND_NEW_MMS; //信箱状态
- CmsSendMessage(SEND_NEW_MMS);
- }
- break;
- case ID_MMS_EDIT_DURATION:
- MMK_CreateWin( (uint32*)MMIMMS_EDIT_SLIDE_TIME_TAB, PNULL);
- break;
- case ID_MMS_EDIT_SEND_ONTIME:
- MMK_CreateWin((uint32*)MMIMMS_EDIT_SET_SEND_DATE_TAB,NULL);
- break;
- default:
- // SCI_ASSERT(0);
- SCI_TRACE_LOW("Edit_HandleEditMMSWinMsg MSG_CTL_OK menu_id error ");
- break;
- }
- }
- break;
- case MSG_PROMPTWIN_OK:
- switch(s_opt_menu_id)
- {
- case ID_MMS_EDIT_DEL_CUR_SLIDE:
- //delete then return
- // fnCPS_DeleteCurSlide(); //faint
- // Adapter_fnCPSDeleteCurSlide();
- MMS_DelSlide(g_peditdoc);
- //close prompt query win
- PUBWIN_ClosePromptQueryWin();
- Edit_SetEditCtrlContent(edit_contrl_id,g_peditdoc);
- MMK_SetAtvCtrl(win_id, edit_contrl_id);
- //alert: have been deleted
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_DELED,
- IMAGE_PROMPT_ICON_SUCCESS,
- ALERT_TIMEOUT,
- PNULL
- );
- //close this menu win
- // MMK_CloseWin(win_id);
- // MMK_WinGetActive(win_id);
- break;
- case ID_MMS_INSERT_DPIC:
- //delete image
- // SCI_ASSERT(fnCPS_CurImageExist());
- // if (COMPOSER_SUCCESS != MMIMMS_DeleteCurImage())
- // {
- // SCI_ASSERT(FALSE);
- // }
- //close prompt query win
- PUBWIN_ClosePromptQueryWin();
- //open insert image win
- Edit_OpenInsertDpicWin(win_id);
- break;
- case ID_MMS_INSERT_PHOTO:
- //delete image
- // SCI_ASSERT(fnCPS_CurImageExist());
- // if (COMPOSER_SUCCESS != MMIMMS_DeleteCurImage())
- // {
- // SCI_ASSERT(FALSE);
- // }
- //close prompt query win
- PUBWIN_ClosePromptQueryWin();
- //open insert image win
- // Edit_OpenInsertPhotoWin(win_id);
- MMIDC_OpenAlbumWinForMMS(MMS_MAX_SIZE_OF_MULTIM,win_id);
- break;
- case ID_MMS_EDIT_DEL_IMAGE:
- //close prompt query win
- MMIMMS_DeleteCurImage(g_peditdoc);
- PUBWIN_ClosePromptQueryWin();
- MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
- //alert: have been deleted
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_DELED,
- IMAGE_PROMPT_ICON_SUCCESS,
- ALERT_TIMEOUT,
- PNULL
- );
- //close this menu win
- // MMK_CloseWin(win_id);
- // MMK_WinGetActive(win_id);
- break;
- case ID_MMS_EDIT_INSERT_MUSIC:
- // SCI_ASSERT(fnCPS_CurAudioExist());
- // if (COMPOSER_SUCCESS != fnCPS_DeleteCurAudio())
- // {
- // SCI_ASSERT(FALSE);
- // }
- //close prompt query win
- PUBWIN_ClosePromptQueryWin();
- //open insert music window
- Edit_OpenInsertDringWin(win_id);
- break;
- case ID_MMS_EDIT_DEL_MUSIC:
- // SCI_ASSERT(fnCPS_CurAudioExist());
- /*
- if (COMPOSER_SUCCESS != fnCPS_DeleteCurAudio())
- {
- SCI_ASSERT(FALSE);
- }
- */
- //close prompt query win
- if (g_peditdoc->slide_cur->audiosize > 0)
- MMS_DelAudio(g_peditdoc->slide_cur, g_peditdoc);
- PUBWIN_ClosePromptQueryWin();
- MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
- //alert: have been deleted
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_DELED,
- IMAGE_PROMPT_ICON_SUCCESS,
- ALERT_TIMEOUT,
- PNULL
- );
- //close this menu win
- // MMK_CloseWin(win_id);
- // MMK_WinGetActive(win_id);
- break;
- case ID_MMS_EDIT_DEL_VIDEO:
- #ifdef HAVE_MPEG4
- MMIMMS_DeleteCurVideo(g_peditdoc);
- //close prompt query win
- PUBWIN_ClosePromptQueryWin();
- MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
- //alert: have been deleted
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_DELED,
- IMAGE_PROMPT_ICON_SUCCESS,
- ALERT_TIMEOUT,
- PNULL
- );
- #endif
- break;
- case ID_MMS_EDIT_EXIT:
- PUBWIN_ClosePromptQueryWin();
- MMK_CloseWin(win_id);
- default:
- break;
- }
- break;
- case MSG_PROMPTWIN_CANCEL:
- //close query window
- PUBWIN_ClosePromptQueryWin();
- break;
- case MSG_APP_CANCEL:
- case MSG_CTL_CANCEL:
- s_opt_menu_id = ID_MMS_EDIT_EXIT;
- PUBWIN_OpenPromptQueryWin(STXT_EXIT, IMAGE_PROMPT_ICON_QUERY);
- break;
- case MSG_CLOSE_WINDOW:
- //need to load text
- is_need_to_load_former_text = TRUE;
- MMIMMS_Destruction();
- if(g_p_mms_subject != NULL)
- {
- cms_free(g_p_mms_subject);
- g_p_mms_subject = NULL;
- }
- /* 删除收件人链表 */
- if (g_p_mms_to != NULL)
- {
- MmsDelAllReceiver(&g_p_mms_to);
- g_p_mms_to = NULL;
- }
- if (g_p_mms_to_group != NULL)
- {
- if (g_p_mms_to_group->cur_group != NULL)
- {
- MmsDelReceiver(g_p_mms_to_group->cur_group);
- g_p_mms_to_group->cur_group = NULL;
- }
- cms_free(g_p_mms_to_group);
- g_p_mms_to_group = NULL;
- }
- /* 删除抄送人链表 */
- if(g_p_mms_cc != NULL)
- {
- MmsDelAllReceiver(&g_p_mms_cc);
- g_p_mms_cc = NULL;
- }
- if (g_p_mms_cc_group != NULL)
- {
- if (g_p_mms_cc_group->cur_group != NULL)
- {
- MmsDelReceiver(g_p_mms_cc_group->cur_group);
- g_p_mms_cc_group->cur_group = NULL;
- }
- cms_free(g_p_mms_cc_group);
- g_p_mms_cc_group = NULL;
- }
- /* 删除密送人链表 */
- if(g_p_mms_bcc != NULL)
- {
- MmsDelAllReceiver(&g_p_mms_bcc);
- g_p_mms_bcc = NULL;
- }
- if (g_p_mms_bcc_group != NULL)
- {
- if (g_p_mms_bcc_group->cur_group != NULL)
- {
- MmsDelReceiver(g_p_mms_bcc_group->cur_group);
- g_p_mms_bcc_group->cur_group = NULL;
- }
- cms_free(g_p_mms_bcc_group);
- g_p_mms_bcc_group = NULL;
- }
- /* 删除编辑器资源 */
- if(g_peditdoc != NULL)
- {
- MMSDelDocument(g_peditdoc);
- g_peditdoc = NULL;
- g_pcur_signdoc = NULL;
- }
- MMICMSBRW_FreeGlobalBuffer();
- if(s_is_mmscontent_suspend_mp3)
- {
- s_is_mmscontent_suspend_mp3=FALSE;
- MMIMP3_ContinuePlayMp3();
- }
- break;
- default:
- is_need_to_load_former_text = FALSE;
- err_code = MMI_RESULT_FALSE;
- break;
- }
- return err_code;
- }
- /******************************************************************************
- * 函数定义: Edit_HandleMMSEditSignWin
- * 函数说明: 编辑自动签名页的窗口处理函数
- * 参数说明: win_id: 窗口ID
- msg_id: 消息ID
- param:
- * 返回值: 空
- ********************************************************************************/
- LOCAL MMI_RESULT_E Edit_HandleMMSEditSignWin(
- MMS_WINDOW_ID_E win_id,
- MMI_MESSAGE_ID_E msg_id,
- DPARAM param
- )
- {
- MMI_RESULT_E err_code = MMI_RESULT_TRUE;
- MMI_CTRL_ID_T edit_contrl_id = MMIMMS_EDITSIGN_CTRL_ID;
- MMI_STRING_T saved_string;
- TEXTEDIT_STRING_INFO_T edit_string;
- int32 i_size_free = 0;
- MMIMPEG4_BUFFER_FILE_INFO_T* mpeg4_return_info_ptr = PNULL;
- MMIMP3_TETURN_INFO_T* mp3_return_info_ptr = PNULL;
- MMIMULTIM_SELECTED_RETURN_T* multim_return_info_ptr = PNULL;
- T_Composer_Image composer_img;
- T_Composer_Audio composer_audio;
- T_Composer_Video composer_video;
- static pMMS_EDocument p_sign_edit;
- FFS_OVERLAPPED_RESULT_T* efs_result_ptr;
- static x_start = 0; //x_start is always zero
- static y_start = 0; //y_start base is TITLE_HEIGHT
- MMS_CONTROL_ID_E anim_ctrl_id = MMIMMS_EDIT_SIGN_IMAGE_CTRL_ID;
- MMS_CONTROL_ID_E editbox_ctrl_id = MMIMMS_EDIT_SIGN_TEXT_CTRL_ID;
- static BOOLEAN b_isFirst = FALSE;
- static BOOLEAN image_is_too_big = FALSE;
- switch(msg_id)
- {
- case MSG_FULL_PAINT:
- MMIMMS_CLEAR_CLIENT();
- //set label window text
- Edit_SetSignLabelContent(MMIMMS_EDITSIGN_LABEL_CTRL_ID,p_sign_edit);
- break;
- case MSG_OPEN_WINDOW:
- SCI_TRACE_LOW("FNH MSG_OPEN_WINDOW !");
- MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
- MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_LEFT_ICON, IMAGE_PICTURE_PREV_PAGE_ON,IMAGE_PICTURE_PREV_PAGE_OFF,COMMON_IMAGE_NULL, TRUE);
- MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_MIDDLE_ICON, IMAGE_MMS_PREVIEW_PLAY,IMAGE_MMS_PREVIEW_PLAY,COMMON_IMAGE_NULL, TRUE);
- MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_RIGHT_ICON, IMAGE_PICTURE_NEXT_PAGE_ON,IMAGE_PICTURE_NEXT_PAGE_OFF,COMMON_IMAGE_NULL, TRUE);
- p_sign_edit = g_pcur_signdoc;
- //need to load former text
- is_need_to_load_former_text = TRUE;
- b_isFirst = TRUE;
- if (p_sign_edit == NULL)
- {
- p_sign_edit = MMS_New();
- SCI_ASSERT(p_sign_edit != NULL);
- MMS_New_Slide(p_sign_edit);
- }
- if (p_sign_edit->slide_cur == NULL)
- {
- MMS_New_Slide(p_sign_edit);
- }
- if (is_need_to_load_former_text)
- {
- Edit_SetEditCtrlContent(edit_contrl_id,p_sign_edit);
- }
- MMK_SetAtvCtrl(win_id, edit_contrl_id);
- break;
- case MSG_CTL_EDITBOX_UPDATE_STRNUM:
- SCI_MEMSET( &edit_string, 0, sizeof( TEXTEDIT_STRING_INFO_T ) );
- GUIEDITBOX_GetTextEditBoxInfo( edit_contrl_id, &edit_string);
- edit_string.str_ptr[edit_string.str_len] = ' ';
- if (p_sign_edit->slide_cur->text_flag) /*判断当前是否已有文本类型?*/
- {
- CmsDelContent(p_sign_edit, p_sign_edit->slide_cur, MMS_TYPE_TEXT);
- p_sign_edit->slide_cur->text_flag = 0;
- }
- if (edit_string.str_len != 0)
- {
- saved_string.str_ptr = edit_string.str_ptr;
- saved_string.length = edit_string.str_len;
- saved_string.is_ucs2 = edit_string.is_ucs2;
- {
- int16 type = 0;
- char text_fname[MMS_MAX_FILE_NAME_LENGTH] = {0};
- SCI_FILE* fd = 0;
- unsigned long value = 0;
- unsigned short buff_size = 0;
- int16 uni_len = 0;
- char* str_utf16 = NULL;
- if (edit_string.is_ucs2 == 0)
- {
- uni_len = Cms_UTF8toUTF16Len(edit_string.str_ptr);
- }
- else
- {
- uni_len = edit_string.str_len;
- }
- if ((p_sign_edit->totalsize +uni_len ) > MMS_SIZE_OF_MESSAGE)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_MMS_TOO_BIG,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- break;
- }
- value = TM_GetTotalSeconds();
- sprintf(text_fname,"%ld",value);
- type = MMS_TYPE_TEXT;
- strcat(text_fname,".txt");
- fd =(SCI_FILE*)mmsf_Open((char*)text_fname,"w");
- if ( !fd )
- {
- SCI_TRACE_LOW("open the file error");
- return ;
- }
- if (edit_string.is_ucs2 == 0)
- {
- str_utf16 =(char*)cms_malloc(uni_len+1);
- SCI_MEMSET(str_utf16,0,uni_len+1);
- Cms_UTF8toUTF16(edit_string.str_ptr,edit_string.str_len,uni_len,str_utf16);
- }
- buff_size = uni_len;
- mmsf_Write((char *)(&buff_size),1,sizeof(unsigned short),(FILE_HANDLE)fd);
- SCI_TRACE_LOW("FNH buff_size = %d",buff_size);
- if (edit_string.is_ucs2 == 0)
- {
- mmsf_Write((char *)str_utf16,1,uni_len,(FILE_HANDLE)fd);
- SCI_TRACE_LOW("FNH after write str_utr16 = %s,uni_len = %d",str_utf16,uni_len);
- }
- else
- {
- mmsf_Write((char *)edit_string.str_ptr,1,uni_len,(FILE_HANDLE)fd);
- SCI_TRACE_BUF("FNH enit_string.str_ptr = ",edit_string.str_ptr,10);
- SCI_TRACE_LOW("FNH uni_len = %d",uni_len);
- }
- mmsf_Close((FILE_HANDLE)fd);
- if (str_utf16)
- {
- cms_free(str_utf16);
- str_utf16 = NULL;
- }
- if (MMS_New_Content((unsigned char *)text_fname,type,p_sign_edit->slide_cur,p_sign_edit))
- {
- SCI_TRACE_LOW("insert text is ok!");
- }
- else
- {
- SCI_TRACE_LOW("insert text is failed!");
- }
- }
- }
- break;
- case MSG_GET_FOCUS:
- if (is_need_to_load_former_text)
- {
- Edit_SetEditCtrlContent(edit_contrl_id,p_sign_edit);
- }
- break;
- case MSG_CTL_PENUP:
- switch ((MMI_CTRL_ID_T)param)
- {
- case MMIMMS_EDITSIGN_PIC_CTRL_ID:
- if (p_sign_edit->slide_cur->image_flag == 1)
- {
- s_opt_menu_id = ID_MMS_EDIT_DEL_IMAGE;
- PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
- }
- else if (p_sign_edit->slide_cur->video_flag == 1)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_CMS_MMS_VIDEO_NOPIC,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- else
- {
- s_opt_menu_id = ID_MMS_INSERT_DPIC;
- MMK_CreateWin( (uint32*)MMIMMS_EDIT_SELECT_IMAGE_WIN_TAB, (ADD_DATA)win_id);
- }
- break;
- case MMIMMS_EDITSIGN_RING_CTRL_ID:
- if (p_sign_edit->slide_cur->audiosize !=0)
- {
- s_opt_menu_id = ID_MMS_EDIT_DEL_MUSIC;
- PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
- }
- else if (p_sign_edit->slide_cur->video_flag == 1)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_CMS_MMS_VIDEO_NOMUSIC,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- else
- {
- s_opt_menu_id = ID_MMS_EDIT_INSERT_MUSIC;
- MMK_CreateWin( (uint32*)MMIMMS_EDIT_SELECT_MUSIC_WIN_TAB, (ADD_DATA)win_id);
- }
- break;
- case MMIMMS_EDITSIGN_VIDEO_CTRL_ID:
- if (p_sign_edit->slide_cur->image_flag == 1)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_CMS_MMS_PIC_NOVIDEO,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- else if (p_sign_edit->slide_cur->audiosize != 0)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_CMS_MMS_MUSIC_NOVIDEO,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- else if (p_sign_edit->slide_cur->video_flag==1)
- {
- s_opt_menu_id = ID_MMS_EDIT_DEL_VIDEO;
- PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
- }
- else
- {
- s_opt_menu_id = ID_MMS_EDIT_INSERT_VIDEO;
- i_size_free = MMS_SIZE_OF_MESSAGE - p_sign_edit->totalsize;
- if (i_size_free <= 0)
- {
- i_size_free = 0;
- }
- //添加视频接口
- MMIMPEG4_SelectAndGetFile(i_size_free , win_id, 1);
- }
- break;
- default:
- break;
- }
- break;
- #ifdef HAVE_MPEG4
- case MSG_MPEG4_READ_FFS_DONE:
- SCI_ASSERT(param != NULL);
- SCI_TRACE_LOW("FNH enter MSG_MULTIM_SLEECTED_RETURN");
- mpeg4_return_info_ptr = (MMIMPEG4_BUFFER_FILE_INFO_T *)param;
- if ((PNULL == mpeg4_return_info_ptr->buf_ptr) || (0 == mpeg4_return_info_ptr->memory_size))
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_EDIT_ADD_FAIL,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- break;
- }
- MMIMMS_DeleteCurVideo(p_sign_edit);
- SCI_MEMSET(&composer_video,0,sizeof(composer_video));
- composer_video.VidBuf = mpeg4_return_info_ptr->buf_ptr;
- composer_video.size = mpeg4_return_info_ptr->memory_size;
- SCI_TRACE_LOW("FNH composer_viedo.size = %d",composer_video.size);
- composer_video.Type = mpeg4_return_info_ptr->type;
- // composer_video.Type = "video/mpeg";
- SCI_TRACE_LOW("FNH before add video");
- MMIMMS_AddVideo(&composer_video,p_sign_edit);
- break;
- #endif
- #ifdef HAVE_MP3
- case MSG_MP3_READ_FFS_DONE:
- SCI_ASSERT(param != NULL);
- SCI_TRACE_LOW("FNH enter MSG_MULTIM_SLEECTED_RETURN");
- mp3_return_info_ptr = (MMIMP3_TETURN_INFO_T *)param;
- if (PNULL == mp3_return_info_ptr->buf_ptr)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_EDIT_ADD_FAIL,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- break;
- }
- MMS_DelAudio(p_sign_edit->slide_cur, p_sign_edit);
- //insert the audio
- composer_audio.AudBuf = mp3_return_info_ptr->buf_ptr;
- composer_audio.size = mp3_return_info_ptr->memory_size;
- composer_audio.Type = COMPOSER_AUDIO_MP3;
- SCI_TRACE_LOW("FNH get music composer_audio.size = %d",composer_audio.size);
- SCI_TRACE_LOW("FNH multim_return_info->type = %d",composer_audio.Type);
- MMIMMS_AddAudio(&composer_audio,p_sign_edit);
- break;
- #endif
- case MSG_MULTIM_SELECTED_RETURN:
- SCI_TRACE_LOW("FNH enter MSG_MULTIM_SELECTED_RETURN");
- SCI_ASSERT(param != NULL);
- multim_return_info_ptr = (MMIMULTIM_SELECTED_RETURN_T *)param;
- if ((PNULL == multim_return_info_ptr->buf_ptr) || (0 == multim_return_info_ptr->memory_size))
- {
- if (s_opt_menu_id == ID_MMS_INSERT_DPIC || s_opt_menu_id ==ID_MMS_INSERT_PHOTO )
- {
- //alert : not supported image
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_INVALID_PIC,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- else if (s_opt_menu_id == ID_MMS_EDIT_INSERT_MUSIC)
- {
- //alert : not supported audio
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_INVALID_AUDIO,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- break;
- }
- SCI_MEMSET(&composer_img, 0, sizeof(composer_img));
- SCI_MEMSET(&composer_audio, 0, sizeof(composer_audio));
- if (s_opt_menu_id == ID_MMS_INSERT_PHOTO || s_opt_menu_id == ID_MMS_INSERT_DPIC)
- {
- MMIMMS_DeleteCurImage(p_sign_edit);
- //insert the image
- composer_img.ImgBuf = multim_return_info_ptr->buf_ptr;
- composer_img.size = multim_return_info_ptr->memory_size;
- composer_img.Type = Edit_GetDeltaMMSImageType2(multim_return_info_ptr->type);
- composer_img.begin = 0;
- SCI_TRACE_LOW("FNH buf = %d,size = %d,type = %d",composer_img.ImgBuf,composer_img.size,multim_return_info_ptr->type);
- if (composer_img.Type != PNULL)
- {
- MMIMMS_AddImage(&composer_img,p_sign_edit);
- }
- else
- {
- //alert : not supported image
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_INVALID_PIC,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- }
- else if (s_opt_menu_id == ID_MMS_EDIT_INSERT_MUSIC)
- {
- MMS_DelAudio(p_sign_edit->slide_cur, p_sign_edit);
- //insert the audio
- composer_audio.AudBuf = multim_return_info_ptr->buf_ptr;
- composer_audio.size = multim_return_info_ptr->memory_size;
- composer_audio.Type = Edit_GetDeltaMMSAudioType(multim_return_info_ptr->type);
- SCI_TRACE_LOW("FNH get music composer_audio.size = %d",multim_return_info_ptr->memory_size);
- SCI_TRACE_LOW("FNH multim_return_info->type = %d",multim_return_info_ptr->type);
- SCI_TRACE_LOW("FNH composer_audio.Type = %s",composer_audio.Type);
- if (composer_audio.Type != PNULL)
- {
- MMIMMS_AddAudio(&composer_audio,p_sign_edit);
- }
- else
- {
- //alert : not supported audio
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_INVALID_AUDIO,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- }
- else
- {
- SCI_ASSERT(!"mmimms:Bad message.");
- }
- //free
- if (s_opt_menu_id != ID_MMS_INSERT_PHOTO)
- {
- if (multim_return_info_ptr->buf_ptr != PNULL)
- {
- cms_free(multim_return_info_ptr->buf_ptr);
- multim_return_info_ptr->buf_ptr = NULL;
- }
- }
- break;
- case MSG_MMS_CLOSE_PREVIEW_WAITING_WIN:
- //create preview win
- MMK_CreateWin( (uint32*)MMIMMS_EDIT_PREVIEW_TAB, (ADD_DATA)p_sign_edit);
- //close waiting win
- PUBWIN_ClosePromptAlertWin();
- // x_start = 0;
- // y_start = 0;
- // image_is_too_big = Preview_PlayCurrentSlide(p_sign_edit,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, TRUE,TRUE);
- break;
- case MSG_APP_WEB:
- #ifdef HAVE_MPEG4
- #ifdef WIN32
- case MSG_APP_GREEN:
- #endif
- if (p_sign_edit->slide_cur->video_flag == 1)
- {
- T_Composer_Video composer_video;
- SCI_MEMSET(&composer_video,0,sizeof(T_Composer_Video));
- if (MMIMMS_GetCurSlideVideo(&composer_video,p_sign_edit)!= -1)
- {
- SCI_TRACE_LOW("FNH size is %d,type is %d",composer_video.size,composer_video.Type);
- MMIMPEG4_playFromBuffer(composer_video.VidBuf,composer_video.size,composer_video.Type);
- }
- }
- #endif
- break;
- case MSG_SKB_ICON:
- if(MMI_SOFTKEYBAR_MIDDLE_ICON == (uint32) param)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXTSYS_WAITING,
- IMAGE_PROMPT_ICON_WAIT,
- 0,
- PNULL
- );
- play_or_preview = MMS_PREVIEW;
- //post close waiting win message
- MMK_PostMsg(win_id, MSG_MMS_CLOSE_PREVIEW_WAITING_WIN, PNULL, 0);
- }
- break;
- case MSG_PROMPTWIN_OK:
- PUBWIN_ClosePromptQueryWin();
- switch(s_opt_menu_id)
- {
- case ID_MMS_INSERT_DPIC:
- //open insert image win
- Edit_OpenInsertDpicWin(win_id);
- break;
- case ID_MMS_INSERT_PHOTO:
- //open insert image win
- MMIDC_OpenAlbumWinForMMS(MMS_MAX_SIZE_OF_MULTIM,win_id);
- break;
- case ID_MMS_EDIT_DEL_IMAGE:
- //close prompt query win
- MMIMMS_DeleteCurImage(p_sign_edit);
- MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
- //alert: have been deleted
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_DELED,
- IMAGE_PROMPT_ICON_SUCCESS,
- ALERT_TIMEOUT,
- PNULL
- );
- break;
- case ID_MMS_EDIT_INSERT_MUSIC:
- //open insert music window
- Edit_OpenInsertDringWin(win_id);
- break;
- case ID_MMS_EDIT_DEL_MUSIC:
- //close prompt query win
- if (p_sign_edit->slide_cur->audiosize > 0)
- MMS_DelAudio(p_sign_edit->slide_cur, p_sign_edit);
- MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
- //alert: have been deleted
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_DELED,
- IMAGE_PROMPT_ICON_SUCCESS,
- ALERT_TIMEOUT,
- PNULL
- );
- break;
- case ID_MMS_EDIT_DEL_VIDEO:
- #ifdef HAVE_MPEG4
- MMIMMS_DeleteCurVideo(p_sign_edit);
- MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
- //alert: have been deleted
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_DELED,
- IMAGE_PROMPT_ICON_SUCCESS,
- ALERT_TIMEOUT,
- PNULL
- );
- #endif
- break;
- case ID_MMS_EDIT_CLOSE_SAVE:
- MMIMMS_CreateSaveMMSWaitingWin();
- MMIMMS_SaveAutoSignMessage(p_sign_edit);
- MMK_CloseWin(win_id);
- break;
- default:
- break;
- }
- break;
- case MSG_PROMPTWIN_CANCEL:
- //close query window
- PUBWIN_ClosePromptQueryWin();
- if(s_opt_menu_id == ID_MMS_EDIT_CLOSE_SAVE)
- {
- if (p_sign_edit != NULL)
- {
- SCI_TRACE_LOW("FNH before MSG_PROMPTWIN_CANCEL free p_cur_edit");
- MMSDelDocument(p_sign_edit);
- p_sign_edit = NULL;
- g_pcur_signdoc = NULL;
- }
- MMK_CloseWin(win_id);
- }
- break;
- case MSG_APP_CANCEL:
- case MSG_CTL_CANCEL:
- s_opt_menu_id = ID_MMS_EDIT_CLOSE_SAVE;
- PUBWIN_OpenPromptQueryWin(TXT_MMS_SAVE, IMAGE_PROMPT_ICON_QUERY);
- break;
- case MSG_APP_OK:
- case MSG_CTL_OK:
- MMIMMS_CreateSaveMMSWaitingWin();
- MMIMMS_SaveAutoSignMessage(p_sign_edit);
- MMK_CloseWin(win_id);
- break;
- case MSG_CLOSE_WINDOW:
- SCI_TRACE_LOW("FNH In close window before stop ring");
- // MMIPROFILE_StopRing(RING_STA_OTHER);
- SCI_TRACE_LOW("FNH after stop ring");
- break;
- default:
- err_code = MMI_RESULT_FALSE;
- break;
- }
- return err_code;
- }
- /******************************************************************************
- * 函数定义: cms_mms_judge_date
- * 函数说明: 将输入的日期与系统时间比较
- * 参数说明: year: 年份
- month: 月
- day : 日期
- * 返回值: int16
- ********************************************************************************/
- int16 cms_mms_judge_date(uint16 year,uint8 month,uint8 day)
- {
- SCI_DATE_T sys_date;
- if ((0 == month) || (12 < month))//check month
- {
- return 0;
- }
- switch(month)
- {
- case MMISET_DATE_JAN:
- case MMISET_DATE_MAR:
- case MMISET_DATE_MAY:
- case MMISET_DATE_JUL:
- case MMISET_DATE_AUG:
- case MMISET_DATE_OCT:
- case MMISET_DATE_DEC:
- //check big month
- if ((0 == day) || (MMISET_DATE_BIG_MONTH_DAY < day))
- {
- return 0;
- }
- break;
- case MMISET_DATE_APR:
- case MMISET_DATE_JUN:
- case MMISET_DATE_SEP:
- case MMISET_DATE_NOV:
- //check small month
- if ((0 == day) || (MMISET_DATE_SMALL_MONTH_DAY < day))
- {
- return 0;
- }
- break;
- case MMISET_DATE_FEB:
- if ((!(year % 4) && (year % 100)) || !(year % 400))
- {
- //check leap month
- if ((0 == day) || (MMISET_DATE_LEAP_MONTH_DAY < day))
- {
- return 0;
- }
- }
- else
- {
- //check not leap month
- if ((0 == day) || (MMISET_DATE_NOT_LEAP_MONTH_DAY < day))
- {
- return 0;
- }
- }
- break;
- default:
- SCI_TRACE_HIGH("CheckDayOfDateIsValid:date.date_month = %d is error!",month);
- break;
- }
- TM_GetSysDate(&sys_date);
- if (year < sys_date.year)
- {
- return 0;
- }
- else if (year == sys_date.year)
- {
- if (month < sys_date.mon)
- {
- return 0;
- }
- else if (month == sys_date.mon)
- {
- if (day < sys_date.mday)
- {
- return 0;
- }
- }
- }
- return 1;
- }
- /******************************************************************************
- * 函数定义: cms_mms_judge_time
- * 函数说明: 将输入的时间与系统时间比较
- * 参数说明: hour: 小时
- minute: 分钟
- * 返回值: int16
- ********************************************************************************/
- int16 cms_mms_judge_time(uint8 hour,uint8 minute)
- {
- SCI_TIME_T sys_time;
- if (59 < minute)
- {
- return 0;
- }
- else
- {
- //check the time of 24 Hour if is valid,check the hour
- if (24 <= hour)
- {
- return 0;
- }
- }
- TM_GetSysTime(&sys_time);
- if (hour < sys_time.hour)
- {
- return 0;
- }
- else if ( hour == sys_time.hour)
- {
- if (minute < sys_time.min)
- {
- return 0;
- }
- }
- return 1;
- }
- /* ----------------------------------------------------------------------------
- * Function Name: Edit_HandleMMSSetSendDateWin
- * Purpose: 设置发送日期窗口
- * Input: win_id:窗口ID,
- msg_Id:消息ID,
- param:窗口参数
- * Returns: MMI_RESULT_E
- * Author:nihongf@mobilesoft.com.cn
- * ----------------------------------------------------------------------------*/
- LOCAL MMI_RESULT_E Edit_HandleMMSSetSendDateWin(
- MMS_WINDOW_ID_E win_id,
- MMI_MESSAGE_ID_E msg_id,
- DPARAM param
- )
- {
- MMI_RESULT_E recode = MMI_RESULT_TRUE;
- SCI_DATE_T sys_date;
- SCI_TIME_T sys_time;
- switch (msg_id)
- {
- case MSG_OPEN_WINDOW:
- {
- //设置输入time or date背景色
- if (g_set_date.year == 0)
- {
- TM_GetSysDate(&sys_date);
- GUIEDITBOX_SetDateEditBoxStringInfo(MMIMMS_SET_SEND_DATE_CTRL_ID,sys_date.year,sys_date.mon,sys_date.mday,YEAR_MONTH_DAY_TYPE);
- }
- else
- {
- GUIEDITBOX_SetDateEditBoxStringInfo(MMIMMS_SET_SEND_DATE_CTRL_ID,g_set_date.year,g_set_date.month,g_set_date.day,YEAR_MONTH_DAY_TYPE);
- }
- if (g_set_date.hour == 0)
- {
- //get current system time
- TM_GetSysTime(&sys_time);
- GUIEDITBOX_SetTimeEditBoxStringInfo(MMIMMS_SET_SEND_TIME_CTRL_ID,sys_time.hour,sys_time.min,TIME_TWENTYFOUR_TYPE);
- }
- else
- {
- GUIEDITBOX_SetTimeEditBoxStringInfo(MMIMMS_SET_SEND_TIME_CTRL_ID,g_set_date.hour,g_set_date.minute,TIME_TWENTYFOUR_TYPE);
- }
- MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
- MMK_SetAtvCtrl(win_id,MMIMMS_SET_SEND_DATE_CTRL_ID);
- }
- break;
- case MSG_FULL_PAINT:
- MMIMMS_CLEAR_CLIENT();
- break;
- case MSG_APP_OK:
- case MSG_CTL_OK:
- {
- uint16 year;
- uint8 month;
- uint8 day;
- GUIEDITBOX_GetDateEditBoxInfo(MMIMMS_SET_SEND_DATE_CTRL_ID,&year,&month,&day);
- if (cms_mms_judge_date(year,month,day) == 0)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_INPUT_ERROR,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- else
- {
- uint8 hour;
- uint8 minute;
- SCI_DATE_T sys_date;
- g_set_date.year = year;
- g_set_date.month = month;
- g_set_date.day = day;
- GUIEDITBOX_GetTimeEditBoxInfo(MMIMMS_SET_SEND_TIME_CTRL_ID,&hour,&minute);
- TM_GetSysDate(&sys_date);
- if ((g_set_date.year==sys_date.year) && (g_set_date.month == sys_date.mon) && (g_set_date.day == sys_date.mday))
- {
- if (cms_mms_judge_time(hour,minute) == 0)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_INPUT_ERROR,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL
- );
- break;
- }
- }
- else
- {
- if (hour>=24 || minute>59)
- {
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_INPUT_ERROR,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL
- );
- break;
- }
- }
- g_set_date.hour = hour;
- g_set_date.minute = minute;
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_EDIT_SET_OK,
- IMAGE_PROMPT_ICON_ALERT,
- ALERT_TIMEOUT,
- PNULL
- );
- // MMK_CreateWin((uint32*)MMIMMS_EDIT_SET_SEND_TIME_TAB,NULL);
- MMK_CloseWin(win_id);
- }
- }
- break;
- case MSG_APP_CANCEL:
- case MSG_CTL_CANCEL:
- MMK_CloseWin(win_id);
- break;
- default:
- recode = MMI_RESULT_FALSE;
- break;
- }
- return recode;
- }
- /******************************************************************************
- * 函数定义: MmsDelReceiver
- * 函数说明: 删除所有收件人
- * 参数说明: p_receiver: 收件人列表
- * 返回值: int16
- ********************************************************************************/
- int16 MmsDelReceiver(p_MMS_RECEPIENT p_receiver)
- {
- int32 number = 0;
- int32 i = 0;
- p_MMS_RECEPIENT p_temp = NULL;
- p_MMS_RECEPIENT p_temp_receiver = NULL;
- p_MMS_RECEPIENT p_temp_next = NULL;
- p_temp_receiver = p_receiver;
- number = MmsGetReceiverCount(p_temp_receiver);
- if(number == 0 )
- {
- return -1;
- }
- if(number == 1)
- {
- cms_free(p_temp_receiver);
- p_temp_receiver = NULL;
- return 0;
- }
- for (i=0;i<number-1;i++)
- {
- p_temp = p_temp_receiver;
- p_temp_next = p_temp_receiver->p_next;
- cms_free(p_temp);
- p_temp = NULL;
- p_temp_receiver = p_temp_next;
- }
- return 0;
- }
- /******************************************************************************
- * 函数定义: MmsDelOneReceiver
- * 函数说明: 删除一个收件人
- * 参数说明: p_receiver: 收件人列表
- p_del: 待删除的地址
- * 返回值: int16
- ********************************************************************************/
- int16 MmsDelOneReceiver(p_MMS_RECEPIENT* p_receiver,void* p_del)
- {
- int32 number = 0;
- p_MMS_RECEPIENT p_temp = NULL;
- p_MMS_RECEPIENT p_temp_receiver = NULL;
- int16 result = 0;
- p_temp_receiver = *p_receiver;
- number = MmsGetReceiverCount(p_temp_receiver);
- SCI_ASSERT(p_del != NULL);
- if(number == 0 )
- {
- result = -1;
- return result;
- }
- if((p_del == p_temp_receiver )&&(number == 1))
- {
- cms_free(p_temp_receiver);
- p_temp_receiver = NULL;
- *p_receiver = NULL;
- result = 0;
- return result;
- }
- if(number>=2)
- {
- /*开头为待删除节点*/
- if(p_del == p_temp_receiver)
- {
- p_temp_receiver = p_temp_receiver->p_next;
- *p_receiver = p_temp_receiver;
- cms_free(p_del);
- number = number - 1;
- result = number;
- return result;
- }
- /*中间为待删除节点*/
- for(p_temp=p_temp_receiver;p_temp; p_temp=p_temp->p_next)
- {
- if(p_temp->p_next == p_del)
- {
- if(p_temp->p_next->p_next != NULL)
- {
- p_temp->p_next = p_temp->p_next->p_next;
- }
- else
- {
- p_temp->p_next = NULL;
- }
- cms_free(p_del);
- *p_receiver = p_temp_receiver;
- break;
- }
- }
- result = number-1;
- return result;
- }
- return result;
- }
- /*****************************************************************************/
- // Description : 预览界面的向上按钮回调函数
- // Global resource dependence :
- // Author:yuhua.shi
- // Note:
- /*****************************************************************************/
- LOCAL MMI_RESULT_E Edit_PreviewUpButtonCallBack( void )
- {
- MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_APP_UP, PNULL);
- MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
- return MMI_RESULT_TRUE;
- }
- /*****************************************************************************/
- // Description : 预览界面的向下按钮回调函数
- // Global resource dependence :
- // Author:Bill.Ji
- // Note:
- /*****************************************************************************/
- LOCAL MMI_RESULT_E Edit_PreviewDownButtonCallBack( void )
- {
- MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_APP_DOWN, PNULL);
- MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
- return MMI_RESULT_TRUE;
- }
- /*****************************************************************************/
- // Description : 预览界面的向左按钮回调函数
- // Global resource dependence :
- // Author:Bill.Ji
- // Note:
- /*****************************************************************************/
- LOCAL MMI_RESULT_E Edit_PreviewLeftButtonCallBack( void )
- {
- MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_APP_LEFT, PNULL);
- MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
- return MMI_RESULT_TRUE;
- }
- /*****************************************************************************/
- // Description : 预览界面的向右按钮回调函数
- // Global resource dependence :
- // Author:Bill.Ji
- // Note:
- /*****************************************************************************/
- LOCAL MMI_RESULT_E Edit_PreviewRightButtonCallBack( void )
- {
- MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_APP_RIGHT, PNULL);
- MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
- return MMI_RESULT_TRUE;
- }
- /*****************************************************************************/
- // Description : 预览界面的停止播放按钮回调函数
- // Global resource dependence :
- // Author:Bill.Ji
- // Note:
- /*****************************************************************************/
- LOCAL MMI_RESULT_E Edit_PreviewPlayButtonCallBack( void )
- {
- Edit_HandlePreviewMMSMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_CTL_OK, PNULL);
- MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
- return MMI_RESULT_TRUE;
- }
- /******************************************************************************
- * 函数定义: Edit_HandlePreviewMMSMsg
- * 函数说明: mms预览或者播放的窗口处理
- * 参数说明: win_id:窗口ID
- msg_Id:消息ID
- param:窗口参数
- * 返回值: 空
- ********************************************************************************/
- LOCAL MMI_RESULT_E Edit_HandlePreviewMMSMsg(
- MMS_WINDOW_ID_E win_id,
- MMI_MESSAGE_ID_E msg_id,
- DPARAM param
- )
- {
- static MMIMMS_PREVIEW_STATE s_edit_mms_preview_state;
- MMI_RESULT_E err_code = MMI_RESULT_TRUE;
- // uint8 timer_id = MMI_MMS_PREVIEW_TIMER_ID;
- uint32 duaration = 0;
- MMS_CONTROL_ID_E anim_ctrl_id = MMIMMS_EDIT_IMAGE_PREVIEW_CTRL_ID;
- MMS_CONTROL_ID_E editbox_ctrl_id = MMIMMS_EDIT_TEXT_PREVIEW_CTRL_ID;
- static int x_start = 0; //x_start is always zero
- static int y_start = 0; //y_start base is TITLE_HEIGHT
- static T_WORD slide_num_save = 0;
- static T_WORD slide_num_lose_focus = 0;
- ANIMATE_IMAGE_TYPE_E image_type = 0;
- uint16 image_height = 0;
- uint16 image_width = 0;
- uint16 text_height = 0;
- static BOOLEAN b_isFirst = FALSE;
- MMIMMS_EDIT_PREVIEW_FROM edit_preview_from = MMIMMS_EDIT_PREVIEW_FROM_MMS;
- BOOLEAN is_new_slide = FALSE;
- static BOOLEAN image_is_too_big = FALSE;
- MMI_STRING_T text_str;
- uint32 button_index = 0;
- static pMMS_EDocument p_cur_edoc = NULL;
- SCI_TRACE_LOW("FNH enter preview mms");
- switch(msg_id)
- {
- case MSG_FULL_PAINT:
- SCI_TRACE_LOW("FNH PREVIEW MMS MSG_FULL_PAINT!");
- if ((image_is_too_big) &&(b_isFirst))
- {
- PUBWIN_OpenPromptAlertWin(PUBWIN_SOFTKEY_ONE,TXT_DC_PICTOO_LARGE,IMAGE_PROMPT_ICON_ALERT,MMI_1SECONDS,PNULL);
- image_is_too_big = FALSE;
- }
- b_isFirst = FALSE;
- Preview_DispSlideNum(MMIMMS_EDIT_PREVIEW_LABEL_CTRL_ID,p_cur_edoc);
- if(MMIMMS_PREVIEW_PLAYING == s_edit_mms_preview_state )
- {
- MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_MIDDLE_ICON, IMAGE_MMS_PREVIEW_PAUSE,IMAGE_MMS_PREVIEW_PAUSE,COMMON_IMAGE_NULL, TRUE);
- }
- else
- {
- MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_MIDDLE_ICON, IMAGE_MMS_PREVIEW_PLAY,IMAGE_MMS_PREVIEW_PLAY,COMMON_IMAGE_NULL, TRUE);
- }
- break;
- case MSG_OPEN_WINDOW:
- SCI_TRACE_LOW("FNH enter Preview MSG_OPEN_WINDOW");
- MMK_SetWinSoftkeyId(win_id, TXT_CMS_MMS_VEDIO, COMMON_TXT_NULL, STXT_RETURN, FALSE);
- MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_LEFT_ICON, IMAGE_PICTURE_PREV_PAGE_ON,IMAGE_PICTURE_PREV_PAGE_OFF,COMMON_IMAGE_NULL, TRUE);
- MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_MIDDLE_ICON, IMAGE_MMS_PREVIEW_PAUSE,IMAGE_MMS_PREVIEW_PAUSE,COMMON_IMAGE_NULL, TRUE);
- MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_RIGHT_ICON, IMAGE_PICTURE_NEXT_PAGE_ON,IMAGE_PICTURE_NEXT_PAGE_OFF,COMMON_IMAGE_NULL, TRUE);
- GUIBUTTON_SetCallBackFuction(MMIMMS_EDIT_PREVIEW_LEFT_BUTTON_CTRL_ID,
- MSG_TP_PRESS_UP, Edit_PreviewUpButtonCallBack);
- GUIBUTTON_SetCallBackFuction(MMIMMS_EDIT_PREVIEW_RIGHT_BUTTON_CTRL_ID,
- MSG_TP_PRESS_UP, Edit_PreviewDownButtonCallBack);
- GUILABEL_SetFontParam(MMIMMS_EDIT_PREVIEW_LABEL_CTRL_ID, MMI_LISTNUM_FONT, MMI_BLACK_COLOR, 0);
- p_cur_edoc = (pMMS_EDocument)(MMK_GetWinAddDataPtr(win_id));
- //save the slide numver
- slide_num_save = MMSGetSlideIndex(p_cur_edoc);
- SCI_TRACE_LOW("FNH Preview MSG_OPEN_WINDOW: before goto first");
- //go to the 1st slide and start timer
- while(MMSGetSlideIndex(p_cur_edoc) != 1)
- {
- MMS_PrevSlide(p_cur_edoc);
- }
- SCI_TRACE_LOW("FNH Preview MSG_OPEN_WINDOW: after goto first");
- //then state changes to playing. this is its entrance
- s_edit_mms_preview_state = MMIMMS_PREVIEW_PLAYING;
- //play first slide
- x_start = 0;
- y_start = 0;
- //disable text scroll bar
- GUITEXTBOX_EnableScrollbar(editbox_ctrl_id, FALSE);
- image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, TRUE,TRUE);
- b_isFirst = TRUE;
- SCI_TRACE_LOW("FNH b_isFirst = %d",b_isFirst);
- //start slide timer
- duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
- g_mmimms_preview_timer_id = MMK_CreateWinTimer(win_id, duaration * ONE_KILO, FALSE);
- break;
- case MSG_GET_FOCUS:
- SCI_TRACE_LOW("FNH enter Preview msg_get_focus");
- if(MMIMMS_PREVIEW_PLAYING == s_edit_mms_preview_state )
- {
- MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_MIDDLE_ICON, IMAGE_MMS_PREVIEW_PAUSE,IMAGE_MMS_PREVIEW_PAUSE,COMMON_IMAGE_NULL, TRUE);
- }
- else
- {
- MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_MIDDLE_ICON, IMAGE_MMS_PREVIEW_PLAY,IMAGE_MMS_PREVIEW_PLAY,COMMON_IMAGE_NULL, TRUE);
- }
- //according to the former status, resume the timer, or not
- switch(s_edit_mms_preview_state)
- {
- case MMIMMS_PREVIEW_LEAVE:
- is_new_slide = FALSE;
- break;
- case MMIMMS_PREVIEW_PLAYING:
- //start the former timer from beginning
- duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
- g_mmimms_preview_timer_id = MMK_CreateWinTimer(win_id, duaration * ONE_KILO, FALSE);
- is_new_slide = FALSE;
- break;
- case MMIMMS_PREVIEW_STOP:
- //don't start the timer
- is_new_slide = FALSE;
- break;
- default:
- SCI_TRACE_LOW("Edit_HandlePreviewMMSMsg MSG_GET_FOCUS default");
- break;
- }
- //preview current slide
- x_start = 0;
- y_start = 0;
- image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, is_new_slide, FALSE,TRUE);
- SCI_TRACE_LOW("FNH image_is_too_big is %d",image_is_too_big);
- MMITHEME_SetUpdateDelayCount(1);
- break;
- case MSG_LOSE_FOCUS:
- SCI_TRACE_LOW("fnh enter MSG_LOSE_FOCUS");
- //save current slide number
- slide_num_lose_focus = MMSGetSlideIndex(p_cur_edoc);
- //don't change the state
- // MmsStopPreviewRing();
- // s_edit_mms_preview_state = MMIMMS_PREVIEW_STOP;
- //stop timer
- MMK_StopTimer(g_mmimms_preview_timer_id);
- g_mmimms_preview_timer_id = 0;
- break;
- case MSG_TIMER:
- if (g_mmimms_preview_timer_id == *((uint8 *) param))
- {
- switch(s_edit_mms_preview_state)
- {
- case MMIMMS_PREVIEW_LEAVE:
- SCI_ASSERT(FALSE);
- break;
- case MMIMMS_PREVIEW_PLAYING:
- //stop ring
- MmsStopPreviewRing();
- if (MMK_IsFocusWin(MMIMMS_EDIT_PREVIEW_WIN_ID))
- {
- //if it is the last slide, stop the timer
- if (Edit_isLastSlide(p_cur_edoc))
- {
- //stop the timer
- MMK_StopTimer(g_mmimms_preview_timer_id);
- g_mmimms_preview_timer_id = 0;
- s_edit_mms_preview_state = MMIMMS_PREVIEW_STOP;
- //set soft key to NULL
- // MMK_SetWinSoftkeyId(win_id, TXT_NULL, TXT_NULL, STXT_RETURN, TRUE);
- //change the state to stop
- // s_edit_mms_preview_state = MMIMMS_PREVIEW_STOP;
- }
- else
- {
- //go next slide
- MMS_NextSlide(p_cur_edoc);
- //display slide
- x_start = 0;
- y_start = 0;
- image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, FALSE,TRUE);
- //stop old timer
- MMK_StopTimer(g_mmimms_preview_timer_id);
- g_mmimms_preview_timer_id = 0;
- //create new timer
- duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
- g_mmimms_preview_timer_id = MMK_CreateWinTimer(win_id, duaration * ONE_KILO, FALSE);
- if (image_is_too_big)
- {
- PUBWIN_OpenPromptAlertWin(PUBWIN_SOFTKEY_ONE,TXT_DC_PICTOO_LARGE,IMAGE_PROMPT_ICON_ALERT,MMI_1SECONDS,PNULL);
- image_is_too_big = FALSE;
- }
- }
- }
- else
- {
- //stop the timer
- MMK_StopTimer(g_mmimms_preview_timer_id);
- g_mmimms_preview_timer_id = 0;
- //set soft key to NULL
- // MMK_SetWinSoftkeyId(win_id, TXT_MMS_PLAY, TXT_NULL, STXT_RETURN, TRUE);
- //change the state to stop
- s_edit_mms_preview_state = MMIMMS_PREVIEW_STOP;
- }
- break;
- case MMIMMS_PREVIEW_STOP:
- SCI_ASSERT(FALSE);
- break;
- default:
- SCI_ASSERT(FALSE);
- break;
- }
- MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
- }
- break;
- case MSG_SKB_ICON:
- button_index = (uint32) param;
- switch(button_index)
- {
- case MMI_SOFTKEYBAR_LEFT_ICON:
- Edit_PreviewLeftButtonCallBack();
- break;
- case MMI_SOFTKEYBAR_MIDDLE_ICON:
- Edit_PreviewPlayButtonCallBack();
- break;
- case MMI_SOFTKEYBAR_RIGHT_ICON:
- Edit_PreviewRightButtonCallBack();
- break;
- default:
- SCI_ASSERT(0);
- break;
- }
- break;
- case MSG_APP_WEB:
- #ifdef HAVE_MPEG4
- #ifdef WIN32
- case MSG_APP_GREEN:
- #endif
- if (p_cur_edoc->slide_cur->video_flag == 1)
- {
- T_Composer_Video composer_video;
- if (s_edit_mms_preview_state == MMIMMS_PREVIEW_PLAYING)
- {
- // MMK_SetWinSoftkeyId(win_id, TXT_MMS_PLAY, TXT_BROWSE, STXT_RETURN, TRUE);
- //stop old timer
- MMK_StopTimer(g_mmimms_preview_timer_id);
- g_mmimms_preview_timer_id = 0;
- }
- SCI_MEMSET(&composer_video,0,sizeof(T_Composer_Video));
- if (MMIMMS_GetCurSlideVideo(&composer_video,p_cur_edoc)!= -1)
- {
- MMIMPEG4_playFromBuffer(composer_video.VidBuf,composer_video.size,composer_video.Type);
- }
- }
- #endif
- break;
- case MSG_APP_OK:
- SCI_TRACE_LOW("FNH IN PREVIEW MMS MSG_APP_OK!");
- if (p_cur_edoc->slide_cur->video_flag == 1)
- {
- MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_APP_WEB, PNULL);
- }
- break;
- case MSG_CTL_OK:
- switch(s_edit_mms_preview_state)
- {
- case MMIMMS_PREVIEW_LEAVE:
- SCI_ASSERT(FALSE);
- break;
- case MMIMMS_PREVIEW_PLAYING:
- SCI_TRACE_LOW("fnh enter app_ok preview_playing");
- //stop ring
- MmsStopPreviewRing();//nihongf modify2005-12-19
- if (Edit_isLastSlide(p_cur_edoc))
- {
- SCI_TRACE_LOW("fnh enter app_ok preview_playing Edit_isLastSlide");
- //stop timer
- MMK_StopTimer(g_mmimms_preview_timer_id);
- g_mmimms_preview_timer_id = 0;
- //change state
- s_edit_mms_preview_state = MMIMMS_PREVIEW_STOP;
- }
- else
- {
- SCI_TRACE_LOW("fnh enter app_ok preview_playing not Edit_isLastSlide");
- MMK_StopTimer(g_mmimms_preview_timer_id);
- g_mmimms_preview_timer_id = 0;
- //change state to STOP
- s_edit_mms_preview_state = MMIMMS_PREVIEW_STOP;
- }
- break;
- case MMIMMS_PREVIEW_STOP:
- SCI_TRACE_LOW("fnh enter app_ok preview_STOP");
- //stop ring
- MmsStopPreviewRing();
- //if it is the last slide, ignore it
- if (Edit_isLastSlide(p_cur_edoc))
- {
- SCI_TRACE_LOW("fnh enter app_ok preview_STOP Edit_isLastSlide");
- x_start = 0;
- y_start = 0;
- image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, FALSE,TRUE);
- //modify softkey
- s_edit_mms_preview_state = MMIMMS_PREVIEW_PLAYING;
- }
- else
- {
- SCI_TRACE_LOW("fnh enter app_ok preview_STOP not Edit_isLastSlide");
- //start timer
- duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
- g_mmimms_preview_timer_id = MMK_CreateWinTimer(win_id, duaration * ONE_KILO, FALSE);
- //play next page
- x_start = 0;
- y_start = 0;
- image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, FALSE,TRUE);
- b_isFirst = TRUE;
- //modify softkey
- // MMK_SetWinSoftkeyId(win_id, TXT_MMS_STOP, TXT_NULL, STXT_RETURN, TRUE);
- //change state
- s_edit_mms_preview_state = MMIMMS_PREVIEW_PLAYING;
- }
- break;
- default:
- SCI_ASSERT(FALSE);
- break;
- }
- // MMK_SendMsg(MMIMMS_INBOX_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
- // err_code = MMI_RESULT_FALSE;
- break;
- case MSG_APP_CANCEL:
- switch(s_edit_mms_preview_state)
- {
- case MMIMMS_PREVIEW_LEAVE:
- SCI_ASSERT(FALSE);
- break;
- case MMIMMS_PREVIEW_PLAYING:
- //stop timer
- MMK_StopTimer(g_mmimms_preview_timer_id);
- g_mmimms_preview_timer_id = 0;
- //change state to leave
- s_edit_mms_preview_state = MMIMMS_PREVIEW_LEAVE;
- //close window
- MMK_CloseWin(win_id);
- break;
- case MMIMMS_PREVIEW_STOP:
- //change state to leave
- // MMK_StopTimer(timer_id);
- s_edit_mms_preview_state = MMIMMS_PREVIEW_LEAVE;
- //close window
- MMK_CloseWin(win_id);
- break;
- default:
- SCI_ASSERT(FALSE);
- break;
- }
- err_code = MMI_RESULT_FALSE;
- break;
- case MSG_APP_DOWN:
- SCI_TRACE_LOW("FNH PREVIEW MMS MSG_APP_DOWN");
- switch(s_edit_mms_preview_state)
- {
- SCI_TRACE_LOW("FNH s_edit_mms_preview_state = %d",s_edit_mms_preview_state);
- case MMIMMS_PREVIEW_LEAVE:
- SCI_ASSERT(FALSE);
- break;
- case MMIMMS_PREVIEW_PLAYING:
- case MMIMMS_PREVIEW_STOP:
- SCI_TRACE_LOW("FNH MSG_APP_DOWN,MMIMMS_PREVIEW_PLAYING");
- GUIANIMATE_GetImageInfo(anim_ctrl_id, &image_type, &image_width, &image_height);
- SCI_TRACE_LOW("FNH image_width = %d,image_height = %d",image_width,image_height);
- text_height = GUITEXTBOX_GetTotalHeight(editbox_ctrl_id);
- SCI_TRACE_LOW("FNH text_height = %d",text_height);
- if (y_start + image_height + text_height > (MMI_MAINSCREEN_BOTTOM_MAX_PIXEL - TITLE_HEIGHT - MMI_LIST_ITEM_HEIGHT - SK_HEIGH - MOVE_UP_DOWN_STEP))
- {
- //scroll screen
- SCI_TRACE_LOW("FNH scroll screen y_start = %d",y_start);
- x_start = 0;
- y_start -= MOVE_UP_DOWN_STEP;
- SCI_TRACE_LOW("FNH scroll screen y_start = %d",y_start);
- Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, FALSE, FALSE,FALSE);
- }
- break;
- default:
- SCI_ASSERT(FALSE);
- break;
- }
- err_code = MMI_RESULT_FALSE;
- break;
- case MSG_APP_UP:
- switch(s_edit_mms_preview_state)
- {
- case MMIMMS_PREVIEW_LEAVE:
- SCI_ASSERT(FALSE);
- break;
- case MMIMMS_PREVIEW_PLAYING:
- case MMIMMS_PREVIEW_STOP:
- //scroll screen
- x_start = 0;
- if (y_start < 0)
- {
- y_start += MOVE_UP_DOWN_STEP;
- Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, FALSE, FALSE,FALSE);
- }
- break;
- }
- err_code = MMI_RESULT_FALSE;
- break;
- case MSG_APP_LEFT:
- {
- uint16 slide_count = 0;
- slide_count =MMSGetSlideCount(g_peditdoc);
- if (slide_count == 1)
- break;
- }
- switch(s_edit_mms_preview_state)
- {
- case MMIMMS_PREVIEW_LEAVE:
- SCI_ASSERT(FALSE);
- break;
- case MMIMMS_PREVIEW_PLAYING:
- //ignore
- break;
- case MMIMMS_PREVIEW_STOP:
- if (MMS_PrevSlide(p_cur_edoc) == 1 )
- {
- x_start = 0;
- y_start = 0;
- MmsStopPreviewRing();
- image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, FALSE,TRUE);
- SCI_TRACE_LOW("FNH left image_is_too_big is %d",image_is_too_big);
- // MMK_SetWinSoftkeyId(win_id, TXT_MMS_PLAY, TXT_NULL, STXT_RETURN, TRUE);
- if (image_is_too_big)
- {
- PUBWIN_OpenPromptAlertWin(PUBWIN_SOFTKEY_ONE,TXT_DC_PICTOO_LARGE,IMAGE_PROMPT_ICON_ALERT,MMI_1SECONDS,PNULL);
- image_is_too_big = FALSE;
- }
- }
- break;
- default:
- SCI_ASSERT(FALSE);
- break;
- }
- break;
- case MSG_APP_RIGHT:
- {
- uint16 slide_count = 0;
- slide_count =MMSGetSlideCount(g_peditdoc);
- if (slide_count == 1)
- break;
- }
- switch(s_edit_mms_preview_state)
- {
- case MMIMMS_PREVIEW_LEAVE:
- SCI_ASSERT(FALSE);
- break;
- case MMIMMS_PREVIEW_PLAYING:
- SCI_TRACE_LOW("fnh enter preview_playing");
- //ignore
- break;
- case MMIMMS_PREVIEW_STOP:
- SCI_TRACE_LOW("fnh enter preview_stop");
- if (MMS_NextSlide(p_cur_edoc) == 1)
- {
- x_start = 0;
- y_start = 0;
- MmsStopPreviewRing();
- image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, FALSE,TRUE);
- SCI_TRACE_LOW("FNH right image_is_too_big is %d",image_is_too_big);
- // MMK_SetWinSoftkeyId(win_id, TXT_MMS_PLAY, TXT_NULL, STXT_RETURN, TRUE);
- if (image_is_too_big)
- {
- PUBWIN_OpenPromptAlertWin(PUBWIN_SOFTKEY_ONE,TXT_DC_PICTOO_LARGE,IMAGE_PROMPT_ICON_ALERT,MMI_1SECONDS,PNULL);
- image_is_too_big = FALSE;
- }
- }
- else
- {
- //last slide
- MMS_HeadSlide(p_cur_edoc);
- //then state changes to playing. this is its entrance
- s_edit_mms_preview_state = MMIMMS_PREVIEW_PLAYING;
- //play first slide
- x_start = 0;
- y_start = 0;
- //disable text scroll bar
- GUITEXTBOX_EnableScrollbar(editbox_ctrl_id, FALSE);
- SCI_TRACE_LOW("FNH IN PREVIEW MMS before play currentslide");
- image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, FALSE,TRUE);
- b_isFirst = TRUE;
- //start slide timer
- duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
- g_mmimms_preview_timer_id = MMK_CreateWinTimer(win_id, duaration * ONE_KILO, FALSE);
- }
- break;
- default:
- SCI_ASSERT(FALSE);
- break;
- }
- break;
- case MSG_CTL_CANCEL:
- // MMK_CloseWin(MMIMMS_EDIT_WIN_ID);
- break;
- case MSG_CLOSE_WINDOW:
- //if (MMK_IsTimerActive(g_mmimms_preview_timer_id))
- if (play_or_preview == MMS_PLAY)
- {
- if (p_cur_edoc)
- {
- if(p_cur_edoc == g_peditdoc)
- {
- MMSDelDocument(g_peditdoc);
- SCI_TRACE_LOW("FNH after free g_peditdoc MMS!");
- g_peditdoc = NULL;
- p_cur_edoc = NULL;
- }
- else if(p_cur_edoc == g_pcur_signdoc)
- {
- MMSDelDocument(g_pcur_signdoc);
- SCI_TRACE_LOW("FNH after free g_pcur_signdoc MMS!");
- g_pcur_signdoc = NULL;
- p_cur_edoc = NULL;
- }
- }
- }
- play_or_preview = MMS_PREVIEW; //设回初始值
- if(0 != g_mmimms_preview_timer_id)
- {
- MMK_StopTimer(g_mmimms_preview_timer_id);
- g_mmimms_preview_timer_id = 0;
- }
- //if ring is playing stop it
- MmsStopPreviewRing();
- SCI_TRACE_LOW("FNH in close window before stop ring");
- MMIPROFILE_StopRing(RING_STA_OTHER);
- SCI_TRACE_LOW("FNH after stop ring");
- //change state to leave
- s_edit_mms_preview_state = MMIMMS_PREVIEW_LEAVE;
- break;
- default:
- err_code = MMI_RESULT_FALSE;
- break;
- }
- return err_code;
- }
- /******************************************************************************
- * 函数定义: Preview_PlayCurrentSlide
- * 函数说明: 显示当前祯
- * 参数说明: x_start:起点X坐标
- y_start:起点Y坐标
- win_id:窗口ID
- anim_ctrl_Id:图形控件ID
- textbox_ctrl_id:文本控件ID
- is_new_slide:是否第一次显示
- * 返回值: 空
- ********************************************************************************/
- LOCAL BOOLEAN Preview_PlayCurrentSlide(pMMS_EDocument p_cur_edoc,
- int x_start,
- int y_start,
- MMS_WINDOW_ID_E win_id,
- MMS_CONTROL_ID_E anim_ctrl_id,
- MMS_CONTROL_ID_E textbox_ctrl_id,
- BOOLEAN is_new_slide,
- BOOLEAN is_beginning,
- BOOLEAN is_update
- )
- {
- T_Composer_Text composer_text;
- MMI_STRING_T content_string;
- T_Composer_Image composer_image;
- ANIMATE_IMAGE_TYPE_E anim_type = 0;
- uint32 duaration = 0;
- GUI_RECT_T image_display_rect;
- T_Composer_Audio composer_audo;
- MMIAUDIO_TYPE_E audio_type = MMIAUDIO_TYPE_MAX;
- MMIPROFILE_RING_VOL_E audio_vol = 0;
- ANIMATE_IMAGE_TYPE_E image_type = 0;
- uint16 image_width = 0;
- uint16 image_height = 0;
- GUI_RECT_T image_rect;
- GUI_RECT_T text_rect;
- GUI_RETURN_E set_text_rect_ret;
- uint16 line_num = 0;
- const uint8 * mmsinsertpic_ptr = NULL;
- BOOLEAN returnval = FALSE;
- SCI_TRACE_LOW("FNH playcurrentslide Y_start = %d",y_start);
- if (is_beginning)
- {
- MMITHEME_SetUpdateDelayCount(1);
- }
- //clear screen
- MMIMMS_CLEAR_CLIENT();
- //1. set image
- //set image rect, need not
- image_rect.left = 0;
- // image_rect.top = y_start + TITLE_HEIGHT;
- image_rect.top = y_start + MMI_TITLE_HEIGHT + MMI_LIST_ITEM_HEIGHT;
- image_rect.right = image_rect.left;
- image_rect.bottom = image_rect.top;
- SCI_TRACE_LOW("FNH image_rect.left = %d,image_rect.top = %d,image_rect.right = %d,image_rect.bottom = %d",image_rect.left,image_rect.top,image_rect.right,image_rect.bottom);
- //if image exist
- if (p_cur_edoc->slide_cur->image_flag == 1)
- {
- //set Image Display Rect
- SCI_MEMSET(&composer_image, 0, sizeof(composer_image));
- SCI_TRACE_LOW("FNH p_cur_edoc->slide_cur->image_flag = %d",p_cur_edoc->slide_cur->image_flag);
- image_display_rect.left = 0;
- image_display_rect.right = MMI_MAINSCREEN_RIGHT_MAX_PIXEL;
- // image_display_rect.top = TITLE_HEIGHT;
- image_display_rect.top = MMI_TITLE_HEIGHT + MMI_LIST_ITEM_HEIGHT;
- image_display_rect.bottom = MMI_CLIENT_RECT_BOTTOM;
- SCI_TRACE_LOW("FNH image_display_rect.top = %d,image_display_rect.bottom = %d",image_display_rect.top,image_display_rect.bottom );
- //get image data
- if (MMIMMS_GetCurSlideImage(&composer_image,p_cur_edoc)!= -1)
- {
- //set ani_ctrol data
- //get image type
- anim_type = Edit_GetAniType(composer_image.Type);
- SCI_TRACE_LOW("FNH anim_type = %d",anim_type);
- SCI_TRACE_LOW("FNH composer_image.Size = %d",composer_image.size);
- //get duaration
- duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
- if (is_new_slide)
- {
- //set anim param position and buf
- SCI_TRACE_LOW("FNH composer_image.Size = %d",composer_image.size);
- if (anim_type == ANIM_NONE ||
- GUIANIMATE_PMI_DECODE_EID_NONE != GUIANIMATE_SetAnimDataExt(
- anim_ctrl_id,
- image_rect.left,
- image_rect.top,
- &image_display_rect,
- composer_image.ImgBuf,
- anim_type,
- composer_image.size,
- 0,//duaration * ONE_KILO,
- TRUE,
- FALSE
- )
- )
- {
- if (is_update)
- {
- returnval = TRUE;
- }
- mmsinsertpic_ptr = MMI_GetLabelAnim(IMAGE_MMS_IMAGE_BIG_ANIM);
- SCI_TRACE_LOW("FNH mmsinsertpic_ptr = %d",mmsinsertpic_ptr);
- GUIANIMATE_SetAnimData(
- anim_ctrl_id,
- image_rect.left,
- image_rect.top,
- mmsinsertpic_ptr,
- ANIM_ANIM,
- 0,
- 500,
- FALSE//TRUE
- );
- SCI_TRACE_LOW("FNH after SetAnimData image_rect.left = %d,image_rect.top = %d,image_rect.right = %d,image_rect.bottom = %d",image_rect.left,image_rect.top,image_rect.right,image_rect.bottom);
- }
- //only adjust position
- GUIANIMATE_GetImageInfo(
- anim_ctrl_id,
- &image_type,
- &image_width,
- &image_height
- );
- SCI_TRACE_LOW("FNH after GetImageInfo image_width =%d,image_height = %d",image_width,image_height);
- image_rect.left = (image_display_rect.right - image_display_rect.left - image_width) / 2 + image_display_rect.left; //middle
- SCI_TRACE_LOW("FNH image_rect.left = %d",image_rect.left);
- if (p_cur_edoc->slide_cur->text_flag == 1)
- {
- //do nothing
- }
- else
- {
- //let the picture be in middle
- if (image_type != ANIM_GIF) //because GIF cann't be resized
- {
- image_rect.top = (image_display_rect.bottom - image_display_rect.top - image_height) / 2 + image_display_rect.top;//
- }
- }
- GUIANIMATE_SetPos(
- anim_ctrl_id,
- image_rect.left,
- image_rect.top,
- !is_beginning//FALSE//TRUE //GUI_Animate will update it in MSG_CTRL_PAINT
- );
- SCI_TRACE_LOW("FNH after SetPos image_rect.left = %d,image_rect.top=%d",image_rect.left,image_rect.top);
- }
- else
- {
- //only adjust position
- GUIANIMATE_GetImageInfo(
- anim_ctrl_id,
- &image_type,
- &image_width,
- &image_height
- );
- SCI_TRACE_LOW("FNH not new slide after GetImageInfo image_width = %d,image_height = %d",image_width,image_height);
- image_rect.left = (image_display_rect.right - image_display_rect.left - image_width) / 2 + image_display_rect.left; //middle
- SCI_TRACE_LOW("FNH image_rect.left = %d",image_rect.left);
- if (p_cur_edoc->slide_cur->text_flag == 1)
- {
- //do nothing
- }
- else
- {
- //let the picture be in middle
- if (image_type != ANIM_GIF) //because GIF cann't be resized
- {
- image_rect.top = (image_display_rect.bottom - image_display_rect.top - image_height) / 2 + image_display_rect.top;//
- SCI_TRACE_LOW("FNH image type is not gif image_rect.top = %d",image_rect.top);
- }
- }
- GUIANIMATE_SetPos(
- anim_ctrl_id,
- image_rect.left,
- image_rect.top,
- TRUE
- );
- SCI_TRACE_LOW("FNH image_rect.left = %d,image_rect.top = %d",image_rect.left,image_rect.top);
- }
- image_width = 0;
- image_height = 0;
- GUIANIMATE_GetImageInfo(
- anim_ctrl_id,
- &image_type,
- &image_width,
- &image_height
- );
- SCI_TRACE_LOW("FNH image_width = %d,image_height = %d",image_width,image_height);
- }
- }
- #ifdef HAVE_MPEG4
- else if (p_cur_edoc->slide_cur->video_flag == 1)
- {
- SCI_TRACE_LOW("FNH ENTER video_flag is true");
- image_display_rect.left = 0;
- image_display_rect.right = MMI_MAINSCREEN_RIGHT_MAX_PIXEL;
- // image_display_rect.top = TITLE_HEIGHT;
- image_display_rect.top = MMI_TITLE_HEIGHT + MMI_LIST_ITEM_HEIGHT;
- image_display_rect.bottom = MMI_CLIENT_RECT_BOTTOM;
- duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
- if (is_new_slide)
- {
- SCI_TRACE_LOW("FNH before getlabelanim");
- mmsinsertpic_ptr = MMI_GetLabelAnim(IMAGE_MMS_HAVEDV_ANIM);
- SCI_TRACE_LOW("FNH mmsinsertpic_ptr = %d",mmsinsertpic_ptr);
- GUIANIMATE_SetAnimData(
- anim_ctrl_id,
- image_rect.left,
- image_rect.top,
- mmsinsertpic_ptr,
- ANIM_ANIM,
- 0,
- 500,
- FALSE//TRUE
- );
- SCI_TRACE_LOW("FNH after SetAnimData image_rect.left = %d,image_rect.top = %d,image_rect.right = %d,image_rect.bottom = %d",image_rect.left,image_rect.top,image_rect.right,image_rect.bottom);
- }
- //only adjust position
- GUIANIMATE_GetImageInfo(
- anim_ctrl_id,
- &image_type,
- &image_width,
- &image_height
- );
- SCI_TRACE_LOW("FNH after GetImageInfo image_width =%d,image_height = %d",image_width,image_height);
- image_rect.left = (image_display_rect.right - image_display_rect.left - image_width) / 2 + image_display_rect.left; //middle
- SCI_TRACE_LOW("FNH image_rect.left = %d",image_rect.left);
- GUIANIMATE_SetPos(
- anim_ctrl_id,
- image_rect.left,
- image_rect.top,
- !is_beginning//FALSE//TRUE //GUI_Animate will update it in MSG_CTRL_PAINT
- );
- SCI_TRACE_LOW("FNH after SetPos image_rect.left = %d,image_rect.top=%d",image_rect.left,image_rect.top);
- image_width = 0;
- image_height = 0;
- GUIANIMATE_GetImageInfo(
- anim_ctrl_id,
- &image_type,
- &image_width,
- &image_height
- );
- SCI_TRACE_LOW("FNH image_width = %d,image_height = %d",image_width,image_height);
- }
- #endif
- else
- {
- //set anim param position and buf
- GUIANIMATE_SetAnimData(
- anim_ctrl_id,
- image_rect.left,
- image_rect.top,
- PNULL,
- ANIM_NONE,
- 0,
- 0,
- TRUE
- );
- image_width = 0;
- image_height = 0;
- GUIANIMATE_GetImageInfo(
- anim_ctrl_id,
- &image_type,
- &image_width,
- &image_height
- );
- }
- image_rect.right = image_rect.left + image_width;
- image_rect.bottom = image_rect.top + image_height;
- SCI_TRACE_LOW("FNH before text image_rect.right = %d,image_rect.bottom = %d",image_rect.right,image_rect.bottom);
- //2. set text
- //set text rect
- text_rect.left = 0;
- text_rect.right = MMI_MAINSCREEN_RIGHT_MAX_PIXEL;
- if (image_rect.bottom >= MMI_MAINSCREEN_BOTTOM_MAX_PIXEL - SK_HEIGH)
- {
- SCI_TRACE_LOW("FNH IMAGE IS TOO BIG,THE TEXT IS IN LOW!");
- //if it is too low
- text_rect.top = MMI_MAINSCREEN_BOTTOM_MAX_PIXEL - SK_HEIGH;
- text_rect.bottom = text_rect.top;
- }
- else
- {
- text_rect.top = image_rect.bottom + ((MATH_ABS(image_rect.bottom - TITLE_HEIGHT - MMI_LIST_ITEM_HEIGHT)) % MOVE_UP_DOWN_STEP);
- SCI_TRACE_LOW("FNH before line_num text_rect.top = %d",text_rect.top);
- line_num = (TITLE_HEIGHT + MMI_LIST_ITEM_HEIGHT - text_rect.top) / MOVE_UP_DOWN_STEP;
- SCI_TRACE_LOW("FNH line_num = %d",line_num);
- text_rect.top = MAX(TITLE_HEIGHT + MMI_LIST_ITEM_HEIGHT, text_rect.top);//bruce
- SCI_TRACE_LOW("FNH THE text_rect.top = %d",text_rect.top);
- if (text_rect.top >= MMI_MAINSCREEN_BOTTOM_MAX_PIXEL - SK_HEIGH)
- {
- text_rect.top = MMI_MAINSCREEN_BOTTOM_MAX_PIXEL - SK_HEIGH;
- text_rect.bottom = text_rect.top;
- SCI_TRACE_LOW("FNH is in low text_rect.bottom = %d",text_rect.bottom);
- }
- else
- {
- text_rect.bottom = MMI_MAINSCREEN_BOTTOM_MAX_PIXEL - SK_HEIGH;
- SCI_TRACE_LOW("FNH text_rect.bottom = %d",text_rect.bottom);
- }
- }
- set_text_rect_ret = GUITEXTBOX_SetPos(
- textbox_ctrl_id,
- text_rect,
- !is_beginning
- );
- SCI_TRACE_LOW("FNH arter textsetpos text_rect.left = %d,text_rect.top = %d,text_rect.right = %d,text_rect.bottom = %d",text_rect.left,text_rect.top,text_rect.right,text_rect.bottom);
- if (GUI_RET_SUCCESS != set_text_rect_ret)
- {
- // SCI_ASSERT(FALSE);
- }
- //get current slide text
- //if text exist
- if (p_cur_edoc->slide_cur->text_flag == 1)
- {
- //get the text
- SCI_MEMSET(&composer_text, 0, sizeof(composer_text));
- if ( MMIMMS_GetCurText(&composer_text,p_cur_edoc)!= -1)
- {
- SCI_TRACE_LOW("mmimms:Preview_PlayCurSlide, text_size=%d", composer_text.size);
- SCI_TRACE_BUF("mmimms:Preview_PlayCurSlide, text_buf", composer_text.TxtBuf, 10);
- //fnh add 1018 begin
- content_string.is_ucs2 = 1;
- content_string.str_ptr = composer_text.TxtBuf;
- content_string.length = composer_text.size ;
- SCI_TRACE_LOW("FNH get composer_text.size = %d",composer_text.size);
- SCI_TRACE_LOW("FNH get text len = %d",content_string.length);
- SCI_TRACE_LOW("FNH get content_string.str_ptr = %x",content_string.str_ptr);
- //fnh add 1018 end
- GUITEXTBOX_SetText(textbox_ctrl_id, &content_string, !is_beginning);
- GUITEXTBOX_SetDisplayFirstLine(textbox_ctrl_id, line_num, TRUE);
- }
- }
- else
- {
- GUITEXTBOX_SetText(textbox_ctrl_id, PNULL, !is_beginning);
- }
- //display slide number
- if (win_id == MMIMMS_EDIT_PREVIEW_WIN_ID)
- {
- Preview_DispSlideNum(MMIMMS_EDIT_PREVIEW_LABEL_CTRL_ID,p_cur_edoc);
- }
- else if (win_id == MMIMMS_INBOX_PREVIEW_WIN_ID)
- {
- Preview_DispSlideNum(MMIMMS_MAILBOX_PREVIEW_LABEL_CTRL_ID,p_cur_edoc);
- }
- else if (win_id == MMIMMS_EDIT_DISPLAY_WIN_ID)
- {
- Preview_DispSlideNum(MMIMMS_EDIT_PREVIEW_LABEL_CTRL_ID,p_cur_edoc);
- }
- SCI_TRACE_LOW("FNH is_new_slide = %d",is_new_slide);
- SCI_TRACE_LOW("FNH p_cur_edoc->slide_cur->audio_type = %d",p_cur_edoc->slide_cur->audio_type);
- if (g_nv_setting_mirror.play_sound == 1)
- {
- //3.play sound
- if (is_new_slide)
- {
- if (p_cur_edoc->slide_cur->audio_type)
- {
- //call audio interface.
- SCI_MEMSET(&composer_audo, 0, sizeof(composer_audo));
- MMIMMS_GetCurSlideAudio(&composer_audo,p_cur_edoc);
- //play ring
- audio_type = Edit_GetLowLayerAudioType(composer_audo.Type);
- if ((audio_type != MMIAUDIO_TYPE_MAX)&&(audio_type != MMIAUDIO_AMR))
- {
- MMIPROFILE_PARA_T cur_profile_para = {0,};
- MMIPROFILE_GetCurrentProfileModeInfo(&cur_profile_para);
- audio_vol = MMISET_VOL_THREE;
- if (MMIPROFILE_IsPermitPlayRingOrVib(RING_STA_OTHER))
- {
- s_mms_is_preview_ring = TRUE;//是否在预览彩信中的铃声
- //暂停mp3播放
- if(MMIMP3_IsMp3PlayingAsBg())
- {
- MMIMP3_SuspendMp3(TRUE);
- }
- MMIPROFILE_PlayRingByPtr(
- audio_vol,
- (uint8 *)composer_audo.AudBuf,
- (uint32)composer_audo.size,
- 1,
- (AUD_RING_TYPE_E)audio_type,
- &MmsRingCallBack
- );
- }
- }
- else
- {
- //make no alert. or it will trap in dead circle(ALERT->LOSE_FOCUS->GET->Play from beginning->ALERT->LOSE_FOCUS....)
- //stop ring
- SCI_TRACE_LOW("FNH before MmsStopPreviewRing1");
- MmsStopPreviewRing();
- }
- }
- else
- {
- SCI_TRACE_LOW("FNH before MmsStopPreviewRing2");
- MmsStopPreviewRing();
- }
- }
- else
- {
- SCI_TRACE_LOW("FNH should do nothing");
- //should do nothing.
- }
- }
- return returnval;
- // SCI_TRACE_LOW("mmimms:Preview_PlayCurrentSlide, ticks=%d", ticks);
- }
- /*****************************************************************************/
- // Description : to continue play mp3
- // Global resource dependence :
- // Author:Jassmine.Meng
- // Note:
- /*****************************************************************************/
- LOCAL void MmsRingCallBack(void)
- {
- return ;
- }
- /* ----------------------------------------------------------------------------
- * Function Name: MmsStopPreviewRing
- * Purpose: 停止预览彩信铃声
- * Input: void
- * Returns: void
- * Author:nihongf@mobilesoft.com.cn
- * ----------------------------------------------------------------------------*/
- LOCAL void MmsStopPreviewRing(void)
- {
- SCI_TRACE_LOW("fnh enter mmsstoppreviewring!");
- SCI_TRACE_LOW("fnh s_Mms_is_preview_ring = %d",s_mms_is_preview_ring);
- if (s_mms_is_preview_ring)//在预览彩信中的铃声
- {
- SCI_TRACE_LOW("fnh before MMISET_StopRing!");
- // MMISET_StopRing(MMISET_RING_TYPE_OTHER);
- MMIPROFILE_StopRing(RING_STA_OTHER);
- s_mms_is_preview_ring = FALSE;
- }
- }
- /*****************************************************************************/
- // Description : display "current_slide_index/total_slide_num"
- // Global resource dependence :
- // Author:Bruce.Chi
- // Note:
- /*****************************************************************************/
- LOCAL void Preview_DispSlideNum(MMS_CONTROL_ID_E label_ctrl_id,pMMS_EDocument p_cur_edoc)
- {
- uint32 total_slide = 0;
- uint32 cur_slide = 0;
- GUI_RECT_T disp_rect = {0};
- uint16 piexl_num = 0;
- uint16 font_height = 0;
- uint16 display_str_len = 0;
- uint8 display_str[16] = {0};
- MMI_STRING_T str = {0};
- //calculate string
- cur_slide = MMSGetSlideIndex(p_cur_edoc);
- total_slide = MMSGetSlideCount(p_cur_edoc);
- SCI_MEMSET((void*)display_str, 0, sizeof(display_str));
- sprintf((char *)display_str,
- "%d/%d", //N/M, N==current slide, M==total slide number
- cur_slide ,
- total_slide
- );
- display_str_len = strlen((char *)display_str);
- SCI_ASSERT(display_str_len < 16);
- str.str_ptr = display_str;
- str.length = display_str_len;
- str.is_ucs2 = FALSE;
- GUILABEL_SetText(label_ctrl_id, &str, TRUE);
- }
- /* ----------------------------------------------------------------------------
- * Function Name: CmsDelContent
- * Purpose: 删除彩信结构中对应类型的内容(目前仅用来删除文本内容)
- * Input: editor_doc: 彩信结构地址 slide: 所在页地址 del_type: 待删除内容的类
- * Output: None.
- * Returns: None.
- * Notes: Copyright(C) 2005 MobileSoft Technology (NanJing) Co.,LTD.
- * ----------------------------------------------------------------------------*/
- void CmsDelContent(pMMS_EDocument editor_doc, pMMS_Slide slide, uint16 del_type)
- {
- pMMS_Content content = NULL;
- content = slide->content_root;
- while(content)
- {
- if(content->type == del_type)
- {
- slide->content_cur = content;
- MMS_DelContent(slide,editor_doc);
- return;
- }
- content = content->next;
- }
- }
- /* ----------------------------------------------------------------------------
- * Function Name: Cms_string_Uni16_strlen
- * Purpose:编码为UTF16的U8字串的实际字数
- * Input: None
- * Output: None.
- * Returns:
- * Notes: Copyright(C) 2005 MobileSoft Technology (NanJing) Co.,LTD.
- * ----------------------------------------------------------------------------*/
- uint32 Cms_string_Uni16_strlen(uint8* string)
- {
- uint32 leng = 0,i=0;
- while(*(string+i)!=0 || *(string+i+1)!=0)
- {
- leng++;
- i+=2;
- }
- return leng;
- }
- /* ----------------------------------------------------------------------------
- * Function Name: Cms_string_Uni16_Uni8_strlen
- * Purpose:得到16位U8字符串转换为UTF8字符串的长度
- * Input: None
- * Output: None.
- * Returns:
- * Notes: Copyright(C) 2005 MobileSoft Technology (NanJing) Co.,LTD.
- * ----------------------------------------------------------------------------*/
- uint32 Cms_string_Uni16_Uni8_strlen(uint8* string)
- {
- uint32 leng = 0,i=0;
- uint16 temp_str = 0;
- if(string == NULL)
- {
- return 0;
- }
- while(*(string+i)!=0 || *(string+i+1)!=0)
- {
- temp_str = (uint16)((*(string+i))*256 + *(string+i+1));
- if(temp_str>0 && temp_str<=0x7F)
- leng++;
- else if(temp_str>=0x80 && temp_str<=0x7FF)
- leng+=2;
- else if(temp_str>=0x800 && temp_str<=0xFFFF)
- leng+=3;
- i+=2;
- }
- return leng;
- }
- /*****************************************************************************/
- // Description : 5.1.13 Edit: set slide time window message handler
- // Global resource dependence :
- // Author:Bruce.Chi
- // Note:
- /*****************************************************************************/
- LOCAL MMI_RESULT_E Edit_HandleSetSlideTimeWinMsg(
- MMS_WINDOW_ID_E win_id,
- MMI_MESSAGE_ID_E msg_id,
- DPARAM param
- )
- {
- MMI_RESULT_E err_code = MMI_RESULT_TRUE;
- STRING_INFO_T edit_string;
- MMS_CONTROL_ID_E digital_edit_ctrl_id = MMIMMS_EDIT_SLIDE_TIME_CTRL_ID;
- T_WORD duaration = 0;
- uint8 duar_buf[16] = {0};
- switch(msg_id)
- {
- case MSG_FULL_PAINT:
- MMIMMS_CLEAR_CLIENT();
- break;
- case MSG_OPEN_WINDOW:
- MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
- duaration = MMIMMS_GetCurSlideDuration(g_peditdoc);
- if (duaration > MMIMMS_SLIDE_DUARATION_MAX)
- {
- duaration = MMIMMS_SLIDE_DUARATION_MAX;
- }
- if (duaration < MMIMMS_SLIDE_DUARATION_MIN)
- {
- duaration = MMIMMS_SLIDE_DUARATION_MIN;
- }
- if (duaration != 0)
- {
- //edit current duaration setting
- SCI_MEMSET(duar_buf, 0, sizeof(duar_buf));
- sprintf((char *)duar_buf, "%d", duaration);
- SCI_ASSERT(strlen((char *)duar_buf) < sizeof(duar_buf));
- GUIEDITBOX_SetDigitalEditBoxStringInfo(
- digital_edit_ctrl_id,
- duar_buf,
- strlen((char *)duar_buf)
- );
- }
- MMK_SetAtvCtrl(win_id, digital_edit_ctrl_id);
- break;
- case MSG_CTL_OK:
- case MSG_APP_OK:
- // to get the content which the user input
- SCI_MEMSET( (void *)&edit_string, 0, sizeof(edit_string) );
- GUIEDITBOX_GetDigitalEditBoxInfo(digital_edit_ctrl_id, &edit_string);
- MMI_MEMCPY(duar_buf, 8, edit_string.str_ptr, edit_string.str_len, edit_string.str_len);
- duaration = atoi((char *)(duar_buf));
- //check
- if (edit_string.str_len == 0 || duaration > MMIMMS_SLIDE_DUARATION_MAX || duaration < MMIMMS_SLIDE_DUARATION_MIN)
- {
- //Alert : invalidate input
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_INVALID_INPUT,
- IMAGE_PROMPT_ICON_WRONG,
- ALERT_TIMEOUT,
- PNULL
- );
- }
- else
- {
- //save
- MMIMMS_SetCurSlideDuration(duaration);
- MMK_CloseWin(MMIMMS_EDIT_SLIDE_TIME_WIN_ID);
- }
- break;
- case MSG_GET_FOCUS:
- MMK_SetAtvCtrl(win_id, digital_edit_ctrl_id);
- break;
- case MSG_CTL_CANCEL:
- case MSG_APP_CANCEL:
- // close the edit window
- MMK_CloseWin(MMIMMS_EDIT_SLIDE_TIME_WIN_ID);
- break;
- default:
- err_code = MMI_RESULT_FALSE;
- break;
- }
- return err_code;
- }
- /*****************************************************************************/
- // Description :5.1.2.1 GroupSend : to list window message handler
- // Global resource dependence :
- // Author:Bruce.Chi
- // Note:
- /*****************************************************************************/
- #define MMIMMS_GSEND_LIST_HEAD 0 //<INPUT> ,<PB> //fnh add
- #define MMIMMS_GSEND_LIST_MAX_ITEM (MMIMMS_MAX_ADDRESS_NUM + MMIMMS_GSEND_LIST_HEAD)
- //totoal address + 3
- int32 MmsGetReceiverCount(p_MMS_RECEPIENT p_receiver)
- {
- int32 number = 0;
- p_MMS_RECEPIENT p_temp = NULL;
- if(p_receiver == NULL)
- {
- return 0;
- }
- for(p_temp=p_receiver; p_temp; p_temp=p_temp->p_next)
- {
- number++;
- }
- return number;
- }
- /*****************************************************************************/
- // Description :
- // Global resource dependence :
- // Author:
- // Note:
- /*****************************************************************************/
- BOOLEAN Space_FormInBox(
- MMI_STRING_T *str_dst //out.
- )
- {
- char* label_str2_ptr = PNULL;
- uint32 label_str2_len = 0;
- MMI_STRING_T label_string2;
- //fill label_string2 with "from"
- label_str2_len = 64;
- label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
- SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
- sprintf(label_str2_ptr,
- ":%ldr",(g_pManager->inboxfolder->messagenumber - g_pManager->inboxfolder->unsettlednumber));
- // strcat(label_str2_ptr,"r");
- label_string2.is_ucs2 = FALSE;
- label_string2.str_ptr = (uint8 *)label_str2_ptr;
- label_string2.length = strlen(label_str2_ptr);
- // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
- CatStringByTextID(str_dst,TXT_MMS_INBOX , &label_string2);
- if(label_str2_ptr != PNULL)
- {
- cms_free(label_str2_ptr);
- label_str2_ptr = PNULL;
- }
- return TRUE;
- }
- /*****************************************************************************/
- // Description :
- // Global resource dependence :
- // Author:
- // Note:
- /*****************************************************************************/
- BOOLEAN Space_FormOutBox(
- MMI_STRING_T *str_dst //out.
- )
- {
- char* label_str2_ptr = PNULL;
- uint32 label_str2_len = 0;
- MMI_STRING_T label_string2;
- //fill label_string2 with "from"
- label_str2_len = 64;
- label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
- SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
- sprintf(label_str2_ptr,
- ":%ldr",g_pManager->outboxfolder->messagenumber);
- // strcat(label_str2_ptr,"r");
- label_string2.is_ucs2 = FALSE;
- label_string2.str_ptr = (uint8 *)label_str2_ptr;
- label_string2.length = strlen(label_str2_ptr);
- // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
- CatStringByTextID(str_dst,TXT_MMS_OUTBOX , &label_string2);
- if(label_str2_ptr != PNULL)
- {
- cms_free(label_str2_ptr);
- label_str2_ptr = PNULL;
- }
- return TRUE;
- }
- /*****************************************************************************/
- // Description :
- // Global resource dependence :
- // Author:
- // Note:
- /*****************************************************************************/
- BOOLEAN Space_FormSentBox(
- MMI_STRING_T *str_dst //out.
- )
- {
- char* label_str2_ptr = PNULL;
- uint32 label_str2_len = 0;
- MMI_STRING_T label_string2;
- //fill label_string2 with "from"
- label_str2_len = 64;
- label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
- SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
- sprintf(label_str2_ptr,
- ":%ldr",g_pManager->sentfolder->messagenumber);
- // strcat(label_str2_ptr,"r");
- label_string2.is_ucs2 = FALSE;
- label_string2.str_ptr = (uint8 *)label_str2_ptr;
- label_string2.length = strlen(label_str2_ptr);
- // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
- CatStringByTextID(str_dst,TXT_MMS_SENTBOX , &label_string2);
- if(label_str2_ptr != PNULL)
- {
- cms_free(label_str2_ptr);
- label_str2_ptr = PNULL;
- }
- return TRUE;
- }
- /*****************************************************************************/
- // Description :
- // Global resource dependence :
- // Author:
- // Note:
- /*****************************************************************************/
- BOOLEAN Space_FormDraftBox(
- MMI_STRING_T *str_dst //out.
- )
- {
- char* label_str2_ptr = PNULL;
- uint32 label_str2_len = 0;
- MMI_STRING_T label_string2;
- //fill label_string2 with "from"
- label_str2_len = 64;
- label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
- SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
- sprintf(label_str2_ptr,
- ":%ldr",g_pManager->draftfolder->messagenumber);
- // strcat(label_str2_ptr,"r");
- label_string2.is_ucs2 = FALSE;
- label_string2.str_ptr = (uint8 *)label_str2_ptr;
- label_string2.length = strlen(label_str2_ptr);
- // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
- CatStringByTextID(str_dst,TXT_MMS_DRAFTBOX , &label_string2);
- if(label_str2_ptr != PNULL)
- {
- cms_free(label_str2_ptr);
- label_str2_ptr = PNULL;
- }
- return TRUE;
- }
- /*****************************************************************************/
- // Description :
- // Global resource dependence :
- // Author:
- // Note:
- /*****************************************************************************/
- BOOLEAN Space_FormTotal(
- MMI_STRING_T *str_dst //out.
- )
- {
- char* label_str2_ptr = PNULL;
- uint32 label_str2_len = 0;
- MMI_STRING_T label_string2;
- uint32 totalnum ;
- if(g_pManager != NULL)
- {
- totalnum = (g_pManager->inboxfolder->messagenumber - g_pManager->inboxfolder->unsettlednumber)+ g_pManager->outboxfolder->messagenumber +g_pManager->sentfolder->messagenumber + g_pManager->draftfolder->messagenumber;
- }
- else
- {
- totalnum = 0;
- }
- //fill label_string2 with "from"
- label_str2_len = 64;
- label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
- SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
- sprintf(label_str2_ptr,
- ":%ld/%dr",totalnum,100);
- // strcat(label_str2_ptr,"r");
- label_string2.is_ucs2 = FALSE;
- label_string2.str_ptr = (uint8 *)label_str2_ptr;
- label_string2.length = strlen(label_str2_ptr);
- // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
- CatStringByTextID(str_dst,TXT_MMS_MMSSPACE_TOTAL , &label_string2);
- if(label_str2_ptr != PNULL)
- {
- cms_free(label_str2_ptr);
- label_str2_ptr = PNULL;
- }
- return TRUE;
- }
- /*****************************************************************************/
- // Description :
- // Global resource dependence :
- // Author:
- // Note:
- /*****************************************************************************/
- BOOLEAN Space_FormSize(MMI_STRING_T *str_dst)
- {
- char* label_str2_ptr = PNULL;
- uint32 label_str2_len = 0;
- MMI_STRING_T label_string2;
- uint32 mms_total_size = 0;
- uint32 mms_inbox_size = 0;
- uint32 mms_outbox_size = 0;
- uint32 mms_sentbox_size = 0;
- uint32 mms_draftbox_size = 0;
- label_str2_len = 64;
- label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
- SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
- mms_inbox_size = MMIMMS_GetMailboxMsgSize(MMIMESSAGE_INBOX);
- mms_sentbox_size = MMIMMS_GetMailboxMsgSize(MMIMESSAGE_SENTBOX);
- mms_outbox_size = MMIMMS_GetMailboxMsgSize(MMIMESSAGE_OUTBOX);
- mms_draftbox_size = MMIMMS_GetMailboxMsgSize(MMIMESSAGE_DRAFTBOX);
- SCI_TRACE_LOW("fnh box size = %d,%d,%d,%d",mms_inbox_size,mms_sentbox_size,mms_outbox_size,mms_draftbox_size);
- mms_total_size = mms_inbox_size+
- mms_sentbox_size+
- mms_outbox_size+
- mms_draftbox_size;
- mms_total_size = MIN(mms_total_size, MMIMMS_MAX_TOTAL_MMS_SIZE); //if exceed, cut.
- sprintf(label_str2_ptr,":%dkr",(int)((mms_total_size + ONE_K_LEN - 1) / ONE_K_LEN));
- label_string2.is_ucs2 = FALSE;
- label_string2.length = strlen((char *)label_str2_ptr);
- SCI_ASSERT(label_string2.length < 64);
- label_string2.str_ptr = (uint8 *)label_str2_ptr;
- if (!CatStringByTextID(str_dst, TXT_MMS_CONTENT, &label_string2))
- {
- SCI_ASSERT(FALSE);
- }
- if(label_str2_ptr != PNULL)
- {
- cms_free(label_str2_ptr);
- label_str2_ptr = PNULL;
- }
- return TRUE;
- }
- LOCAL MMI_RESULT_E MMSSPACE_HandleListWinMsg(
- MMS_WINDOW_ID_E win_id,
- MMI_MESSAGE_ID_E msg_id,
- DPARAM param
- )
- {
- MMI_RESULT_E err_code = MMI_RESULT_TRUE;
- MMI_STRING_T dst_ptr ={0};
- MMI_STRING_T dst_temp ={0};
- MMI_STRING_T dst_temp2 ={0};
- MMI_STRING_T dst_temp3 ={0};
- MMI_STRING_T dst_temp4 = {0}; //fnh add 0327
- MMI_STRING_T dst_ptr1 ={0};
- MMI_STRING_T dst_ptr2 ={0};
- MMI_STRING_T dst_ptr3 ={0};
- MMI_STRING_T dst_ptr4 ={0};
- MMI_STRING_T dst_ptr5 = {0};
- MMI_STRING_T dst_ptr6 = {0}; //fnh add 0327
- switch(msg_id)
- {
- case MSG_FULL_PAINT:
- //clear
- MMIMMS_CLEAR_CLIENT();
- SCI_MEMSET(&dst_ptr, 0, sizeof(MMI_STRING_T));
- SCI_MEMSET(&dst_temp, 0, sizeof(MMI_STRING_T));
- SCI_MEMSET(&dst_temp2, 0, sizeof(MMI_STRING_T));
- SCI_MEMSET(&dst_temp3, 0, sizeof(MMI_STRING_T));
- SCI_MEMSET(&dst_temp4, 0, sizeof(MMI_STRING_T)); //fnh add 0327
- SCI_MEMSET(&dst_ptr1, 0, sizeof(MMI_STRING_T));
- SCI_MEMSET(&dst_ptr2, 0, sizeof(MMI_STRING_T));
- SCI_MEMSET(&dst_ptr3, 0, sizeof(MMI_STRING_T));
- SCI_MEMSET(&dst_ptr4, 0, sizeof(MMI_STRING_T));
- SCI_MEMSET(&dst_ptr5, 0, sizeof(MMI_STRING_T));
- SCI_MEMSET(&dst_ptr6, 0, sizeof(MMI_STRING_T));
- Space_FormInBox(&dst_ptr1);
- Space_FormOutBox(&dst_ptr2);
- Space_FormSentBox(&dst_ptr3);
- Space_FormDraftBox(&dst_ptr4);
- Space_FormTotal(&dst_ptr5);
- Space_FormSize(&dst_ptr6); //fnh add 0327
- CatString(&dst_temp, &dst_ptr1,&dst_ptr2);
- CatString(&dst_temp2, &dst_temp,&dst_ptr3);
- CatString(&dst_temp3, &dst_temp2, &dst_ptr4);
- // CatString(&dst_ptr,&dst_temp3,&dst_ptr5); //fnh modify 0510
- CatString(&dst_temp4,&dst_temp3,&dst_ptr5); //fnh add 0327
- CatString(&dst_ptr, &dst_temp4, &dst_ptr6); //fnh add 0327
- GUITEXTBOX_SetText(MMIMMS_MMSSPACE_TEXTBOX_CTRL_ID, &dst_ptr, TRUE);
- //set sofkey
- MMK_SetWinSoftkeyId(win_id, COMMON_TXT_NULL, COMMON_TXT_NULL, STXT_RETURN, TRUE);
- break;
- case MSG_OPEN_WINDOW:
- //set active control
- MMK_SetAtvCtrl(win_id, MMIMMS_MMSSPACE_TEXTBOX_CTRL_ID);
- break;
- case MSG_APP_CANCEL:
- // close the edit window
- MMK_CloseWin(win_id);
- break;
- case MSG_CLOSE_WINDOW:
- break;
- default:
- err_code = MMI_RESULT_FALSE;
- break;
- }
- return err_code;
- }
- /*****************************************************************************/
- // Description : 5.4.1A Inbox: message list window message handler
- // Global resource dependence :
- // Author:Bruce.Chi
- // changed liangliu for MMS message show!
- // Note:
- /*****************************************************************************/
- LOCAL MMI_RESULT_E Inbox_HandleListWinMsg(
- MMS_WINDOW_ID_E win_id,
- MMI_MESSAGE_ID_E msg_id,
- DPARAM param
- )
- {
- MMI_RESULT_E err_code = MMI_RESULT_TRUE;
- uint16 list_index = 0;
- int i = 0;
- MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_INBOX_LIST_CTRL_ID;
- static uint32 list_state = 0 ;
- MMI_STRING_T name_ptr;
- uint16 message_num = 0;
- BOOLEAN is_content_ucs2 = FALSE;
- pMessageList tlist = PNULL;
- uint32 listicon_id;
- uint8 listptr[LISTMAXLENGTH];
- switch(msg_id)
- {
- case MSG_FULL_PAINT:
- MMIMMS_CLEAR_CLIENT();
- break;
- case MSG_OPEN_WINDOW:
- MMK_SetWinSoftkeyId(win_id, STXT_OK, 0, STXT_RETURN, FALSE);
- message_num = MMIMMS_GetMessageNum(g_pManager->currentfolder);
- g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->root;//modify 2005-12-2
- if (message_num == 0)
- {
- // PUBWIN_OpenPromptAlertWin(
- // PUBWIN_SOFTKEY_ONE,
- // TXT_MMS_DRAFTBOX_EMPTY,
- // IMAGE_PROMPT_ICON_WRONG,
- // ALERT_TIMEOUT,
- // PNULL
- // );
- MMK_CloseWin(win_id);
- break;
- }
- GUILISTBOX_SetMaxItem(list_ctrl_id, MMIMMS_MAX_MMS_AND_MMSNOTI_NUM);
- //mms_sort_ptr = MMIMMS_Sort(MMIMESSAGE_INBOX, &message_num);
- //SCI_ASSERT(mms_sort_ptr != PNULL);
- if (message_num > 0)
- {
- tlist = g_pManager->currentfolder->root;
- for(i = 0; i < message_num; i++)
- {
- //is_content_ucs2 = ((mms_sort_ptr[i].status_flag & FLAG_MMS_CONTENT_IS_UCS2) != 0) ? TRUE : FALSE;
- if(tlist == g_pManager->currentfolder->currentmessage)
- {
- list_index = i ;
- }
- SCI_MEMSET(&name_ptr, 0, sizeof(MMI_STRING_T));
- name_ptr.str_ptr = cms_malloc(MMIPB_NAME_MAX_LEN);
- switch(tlist->state)
- {
- case MMS_MSG_STATE_UNRECEIVED:
- listicon_id = IMAGE_MMS_NOTIFY_NEW_ICON;
- break;
- case MMS_MSG_STATE_UNREAD:
- listicon_id = IMAGE_NOT_READ_MMS_ICON;
- break;
- case MMS_MSG_STATE_READ:
- listicon_id = IMAGE_READ_MMS_ICON;
- break;
- default:
- listicon_id = IMAGE_READ_MMS_ICON;
- break;
- }
- SCI_MEMSET(listptr, 0, LISTMAXLENGTH)
- if(SCI_STRLEN((char*)tlist->sender) > LISTMAXLENGTH)
- {
- strncpy((char*)listptr,(char*)tlist->sender,LISTMAXLENGTH);
- }else
- {
- SCI_TRACE_LOW("fnh listptr = %s,tlist->sender = %s",listptr,tlist->sender);
- SCI_STRCPY((char*)listptr,(char*)tlist->sender);
- }
- if (MMIMMS_GetPBNameByNumber(listptr,&name_ptr)== 1) //从电话簿中选择与号码匹配的名字
- {
- SCI_TRACE_BUF("fnh get pb_name = %x",name_ptr.str_ptr,10);
- SCI_TRACE_LOW("FNH GET PB_NAME_LENGTH = %d",name_ptr.length);
- SCI_TRACE_LOW("FNH is_ucs2 = %d",name_ptr.is_ucs2);
- AppendListItemWithIcon(
- (uint8 *)name_ptr.str_ptr,
- name_ptr.length,
- listicon_id,
- name_ptr.is_ucs2,
- list_ctrl_id,
- STXT_OPTION
- );
- }
- else
- {
- SCI_TRACE_LOW("FNH NOT IN PB!");
- AppendListItemWithIcon(
- (uint8 *)listptr,
- SCI_STRLEN((char*)listptr),
- listicon_id,
- is_content_ucs2,
- list_ctrl_id,
- STXT_OPTION
- );
- }
- if(tlist->next!=NULL)
- {
- tlist = tlist->next;//这里还要增加意外判断
- }
- else
- {
- tlist = g_pManager->currentfolder->root;
- }
- if (name_ptr.str_ptr)
- {
- cms_free(name_ptr.str_ptr);
- name_ptr.str_ptr = NULL;
- }
- }
- }
- //GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
- MMK_SetAtvCtrl(win_id, list_ctrl_id);
- GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
- break;
- case MSG_GET_FOCUS://be careful, memory leak.
- g_pManager->currentfolder =g_pManager->inboxfolder;
- message_num = MMIMMS_GetMessageNum(g_pManager->currentfolder);
- if (message_num == 0)
- {
- // PUBWIN_OpenPromptAlertWin(
- // PUBWIN_SOFTKEY_ONE,
- // TXT_MMS_DRAFTBOX_EMPTY,
- // IMAGE_PROMPT_ICON_WRONG,
- // ALERT_TIMEOUT,
- // PNULL
- // );
- MMK_CloseWin(win_id);
- break;
- }
- GUILISTBOX_SetMaxItem(list_ctrl_id, MMIMMS_MAX_MMS_AND_MMSNOTI_NUM);
- //mms_sort_ptr = MMIMMS_Sort(MMIMESSAGE_INBOX, &message_num);
- //SCI_ASSERT(mms_sort_ptr != PNULL);
- if (message_num > 0)
- {
- tlist = g_pManager->currentfolder->root;
- for(i = 0; i < message_num; i++)
- {
- //is_content_ucs2 = ((mms_sort_ptr[i].status_flag & FLAG_MMS_CONTENT_IS_UCS2) != 0) ? TRUE : FALSE;
- if(tlist == g_pManager->currentfolder->currentmessage)
- {
- list_index = i ;
- }
- SCI_MEMSET(&name_ptr, 0, sizeof(MMI_STRING_T));
- name_ptr.str_ptr = cms_malloc(MMIPB_NAME_MAX_LEN);
- switch(tlist->state)
- {
- case MMS_MSG_STATE_UNRECEIVED:
- listicon_id = IMAGE_MMS_NOTIFY_NEW_ICON;
- break;
- case MMS_MSG_STATE_UNREAD:
- listicon_id = IMAGE_NOT_READ_MMS_ICON;
- break;
- case MMS_MSG_STATE_READ:
- listicon_id = IMAGE_READ_MMS_ICON;
- break;
- default:
- listicon_id = IMAGE_READ_MMS_ICON;
- break;
- }
- SCI_MEMSET(listptr, 0, LISTMAXLENGTH)
- if(SCI_STRLEN((char*)tlist->sender) > LISTMAXLENGTH)
- {
- strncpy((char*)listptr,(char*)tlist->sender,LISTMAXLENGTH);
- }else
- {
- SCI_STRCPY((char*)listptr,(char*)tlist->sender);
- }
- if (MMIMMS_GetPBNameByNumber(listptr,&name_ptr)== 1) //从电话簿中选择与号码匹配的名字
- {
- SCI_TRACE_BUF("fnh get pb_name = %x",name_ptr.str_ptr,10);
- SCI_TRACE_LOW("FNH GET PB_NAME_LENGTH = %d",name_ptr.length);
- SCI_TRACE_LOW("FNH is_ucs2 = %d",name_ptr.is_ucs2);
- AppendListItemWithIcon(
- (uint8 *)name_ptr.str_ptr,
- name_ptr.length,
- listicon_id,
- name_ptr.is_ucs2,
- list_ctrl_id,
- STXT_OPTION
- );
- }
- else
- {
- SCI_TRACE_LOW("FNH NOT IN PB!");
- AppendListItemWithIcon(
- (uint8 *)listptr,
- SCI_STRLEN((char*)listptr),
- listicon_id,
- is_content_ucs2,
- list_ctrl_id,
- STXT_OPTION
- );
- }
- if(tlist->next!=NULL)
- {
- tlist = tlist->next;//这里还要增加意外判断
- }
- else
- {
- tlist = g_pManager->currentfolder->root;
- }
- if (name_ptr.str_ptr)
- {
- cms_free(name_ptr.str_ptr);
- name_ptr.str_ptr = NULL;
- }
- }
- }
- GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
- MMK_SetAtvCtrl(win_id, list_ctrl_id);
- //GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
- break;
- case MSG_LOSE_FOCUS:
- break;
- // case MSG_APP_OK:
- // MMK_TrackPopupMenu(win_id);
- // break;
- case MSG_CTL_DBCLICK:
- case MSG_APP_OK:
- case MSG_CTL_OK:
- //get selected list index
- list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
- g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->root;
- for(i = 0 ;i < list_index;i++)
- {
- g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->currentmessage->next;
- }
- g_pCurrentList = g_pManager->inboxfolder->currentmessage;
- list_state = MMIMMS_GetListState(g_pCurrentList);
- //list_state = 0 ;
- if (list_state == MMS_MSG_STATE_UNRECEIVED)
- {
- MMK_CreateWin((uint32 *)MMIMMS_INBOX_MMSNOTIMENU_WIN, PNULL);
- }
- else
- {
- /************fnh add begin *********/
- SCI_TRACE_LOW("FNH g_pCurrentList->state = %d",g_pCurrentList->state);
- if(g_pCurrentList->state == 1&& g_pCurrentList->needreadrpt == 1)
- {
- g_readforstate = MMS_MSG_INBOX_READ_FOR_PLAY;
- PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_SEND_READRPT, IMAGE_PROMPT_ICON_QUERY);
- }
- else
- {
- // MMIMMS_Construction();
- g_p_mms_subject = NULL;
- SCI_MEMSET(&g_set_date,0,sizeof(MMS_SEND_ONTIME_TIME));
- g_p_mms_to = NULL;
- g_p_mms_cc = NULL;
- g_p_mms_bcc = NULL;
- /************fnh add end ************/
- MMK_CreateWin((uint32 *)MMIMMS_INBOX_MMSMENU_WIN, PNULL);
- }
- }
- break;
- case MSG_MMS_SEND_OK:
- if (MMK_IsOpenWin(MAIN_PROMPTALERT_WIN_ID)) //46351
- {
- MMK_CloseWin(MAIN_PROMPTALERT_WIN_ID);
- }
- SCI_TRACE_LOW("FNH before send readreport success");
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_SEND_SUCCEED,
- IMAGE_PROMPT_ICON_SUCCESS,//IMAGE_PROMPT_ICON_OK,
- ALERT_TIMEOUT,
- PNULL
- );
- g_pCurrentList->needreadrpt = 0;
- break;
- case MSG_MMS_SENDED_FAILED:
- if (MMK_IsOpenWin(MAIN_PROMPTALERT_WIN_ID)) //46351
- {
- MMK_CloseWin(MAIN_PROMPTALERT_WIN_ID);
- }
- PUBWIN_OpenPromptAlertWin(
- PUBWIN_SOFTKEY_ONE,
- TXT_MMS_SEND_FAILED,
- IMAGE_PROMPT_ICON_FAIL,
- ALERT_TIMEOUT,
- PNULL
- );
- g_pCurrentList->needreadrpt = 0;
- break;
- case MSG_PROMPTWIN_OK:
- PUBWIN_ClosePromptQueryWin();
- g_issendingreadrpt = TRUE;
- MMIMMS_SendReadRpt_CreateWaitingWin();
- MMIMMS_SendMMSReadRpt(g_pCurrentList);
- g_netusing = MMS_MSG_NETUSING_STEP1;
- break;
- case MSG_PROMPTWIN_CANCEL:
- PUBWIN_ClosePromptQueryWin();//here should close the win and open the waitwin for delete.
- // MMIMMS_Construction();
- g_pCurrentList->needreadrpt = 0;
- g_p_mms_subject = NULL;
- SCI_MEMSET(&g_set_date,0,sizeof(MMS_SEND_ONTIME_TIME));
- g_p_mms_to = NULL;
- g_p_mms_cc = NULL;
- g_p_mms_bcc = NULL;
- /************fnh add end ************/
- MMK_CreateWin((uint32 *)MMIMMS_INBOX_MMSMENU_WIN, PNULL);
- break;
- case MSG_APP_CANCEL:
- case MSG_CTL_CANCEL:
- MMK_CloseWin(win_id);
- break;
- case MSG_CLOSE_WINDOW:
- g_pCurrentList = PNULL;
- break;
- default:
- err_code = MMI_RESULT_FALSE;
- break;
- }
- return err_code;
- }
- /*****************************************************************************/
- // Description :5.4.1C Inbox : Option menu of MMS window message handler
- // Global resource dependence :
- // Author:Bruce.Chi
- // Note:
- /*****************************************************************************/
- LOCAL MMI_RESULT_E Inbox_HandleMMSMenuWinMsg(
- MMS_WINDOW_ID_E win_id,
- MMI_MESSAGE_ID_E msg_id,
- DPARAM param
- )
- {
- MMI_RESULT_E err_code = MMI_RESULT_TRUE;
- uint32 group_id = 0;
- uint32 menu_id = 0;
- MMS_CONTROL_ID_E menu_ctrl_id = MMIMMS_INBOX_MMSOPT_MENU_CTRL_ID;
- switch(msg_id)
- {
- case MSG_OPEN_WINDOW:
- MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);