mmimms_wintable.c
上传用户:amanda_214
上传日期:2014-04-26
资源大小:163k
文件大小:463k
开发平台:

C/C++

  1. MMIMMS_DeleteCurVideo(g_peditdoc);
  2. SCI_MEMSET(&composer_video,0,sizeof(composer_video));
  3. composer_video.VidBuf = mpeg4_return_info_ptr->buf_ptr;
  4. composer_video.size = mpeg4_return_info_ptr->memory_size;
  5. SCI_TRACE_LOW("FNH composer_viedo.size = %d",composer_video.size);
  6. composer_video.Type = mpeg4_return_info_ptr->type;
  7. // composer_video.Type = "video/mpeg";
  8. SCI_TRACE_LOW("FNH before add video");
  9. MMIMMS_AddVideo(&composer_video,g_peditdoc);
  10. break;
  11. #endif
  12. #ifdef HAVE_MP3
  13. case MSG_MP3_READ_FFS_DONE:
  14. SCI_ASSERT(param != NULL);
  15. SCI_TRACE_LOW("FNH enter MSG_MULTIM_SLEECTED_RETURN");
  16. mp3_return_info_ptr = (MMIMP3_TETURN_INFO_T *)param;
  17. if (PNULL == mp3_return_info_ptr->buf_ptr)
  18. {
  19. PUBWIN_OpenPromptAlertWin(
  20. PUBWIN_SOFTKEY_ONE, 
  21. TXT_MMS_EDIT_ADD_FAIL, 
  22. IMAGE_PROMPT_ICON_WRONG, 
  23. ALERT_TIMEOUT, 
  24. PNULL
  25. );
  26. break;
  27. }
  28. MMS_DelAudio(g_peditdoc->slide_cur, g_peditdoc);
  29. //insert the audio
  30. composer_audio.AudBuf = mp3_return_info_ptr->buf_ptr;
  31. composer_audio.size = mp3_return_info_ptr->memory_size;
  32. composer_audio.Type = COMPOSER_AUDIO_MP3;
  33. SCI_TRACE_LOW("FNH get music composer_audio.size = %d",composer_audio.size);
  34. SCI_TRACE_LOW("FNH multim_return_info->type = %d",composer_audio.Type);
  35. MMIMMS_AddAudio(&composer_audio,g_peditdoc);
  36. break;
  37. #endif
  38.     case MSG_MULTIM_SELECTED_RETURN:
  39. SCI_TRACE_LOW("FNH enter MSG_MULTIM_SELECTED_RETURN");
  40. SCI_ASSERT(param != NULL);
  41. multim_return_info_ptr = (MMIMULTIM_SELECTED_RETURN_T *)param;
  42. // SCI_ASSERT(multim_return_info_ptr->buf_ptr != PNULL);
  43. // SCI_ASSERT(multim_return_info_ptr->memory_size != 0);
  44. if ((PNULL == multim_return_info_ptr->buf_ptr) || (0 == multim_return_info_ptr->memory_size))
  45. {
  46.       //      if (menu_id == ID_MMS_INSERT_DPIC || menu_id ==ID_MMS_INSERT_PHOTO )
  47. if (s_opt_menu_id == ID_MMS_INSERT_DPIC || s_opt_menu_id ==ID_MMS_INSERT_PHOTO )
  48.             {
  49.     //alert : not supported image
  50.     PUBWIN_OpenPromptAlertWin(
  51.     PUBWIN_SOFTKEY_ONE, 
  52.     TXT_MMS_INVALID_PIC, 
  53.     IMAGE_PROMPT_ICON_WRONG, 
  54.     ALERT_TIMEOUT, 
  55.     PNULL
  56.     );
  57.             }
  58.        //     else if (menu_id == ID_MMS_EDIT_INSERT_RING )
  59. else if (s_opt_menu_id == ID_MMS_EDIT_INSERT_MUSIC)
  60.             {
  61.                 //alert : not supported audio
  62.     PUBWIN_OpenPromptAlertWin(
  63.     PUBWIN_SOFTKEY_ONE, 
  64.     TXT_MMS_INVALID_AUDIO, 
  65.     IMAGE_PROMPT_ICON_WRONG, 
  66.     ALERT_TIMEOUT, 
  67.     PNULL
  68.     );
  69.             }
  70. break;
  71. }
  72. SCI_MEMSET(&composer_img, 0, sizeof(composer_img));
  73. SCI_MEMSET(&composer_audio, 0, sizeof(composer_audio));
  74. // if (menu_id == ID_MMS_INSERT_DPIC || menu_id ==ID_MMS_INSERT_PHOTO )
  75. if (s_opt_menu_id == ID_MMS_INSERT_PHOTO || s_opt_menu_id == ID_MMS_INSERT_DPIC)
  76. {
  77. MMIMMS_DeleteCurImage(g_peditdoc);
  78. //insert the image
  79. composer_img.ImgBuf = multim_return_info_ptr->buf_ptr;
  80. composer_img.size = multim_return_info_ptr->memory_size;
  81. composer_img.Type = Edit_GetDeltaMMSImageType2(multim_return_info_ptr->type);
  82. composer_img.begin = 0;
  83. SCI_TRACE_LOW("FNH buf = %d,size = %d,type = %d",composer_img.ImgBuf,composer_img.size,multim_return_info_ptr->type);
  84. if (composer_img.Type != PNULL)
  85. {
  86. MMIMMS_AddImage(&composer_img,g_peditdoc);
  87. }
  88. else
  89. {
  90. //alert : not supported image
  91. PUBWIN_OpenPromptAlertWin(
  92. PUBWIN_SOFTKEY_ONE, 
  93. TXT_MMS_INVALID_PIC, 
  94. IMAGE_PROMPT_ICON_WRONG, 
  95. ALERT_TIMEOUT, 
  96. PNULL
  97. );
  98. }
  99. }
  100. // else if (menu_id == ID_MMS_EDIT_INSERT_RING)
  101. else if (s_opt_menu_id == ID_MMS_EDIT_INSERT_MUSIC)
  102. {
  103. // MMS_DelAudio(p_cur_doc->slide_cur, p_cur_doc);
  104. MMS_DelAudio(g_peditdoc->slide_cur, g_peditdoc);
  105. //insert the audio
  106. composer_audio.AudBuf = multim_return_info_ptr->buf_ptr;
  107. composer_audio.size = multim_return_info_ptr->memory_size;
  108. composer_audio.Type = Edit_GetDeltaMMSAudioType(multim_return_info_ptr->type);
  109. // composer_audio.Type = COMPOSER_AUDIO_MIDI;
  110. SCI_TRACE_LOW("FNH get music composer_audio.size = %d",multim_return_info_ptr->memory_size);
  111. SCI_TRACE_LOW("FNH multim_return_info->type = %d",multim_return_info_ptr->type);
  112. SCI_TRACE_LOW("FNH composer_audio.Type = %s",composer_audio.Type);
  113. if (composer_audio.Type != PNULL)
  114. {
  115. MMIMMS_AddAudio(&composer_audio,g_peditdoc);
  116. }
  117. else
  118. {
  119. //alert : not supported audio
  120. PUBWIN_OpenPromptAlertWin(
  121. PUBWIN_SOFTKEY_ONE, 
  122. TXT_MMS_INVALID_AUDIO, 
  123. IMAGE_PROMPT_ICON_WRONG, 
  124. ALERT_TIMEOUT, 
  125. PNULL
  126. );
  127. }
  128. }
  129. else
  130. {
  131. SCI_ASSERT(!"mmimms:Bad message.");
  132. }
  133. //free
  134. // if (menu_id != ID_MMS_INSERT_PHOTO )
  135. 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);
  136. if (s_opt_menu_id != ID_MMS_INSERT_PHOTO)
  137. {
  138. SCI_TRACE_LOW("MSG_MULTIM_SELECTED_RETURN multim_return_info_ptr->buf_ptr=%p",multim_return_info_ptr->buf_ptr);
  139. if (multim_return_info_ptr->buf_ptr != PNULL)
  140. {
  141. cms_free(multim_return_info_ptr->buf_ptr);
  142. multim_return_info_ptr->buf_ptr = NULL;
  143. }
  144. }
  145. break;
  146.     case MSG_MMS_CLOSE_WAITING_WIN:
  147.         break;
  148.     case MSG_MMS_CLOSE_PREVIEW_WAITING_WIN:
  149.         //create preview win
  150.         MMK_CreateWin( (uint32*)MMIMMS_EDIT_PREVIEW_TAB, (ADD_DATA)g_peditdoc);
  151.         //close waiting win
  152.         //PUBWIN_CloseWaitingMessageWin(MMIMMS_EDIT_PREVIEW_WAITING_WIN_ID);
  153.         PUBWIN_ClosePromptAlertWin();        
  154.         break;
  155.             
  156.     case MSG_SKB_ICON:
  157.     //    Edit_SaveMMSText(edit_contrl_id);
  158. // Edit_SetEditCtrlContent(edit_contrl_id);
  159.         button_index = (uint32) param;
  160.         switch(button_index)    
  161.         {
  162.            case MMI_SOFTKEYBAR_LEFT_ICON:
  163. if (MMS_PrevSlide(g_peditdoc) == 1)
  164. {
  165. MmsStopPreviewRing();
  166. Edit_SetEditCtrlContent(edit_contrl_id,g_peditdoc);
  167. MMK_SetAtvCtrl(win_id, edit_contrl_id);
  168. MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
  169. }
  170. break;
  171.                 
  172.            case MMI_SOFTKEYBAR_MIDDLE_ICON:
  173. MMI_GetLabelTextByLang( TXTSYS_WAITING, &prompt_str );
  174. PUBWIN_OpenPromptAlertWin(
  175. PUBWIN_SOFTKEY_ONE, 
  176. TXTSYS_WAITING, 
  177. IMAGE_PROMPT_ICON_WAIT,
  178. 0, 
  179. PNULL
  180. );
  181. play_or_preview = MMS_PREVIEW;
  182. //post close waiting win message
  183. MMK_PostMsg(win_id, MSG_MMS_CLOSE_PREVIEW_WAITING_WIN, PNULL, 0);   
  184. break;
  185.                 
  186.            case MMI_SOFTKEYBAR_RIGHT_ICON:
  187. if (MMS_NextSlide(g_peditdoc) == 1)
  188. {
  189. MmsStopPreviewRing();
  190. Edit_SetEditCtrlContent(edit_contrl_id,g_peditdoc);
  191. MMK_SetAtvCtrl(win_id, edit_contrl_id);
  192. MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
  193. }
  194. break;
  195.            default:
  196.                SCI_ASSERT(0);
  197.                break;           
  198.          }
  199.          break;
  200.   
  201.     case MSG_APP_OK:
  202.       MMK_TrackPopupMenu(win_id);
  203.       break;
  204.     case MSG_CTL_OK:
  205.   if ( MMIMMS_EDIT_MENU_CTRL_ID == (MMI_CTRL_ID_T)param ) 
  206.   {
  207.          //need to load former
  208.          is_need_to_load_former_text = TRUE;
  209.          GUIMENU_GetRetID((MMI_CTRL_ID_T)param, &group_id, &menu_id);
  210.          //s_opt_menu_id = menu_id;
  211.          MMK_WinGetActive(MMIMMS_EDIT_WIN_ID);
  212.          switch( menu_id )
  213.  {
  214.            case ID_MMS_EDIT_SAVE:
  215. #ifndef WIN32
  216.     g_filetype = MMICMS_GetCurrentFFS();
  217. if((g_filetype == FS_INVALID)||MMIMMS_GetManagerTotalNum() > (MMS_MAX_NUM-1)||!MMIMMS_IsMoreSpace())//modify liangliu 2005-12-14
  218. #else
  219. if(0)
  220. #endif
  221.     {
  222.          PUBWIN_OpenPromptAlertWin(
  223.   PUBWIN_SOFTKEY_ONE, 
  224.   TXT_MMS_MEMORYFULL, 
  225.   IMAGE_PROMPT_ICON_ALERT, 
  226.   ALERT_TIMEOUT, 
  227.   PNULL);
  228. }
  229. else
  230. {
  231. if (g_peditdoc->slide_cur == NULL)
  232. {
  233. PUBWIN_OpenPromptAlertWin(
  234. PUBWIN_SOFTKEY_ONE, 
  235. TXT_MMS_EDIT_NO_CONTENT, 
  236. IMAGE_PROMPT_ICON_ALERT,
  237. ALERT_TIMEOUT, 
  238. PNULL
  239. );
  240. break;
  241. }
  242. else
  243. {
  244. SaveMmsMessage(SAVE_MMS_TO_DRAFTBOX,NULL);
  245. }
  246. }
  247. break;
  248.            case ID_MMS_EDIT_SEND:
  249. if (CC_IsInCall()) //judge whether it's making a call
  250. {
  251. //alert : TXT_MMS_CANNOT_SEND_IN_CALL
  252. PUBWIN_OpenPromptAlertWin(
  253. PUBWIN_SOFTKEY_ONE, 
  254. TXT_MMS_CANNOT_SEND_IN_CALL, 
  255. IMAGE_PROMPT_ICON_ALERT, 
  256. ALERT_TIMEOUT, 
  257. PNULL
  258. );
  259. }
  260. else if (! (MMISMS_IsReady() && MMISMS_IsOrderOk())) //judge whether sms_order ready
  261. {
  262. PUBWIN_OpenPromptAlertWin(
  263. PUBWIN_SOFTKEY_ONE,
  264. TXTSYS_WAITING,
  265. IMAGE_PROMPT_ICON_WAIT,
  266. MMISMS_3SECOND, PNULL
  267. );   
  268. }
  269. else
  270. {
  271. if((g_p_mms_to == NULL)&&(g_p_mms_cc == NULL)&&(g_p_mms_bcc == NULL)
  272. &&(g_p_mms_to_group == NULL)&&(g_p_mms_cc_group == NULL)&&(g_p_mms_bcc_group == NULL))
  273. {
  274. PUBWIN_OpenPromptAlertWin(
  275. PUBWIN_SOFTKEY_ONE, 
  276. TXT_MMS_EDIT_RECEIVER_NONE, 
  277. IMAGE_PROMPT_ICON_ALERT, 
  278. ALERT_TIMEOUT, 
  279. PNULL);
  280. break;
  281. }
  282. SCI_TRACE_LOW("FNH before send messeage");
  283. if (g_peditdoc->slide_cur == NULL)
  284. {
  285. PUBWIN_OpenPromptAlertWin(
  286. PUBWIN_SOFTKEY_ONE, 
  287. TXT_MMS_EDIT_NO_CONTENT, 
  288. IMAGE_PROMPT_ICON_ALERT,
  289. ALERT_TIMEOUT, 
  290. PNULL
  291. );
  292. break;
  293. }
  294. MMIMMS_SendMMS_CreateSendingWin();
  295. g_netusing = MMS_MSG_NETUSING_STEP1;
  296. g_mailbox_status = SEND_NEW_MMS; //信箱状态
  297. CmsSendMessage(SEND_NEW_MMS);
  298. }
  299.             break;
  300.            case ID_MMS_EDIT_DURATION:
  301.                MMK_CreateWin( (uint32*)MMIMMS_EDIT_SLIDE_TIME_TAB, PNULL);
  302.             break;
  303. case ID_MMS_EDIT_SEND_ONTIME:
  304. MMK_CreateWin((uint32*)MMIMMS_EDIT_SET_SEND_DATE_TAB,NULL);
  305. break;
  306.            default:
  307.       //       SCI_ASSERT(0);
  308.    SCI_TRACE_LOW("Edit_HandleEditMMSWinMsg MSG_CTL_OK menu_id error ");
  309.              break;
  310.          }
  311.       }
  312.       break;
  313.       
  314.     case MSG_PROMPTWIN_OK:
  315.         switch(s_opt_menu_id)
  316.         {
  317.         case ID_MMS_EDIT_DEL_CUR_SLIDE:
  318.             //delete then return 
  319.           //  fnCPS_DeleteCurSlide();    //faint
  320.          //   Adapter_fnCPSDeleteCurSlide();
  321. MMS_DelSlide(g_peditdoc);
  322.             
  323.             //close prompt query win
  324.             PUBWIN_ClosePromptQueryWin();
  325.             Edit_SetEditCtrlContent(edit_contrl_id,g_peditdoc);
  326.             MMK_SetAtvCtrl(win_id, edit_contrl_id);
  327.             //alert: have been deleted
  328.             PUBWIN_OpenPromptAlertWin(
  329.                     PUBWIN_SOFTKEY_ONE, 
  330.                     TXT_MMS_DELED, 
  331.                     IMAGE_PROMPT_ICON_SUCCESS,
  332.                     ALERT_TIMEOUT, 
  333.                     PNULL
  334.                     );
  335.             
  336.             //close this menu win
  337. //            MMK_CloseWin(win_id);
  338. //               MMK_WinGetActive(win_id);
  339.             break;
  340.         case ID_MMS_INSERT_DPIC:
  341.             //delete image
  342. //            SCI_ASSERT(fnCPS_CurImageExist());
  343. //            if (COMPOSER_SUCCESS != MMIMMS_DeleteCurImage())
  344. //            {
  345. //                SCI_ASSERT(FALSE);
  346. //            }
  347.             //close prompt query win
  348.             PUBWIN_ClosePromptQueryWin();
  349.             
  350.             //open insert image win
  351.             Edit_OpenInsertDpicWin(win_id);
  352.             break;
  353.             
  354.         case ID_MMS_INSERT_PHOTO:
  355.             //delete image
  356. //            SCI_ASSERT(fnCPS_CurImageExist());
  357. //            if (COMPOSER_SUCCESS != MMIMMS_DeleteCurImage())
  358. //            {
  359. //                SCI_ASSERT(FALSE);
  360. //            }
  361.             //close prompt query win
  362.             PUBWIN_ClosePromptQueryWin();
  363.             
  364.             //open insert image win
  365.       //      Edit_OpenInsertPhotoWin(win_id);
  366. MMIDC_OpenAlbumWinForMMS(MMS_MAX_SIZE_OF_MULTIM,win_id);
  367.             break;
  368.         case ID_MMS_EDIT_DEL_IMAGE:
  369.             //close prompt query win
  370. MMIMMS_DeleteCurImage(g_peditdoc);
  371.             PUBWIN_ClosePromptQueryWin();
  372.             MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
  373.             //alert: have been deleted
  374.             PUBWIN_OpenPromptAlertWin(
  375.                     PUBWIN_SOFTKEY_ONE, 
  376.                     TXT_MMS_DELED, 
  377.                     IMAGE_PROMPT_ICON_SUCCESS,
  378.                     ALERT_TIMEOUT, 
  379.                     PNULL
  380.                     );            
  381.             //close this menu win
  382. //            MMK_CloseWin(win_id);
  383. //               MMK_WinGetActive(win_id);
  384.             break;
  385.         
  386.         case ID_MMS_EDIT_INSERT_MUSIC:
  387. //            SCI_ASSERT(fnCPS_CurAudioExist());
  388.       //      if (COMPOSER_SUCCESS != fnCPS_DeleteCurAudio())
  389.       //      {
  390.       //          SCI_ASSERT(FALSE);
  391.        //     }
  392.             //close prompt query win
  393.             PUBWIN_ClosePromptQueryWin();
  394.             
  395.             //open insert music window
  396.             Edit_OpenInsertDringWin(win_id);
  397.             break;
  398.         case ID_MMS_EDIT_DEL_MUSIC:
  399. //            SCI_ASSERT(fnCPS_CurAudioExist());
  400. /*
  401.             if (COMPOSER_SUCCESS != fnCPS_DeleteCurAudio())
  402.             {
  403.                 SCI_ASSERT(FALSE);
  404.             }
  405. */
  406.             //close prompt query win
  407. if (g_peditdoc->slide_cur->audiosize > 0)
  408. MMS_DelAudio(g_peditdoc->slide_cur, g_peditdoc);
  409.             PUBWIN_ClosePromptQueryWin();
  410.             MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
  411.             //alert: have been deleted
  412.             PUBWIN_OpenPromptAlertWin(
  413.                     PUBWIN_SOFTKEY_ONE, 
  414.                     TXT_MMS_DELED, 
  415.                     IMAGE_PROMPT_ICON_SUCCESS,
  416.                     ALERT_TIMEOUT, 
  417.                     PNULL
  418.                     );
  419.             
  420.             //close this menu win
  421. //            MMK_CloseWin(win_id);
  422. //               MMK_WinGetActive(win_id);
  423.             break;
  424. case ID_MMS_EDIT_DEL_VIDEO:
  425. #ifdef HAVE_MPEG4
  426. MMIMMS_DeleteCurVideo(g_peditdoc);
  427. //close prompt query win
  428. PUBWIN_ClosePromptQueryWin();
  429. MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
  430. //alert: have been deleted
  431. PUBWIN_OpenPromptAlertWin(
  432. PUBWIN_SOFTKEY_ONE, 
  433. TXT_MMS_DELED, 
  434. IMAGE_PROMPT_ICON_SUCCESS,
  435. ALERT_TIMEOUT, 
  436. PNULL
  437. );
  438. #endif
  439. break;
  440. case ID_MMS_EDIT_EXIT:
  441. PUBWIN_ClosePromptQueryWin();
  442. MMK_CloseWin(win_id);
  443.         default:
  444.             break;
  445.         }
  446.         
  447.         break;
  448.     case MSG_PROMPTWIN_CANCEL:
  449.         //close query window
  450.         PUBWIN_ClosePromptQueryWin();
  451.         
  452.         break;
  453.     case MSG_APP_CANCEL:
  454.     case MSG_CTL_CANCEL:
  455. s_opt_menu_id = ID_MMS_EDIT_EXIT;
  456. PUBWIN_OpenPromptQueryWin(STXT_EXIT, IMAGE_PROMPT_ICON_QUERY);
  457.         
  458.         break;
  459.         
  460.     case MSG_CLOSE_WINDOW:
  461.         //need to load text
  462.         is_need_to_load_former_text = TRUE;
  463. MMIMMS_Destruction();
  464. if(g_p_mms_subject != NULL)
  465. {
  466. cms_free(g_p_mms_subject);
  467. g_p_mms_subject = NULL;
  468. }
  469. /* 删除收件人链表 */
  470. if (g_p_mms_to != NULL)
  471. {
  472. MmsDelAllReceiver(&g_p_mms_to);
  473. g_p_mms_to = NULL;
  474. }
  475. if (g_p_mms_to_group != NULL)
  476. {
  477. if (g_p_mms_to_group->cur_group != NULL)
  478. {
  479. MmsDelReceiver(g_p_mms_to_group->cur_group);
  480. g_p_mms_to_group->cur_group = NULL;
  481. }
  482. cms_free(g_p_mms_to_group);
  483. g_p_mms_to_group = NULL;
  484. }
  485. /* 删除抄送人链表 */
  486. if(g_p_mms_cc != NULL)
  487. {
  488. MmsDelAllReceiver(&g_p_mms_cc);
  489. g_p_mms_cc = NULL;
  490. }
  491. if (g_p_mms_cc_group != NULL)
  492. {
  493. if (g_p_mms_cc_group->cur_group != NULL)
  494. {
  495. MmsDelReceiver(g_p_mms_cc_group->cur_group);
  496. g_p_mms_cc_group->cur_group = NULL;
  497. }
  498. cms_free(g_p_mms_cc_group);
  499. g_p_mms_cc_group = NULL;
  500. }
  501. /* 删除密送人链表 */
  502. if(g_p_mms_bcc != NULL)
  503. {
  504. MmsDelAllReceiver(&g_p_mms_bcc);
  505. g_p_mms_bcc = NULL;
  506. }
  507. if (g_p_mms_bcc_group != NULL)
  508. {
  509. if (g_p_mms_bcc_group->cur_group != NULL)
  510. {
  511. MmsDelReceiver(g_p_mms_bcc_group->cur_group);
  512. g_p_mms_bcc_group->cur_group = NULL;
  513. }
  514. cms_free(g_p_mms_bcc_group);
  515. g_p_mms_bcc_group = NULL;
  516. }
  517. /* 删除编辑器资源 */
  518. if(g_peditdoc != NULL)
  519. {
  520. MMSDelDocument(g_peditdoc);
  521. g_peditdoc = NULL;
  522. g_pcur_signdoc = NULL;
  523. }
  524. MMICMSBRW_FreeGlobalBuffer();
  525. if(s_is_mmscontent_suspend_mp3)
  526.         {
  527.           s_is_mmscontent_suspend_mp3=FALSE;
  528.           MMIMP3_ContinuePlayMp3();
  529.         }
  530.         break;
  531.         
  532.     default:
  533.         is_need_to_load_former_text = FALSE;
  534.         err_code = MMI_RESULT_FALSE;
  535.         break;
  536.     }
  537.     return err_code;
  538. }
  539. /******************************************************************************
  540.  * 函数定义: Edit_HandleMMSEditSignWin
  541.  * 函数说明: 编辑自动签名页的窗口处理函数
  542.  * 参数说明: win_id: 窗口ID
  543.   msg_id: 消息ID
  544.   param:
  545.  * 返回值: 空 
  546. ********************************************************************************/
  547. LOCAL MMI_RESULT_E  Edit_HandleMMSEditSignWin(
  548. MMS_WINDOW_ID_E win_id, 
  549. MMI_MESSAGE_ID_E msg_id, 
  550. DPARAM param
  551. )
  552. {
  553.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  554. MMI_CTRL_ID_T   edit_contrl_id = MMIMMS_EDITSIGN_CTRL_ID;
  555. MMI_STRING_T saved_string;
  556. TEXTEDIT_STRING_INFO_T  edit_string;
  557. int32 i_size_free = 0;
  558. MMIMPEG4_BUFFER_FILE_INFO_T* mpeg4_return_info_ptr = PNULL;
  559. MMIMP3_TETURN_INFO_T* mp3_return_info_ptr = PNULL;
  560. MMIMULTIM_SELECTED_RETURN_T* multim_return_info_ptr = PNULL;
  561. T_Composer_Image             composer_img;
  562.     T_Composer_Audio             composer_audio;
  563. T_Composer_Video  composer_video;
  564. static pMMS_EDocument p_sign_edit;
  565. FFS_OVERLAPPED_RESULT_T* efs_result_ptr;
  566. static x_start = 0; //x_start is always zero
  567. static y_start = 0; //y_start base is TITLE_HEIGHT
  568. MMS_CONTROL_ID_E anim_ctrl_id = MMIMMS_EDIT_SIGN_IMAGE_CTRL_ID;
  569. MMS_CONTROL_ID_E editbox_ctrl_id = MMIMMS_EDIT_SIGN_TEXT_CTRL_ID;
  570. static BOOLEAN b_isFirst = FALSE;
  571. static BOOLEAN image_is_too_big = FALSE;
  572.     switch(msg_id)
  573.     {
  574.     case MSG_FULL_PAINT:
  575. MMIMMS_CLEAR_CLIENT();       
  576.         //set label window text
  577.         Edit_SetSignLabelContent(MMIMMS_EDITSIGN_LABEL_CTRL_ID,p_sign_edit);
  578. break;
  579.     case MSG_OPEN_WINDOW:
  580. SCI_TRACE_LOW("FNH MSG_OPEN_WINDOW !");
  581. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  582. MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_LEFT_ICON, IMAGE_PICTURE_PREV_PAGE_ON,IMAGE_PICTURE_PREV_PAGE_OFF,COMMON_IMAGE_NULL, TRUE);
  583.         MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_MIDDLE_ICON, IMAGE_MMS_PREVIEW_PLAY,IMAGE_MMS_PREVIEW_PLAY,COMMON_IMAGE_NULL, TRUE);
  584.         MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_RIGHT_ICON, IMAGE_PICTURE_NEXT_PAGE_ON,IMAGE_PICTURE_NEXT_PAGE_OFF,COMMON_IMAGE_NULL, TRUE);
  585. p_sign_edit = g_pcur_signdoc;
  586. //need to load former text
  587.         is_need_to_load_former_text = TRUE;
  588. b_isFirst = TRUE;
  589. if (p_sign_edit == NULL)
  590. {
  591. p_sign_edit = MMS_New();
  592. SCI_ASSERT(p_sign_edit != NULL);
  593. MMS_New_Slide(p_sign_edit);
  594. }
  595. if (p_sign_edit->slide_cur == NULL)
  596. {
  597. MMS_New_Slide(p_sign_edit);
  598. }
  599. if (is_need_to_load_former_text)
  600.         {
  601.             Edit_SetEditCtrlContent(edit_contrl_id,p_sign_edit);
  602.         }
  603. MMK_SetAtvCtrl(win_id, edit_contrl_id);
  604.         break;
  605. case MSG_CTL_EDITBOX_UPDATE_STRNUM:
  606. SCI_MEMSET( &edit_string, 0, sizeof( TEXTEDIT_STRING_INFO_T ) );
  607. GUIEDITBOX_GetTextEditBoxInfo( edit_contrl_id, &edit_string);
  608. edit_string.str_ptr[edit_string.str_len] = '';
  609. if (p_sign_edit->slide_cur->text_flag) /*判断当前是否已有文本类型?*/
  610. {
  611. CmsDelContent(p_sign_edit, p_sign_edit->slide_cur, MMS_TYPE_TEXT);
  612. p_sign_edit->slide_cur->text_flag = 0;
  613. }
  614. if (edit_string.str_len != 0)
  615. {
  616. saved_string.str_ptr = edit_string.str_ptr;
  617. saved_string.length = edit_string.str_len;
  618. saved_string.is_ucs2 = edit_string.is_ucs2;
  619. {
  620. int16 type = 0;
  621. char text_fname[MMS_MAX_FILE_NAME_LENGTH] = {0};
  622. SCI_FILE* fd = 0;
  623. unsigned long value = 0;
  624. unsigned short buff_size = 0;
  625. int16 uni_len = 0;
  626. char* str_utf16 = NULL;
  627. if (edit_string.is_ucs2 == 0)
  628. {
  629. uni_len = Cms_UTF8toUTF16Len(edit_string.str_ptr);
  630. }
  631. else
  632. {
  633. uni_len = edit_string.str_len;
  634. }
  635. if ((p_sign_edit->totalsize +uni_len ) > MMS_SIZE_OF_MESSAGE)
  636. {
  637. PUBWIN_OpenPromptAlertWin(
  638. PUBWIN_SOFTKEY_ONE, 
  639. TXT_MMS_MMS_TOO_BIG, 
  640. IMAGE_PROMPT_ICON_WRONG, 
  641. ALERT_TIMEOUT, 
  642. PNULL
  643. );
  644. break;
  645. }
  646. value = TM_GetTotalSeconds();
  647. sprintf(text_fname,"%ld",value);
  648. type = MMS_TYPE_TEXT;
  649. strcat(text_fname,".txt");
  650. fd =(SCI_FILE*)mmsf_Open((char*)text_fname,"w");
  651. if ( !fd )
  652. {
  653. SCI_TRACE_LOW("open the file error");
  654. return ;
  655. }
  656. if (edit_string.is_ucs2 == 0)
  657. {
  658. str_utf16 =(char*)cms_malloc(uni_len+1);
  659. SCI_MEMSET(str_utf16,0,uni_len+1);
  660. Cms_UTF8toUTF16(edit_string.str_ptr,edit_string.str_len,uni_len,str_utf16);
  661. }
  662. buff_size = uni_len;
  663. mmsf_Write((char *)(&buff_size),1,sizeof(unsigned short),(FILE_HANDLE)fd);
  664. SCI_TRACE_LOW("FNH buff_size = %d",buff_size);
  665. if (edit_string.is_ucs2 == 0)
  666. {
  667. mmsf_Write((char *)str_utf16,1,uni_len,(FILE_HANDLE)fd);
  668. SCI_TRACE_LOW("FNH after write str_utr16 = %s,uni_len = %d",str_utf16,uni_len);
  669. }
  670. else
  671. {
  672. mmsf_Write((char *)edit_string.str_ptr,1,uni_len,(FILE_HANDLE)fd);
  673. SCI_TRACE_BUF("FNH enit_string.str_ptr = ",edit_string.str_ptr,10);
  674. SCI_TRACE_LOW("FNH uni_len = %d",uni_len);
  675. }
  676. mmsf_Close((FILE_HANDLE)fd);
  677. if (str_utf16)
  678. {
  679. cms_free(str_utf16);
  680. str_utf16 = NULL;
  681. }
  682. if (MMS_New_Content((unsigned char *)text_fname,type,p_sign_edit->slide_cur,p_sign_edit))
  683. {
  684. SCI_TRACE_LOW("insert text is ok!");
  685. }
  686. else 
  687. {
  688. SCI_TRACE_LOW("insert text is failed!");
  689. }
  690. }
  691. }
  692. break;
  693. case MSG_GET_FOCUS:
  694. if (is_need_to_load_former_text)
  695.         {
  696.             Edit_SetEditCtrlContent(edit_contrl_id,p_sign_edit);
  697.         }
  698. break;
  699. case MSG_CTL_PENUP:
  700.         switch ((MMI_CTRL_ID_T)param)
  701.         {       
  702.         case MMIMMS_EDITSIGN_PIC_CTRL_ID:
  703. if (p_sign_edit->slide_cur->image_flag == 1)
  704. {
  705. s_opt_menu_id = ID_MMS_EDIT_DEL_IMAGE;
  706. PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
  707. }
  708. else if (p_sign_edit->slide_cur->video_flag == 1)
  709. {
  710. PUBWIN_OpenPromptAlertWin(
  711. PUBWIN_SOFTKEY_ONE, 
  712. TXT_CMS_MMS_VIDEO_NOPIC, 
  713. IMAGE_PROMPT_ICON_ALERT,
  714. ALERT_TIMEOUT, 
  715. PNULL
  716. );
  717. }
  718. else
  719. {
  720. s_opt_menu_id = ID_MMS_INSERT_DPIC;
  721. MMK_CreateWin( (uint32*)MMIMMS_EDIT_SELECT_IMAGE_WIN_TAB, (ADD_DATA)win_id);
  722. }
  723.             break;
  724.         
  725.         case MMIMMS_EDITSIGN_RING_CTRL_ID:
  726. if (p_sign_edit->slide_cur->audiosize !=0)
  727. {
  728. s_opt_menu_id = ID_MMS_EDIT_DEL_MUSIC;
  729. PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
  730. }
  731. else if (p_sign_edit->slide_cur->video_flag == 1)
  732. {
  733. PUBWIN_OpenPromptAlertWin(
  734. PUBWIN_SOFTKEY_ONE, 
  735. TXT_CMS_MMS_VIDEO_NOMUSIC, 
  736. IMAGE_PROMPT_ICON_ALERT,
  737. ALERT_TIMEOUT, 
  738. PNULL
  739. );
  740. }
  741. else
  742. {
  743. s_opt_menu_id = ID_MMS_EDIT_INSERT_MUSIC;
  744. MMK_CreateWin( (uint32*)MMIMMS_EDIT_SELECT_MUSIC_WIN_TAB, (ADD_DATA)win_id);
  745. }
  746.             break;
  747. case MMIMMS_EDITSIGN_VIDEO_CTRL_ID:
  748. if (p_sign_edit->slide_cur->image_flag == 1)
  749. {
  750. PUBWIN_OpenPromptAlertWin(
  751. PUBWIN_SOFTKEY_ONE, 
  752. TXT_CMS_MMS_PIC_NOVIDEO, 
  753. IMAGE_PROMPT_ICON_ALERT,
  754. ALERT_TIMEOUT, 
  755. PNULL
  756. );
  757. }
  758. else if (p_sign_edit->slide_cur->audiosize != 0)
  759. {
  760. PUBWIN_OpenPromptAlertWin(
  761. PUBWIN_SOFTKEY_ONE, 
  762. TXT_CMS_MMS_MUSIC_NOVIDEO, 
  763. IMAGE_PROMPT_ICON_ALERT,
  764. ALERT_TIMEOUT, 
  765. PNULL
  766. );
  767. }
  768. else if (p_sign_edit->slide_cur->video_flag==1)
  769. {
  770. s_opt_menu_id = ID_MMS_EDIT_DEL_VIDEO;
  771. PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
  772. }
  773. else 
  774. {
  775. s_opt_menu_id = ID_MMS_EDIT_INSERT_VIDEO;
  776. i_size_free = MMS_SIZE_OF_MESSAGE - p_sign_edit->totalsize;
  777. if (i_size_free <= 0)
  778. {
  779. i_size_free = 0;
  780. }
  781. //添加视频接口
  782. MMIMPEG4_SelectAndGetFile(i_size_free , win_id, 1);
  783. }
  784. break;
  785.         default:
  786.             break;
  787.         }
  788.         break;
  789. #ifdef HAVE_MPEG4
  790. case MSG_MPEG4_READ_FFS_DONE:
  791. SCI_ASSERT(param != NULL);
  792. SCI_TRACE_LOW("FNH enter MSG_MULTIM_SLEECTED_RETURN");
  793. mpeg4_return_info_ptr = (MMIMPEG4_BUFFER_FILE_INFO_T *)param;
  794. if ((PNULL == mpeg4_return_info_ptr->buf_ptr) || (0 == mpeg4_return_info_ptr->memory_size))
  795. {
  796. PUBWIN_OpenPromptAlertWin(
  797. PUBWIN_SOFTKEY_ONE, 
  798. TXT_MMS_EDIT_ADD_FAIL, 
  799. IMAGE_PROMPT_ICON_WRONG, 
  800. ALERT_TIMEOUT, 
  801. PNULL
  802. );
  803. break;
  804. }
  805. MMIMMS_DeleteCurVideo(p_sign_edit);
  806. SCI_MEMSET(&composer_video,0,sizeof(composer_video));
  807. composer_video.VidBuf = mpeg4_return_info_ptr->buf_ptr;
  808. composer_video.size = mpeg4_return_info_ptr->memory_size;
  809. SCI_TRACE_LOW("FNH composer_viedo.size = %d",composer_video.size);
  810. composer_video.Type = mpeg4_return_info_ptr->type;
  811. // composer_video.Type = "video/mpeg";
  812. SCI_TRACE_LOW("FNH before add video");
  813. MMIMMS_AddVideo(&composer_video,p_sign_edit);
  814. break;
  815. #endif
  816. #ifdef HAVE_MP3
  817. case MSG_MP3_READ_FFS_DONE:
  818. SCI_ASSERT(param != NULL);
  819. SCI_TRACE_LOW("FNH enter MSG_MULTIM_SLEECTED_RETURN");
  820. mp3_return_info_ptr = (MMIMP3_TETURN_INFO_T *)param;
  821. if (PNULL == mp3_return_info_ptr->buf_ptr)
  822. {
  823. PUBWIN_OpenPromptAlertWin(
  824. PUBWIN_SOFTKEY_ONE, 
  825. TXT_MMS_EDIT_ADD_FAIL, 
  826. IMAGE_PROMPT_ICON_WRONG, 
  827. ALERT_TIMEOUT, 
  828. PNULL
  829. );
  830. break;
  831. }
  832. MMS_DelAudio(p_sign_edit->slide_cur, p_sign_edit);
  833. //insert the audio
  834. composer_audio.AudBuf = mp3_return_info_ptr->buf_ptr;
  835. composer_audio.size = mp3_return_info_ptr->memory_size;
  836. composer_audio.Type = COMPOSER_AUDIO_MP3;
  837. SCI_TRACE_LOW("FNH get music composer_audio.size = %d",composer_audio.size);
  838. SCI_TRACE_LOW("FNH multim_return_info->type = %d",composer_audio.Type);
  839. MMIMMS_AddAudio(&composer_audio,p_sign_edit);
  840. break;
  841. #endif
  842.     case MSG_MULTIM_SELECTED_RETURN:
  843. SCI_TRACE_LOW("FNH enter MSG_MULTIM_SELECTED_RETURN");
  844. SCI_ASSERT(param != NULL);
  845. multim_return_info_ptr = (MMIMULTIM_SELECTED_RETURN_T *)param;
  846. if ((PNULL == multim_return_info_ptr->buf_ptr) || (0 == multim_return_info_ptr->memory_size))
  847. {
  848. if (s_opt_menu_id == ID_MMS_INSERT_DPIC || s_opt_menu_id ==ID_MMS_INSERT_PHOTO )
  849.             {
  850.     //alert : not supported image
  851.     PUBWIN_OpenPromptAlertWin(
  852.     PUBWIN_SOFTKEY_ONE, 
  853.     TXT_MMS_INVALID_PIC, 
  854.     IMAGE_PROMPT_ICON_WRONG, 
  855.     ALERT_TIMEOUT, 
  856.     PNULL
  857.     );
  858.             }
  859. else if (s_opt_menu_id == ID_MMS_EDIT_INSERT_MUSIC)
  860.             {
  861.                 //alert : not supported audio
  862.     PUBWIN_OpenPromptAlertWin(
  863.     PUBWIN_SOFTKEY_ONE, 
  864.     TXT_MMS_INVALID_AUDIO, 
  865.     IMAGE_PROMPT_ICON_WRONG, 
  866.     ALERT_TIMEOUT, 
  867.     PNULL
  868.     );
  869.             }
  870. break;
  871. }
  872. SCI_MEMSET(&composer_img, 0, sizeof(composer_img));
  873. SCI_MEMSET(&composer_audio, 0, sizeof(composer_audio));
  874. if (s_opt_menu_id == ID_MMS_INSERT_PHOTO || s_opt_menu_id == ID_MMS_INSERT_DPIC)
  875. {
  876. MMIMMS_DeleteCurImage(p_sign_edit);
  877. //insert the image
  878. composer_img.ImgBuf = multim_return_info_ptr->buf_ptr;
  879. composer_img.size = multim_return_info_ptr->memory_size;
  880. composer_img.Type = Edit_GetDeltaMMSImageType2(multim_return_info_ptr->type);
  881. composer_img.begin = 0;
  882. SCI_TRACE_LOW("FNH buf = %d,size = %d,type = %d",composer_img.ImgBuf,composer_img.size,multim_return_info_ptr->type);
  883. if (composer_img.Type != PNULL)
  884. {
  885. MMIMMS_AddImage(&composer_img,p_sign_edit);
  886. }
  887. else
  888. {
  889. //alert : not supported image
  890. PUBWIN_OpenPromptAlertWin(
  891. PUBWIN_SOFTKEY_ONE, 
  892. TXT_MMS_INVALID_PIC, 
  893. IMAGE_PROMPT_ICON_WRONG, 
  894. ALERT_TIMEOUT, 
  895. PNULL
  896. );
  897. }
  898. }
  899. else if (s_opt_menu_id == ID_MMS_EDIT_INSERT_MUSIC)
  900. {
  901. MMS_DelAudio(p_sign_edit->slide_cur, p_sign_edit);
  902. //insert the audio
  903. composer_audio.AudBuf = multim_return_info_ptr->buf_ptr;
  904. composer_audio.size = multim_return_info_ptr->memory_size;
  905. composer_audio.Type = Edit_GetDeltaMMSAudioType(multim_return_info_ptr->type);
  906. SCI_TRACE_LOW("FNH get music composer_audio.size = %d",multim_return_info_ptr->memory_size);
  907. SCI_TRACE_LOW("FNH multim_return_info->type = %d",multim_return_info_ptr->type);
  908. SCI_TRACE_LOW("FNH composer_audio.Type = %s",composer_audio.Type);
  909. if (composer_audio.Type != PNULL)
  910. {
  911. MMIMMS_AddAudio(&composer_audio,p_sign_edit);
  912. }
  913. else
  914. {
  915. //alert : not supported audio
  916. PUBWIN_OpenPromptAlertWin(
  917. PUBWIN_SOFTKEY_ONE, 
  918. TXT_MMS_INVALID_AUDIO, 
  919. IMAGE_PROMPT_ICON_WRONG, 
  920. ALERT_TIMEOUT, 
  921. PNULL
  922. );
  923. }
  924. }
  925. else
  926. {
  927. SCI_ASSERT(!"mmimms:Bad message.");
  928. }
  929. //free
  930. if (s_opt_menu_id != ID_MMS_INSERT_PHOTO)
  931. {
  932. if (multim_return_info_ptr->buf_ptr != PNULL)
  933. {
  934. cms_free(multim_return_info_ptr->buf_ptr);
  935. multim_return_info_ptr->buf_ptr = NULL;
  936. }
  937. }
  938. break;
  939. case MSG_MMS_CLOSE_PREVIEW_WAITING_WIN:
  940.         //create preview win
  941.         MMK_CreateWin( (uint32*)MMIMMS_EDIT_PREVIEW_TAB, (ADD_DATA)p_sign_edit);
  942.         //close waiting win
  943.         PUBWIN_ClosePromptAlertWin(); 
  944. // x_start = 0;
  945. // y_start = 0;
  946. // image_is_too_big = Preview_PlayCurrentSlide(p_sign_edit,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, TRUE,TRUE);
  947.         break;
  948. case MSG_APP_WEB:
  949. #ifdef HAVE_MPEG4
  950. #ifdef WIN32
  951. case MSG_APP_GREEN:
  952. #endif
  953. if (p_sign_edit->slide_cur->video_flag == 1)
  954. {
  955. T_Composer_Video  composer_video;
  956. SCI_MEMSET(&composer_video,0,sizeof(T_Composer_Video));
  957. if (MMIMMS_GetCurSlideVideo(&composer_video,p_sign_edit)!= -1)
  958. {
  959. SCI_TRACE_LOW("FNH size is %d,type is %d",composer_video.size,composer_video.Type);
  960. MMIMPEG4_playFromBuffer(composer_video.VidBuf,composer_video.size,composer_video.Type);
  961. }
  962. }
  963. #endif
  964. break;
  965. case MSG_SKB_ICON:
  966. if(MMI_SOFTKEYBAR_MIDDLE_ICON == (uint32) param)
  967. {
  968. PUBWIN_OpenPromptAlertWin(
  969.                 PUBWIN_SOFTKEY_ONE, 
  970.                 TXTSYS_WAITING, 
  971.                 IMAGE_PROMPT_ICON_WAIT,
  972.                 0, 
  973.                 PNULL
  974.                 );
  975. play_or_preview = MMS_PREVIEW;
  976. //post close waiting win message
  977. MMK_PostMsg(win_id, MSG_MMS_CLOSE_PREVIEW_WAITING_WIN, PNULL, 0);
  978. }
  979. break;
  980.       
  981.     case MSG_PROMPTWIN_OK:
  982. PUBWIN_ClosePromptQueryWin();
  983.         switch(s_opt_menu_id)
  984.         {
  985.         case ID_MMS_INSERT_DPIC:
  986.             //open insert image win
  987.             Edit_OpenInsertDpicWin(win_id);
  988.             break;
  989.             
  990.         case ID_MMS_INSERT_PHOTO:
  991.             //open insert image win
  992. MMIDC_OpenAlbumWinForMMS(MMS_MAX_SIZE_OF_MULTIM,win_id);
  993.             break;
  994.         case ID_MMS_EDIT_DEL_IMAGE:
  995.             //close prompt query win
  996. MMIMMS_DeleteCurImage(p_sign_edit);
  997.             MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
  998.             //alert: have been deleted
  999.             PUBWIN_OpenPromptAlertWin(
  1000.                     PUBWIN_SOFTKEY_ONE, 
  1001.                     TXT_MMS_DELED, 
  1002.                     IMAGE_PROMPT_ICON_SUCCESS,
  1003.                     ALERT_TIMEOUT, 
  1004.                     PNULL
  1005.                     );            
  1006.             break;
  1007.         
  1008.         case ID_MMS_EDIT_INSERT_MUSIC:            
  1009.             //open insert music window
  1010.             Edit_OpenInsertDringWin(win_id);
  1011.             break;
  1012.         case ID_MMS_EDIT_DEL_MUSIC:
  1013.             //close prompt query win
  1014. if (p_sign_edit->slide_cur->audiosize > 0)
  1015. MMS_DelAudio(p_sign_edit->slide_cur, p_sign_edit);
  1016.             MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
  1017.             //alert: have been deleted
  1018.             PUBWIN_OpenPromptAlertWin(
  1019.                     PUBWIN_SOFTKEY_ONE, 
  1020.                     TXT_MMS_DELED, 
  1021.                     IMAGE_PROMPT_ICON_SUCCESS,
  1022.                     ALERT_TIMEOUT, 
  1023.                     PNULL
  1024.                     );
  1025.             break;
  1026. case ID_MMS_EDIT_DEL_VIDEO:
  1027. #ifdef HAVE_MPEG4
  1028. MMIMMS_DeleteCurVideo(p_sign_edit);
  1029. MMK_SendMessage(PNULL, MSG_FULL_PAINT, PNULL);
  1030. //alert: have been deleted
  1031. PUBWIN_OpenPromptAlertWin(
  1032. PUBWIN_SOFTKEY_ONE, 
  1033. TXT_MMS_DELED, 
  1034. IMAGE_PROMPT_ICON_SUCCESS,
  1035. ALERT_TIMEOUT, 
  1036. PNULL
  1037. );
  1038. #endif
  1039. break;
  1040. case ID_MMS_EDIT_CLOSE_SAVE:
  1041. MMIMMS_CreateSaveMMSWaitingWin();
  1042. MMIMMS_SaveAutoSignMessage(p_sign_edit);
  1043. MMK_CloseWin(win_id);
  1044. break;
  1045.         default:
  1046.             break;
  1047.         }
  1048.         
  1049.         break;
  1050.     case MSG_PROMPTWIN_CANCEL:
  1051.         //close query window
  1052.         PUBWIN_ClosePromptQueryWin();
  1053.         if(s_opt_menu_id == ID_MMS_EDIT_CLOSE_SAVE)
  1054. {
  1055. if (p_sign_edit != NULL)
  1056. {
  1057. SCI_TRACE_LOW("FNH before MSG_PROMPTWIN_CANCEL free p_cur_edit");
  1058. MMSDelDocument(p_sign_edit);
  1059. p_sign_edit = NULL;
  1060. g_pcur_signdoc = NULL;
  1061. }
  1062. MMK_CloseWin(win_id);
  1063. }
  1064.         break;
  1065. case MSG_APP_CANCEL:
  1066.     case MSG_CTL_CANCEL:
  1067. s_opt_menu_id = ID_MMS_EDIT_CLOSE_SAVE;
  1068.         PUBWIN_OpenPromptQueryWin(TXT_MMS_SAVE, IMAGE_PROMPT_ICON_QUERY);
  1069.         break;
  1070. case MSG_APP_OK:
  1071.     case MSG_CTL_OK:
  1072. MMIMMS_CreateSaveMMSWaitingWin();
  1073. MMIMMS_SaveAutoSignMessage(p_sign_edit);
  1074. MMK_CloseWin(win_id);
  1075.         break;
  1076. case MSG_CLOSE_WINDOW:
  1077. SCI_TRACE_LOW("FNH In close window before stop ring");
  1078. // MMIPROFILE_StopRing(RING_STA_OTHER);
  1079. SCI_TRACE_LOW("FNH after stop ring");
  1080. break;
  1081.         
  1082.     default:
  1083.         err_code = MMI_RESULT_FALSE;
  1084.         break;
  1085.     }
  1086.     
  1087.     return err_code;
  1088. }
  1089. /******************************************************************************
  1090.  * 函数定义: cms_mms_judge_date
  1091.  * 函数说明:    将输入的日期与系统时间比较
  1092.  * 参数说明: year: 年份
  1093.   month: 月
  1094.   day :     日期
  1095.  * 返回值: int16 
  1096. ********************************************************************************/
  1097. int16 cms_mms_judge_date(uint16 year,uint8 month,uint8 day)
  1098. {
  1099. SCI_DATE_T  sys_date;
  1100. if ((0 == month) || (12 < month))//check month
  1101. {
  1102.         return 0;
  1103.     }
  1104. switch(month)
  1105. {
  1106.     case MMISET_DATE_JAN:
  1107.     case MMISET_DATE_MAR:
  1108.     case MMISET_DATE_MAY:
  1109.     case MMISET_DATE_JUL:
  1110.     case MMISET_DATE_AUG:
  1111.     case MMISET_DATE_OCT:
  1112.     case MMISET_DATE_DEC:
  1113.         //check big month
  1114.         if ((0 == day) || (MMISET_DATE_BIG_MONTH_DAY < day))
  1115.         {
  1116.             return 0;
  1117.         }
  1118.         break;
  1119.     case MMISET_DATE_APR:
  1120.     case MMISET_DATE_JUN:
  1121.     case MMISET_DATE_SEP:
  1122.     case MMISET_DATE_NOV:
  1123.         //check small month
  1124.         if ((0 == day) || (MMISET_DATE_SMALL_MONTH_DAY < day))
  1125.         {
  1126.             return 0;
  1127.         }
  1128.         break;
  1129.     case MMISET_DATE_FEB:
  1130.         if ((!(year % 4) && (year % 100)) || !(year % 400))
  1131.         {
  1132.             //check leap month
  1133.             if ((0 == day) || (MMISET_DATE_LEAP_MONTH_DAY < day))
  1134.             {
  1135.                 return 0;
  1136.             }
  1137.         }
  1138.         else
  1139.         {
  1140.             //check not leap month
  1141.             if ((0 == day) || (MMISET_DATE_NOT_LEAP_MONTH_DAY < day))
  1142.             {
  1143.                 return 0;
  1144.             }
  1145.         }
  1146.         break;
  1147.     default:
  1148.         SCI_TRACE_HIGH("CheckDayOfDateIsValid:date.date_month = %d is error!",month);
  1149.         break;
  1150. }
  1151. TM_GetSysDate(&sys_date);
  1152. if (year < sys_date.year)
  1153. {
  1154. return 0;
  1155. }
  1156. else if (year == sys_date.year)
  1157. {
  1158. if (month < sys_date.mon)
  1159. {
  1160. return 0;
  1161. }
  1162. else if (month == sys_date.mon)
  1163. {
  1164. if (day < sys_date.mday)
  1165. {
  1166. return 0;
  1167. }
  1168. }
  1169. }
  1170. return 1;
  1171. }
  1172. /******************************************************************************
  1173.  * 函数定义: cms_mms_judge_time
  1174.  * 函数说明:    将输入的时间与系统时间比较
  1175.  * 参数说明: hour: 小时
  1176.   minute: 分钟
  1177.  * 返回值: int16 
  1178. ********************************************************************************/
  1179. int16 cms_mms_judge_time(uint8 hour,uint8 minute)
  1180. {
  1181.   SCI_TIME_T sys_time;
  1182.     if (59 < minute)
  1183.     {
  1184.         return 0;
  1185.     }
  1186.     else
  1187.     {
  1188.         //check the time of 24 Hour if is valid,check the hour
  1189.         if (24 <= hour)
  1190.         {
  1191.             return 0;
  1192.         }
  1193.     }
  1194. TM_GetSysTime(&sys_time);
  1195. if (hour < sys_time.hour)
  1196. {
  1197. return 0;
  1198. }
  1199. else if ( hour == sys_time.hour)
  1200. {
  1201. if (minute < sys_time.min)
  1202. {
  1203. return 0;
  1204. }
  1205. }
  1206. return 1;
  1207. }
  1208. /* ----------------------------------------------------------------------------
  1209. * Function Name: Edit_HandleMMSSetSendDateWin
  1210. * Purpose: 设置发送日期窗口
  1211. * Input: win_id:窗口ID,
  1212.  msg_Id:消息ID,
  1213.  param:窗口参数
  1214. * Returns: MMI_RESULT_E
  1215. * Author:nihongf@mobilesoft.com.cn
  1216. * ----------------------------------------------------------------------------*/ 
  1217. LOCAL MMI_RESULT_E  Edit_HandleMMSSetSendDateWin(
  1218. MMS_WINDOW_ID_E win_id, 
  1219. MMI_MESSAGE_ID_E msg_id, 
  1220. DPARAM param
  1221. )
  1222. {
  1223.     MMI_RESULT_E    recode = MMI_RESULT_TRUE;
  1224.     SCI_DATE_T      sys_date;
  1225. SCI_TIME_T      sys_time;
  1226.     switch (msg_id)
  1227.     {
  1228.     case MSG_OPEN_WINDOW:
  1229. {
  1230. //设置输入time or date背景色
  1231. if (g_set_date.year == 0)
  1232. {
  1233. TM_GetSysDate(&sys_date);
  1234. GUIEDITBOX_SetDateEditBoxStringInfo(MMIMMS_SET_SEND_DATE_CTRL_ID,sys_date.year,sys_date.mon,sys_date.mday,YEAR_MONTH_DAY_TYPE);
  1235. }
  1236. else 
  1237. {
  1238. GUIEDITBOX_SetDateEditBoxStringInfo(MMIMMS_SET_SEND_DATE_CTRL_ID,g_set_date.year,g_set_date.month,g_set_date.day,YEAR_MONTH_DAY_TYPE);
  1239. }
  1240. if (g_set_date.hour == 0)
  1241.   {
  1242. //get current system time
  1243. TM_GetSysTime(&sys_time);
  1244. GUIEDITBOX_SetTimeEditBoxStringInfo(MMIMMS_SET_SEND_TIME_CTRL_ID,sys_time.hour,sys_time.min,TIME_TWENTYFOUR_TYPE);
  1245.   }
  1246. else 
  1247. {
  1248. GUIEDITBOX_SetTimeEditBoxStringInfo(MMIMMS_SET_SEND_TIME_CTRL_ID,g_set_date.hour,g_set_date.minute,TIME_TWENTYFOUR_TYPE);
  1249. }
  1250. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  1251. MMK_SetAtvCtrl(win_id,MMIMMS_SET_SEND_DATE_CTRL_ID);
  1252. }
  1253.         break;
  1254.     case MSG_FULL_PAINT:
  1255. MMIMMS_CLEAR_CLIENT();
  1256. break;
  1257. case MSG_APP_OK:
  1258.     case MSG_CTL_OK:
  1259. {
  1260. uint16 year;
  1261. uint8 month;
  1262. uint8 day;
  1263. GUIEDITBOX_GetDateEditBoxInfo(MMIMMS_SET_SEND_DATE_CTRL_ID,&year,&month,&day);
  1264. if (cms_mms_judge_date(year,month,day) == 0)
  1265. {
  1266. PUBWIN_OpenPromptAlertWin(
  1267. PUBWIN_SOFTKEY_ONE, 
  1268. TXT_MMS_INPUT_ERROR, 
  1269. IMAGE_PROMPT_ICON_ALERT,
  1270. ALERT_TIMEOUT, 
  1271. PNULL
  1272. );
  1273. }
  1274. else
  1275. {
  1276. uint8 hour;
  1277. uint8 minute;
  1278. SCI_DATE_T sys_date;
  1279. g_set_date.year = year;
  1280. g_set_date.month = month;
  1281. g_set_date.day = day;
  1282. GUIEDITBOX_GetTimeEditBoxInfo(MMIMMS_SET_SEND_TIME_CTRL_ID,&hour,&minute);
  1283. TM_GetSysDate(&sys_date);
  1284. if ((g_set_date.year==sys_date.year) && (g_set_date.month == sys_date.mon) && (g_set_date.day == sys_date.mday))
  1285. {
  1286. if (cms_mms_judge_time(hour,minute) == 0)
  1287. {
  1288. PUBWIN_OpenPromptAlertWin(
  1289. PUBWIN_SOFTKEY_ONE, 
  1290. TXT_MMS_INPUT_ERROR, 
  1291. IMAGE_PROMPT_ICON_ALERT,
  1292. ALERT_TIMEOUT, 
  1293. PNULL
  1294. );
  1295. break;
  1296. }
  1297. }
  1298. else
  1299. {
  1300. if (hour>=24 || minute>59)
  1301. {
  1302. PUBWIN_OpenPromptAlertWin(
  1303. PUBWIN_SOFTKEY_ONE, 
  1304. TXT_MMS_INPUT_ERROR, 
  1305. IMAGE_PROMPT_ICON_ALERT,
  1306. ALERT_TIMEOUT, 
  1307. PNULL
  1308. );
  1309. break;
  1310. }
  1311. }
  1312. g_set_date.hour = hour;
  1313. g_set_date.minute = minute;
  1314. PUBWIN_OpenPromptAlertWin(
  1315. PUBWIN_SOFTKEY_ONE, 
  1316. TXT_MMS_EDIT_SET_OK, 
  1317. IMAGE_PROMPT_ICON_ALERT,
  1318. ALERT_TIMEOUT, 
  1319. PNULL
  1320. );
  1321. // MMK_CreateWin((uint32*)MMIMMS_EDIT_SET_SEND_TIME_TAB,NULL);
  1322.            MMK_CloseWin(win_id);
  1323. }
  1324.      }
  1325.         break;
  1326. case MSG_APP_CANCEL:
  1327.     case MSG_CTL_CANCEL:
  1328. MMK_CloseWin(win_id);      
  1329. break;
  1330.     default:
  1331.         recode = MMI_RESULT_FALSE;
  1332.         break;
  1333.     }
  1334.     return recode;
  1335. }
  1336. /******************************************************************************
  1337.  * 函数定义: MmsDelReceiver
  1338.  * 函数说明:   删除所有收件人
  1339.  * 参数说明: p_receiver: 收件人列表
  1340.  
  1341.  * 返回值: int16 
  1342. ********************************************************************************/
  1343. int16 MmsDelReceiver(p_MMS_RECEPIENT p_receiver)
  1344. {
  1345. int32 number = 0;
  1346. int32 i = 0;
  1347. p_MMS_RECEPIENT p_temp = NULL;
  1348. p_MMS_RECEPIENT p_temp_receiver = NULL;
  1349. p_MMS_RECEPIENT p_temp_next = NULL;
  1350. p_temp_receiver = p_receiver;
  1351. number = MmsGetReceiverCount(p_temp_receiver);
  1352. if(number == 0 )
  1353. {
  1354. return -1;
  1355. }
  1356. if(number == 1)
  1357. {
  1358. cms_free(p_temp_receiver);
  1359. p_temp_receiver = NULL;
  1360. return 0;
  1361. }
  1362. for (i=0;i<number-1;i++)
  1363. {
  1364. p_temp = p_temp_receiver;
  1365. p_temp_next = p_temp_receiver->p_next;
  1366. cms_free(p_temp);
  1367. p_temp = NULL;
  1368. p_temp_receiver = p_temp_next;
  1369. }
  1370. return 0;
  1371. }
  1372. /******************************************************************************
  1373.  * 函数定义: MmsDelOneReceiver
  1374.  * 函数说明:    删除一个收件人
  1375.  * 参数说明: p_receiver: 收件人列表
  1376.   p_del: 待删除的地址
  1377.  * 返回值: int16 
  1378. ********************************************************************************/
  1379. int16 MmsDelOneReceiver(p_MMS_RECEPIENT* p_receiver,void* p_del)
  1380. {
  1381. int32 number = 0;
  1382. p_MMS_RECEPIENT p_temp = NULL;
  1383. p_MMS_RECEPIENT p_temp_receiver = NULL;
  1384. int16   result  = 0;
  1385. p_temp_receiver = *p_receiver;
  1386. number = MmsGetReceiverCount(p_temp_receiver);
  1387. SCI_ASSERT(p_del != NULL);
  1388. if(number == 0 )
  1389. {
  1390. result = -1;
  1391. return result;
  1392. }
  1393. if((p_del == p_temp_receiver )&&(number == 1))
  1394. {
  1395. cms_free(p_temp_receiver);
  1396. p_temp_receiver = NULL;
  1397. *p_receiver = NULL;
  1398. result = 0;
  1399. return result;
  1400. }
  1401. if(number>=2)
  1402. {
  1403. /*开头为待删除节点*/
  1404. if(p_del == p_temp_receiver)
  1405. {
  1406. p_temp_receiver = p_temp_receiver->p_next;
  1407. *p_receiver = p_temp_receiver;
  1408. cms_free(p_del);
  1409. number = number - 1;
  1410. result = number;
  1411. return result;
  1412. }
  1413. /*中间为待删除节点*/
  1414. for(p_temp=p_temp_receiver;p_temp; p_temp=p_temp->p_next)
  1415. {
  1416. if(p_temp->p_next == p_del)
  1417. {
  1418. if(p_temp->p_next->p_next != NULL)
  1419. {
  1420. p_temp->p_next = p_temp->p_next->p_next;
  1421. }
  1422. else
  1423. {
  1424. p_temp->p_next = NULL;
  1425. }
  1426. cms_free(p_del);
  1427. *p_receiver = p_temp_receiver;
  1428. break;
  1429. }
  1430. }
  1431. result = number-1;
  1432. return result;
  1433. }
  1434. return result;
  1435. }
  1436. /*****************************************************************************/
  1437. //  Description : 预览界面的向上按钮回调函数
  1438. //  Global resource dependence : 
  1439. //  Author:yuhua.shi
  1440. //  Note:
  1441. /*****************************************************************************/
  1442. LOCAL MMI_RESULT_E Edit_PreviewUpButtonCallBack( void )
  1443. {
  1444.   MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_APP_UP, PNULL);
  1445.   MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
  1446.   return MMI_RESULT_TRUE;
  1447. }
  1448. /*****************************************************************************/
  1449. //  Description : 预览界面的向下按钮回调函数
  1450. //  Global resource dependence : 
  1451. //  Author:Bill.Ji
  1452. //  Note:
  1453. /*****************************************************************************/
  1454. LOCAL MMI_RESULT_E Edit_PreviewDownButtonCallBack( void )
  1455. {
  1456.   MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_APP_DOWN, PNULL);
  1457.   MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
  1458.   return MMI_RESULT_TRUE;
  1459. }
  1460. /*****************************************************************************/
  1461. //  Description : 预览界面的向左按钮回调函数
  1462. //  Global resource dependence : 
  1463. //  Author:Bill.Ji
  1464. //  Note:
  1465. /*****************************************************************************/
  1466. LOCAL MMI_RESULT_E Edit_PreviewLeftButtonCallBack( void )
  1467. {
  1468.   MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_APP_LEFT, PNULL);
  1469.   MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
  1470.   return MMI_RESULT_TRUE;
  1471. }
  1472. /*****************************************************************************/
  1473. //  Description : 预览界面的向右按钮回调函数
  1474. //  Global resource dependence : 
  1475. //  Author:Bill.Ji
  1476. //  Note:
  1477. /*****************************************************************************/
  1478. LOCAL MMI_RESULT_E Edit_PreviewRightButtonCallBack( void )
  1479. {
  1480.   MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_APP_RIGHT, PNULL);
  1481.   MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
  1482.   return MMI_RESULT_TRUE;
  1483. }
  1484. /*****************************************************************************/
  1485. //  Description : 预览界面的停止播放按钮回调函数
  1486. //  Global resource dependence : 
  1487. //  Author:Bill.Ji
  1488. //  Note:
  1489. /*****************************************************************************/
  1490. LOCAL MMI_RESULT_E Edit_PreviewPlayButtonCallBack( void )
  1491. {
  1492.   Edit_HandlePreviewMMSMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_CTL_OK, PNULL);
  1493.   MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
  1494.   return MMI_RESULT_TRUE;
  1495. }
  1496. /******************************************************************************
  1497.  * 函数定义: Edit_HandlePreviewMMSMsg
  1498.  * 函数说明:    mms预览或者播放的窗口处理
  1499.  * 参数说明: win_id:窗口ID
  1500.   msg_Id:消息ID
  1501.   param:窗口参数
  1502.  * 返回值: 空 
  1503. ********************************************************************************/
  1504. LOCAL MMI_RESULT_E  Edit_HandlePreviewMMSMsg(
  1505. MMS_WINDOW_ID_E win_id, 
  1506. MMI_MESSAGE_ID_E msg_id, 
  1507. DPARAM param
  1508. )
  1509. {
  1510. static MMIMMS_PREVIEW_STATE s_edit_mms_preview_state;
  1511.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  1512. // uint8 timer_id = MMI_MMS_PREVIEW_TIMER_ID;
  1513. uint32 duaration = 0;
  1514. MMS_CONTROL_ID_E anim_ctrl_id = MMIMMS_EDIT_IMAGE_PREVIEW_CTRL_ID;
  1515. MMS_CONTROL_ID_E editbox_ctrl_id = MMIMMS_EDIT_TEXT_PREVIEW_CTRL_ID;
  1516. static int x_start = 0; //x_start is always zero
  1517. static int y_start = 0; //y_start base is TITLE_HEIGHT
  1518. static T_WORD slide_num_save = 0;
  1519. static T_WORD slide_num_lose_focus = 0;
  1520. ANIMATE_IMAGE_TYPE_E   image_type = 0;
  1521. uint16 image_height = 0;
  1522. uint16 image_width = 0;
  1523. uint16 text_height = 0;
  1524. static BOOLEAN b_isFirst = FALSE;
  1525. MMIMMS_EDIT_PREVIEW_FROM edit_preview_from = MMIMMS_EDIT_PREVIEW_FROM_MMS;
  1526. BOOLEAN is_new_slide = FALSE;
  1527. static BOOLEAN image_is_too_big = FALSE;
  1528. MMI_STRING_T         text_str;
  1529.     uint32                  button_index = 0;
  1530. static pMMS_EDocument p_cur_edoc = NULL;
  1531. SCI_TRACE_LOW("FNH enter preview mms");
  1532.     switch(msg_id)
  1533.     {
  1534.     case MSG_FULL_PAINT:
  1535. SCI_TRACE_LOW("FNH PREVIEW MMS MSG_FULL_PAINT!");
  1536. if ((image_is_too_big) &&(b_isFirst))
  1537. {
  1538. PUBWIN_OpenPromptAlertWin(PUBWIN_SOFTKEY_ONE,TXT_DC_PICTOO_LARGE,IMAGE_PROMPT_ICON_ALERT,MMI_1SECONDS,PNULL);
  1539. image_is_too_big = FALSE;
  1540. }
  1541. b_isFirst = FALSE;
  1542. Preview_DispSlideNum(MMIMMS_EDIT_PREVIEW_LABEL_CTRL_ID,p_cur_edoc);
  1543.         if(MMIMMS_PREVIEW_PLAYING == s_edit_mms_preview_state )
  1544.         {
  1545.             MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_MIDDLE_ICON, IMAGE_MMS_PREVIEW_PAUSE,IMAGE_MMS_PREVIEW_PAUSE,COMMON_IMAGE_NULL, TRUE);        
  1546.         }
  1547.         else
  1548.         {
  1549.             MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_MIDDLE_ICON, IMAGE_MMS_PREVIEW_PLAY,IMAGE_MMS_PREVIEW_PLAY,COMMON_IMAGE_NULL, TRUE);
  1550.         }
  1551. break;
  1552.     case MSG_OPEN_WINDOW:
  1553. SCI_TRACE_LOW("FNH enter Preview MSG_OPEN_WINDOW");
  1554.         MMK_SetWinSoftkeyId(win_id, TXT_CMS_MMS_VEDIO, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  1555.         MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_LEFT_ICON, IMAGE_PICTURE_PREV_PAGE_ON,IMAGE_PICTURE_PREV_PAGE_OFF,COMMON_IMAGE_NULL, TRUE);
  1556.         MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_MIDDLE_ICON, IMAGE_MMS_PREVIEW_PAUSE,IMAGE_MMS_PREVIEW_PAUSE,COMMON_IMAGE_NULL, TRUE);
  1557.         MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_RIGHT_ICON, IMAGE_PICTURE_NEXT_PAGE_ON,IMAGE_PICTURE_NEXT_PAGE_OFF,COMMON_IMAGE_NULL, TRUE);
  1558.        
  1559.         GUIBUTTON_SetCallBackFuction(MMIMMS_EDIT_PREVIEW_LEFT_BUTTON_CTRL_ID, 
  1560.                                      MSG_TP_PRESS_UP, Edit_PreviewUpButtonCallBack);
  1561.         GUIBUTTON_SetCallBackFuction(MMIMMS_EDIT_PREVIEW_RIGHT_BUTTON_CTRL_ID, 
  1562.                                      MSG_TP_PRESS_UP, Edit_PreviewDownButtonCallBack);
  1563.         GUILABEL_SetFontParam(MMIMMS_EDIT_PREVIEW_LABEL_CTRL_ID, MMI_LISTNUM_FONT, MMI_BLACK_COLOR, 0);
  1564. p_cur_edoc = (pMMS_EDocument)(MMK_GetWinAddDataPtr(win_id));
  1565.         //save the slide numver
  1566. slide_num_save = MMSGetSlideIndex(p_cur_edoc);
  1567. SCI_TRACE_LOW("FNH Preview MSG_OPEN_WINDOW: before goto first");
  1568.         
  1569.         //go to the 1st slide and start timer
  1570.         while(MMSGetSlideIndex(p_cur_edoc) != 1)
  1571. {
  1572. MMS_PrevSlide(p_cur_edoc);
  1573. }
  1574. SCI_TRACE_LOW("FNH Preview MSG_OPEN_WINDOW: after goto first");
  1575.         
  1576.         //then state changes to playing. this is its entrance
  1577.         s_edit_mms_preview_state = MMIMMS_PREVIEW_PLAYING;
  1578.         
  1579.         //play first slide
  1580.         x_start = 0;
  1581.         y_start = 0;
  1582.         //disable text scroll bar
  1583.         GUITEXTBOX_EnableScrollbar(editbox_ctrl_id, FALSE);
  1584. image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, TRUE,TRUE);
  1585. b_isFirst = TRUE;
  1586. SCI_TRACE_LOW("FNH b_isFirst = %d",b_isFirst);
  1587.         //start slide timer
  1588.         duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
  1589.         g_mmimms_preview_timer_id = MMK_CreateWinTimer(win_id, duaration * ONE_KILO, FALSE);
  1590.         break;
  1591. case MSG_GET_FOCUS:
  1592. SCI_TRACE_LOW("FNH enter Preview msg_get_focus");
  1593. if(MMIMMS_PREVIEW_PLAYING == s_edit_mms_preview_state )
  1594.         {
  1595.             MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_MIDDLE_ICON, IMAGE_MMS_PREVIEW_PAUSE,IMAGE_MMS_PREVIEW_PAUSE,COMMON_IMAGE_NULL, TRUE);        
  1596.         }
  1597.         else
  1598.         {
  1599.             MMK_SetWinSKBButton(win_id, MMI_SOFTKEYBAR_MIDDLE_ICON, IMAGE_MMS_PREVIEW_PLAY,IMAGE_MMS_PREVIEW_PLAY,COMMON_IMAGE_NULL, TRUE);
  1600.         }
  1601.     
  1602. //according to the former status, resume the timer, or not
  1603. switch(s_edit_mms_preview_state)
  1604. {
  1605. case MMIMMS_PREVIEW_LEAVE:
  1606. is_new_slide = FALSE;
  1607. break;
  1608. case MMIMMS_PREVIEW_PLAYING:
  1609. //start the former timer from beginning
  1610. duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
  1611.             g_mmimms_preview_timer_id = MMK_CreateWinTimer(win_id, duaration * ONE_KILO, FALSE);
  1612. is_new_slide = FALSE;
  1613. break;
  1614. case MMIMMS_PREVIEW_STOP:
  1615. //don't start the timer
  1616. is_new_slide = FALSE;
  1617. break;
  1618. default:
  1619. SCI_TRACE_LOW("Edit_HandlePreviewMMSMsg MSG_GET_FOCUS default");
  1620. break;
  1621. }
  1622. //preview current slide
  1623. x_start = 0;
  1624. y_start = 0;
  1625. 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);
  1626. SCI_TRACE_LOW("FNH image_is_too_big is %d",image_is_too_big);
  1627. MMITHEME_SetUpdateDelayCount(1);
  1628.         break;
  1629. case MSG_LOSE_FOCUS:
  1630. SCI_TRACE_LOW("fnh enter MSG_LOSE_FOCUS");
  1631. //save current slide number
  1632. slide_num_lose_focus = MMSGetSlideIndex(p_cur_edoc);
  1633. //don't change the state
  1634. // MmsStopPreviewRing();   
  1635. //        s_edit_mms_preview_state = MMIMMS_PREVIEW_STOP;
  1636. //stop timer
  1637. MMK_StopTimer(g_mmimms_preview_timer_id);
  1638.         g_mmimms_preview_timer_id = 0;
  1639. break;
  1640. case MSG_TIMER:
  1641. if (g_mmimms_preview_timer_id == *((uint8 *) param))
  1642. {
  1643. switch(s_edit_mms_preview_state)
  1644. {
  1645. case MMIMMS_PREVIEW_LEAVE:
  1646. SCI_ASSERT(FALSE);
  1647. break;
  1648. case MMIMMS_PREVIEW_PLAYING:
  1649. //stop ring
  1650. MmsStopPreviewRing();
  1651. if (MMK_IsFocusWin(MMIMMS_EDIT_PREVIEW_WIN_ID))
  1652. {
  1653. //if it is the last slide, stop the timer
  1654. if (Edit_isLastSlide(p_cur_edoc))
  1655. {
  1656. //stop the timer
  1657. MMK_StopTimer(g_mmimms_preview_timer_id);
  1658. g_mmimms_preview_timer_id = 0;
  1659. s_edit_mms_preview_state = MMIMMS_PREVIEW_STOP;
  1660. //set soft key to NULL
  1661. // MMK_SetWinSoftkeyId(win_id, TXT_NULL, TXT_NULL, STXT_RETURN, TRUE);
  1662. //change the state to stop
  1663. // s_edit_mms_preview_state = MMIMMS_PREVIEW_STOP;
  1664. }
  1665. else
  1666. {
  1667. //go next slide
  1668. MMS_NextSlide(p_cur_edoc);
  1669. //display slide
  1670. x_start = 0;
  1671. y_start = 0;
  1672. image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, FALSE,TRUE);
  1673. //stop old timer
  1674. MMK_StopTimer(g_mmimms_preview_timer_id);
  1675. g_mmimms_preview_timer_id = 0;
  1676. //create new timer
  1677. duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
  1678. g_mmimms_preview_timer_id = MMK_CreateWinTimer(win_id, duaration * ONE_KILO, FALSE);
  1679. if (image_is_too_big)
  1680. {
  1681. PUBWIN_OpenPromptAlertWin(PUBWIN_SOFTKEY_ONE,TXT_DC_PICTOO_LARGE,IMAGE_PROMPT_ICON_ALERT,MMI_1SECONDS,PNULL);
  1682. image_is_too_big = FALSE;
  1683. }
  1684. }
  1685. }
  1686. else
  1687. {
  1688. //stop the timer
  1689. MMK_StopTimer(g_mmimms_preview_timer_id);
  1690. g_mmimms_preview_timer_id = 0;
  1691. //set soft key to NULL
  1692. // MMK_SetWinSoftkeyId(win_id, TXT_MMS_PLAY, TXT_NULL, STXT_RETURN, TRUE);
  1693. //change the state to stop
  1694. s_edit_mms_preview_state = MMIMMS_PREVIEW_STOP;
  1695. }
  1696. break;
  1697. case MMIMMS_PREVIEW_STOP:
  1698. SCI_ASSERT(FALSE);
  1699. break;
  1700. default:
  1701. SCI_ASSERT(FALSE);
  1702. break;
  1703. }
  1704. MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
  1705. }
  1706. break;
  1707. case MSG_SKB_ICON:
  1708.         button_index = (uint32) param;
  1709.         switch(button_index)    
  1710.         {
  1711.            case MMI_SOFTKEYBAR_LEFT_ICON:
  1712.                   Edit_PreviewLeftButtonCallBack();
  1713.                break;
  1714.                 
  1715.            case MMI_SOFTKEYBAR_MIDDLE_ICON:
  1716.                   Edit_PreviewPlayButtonCallBack();
  1717.                break;
  1718.                 
  1719.            case MMI_SOFTKEYBAR_RIGHT_ICON:
  1720.   Edit_PreviewRightButtonCallBack();
  1721.                   break;
  1722.            default:
  1723.                SCI_ASSERT(0);
  1724.                break;           
  1725.          }
  1726.          break;
  1727. case MSG_APP_WEB:
  1728. #ifdef HAVE_MPEG4
  1729. #ifdef WIN32
  1730. case MSG_APP_GREEN:
  1731. #endif
  1732. if (p_cur_edoc->slide_cur->video_flag == 1)
  1733. {
  1734. T_Composer_Video  composer_video;
  1735. if (s_edit_mms_preview_state == MMIMMS_PREVIEW_PLAYING)
  1736. {
  1737. // MMK_SetWinSoftkeyId(win_id, TXT_MMS_PLAY, TXT_BROWSE, STXT_RETURN, TRUE);
  1738. //stop old timer
  1739. MMK_StopTimer(g_mmimms_preview_timer_id);
  1740.                 g_mmimms_preview_timer_id = 0;
  1741. }
  1742. SCI_MEMSET(&composer_video,0,sizeof(T_Composer_Video));
  1743. if (MMIMMS_GetCurSlideVideo(&composer_video,p_cur_edoc)!= -1)
  1744. {
  1745. MMIMPEG4_playFromBuffer(composer_video.VidBuf,composer_video.size,composer_video.Type);
  1746. }
  1747. }
  1748. #endif
  1749. break;
  1750. case MSG_APP_OK:
  1751. SCI_TRACE_LOW("FNH IN PREVIEW MMS MSG_APP_OK!");
  1752. if (p_cur_edoc->slide_cur->video_flag == 1)
  1753. {
  1754. MMK_SendMsg(MMIMMS_EDIT_PREVIEW_WIN_ID, MSG_APP_WEB, PNULL);
  1755. }
  1756. break;
  1757. case MSG_CTL_OK:
  1758. switch(s_edit_mms_preview_state)
  1759. {
  1760. case MMIMMS_PREVIEW_LEAVE:
  1761. SCI_ASSERT(FALSE);
  1762. break;
  1763. case MMIMMS_PREVIEW_PLAYING:
  1764. SCI_TRACE_LOW("fnh enter app_ok preview_playing");
  1765. //stop ring
  1766. MmsStopPreviewRing();//nihongf modify2005-12-19
  1767. if (Edit_isLastSlide(p_cur_edoc))
  1768. {
  1769. SCI_TRACE_LOW("fnh enter app_ok preview_playing Edit_isLastSlide");
  1770. //stop timer
  1771. MMK_StopTimer(g_mmimms_preview_timer_id);
  1772.                 g_mmimms_preview_timer_id = 0;
  1773. //change state
  1774. s_edit_mms_preview_state = MMIMMS_PREVIEW_STOP;
  1775. }
  1776. else
  1777. {
  1778. SCI_TRACE_LOW("fnh enter app_ok preview_playing not Edit_isLastSlide");
  1779. MMK_StopTimer(g_mmimms_preview_timer_id);
  1780.                 g_mmimms_preview_timer_id = 0;
  1781. //change state to STOP
  1782. s_edit_mms_preview_state = MMIMMS_PREVIEW_STOP;
  1783. }
  1784. break;
  1785. case MMIMMS_PREVIEW_STOP:
  1786. SCI_TRACE_LOW("fnh enter app_ok preview_STOP");
  1787. //stop ring
  1788. MmsStopPreviewRing();
  1789. //if it is the last slide, ignore it
  1790. if (Edit_isLastSlide(p_cur_edoc))
  1791. {
  1792. SCI_TRACE_LOW("fnh enter app_ok preview_STOP Edit_isLastSlide");
  1793. x_start = 0;
  1794. y_start = 0;
  1795. image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, FALSE,TRUE);
  1796. //modify softkey
  1797. s_edit_mms_preview_state = MMIMMS_PREVIEW_PLAYING;
  1798. }
  1799. else
  1800. {
  1801. SCI_TRACE_LOW("fnh enter app_ok preview_STOP not Edit_isLastSlide");
  1802. //start timer
  1803. duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
  1804. g_mmimms_preview_timer_id = MMK_CreateWinTimer(win_id, duaration * ONE_KILO, FALSE);
  1805. //play next page
  1806. x_start = 0;
  1807. y_start = 0;
  1808. image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, FALSE,TRUE);
  1809. b_isFirst = TRUE;
  1810. //modify softkey
  1811. // MMK_SetWinSoftkeyId(win_id, TXT_MMS_STOP, TXT_NULL, STXT_RETURN, TRUE);
  1812. //change state
  1813. s_edit_mms_preview_state = MMIMMS_PREVIEW_PLAYING;
  1814. }
  1815. break;
  1816. default:
  1817. SCI_ASSERT(FALSE);
  1818. break;
  1819. }
  1820. // MMK_SendMsg(MMIMMS_INBOX_PREVIEW_WIN_ID, MSG_FULL_PAINT, PNULL);
  1821. // err_code = MMI_RESULT_FALSE;
  1822. break;
  1823. case MSG_APP_CANCEL:
  1824. switch(s_edit_mms_preview_state)
  1825. {
  1826. case MMIMMS_PREVIEW_LEAVE:
  1827. SCI_ASSERT(FALSE);
  1828. break;
  1829. case MMIMMS_PREVIEW_PLAYING:
  1830. //stop timer
  1831. MMK_StopTimer(g_mmimms_preview_timer_id);
  1832.             g_mmimms_preview_timer_id = 0;
  1833. //change state to leave
  1834. s_edit_mms_preview_state = MMIMMS_PREVIEW_LEAVE;
  1835. //close window
  1836. MMK_CloseWin(win_id);
  1837. break;
  1838. case MMIMMS_PREVIEW_STOP:
  1839. //change state to leave
  1840. //  MMK_StopTimer(timer_id);
  1841. s_edit_mms_preview_state = MMIMMS_PREVIEW_LEAVE;
  1842. //close window
  1843. MMK_CloseWin(win_id);
  1844. break;
  1845. default:
  1846. SCI_ASSERT(FALSE);
  1847. break;
  1848. }
  1849. err_code = MMI_RESULT_FALSE;
  1850. break;
  1851. case MSG_APP_DOWN:
  1852. SCI_TRACE_LOW("FNH PREVIEW MMS MSG_APP_DOWN");
  1853. switch(s_edit_mms_preview_state)
  1854. {
  1855. SCI_TRACE_LOW("FNH s_edit_mms_preview_state = %d",s_edit_mms_preview_state);
  1856. case MMIMMS_PREVIEW_LEAVE:
  1857. SCI_ASSERT(FALSE);
  1858. break;
  1859. case MMIMMS_PREVIEW_PLAYING:
  1860. case MMIMMS_PREVIEW_STOP:
  1861. SCI_TRACE_LOW("FNH MSG_APP_DOWN,MMIMMS_PREVIEW_PLAYING");
  1862. GUIANIMATE_GetImageInfo(anim_ctrl_id, &image_type, &image_width, &image_height);
  1863. SCI_TRACE_LOW("FNH image_width = %d,image_height = %d",image_width,image_height);
  1864. text_height = GUITEXTBOX_GetTotalHeight(editbox_ctrl_id);
  1865. SCI_TRACE_LOW("FNH text_height = %d",text_height);
  1866. if (y_start + image_height + text_height > (MMI_MAINSCREEN_BOTTOM_MAX_PIXEL - TITLE_HEIGHT - MMI_LIST_ITEM_HEIGHT - SK_HEIGH - MOVE_UP_DOWN_STEP))
  1867. {
  1868. //scroll screen
  1869. SCI_TRACE_LOW("FNH scroll screen y_start = %d",y_start);
  1870. x_start = 0;
  1871. y_start -= MOVE_UP_DOWN_STEP;
  1872. SCI_TRACE_LOW("FNH scroll screen y_start = %d",y_start);
  1873. Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, FALSE, FALSE,FALSE);
  1874. }
  1875. break;
  1876. default:
  1877. SCI_ASSERT(FALSE);
  1878. break;
  1879. }
  1880. err_code = MMI_RESULT_FALSE;
  1881. break;
  1882. case MSG_APP_UP:
  1883. switch(s_edit_mms_preview_state)
  1884. {
  1885. case MMIMMS_PREVIEW_LEAVE:
  1886. SCI_ASSERT(FALSE);
  1887. break;
  1888. case MMIMMS_PREVIEW_PLAYING:
  1889. case MMIMMS_PREVIEW_STOP:
  1890. //scroll screen
  1891. x_start = 0;
  1892. if (y_start < 0)
  1893. {
  1894. y_start += MOVE_UP_DOWN_STEP;
  1895. Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, FALSE, FALSE,FALSE);
  1896. }
  1897. break;
  1898. }
  1899. err_code = MMI_RESULT_FALSE;
  1900. break;
  1901. case MSG_APP_LEFT:
  1902. {
  1903. uint16 slide_count = 0;
  1904. slide_count =MMSGetSlideCount(g_peditdoc);
  1905. if (slide_count == 1)
  1906. break;
  1907. }
  1908. switch(s_edit_mms_preview_state)
  1909. {
  1910. case MMIMMS_PREVIEW_LEAVE:
  1911. SCI_ASSERT(FALSE);
  1912. break;
  1913. case MMIMMS_PREVIEW_PLAYING:
  1914. //ignore
  1915. break;
  1916. case MMIMMS_PREVIEW_STOP:
  1917. if (MMS_PrevSlide(p_cur_edoc) == 1 )
  1918. {
  1919. x_start = 0;
  1920. y_start = 0;
  1921. MmsStopPreviewRing();
  1922. image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, FALSE,TRUE);
  1923. SCI_TRACE_LOW("FNH left image_is_too_big is %d",image_is_too_big);
  1924. // MMK_SetWinSoftkeyId(win_id, TXT_MMS_PLAY, TXT_NULL, STXT_RETURN, TRUE);    
  1925. if (image_is_too_big)
  1926. {
  1927. PUBWIN_OpenPromptAlertWin(PUBWIN_SOFTKEY_ONE,TXT_DC_PICTOO_LARGE,IMAGE_PROMPT_ICON_ALERT,MMI_1SECONDS,PNULL);
  1928. image_is_too_big = FALSE;
  1929. }
  1930. }
  1931. break;
  1932. default:
  1933. SCI_ASSERT(FALSE);
  1934. break;
  1935. }
  1936. break;
  1937. case MSG_APP_RIGHT:
  1938. {
  1939. uint16 slide_count = 0;
  1940. slide_count =MMSGetSlideCount(g_peditdoc);
  1941. if (slide_count == 1)
  1942. break;
  1943. }
  1944. switch(s_edit_mms_preview_state)
  1945. {
  1946. case MMIMMS_PREVIEW_LEAVE:
  1947. SCI_ASSERT(FALSE);
  1948. break;
  1949. case MMIMMS_PREVIEW_PLAYING:
  1950. SCI_TRACE_LOW("fnh enter preview_playing");
  1951. //ignore
  1952. break;
  1953. case MMIMMS_PREVIEW_STOP:
  1954. SCI_TRACE_LOW("fnh enter preview_stop");
  1955. if (MMS_NextSlide(p_cur_edoc) == 1)
  1956. {
  1957. x_start = 0;
  1958. y_start = 0;
  1959. MmsStopPreviewRing();
  1960. image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, FALSE,TRUE);
  1961. SCI_TRACE_LOW("FNH right image_is_too_big is %d",image_is_too_big);
  1962. // MMK_SetWinSoftkeyId(win_id, TXT_MMS_PLAY, TXT_NULL, STXT_RETURN, TRUE);    
  1963. if (image_is_too_big)
  1964. {
  1965. PUBWIN_OpenPromptAlertWin(PUBWIN_SOFTKEY_ONE,TXT_DC_PICTOO_LARGE,IMAGE_PROMPT_ICON_ALERT,MMI_1SECONDS,PNULL);
  1966. image_is_too_big = FALSE;
  1967. }
  1968. }
  1969. else
  1970. {
  1971. //last slide
  1972. MMS_HeadSlide(p_cur_edoc);
  1973. //then state changes to playing. this is its entrance
  1974. s_edit_mms_preview_state = MMIMMS_PREVIEW_PLAYING;
  1975. //play first slide
  1976. x_start = 0;
  1977. y_start = 0;
  1978. //disable text scroll bar
  1979. GUITEXTBOX_EnableScrollbar(editbox_ctrl_id, FALSE);
  1980. SCI_TRACE_LOW("FNH IN PREVIEW MMS before play currentslide");
  1981. image_is_too_big = Preview_PlayCurrentSlide(p_cur_edoc,x_start, y_start, win_id, anim_ctrl_id, editbox_ctrl_id, TRUE, FALSE,TRUE);
  1982. b_isFirst = TRUE;
  1983. //start slide timer
  1984. duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
  1985. g_mmimms_preview_timer_id = MMK_CreateWinTimer(win_id, duaration * ONE_KILO, FALSE);
  1986. }
  1987. break;
  1988. default:
  1989. SCI_ASSERT(FALSE);
  1990. break;
  1991. }
  1992. break;
  1993.     case MSG_CTL_CANCEL:
  1994. // MMK_CloseWin(MMIMMS_EDIT_WIN_ID);
  1995.         break;
  1996. case MSG_CLOSE_WINDOW:
  1997. //if (MMK_IsTimerActive(g_mmimms_preview_timer_id))
  1998. if (play_or_preview == MMS_PLAY)
  1999. {
  2000. if (p_cur_edoc)
  2001. {
  2002. if(p_cur_edoc == g_peditdoc)
  2003. {
  2004. MMSDelDocument(g_peditdoc);
  2005. SCI_TRACE_LOW("FNH after free g_peditdoc MMS!");
  2006. g_peditdoc = NULL;
  2007. p_cur_edoc = NULL;
  2008. }
  2009. else if(p_cur_edoc == g_pcur_signdoc)
  2010. {
  2011. MMSDelDocument(g_pcur_signdoc);
  2012. SCI_TRACE_LOW("FNH after free g_pcur_signdoc MMS!");
  2013. g_pcur_signdoc = NULL;
  2014. p_cur_edoc = NULL;
  2015. }
  2016. }
  2017. }
  2018. play_or_preview = MMS_PREVIEW; //设回初始值
  2019.         if(0 != g_mmimms_preview_timer_id)
  2020. {
  2021. MMK_StopTimer(g_mmimms_preview_timer_id);
  2022.             g_mmimms_preview_timer_id = 0;
  2023. }
  2024. //if ring is playing stop it
  2025. MmsStopPreviewRing();
  2026. SCI_TRACE_LOW("FNH in close window before stop ring");
  2027. MMIPROFILE_StopRing(RING_STA_OTHER);
  2028. SCI_TRACE_LOW("FNH after stop ring");
  2029. //change state to leave
  2030. s_edit_mms_preview_state = MMIMMS_PREVIEW_LEAVE;
  2031. break;
  2032.         
  2033.     default:
  2034.         err_code = MMI_RESULT_FALSE;
  2035.         break;
  2036.     }
  2037.     
  2038.     return err_code;
  2039. }
  2040. /******************************************************************************
  2041.  * 函数定义: Preview_PlayCurrentSlide
  2042.  * 函数说明:    显示当前祯
  2043.  * 参数说明: x_start:起点X坐标
  2044.   y_start:起点Y坐标
  2045.   win_id:窗口ID
  2046.   anim_ctrl_Id:图形控件ID
  2047.   textbox_ctrl_id:文本控件ID
  2048.   is_new_slide:是否第一次显示
  2049.  * 返回值: 空 
  2050. ********************************************************************************/
  2051. LOCAL BOOLEAN Preview_PlayCurrentSlide(pMMS_EDocument p_cur_edoc,
  2052. int x_start, 
  2053. int y_start,
  2054. MMS_WINDOW_ID_E win_id,
  2055. MMS_CONTROL_ID_E anim_ctrl_id, 
  2056. MMS_CONTROL_ID_E textbox_ctrl_id,
  2057. BOOLEAN is_new_slide,
  2058. BOOLEAN is_beginning,
  2059. BOOLEAN is_update
  2060. )
  2061. {
  2062. T_Composer_Text composer_text;
  2063. MMI_STRING_T content_string;
  2064. T_Composer_Image composer_image;
  2065. ANIMATE_IMAGE_TYPE_E anim_type = 0;
  2066. uint32 duaration = 0;
  2067. GUI_RECT_T image_display_rect;
  2068. T_Composer_Audio composer_audo;
  2069. MMIAUDIO_TYPE_E audio_type = MMIAUDIO_TYPE_MAX;
  2070. MMIPROFILE_RING_VOL_E audio_vol = 0;
  2071. ANIMATE_IMAGE_TYPE_E   image_type = 0;
  2072. uint16 image_width = 0;
  2073. uint16 image_height = 0;
  2074. GUI_RECT_T image_rect;
  2075. GUI_RECT_T text_rect;
  2076. GUI_RETURN_E set_text_rect_ret;
  2077. uint16 line_num = 0;
  2078. const uint8 * mmsinsertpic_ptr = NULL;
  2079. BOOLEAN returnval = FALSE;
  2080. SCI_TRACE_LOW("FNH playcurrentslide Y_start = %d",y_start);
  2081.                                
  2082. if (is_beginning)
  2083. {
  2084. MMITHEME_SetUpdateDelayCount(1);
  2085. }
  2086. //clear screen
  2087. MMIMMS_CLEAR_CLIENT();
  2088. //1. set image
  2089. //set image rect, need not
  2090. image_rect.left = 0;
  2091. // image_rect.top = y_start + TITLE_HEIGHT;
  2092. image_rect.top = y_start + MMI_TITLE_HEIGHT + MMI_LIST_ITEM_HEIGHT;
  2093. image_rect.right = image_rect.left;
  2094. image_rect.bottom = image_rect.top;
  2095. 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);
  2096. //if image exist
  2097. if (p_cur_edoc->slide_cur->image_flag == 1)
  2098. {
  2099. //set Image Display Rect
  2100. SCI_MEMSET(&composer_image, 0, sizeof(composer_image));
  2101. SCI_TRACE_LOW("FNH p_cur_edoc->slide_cur->image_flag = %d",p_cur_edoc->slide_cur->image_flag);
  2102. image_display_rect.left = 0;
  2103. image_display_rect.right = MMI_MAINSCREEN_RIGHT_MAX_PIXEL;
  2104. // image_display_rect.top = TITLE_HEIGHT;
  2105. image_display_rect.top = MMI_TITLE_HEIGHT + MMI_LIST_ITEM_HEIGHT;
  2106. image_display_rect.bottom = MMI_CLIENT_RECT_BOTTOM;
  2107. SCI_TRACE_LOW("FNH image_display_rect.top = %d,image_display_rect.bottom = %d",image_display_rect.top,image_display_rect.bottom );
  2108. //get image data
  2109. if (MMIMMS_GetCurSlideImage(&composer_image,p_cur_edoc)!= -1)
  2110. {
  2111. //set ani_ctrol data
  2112. //get image type
  2113. anim_type = Edit_GetAniType(composer_image.Type);
  2114. SCI_TRACE_LOW("FNH anim_type = %d",anim_type);
  2115. SCI_TRACE_LOW("FNH composer_image.Size = %d",composer_image.size);
  2116. //get duaration
  2117. duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
  2118. if (is_new_slide)
  2119. {
  2120. //set anim param position and buf
  2121. SCI_TRACE_LOW("FNH composer_image.Size = %d",composer_image.size);
  2122. if (anim_type == ANIM_NONE ||
  2123. GUIANIMATE_PMI_DECODE_EID_NONE != GUIANIMATE_SetAnimDataExt(
  2124. anim_ctrl_id,
  2125. image_rect.left,
  2126. image_rect.top,
  2127. &image_display_rect,
  2128. composer_image.ImgBuf,
  2129. anim_type,
  2130. composer_image.size,
  2131. 0,//duaration * ONE_KILO,
  2132. TRUE,
  2133. FALSE
  2134. )
  2135. )
  2136. {
  2137. if (is_update)
  2138. {
  2139. returnval = TRUE;
  2140. mmsinsertpic_ptr = MMI_GetLabelAnim(IMAGE_MMS_IMAGE_BIG_ANIM);
  2141. SCI_TRACE_LOW("FNH mmsinsertpic_ptr = %d",mmsinsertpic_ptr);
  2142. GUIANIMATE_SetAnimData(
  2143. anim_ctrl_id,
  2144. image_rect.left,
  2145. image_rect.top,
  2146. mmsinsertpic_ptr,
  2147. ANIM_ANIM,
  2148. 0,
  2149. 500,
  2150. FALSE//TRUE
  2151. );
  2152. 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);
  2153. }
  2154. //only adjust position
  2155. GUIANIMATE_GetImageInfo(
  2156. anim_ctrl_id,
  2157. &image_type,
  2158. &image_width,
  2159. &image_height
  2160. );
  2161. SCI_TRACE_LOW("FNH after GetImageInfo image_width =%d,image_height = %d",image_width,image_height);
  2162. image_rect.left = (image_display_rect.right - image_display_rect.left - image_width) / 2 + image_display_rect.left; //middle
  2163. SCI_TRACE_LOW("FNH image_rect.left = %d",image_rect.left);
  2164. if (p_cur_edoc->slide_cur->text_flag == 1)
  2165. {
  2166. //do nothing
  2167. }
  2168. else
  2169. {
  2170. //let the picture be in middle
  2171. if (image_type != ANIM_GIF) //because GIF cann't be resized
  2172. {
  2173. image_rect.top = (image_display_rect.bottom - image_display_rect.top - image_height) / 2 + image_display_rect.top;//
  2174. }
  2175. }
  2176. GUIANIMATE_SetPos(
  2177. anim_ctrl_id,
  2178. image_rect.left,
  2179. image_rect.top,
  2180. !is_beginning//FALSE//TRUE //GUI_Animate will update it in MSG_CTRL_PAINT
  2181. );
  2182. SCI_TRACE_LOW("FNH after SetPos image_rect.left = %d,image_rect.top=%d",image_rect.left,image_rect.top);
  2183. }
  2184. else
  2185. {
  2186. //only adjust position
  2187. GUIANIMATE_GetImageInfo(
  2188. anim_ctrl_id,
  2189. &image_type,
  2190. &image_width,
  2191. &image_height
  2192. );
  2193. SCI_TRACE_LOW("FNH not new slide after GetImageInfo image_width = %d,image_height = %d",image_width,image_height);
  2194. image_rect.left = (image_display_rect.right - image_display_rect.left - image_width) / 2 + image_display_rect.left; //middle
  2195. SCI_TRACE_LOW("FNH image_rect.left = %d",image_rect.left);
  2196. if (p_cur_edoc->slide_cur->text_flag == 1)
  2197. {
  2198. //do nothing
  2199. }
  2200. else
  2201. {
  2202. //let the picture be in middle
  2203. if (image_type != ANIM_GIF) //because GIF cann't be resized
  2204. {
  2205. image_rect.top = (image_display_rect.bottom - image_display_rect.top - image_height) / 2 + image_display_rect.top;//
  2206. SCI_TRACE_LOW("FNH image type is not gif image_rect.top = %d",image_rect.top);
  2207. }
  2208. }
  2209. GUIANIMATE_SetPos(
  2210. anim_ctrl_id,
  2211. image_rect.left,
  2212. image_rect.top,
  2213. TRUE
  2214. );
  2215. SCI_TRACE_LOW("FNH image_rect.left = %d,image_rect.top = %d",image_rect.left,image_rect.top);
  2216. }
  2217. image_width = 0;
  2218. image_height = 0;
  2219. GUIANIMATE_GetImageInfo(
  2220. anim_ctrl_id,
  2221. &image_type,
  2222. &image_width,
  2223. &image_height
  2224. );
  2225. SCI_TRACE_LOW("FNH image_width = %d,image_height = %d",image_width,image_height);
  2226. }
  2227. }
  2228. #ifdef HAVE_MPEG4
  2229. else if (p_cur_edoc->slide_cur->video_flag == 1)
  2230. {
  2231. SCI_TRACE_LOW("FNH ENTER video_flag is true");
  2232. image_display_rect.left = 0;
  2233. image_display_rect.right = MMI_MAINSCREEN_RIGHT_MAX_PIXEL;
  2234. // image_display_rect.top = TITLE_HEIGHT;
  2235. image_display_rect.top = MMI_TITLE_HEIGHT + MMI_LIST_ITEM_HEIGHT;
  2236. image_display_rect.bottom = MMI_CLIENT_RECT_BOTTOM;
  2237. duaration = MMIMMS_GetCurSlideDuration(p_cur_edoc);
  2238. if (is_new_slide)
  2239. {
  2240. SCI_TRACE_LOW("FNH before getlabelanim");
  2241. mmsinsertpic_ptr = MMI_GetLabelAnim(IMAGE_MMS_HAVEDV_ANIM);
  2242.   SCI_TRACE_LOW("FNH mmsinsertpic_ptr = %d",mmsinsertpic_ptr);
  2243. GUIANIMATE_SetAnimData(
  2244. anim_ctrl_id,
  2245. image_rect.left,
  2246. image_rect.top,
  2247. mmsinsertpic_ptr,
  2248. ANIM_ANIM,
  2249. 0,
  2250. 500,
  2251. FALSE//TRUE
  2252. );
  2253. 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);
  2254. }
  2255. //only adjust position
  2256. GUIANIMATE_GetImageInfo(
  2257. anim_ctrl_id,
  2258. &image_type,
  2259. &image_width,
  2260. &image_height
  2261. );
  2262. SCI_TRACE_LOW("FNH after GetImageInfo image_width =%d,image_height = %d",image_width,image_height);
  2263. image_rect.left = (image_display_rect.right - image_display_rect.left - image_width) / 2 + image_display_rect.left; //middle
  2264. SCI_TRACE_LOW("FNH image_rect.left = %d",image_rect.left);
  2265. GUIANIMATE_SetPos(
  2266. anim_ctrl_id,
  2267. image_rect.left,
  2268. image_rect.top,
  2269. !is_beginning//FALSE//TRUE //GUI_Animate will update it in MSG_CTRL_PAINT
  2270. );
  2271. SCI_TRACE_LOW("FNH after SetPos image_rect.left = %d,image_rect.top=%d",image_rect.left,image_rect.top);
  2272. image_width = 0;
  2273. image_height = 0;
  2274. GUIANIMATE_GetImageInfo(
  2275. anim_ctrl_id,
  2276. &image_type,
  2277. &image_width,
  2278. &image_height
  2279. );
  2280. SCI_TRACE_LOW("FNH image_width = %d,image_height = %d",image_width,image_height);
  2281. }
  2282. #endif
  2283. else
  2284. {
  2285. //set anim param position and buf
  2286. GUIANIMATE_SetAnimData(
  2287. anim_ctrl_id,
  2288. image_rect.left,
  2289. image_rect.top,
  2290. PNULL,
  2291. ANIM_NONE,
  2292. 0,
  2293. 0,
  2294. TRUE
  2295. );
  2296.   image_width = 0;
  2297.   image_height = 0;
  2298.   GUIANIMATE_GetImageInfo(
  2299. anim_ctrl_id,
  2300. &image_type,
  2301. &image_width,
  2302. &image_height
  2303. );
  2304. }
  2305. image_rect.right = image_rect.left + image_width;
  2306. image_rect.bottom = image_rect.top + image_height;
  2307. SCI_TRACE_LOW("FNH before text image_rect.right = %d,image_rect.bottom = %d",image_rect.right,image_rect.bottom);
  2308. //2. set text
  2309. //set text rect
  2310. text_rect.left = 0;
  2311. text_rect.right = MMI_MAINSCREEN_RIGHT_MAX_PIXEL;
  2312. if (image_rect.bottom >= MMI_MAINSCREEN_BOTTOM_MAX_PIXEL - SK_HEIGH)
  2313. {
  2314. SCI_TRACE_LOW("FNH IMAGE IS TOO BIG,THE TEXT IS IN LOW!");
  2315. //if it is too low
  2316. text_rect.top = MMI_MAINSCREEN_BOTTOM_MAX_PIXEL - SK_HEIGH;
  2317. text_rect.bottom = text_rect.top;
  2318. }
  2319. else
  2320. {
  2321. text_rect.top = image_rect.bottom + ((MATH_ABS(image_rect.bottom - TITLE_HEIGHT - MMI_LIST_ITEM_HEIGHT)) % MOVE_UP_DOWN_STEP);
  2322. SCI_TRACE_LOW("FNH before line_num text_rect.top = %d",text_rect.top);
  2323. line_num = (TITLE_HEIGHT + MMI_LIST_ITEM_HEIGHT - text_rect.top) / MOVE_UP_DOWN_STEP;
  2324. SCI_TRACE_LOW("FNH line_num = %d",line_num);
  2325. text_rect.top = MAX(TITLE_HEIGHT + MMI_LIST_ITEM_HEIGHT, text_rect.top);//bruce
  2326. SCI_TRACE_LOW("FNH THE text_rect.top = %d",text_rect.top);
  2327. if (text_rect.top >= MMI_MAINSCREEN_BOTTOM_MAX_PIXEL - SK_HEIGH)
  2328. {
  2329. text_rect.top = MMI_MAINSCREEN_BOTTOM_MAX_PIXEL - SK_HEIGH;
  2330. text_rect.bottom = text_rect.top;
  2331. SCI_TRACE_LOW("FNH is in low text_rect.bottom = %d",text_rect.bottom);
  2332. }
  2333. else
  2334. {
  2335. text_rect.bottom = MMI_MAINSCREEN_BOTTOM_MAX_PIXEL - SK_HEIGH;
  2336. SCI_TRACE_LOW("FNH text_rect.bottom = %d",text_rect.bottom);
  2337. }
  2338. }
  2339. set_text_rect_ret = GUITEXTBOX_SetPos(
  2340. textbox_ctrl_id,
  2341. text_rect,
  2342. !is_beginning
  2343. );
  2344. 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);
  2345. if (GUI_RET_SUCCESS != set_text_rect_ret)
  2346. {
  2347. // SCI_ASSERT(FALSE);
  2348. }
  2349. //get current slide text
  2350. //if text exist
  2351. if (p_cur_edoc->slide_cur->text_flag == 1)
  2352. {
  2353. //get the text
  2354. SCI_MEMSET(&composer_text, 0, sizeof(composer_text));
  2355. if ( MMIMMS_GetCurText(&composer_text,p_cur_edoc)!= -1)
  2356. {
  2357. SCI_TRACE_LOW("mmimms:Preview_PlayCurSlide, text_size=%d", composer_text.size);
  2358. SCI_TRACE_BUF("mmimms:Preview_PlayCurSlide, text_buf", composer_text.TxtBuf, 10);
  2359. //fnh add 1018 begin 
  2360. content_string.is_ucs2 = 1;
  2361. content_string.str_ptr = composer_text.TxtBuf;
  2362. content_string.length = composer_text.size ;
  2363. SCI_TRACE_LOW("FNH get composer_text.size = %d",composer_text.size);
  2364. SCI_TRACE_LOW("FNH get text len = %d",content_string.length);
  2365. SCI_TRACE_LOW("FNH get content_string.str_ptr = %x",content_string.str_ptr);
  2366. //fnh add 1018 end
  2367. GUITEXTBOX_SetText(textbox_ctrl_id, &content_string, !is_beginning);
  2368. GUITEXTBOX_SetDisplayFirstLine(textbox_ctrl_id, line_num, TRUE);
  2369. }
  2370. }
  2371. else
  2372. {
  2373. GUITEXTBOX_SetText(textbox_ctrl_id, PNULL, !is_beginning);
  2374. }
  2375. //display slide number
  2376. if (win_id == MMIMMS_EDIT_PREVIEW_WIN_ID)
  2377. {
  2378. Preview_DispSlideNum(MMIMMS_EDIT_PREVIEW_LABEL_CTRL_ID,p_cur_edoc);
  2379. }
  2380. else if (win_id == MMIMMS_INBOX_PREVIEW_WIN_ID)
  2381. {
  2382. Preview_DispSlideNum(MMIMMS_MAILBOX_PREVIEW_LABEL_CTRL_ID,p_cur_edoc);
  2383. }
  2384. else if (win_id == MMIMMS_EDIT_DISPLAY_WIN_ID)
  2385. {
  2386. Preview_DispSlideNum(MMIMMS_EDIT_PREVIEW_LABEL_CTRL_ID,p_cur_edoc);
  2387. }
  2388. SCI_TRACE_LOW("FNH is_new_slide = %d",is_new_slide);
  2389. SCI_TRACE_LOW("FNH p_cur_edoc->slide_cur->audio_type = %d",p_cur_edoc->slide_cur->audio_type);
  2390. if (g_nv_setting_mirror.play_sound == 1)
  2391. {
  2392. //3.play sound
  2393. if (is_new_slide)
  2394. {
  2395. if (p_cur_edoc->slide_cur->audio_type)
  2396. {
  2397. //call audio interface.
  2398. SCI_MEMSET(&composer_audo, 0, sizeof(composer_audo));
  2399. MMIMMS_GetCurSlideAudio(&composer_audo,p_cur_edoc);
  2400. //play ring
  2401. audio_type = Edit_GetLowLayerAudioType(composer_audo.Type);
  2402. if ((audio_type != MMIAUDIO_TYPE_MAX)&&(audio_type != MMIAUDIO_AMR))
  2403. {
  2404. MMIPROFILE_PARA_T cur_profile_para = {0,};
  2405. MMIPROFILE_GetCurrentProfileModeInfo(&cur_profile_para);
  2406. audio_vol = MMISET_VOL_THREE;
  2407. if (MMIPROFILE_IsPermitPlayRingOrVib(RING_STA_OTHER))
  2408. {
  2409.                         s_mms_is_preview_ring = TRUE;//是否在预览彩信中的铃声
  2410. //暂停mp3播放
  2411.                        if(MMIMP3_IsMp3PlayingAsBg())
  2412.                        {
  2413.                             MMIMP3_SuspendMp3(TRUE);
  2414.                         }
  2415.                         MMIPROFILE_PlayRingByPtr(
  2416.                                         audio_vol,
  2417.                                        (uint8 *)composer_audo.AudBuf,
  2418.                                        (uint32)composer_audo.size,
  2419.                                        1,
  2420.                                        (AUD_RING_TYPE_E)audio_type,
  2421.                                        &MmsRingCallBack
  2422.                                         );
  2423. }
  2424. }
  2425. else
  2426. {
  2427. //make no alert. or it will trap in dead circle(ALERT->LOSE_FOCUS->GET->Play from beginning->ALERT->LOSE_FOCUS....)
  2428. //stop ring
  2429. SCI_TRACE_LOW("FNH before MmsStopPreviewRing1");
  2430. MmsStopPreviewRing();
  2431. }
  2432. }
  2433. else
  2434. {
  2435. SCI_TRACE_LOW("FNH before MmsStopPreviewRing2");
  2436. MmsStopPreviewRing();
  2437. }
  2438. }
  2439. else
  2440. {
  2441. SCI_TRACE_LOW("FNH should do nothing");
  2442. //should do nothing.
  2443. }
  2444. }
  2445. return returnval;
  2446. // SCI_TRACE_LOW("mmimms:Preview_PlayCurrentSlide, ticks=%d", ticks);
  2447. }
  2448. /*****************************************************************************/
  2449. //  Description : to continue play mp3
  2450. // Global resource dependence : 
  2451. //  Author:Jassmine.Meng
  2452. // Note: 
  2453. /*****************************************************************************/
  2454. LOCAL void MmsRingCallBack(void)
  2455. {
  2456. return ;
  2457. }
  2458. /* ----------------------------------------------------------------------------
  2459. * Function Name: MmsStopPreviewRing
  2460. * Purpose: 停止预览彩信铃声
  2461. * Input: void
  2462. * Returns: void
  2463. * Author:nihongf@mobilesoft.com.cn
  2464. * ----------------------------------------------------------------------------*/ 
  2465. LOCAL void MmsStopPreviewRing(void)
  2466. {
  2467. SCI_TRACE_LOW("fnh enter mmsstoppreviewring!");
  2468. SCI_TRACE_LOW("fnh s_Mms_is_preview_ring = %d",s_mms_is_preview_ring);
  2469.     if (s_mms_is_preview_ring)//在预览彩信中的铃声
  2470.     {
  2471. SCI_TRACE_LOW("fnh before MMISET_StopRing!");
  2472.    //     MMISET_StopRing(MMISET_RING_TYPE_OTHER);
  2473. MMIPROFILE_StopRing(RING_STA_OTHER);
  2474.         s_mms_is_preview_ring = FALSE;
  2475.     }
  2476. }
  2477. /*****************************************************************************/
  2478. //  Description : display "current_slide_index/total_slide_num"
  2479. // Global resource dependence : 
  2480. //  Author:Bruce.Chi
  2481. // Note: 
  2482. /*****************************************************************************/
  2483. LOCAL void Preview_DispSlideNum(MMS_CONTROL_ID_E label_ctrl_id,pMMS_EDocument p_cur_edoc)
  2484. {
  2485. uint32 total_slide = 0;
  2486. uint32 cur_slide = 0;
  2487. GUI_RECT_T  disp_rect = {0};
  2488. uint16      piexl_num       = 0;
  2489. uint16      font_height     = 0;    
  2490. uint16      display_str_len = 0;
  2491. uint8       display_str[16] = {0};
  2492.     MMI_STRING_T str = {0};
  2493.     
  2494. //calculate string
  2495. cur_slide = MMSGetSlideIndex(p_cur_edoc);
  2496. total_slide = MMSGetSlideCount(p_cur_edoc);
  2497. SCI_MEMSET((void*)display_str, 0, sizeof(display_str));
  2498. sprintf((char *)display_str,
  2499. "%d/%d", //N/M, N==current slide, M==total slide number
  2500. cur_slide ,
  2501. total_slide
  2502. );
  2503. display_str_len = strlen((char *)display_str);
  2504. SCI_ASSERT(display_str_len < 16);
  2505.     str.str_ptr = display_str;
  2506.     str.length = display_str_len;
  2507.     str.is_ucs2 = FALSE;
  2508.     GUILABEL_SetText(label_ctrl_id, &str, TRUE);    
  2509. }
  2510. /* ----------------------------------------------------------------------------
  2511.  * Function Name: CmsDelContent
  2512.  *       Purpose:  删除彩信结构中对应类型的内容(目前仅用来删除文本内容)
  2513.  *         Input:   editor_doc: 彩信结构地址 slide: 所在页地址 del_type: 待删除内容的类
  2514.  *        Output: None.
  2515.  *       Returns: None.
  2516.  *         Notes: Copyright(C) 2005 MobileSoft Technology (NanJing) Co.,LTD.
  2517.  * ----------------------------------------------------------------------------*/
  2518. void CmsDelContent(pMMS_EDocument editor_doc, pMMS_Slide slide, uint16 del_type)
  2519. {
  2520. pMMS_Content content = NULL;
  2521. content = slide->content_root;
  2522. while(content)
  2523. {
  2524. if(content->type == del_type)
  2525. {
  2526. slide->content_cur = content;
  2527. MMS_DelContent(slide,editor_doc);
  2528. return;
  2529. }
  2530. content = content->next;
  2531. }
  2532. }
  2533.  /* ----------------------------------------------------------------------------
  2534.  * Function Name: Cms_string_Uni16_strlen
  2535.  *       Purpose:编码为UTF16的U8字串的实际字数
  2536.  *         Input:  None
  2537.  *        Output: None.
  2538.  *       Returns:
  2539.  *         Notes: Copyright(C) 2005 MobileSoft Technology (NanJing) Co.,LTD.
  2540.  * ----------------------------------------------------------------------------*/  
  2541. uint32 Cms_string_Uni16_strlen(uint8* string)
  2542. {
  2543. uint32 leng = 0,i=0;
  2544.     
  2545. while(*(string+i)!=0 || *(string+i+1)!=0)
  2546. {
  2547. leng++;
  2548. i+=2;
  2549. }
  2550. return leng;
  2551. }
  2552.  /* ----------------------------------------------------------------------------
  2553.  * Function Name: Cms_string_Uni16_Uni8_strlen
  2554.  *       Purpose:得到16位U8字符串转换为UTF8字符串的长度
  2555.  *         Input:  None
  2556.  *        Output: None.
  2557.  *       Returns:
  2558.  *         Notes: Copyright(C) 2005 MobileSoft Technology (NanJing) Co.,LTD.
  2559.  * ----------------------------------------------------------------------------*/  
  2560. uint32 Cms_string_Uni16_Uni8_strlen(uint8* string)
  2561. {
  2562. uint32 leng = 0,i=0;
  2563. uint16 temp_str = 0;
  2564. if(string == NULL)
  2565. {
  2566. return 0;
  2567. }
  2568. while(*(string+i)!=0 || *(string+i+1)!=0)
  2569. {
  2570.         temp_str = (uint16)((*(string+i))*256 + *(string+i+1));
  2571. if(temp_str>0 && temp_str<=0x7F)
  2572. leng++;
  2573. else if(temp_str>=0x80 && temp_str<=0x7FF)
  2574. leng+=2;
  2575. else if(temp_str>=0x800 && temp_str<=0xFFFF)
  2576. leng+=3;
  2577. i+=2;
  2578. }
  2579. return leng;
  2580. }
  2581. /*****************************************************************************/
  2582. //  Description : 5.1.13 Edit: set slide time   window message handler
  2583. // Global resource dependence : 
  2584. //  Author:Bruce.Chi
  2585. // Note: 
  2586. /*****************************************************************************/
  2587. LOCAL MMI_RESULT_E  Edit_HandleSetSlideTimeWinMsg(
  2588. MMS_WINDOW_ID_E win_id, 
  2589. MMI_MESSAGE_ID_E msg_id, 
  2590. DPARAM param
  2591. )
  2592. {
  2593.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  2594.     STRING_INFO_T  edit_string;
  2595. MMS_CONTROL_ID_E digital_edit_ctrl_id = MMIMMS_EDIT_SLIDE_TIME_CTRL_ID;
  2596. T_WORD duaration = 0;
  2597. uint8 duar_buf[16] = {0};
  2598.     
  2599.     switch(msg_id)
  2600.     {
  2601.     case MSG_FULL_PAINT:
  2602. MMIMMS_CLEAR_CLIENT();
  2603. break;
  2604.     case MSG_OPEN_WINDOW:
  2605. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  2606. duaration = MMIMMS_GetCurSlideDuration(g_peditdoc);
  2607. if (duaration > MMIMMS_SLIDE_DUARATION_MAX)
  2608. {
  2609. duaration = MMIMMS_SLIDE_DUARATION_MAX;
  2610. }
  2611. if (duaration < MMIMMS_SLIDE_DUARATION_MIN)
  2612. {
  2613. duaration = MMIMMS_SLIDE_DUARATION_MIN;
  2614. }
  2615. if (duaration != 0)
  2616. {
  2617. //edit current duaration setting
  2618. SCI_MEMSET(duar_buf, 0, sizeof(duar_buf));
  2619. sprintf((char *)duar_buf, "%d", duaration);
  2620. SCI_ASSERT(strlen((char *)duar_buf) < sizeof(duar_buf));
  2621. GUIEDITBOX_SetDigitalEditBoxStringInfo(
  2622. digital_edit_ctrl_id,
  2623. duar_buf,
  2624. strlen((char *)duar_buf)
  2625. );
  2626. }
  2627.         MMK_SetAtvCtrl(win_id, digital_edit_ctrl_id);
  2628.         break;
  2629.         
  2630.     case MSG_CTL_OK:
  2631. case MSG_APP_OK:
  2632.         // to get the content which the user input
  2633.         SCI_MEMSET( (void *)&edit_string, 0, sizeof(edit_string) );
  2634.         GUIEDITBOX_GetDigitalEditBoxInfo(digital_edit_ctrl_id, &edit_string);
  2635. MMI_MEMCPY(duar_buf, 8, edit_string.str_ptr, edit_string.str_len, edit_string.str_len);
  2636. duaration = atoi((char *)(duar_buf));
  2637.         //check
  2638. if (edit_string.str_len == 0 || duaration > MMIMMS_SLIDE_DUARATION_MAX || duaration < MMIMMS_SLIDE_DUARATION_MIN)
  2639. {
  2640. //Alert : invalidate input
  2641. PUBWIN_OpenPromptAlertWin(
  2642. PUBWIN_SOFTKEY_ONE, 
  2643. TXT_MMS_INVALID_INPUT, 
  2644. IMAGE_PROMPT_ICON_WRONG, 
  2645. ALERT_TIMEOUT, 
  2646. PNULL
  2647. );
  2648. }
  2649. else
  2650. {
  2651. //save
  2652. MMIMMS_SetCurSlideDuration(duaration);
  2653.         MMK_CloseWin(MMIMMS_EDIT_SLIDE_TIME_WIN_ID);
  2654. }
  2655.         break;
  2656. case MSG_GET_FOCUS:
  2657. MMK_SetAtvCtrl(win_id, digital_edit_ctrl_id);
  2658. break;
  2659.         
  2660.     case MSG_CTL_CANCEL:
  2661. case MSG_APP_CANCEL:
  2662.         // close the edit window
  2663.         MMK_CloseWin(MMIMMS_EDIT_SLIDE_TIME_WIN_ID);        
  2664.         break;
  2665.         
  2666.     default:
  2667.         err_code = MMI_RESULT_FALSE;
  2668.         break;
  2669.     }
  2670.     
  2671.     return err_code;
  2672. }
  2673. /*****************************************************************************/
  2674. //  Description :5.1.2.1 GroupSend : to list   window message handler
  2675. // Global resource dependence : 
  2676. //  Author:Bruce.Chi
  2677. // Note: 
  2678. /*****************************************************************************/
  2679. #define MMIMMS_GSEND_LIST_HEAD 0 //<INPUT>  ,<PB>    //fnh add
  2680. #define MMIMMS_GSEND_LIST_MAX_ITEM (MMIMMS_MAX_ADDRESS_NUM + MMIMMS_GSEND_LIST_HEAD)
  2681. //totoal address + 3
  2682. int32 MmsGetReceiverCount(p_MMS_RECEPIENT p_receiver)
  2683. {
  2684. int32 number = 0;
  2685. p_MMS_RECEPIENT p_temp = NULL;
  2686. if(p_receiver == NULL)
  2687. {
  2688. return 0;
  2689. }
  2690. for(p_temp=p_receiver; p_temp; p_temp=p_temp->p_next)
  2691. {
  2692. number++;
  2693. }
  2694. return number;
  2695. }
  2696. /*****************************************************************************/
  2697. //  Description :
  2698. // Global resource dependence :
  2699. //  Author:
  2700. // Note:
  2701. /*****************************************************************************/
  2702. BOOLEAN Space_FormInBox(
  2703.                                    MMI_STRING_T *str_dst //out.
  2704.  )
  2705. {
  2706. char* label_str2_ptr = PNULL;
  2707. uint32 label_str2_len = 0;
  2708. MMI_STRING_T label_string2;
  2709. //fill label_string2 with "from"
  2710. label_str2_len = 64;
  2711. label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
  2712. SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
  2713.        sprintf(label_str2_ptr, 
  2714. ":%ldr",(g_pManager->inboxfolder->messagenumber - g_pManager->inboxfolder->unsettlednumber));
  2715. // strcat(label_str2_ptr,"r");
  2716. label_string2.is_ucs2 = FALSE;
  2717. label_string2.str_ptr = (uint8 *)label_str2_ptr;
  2718. label_string2.length = strlen(label_str2_ptr);
  2719. // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
  2720. CatStringByTextID(str_dst,TXT_MMS_INBOX , &label_string2);
  2721. if(label_str2_ptr != PNULL)
  2722. {
  2723. cms_free(label_str2_ptr);
  2724. label_str2_ptr = PNULL;
  2725. }
  2726. return TRUE;
  2727. }
  2728. /*****************************************************************************/
  2729. //  Description :
  2730. // Global resource dependence :
  2731. //  Author:
  2732. // Note:
  2733. /*****************************************************************************/
  2734.  BOOLEAN Space_FormOutBox(
  2735.                                    MMI_STRING_T *str_dst //out.
  2736.  )
  2737. {
  2738. char* label_str2_ptr = PNULL;
  2739. uint32 label_str2_len = 0;
  2740. MMI_STRING_T label_string2;
  2741. //fill label_string2 with "from"
  2742. label_str2_len = 64;
  2743. label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
  2744. SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
  2745.        sprintf(label_str2_ptr, 
  2746. ":%ldr",g_pManager->outboxfolder->messagenumber);
  2747. // strcat(label_str2_ptr,"r");
  2748. label_string2.is_ucs2 = FALSE;
  2749. label_string2.str_ptr = (uint8 *)label_str2_ptr;
  2750. label_string2.length = strlen(label_str2_ptr);
  2751. // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
  2752. CatStringByTextID(str_dst,TXT_MMS_OUTBOX , &label_string2);
  2753. if(label_str2_ptr != PNULL)
  2754. {
  2755. cms_free(label_str2_ptr);
  2756. label_str2_ptr = PNULL;
  2757. }
  2758. return TRUE;
  2759. }
  2760. /*****************************************************************************/
  2761. //  Description :
  2762. // Global resource dependence :
  2763. //  Author:
  2764. // Note:
  2765. /*****************************************************************************/
  2766. BOOLEAN Space_FormSentBox(
  2767.                                    MMI_STRING_T *str_dst //out.
  2768.  )
  2769. {
  2770. char* label_str2_ptr = PNULL;
  2771. uint32 label_str2_len = 0;
  2772. MMI_STRING_T label_string2;
  2773. //fill label_string2 with "from"
  2774. label_str2_len = 64;
  2775. label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
  2776. SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
  2777.        sprintf(label_str2_ptr, 
  2778. ":%ldr",g_pManager->sentfolder->messagenumber);
  2779. // strcat(label_str2_ptr,"r");
  2780. label_string2.is_ucs2 = FALSE;
  2781. label_string2.str_ptr = (uint8 *)label_str2_ptr;
  2782. label_string2.length = strlen(label_str2_ptr);
  2783. // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
  2784. CatStringByTextID(str_dst,TXT_MMS_SENTBOX , &label_string2);
  2785. if(label_str2_ptr != PNULL)
  2786. {
  2787. cms_free(label_str2_ptr);
  2788. label_str2_ptr = PNULL;
  2789. }
  2790. return TRUE;
  2791. }
  2792. /*****************************************************************************/
  2793. //  Description :
  2794. // Global resource dependence :
  2795. //  Author:
  2796. // Note:
  2797. /*****************************************************************************/
  2798. BOOLEAN Space_FormDraftBox(
  2799.                                    MMI_STRING_T *str_dst //out.
  2800.  )
  2801. {
  2802. char* label_str2_ptr = PNULL;
  2803. uint32 label_str2_len = 0;
  2804. MMI_STRING_T label_string2;
  2805. //fill label_string2 with "from"
  2806. label_str2_len = 64;
  2807. label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
  2808. SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
  2809.        sprintf(label_str2_ptr, 
  2810. ":%ldr",g_pManager->draftfolder->messagenumber);
  2811. // strcat(label_str2_ptr,"r");
  2812. label_string2.is_ucs2 = FALSE;
  2813. label_string2.str_ptr = (uint8 *)label_str2_ptr;
  2814. label_string2.length = strlen(label_str2_ptr);
  2815. // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
  2816. CatStringByTextID(str_dst,TXT_MMS_DRAFTBOX , &label_string2);
  2817. if(label_str2_ptr != PNULL)
  2818. {
  2819. cms_free(label_str2_ptr);
  2820. label_str2_ptr = PNULL;
  2821. }
  2822. return TRUE;
  2823. }
  2824. /*****************************************************************************/
  2825. //  Description :
  2826. // Global resource dependence :
  2827. //  Author:
  2828. // Note:
  2829. /*****************************************************************************/
  2830. BOOLEAN Space_FormTotal(
  2831.                                    MMI_STRING_T *str_dst //out.
  2832.  )
  2833. {
  2834. char* label_str2_ptr = PNULL;
  2835. uint32 label_str2_len = 0;
  2836. MMI_STRING_T label_string2;
  2837. uint32 totalnum ;
  2838. if(g_pManager != NULL)
  2839. {
  2840. totalnum = (g_pManager->inboxfolder->messagenumber - g_pManager->inboxfolder->unsettlednumber)+ g_pManager->outboxfolder->messagenumber +g_pManager->sentfolder->messagenumber + g_pManager->draftfolder->messagenumber;
  2841. }
  2842. else
  2843. {
  2844. totalnum = 0;
  2845. }
  2846. //fill label_string2 with "from"
  2847. label_str2_len = 64;
  2848. label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
  2849. SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
  2850.        sprintf(label_str2_ptr, 
  2851. ":%ld/%dr",totalnum,100);
  2852. // strcat(label_str2_ptr,"r");
  2853. label_string2.is_ucs2 = FALSE;
  2854. label_string2.str_ptr = (uint8 *)label_str2_ptr;
  2855. label_string2.length = strlen(label_str2_ptr);
  2856. // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
  2857. CatStringByTextID(str_dst,TXT_MMS_MMSSPACE_TOTAL , &label_string2);
  2858. if(label_str2_ptr != PNULL)
  2859. {
  2860. cms_free(label_str2_ptr);
  2861. label_str2_ptr = PNULL;
  2862. }
  2863. return TRUE;
  2864. }
  2865. /*****************************************************************************/
  2866. //  Description :
  2867. // Global resource dependence :
  2868. //  Author:
  2869. // Note:
  2870. /*****************************************************************************/
  2871. BOOLEAN Space_FormSize(MMI_STRING_T *str_dst)
  2872. {
  2873. char* label_str2_ptr = PNULL;
  2874. uint32 label_str2_len = 0;
  2875. MMI_STRING_T label_string2;
  2876. uint32 mms_total_size = 0;
  2877. uint32 mms_inbox_size = 0;
  2878. uint32 mms_outbox_size = 0;
  2879. uint32 mms_sentbox_size = 0;
  2880. uint32 mms_draftbox_size = 0;
  2881. label_str2_len = 64;
  2882. label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
  2883. SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
  2884. mms_inbox_size = MMIMMS_GetMailboxMsgSize(MMIMESSAGE_INBOX);
  2885. mms_sentbox_size = MMIMMS_GetMailboxMsgSize(MMIMESSAGE_SENTBOX);
  2886. mms_outbox_size = MMIMMS_GetMailboxMsgSize(MMIMESSAGE_OUTBOX);
  2887. mms_draftbox_size = MMIMMS_GetMailboxMsgSize(MMIMESSAGE_DRAFTBOX);
  2888. SCI_TRACE_LOW("fnh box size = %d,%d,%d,%d",mms_inbox_size,mms_sentbox_size,mms_outbox_size,mms_draftbox_size);
  2889. mms_total_size = mms_inbox_size+
  2890.  mms_sentbox_size+
  2891.  mms_outbox_size+
  2892.  mms_draftbox_size;
  2893. mms_total_size = MIN(mms_total_size, MMIMMS_MAX_TOTAL_MMS_SIZE); //if exceed, cut.
  2894. sprintf(label_str2_ptr,":%dkr",(int)((mms_total_size + ONE_K_LEN - 1) / ONE_K_LEN));
  2895. label_string2.is_ucs2 = FALSE;
  2896. label_string2.length = strlen((char *)label_str2_ptr);
  2897. SCI_ASSERT(label_string2.length < 64);
  2898. label_string2.str_ptr = (uint8 *)label_str2_ptr;
  2899. if (!CatStringByTextID(str_dst, TXT_MMS_CONTENT, &label_string2))
  2900. {
  2901. SCI_ASSERT(FALSE);
  2902. }
  2903. if(label_str2_ptr != PNULL)
  2904. {
  2905. cms_free(label_str2_ptr);
  2906. label_str2_ptr = PNULL;
  2907. }
  2908. return TRUE;
  2909. }
  2910. LOCAL MMI_RESULT_E  MMSSPACE_HandleListWinMsg(
  2911. MMS_WINDOW_ID_E win_id, 
  2912. MMI_MESSAGE_ID_E msg_id, 
  2913. DPARAM param
  2914. )
  2915. {
  2916.     MMI_RESULT_E   err_code = MMI_RESULT_TRUE;
  2917. MMI_STRING_T      dst_ptr ={0};
  2918. MMI_STRING_T      dst_temp ={0};
  2919. MMI_STRING_T      dst_temp2 ={0};
  2920. MMI_STRING_T      dst_temp3 ={0};
  2921. MMI_STRING_T      dst_temp4 = {0}; //fnh add 0327
  2922. MMI_STRING_T      dst_ptr1 ={0};
  2923. MMI_STRING_T      dst_ptr2 ={0};
  2924. MMI_STRING_T      dst_ptr3 ={0};
  2925. MMI_STRING_T      dst_ptr4 ={0};
  2926. MMI_STRING_T      dst_ptr5 = {0};
  2927. MMI_STRING_T      dst_ptr6 = {0}; //fnh add 0327
  2928.     switch(msg_id)
  2929.     {
  2930.    case MSG_FULL_PAINT:
  2931. //clear
  2932. MMIMMS_CLEAR_CLIENT();
  2933. SCI_MEMSET(&dst_ptr, 0, sizeof(MMI_STRING_T));
  2934. SCI_MEMSET(&dst_temp, 0, sizeof(MMI_STRING_T));
  2935. SCI_MEMSET(&dst_temp2, 0, sizeof(MMI_STRING_T));
  2936.  SCI_MEMSET(&dst_temp3, 0, sizeof(MMI_STRING_T)); 
  2937.  SCI_MEMSET(&dst_temp4, 0, sizeof(MMI_STRING_T)); //fnh add 0327
  2938. SCI_MEMSET(&dst_ptr1, 0, sizeof(MMI_STRING_T));
  2939. SCI_MEMSET(&dst_ptr2, 0, sizeof(MMI_STRING_T));
  2940. SCI_MEMSET(&dst_ptr3, 0, sizeof(MMI_STRING_T));
  2941. SCI_MEMSET(&dst_ptr4, 0, sizeof(MMI_STRING_T));
  2942. SCI_MEMSET(&dst_ptr5, 0, sizeof(MMI_STRING_T));
  2943.  SCI_MEMSET(&dst_ptr6, 0, sizeof(MMI_STRING_T)); 
  2944.  Space_FormInBox(&dst_ptr1);
  2945.  Space_FormOutBox(&dst_ptr2);
  2946.  Space_FormSentBox(&dst_ptr3);
  2947.  Space_FormDraftBox(&dst_ptr4);
  2948.  Space_FormTotal(&dst_ptr5);
  2949.  Space_FormSize(&dst_ptr6); //fnh add 0327
  2950.  CatString(&dst_temp, &dst_ptr1,&dst_ptr2);
  2951.  CatString(&dst_temp2, &dst_temp,&dst_ptr3);
  2952.  CatString(&dst_temp3, &dst_temp2, &dst_ptr4);
  2953. //  CatString(&dst_ptr,&dst_temp3,&dst_ptr5); //fnh modify 0510
  2954.  CatString(&dst_temp4,&dst_temp3,&dst_ptr5); //fnh add 0327
  2955.  CatString(&dst_ptr, &dst_temp4, &dst_ptr6); //fnh add 0327
  2956.   
  2957.  GUITEXTBOX_SetText(MMIMMS_MMSSPACE_TEXTBOX_CTRL_ID, &dst_ptr, TRUE);
  2958. //set sofkey
  2959. MMK_SetWinSoftkeyId(win_id, COMMON_TXT_NULL, COMMON_TXT_NULL, STXT_RETURN, TRUE);
  2960. break;
  2961.     case MSG_OPEN_WINDOW:
  2962.    
  2963. //set active control
  2964. MMK_SetAtvCtrl(win_id, MMIMMS_MMSSPACE_TEXTBOX_CTRL_ID);
  2965.         break;
  2966.     case MSG_APP_CANCEL:
  2967.         // close the edit window
  2968.         
  2969.         MMK_CloseWin(win_id);
  2970.         break;
  2971.   case MSG_CLOSE_WINDOW:
  2972.   break;
  2973.   
  2974.                 
  2975.     default:
  2976.         err_code = MMI_RESULT_FALSE;
  2977.         break;
  2978.     }
  2979.     
  2980.     return err_code;
  2981. }
  2982. /*****************************************************************************/
  2983. //  Description : 5.4.1A Inbox: message list  window message handler
  2984. // Global resource dependence : 
  2985. //  Author:Bruce.Chi
  2986. // changed liangliu for MMS message show!
  2987. // Note: 
  2988. /*****************************************************************************/
  2989. LOCAL MMI_RESULT_E  Inbox_HandleListWinMsg(
  2990. MMS_WINDOW_ID_E win_id, 
  2991. MMI_MESSAGE_ID_E msg_id, 
  2992. DPARAM param
  2993. )
  2994. {
  2995.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  2996. uint16 list_index = 0;
  2997. int i = 0;
  2998. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_INBOX_LIST_CTRL_ID;
  2999. static uint32       list_state = 0 ;
  3000. MMI_STRING_T name_ptr;
  3001. uint16 message_num = 0;
  3002. BOOLEAN is_content_ucs2 = FALSE;
  3003. pMessageList         tlist = PNULL;
  3004. uint32                  listicon_id;
  3005. uint8                  listptr[LISTMAXLENGTH];
  3006.     switch(msg_id)
  3007.     {
  3008.     case MSG_FULL_PAINT:
  3009. MMIMMS_CLEAR_CLIENT();
  3010. break;
  3011. case MSG_OPEN_WINDOW:
  3012. MMK_SetWinSoftkeyId(win_id, STXT_OK, 0, STXT_RETURN, FALSE);
  3013. message_num = MMIMMS_GetMessageNum(g_pManager->currentfolder);
  3014. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->root;//modify 2005-12-2
  3015. if (message_num == 0)
  3016. {
  3017. // PUBWIN_OpenPromptAlertWin(
  3018. // PUBWIN_SOFTKEY_ONE, 
  3019. // TXT_MMS_DRAFTBOX_EMPTY, 
  3020. // IMAGE_PROMPT_ICON_WRONG, 
  3021. // ALERT_TIMEOUT, 
  3022. // PNULL
  3023. // );
  3024. MMK_CloseWin(win_id);
  3025. break;
  3026. }
  3027. GUILISTBOX_SetMaxItem(list_ctrl_id, MMIMMS_MAX_MMS_AND_MMSNOTI_NUM);
  3028. //mms_sort_ptr = MMIMMS_Sort(MMIMESSAGE_INBOX, &message_num);
  3029. //SCI_ASSERT(mms_sort_ptr != PNULL);
  3030. if (message_num > 0)
  3031. {
  3032.        tlist = g_pManager->currentfolder->root;
  3033. for(i = 0; i < message_num; i++)
  3034. {
  3035. //is_content_ucs2 = ((mms_sort_ptr[i].status_flag & FLAG_MMS_CONTENT_IS_UCS2) != 0) ? TRUE : FALSE;
  3036. if(tlist == g_pManager->currentfolder->currentmessage)
  3037. {
  3038. list_index = i ;
  3039. }
  3040. SCI_MEMSET(&name_ptr, 0, sizeof(MMI_STRING_T));
  3041. name_ptr.str_ptr = cms_malloc(MMIPB_NAME_MAX_LEN);
  3042. switch(tlist->state)
  3043. {
  3044.    case MMS_MSG_STATE_UNRECEIVED:
  3045.     listicon_id = IMAGE_MMS_NOTIFY_NEW_ICON;
  3046. break;
  3047.   case MMS_MSG_STATE_UNREAD:
  3048.    listicon_id = IMAGE_NOT_READ_MMS_ICON;
  3049. break;
  3050.   case MMS_MSG_STATE_READ:
  3051.    listicon_id = IMAGE_READ_MMS_ICON;
  3052. break;
  3053.   default:
  3054.    listicon_id = IMAGE_READ_MMS_ICON;
  3055. break;
  3056.   
  3057. }
  3058. SCI_MEMSET(listptr, 0, LISTMAXLENGTH)
  3059. if(SCI_STRLEN((char*)tlist->sender) > LISTMAXLENGTH)
  3060. {
  3061.       strncpy((char*)listptr,(char*)tlist->sender,LISTMAXLENGTH);
  3062. }else
  3063. {
  3064. SCI_TRACE_LOW("fnh listptr = %s,tlist->sender = %s",listptr,tlist->sender);
  3065.      SCI_STRCPY((char*)listptr,(char*)tlist->sender);
  3066. }
  3067. if (MMIMMS_GetPBNameByNumber(listptr,&name_ptr)== 1) //从电话簿中选择与号码匹配的名字
  3068. {
  3069. SCI_TRACE_BUF("fnh get pb_name = %x",name_ptr.str_ptr,10);
  3070. SCI_TRACE_LOW("FNH GET PB_NAME_LENGTH = %d",name_ptr.length);
  3071. SCI_TRACE_LOW("FNH is_ucs2 = %d",name_ptr.is_ucs2);
  3072. AppendListItemWithIcon(
  3073. (uint8 *)name_ptr.str_ptr,
  3074. name_ptr.length,
  3075. listicon_id,
  3076. name_ptr.is_ucs2,
  3077. list_ctrl_id,
  3078. STXT_OPTION
  3079. );
  3080. }
  3081. else
  3082. {
  3083. SCI_TRACE_LOW("FNH NOT IN PB!");
  3084. AppendListItemWithIcon(
  3085. (uint8 *)listptr,
  3086. SCI_STRLEN((char*)listptr),
  3087. listicon_id,
  3088. is_content_ucs2,
  3089. list_ctrl_id,
  3090. STXT_OPTION
  3091. );
  3092. }
  3093. if(tlist->next!=NULL)
  3094. {
  3095.                                   tlist = tlist->next;//这里还要增加意外判断
  3096. }
  3097. else
  3098. {
  3099.      tlist = g_pManager->currentfolder->root;
  3100. }
  3101. if (name_ptr.str_ptr)
  3102. {
  3103. cms_free(name_ptr.str_ptr);
  3104. name_ptr.str_ptr = NULL;
  3105. }
  3106. }
  3107. }
  3108. //GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  3109. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  3110. GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  3111.         break;
  3112. case MSG_GET_FOCUS://be careful, memory leak.
  3113. g_pManager->currentfolder =g_pManager->inboxfolder;
  3114. message_num = MMIMMS_GetMessageNum(g_pManager->currentfolder);
  3115. if (message_num == 0)
  3116. {
  3117. // PUBWIN_OpenPromptAlertWin(
  3118. // PUBWIN_SOFTKEY_ONE, 
  3119. // TXT_MMS_DRAFTBOX_EMPTY, 
  3120. // IMAGE_PROMPT_ICON_WRONG, 
  3121. // ALERT_TIMEOUT, 
  3122. // PNULL
  3123. // );
  3124. MMK_CloseWin(win_id);
  3125. break;
  3126. }
  3127. GUILISTBOX_SetMaxItem(list_ctrl_id, MMIMMS_MAX_MMS_AND_MMSNOTI_NUM);
  3128. //mms_sort_ptr = MMIMMS_Sort(MMIMESSAGE_INBOX, &message_num);
  3129. //SCI_ASSERT(mms_sort_ptr != PNULL);
  3130. if (message_num > 0)
  3131. {
  3132.        tlist = g_pManager->currentfolder->root;
  3133. for(i = 0; i < message_num; i++)
  3134. {
  3135. //is_content_ucs2 = ((mms_sort_ptr[i].status_flag & FLAG_MMS_CONTENT_IS_UCS2) != 0) ? TRUE : FALSE;
  3136. if(tlist == g_pManager->currentfolder->currentmessage)
  3137. {
  3138. list_index = i ;
  3139. }
  3140. SCI_MEMSET(&name_ptr, 0, sizeof(MMI_STRING_T));
  3141. name_ptr.str_ptr = cms_malloc(MMIPB_NAME_MAX_LEN);
  3142. switch(tlist->state)
  3143. {
  3144.    case MMS_MSG_STATE_UNRECEIVED:
  3145.     listicon_id = IMAGE_MMS_NOTIFY_NEW_ICON;
  3146. break;
  3147.   case MMS_MSG_STATE_UNREAD:
  3148.    listicon_id = IMAGE_NOT_READ_MMS_ICON;
  3149. break;
  3150.   case MMS_MSG_STATE_READ:
  3151.    listicon_id = IMAGE_READ_MMS_ICON;
  3152. break;
  3153.   default:
  3154.    listicon_id = IMAGE_READ_MMS_ICON;
  3155. break;
  3156.   
  3157. }
  3158.  SCI_MEMSET(listptr, 0, LISTMAXLENGTH)
  3159. if(SCI_STRLEN((char*)tlist->sender) > LISTMAXLENGTH)
  3160. {
  3161.       strncpy((char*)listptr,(char*)tlist->sender,LISTMAXLENGTH);
  3162. }else
  3163. {
  3164.      SCI_STRCPY((char*)listptr,(char*)tlist->sender);
  3165. }
  3166. if (MMIMMS_GetPBNameByNumber(listptr,&name_ptr)== 1) //从电话簿中选择与号码匹配的名字
  3167. {
  3168. SCI_TRACE_BUF("fnh get pb_name = %x",name_ptr.str_ptr,10);
  3169. SCI_TRACE_LOW("FNH GET PB_NAME_LENGTH = %d",name_ptr.length);
  3170. SCI_TRACE_LOW("FNH is_ucs2 = %d",name_ptr.is_ucs2);
  3171. AppendListItemWithIcon(
  3172. (uint8 *)name_ptr.str_ptr,
  3173. name_ptr.length,
  3174. listicon_id,
  3175. name_ptr.is_ucs2,
  3176. list_ctrl_id,
  3177. STXT_OPTION
  3178. );
  3179. }
  3180. else
  3181. {
  3182. SCI_TRACE_LOW("FNH NOT IN PB!");
  3183. AppendListItemWithIcon(
  3184. (uint8 *)listptr,
  3185. SCI_STRLEN((char*)listptr),
  3186. listicon_id,
  3187. is_content_ucs2,
  3188. list_ctrl_id,
  3189. STXT_OPTION
  3190. );
  3191. }
  3192. if(tlist->next!=NULL)
  3193. {
  3194.                                   tlist = tlist->next;//这里还要增加意外判断
  3195. }
  3196. else
  3197. {
  3198.      tlist = g_pManager->currentfolder->root;
  3199. }
  3200. if (name_ptr.str_ptr)
  3201. {
  3202. cms_free(name_ptr.str_ptr);
  3203. name_ptr.str_ptr = NULL;
  3204. }
  3205. }
  3206. }
  3207.       GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  3208. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  3209. //GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  3210.         break;
  3211. case MSG_LOSE_FOCUS:
  3212. break;
  3213. // case MSG_APP_OK:
  3214. // MMK_TrackPopupMenu(win_id);
  3215. // break;
  3216. case MSG_CTL_DBCLICK:     
  3217. case MSG_APP_OK:
  3218.     case MSG_CTL_OK:
  3219. //get selected list index
  3220. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  3221. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->root;
  3222. for(i = 0 ;i < list_index;i++)
  3223. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->currentmessage->next;
  3224. }
  3225. g_pCurrentList = g_pManager->inboxfolder->currentmessage;
  3226. list_state = MMIMMS_GetListState(g_pCurrentList);
  3227. //list_state = 0 ;
  3228. if (list_state == MMS_MSG_STATE_UNRECEIVED)
  3229. {
  3230. MMK_CreateWin((uint32 *)MMIMMS_INBOX_MMSNOTIMENU_WIN, PNULL);
  3231. }
  3232. else
  3233. {
  3234. /************fnh add begin *********/
  3235. SCI_TRACE_LOW("FNH g_pCurrentList->state = %d",g_pCurrentList->state);
  3236. if(g_pCurrentList->state == 1&& g_pCurrentList->needreadrpt == 1)
  3237. {
  3238. g_readforstate = MMS_MSG_INBOX_READ_FOR_PLAY;
  3239. PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_SEND_READRPT, IMAGE_PROMPT_ICON_QUERY);
  3240. }
  3241. else
  3242. {
  3243. // MMIMMS_Construction();
  3244. g_p_mms_subject = NULL;
  3245. SCI_MEMSET(&g_set_date,0,sizeof(MMS_SEND_ONTIME_TIME));
  3246. g_p_mms_to = NULL;
  3247. g_p_mms_cc = NULL;
  3248. g_p_mms_bcc = NULL;
  3249. /************fnh add end ************/
  3250. MMK_CreateWin((uint32 *)MMIMMS_INBOX_MMSMENU_WIN, PNULL);
  3251. }
  3252. }
  3253. break;
  3254. case MSG_MMS_SEND_OK:
  3255. if (MMK_IsOpenWin(MAIN_PROMPTALERT_WIN_ID)) //46351
  3256. {
  3257. MMK_CloseWin(MAIN_PROMPTALERT_WIN_ID);
  3258. }
  3259. SCI_TRACE_LOW("FNH before send readreport success");
  3260. PUBWIN_OpenPromptAlertWin(
  3261. PUBWIN_SOFTKEY_ONE, 
  3262. TXT_MMS_SEND_SUCCEED,
  3263. IMAGE_PROMPT_ICON_SUCCESS,//IMAGE_PROMPT_ICON_OK, 
  3264. ALERT_TIMEOUT, 
  3265. PNULL
  3266. );
  3267. g_pCurrentList->needreadrpt = 0;
  3268. break;
  3269. case MSG_MMS_SENDED_FAILED:
  3270. if (MMK_IsOpenWin(MAIN_PROMPTALERT_WIN_ID)) //46351
  3271. {
  3272. MMK_CloseWin(MAIN_PROMPTALERT_WIN_ID);
  3273. }
  3274. PUBWIN_OpenPromptAlertWin(
  3275. PUBWIN_SOFTKEY_ONE, 
  3276. TXT_MMS_SEND_FAILED,
  3277. IMAGE_PROMPT_ICON_FAIL, 
  3278. ALERT_TIMEOUT, 
  3279. PNULL
  3280. );
  3281. g_pCurrentList->needreadrpt = 0;
  3282. break;
  3283. case MSG_PROMPTWIN_OK:
  3284. PUBWIN_ClosePromptQueryWin();    
  3285. g_issendingreadrpt = TRUE;
  3286. MMIMMS_SendReadRpt_CreateWaitingWin();
  3287. MMIMMS_SendMMSReadRpt(g_pCurrentList);
  3288. g_netusing = MMS_MSG_NETUSING_STEP1;
  3289. break;
  3290. case MSG_PROMPTWIN_CANCEL:
  3291. PUBWIN_ClosePromptQueryWin();//here should close the win and open the waitwin for delete.
  3292. // MMIMMS_Construction();
  3293. g_pCurrentList->needreadrpt = 0;
  3294. g_p_mms_subject = NULL;
  3295. SCI_MEMSET(&g_set_date,0,sizeof(MMS_SEND_ONTIME_TIME));
  3296. g_p_mms_to = NULL;
  3297. g_p_mms_cc = NULL;
  3298. g_p_mms_bcc = NULL;
  3299. /************fnh add end ************/
  3300. MMK_CreateWin((uint32 *)MMIMMS_INBOX_MMSMENU_WIN, PNULL);
  3301. break;
  3302.             
  3303. case MSG_APP_CANCEL:
  3304. case MSG_CTL_CANCEL:
  3305. MMK_CloseWin(win_id);
  3306. break;
  3307. case MSG_CLOSE_WINDOW:
  3308. g_pCurrentList = PNULL;
  3309. break;
  3310.         
  3311. default:
  3312. err_code = MMI_RESULT_FALSE;
  3313. break;
  3314.         }
  3315.        
  3316. return err_code;
  3317. }
  3318. /*****************************************************************************/
  3319. //  Description :5.4.1C Inbox : Option menu of MMS  window message handler
  3320. // Global resource dependence : 
  3321. //  Author:Bruce.Chi
  3322. // Note: 
  3323. /*****************************************************************************/
  3324. LOCAL MMI_RESULT_E  Inbox_HandleMMSMenuWinMsg(
  3325. MMS_WINDOW_ID_E win_id, 
  3326. MMI_MESSAGE_ID_E msg_id, 
  3327. DPARAM param
  3328. )
  3329. {
  3330.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  3331.     uint32  group_id = 0;
  3332.     uint32  menu_id = 0;
  3333.     
  3334. MMS_CONTROL_ID_E menu_ctrl_id = MMIMMS_INBOX_MMSOPT_MENU_CTRL_ID;
  3335.     switch(msg_id)
  3336.     {
  3337.     case MSG_OPEN_WINDOW:
  3338. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);