JMMSComposeUI.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:366k
源码类别:

MTK

开发平台:

C/C++

  1.         STR_ID_JMMS_EDIT_TEXT_COLOR,
  2.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  3.         STR_GLOBAL_OK,
  4.         IMG_GLOBAL_OK,
  5.         STR_GLOBAL_BACK,
  6.         IMG_GLOBAL_BACK,
  7.         &g_custom_color_RGB_list[0],
  8.         &g_custom_color_RGB_list[1],
  9.         &g_custom_color_RGB_list[2],
  10. /* MAUI_00018451 Start */
  11. &g_slider_info,
  12. /* MAUI_00018451 End */
  13.         gui_buffer);
  14.     SetLeftSoftkeyFunction(mmi_jmms_save_txt_custom_color, KEY_EVENT_UP);
  15.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  16. }
  17. /*****************************************************************************
  18.  * FUNCTION
  19.  *  mmi_jmms_save_txt_custom_color
  20.  * DESCRIPTION
  21.  *  fn to save customized color.
  22.  * PARAMETERS
  23.  *  void
  24.  *  a(?)        [IN/OUT]        Nil(?)
  25.  *  b(?)        [IN]            Nil(?)
  26.  * RETURNS
  27.  *  void
  28.  *****************************************************************************/
  29. void mmi_jmms_save_txt_custom_color(void)
  30. {
  31.     /*----------------------------------------------------------------*/
  32.     /* Local Variables                                                */
  33.     /*----------------------------------------------------------------*/
  34.     /*----------------------------------------------------------------*/
  35.     /* Code Body                                                      */
  36.     /*----------------------------------------------------------------*/
  37.     g_text_custom_color_RGB = 0;
  38.     g_text_custom_color_RGB |= 0x00000064;
  39.     g_text_custom_color_RGB |=
  40.         ((((U32) g_custom_color_RGB_list[0]) << 24) | (((U32) g_custom_color_RGB_list[1]) << 16) |
  41.          (((U32) g_custom_color_RGB_list[2]) << 8));
  42.     g_custom_var_change = 1;
  43.     GoBackHistory();
  44. }
  45. /* SMIL Settings */
  46. /*****************************************************************************
  47.  * FUNCTION
  48.  *  mmi_jmms_entry_edit_content_smil_settings
  49.  * DESCRIPTION
  50.  *  Entry function when user press edit content->SETTINGS->smil settings.
  51.  * PARAMETERS
  52.  *  void
  53.  *  a(?)        [IN/OUT]        Nil(?)
  54.  *  b(?)        [IN]            Nil(?)
  55.  * RETURNS
  56.  *  void
  57.  *****************************************************************************/
  58. void mmi_jmms_entry_edit_content_smil_settings(void)
  59. {
  60.     /*----------------------------------------------------------------*/
  61.     /* Local Variables                                                */
  62.     /*----------------------------------------------------------------*/
  63.     U16 str_item_list[MAX_SUB_MENUS];   /* Stores the strings id of submenus returned */
  64.     U16 num_item;                       /* Stores no of children in the submenu */
  65.     U16 disp_Attribute;                 /* Stores display attribue */
  66.     U8 *gui_buffer;                     /* Buffer holding history data */
  67.     U16 parent_id;
  68.     /*----------------------------------------------------------------*/
  69.     /* Code Body                                                      */
  70.     /*----------------------------------------------------------------*/
  71.     EntryNewScreen(SCR_ID_JMMS_EDIT_CONTENT_SMIL_SETTINGS, NULL, mmi_jmms_entry_edit_content_smil_settings, NULL);
  72.     parent_id = MENU_ID_JMMS_EDIT_CONTENT_SETTINGS_SMIL;
  73.     SetParentHandler(parent_id);
  74.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_EDIT_CONTENT_SMIL_SETTINGS);
  75.     num_item = GetNumOfChild(parent_id);
  76.     disp_Attribute = GetDispAttributeOfItem(parent_id);
  77.     GetSequenceStringIds(parent_id, str_item_list);
  78.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  79.     ShowCategory52Screen(
  80.         STR_ID_JMMS_EDIT_CONTENT_SETTINGS_SMIL,
  81.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  82.         STR_GLOBAL_OK,
  83.         IMG_GLOBAL_OK,
  84.         STR_GLOBAL_BACK,
  85.         IMG_GLOBAL_BACK,
  86.         num_item,
  87.         str_item_list,
  88.         (PU16) gIndexIconsImageList,
  89.         NULL,
  90.         0,
  91.         0,
  92.         gui_buffer);
  93.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  94. }
  95. /*****************************************************************************
  96.  * FUNCTION
  97.  *  mmi_jmms_pre_entry_text_timing_settings
  98.  * DESCRIPTION
  99.  *  pre entry fn to enter image media timing screen for text.
  100.  * PARAMETERS
  101.  *  void
  102.  *  a(?)        [IN/OUT]        Nil(?)
  103.  *  b(?)        [IN]            Nil(?)
  104.  * RETURNS
  105.  *  void
  106.  *****************************************************************************/
  107. void mmi_jmms_pre_entry_text_timing_settings(void)
  108. {
  109.     /*----------------------------------------------------------------*/
  110.     /* Local Variables                                                */
  111.     /*----------------------------------------------------------------*/
  112.     U32 start_time, duration;
  113.     U8 duration_flag;
  114.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  115.     /*----------------------------------------------------------------*/
  116.     /* Code Body                                                      */
  117.     /*----------------------------------------------------------------*/
  118.     g_jmms_context->compose_context->media_type = MEDIA_TEXT;
  119.     g_custom_var_change = 0;
  120.     /*Dilip 13th sept */
  121.     if(g_jmms_context->compose_context->curr_slide_info.text_ID < 1)
  122.     {
  123.         DisplayPopup((PU8) GetString(STR_ID_JMMS_TEXT_NOT_INSERTED), IMG_GLOBAL_WARNING, 1, JMMS_POPUP_TIME, WARNING_TONE);
  124.         return;
  125.     }
  126.     /* DIlip 13th sept*/
  127.     err_code = mmi_jmms_get_media_time(
  128.                 &start_time,
  129.                 &duration,
  130.                 g_jmms_context->compose_context->curr_slide_info.text_ID,
  131.                 g_jmms_context->compose_context->curr_page_index);
  132.     if (err_code == JMMS_COMP_OK)
  133.     {
  134.         gui_itoa(
  135.             (S32) start_time,
  136.             (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer,
  137.             10);
  138.         duration_flag =
  139.             g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].txt_dur_max_set;
  140.         if (duration_flag == 0 && duration!=0)
  141.         {
  142.             g_jmms_context->jmms_inline_items.smil_settings_items.duration_select = 1;
  143.             gui_itoa(
  144.                 (S32) duration,
  145.                 (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,
  146.                 10);
  147.         }
  148.         else
  149.         {
  150.             if(g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time)
  151. {
  152. gui_itoa(
  153. ((S32) g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time - start_time),
  154. (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,
  155. 10);
  156. }
  157. else
  158. {
  159. gui_itoa(
  160. ((S32) g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time),
  161. (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,
  162. 10);
  163. }
  164.             g_jmms_context->jmms_inline_items.smil_settings_items.duration_select = 0;
  165.         }
  166. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_done_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  167. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_temp_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  168.         mmi_jmms_entry_smil_settings_media_timing();
  169.     }
  170. }
  171. /*****************************************************************************
  172.  * FUNCTION
  173.  *  mmi_jmms_pre_entry_image_timing_settings
  174.  * DESCRIPTION
  175.  *  pre entry fn to enter image media timing screen for image.
  176.  * PARAMETERS
  177.  *  void
  178.  *  a(?)        [IN/OUT]        Nil(?)
  179.  *  b(?)        [IN]            Nil(?)
  180.  * RETURNS
  181.  *  void
  182.  *****************************************************************************/
  183. void mmi_jmms_pre_entry_image_timing_settings(void)
  184. {
  185.     /*----------------------------------------------------------------*/
  186.     /* Local Variables                                                */
  187.     /*----------------------------------------------------------------*/
  188.     U32 start_time, duration;
  189.     U8 duration_flag;
  190.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  191.     /*----------------------------------------------------------------*/
  192.     /* Code Body                                                      */
  193.     /*----------------------------------------------------------------*/
  194.     g_jmms_context->compose_context->media_type = MEDIA_IMAGE;
  195.     g_custom_var_change = 0;
  196.     /*Dilip 13th sept */
  197.     if(g_jmms_context->compose_context->curr_slide_info.image_ID < 1)
  198.     {
  199.         DisplayPopup((PU8) GetString(STR_ID_JMMS_IMAGE_NOT_INSERTED), IMG_GLOBAL_WARNING, 1, JMMS_POPUP_TIME, WARNING_TONE);
  200.         return;
  201.     }
  202.     /* DIlip 13th sept*/
  203.     else
  204.     {
  205.     err_code = mmi_jmms_get_media_time(
  206.                 &start_time,
  207.                 &duration,
  208.                 g_jmms_context->compose_context->curr_slide_info.image_ID,
  209.                 g_jmms_context->compose_context->curr_page_index);
  210.     if (err_code == JMMS_COMP_OK)
  211.     {
  212.         gui_itoa(
  213.             (S32) start_time,
  214.             (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer,
  215.             10);
  216.         duration_flag =
  217.             g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].img_dur_max_set;
  218.         if (duration_flag == 0 && duration!=0)
  219.         {
  220.             g_jmms_context->jmms_inline_items.smil_settings_items.duration_select = 1;
  221.             gui_itoa(
  222.                 (S32) duration,
  223.                 (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,
  224.                 10);
  225.         }
  226.         else
  227.         {
  228.             if(g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time)
  229. {
  230. gui_itoa(
  231. ((S32) g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time - start_time),
  232. (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,
  233. 10);
  234. }
  235. else
  236. {
  237. gui_itoa(
  238. ((S32) g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time),
  239. (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,
  240. 10);
  241. }
  242.             g_jmms_context->jmms_inline_items.smil_settings_items.duration_select = 0;
  243.         }
  244. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_done_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  245. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_temp_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  246.         mmi_jmms_entry_smil_settings_media_timing();
  247.     }
  248.     }
  249. }
  250. /*****************************************************************************
  251.  * FUNCTION
  252.  *  mmi_jmms_pre_entry_audio_timing_settings
  253.  * DESCRIPTION
  254.  *  pre entry fn to enter image media timing screen for audio.
  255.  * PARAMETERS
  256.  *  void
  257.  *  a(?)        [IN/OUT]        Nil(?)
  258.  *  b(?)        [IN]            Nil(?)
  259.  * RETURNS
  260.  *  void
  261.  *****************************************************************************/
  262. void mmi_jmms_pre_entry_audio_timing_settings(void)
  263. {
  264.     /*----------------------------------------------------------------*/
  265.     /* Local Variables                                                */
  266.     /*----------------------------------------------------------------*/
  267.     U32 start_time, duration;
  268.     U8 duration_flag;
  269.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  270.     /*----------------------------------------------------------------*/
  271.     /* Code Body                                                      */
  272.     /*----------------------------------------------------------------*/
  273.     g_jmms_context->compose_context->media_type = MEDIA_AUDIO;
  274.     g_custom_var_change = 0;
  275.     /*Dilip 13th sept */
  276.     if(g_jmms_context->compose_context->curr_slide_info.audio_ID < 1)
  277.     {
  278.         DisplayPopup((PU8) GetString(STR_ID_JMMS_AUDIO_NOT_INSERTED), IMG_GLOBAL_WARNING, 1, JMMS_POPUP_TIME, WARNING_TONE);
  279.         return;
  280.     }
  281.     /* DIlip 13th sept*/
  282.     else
  283.     {
  284.     err_code = mmi_jmms_get_media_time(
  285.                 &start_time,
  286.                 &duration,
  287.                 g_jmms_context->compose_context->curr_slide_info.audio_ID,
  288.                 g_jmms_context->compose_context->curr_page_index);
  289.     if (err_code == JMMS_COMP_OK)
  290.     {
  291.         gui_itoa(
  292.             (S32) start_time,
  293.             (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer,
  294.             10);
  295.         duration_flag =
  296.             g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].
  297.             audio_dur_max_set;
  298.         if (duration_flag == 0 && duration!=0)
  299.         {
  300.             g_jmms_context->jmms_inline_items.smil_settings_items.duration_select = 1;
  301.             gui_itoa(
  302.                 (S32) duration,
  303.                 (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,
  304.                 10);
  305.         }
  306.         else
  307.         {
  308. U32 temp_duration = g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time;
  309. if ((U8) mmi_jmms_compose_settings_best_page_duration() == (U8) E_ON && temp_duration!=0)
  310. {
  311. temp_duration = duration;
  312. }
  313. if(temp_duration)
  314. {
  315. gui_itoa(
  316. (S32) (temp_duration - start_time),
  317. (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,
  318. 10);
  319. }
  320. else
  321. {
  322. gui_itoa(
  323. (S32) temp_duration,
  324. (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,
  325. 10);
  326. }
  327.             g_jmms_context->jmms_inline_items.smil_settings_items.duration_select = 0;
  328.         }
  329. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_done_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  330. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_temp_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  331.         mmi_jmms_entry_smil_settings_media_timing();
  332.     }
  333.     }
  334. }
  335. /*****************************************************************************
  336.  * FUNCTION
  337.  *  mmi_jmms_pre_entry_video_timing_settings
  338.  * DESCRIPTION
  339.  *  pre entry fn to enter image media timing screen for video.
  340.  * PARAMETERS
  341.  *  void
  342.  *  a(?)        [IN/OUT]        Nil(?)
  343.  *  b(?)        [IN]            Nil(?)
  344.  * RETURNS
  345.  *  void
  346.  *****************************************************************************/
  347. void mmi_jmms_pre_entry_video_timing_settings(void)
  348. {
  349.     /*----------------------------------------------------------------*/
  350.     /* Local Variables                                                */
  351.     /*----------------------------------------------------------------*/
  352.     U32 start_time, duration;
  353.     U8 duration_flag;
  354.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  355.     /*----------------------------------------------------------------*/
  356.     /* Code Body                                                      */
  357.     /*----------------------------------------------------------------*/
  358.     g_jmms_context->compose_context->media_type = MEDIA_VIDEO;
  359.     g_custom_var_change = 0;
  360.     /*Dilip 13th sept */
  361.     if(g_jmms_context->compose_context->curr_slide_info.video_ID < 1)
  362.     {
  363.         DisplayPopup((PU8) GetString(STR_ID_JMMS_VIDEO_NOT_INSERTED), IMG_GLOBAL_WARNING, 1, JMMS_POPUP_TIME, WARNING_TONE);
  364.         return;
  365.     }
  366.     /* DIlip 13th sept*/
  367.     else
  368.     {
  369.     err_code = mmi_jmms_get_media_time(
  370.                 &start_time,
  371.                 &duration,
  372.                 g_jmms_context->compose_context->curr_slide_info.video_ID,
  373.                 g_jmms_context->compose_context->curr_page_index);
  374.     if (err_code == JMMS_COMP_OK)
  375.     {
  376.         gui_itoa(
  377.             (S32) start_time,
  378.             (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer,
  379.             10);
  380.         duration_flag =
  381.             g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].
  382.             video_dur_max_set;
  383.         if (duration_flag == 0 && duration!=0)
  384.         {
  385.             gui_itoa(
  386.                 (S32) duration,
  387.                 (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,
  388.                 10);
  389.             g_jmms_context->jmms_inline_items.smil_settings_items.duration_select = 1;
  390.         }
  391.         else
  392.         {
  393. U32 temp_duration = g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time;
  394. if ((U8) mmi_jmms_compose_settings_best_page_duration() == (U8) E_ON && temp_duration!=0)
  395. {
  396. temp_duration = duration;
  397. }
  398. if(temp_duration)
  399. {
  400. gui_itoa(
  401. (S32) (temp_duration - start_time),
  402. (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,
  403. 10);
  404. }
  405. else
  406. {
  407. gui_itoa(
  408. (S32) temp_duration,
  409. (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,
  410. 10);
  411. }
  412.             g_jmms_context->jmms_inline_items.smil_settings_items.duration_select = 0;
  413.         }
  414. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_done_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  415. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_temp_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  416.         mmi_jmms_entry_smil_settings_media_timing();
  417.     }
  418.     }
  419. }
  420. /*****************************************************************************
  421.  * FUNCTION
  422.  *  mmi_jmms_entry_smil_settings_media_timing
  423.  * DESCRIPTION
  424.  *  Entry function when user press edit content->SETTINGS->smil settings->media timings.
  425.  * PARAMETERS
  426.  *  void
  427.  *  a(?)        [IN/OUT]        Nil(?)
  428.  *  b(?)        [IN]            Nil(?)
  429.  * RETURNS
  430.  *  void
  431.  *****************************************************************************/
  432. void mmi_jmms_entry_smil_settings_media_timing(void)
  433. {
  434.     /*----------------------------------------------------------------*/
  435.     /* Local Variables                                                */
  436.     /*----------------------------------------------------------------*/
  437.     U8 *gui_buffer;
  438.     U8 *input_buffer;
  439.     U16 input_buffer_size;
  440.     InlineItem smil_settings_inline_edit_list[4];
  441.     MMI_ID_TYPE item_icons[] = 
  442.     {
  443.         IMG_GLOBAL_L1,
  444.         0,
  445.         IMG_GLOBAL_L2,
  446.         0,
  447.     };
  448.     /*----------------------------------------------------------------*/
  449.     /* Code Body                                                      */
  450.     /*----------------------------------------------------------------*/
  451.     EntryNewScreen(SCR_ID_JMMS_SMIL_SETTINGS_TEXT_TIMINGS, mmi_jmms_exit_smil_settings_media_timing, NULL, NULL);
  452.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_SMIL_SETTINGS_TEXT_TIMINGS);
  453.     input_buffer = GetCurrNInputBuffer(SCR_ID_JMMS_SMIL_SETTINGS_TEXT_TIMINGS, &input_buffer_size);
  454.     InitializeCategory57Screen();
  455.     mmi_jmms_fill_media_timing_inline_edit_struct((void*)smil_settings_inline_edit_list);
  456.     if (input_buffer != NULL)   /* added for inline edit history */
  457.     {
  458.         SetCategory57Data(smil_settings_inline_edit_list, 4, input_buffer);     /* sets the data */
  459.     }
  460.     if (GetInlineDoneFlag(gui_buffer) == 0)
  461.     {
  462.         if (g_custom_var_change == 1)
  463.         {
  464.             SetInlineDoneFlag(gui_buffer);
  465.         }
  466.     }
  467.     ShowCategory57Screen(
  468.         STR_ID_JMMS_EDIT_CONTENT_EDIT_MEDIA_TIME,
  469.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  470.         STR_GLOBAL_EDIT,
  471.         IMG_GLOBAL_OK,
  472.         STR_GLOBAL_DONE,
  473.         IMG_GLOBAL_BACK,
  474.         4,
  475.         (PU16) item_icons,
  476.         smil_settings_inline_edit_list,
  477.         0,
  478.         gui_buffer);
  479.     switch (g_jmms_context->compose_context->media_type)
  480.     {
  481.         case MEDIA_TEXT:
  482.             SetCategory57RightSoftkeyFunctions(mmi_jmms_confirm_save_text_timing_settings, GoBackHistory);
  483.             break;
  484.         case MEDIA_IMAGE:
  485.             SetCategory57RightSoftkeyFunctions(mmi_jmms_confirm_save_image_timing_settings, GoBackHistory);
  486.             break;
  487.         case MEDIA_AUDIO:
  488.             SetCategory57RightSoftkeyFunctions(mmi_jmms_confirm_save_audio_timing_settings, GoBackHistory);
  489.             break;
  490.         case MEDIA_VIDEO:
  491.             SetCategory57RightSoftkeyFunctions(mmi_jmms_confirm_save_video_timing_settings, GoBackHistory);
  492.             break;
  493.     }
  494. }
  495. /*****************************************************************************
  496.  * FUNCTION
  497.  *  mmi_jmms_exit_smil_settings_media_timing
  498.  * DESCRIPTION
  499.  *  Exit function when user press edit content->SETTINGS->smil settings->media timing.
  500.  * PARAMETERS
  501.  *  void
  502.  *  a(?)        [IN/OUT]        Nil(?)
  503.  *  b(?)        [IN]            Nil(?)
  504.  * RETURNS
  505.  *  void
  506.  *****************************************************************************/
  507. void mmi_jmms_exit_smil_settings_media_timing(void)
  508. {
  509.     /*----------------------------------------------------------------*/
  510.     /* Local Variables                                                */
  511.     /*----------------------------------------------------------------*/
  512.     history scr;    /* Variable to hold the history data */
  513.     S16 history_data = 0;
  514.     U16 size;
  515.     /*----------------------------------------------------------------*/
  516.     /* Code Body                                                      */
  517.     /*----------------------------------------------------------------*/
  518.     CloseCategory57Screen();
  519.     scr.scrnID = SCR_ID_JMMS_SMIL_SETTINGS_TEXT_TIMINGS;
  520.     scr.entryFuncPtr = mmi_jmms_entry_smil_settings_media_timing;
  521.     pfnUnicodeStrcpy((S8*) scr.inputBuffer, (S8*) & history_data);
  522.     GetCategory57History(scr.guiBuffer);
  523.     size = (U16) GetCategory57DataSize();       /* added for inline edit history */
  524.     GetCategory57Data((U8*) scr.inputBuffer);   /* added for inline edit history */
  525.     AddNHistory(scr, size);
  526.     if (g_jmms_context->jmms_inline_lists != NULL)
  527.     {
  528.         jdd_MemFree(g_jmms_context->jmms_inline_lists);
  529.         g_jmms_context->jmms_inline_lists = NULL;
  530.     }
  531. }
  532. /*****************************************************************************
  533.  * FUNCTION
  534.  *  mmi_jmms_fill_media_timing_inline_edit_struct
  535.  * DESCRIPTION
  536.  *  this fn will fill the inline struct of smil media timings settings
  537.  * PARAMETERS
  538.  *  inline_edit_p       [IN/OUT]        
  539.  * RETURNS
  540.  *  void
  541.  *****************************************************************************/
  542. void mmi_jmms_fill_media_timing_inline_edit_struct(void *inline_edit_p)
  543. {
  544.     /*----------------------------------------------------------------*/
  545.     /* Local Variables                                                */
  546.     /*----------------------------------------------------------------*/
  547.     InlineItem *inline_struct_p = (InlineItem*) inline_edit_p;
  548.     U8 item_offset = 0;
  549.     /*----------------------------------------------------------------*/
  550.     /* Code Body                                                      */
  551.     /*----------------------------------------------------------------*/
  552.     if (g_jmms_context->jmms_inline_lists == NULL)
  553.     {
  554.         g_jmms_context->jmms_inline_lists =
  555.             (jmms_common_inline_lists_struct*) jdd_MemAlloc(sizeof(jmms_common_inline_lists_struct), 1);
  556.         if (g_jmms_context->jmms_inline_lists == NULL)
  557.         {
  558.             DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  559.             return;
  560.         }
  561.     }
  562.     g_jmms_context->jmms_inline_lists->on_off_list[0] = (S8*) GetString(STR_ID_JMMS_MAXIMUM);
  563.     g_jmms_context->jmms_inline_lists->on_off_list[1] = (S8*) GetString(STR_ID_JMMS_TEXT_SETTINGS_CUSTOM);
  564.     SetInlineItemActivation(&inline_struct_p[item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  565.     SetInlineItemCaption(&inline_struct_p[item_offset], (PU8) GetString(STR_ID_JMMS_SMIL_SETTINGS_START_TIME));
  566.     SetInlineItemActivation(&inline_struct_p[++item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  567.     SetInlineItemTextEdit(
  568.         &inline_struct_p[item_offset],
  569.         (PU8) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer,
  570.         MAX_JMMS_SLIDE_TIME_DIGITS + 1,
  571.         INPUT_TYPE_NUMERIC);
  572.     SetInlineItemActivation(&inline_struct_p[++item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  573.     SetInlineItemCaption(&inline_struct_p[item_offset], (PU8) GetString(STR_ID_JMMS_DURATION));
  574.     SetInlineItemActivation(&inline_struct_p[++item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  575.     SetInlineItemSelect(
  576.         &inline_struct_p[item_offset],
  577.         2,
  578.         (U8 **) g_jmms_context->jmms_inline_lists->on_off_list,
  579.         (S32*) & (g_jmms_context->jmms_inline_items.smil_settings_items.duration_select) /* CurrSelect */ );
  580.     RegisterInlineSelectHighlightHandler(&inline_struct_p[item_offset], mmi_jmms_inline_media_timings_hilite_handler);
  581. }
  582. /*****************************************************************************
  583.  * FUNCTION
  584.  *  mmi_jmms_pre_entry_media_duration
  585.  * DESCRIPTION
  586.  *  fn to be called before entry media duration screen
  587.  * PARAMETERS
  588.  *  index       [IN]        
  589.  *  a(?)        [IN/OUT]        Nil(?)
  590.  *  b(?)        [IN]            Nil(?)
  591.  * RETURNS
  592.  *  void
  593.  *****************************************************************************/
  594. void mmi_jmms_pre_entry_media_duration(void)
  595. {
  596. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_temp_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_done_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  597. mmi_jmms_entry_media_duration();
  598. }
  599. /*****************************************************************************
  600.  * FUNCTION
  601.  *  mmi_jmms_inline_media_timings_hilite_handler
  602.  * DESCRIPTION
  603.  *  fn to be called when duration is highlited in media time settings.
  604.  * PARAMETERS
  605.  *  index       [IN]        
  606.  *  a(?)        [IN/OUT]        Nil(?)
  607.  *  b(?)        [IN]            Nil(?)
  608.  * RETURNS
  609.  *  void
  610.  *****************************************************************************/
  611. void mmi_jmms_inline_media_timings_hilite_handler(S32 index)
  612. {
  613.     /*----------------------------------------------------------------*/
  614.     /* Local Variables                                                */
  615.     /*----------------------------------------------------------------*/
  616.     /*----------------------------------------------------------------*/
  617.     /* Code Body                                                      */
  618.     /*----------------------------------------------------------------*/
  619.     if (index == 1)
  620.     {
  621. ChangeLeftSoftkey(STR_GLOBAL_EDIT, IMG_GLOBAL_OK);
  622.         SetCategory57LeftSoftkeyFunction(mmi_jmms_pre_entry_media_duration);
  623.     }
  624.     else
  625.     {
  626.         ChangeLeftSoftkey(0, 0);
  627.         ClearKeyHandler(KEY_LSK, KEY_EVENT_UP);
  628.     }
  629. }
  630. /*****************************************************************************
  631.  * FUNCTION
  632.  *  mmi_jmms_entry_media_duration
  633.  * DESCRIPTION
  634.  *  entry fn for custom media duration screen.
  635.  * PARAMETERS
  636.  *  void
  637.  *  a(?)        [IN/OUT]        Nil(?)
  638.  *  b(?)        [IN]            Nil(?)
  639.  * RETURNS
  640.  *  void
  641.  *****************************************************************************/
  642. void mmi_jmms_entry_media_duration(void)
  643. {
  644.     /*----------------------------------------------------------------*/
  645.     /* Local Variables                                                */
  646.     /*----------------------------------------------------------------*/
  647.     U8 *gui_buffer;
  648.     /*----------------------------------------------------------------*/
  649.     /* Code Body                                                      */
  650.     /*----------------------------------------------------------------*/
  651.     EntryNewScreen(SCR_ID_JMMS_SMIL_SETTINGS_MEDIA_TIMINGS_DURATION, NULL, mmi_jmms_entry_media_duration, NULL);
  652.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_SMIL_SETTINGS_MEDIA_TIMINGS_DURATION);
  653.     ShowCategory5Screen(
  654.         STR_ID_JMMS_DURATION,
  655.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  656.         STR_GLOBAL_OK,
  657.         IMG_GLOBAL_OK,
  658.         STR_GLOBAL_BACK,
  659.         IMG_GLOBAL_BACK,
  660.         INPUT_TYPE_NUMERIC,
  661.         g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_temp_buffer,
  662.         MAX_JMMS_MEDIA_DURATION_DIGITS + 1,
  663.         gui_buffer);
  664.     SetLeftSoftkeyFunction(mmi_jmms_save_custom_media_duration, KEY_EVENT_UP);
  665.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  666. }
  667. /*****************************************************************************
  668.  * FUNCTION
  669.  *  mmi_jmms_save_custom_media_duration
  670.  * DESCRIPTION
  671.  *  fn to change the value change in custom duartion.
  672.  * PARAMETERS
  673.  *  void
  674.  *  a(?)        [IN/OUT]        Nil(?)
  675.  *  b(?)        [IN]            Nil(?)
  676.  * RETURNS
  677.  *  void
  678.  *****************************************************************************/
  679. void mmi_jmms_save_custom_media_duration(void)
  680. {
  681.     /*----------------------------------------------------------------*/
  682.     /* Local Variables                                                */
  683.     /*----------------------------------------------------------------*/
  684.     /*----------------------------------------------------------------*/
  685.     /* Code Body                                                      */
  686.     /*----------------------------------------------------------------*/
  687.     g_custom_var_change = 1;
  688. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_done_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_temp_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  689.     GoBackHistory();
  690. }
  691. /*****************************************************************************
  692.  * FUNCTION
  693.  *  mmi_jmms_confirm_save_text_timing_settings
  694.  * DESCRIPTION
  695.  *  fn to show the confirmation popup when user press done on text timings settings.
  696.  * PARAMETERS
  697.  *  void
  698.  *  a(?)        [IN/OUT]        Nil(?)
  699.  *  b(?)        [IN]            Nil(?)
  700.  * RETURNS
  701.  *  void
  702.  *****************************************************************************/
  703. void mmi_jmms_confirm_save_text_timing_settings(void)
  704. {
  705.     /*----------------------------------------------------------------*/
  706.     /* Local Variables                                                */
  707.     /*----------------------------------------------------------------*/
  708.     U32 start_time;
  709.     /*----------------------------------------------------------------*/
  710.     /* Code Body                                                      */
  711.     /*----------------------------------------------------------------*/
  712.     start_time =
  713.         (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer);
  714.     if (g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time &&
  715. start_time >= g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time)
  716.     {
  717.         DisplayPopup(
  718.             (PU8) GetString(STR_ID_JMMS_SLIDE_TIME_EXCEED),
  719.             IMG_GLOBAL_WARNING,
  720.             1,
  721.             JMMS_POPUP_TIME,
  722.             WARNING_TONE);
  723.     }
  724.     else
  725.     {
  726.         DisplayConfirm(
  727.             STR_GLOBAL_YES,
  728.             IMG_GLOBAL_YES,
  729.             STR_GLOBAL_NO,
  730.             IMG_GLOBAL_NO,
  731.             get_string(STR_GLOBAL_SAVE),
  732.             IMG_GLOBAL_QUESTION,
  733.             WARNING_TONE);
  734.         SetLeftSoftkeyFunction(mmi_jmms_save_text_timing_settings, KEY_EVENT_UP);
  735.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  736.         DeleteUptoScrID(SCR_ID_JMMS_EDIT_CONTENT_SMIL_SETTINGS);
  737.     }
  738. }
  739. /*****************************************************************************
  740.  * FUNCTION
  741.  *  mmi_jmms_save_text_timing_settings
  742.  * DESCRIPTION
  743.  *  fn to be called when user press yes on text settings confirmation.
  744.  * PARAMETERS
  745.  *  void
  746.  *  a(?)        [IN/OUT]        Nil(?)
  747.  *  b(?)        [IN]            Nil(?)
  748.  * RETURNS
  749.  *  void
  750.  *****************************************************************************/
  751. void mmi_jmms_save_text_timing_settings(void)
  752. {
  753.     /*----------------------------------------------------------------*/
  754.     /* Local Variables                                                */
  755.     /*----------------------------------------------------------------*/
  756.     U32 start_time, duration;
  757.     U8 max_set;
  758.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  759.     /*----------------------------------------------------------------*/
  760.     /* Code Body                                                      */
  761.     /*----------------------------------------------------------------*/
  762. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_temp_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  763.     start_time =
  764.         (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer);
  765.     if (g_jmms_context->jmms_inline_items.smil_settings_items.duration_select == 0)
  766.     {
  767. duration = 0;
  768.         max_set = 1;
  769.     }
  770.     else
  771.     {
  772.         duration =
  773.             (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.
  774.                            media_duration_edit_buffer);
  775.         max_set = 0;
  776.     }
  777.     err_code = mmi_jmms_set_media_time(
  778.                 start_time,
  779.                 duration,
  780.                 g_jmms_context->compose_context->curr_slide_info.text_ID,
  781.                 g_jmms_context->compose_context->curr_page_index);
  782.     if (err_code == JMMS_COMP_OK)
  783.     {
  784.         g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].txt_dur_max_set =
  785.             max_set;
  786.         DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JMMS_POPUP_TIME, SUCCESS_TONE);
  787.     }
  788. }
  789. /*****************************************************************************
  790.  * FUNCTION
  791.  *  mmi_jmms_confirm_save_image_timing_settings
  792.  * DESCRIPTION
  793.  *  fn to show the confirmation popup when user press done on image timings settings.
  794.  * PARAMETERS
  795.  *  void
  796.  *  a(?)        [IN/OUT]        Nil(?)
  797.  *  b(?)        [IN]            Nil(?)
  798.  * RETURNS
  799.  *  void
  800.  *****************************************************************************/
  801. void mmi_jmms_confirm_save_image_timing_settings(void)
  802. {
  803.     /*----------------------------------------------------------------*/
  804.     /* Local Variables                                                */
  805.     /*----------------------------------------------------------------*/
  806.     U32 start_time;
  807.     /*----------------------------------------------------------------*/
  808.     /* Code Body                                                      */
  809.     /*----------------------------------------------------------------*/
  810.     start_time =
  811.         (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer);
  812.     if (g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time &&
  813. start_time >= g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time)
  814.     {
  815.         DisplayPopup(
  816.             (PU8) GetString(STR_ID_JMMS_SLIDE_TIME_EXCEED),
  817.             IMG_GLOBAL_WARNING,
  818.             1,
  819.             JMMS_POPUP_TIME,
  820.             WARNING_TONE);
  821.     }
  822.     else
  823.     {
  824.         DisplayConfirm(
  825.             STR_GLOBAL_YES,
  826.             IMG_GLOBAL_YES,
  827.             STR_GLOBAL_NO,
  828.             IMG_GLOBAL_NO,
  829.             get_string(STR_GLOBAL_SAVE),
  830.             IMG_GLOBAL_QUESTION,
  831.             WARNING_TONE);
  832.         SetLeftSoftkeyFunction(mmi_jmms_save_image_timing_settings, KEY_EVENT_UP);
  833.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  834.         DeleteUptoScrID(SCR_ID_JMMS_EDIT_CONTENT_SMIL_SETTINGS);
  835.     }
  836. }
  837. /*****************************************************************************
  838.  * FUNCTION
  839.  *  mmi_jmms_save_image_timing_settings
  840.  * DESCRIPTION
  841.  *  fn to be called when user press yes on image timings settings
  842.  * PARAMETERS
  843.  *  void
  844.  *  a(?)        [IN/OUT]        Nil(?)
  845.  *  b(?)        [IN]            Nil(?)
  846.  * RETURNS
  847.  *  void
  848.  *****************************************************************************/
  849. void mmi_jmms_save_image_timing_settings(void)
  850. {
  851.     /*----------------------------------------------------------------*/
  852.     /* Local Variables                                                */
  853.     /*----------------------------------------------------------------*/
  854.     U32 start_time, duration;
  855.     U8 max_set;
  856.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  857.     /*----------------------------------------------------------------*/
  858.     /* Code Body                                                      */
  859.     /*----------------------------------------------------------------*/
  860. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_done_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  861.     start_time =
  862.         (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer);
  863.     if (g_jmms_context->jmms_inline_items.smil_settings_items.duration_select == 0)
  864.     {
  865. duration = 0;
  866.         max_set = 1;
  867.     }
  868.     else
  869.     {
  870.         duration =
  871.             (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.
  872.                            media_duration_edit_buffer);
  873.         max_set = 0;
  874.     }
  875.     err_code = mmi_jmms_set_media_time(
  876.                 start_time,
  877.                 duration,
  878.                 g_jmms_context->compose_context->curr_slide_info.image_ID,
  879.                 g_jmms_context->compose_context->curr_page_index);
  880.     if (err_code == JMMS_COMP_OK)
  881.     {
  882.         g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].img_dur_max_set =
  883.             max_set;
  884.         DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JMMS_POPUP_TIME, SUCCESS_TONE);
  885.     }
  886. }
  887. /*****************************************************************************
  888.  * FUNCTION
  889.  *  mmi_jmms_confirm_save_audio_timing_settings
  890.  * DESCRIPTION
  891.  *  fn to show the confirmation popup when user press done on audio timings settings.
  892.  * PARAMETERS
  893.  *  void
  894.  *  a(?)        [IN/OUT]        Nil(?)
  895.  *  b(?)        [IN]            Nil(?)
  896.  * RETURNS
  897.  *  void
  898.  *****************************************************************************/
  899. void mmi_jmms_confirm_save_audio_timing_settings(void)
  900. {
  901.     /*----------------------------------------------------------------*/
  902.     /* Local Variables                                                */
  903.     /*----------------------------------------------------------------*/
  904.     U32 start_time;
  905.     /*----------------------------------------------------------------*/
  906.     /* Code Body                                                      */
  907.     /*----------------------------------------------------------------*/
  908.     start_time =
  909.         (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer);
  910.     if (g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time &&
  911. start_time >= g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time)
  912.     {
  913.         DisplayPopup(
  914.             (PU8) GetString(STR_ID_JMMS_SLIDE_TIME_EXCEED),
  915.             IMG_GLOBAL_WARNING,
  916.             1,
  917.             JMMS_POPUP_TIME,
  918.             WARNING_TONE);
  919.     }
  920.     else
  921.     {
  922.         DisplayConfirm(
  923.             STR_GLOBAL_YES,
  924.             IMG_GLOBAL_YES,
  925.             STR_GLOBAL_NO,
  926.             IMG_GLOBAL_NO,
  927.             get_string(STR_GLOBAL_SAVE),
  928.             IMG_GLOBAL_QUESTION,
  929.             WARNING_TONE);
  930.         SetLeftSoftkeyFunction(mmi_jmms_save_audio_timing_settings, KEY_EVENT_UP);
  931.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  932.         DeleteUptoScrID(SCR_ID_JMMS_EDIT_CONTENT_SMIL_SETTINGS);
  933.     }
  934. }
  935. /*****************************************************************************
  936.  * FUNCTION
  937.  *  mmi_jmms_save_audio_timing_settings
  938.  * DESCRIPTION
  939.  *  fn to be called when user press yes on audio timings settings.
  940.  * PARAMETERS
  941.  *  void
  942.  *  a(?)        [IN/OUT]        Nil(?)
  943.  *  b(?)        [IN]            Nil(?)
  944.  * RETURNS
  945.  *  void
  946.  *****************************************************************************/
  947. void mmi_jmms_save_audio_timing_settings(void)
  948. {
  949.     /*----------------------------------------------------------------*/
  950.     /* Local Variables                                                */
  951.     /*----------------------------------------------------------------*/
  952.     U32 start_time, duration;
  953.     U8 max_set;
  954.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  955.     /*----------------------------------------------------------------*/
  956.     /* Code Body                                                      */
  957.     /*----------------------------------------------------------------*/
  958. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_done_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  959.     start_time =
  960.         (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer);
  961.     if (g_jmms_context->jmms_inline_items.smil_settings_items.duration_select == 0)
  962.     {
  963. duration = 0;
  964.         max_set = 1;
  965.     }
  966.     else
  967.     {
  968.         duration =
  969.             (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.
  970.                            media_duration_edit_buffer);
  971.         max_set = 0;
  972.     }
  973. err_code = mmi_jmms_set_media_time(
  974. start_time,
  975. duration,
  976. g_jmms_context->compose_context->curr_slide_info.audio_ID,
  977. g_jmms_context->compose_context->curr_page_index);
  978.     if (err_code == JMMS_COMP_OK)
  979.     {
  980.         g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].audio_dur_max_set =
  981.             max_set;
  982.         DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JMMS_POPUP_TIME, SUCCESS_TONE);
  983.     }
  984. }
  985. /*****************************************************************************
  986.  * FUNCTION
  987.  *  mmi_jmms_confirm_save_video_timing_settings
  988.  * DESCRIPTION
  989.  *  fn to show the confirmation popup when user press done on video timings settings.
  990.  * PARAMETERS
  991.  *  void
  992.  *  a(?)        [IN/OUT]        Nil(?)
  993.  *  b(?)        [IN]            Nil(?)
  994.  * RETURNS
  995.  *  void
  996.  *****************************************************************************/
  997. void mmi_jmms_confirm_save_video_timing_settings(void)
  998. {
  999.     /*----------------------------------------------------------------*/
  1000.     /* Local Variables                                                */
  1001.     /*----------------------------------------------------------------*/
  1002.     U32 start_time;
  1003.     /*----------------------------------------------------------------*/
  1004.     /* Code Body                                                      */
  1005.     /*----------------------------------------------------------------*/
  1006.     start_time =
  1007.         (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer);
  1008.     if (g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time &&
  1009. start_time >= g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time)
  1010.     {
  1011.         DisplayPopup(
  1012.             (PU8) GetString(STR_ID_JMMS_SLIDE_TIME_EXCEED),
  1013.             IMG_GLOBAL_WARNING,
  1014.             1,
  1015.             JMMS_POPUP_TIME,
  1016.             WARNING_TONE);
  1017.     }
  1018.     else
  1019.     {
  1020.         DisplayConfirm(
  1021.             STR_GLOBAL_YES,
  1022.             IMG_GLOBAL_YES,
  1023.             STR_GLOBAL_NO,
  1024.             IMG_GLOBAL_NO,
  1025.             get_string(STR_GLOBAL_SAVE),
  1026.             IMG_GLOBAL_QUESTION,
  1027.             WARNING_TONE);
  1028.         SetLeftSoftkeyFunction(mmi_jmms_save_video_timing_settings, KEY_EVENT_UP);
  1029.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1030.         DeleteUptoScrID(SCR_ID_JMMS_EDIT_CONTENT_SMIL_SETTINGS);
  1031.     }
  1032. }
  1033. /*****************************************************************************
  1034.  * FUNCTION
  1035.  *  mmi_jmms_save_video_timing_settings
  1036.  * DESCRIPTION
  1037.  *  fn to be called when user press yes on video settings confirmation.
  1038.  * PARAMETERS
  1039.  *  void
  1040.  *  a(?)        [IN/OUT]        Nil(?)
  1041.  *  b(?)        [IN]            Nil(?)
  1042.  * RETURNS
  1043.  *  void
  1044.  *****************************************************************************/
  1045. void mmi_jmms_save_video_timing_settings(void)
  1046. {
  1047.     /*----------------------------------------------------------------*/
  1048.     /* Local Variables                                                */
  1049.     /*----------------------------------------------------------------*/
  1050.     U32 start_time, duration;
  1051.     U8 max_set;
  1052.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  1053.     /*----------------------------------------------------------------*/
  1054.     /* Code Body                                                      */
  1055.     /*----------------------------------------------------------------*/
  1056. memcpy(g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_buffer , g_jmms_context->jmms_inline_items.smil_settings_items.media_duration_edit_done_buffer,((MAX_JMMS_MEDIA_DURATION_DIGITS + 1) *ENCODING_LENGTH));
  1057.     start_time =
  1058.         (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer);
  1059.     if (g_jmms_context->jmms_inline_items.smil_settings_items.duration_select == 0)
  1060.     {
  1061. duration = 0;
  1062.         max_set = 1;
  1063.     }
  1064.     else
  1065.     {
  1066.         duration =
  1067.             (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.
  1068.                            media_duration_edit_buffer);
  1069.         max_set = 0;
  1070.     }
  1071. err_code = mmi_jmms_set_media_time(
  1072. start_time,
  1073. duration,
  1074. g_jmms_context->compose_context->curr_slide_info.video_ID,
  1075. g_jmms_context->compose_context->curr_page_index);
  1076.     if (err_code == JMMS_COMP_OK)
  1077.     {
  1078.         g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].video_dur_max_set =
  1079.             max_set;
  1080.         DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JMMS_POPUP_TIME, SUCCESS_TONE);
  1081.     }
  1082. }
  1083. /*****************************************************************************
  1084.  * FUNCTION
  1085.  *  mmi_jmms_entry_smil_bg_color_settings
  1086.  * DESCRIPTION
  1087.  *  entry fn for BG color smil settings
  1088.  * PARAMETERS
  1089.  *  void
  1090.  *  a(?)        [IN/OUT]        Nil(?)
  1091.  *  b(?)        [IN]            Nil(?)
  1092.  * RETURNS
  1093.  *  void
  1094.  *****************************************************************************/
  1095. void mmi_jmms_entry_smil_bg_color_settings(void)
  1096. {
  1097.     /*----------------------------------------------------------------*/
  1098.     /* Local Variables                                                */
  1099.     /*----------------------------------------------------------------*/
  1100.     U8 *gui_buffer;
  1101.     U8 count = 0;
  1102.     /*----------------------------------------------------------------*/
  1103.     /* Code Body                                                      */
  1104.     /*----------------------------------------------------------------*/
  1105.     EntryNewScreen(SCR_ID_JMMS_SMIL_SETTINGS_BG_COLOR, NULL, mmi_jmms_entry_smil_bg_color_settings, NULL);
  1106.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_SMIL_SETTINGS_BG_COLOR);
  1107.     RegisterHighlightHandler(mmi_jmms_bg_color_highlight_hdlr);
  1108.     for (count = 0;
  1109.          g_jmms_context->compose_context->mms_bg_color != g_jmms_color_RGB_list[count] &&
  1110.          count < MAX_JMMS_COLOR_NUM - 1; count++);
  1111.     if (count == MAX_JMMS_COLOR_NUM - 1)
  1112.     {
  1113.         g_jmms_context->jmms_inline_items.text_settings_items.color_selected = MAX_JMMS_COLOR_NUM - 1;
  1114.     }
  1115.     else
  1116.     {
  1117.         g_jmms_context->jmms_inline_items.text_settings_items.color_selected = count;
  1118.         /* MAUI_00018544 Start */
  1119.         g_bg_custom_color_RGB = 0x00000064;
  1120.         /* MAUI_00018544 End */
  1121.     }
  1122.     g_jmms_context->jmms_inline_items.text_settings_items.color_list[0] =
  1123.         (S8*) GetString(STR_ID_JMMS_TEXT_SETTINGS_COLOR1);
  1124.     g_jmms_context->jmms_inline_items.text_settings_items.color_list[1] =
  1125.         (S8*) GetString(STR_ID_JMMS_TEXT_SETTINGS_COLOR2);
  1126.     g_jmms_context->jmms_inline_items.text_settings_items.color_list[2] =
  1127.         (S8*) GetString(STR_ID_JMMS_TEXT_SETTINGS_COLOR3);
  1128.     g_jmms_context->jmms_inline_items.text_settings_items.color_list[3] =
  1129.         (S8*) GetString(STR_ID_JMMS_TEXT_SETTINGS_COLOR4);
  1130.     g_jmms_context->jmms_inline_items.text_settings_items.color_list[4] =
  1131.         (S8*) GetString(STR_ID_JMMS_TEXT_SETTINGS_COLOR5);
  1132.     g_jmms_context->jmms_inline_items.text_settings_items.color_list[5] =
  1133.         (S8*) GetString(STR_ID_JMMS_TEXT_SETTINGS_CUSTOM);
  1134.     ShowCategory53Screen(
  1135.         STR_ID_JMMS_EDIT_CONTENT_SETTINGS_SMIL_BGCOLOR,
  1136.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  1137.         STR_GLOBAL_OK,
  1138.         IMG_GLOBAL_OK,
  1139.         STR_GLOBAL_BACK,
  1140.         IMG_GLOBAL_BACK,
  1141.         (S32) MAX_JMMS_COLOR_NUM,
  1142.         (U8 **) g_jmms_context->jmms_inline_items.text_settings_items.color_list,
  1143.         (U16*) gIndexIconsImageList,
  1144.         NULL,
  1145.         0,
  1146.         g_jmms_context->jmms_inline_items.text_settings_items.color_selected,
  1147.         gui_buffer);
  1148.     SetLeftSoftkeyFunction(mmi_jmms_select_bg_color, KEY_EVENT_UP);
  1149.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1150.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1151. }
  1152. /*****************************************************************************
  1153.  * FUNCTION
  1154.  *  mmi_jmms_bg_color_highlight_hdlr
  1155.  * DESCRIPTION
  1156.  *  highlight handler for Bg color screen.
  1157.  * PARAMETERS
  1158.  *  index       [IN]        
  1159.  *  a(?)        [IN/OUT]        Nil(?)
  1160.  *  b(?)        [IN]            Nil(?)
  1161.  * RETURNS
  1162.  *  void
  1163.  *****************************************************************************/
  1164. void mmi_jmms_bg_color_highlight_hdlr(S32 index)
  1165. {
  1166.     /*----------------------------------------------------------------*/
  1167.     /* Local Variables                                                */
  1168.     /*----------------------------------------------------------------*/
  1169.     /*----------------------------------------------------------------*/
  1170.     /* Code Body                                                      */
  1171.     /*----------------------------------------------------------------*/
  1172.     g_jmms_context->curr_scr_hilite_index = index;
  1173. }
  1174. /*****************************************************************************
  1175.  * FUNCTION
  1176.  *  mmi_jmms_select_bg_color
  1177.  * DESCRIPTION
  1178.  *  fn to be called when bg color is selected
  1179.  * PARAMETERS
  1180.  *  void
  1181.  *  a(?)        [IN/OUT]        Nil(?)
  1182.  *  b(?)        [IN]            Nil(?)
  1183.  * RETURNS
  1184.  *  void
  1185.  *****************************************************************************/
  1186. void mmi_jmms_select_bg_color(void)
  1187. {
  1188.     /*----------------------------------------------------------------*/
  1189.     /* Local Variables                                                */
  1190.     /*----------------------------------------------------------------*/
  1191.     U32 bg_color;
  1192.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  1193.     /*----------------------------------------------------------------*/
  1194.     /* Code Body                                                      */
  1195.     /*----------------------------------------------------------------*/
  1196.     if (g_jmms_context->curr_scr_hilite_index >= MAX_JMMS_COLOR_NUM - 1)
  1197.     {
  1198.         g_custom_color_RGB_list[0] = (U8) ((0xFF000000 & g_bg_custom_color_RGB) >> 24);
  1199.         g_custom_color_RGB_list[1] = (U8) ((0x00FF0000 & g_bg_custom_color_RGB) >> 16);
  1200.         g_custom_color_RGB_list[2] = (U8) ((0x0000FF00 & g_bg_custom_color_RGB) >> 8);
  1201.         mmi_jmms_entry_bg_custom_color();
  1202.     }
  1203.     else
  1204.     {
  1205.         bg_color = g_jmms_color_RGB_list[g_jmms_context->curr_scr_hilite_index];
  1206.         err_code = mmi_jmms_set_bg_color(bg_color);
  1207.         if (err_code == JMMS_COMP_OK)
  1208.         {
  1209.             g_jmms_context->compose_context->mms_bg_color = bg_color;
  1210.             mmi_jmms_set_region_list();
  1211.             DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JMMS_POPUP_TIME, SUCCESS_TONE);
  1212.         }
  1213.         DeleteUptoScrID(SCR_ID_JMMS_EDIT_CONTENT);
  1214.     }
  1215. }
  1216. /*****************************************************************************
  1217.  * FUNCTION
  1218.  *  mmi_jmms_entry_bg_custom_color
  1219.  * DESCRIPTION
  1220.  *  entry fn for background custom color screen.
  1221.  * PARAMETERS
  1222.  *  void
  1223.  *  a(?)        [IN/OUT]        Nil(?)
  1224.  *  b(?)        [IN]            Nil(?)
  1225.  * RETURNS
  1226.  *  void
  1227.  *****************************************************************************/
  1228. void mmi_jmms_entry_bg_custom_color(void)
  1229. {
  1230.     /*----------------------------------------------------------------*/
  1231.     /* Local Variables                                                */
  1232.     /*----------------------------------------------------------------*/
  1233.     U8 *gui_buffer;
  1234.     /*----------------------------------------------------------------*/
  1235.     /* Code Body                                                      */
  1236.     /*----------------------------------------------------------------*/
  1237.     EntryNewScreen(SCR_ID_JMMS_CUSTOM_COLOR, NULL, mmi_jmms_entry_bg_custom_color, NULL);
  1238.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_CUSTOM_COLOR);
  1239. /* MAUI_00018451 Start */
  1240. if (gui_buffer == NULL)
  1241. {
  1242.     g_slider_info = MMI_CAT91_COLOR_SLIDER_RED_COLOR;
  1243. }
  1244. /* MAUI_00018451 End */
  1245.     ShowCategory91Screen(
  1246.         STR_ID_JMMS_EDIT_CONTENT_SETTINGS_SMIL_BGCOLOR,
  1247.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  1248.         STR_GLOBAL_OK,
  1249.         IMG_GLOBAL_OK,
  1250.         STR_GLOBAL_BACK,
  1251.         IMG_GLOBAL_BACK,
  1252.         &g_custom_color_RGB_list[0],
  1253.         &g_custom_color_RGB_list[1],
  1254.         &g_custom_color_RGB_list[2],
  1255. /* MAUI_00018451 Start */
  1256. &g_slider_info,
  1257. /* MAUI_00018451 End */
  1258.         gui_buffer);
  1259.     SetLeftSoftkeyFunction(mmi_jmms_save_smil_bg_custom_color, KEY_EVENT_UP);
  1260.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1261. }
  1262. /*****************************************************************************
  1263.  * FUNCTION
  1264.  *  mmi_jmms_save_smil_bg_custom_color
  1265.  * DESCRIPTION
  1266.  *  fn to save background customized color.
  1267.  * PARAMETERS
  1268.  *  void
  1269.  *  a(?)        [IN/OUT]        Nil(?)
  1270.  *  b(?)        [IN]            Nil(?)
  1271.  * RETURNS
  1272.  *  void
  1273.  *****************************************************************************/
  1274. void mmi_jmms_save_smil_bg_custom_color(void)
  1275. {
  1276.     /*----------------------------------------------------------------*/
  1277.     /* Local Variables                                                */
  1278.     /*----------------------------------------------------------------*/
  1279.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  1280.     /*----------------------------------------------------------------*/
  1281.     /* Code Body                                                      */
  1282.     /*----------------------------------------------------------------*/
  1283.     g_bg_custom_color_RGB &= 0x000000FF;
  1284.     g_bg_custom_color_RGB |=
  1285.         ((((U32) g_custom_color_RGB_list[0]) << 24) | (((U32) g_custom_color_RGB_list[1]) << 16) |
  1286.          (((U32) g_custom_color_RGB_list[2]) << 8));
  1287.     err_code = mmi_jmms_set_bg_color(g_bg_custom_color_RGB);
  1288.     if (err_code == JMMS_COMP_OK)
  1289.     {
  1290.         g_jmms_context->compose_context->mms_bg_color = g_bg_custom_color_RGB;
  1291.         mmi_jmms_set_region_list();
  1292.         DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JMMS_POPUP_TIME, SUCCESS_TONE);
  1293.     }
  1294.     DeleteUptoScrID(SCR_ID_JMMS_EDIT_CONTENT);
  1295. }
  1296. /*****************************************************************************
  1297.  * FUNCTION
  1298.  *  mmi_jmms_pre_entry_edit_content_slide_time
  1299.  * DESCRIPTION
  1300.  *  pre entry fn for slide duration screen.
  1301.  * PARAMETERS
  1302.  *  void
  1303.  *  a(?)        [IN/OUT]        Nil(?)
  1304.  *  b(?)        [IN]            Nil(?)
  1305.  * RETURNS
  1306.  *  void
  1307.  *****************************************************************************/
  1308. void mmi_jmms_pre_entry_edit_content_slide_time(void)
  1309. {
  1310.     /*----------------------------------------------------------------*/
  1311.     /* Local Variables                                                */
  1312.     /*----------------------------------------------------------------*/
  1313.     /*----------------------------------------------------------------*/
  1314.     /* Code Body                                                      */
  1315.     /*----------------------------------------------------------------*/
  1316.     /*
  1317.      * if(g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time==0)
  1318.      * {
  1319.      * g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time=mmi_jmms_compose_settings_default_slide_time();
  1320.      * }
  1321.      */
  1322.     gui_itoa(
  1323.         (S32) g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time,
  1324.         (UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer,
  1325.         10);
  1326.     mmi_jmms_entry_edit_content_slide_time();
  1327. }
  1328. /*****************************************************************************
  1329.  * FUNCTION
  1330.  *  mmi_jmms_entry_edit_content_slide_time
  1331.  * DESCRIPTION
  1332.  *  entry fn for slide duration screen.
  1333.  * PARAMETERS
  1334.  *  void
  1335.  *  a(?)        [IN/OUT]        Nil(?)
  1336.  *  b(?)        [IN]            Nil(?)
  1337.  * RETURNS
  1338.  *  void
  1339.  *****************************************************************************/
  1340. void mmi_jmms_entry_edit_content_slide_time(void)
  1341. {
  1342.     /*----------------------------------------------------------------*/
  1343.     /* Local Variables                                                */
  1344.     /*----------------------------------------------------------------*/
  1345.     U8 *gui_buffer;
  1346.     /*----------------------------------------------------------------*/
  1347.     /* Code Body                                                      */
  1348.     /*----------------------------------------------------------------*/
  1349.     EntryNewScreen(SCR_ID_JMMS_EDIT_CONTENT_SLIDE_TIME, NULL, mmi_jmms_entry_edit_content_slide_time, NULL);
  1350.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_EDIT_CONTENT_SLIDE_TIME);
  1351.     ShowCategory5Screen(
  1352.         STR_ID_JMMS_EDIT_SLIDE_TIME,
  1353.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  1354.         STR_GLOBAL_OK,
  1355.         IMG_GLOBAL_OK,
  1356.         STR_GLOBAL_BACK,
  1357.         IMG_GLOBAL_BACK,
  1358.         INPUT_TYPE_NUMERIC,
  1359.         g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer,
  1360.         MAX_JMMS_MEDIA_DURATION_DIGITS + 1,
  1361.         gui_buffer);
  1362.     SetLeftSoftkeyFunction(mmi_jmms_save_edit_content_slide_timing, KEY_EVENT_UP);
  1363.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1364. }
  1365. /*****************************************************************************
  1366.  * FUNCTION
  1367.  *  mmi_jmms_save_edit_content_slide_timing
  1368.  * DESCRIPTION
  1369.  *  fn save the slide timings when user press ok on slide timings settings.
  1370.  * PARAMETERS
  1371.  *  void
  1372.  *  a(?)        [IN/OUT]        Nil(?)
  1373.  *  b(?)        [IN]            Nil(?)
  1374.  * RETURNS
  1375.  *  void
  1376.  *****************************************************************************/
  1377. void mmi_jmms_save_edit_content_slide_timing(void)
  1378. {
  1379.     /*----------------------------------------------------------------*/
  1380.     /* Local Variables                                                */
  1381.     /*----------------------------------------------------------------*/
  1382.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  1383.     U32 slide_time;
  1384.     /*----------------------------------------------------------------*/
  1385.     /* Code Body                                                      */
  1386.     /*----------------------------------------------------------------*/
  1387. if(pfnUnicodeStrncmp
  1388.              ((S8*) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer, "",
  1389.               1 * ENCODING_LENGTH) == 0)
  1390. {
  1391. DisplayPopup((U8*) GetString(STR_ID_SLIDE_TIME_ZERO_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  1392. return;
  1393. }
  1394. slide_time = (U32) gui_atoi((UI_string_type) g_jmms_context->jmms_inline_items.smil_settings_items.slide_time_edit_buffer);
  1395.     err_code = mmi_jmms_save_post_entry_edit_content_slide_timing(slide_time);
  1396. if(err_code != JMMS_COMP_OK)
  1397. {
  1398.     DisplayPopup(
  1399. (PU8) GetString(STR_ID_JMMS_MEDIA_TIME_EXCEED),
  1400. IMG_GLOBAL_WARNING,
  1401. 1,
  1402. JMMS_POPUP_TIME,
  1403. WARNING_TONE);
  1404. return;
  1405. }
  1406.     err_code = mmi_jmms_save_page_time(slide_time);
  1407.     if (err_code == JMMS_COMP_OK)
  1408.     {
  1409.         g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time = slide_time;
  1410.         DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JMMS_POPUP_TIME, SUCCESS_TONE);
  1411.         DeleteUptoScrID(SCR_ID_JMMS_EDIT_CONTENT_SETTINGS);
  1412.     }
  1413.     else
  1414.     {
  1415.         DeleteUptoScrID(SCR_ID_JMMS_EDIT_CONTENT_SETTINGS);
  1416.     }
  1417. }
  1418. /* edit content screen */
  1419. /*****************************************************************************
  1420.  * FUNCTION
  1421.  *  mmi_jmms_pre_entry_edit_content_screen
  1422.  * DESCRIPTION
  1423.  *  pre entry fn for edit content screen.
  1424.  * PARAMETERS
  1425.  *  void
  1426.  *  a(?)        [IN/OUT]        Nil(?)
  1427.  *  b(?)        [IN]            Nil(?)
  1428.  * RETURNS
  1429.  *  void
  1430.  *****************************************************************************/
  1431. void mmi_jmms_pre_entry_edit_content_screen(void)
  1432. {
  1433.     /*----------------------------------------------------------------*/
  1434.     /* Local Variables                                                */
  1435.     /*----------------------------------------------------------------*/
  1436.     U8 page_count;
  1437.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  1438.     /*----------------------------------------------------------------*/
  1439.     /* Code Body                                                      */
  1440.     /*----------------------------------------------------------------*/
  1441. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s ", "mmi_jmms_pre_entry_edit_content_screen"));  
  1442. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d", "Previous Set Values: Text Size of compose context is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size));  
  1443. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d", "Previous Set Values: Italic Selection of compose context is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic));  
  1444. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d", "Previous Set Values: Bold Selection of compose context is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold));  
  1445. #ifdef __DRM_SUPPORT__
  1446.     if (mmi_jmms_is_drm_fwd_lock_media_in_mms(g_jmms_context->msg_handle, E_TRUE) == E_TRUE)
  1447.     {
  1448.        return;
  1449.     }
  1450. #endif 
  1451.     if (g_jmms_context->compose_context == NULL)
  1452.     {
  1453.         g_jmms_context->compose_context =
  1454.             (jmms_compose_context_struct*) jdd_MemAlloc(sizeof(jmms_compose_context_struct), 1);
  1455.         if (g_jmms_context->compose_context == NULL)
  1456.         {
  1457.             DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  1458.             return;
  1459.         }
  1460.     }
  1461.     mmi_jmms_jdi_get_total_pages(g_jmms_context->msg_handle, &page_count);
  1462.     g_jmms_context->compose_context->curr_page_index = 0;
  1463.     if (page_count == 0)
  1464.     {
  1465.         g_jmms_context->compose_context->mms_bg_color = g_jmms_color_RGB_list[COLOR_WHITE];
  1466.         /* PMT HIMANSHU START 20060425 */
  1467.         /* Added by Deepali for root layout */
  1468.         err_code = mmi_jmms_set_bg_color(g_jmms_context->compose_context->mms_bg_color);
  1469.         if (err_code == JMMS_COMP_OK)
  1470.             /* PMT HIMANSHU END 20060425 */
  1471.         {
  1472.             err_code = mmi_jmms_compose_insert_slide();
  1473.         }
  1474.     }
  1475.     else
  1476.     {
  1477.         err_code = mmi_jmms_get_bg_color(&(g_jmms_context->compose_context->mms_bg_color));
  1478.         g_jmms_context->compose_context->curr_page_index = 1;
  1479.         if (err_code == JMMS_COMP_OK)
  1480.         {
  1481.             err_code = mmi_jmms_extract_slide_media_info(g_jmms_context->compose_context->curr_page_index);
  1482.         }
  1483.     }
  1484. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d", "After Set Values: Text Size of compose context is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size));  
  1485. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d", "After Set Values: Italic Selection of compose context is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic));  
  1486. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d", "After Set Values: Bold Selection of compose context is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold));  
  1487.     if (err_code == JMMS_COMP_OK)
  1488.     {
  1489.         mmi_jmms_entry_edit_content_screen();
  1490.     }
  1491. }
  1492. /*****************************************************************************
  1493.  * FUNCTION
  1494.  *  mmi_jmms_get_edit_content_scr_bg_color
  1495.  * DESCRIPTION
  1496.  *  set bg-color for MMS.
  1497.  * PARAMETERS
  1498.  *  void
  1499.  *  a(?)        [IN/OUT]        Nil(?)
  1500.  *  b(?)        [IN]            Nil(?)
  1501.  * RETURNS
  1502.  *  void
  1503.  *****************************************************************************/
  1504. color mmi_jmms_get_edit_content_scr_bg_color(void)
  1505. {
  1506.     /*----------------------------------------------------------------*/
  1507.     /* Local Variables                                                */
  1508.     /*----------------------------------------------------------------*/
  1509.     color bg_color;
  1510.     /*----------------------------------------------------------------*/
  1511.     /* Code Body                                                      */
  1512.     /*----------------------------------------------------------------*/
  1513.     mmi_jmms_convert_u32_to_color(&bg_color, g_jmms_context->compose_context->mms_bg_color);
  1514.     return bg_color;
  1515. }
  1516. /*****************************************************************************
  1517.  * FUNCTION
  1518.  *  mmi_jmms_get_edit_content_scr_txt_color
  1519.  * DESCRIPTION
  1520.  *  set txt-color for MMS slide.
  1521.  * PARAMETERS
  1522.  *  void
  1523.  *  a(?)        [IN/OUT]        Nil(?)
  1524.  *  b(?)        [IN]            Nil(?)
  1525.  * RETURNS
  1526.  *  void
  1527.  *****************************************************************************/
  1528. color mmi_jmms_get_edit_content_scr_txt_color(void)
  1529. {
  1530.     /*----------------------------------------------------------------*/
  1531.     /* Local Variables                                                */
  1532.     /*----------------------------------------------------------------*/
  1533.     color text_color;
  1534.     /*----------------------------------------------------------------*/
  1535.     /* Code Body                                                      */
  1536.     /*----------------------------------------------------------------*/
  1537.     mmi_jmms_convert_u32_to_color(&text_color, g_jmms_context->compose_context->curr_slide_info.slide_prop.text_color);
  1538.     return text_color;
  1539. }
  1540. /*****************************************************************************
  1541.  * FUNCTION
  1542.  *  mmi_jmms_get_edit_content_scr_txt_font
  1543.  * DESCRIPTION
  1544.  *  set txt-font for MMS slide.
  1545.  * PARAMETERS
  1546.  *  void
  1547.  *  a(?)        [IN/OUT]        Nil(?)
  1548.  *  b(?)        [IN]            Nil(?)
  1549.  * RETURNS
  1550.  *  void
  1551.  *****************************************************************************/
  1552. UI_font_type mmi_jmms_get_edit_content_scr_txt_font(void)
  1553. {
  1554.     /*----------------------------------------------------------------*/
  1555.     /* Local Variables                                                */
  1556.     /*----------------------------------------------------------------*/
  1557.     /*----------------------------------------------------------------*/
  1558.     /* Code Body                                                      */
  1559.     /*----------------------------------------------------------------*/
  1560.     return &(g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font);
  1561. }
  1562. /*****************************************************************************
  1563.  * FUNCTION
  1564.  *  GoBacktoWriteMMS
  1565.  * DESCRIPTION
  1566.  *  set dlag of write MMS screen as done.
  1567.  * PARAMETERS
  1568.  *  void
  1569.  *  a(?)        [IN/OUT]        Nil(?)
  1570.  *  b(?)        [IN]            Nil(?)
  1571.  * RETURNS
  1572.  *  void
  1573.  *****************************************************************************/
  1574. void GoBacktoWriteMMS(void)
  1575. {
  1576.     /*----------------------------------------------------------------*/
  1577.     /* Local Variables                                                */
  1578.     /*----------------------------------------------------------------*/
  1579.     /* JMMS_COMP_ERRCODE err_code; */
  1580.     /*----------------------------------------------------------------*/
  1581.     /* Code Body                                                      */
  1582.     /*----------------------------------------------------------------*/
  1583. /*    mmi_jmms_jdi_get_media_count(g_jmms_context->msg_handle, 0, &num_attchments, E_TRUE);
  1584.     mmi_jmms_jdi_get_media_count(g_jmms_context->msg_handle, 1, &num_inline_media, E_FALSE);
  1585.     mmi_jmms_jdi_get_total_pages(g_jmms_context->msg_handle, &num_pages);
  1586.     if ((num_pages == 1) && (num_inline_media == 0)
  1587.         && (jc_tcslen((UI_character_type*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer) == 0)
  1588.         && g_jmms_context->compose_context->curr_slide_info.audio_ID == 0
  1589.         && g_jmms_context->compose_context->curr_slide_info.image_ID == 0
  1590.         && g_jmms_context->compose_context->curr_slide_info.video_ID == 0)
  1591.     {
  1592.         err_code = mmi_jmms_compose_delete_page(1);
  1593.         if (err_code == JMMS_COMP_OK)
  1594.         {
  1595.             g_jmms_context->compose_context->curr_page_index = 0;
  1596.             num_pages = 0;
  1597.         }
  1598.     }
  1599.     if (num_attchments > 0 || num_pages > 0 || num_inline_media > 0)
  1600.     {
  1601.         g_jmms_context->g_write_mms_right_soft_key = STR_GLOBAL_DONE;
  1602.     }
  1603. */
  1604.     g_jmms_context->g_write_mms_right_soft_key = STR_GLOBAL_DONE;
  1605.     
  1606.     if(mmi_jmms_exit_curr_slide() == JMMS_COMP_POPUP_OK)
  1607.     {      
  1608.         DeleteUptoScrID(SCR_ID_JMMS_WRITE_MMS);
  1609.     }
  1610.     else
  1611.     {
  1612.         GoBackToHistory(SCR_ID_JMMS_WRITE_MMS);
  1613.     }
  1614. }
  1615. /* Functions for Category 275 */
  1616. #if defined(__MMI_MAINLCD_176X220__) || defined(__MMI_MAINLCD_240X320__)
  1617. #define SMIL_EDITOR_TEXT_MIN_HEIGHT       80    // TODO: reference GUI definition
  1618. #else 
  1619. #define SMIL_EDITOR_TEXT_MIN_HEIGHT       54    // TODO: reference GUI definition
  1620. #endif 
  1621. #if defined(__MMI_MAINLCD_176X220__) || defined (__MMI_MAINLCD_240X320__)
  1622. #define SMIL_EDITOR_IMAGE_MAX_HEIGHT (GDI_LCD_HEIGHT - MMI_BUTTON_BAR_HEIGHT - MMI_TITLE_HEIGHT - MMI_STATUS_BAR_HEIGHT - SMIL_EDITOR_TEXT_MIN_HEIGHT)
  1623. #else 
  1624. #define SMIL_EDITOR_IMAGE_MAX_HEIGHT (GDI_LCD_HEIGHT - MMI_BUTTON_BAR_HEIGHT - MMI_TITLE_HEIGHT - SMIL_EDITOR_TEXT_MIN_HEIGHT - INFORMATION_BAR_HEIGHT)
  1625. #endif
  1626.  
  1627. #define SMIL_EDITOR_IMAGE_MAX_WIDTH (GDI_LCD_WIDTH - (JMMS_HORZN_MARGIN_SPACE * 2) )
  1628. #define SMIL_EDITOR_IMAGE_CACHE_BUF_SIZE  
  1629.          ( SMIL_EDITOR_IMAGE_MAX_WIDTH * SMIL_EDITOR_IMAGE_MAX_HEIGHT * (GDI_MAINLCD_BIT_PER_PIXEL>>3))
  1630. /*****************************************************************************
  1631.  * FUNCTION
  1632.  *  mmi_jmms_compute_edit_content_screen_layout
  1633.  * DESCRIPTION
  1634.  *  calculates the layout area.
  1635.  * PARAMETERS
  1636.  *  area1_height        [OUT]       
  1637.  *  area2_height        [OUT]       
  1638.  * RETURNS
  1639.  *  void
  1640.  *****************************************************************************/
  1641. void mmi_jmms_compute_edit_content_screen_layout(U16 *area1_height, U16 *area2_height)
  1642. {
  1643.     /*----------------------------------------------------------------*/
  1644.     /* Local Variables                                                */
  1645.     /*----------------------------------------------------------------*/
  1646.     S32 width = 0, height = 0, width_bound1 = 0, height_bound1 = 0, img_width = 0, img_height = 0;
  1647.     S32 zoom_x = 0, zoom_y = 0, zoom_width = 0, zoom_height = 0;
  1648.     U8 *temp_file_name = g_jmms_context->compose_context->curr_slide_info.img_info.pFileName;
  1649. U32 max_width;
  1650. #ifdef __MMI_VIDEO_PLAYER__
  1651.     MDI_RESULT result_video = 0;
  1652.     U32 img_widthv = 0, img_heightv = 0;
  1653. #endif 
  1654.     /*----------------------------------------------------------------*/
  1655.     /* Code Body                                                      */
  1656.     /*----------------------------------------------------------------*/
  1657.     width_bound1 = 0;
  1658.     *area1_height = 0;
  1659. max_width = MMI_content_width - (current_MMI_theme->scrollbar_size *2 + JMMS_HORZN_MARGIN_SPACE *2) * 2;
  1660.     if (g_jmms_context->compose_context->curr_slide_info.video_ID != 0 ||
  1661.         g_jmms_context->compose_context->curr_slide_info.image_ID != 0 ||
  1662.         g_jmms_context->compose_context->curr_slide_info.audio_ID != 0 ||
  1663.         g_jmms_context->num_attachments > 0)
  1664.     {
  1665.         *area1_height += JMMS_VERT_ICON_MARGIN_SPACE * 2;
  1666.         gui_measure_image((PU8) GetImage(IMG_ID_JMMS_SMIL_EDITOR_PIC_ICON), &width, &height);
  1667.         *area1_height += height;
  1668.         width_bound1 = (max_width>(SMIL_EDITOR_IMAGE_MAX_WIDTH - (JMMS_HORZN_MARGIN_SPACE * 2)))?(SMIL_EDITOR_IMAGE_MAX_WIDTH - (JMMS_HORZN_MARGIN_SPACE * 2)) :max_width;
  1669.         height_bound1 = (SMIL_EDITOR_IMAGE_MAX_HEIGHT -  JMMS_VERT_ICON_MARGIN_SPACE * 2);
  1670.     }
  1671.     else
  1672.     {
  1673.         height_bound1 = 0;
  1674.         *area1_height = 0;
  1675.         *area2_height = 0;
  1676.         height = 0;
  1677.     }
  1678. #ifdef __MMI_VIDEO_PLAYER__
  1679.     if (g_jmms_context->compose_context->curr_slide_info.video_ID != 0)
  1680.     {
  1681.         result_video = mmi_jdd_videoapp_get_video_file_size_info((S8*) temp_file_name, &img_widthv, &img_heightv);
  1682.         img_width = img_widthv;
  1683.         img_height = img_heightv;
  1684.     }
  1685.     else
  1686. #endif /* __MMI_VIDEO_PLAYER__ */ 
  1687.     if (g_jmms_context->compose_context->curr_slide_info.image_ID != 0)
  1688.     {
  1689.         gdi_image_get_dimension_file((S8*) temp_file_name, &img_width, &img_height);
  1690.     }
  1691.     if (g_jmms_context->compose_context->curr_slide_info.video_ID != 0 ||
  1692.         g_jmms_context->compose_context->curr_slide_info.image_ID != 0)
  1693.     {
  1694.         /* Himanshu - Fixed bug MAUI_00228009 START*/
  1695.         if ((img_width < width_bound1) && 
  1696.                 (img_height < height_bound1))
  1697.         {
  1698.             zoom_width = img_width;
  1699.             zoom_height = img_height;
  1700.         }
  1701.         else
  1702.         {
  1703.             gdi_image_util_fit_bbox(
  1704.                 width_bound1,
  1705.                 height_bound1,
  1706.                 img_width,
  1707.                 img_height,
  1708.                 &zoom_x,
  1709.                 &zoom_y,
  1710.                 &zoom_width,
  1711.                 &zoom_height);
  1712.         }
  1713.         /* Himanshu - Fixed bug MAUI_00228009 END*/
  1714.     }
  1715.     if (g_jmms_context->compose_context->curr_slide_info.image_ID == 0 &&
  1716.         g_jmms_context->compose_context->curr_slide_info.video_ID == 0)
  1717.     {
  1718.         *area2_height = 0;
  1719.     }
  1720.     else if (g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] == 1)
  1721.     {
  1722.         *area2_height = 0;
  1723.         *area1_height += SMIL_EDITOR_IMAGE_MAX_HEIGHT + JMMS_VERT_IMAGE_MARGIN_SPACE;
  1724.     }
  1725.     else
  1726.     {
  1727.         *area2_height = SMIL_EDITOR_IMAGE_MAX_HEIGHT + JMMS_VERT_IMAGE_MARGIN_SPACE * 2;
  1728.     }
  1729.     g_jmms_context->compose_context->curr_slide_info.img_info.img_x = (MMI_content_width - zoom_width) >> 1;
  1730.     /* Himanshu - Media should be center-aligned */
  1731.     /* g_jmms_context->compose_context->curr_slide_info.img_info.img_y = JMMS_VERT_ICON_MARGIN_SPACE; */
  1732.     g_jmms_context->compose_context->curr_slide_info.img_info.img_y = JMMS_VERT_ICON_MARGIN_SPACE + ((height_bound1 >> 1) - (zoom_height >> 1));
  1733.     g_jmms_context->compose_context->curr_slide_info.img_info.zoom_in_width = zoom_width;
  1734.     g_jmms_context->compose_context->curr_slide_info.img_info.zoom_in_height = zoom_height;
  1735. }
  1736. /*****************************************************************************
  1737.  * FUNCTION
  1738.  *  mmi_jmms_show_smil_editor_title
  1739.  * DESCRIPTION
  1740.  *  callback fn to show smil editor title.
  1741.  * PARAMETERS
  1742.  *  identifier      [IN]        
  1743.  *  a(?)            [IN/OUT]        Nil(?)
  1744.  *  b(?)            [IN]            Nil(?)
  1745.  * RETURNS
  1746.  *  void
  1747.  *****************************************************************************/
  1748. void mmi_jmms_show_smil_editor_title(U32 identifier)
  1749. {
  1750.     /*----------------------------------------------------------------*/
  1751.     /* Local Variables                                                */
  1752.     /*----------------------------------------------------------------*/
  1753.     S32 text_width, character_height;
  1754.     S32 x_start;
  1755.     U8 title_buffer[20];
  1756.     U8 title_temp_buffer[16];
  1757.     U8 page_count = 0;
  1758.     U32 mms_size = 0; /*, mms_bytes = 0; */
  1759.     FLOAT mms_kb_size = 0, mms_mb_size = 0, mms_gb_size = 0, mms_tb_size = 0;
  1760.     /*----------------------------------------------------------------*/
  1761.     /* Code Body                                                      */
  1762.     /*----------------------------------------------------------------*/
  1763.     mmi_jmms_jdi_get_total_pages(g_jmms_context->msg_handle, &page_count);
  1764.     sprintf((S8*) title_temp_buffer, "%d/%d", identifier, page_count);
  1765.     AnsiiToUnicodeString((S8*) title_buffer, (S8*) title_temp_buffer);
  1766.     /* Himanshu - For fixing MAUI_00227854 START*/
  1767. #if defined (__MMI_MAINLCD_128X128__) || defined (__MMI_MAINLCD_128X160__)
  1768.     /* 
  1769.      * In 128x128 and 128x160, MMS editor title font size will use MMI_small_font.
  1770.      * It avoid the title string1 and string2 overlap.
  1771.      */
  1772.     MMI_title_string = NULL;
  1773. #else /* defined (__MMI_MAINLCD_128X128__) || defined (__MMI_MAINLCD_128X160__) */ 
  1774.     MMI_title_string = (UI_string_type) title_buffer;
  1775. #endif /* defined (__MMI_MAINLCD_128X128__) || defined (__MMI_MAINLCD_128X160__) */ 
  1776.     /* Himanshu - For fixing MAUI_00227854 END*/
  1777.     MMI_title_icon = (PU8) get_image(GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID));
  1778.     show_title_status_icon();
  1779.     draw_title();
  1780.     gui_push_clip();
  1781.     gui_push_text_clip();
  1782.     gui_set_clip(0, 0, UI_device_width - 1, UI_device_height - 1);
  1783.     gui_set_text_clip(MMI_title_x, MMI_title_y, MMI_title_x + MMI_title_width - 1, MMI_title_y + MMI_title_height - 1);
  1784.     gui_set_font(&MMI_small_font);
  1785.     /* Himanshu - For fixing MAUI_00227854 START*/
  1786. #if defined (__MMI_MAINLCD_128X128__) || defined (__MMI_MAINLCD_128X160__)
  1787.     /* 
  1788.      * In 128x128 and 128x160, MMS editor title font size will use MMI_small_font.
  1789.      * It avoid the title string1 and string2 overlap.
  1790.      */
  1791.     /* draw title string 1 */
  1792.     gui_measure_string((UI_string_type) title_buffer, &text_width, &character_height);
  1793.     if (r2lMMIFlag)
  1794.     {
  1795.         x_start = (MMI_title_x + MMI_title_width) / 2 + text_width / 2;
  1796.     }
  1797.     else
  1798.     {
  1799.         x_start = (MMI_title_x + MMI_title_width) / 2 - text_width / 2;
  1800.     }
  1801.     gui_move_text_cursor(x_start, MMI_title_y + ((MMI_title_height - character_height) >> 1));
  1802.     gui_set_text_color(*current_MMI_theme->title_text_color);
  1803.     gui_print_text((UI_string_type) title_buffer);
  1804. #endif /* defined (__MMI_MAINLCD_128X128__) || defined (__MMI_MAINLCD_128X160__) */ 
  1805.     /* Himanshu - For fixing MAUI_00227854 END*/
  1806.     mmi_jmms_jdi_get_size(g_jmms_context->msg_handle, 0, &mms_size);
  1807.     /* mms_bytes = mms_size % 1024; */
  1808.     mms_kb_size = (FLOAT) mms_size / 1024;
  1809.     mms_mb_size = mms_kb_size / 1024;
  1810.     mms_gb_size = mms_mb_size / 1024;
  1811.     mms_tb_size = mms_gb_size / 1024;
  1812.     /* Himanshu - For fixing MAUI_00227854 START*/
  1813.     if (mms_kb_size < 10.0)
  1814.     {
  1815.         sprintf((S8*) title_temp_buffer, "%0.2f%s", mms_kb_size, "KB");
  1816.     }
  1817.     else if( mms_kb_size < 100.0)
  1818.     {
  1819.         sprintf((S8*) title_temp_buffer, "%0.1f%s", mms_kb_size, "KB");
  1820.     }
  1821.     else if (mms_kb_size < 1000.0)
  1822.     {
  1823.         sprintf((S8*) title_temp_buffer, "%d%s", (U32)mms_kb_size, "KB");
  1824.     }
  1825.     else if (mms_mb_size < 10.0)
  1826.     {
  1827.         sprintf((S8*) title_temp_buffer, "%0.2f%s", mms_mb_size, "MB");
  1828.     }
  1829.     else if (mms_mb_size < 100.0)
  1830.     {
  1831.         sprintf((S8*) title_temp_buffer, "%0.1f%s", mms_mb_size, "MB");
  1832.     }
  1833.     else if (mms_mb_size < 1000.0)
  1834.     {
  1835.         sprintf((S8*) title_temp_buffer, "%d%s", (U32)mms_mb_size, "MB");
  1836.     }
  1837.     else if (mms_gb_size < 10.0)
  1838.     {
  1839.         sprintf((S8*) title_temp_buffer, "%0.2f%s", mms_gb_size, "GB");
  1840.     }
  1841.     else if(mms_gb_size < 100.0)
  1842.     {
  1843.         sprintf((S8*) title_temp_buffer, "%0.1f%s", mms_gb_size, "GB");
  1844.     }
  1845.     else if(mms_gb_size < 1000.0)
  1846.     {
  1847.         sprintf((S8*) title_temp_buffer, "%d%s", (U32)mms_gb_size, "GB");
  1848.     }
  1849.     else if (mms_tb_size < 4.1)
  1850.     {
  1851.         sprintf((S8*) title_temp_buffer, "%0.2f%s", mms_tb_size, "TB");
  1852.     }
  1853.     else
  1854.     {
  1855.         /*
  1856.          * As the maximum limit of U32 datatype is 4294967295 which is equivalent to 4.0 TB
  1857.          */
  1858.         ASSERT(0);
  1859.     }
  1860.     /* Himanshu - For fixing MAUI_00227854 END*/
  1861.     AnsiiToUnicodeString((S8*) title_buffer, (S8*) title_temp_buffer);
  1862.     gui_measure_string((UI_string_type) title_buffer, &text_width, &character_height);
  1863.     /* Himanshu - For fixing MAUI_00227920 START*/
  1864.     if (r2lMMIFlag)
  1865.     {
  1866.         x_start = MMI_title_x + text_width + 3;
  1867.     }
  1868.     else
  1869.     {
  1870.         x_start = MMI_title_x + MMI_title_width - text_width - 4;
  1871.     }
  1872.     /* Himanshu - For fixing MAUI_00227920 END*/
  1873.     gui_move_text_cursor(x_start, MMI_title_y + ((MMI_title_height - character_height) >> 1));
  1874.     gui_set_text_color(*current_MMI_theme->title_text_color);
  1875.     gui_print_text((UI_string_type) title_buffer);
  1876.     gui_set_font(&MMI_medium_font);
  1877.     gui_pop_text_clip();
  1878.     gui_pop_clip();
  1879. }
  1880. /*****************************************************************************
  1881.  * FUNCTION
  1882.  *  mmi_jmms_show_smil_editor_draw_area_1
  1883.  * DESCRIPTION
  1884.  *  callback fn to show smil draw area 1
  1885.  * PARAMETERS
  1886.  *  identifier      [IN]        
  1887.  *  y_offset        [IN]        
  1888.  *  clip_x1         [IN]        
  1889.  *  clip_y1         [IN]        
  1890.  *  clip_x2         [IN]        
  1891.  *  clip_y2         [IN]        
  1892.  *  a(?)            [IN/OUT]        Nil(?)
  1893.  *  b(?)            [IN]            Nil(?)
  1894.  * RETURNS
  1895.  *  void
  1896.  *****************************************************************************/
  1897. void mmi_jmms_show_smil_editor_draw_area_1(
  1898.         U32 identifier,
  1899.         S32 y_offset,
  1900.         S32 clip_x1,
  1901.         S32 clip_y1,
  1902.         S32 clip_x2,
  1903.         S32 clip_y2)
  1904. {
  1905.     /*----------------------------------------------------------------*/
  1906.     /* Local Variables                                                */
  1907.     /*----------------------------------------------------------------*/
  1908.     S32 x1, y1, x2, y2, icon_x;
  1909.     S32 width, height;
  1910.     U32 vbar_width = current_MMI_theme->scrollbar_size;
  1911.     U32 max_width;
  1912.     S32 largest_y;
  1913.     color c = {100, 150, 200, 100};
  1914.     /*----------------------------------------------------------------*/
  1915.     /* Code Body                                                      */
  1916.     /*----------------------------------------------------------------*/
  1917.     /* Set clipping */
  1918.     gui_push_clip();
  1919.     gui_set_clip(clip_x1, clip_y1, clip_x2, clip_y2);
  1920.     /* Show attachment icon */
  1921.     x1 = clip_x1;
  1922.     y1 = y_offset;
  1923.     gui_measure_image((PU8)GetImage(IMG_ID_JMMS_EDIT_CONTENT_AUDIO),&width,&height);
  1924.     y2 = y1 + height;
  1925.     x2 = clip_x2 - JMMS_VERT_ICON_MARGIN_SPACE;
  1926.     max_width = MMI_content_width - (vbar_width + JMMS_HORZN_MARGIN_SPACE) * 2;
  1927.     x2 = ((x2 - x1) > max_width)?(x1 + max_width) :x2;
  1928.     x1 = x1 + vbar_width;
  1929.     gui_fill_rectangle(x1, y1, x2, y2, c);
  1930.     g_jmms_context->compose_context->curr_slide_info.img_info.img_x = x1 +
  1931.         (((x2 - x1) - g_jmms_context->compose_context->curr_slide_info.img_info.zoom_in_width) >> 1);
  1932.     largest_y = y2;
  1933.     icon_x = x1 + JMMS_HORZN_MARGIN_SPACE;
  1934.     if (g_jmms_context->num_attachments > 0)
  1935.     {
  1936.         gui_show_image(icon_x, y1, (PU8) GetImage(IMG_ID_JMMS_EDIT_CONTENT_ATTACHMENT));
  1937.         icon_x = icon_x + width + JMMS_HORZN_MARGIN_SPACE;
  1938.     }
  1939.     if (g_jmms_context->compose_context->curr_slide_info.audio_ID != 0)
  1940.     {
  1941.         gui_show_image(icon_x, y1, (PU8) GetImage(IMG_ID_JMMS_EDIT_CONTENT_AUDIO));
  1942.         icon_x = icon_x + width + JMMS_HORZN_MARGIN_SPACE;
  1943.     }
  1944.     if (((g_jmms_context->compose_context->curr_slide_info.video_ID != 0) ||
  1945.          (g_jmms_context->compose_context->curr_slide_info.image_ID != 0)))
  1946.     {
  1947.         if (g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] == 1)
  1948.         {
  1949.             gui_draw_rectangle(x1, largest_y, x2, largest_y + SMIL_EDITOR_IMAGE_MAX_HEIGHT, c);
  1950.         }
  1951.         if (g_jmms_context->compose_context->curr_slide_info.video_ID != 0)
  1952.         {
  1953.             gui_show_image(
  1954.             icon_x,
  1955.             y1,
  1956.             (PU8) GetImage(IMG_ID_JMMS_SMIL_EDITOR_VIDEO_ICON));
  1957.         }
  1958.         else
  1959.         {
  1960.             gui_show_image(
  1961.             icon_x,
  1962.             y1,
  1963.             (PU8) GetImage(IMG_ID_JMMS_SMIL_EDITOR_PIC_ICON));
  1964.         }
  1965.     }
  1966.     if ((g_jmms_context->compose_context->curr_slide_info.video_ID != 0) &&
  1967.         (g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] == 1))
  1968.     {
  1969.         mmi_jmms_smil_editor_show_video_from_file(largest_y);
  1970.     }
  1971.     if ((g_jmms_context->compose_context->curr_slide_info.image_ID != 0) &&
  1972.         (g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] == 1))
  1973.     {
  1974.         mmi_jmms_smil_editor_show_image_from_file(largest_y);
  1975.     }
  1976.     gui_pop_clip();
  1977. }
  1978. /*****************************************************************************
  1979.  * FUNCTION
  1980.  *  mmi_jmms_show_smil_editor_draw_area_2
  1981.  * DESCRIPTION
  1982.  *  callback fn to show smil draw area 2
  1983.  * PARAMETERS
  1984.  *  identifier      [IN]        
  1985.  *  y_offset        [IN]        
  1986.  *  clip_x1         [IN]        
  1987.  *  clip_y1         [IN]        
  1988.  *  clip_x2         [IN]        
  1989.  *  clip_y2         [IN]        
  1990.  *  a(?)            [IN/OUT]        Nil(?)
  1991.  *  b(?)            [IN]            Nil(?)
  1992.  * RETURNS
  1993.  *  void
  1994.  *****************************************************************************/
  1995. void mmi_jmms_show_smil_editor_draw_area_2(
  1996.         U32 identifier,
  1997.         S32 y_offset,
  1998.         S32 clip_x1,
  1999.         S32 clip_y1,
  2000.         S32 clip_x2,
  2001.         S32 clip_y2)
  2002. {
  2003.     /*----------------------------------------------------------------*/
  2004.     /* Local Variables                                                */
  2005.     /*----------------------------------------------------------------*/
  2006.     /* PMT VIKAS START 20060502 */
  2007.     S32 max_width, x1, x2, y2;
  2008.     color c = {100, 150, 200, 100};
  2009.     U32 vbar_width = current_MMI_theme->scrollbar_size;
  2010.     /*----------------------------------------------------------------*/
  2011.     /* Code Body                                                      */
  2012.     /*----------------------------------------------------------------*/
  2013.     /* PMT VIKAS START 20060502 */
  2014.     gui_push_clip();
  2015.     gui_set_clip(clip_x1, clip_y1, clip_x2, clip_y2);
  2016.     max_width = MMI_content_width - (vbar_width + JMMS_HORZN_MARGIN_SPACE) * 2;
  2017.     x1 = clip_x1;
  2018.     x2 = ((clip_x2 - clip_x1) > max_width) ? (clip_x1 + max_width) : clip_x2;
  2019.     y2 = y_offset + SMIL_EDITOR_IMAGE_MAX_HEIGHT + JMMS_VERT_IMAGE_MARGIN_SPACE + JMMS_VERT_ICON_MARGIN_SPACE * 2;
  2020.     x1 = x1 + vbar_width;
  2021.     if (((g_jmms_context->compose_context->curr_slide_info.video_ID != 0) ||
  2022.          (g_jmms_context->compose_context->curr_slide_info.image_ID != 0)) &&
  2023.         (g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] == 0))
  2024.     {
  2025.         gui_draw_rectangle(x1, y_offset + JMMS_VERT_IMAGE_MARGIN_SPACE, x2, y2, c);
  2026.     }
  2027.     if ((g_jmms_context->compose_context->curr_slide_info.image_ID != 0) &&
  2028.         (g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] == 0))
  2029.     {
  2030.         mmi_jmms_smil_editor_show_image_from_file(y_offset + JMMS_VERT_IMAGE_MARGIN_SPACE + JMMS_VERT_ICON_MARGIN_SPACE);
  2031.     }
  2032.     if ((g_jmms_context->compose_context->curr_slide_info.video_ID != 0) &&
  2033.         (g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] == 0))
  2034.     {
  2035.         mmi_jmms_smil_editor_show_video_from_file(y_offset + JMMS_VERT_IMAGE_MARGIN_SPACE + JMMS_VERT_ICON_MARGIN_SPACE);
  2036.     }
  2037.     /* PMT VIKAS END20060502 */
  2038.     gui_pop_clip();
  2039. }
  2040. /*****************************************************************************
  2041.  * FUNCTION
  2042.  *  mmi_jmms_key_handler_for_back
  2043.  * DESCRIPTION
  2044.  *  entry fn for edit content screen.
  2045.  * PARAMETERS
  2046.  *  void
  2047.  * RETURNS
  2048.  *  void
  2049.  *****************************************************************************/
  2050. void mmi_jmms_key_handler_for_back(void)
  2051. {
  2052.     /*----------------------------------------------------------------*/
  2053.     /* Local Variables                                                */
  2054.     /*----------------------------------------------------------------*/
  2055.     U16 keyCode, keyType;
  2056.     /*----------------------------------------------------------------*/
  2057.     /* Code Body                                                      */
  2058.     /*----------------------------------------------------------------*/
  2059.     GetkeyInfo(&keyCode, &keyType);
  2060.     if (keyCode == KEY_CLEAR)
  2061.     {
  2062.         /* No need to do any thing */
  2063.     }
  2064.     else
  2065.     {
  2066.         GoBacktoWriteMMS();
  2067.     }
  2068. }
  2069. /*****************************************************************************
  2070.  * FUNCTION
  2071.  *  mmi_jmms_entry_edit_content_screen
  2072.  * DESCRIPTION
  2073.  *  
  2074.  * PARAMETERS
  2075.  *  void
  2076.  * RETURNS
  2077.  *  void
  2078.  *****************************************************************************/
  2079. void mmi_jmms_entry_edit_content_screen(void)
  2080. {
  2081.     /*----------------------------------------------------------------*/
  2082.     /* Local Variables                                                */
  2083.     /*----------------------------------------------------------------*/
  2084.     U8 *gui_buffer;
  2085.     U16 area1_height, area2_height;
  2086.     UI_font_type text_font;
  2087.     color text_color;
  2088.     color bg_color;
  2089.     /*----------------------------------------------------------------*/
  2090.     /* Code Body                                                      */
  2091.     /*----------------------------------------------------------------*/
  2092. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s ", "mmi_jmms_entry_edit_content_screen"));  
  2093.     EntryNewScreen(
  2094.         SCR_ID_JMMS_EDIT_CONTENT,
  2095.         mmi_jmms_exit_edit_content_screen,
  2096.         mmi_jmms_entry_edit_content_screen,
  2097.         NULL);
  2098.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_EDIT_CONTENT);
  2099.     if (g_media_buffer_p != NULL)
  2100.     {
  2101.         jdd_MemFree(g_media_buffer_p);
  2102.         g_media_buffer_p = NULL;
  2103.     }
  2104.     mmi_jmms_compute_edit_content_screen_layout(&area1_height, &area2_height);
  2105.     g_jmms_context->compose_context->exit_conpose_screen = 0;
  2106.     if (g_jmms_context->compose_context->curr_slide_info.img_info.custom_img_display == 1)
  2107.     {
  2108.         gui_lock_double_buffer();
  2109.     }
  2110.     bg_color = mmi_jmms_get_edit_content_scr_bg_color();
  2111.     text_color = mmi_jmms_get_edit_content_scr_txt_color();
  2112.     text_font = mmi_jmms_get_edit_content_scr_txt_font();
  2113. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d ", "Compose Context Values: Text Size of compose context : ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size));  
  2114. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d ", "Compose Context Values: Italic Selection of compose context : ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic));  
  2115. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d ", "Compose Context Values: Bold Selection of compose context : ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold));  
  2116.     ShowCategory277Screen(
  2117.         (U32) g_jmms_context->compose_context->curr_page_index,
  2118.         STR_GLOBAL_OPTIONS,
  2119.         IMG_GLOBAL_OPTIONS,
  2120.         STR_GLOBAL_DONE,
  2121.         IMG_GLOBAL_OK,
  2122.         INPUT_TYPE_ALPHANUMERIC_LOWERCASE,
  2123.         g_jmms_context->compose_context->curr_slide_info.edit_content_buffer,
  2124.         (S32) (JMMS_COMPOSE_TEXT_LENGTH + 1),
  2125.         (U16) current_MMI_theme->scrollbar_size,
  2126.         mmi_jmms_show_smil_editor_title,
  2127.         area1_height,
  2128.         mmi_jmms_show_smil_editor_draw_area_1,
  2129.         area2_height,
  2130.         mmi_jmms_show_smil_editor_draw_area_2,
  2131.         &text_font,
  2132.         &text_color,
  2133.         &bg_color,
  2134.         gui_buffer);
  2135. // sandeep start Nov 21 for bug number PMT005940
  2136.     if (g_jmms_context->compose_context->curr_slide_info.img_info.custom_img_display == 1)
  2137.     {
  2138.         if (g_jmms_context->compose_context->curr_slide_info.image_ID != 0)
  2139. {
  2140. if(g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] == 0)
  2141. {
  2142. Category275GotoBottom();
  2143. }
  2144. else
  2145. {
  2146. Category275GotoTop();
  2147. }
  2148. }
  2149. else if (g_jmms_context->compose_context->curr_slide_info.video_ID != 0)
  2150. {
  2151. if(g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] == 0)
  2152. {
  2153. Category275GotoBottom();
  2154. }
  2155. else
  2156. {
  2157. Category275GotoTop();
  2158. }
  2159. }
  2160.         gui_unlock_double_buffer();
  2161.         gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  2162.         g_jmms_context->compose_context->curr_slide_info.img_info.custom_img_display = 0;
  2163.     }
  2164. else if (g_jmms_context->compose_context->curr_slide_info.img_info.img_delete)
  2165. {
  2166. if (g_jmms_context->compose_context->curr_slide_info.img_info.img_delete & 2) // check if second bit is set then image is not first
  2167. {
  2168. Category275GotoBottom();
  2169. }
  2170. else
  2171. {
  2172. Category275GotoTop();
  2173. }
  2174. g_jmms_context->compose_context->curr_slide_info.img_info.img_delete = 0;
  2175. }
  2176. // sandeep end Nov 21 for bug number PMT005940
  2177.     SetLeftSoftkeyFunction(mmi_jmms_show_edit_content_option, KEY_EVENT_UP);
  2178.     SetCategory275RightSoftkeyFunction(mmi_jmms_key_handler_for_back, KEY_EVENT_UP);
  2179. }
  2180. /*****************************************************************************
  2181.  * FUNCTION
  2182.  *  mmi_jmms_exit_edit_content_screen
  2183.  * DESCRIPTION
  2184.  *  entry fn for edit content screen.
  2185.  * PARAMETERS
  2186.  *  void
  2187.  *  a(?)        [IN/OUT]        Nil(?)
  2188.  *  b(?)        [IN]            Nil(?)
  2189.  * RETURNS
  2190.  *  void
  2191.  *****************************************************************************/
  2192. void mmi_jmms_exit_edit_content_screen(void)
  2193. {
  2194.     /*----------------------------------------------------------------*/
  2195.     /* Local Variables                                                */
  2196.     /*----------------------------------------------------------------*/
  2197.     /*----------------------------------------------------------------*/
  2198.     /* Code Body                                                      */
  2199.     /*----------------------------------------------------------------*/
  2200.     if (g_media_buffer_p != NULL)
  2201.     {
  2202.         jdd_MemFree(g_media_buffer_p);
  2203.         g_media_buffer_p = NULL;
  2204.     }
  2205. }
  2206. /*****************************************************************************
  2207.  * FUNCTION
  2208.  *  mmi_jmms_video_idle_preview_in_composer
  2209.  * DESCRIPTION
  2210.  *  Function to show the composer screen
  2211.  * PARAMETERS
  2212.  *  filename            [IN]        
  2213.  *  x_frame             [IN]        
  2214.  *  y_frame             [IN]        
  2215.  *  width_frame         [IN]        
  2216.  *  height_frame        [IN]        
  2217.  * RETURNS
  2218.  *  void
  2219.  *****************************************************************************/
  2220. static void mmi_jmms_video_idle_preview_in_composer(
  2221.                 S8 *filename,
  2222.                 S32 x_frame,
  2223.                 S32 y_frame,
  2224.                 S32 width_frame,
  2225.                 S32 height_frame)
  2226. {
  2227. #ifdef __MMI_VIDEO_PLAYER__
  2228.     /*----------------------------------------------------------------*/
  2229.     /* Local Variables                                                */
  2230.     /*----------------------------------------------------------------*/
  2231.     MDI_RESULT mdi_ret;
  2232.     mdi_video_info_struct video_clip;
  2233. #endif /* __MMI_VIDEO_PLAYER__ */ 
  2234.     gdi_handle cache_layer;
  2235.     /*----------------------------------------------------------------*/
  2236.     /* Code Body                                                      */
  2237.     /*----------------------------------------------------------------*/
  2238.     if (g_media_buffer_p == NULL)
  2239.     {
  2240.         g_media_buffer_p = (U8*) jdd_MemAlloc(SMIL_EDITOR_IMAGE_CACHE_BUF_SIZE, sizeof(U8));
  2241.         gdi_layer_create_using_outside_memory(
  2242.             x_frame,
  2243.             y_frame,
  2244.             width_frame,
  2245.             height_frame,
  2246.             &cache_layer,
  2247.             (U8*) g_media_buffer_p,
  2248.             SMIL_EDITOR_IMAGE_CACHE_BUF_SIZE);
  2249.     #ifdef __MMI_VIDEO_PLAYER__
  2250.         mdi_ret = mdi_video_ply_open_clip_file(filename, &video_clip);
  2251.         if (mdi_ret == MDI_RES_VDOPLY_SUCCEED)
  2252.         {
  2253.             /* draw the first frame of the video */
  2254.             mdi_video_ply_seek_and_get_frame((U64) 0, cache_layer);
  2255.             mdi_video_ply_close_clip_file();
  2256.         }
  2257.     #endif /* __MMI_VIDEO_PLAYER__ */ /* #ifdef __MMI_VIDEO_PLAYER__ */
  2258.         gdi_layer_free(cache_layer);
  2259.     }
  2260. }
  2261. /*****************************************************************************
  2262.  * FUNCTION
  2263.  *  mmi_jmms_image_idle_preview_in_composer
  2264.  * DESCRIPTION
  2265.  *  Function to show the image in composer screen
  2266.  * PARAMETERS
  2267.  *  filename        [IN]        
  2268.  *  img_x           [IN]        
  2269.  *  img_y           [IN]        
  2270.  *  img_width       [IN]        
  2271.  *  img_height      [IN]        
  2272.  * RETURNS
  2273.  *  void
  2274.  *****************************************************************************/
  2275. static void mmi_jmms_image_idle_preview_in_composer(S8 *filename, S32 img_x, S32 img_y, S32 img_width, S32 img_height)
  2276. {
  2277.     /*----------------------------------------------------------------*/
  2278.     /* Local Variables                                                */
  2279.     /*----------------------------------------------------------------*/
  2280.     gdi_handle cache_layer;
  2281.     /*----------------------------------------------------------------*/
  2282.     /* Code Body                                                      */
  2283.     /*----------------------------------------------------------------*/
  2284.     if (g_media_buffer_p == NULL)
  2285.     {
  2286.         g_media_buffer_p = (U8*) jdd_MemAlloc(SMIL_EDITOR_IMAGE_CACHE_BUF_SIZE, sizeof(U8));
  2287.         if (img_width * img_height * (GDI_MAINLCD_BIT_PER_PIXEL >> 3) > SMIL_EDITOR_IMAGE_CACHE_BUF_SIZE)
  2288.         {
  2289.             ASSERT(0);
  2290.         }
  2291.         if (gdi_layer_create_using_outside_memory
  2292.             (0, 0, img_width, img_height, &cache_layer, (U8*) g_media_buffer_p,
  2293.              SMIL_EDITOR_IMAGE_CACHE_BUF_SIZE) != GDI_LAYER_SUCCEED)
  2294.         {
  2295.             ASSERT(0);
  2296.         }
  2297.         gdi_layer_push_and_set_active(cache_layer);
  2298.         gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
  2299.         gdi_layer_set_clip(0, 0, img_width - 1, img_height - 1);
  2300.         gdi_layer_set_position(img_x, img_y);
  2301.         gdi_draw_solid_rect(0, 0, img_width - 1, img_height - 1, GDI_COLOR_WHITE);
  2302.         gdi_image_draw_resized_file(0, 0, img_width, img_height, (S8*) filename);
  2303.         gdi_layer_pop_and_restore_active();
  2304.         gdi_layer_free(cache_layer);
  2305.     }
  2306. }
  2307. /* PMT VIKAS END 20060502 */
  2308. /*****************************************************************************
  2309.  * FUNCTION
  2310.  *  mmi_jmms_show_image_from_cached_buffer
  2311.  * DESCRIPTION
  2312.  *  show image in cat 275
  2313.  * PARAMETERS
  2314.  *  x_offset        [IN]        
  2315.  *  y_offset        [IN]        
  2316.  *  width           [IN]        
  2317.  *  height          [IN]        
  2318.  *  buffer_ptr      [IN]        
  2319.  *  a(?)            [IN/OUT]        Nil(?)
  2320.  *  b(?)            [IN]            Nil(?)
  2321.  * RETURNS
  2322.  *  void
  2323.  *****************************************************************************/
  2324. void mmi_jmms_show_image_from_cached_buffer(S32 x_offset, S32 y_offset, S32 width, S32 height, const U8 *buffer_ptr)
  2325. {
  2326.     /*----------------------------------------------------------------*/
  2327.     /* Local Variables                                                */
  2328.     /*----------------------------------------------------------------*/
  2329.     S32 clip_x1, clip_y1, clip_x2, clip_y2;
  2330.     S32 x, y, y_multiple;
  2331.     U16 *buf = (U16*) buffer_ptr;
  2332.     /*----------------------------------------------------------------*/
  2333.     /* Code Body                                                      */
  2334.     /*----------------------------------------------------------------*/
  2335.     gdi_layer_get_clip(&clip_x1, &clip_y1, &clip_x2, &clip_y2);
  2336.     if ((clip_x2 < x_offset) || (clip_x1 > x_offset + width - 1) || (clip_y2 < y_offset) ||
  2337.         (clip_y1 > y_offset + height - 1))
  2338.     {
  2339.         return;
  2340.     }
  2341.     if (clip_x1 < x_offset)
  2342.     {
  2343.         clip_x1 = x_offset;
  2344.     }
  2345.     if (clip_y1 < y_offset)
  2346.     {
  2347.         clip_y1 = y_offset;
  2348.     }
  2349.     if (clip_x2 > x_offset + width - 1)
  2350.     {
  2351.         clip_x2 = x_offset + width - 1;
  2352.     }
  2353.     if (clip_y2 > y_offset + height - 1)
  2354.     {
  2355.         clip_y2 = y_offset + height - 1;
  2356.     }
  2357.     clip_x1 -= x_offset;
  2358.     clip_y1 -= y_offset;
  2359.     clip_x2 -= x_offset;
  2360.     clip_y2 -= y_offset;
  2361.     for (y = clip_y1; y <= clip_y2; y++)
  2362.     {
  2363.         y_multiple = y * width;
  2364.         for (x = clip_x1; x <= clip_x2; x++)
  2365.         {
  2366.             GDI_SET_BUFFER_PIXEL(x + x_offset, y + y_offset, buf[y_multiple + x]);
  2367.         }
  2368.     }
  2369. }
  2370. /*****************************************************************************
  2371.  * FUNCTION
  2372.  *  mmi_jmms_smil_editor_show_video_from_file
  2373.  * DESCRIPTION
  2374.  *  Show image from file
  2375.  * PARAMETERS
  2376.  *  y_offset        [IN]        
  2377.  *  a(?)            [IN/OUT]        Nil(?)
  2378.  *  b(?)            [IN]            Nil(?)
  2379.  * RETURNS
  2380.  *  void
  2381.  *****************************************************************************/
  2382. void mmi_jmms_smil_editor_show_video_from_file(S32 y_offset)
  2383. {
  2384.     /*----------------------------------------------------------------*/
  2385.     /* Local Variables                                                */
  2386.     /*----------------------------------------------------------------*/
  2387.     U8 *temp_file_name = g_jmms_context->compose_context->curr_slide_info.img_info.pFileName;
  2388.     S32 x, y, zoom_width, zoom_height;
  2389.     /*----------------------------------------------------------------*/
  2390.     /* Code Body                                                      */
  2391.     /*----------------------------------------------------------------*/
  2392.     x = g_jmms_context->compose_context->curr_slide_info.img_info.img_x;
  2393.     y = g_jmms_context->compose_context->curr_slide_info.img_info.img_y;
  2394.     zoom_width = g_jmms_context->compose_context->curr_slide_info.img_info.zoom_in_width;
  2395.     zoom_height = g_jmms_context->compose_context->curr_slide_info.img_info.zoom_in_height;
  2396.     if (g_media_buffer_p == NULL)
  2397.     {
  2398.         mmi_jmms_video_idle_preview_in_composer((S8*) temp_file_name, x, y_offset + y, zoom_width, zoom_height);
  2399.     }
  2400.     mmi_jmms_show_image_from_cached_buffer(x, y_offset + y, zoom_width, zoom_height, g_media_buffer_p);
  2401. }
  2402. /*****************************************************************************
  2403.  * FUNCTION
  2404.  *  mmi_jmms_smil_editor_show_image_from_file
  2405.  * DESCRIPTION
  2406.  *  Show image from file
  2407.  * PARAMETERS
  2408.  *  y_offset        [IN]        
  2409.  *  a(?)            [IN/OUT]        Nil(?)
  2410.  *  b(?)            [IN]            Nil(?)
  2411.  * RETURNS
  2412.  *  void
  2413.  *****************************************************************************/
  2414. void mmi_jmms_smil_editor_show_image_from_file(S32 y_offset)
  2415. {
  2416.     /*----------------------------------------------------------------*/
  2417.     /* Local Variables                                                */
  2418.     /*----------------------------------------------------------------*/
  2419.     U8 *temp_file_name = g_jmms_context->compose_context->curr_slide_info.img_info.pFileName;
  2420.     S32 x, y, zoom_width, zoom_height;
  2421.     /*----------------------------------------------------------------*/
  2422.     /* Code Body                                                      */
  2423.     /*----------------------------------------------------------------*/
  2424.     x = g_jmms_context->compose_context->curr_slide_info.img_info.img_x;
  2425.     y = g_jmms_context->compose_context->curr_slide_info.img_info.img_y;
  2426.     zoom_width = g_jmms_context->compose_context->curr_slide_info.img_info.zoom_in_width;
  2427.     zoom_height = g_jmms_context->compose_context->curr_slide_info.img_info.zoom_in_height;
  2428.     if (g_media_buffer_p == NULL)
  2429.     {
  2430.         mmi_jmms_image_idle_preview_in_composer((S8*) temp_file_name, x, y_offset + y, zoom_width, zoom_height);
  2431.     }
  2432.     mmi_jmms_show_image_from_cached_buffer(x, y_offset + y, zoom_width, zoom_height, g_media_buffer_p);
  2433. }
  2434. /*****************************************************************************
  2435.  * FUNCTION
  2436.  *  mmi_jmms_compose_go_back_history_ip_method
  2437.  * DESCRIPTION
  2438.  *  callback fn to go in history from input method screen.
  2439.  * PARAMETERS
  2440.  *  void
  2441.  *  a(?)        [IN/OUT]        Nil(?)
  2442.  *  b(?)        [IN]            Nil(?)
  2443.  * RETURNS
  2444.  *  void
  2445.  *****************************************************************************/
  2446. void mmi_jmms_compose_go_back_history_ip_method(void)
  2447. {
  2448.     /*----------------------------------------------------------------*/
  2449.     /* Local Variables                                                */
  2450.     /*----------------------------------------------------------------*/
  2451.     /*----------------------------------------------------------------*/
  2452.     /* Code Body                                                      */
  2453.     /*----------------------------------------------------------------*/
  2454.     DeleteUptoScrID(SCR_ID_JMMS_EDIT_CONTENT);
  2455.     GoBackHistory();
  2456. }
  2457. /* Insert image */
  2458. /*****************************************************************************
  2459.  * FUNCTION
  2460.  *  mmi_jmms_entry_filemgr_insert_image
  2461.  * DESCRIPTION
  2462.  *  entry fn for filemgr from insert image.
  2463.  * PARAMETERS
  2464.  *  void
  2465.  *  a(?)        [IN/OUT]        Nil(?)
  2466.  *  b(?)        [IN]            Nil(?)
  2467.  * RETURNS
  2468.  *  void
  2469.  *****************************************************************************/
  2470. void mmi_jmms_entry_filemgr_insert_image(void)
  2471. {
  2472. #if ( defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  2473.     /*----------------------------------------------------------------*/
  2474.     /* Local Variables                                                */
  2475.     /*----------------------------------------------------------------*/
  2476.     FMGR_FILTER filter;
  2477.     /*----------------------------------------------------------------*/
  2478.     /* Code Body                                                      */
  2479.     /*----------------------------------------------------------------*/
  2480.     FMGR_FILTER_INIT(&filter);
  2481.     FMGR_FILTER_SET(&filter, FMGR_TYPE_BMP);
  2482.     FMGR_FILTER_SET(&filter, FMGR_TYPE_GIF);
  2483.     FMGR_FILTER_SET(&filter, FMGR_TYPE_WBMP);
  2484. #ifdef GDI_USING_PNG
  2485.     FMGR_FILTER_SET(&filter, FMGR_TYPE_PNG);
  2486. #endif 
  2487. //    FMGR_FILTER_SET(&filter, FMGR_TYPE_EMS);
  2488. //    FMGR_FILTER_SET(&filter, FMGR_TYPE_ANM);
  2489.     FMGR_FILTER_SET(&filter, FMGR_TYPE_WBM);
  2490. #ifdef JPG_DECODE
  2491.     FMGR_FILTER_SET(&filter, FMGR_TYPE_JPG);
  2492.     FMGR_FILTER_SET(&filter, FMGR_TYPE_JPEG);
  2493. #endif /* JPG_DECODE */ 
  2494.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
  2495.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER_DOT);
  2496.     mmi_fmgr_select_path_and_enter(
  2497.         APP_JATAAYU_MMS,
  2498.         FMGR_SELECT_FILE | FMGR_SELECT_REPEAT,
  2499.         filter,
  2500.         (S8*) L"root",
  2501.         mmi_jmms_callback_filemgr_select_image);
  2502. #endif /* ( defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  2503. }
  2504. /*****************************************************************************
  2505.  * FUNCTION
  2506.  *  mmi_jmms_callback_filemgr_select_image
  2507.  * DESCRIPTION
  2508.  *  callback fn for filemgr when user select a image.
  2509.  * PARAMETERS
  2510.  *  path            [IN]        
  2511.  *  is_short        [IN]        
  2512.  * RETURNS
  2513.  *  void
  2514.  *****************************************************************************/
  2515. void mmi_jmms_callback_filemgr_select_image(void *path, int is_short)
  2516. {
  2517.     /*----------------------------------------------------------------*/
  2518.     /* Local Variables                                                */
  2519.     /*----------------------------------------------------------------*/
  2520.     GDI_RESULT image_result;
  2521.     S32 img_widthv = 0, img_heightv = 0;
  2522.     /* HIMANSHU 05122006 START */
  2523. #ifdef __MMI_MMS_MEGA_PIXEL_SUPPORT__
  2524.     JC_CHAR *dest_fname = NULL;
  2525.     U32 resize_result = 0;
  2526. #endif /* __MMI_MMS_MEGA_PIXEL_SUPPORT__ */ 
  2527.     /* HIMANSHU 05122006 END */
  2528.     U32 media_size = 0;
  2529.     /*----------------------------------------------------------------*/
  2530.     /* Code Body                                                      */
  2531.     /*----------------------------------------------------------------*/
  2532.     if (path)
  2533.     {
  2534.     #ifdef __DRM_SUPPORT__
  2535.         JC_BOOLEAN is_fwd_lock;
  2536.         JC_BOOLEAN is_separate_DRM = E_FALSE;
  2537.         is_fwd_lock = jMMS_is_fwd_lock_content(path);
  2538.         if (is_fwd_lock)
  2539.         {
  2540.             DisplayPopup(
  2541.                 (PU8) GetString(STR_GLOBAL_DRM_PROHIBITED),
  2542.                 IMG_GLOBAL_WARNING,
  2543.                 1,
  2544.                 JMMS_POPUP_TIME,
  2545.                 ERROR_TONE);
  2546.             return;
  2547.         }
  2548.     #endif /* __DRM_SUPPORT__ */ 
  2549.     #ifdef __DRM_SUPPORT__
  2550.         if ((is_separate_DRM = jMMS_is_sep_delivery_content((JC_CHAR*) path)) == E_FALSE)
  2551.     #endif 
  2552.         {
  2553.             image_result = gdi_image_get_dimension_file((S8*) path, &img_widthv, &img_heightv);
  2554.             if (image_result != GDI_SUCCEED || (img_widthv * img_heightv) == 0)
  2555.             {
  2556.                 DisplayPopup((PU8) GetString(STR_ID_JMMS_CORRUPTED_MEDIA_FILE), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  2557.                 return;
  2558.             }
  2559.         }
  2560.         if (mmi_jmms_selected_media_valid_size_check_for_mms(path, is_short, &media_size, E_TRUE) != E_TRUE)
  2561.         {
  2562.             return;
  2563.         }
  2564.         /* Himanshu Fix PMTSW00006527 START */
  2565.         if (mmi_jmms_check_for_image_size_and_resolution(path, img_widthv, img_heightv, media_size) != E_TRUE)
  2566.         {
  2567.             return;
  2568.         }
  2569.         /* Himanshu Fix PMTSW00006527 END */
  2570.         /* HIMANSHU 05122006 START */
  2571.     #ifdef __MMI_MMS_MEGA_PIXEL_SUPPORT__
  2572.     #ifdef __DRM_SUPPORT__
  2573.         if (is_separate_DRM == E_FALSE)
  2574.     #endif
  2575.         {
  2576.             /* Check if image resizing needs to be done. */
  2577.             resize_result = check_for_image_resize(path, &dest_fname);
  2578.             if (resize_result == JMMS_IMAGE_RESIZE_SUCCEED)
  2579.             {
  2580.                 path = dest_fname;
  2581.             }
  2582.             else if (resize_result == JMMS_IMAGE_RESIZE_UNCHANGED)
  2583.             {
  2584.                 /* Do nothing as same file source is to be used. */
  2585.             }
  2586.             else
  2587.             {
  2588.                 goto error;
  2589.             }
  2590.         }
  2591.     #endif /* __MMI_MMS_MEGA_PIXEL_SUPPORT__ */ 
  2592.         /* HIMANSHU 05122006 END */
  2593.         g_jmms_context->compose_context->media_path =
  2594.             (S8*) jdd_MemAlloc((pfnUnicodeStrlen(path) + 1), sizeof(JC_CHAR));
  2595.         if (g_jmms_context->compose_context->media_path == NULL)
  2596.         {
  2597.             DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  2598.             /* return; */
  2599.             goto error;
  2600.         }
  2601.         pfnUnicodeStrcpy((S8*) g_jmms_context->compose_context->media_path, (S8*) path);
  2602. #ifdef __DRM_SUPPORT__
  2603.         if (mmi_jmms_is_compose_add_as_drm(path) && (is_separate_DRM == E_FALSE))
  2604.         {
  2605.             mmi_jmms_confirm_add_drm_media(mmi_jmms_fm_add_image);
  2606.             return;
  2607.         }
  2608.         else
  2609. #endif /* __DRM_SUPPORT__ */ 
  2610.         {
  2611.             mmi_jmms_fm_add_image();
  2612.         }
  2613.     }
  2614.     else
  2615.     {
  2616.         GoBackToHistory(SCR_ID_JMMS_EDIT_CONTENT_INSERT);
  2617.     }
  2618.   error:
  2619.     if (g_jmms_context->compose_context->media_path != NULL)
  2620.     {
  2621.         jdd_MemFree(g_jmms_context->compose_context->media_path);
  2622.         g_jmms_context->compose_context->media_path = NULL;
  2623.     }
  2624.     /* HIMANSHU 05122006 START */
  2625. #ifdef __MMI_MMS_MEGA_PIXEL_SUPPORT__
  2626.     if (dest_fname != NULL)
  2627.     {
  2628.         jdd_MemFree(dest_fname);
  2629.         dest_fname = NULL;
  2630.     }
  2631.     DeleteScreenIfPresent(SCR_ID_JMMS_IMAGE_RESIZE_TRANSITION);
  2632. #endif /* __MMI_MMS_MEGA_PIXEL_SUPPORT__ */ 
  2633.     /* HIMANSHU 05122006 END */
  2634. }
  2635. /*****************************************************************************
  2636.  * FUNCTION
  2637.  *  mmi_jmms_fm_add_image
  2638.  * DESCRIPTION
  2639.  *  fn for filemgr when user select a image.
  2640.  * PARAMETERS
  2641.  *  void
  2642.  *  a(?)        [IN/OUT]        Nil(?)
  2643.  *  b(?)        [IN]            Nil(?)
  2644.  * RETURNS
  2645.  *  void
  2646.  *****************************************************************************/
  2647. void mmi_jmms_fm_add_image(void)
  2648. {
  2649.     /*----------------------------------------------------------------*/
  2650.     /* Local Variables                                                */
  2651.     /*----------------------------------------------------------------*/
  2652.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  2653.     /*----------------------------------------------------------------*/
  2654.     /* Code Body                                                      */
  2655.     /*----------------------------------------------------------------*/
  2656.     err_code = mmi_jmms_compose_add_media(
  2657.                 g_jmms_context->compose_context->media_path,
  2658.                 E_MEDIA_IMAGE,
  2659.                 0,
  2660.                 g_jmms_context->compose_context->curr_page_index);
  2661.     if (err_code == JMMS_COMP_FAIL)
  2662.     {
  2663.         DeleteUptoScrID(SCR_FMGR_EXPLORER); /* sanjeev added */
  2664.     }
  2665.     else if (err_code == JMMS_COMP_OK)
  2666.     {
  2667.         g_jmms_context->compose_context->curr_slide_info.img_info.custom_img_display = 1;
  2668.         g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index -1 ].img_dur_max_set = 1;
  2669.         if (pfnUnicodeStrlen((S8*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer) == 0)
  2670.         {
  2671.             g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] = 1;
  2672.         }
  2673.         else
  2674.         {
  2675.             g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] = 0;
  2676.         }
  2677.         GoBackToHistory(SCR_ID_JMMS_EDIT_CONTENT);
  2678.     }
  2679.     else if (err_code == JMMS_COMP_POPUP_OK)
  2680.     {
  2681.         g_jmms_context->compose_context->curr_slide_info.img_info.custom_img_display = 1;
  2682.         g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index -1 ].img_dur_max_set = 1;
  2683.         if (pfnUnicodeStrlen((S8*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer) == 0)
  2684.         {
  2685.             g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] = 1;
  2686.         }
  2687.         else
  2688.         {
  2689.             g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] = 0;
  2690.         }
  2691.         DeleteUptoScrID(SCR_ID_JMMS_EDIT_CONTENT);
  2692.     }
  2693.     jdd_MemFree(g_jmms_context->compose_context->media_path);
  2694.     g_jmms_context->compose_context->media_path = NULL;
  2695. }
  2696. /* Insert audio */
  2697. /*****************************************************************************
  2698.  * FUNCTION
  2699.  *  mmi_jmms_entry_filemgr_insert_audio
  2700.  * DESCRIPTION
  2701.  *  entry fn for filemgr from insert audio.
  2702.  * PARAMETERS
  2703.  *  void
  2704.  *  a(?)        [IN/OUT]        Nil(?)
  2705.  *  b(?)        [IN]            Nil(?)
  2706.  * RETURNS
  2707.  *  void
  2708.  *****************************************************************************/
  2709. void mmi_jmms_entry_filemgr_insert_audio(void)
  2710. {
  2711. #if ( defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  2712.     /*----------------------------------------------------------------*/
  2713.     /* Local Variables                                                */
  2714.     /*----------------------------------------------------------------*/
  2715.     FMGR_FILTER filter;
  2716.     /*----------------------------------------------------------------*/
  2717.     /* Code Body                                                      */
  2718.     /*----------------------------------------------------------------*/
  2719.     FMGR_FILTER_INIT(&filter);
  2720.     FMGR_FILTER_SET(&filter, FMGR_TYPE_IMY);
  2721.     FMGR_FILTER_SET(&filter, FMGR_TYPE_MID);
  2722.     FMGR_FILTER_SET(&filter, FMGR_TYPE_MIDI);
  2723.     FMGR_FILTER_SET(&filter, FMGR_TYPE_WAV);
  2724.     FMGR_FILTER_SET(&filter, FMGR_TYPE_AMR);
  2725. #ifdef AAC_DECODE
  2726.     FMGR_FILTER_SET(&filter, FMGR_TYPE_AAC);
  2727. #endif 
  2728. #ifdef DAF_DECODE
  2729.     FMGR_FILTER_SET(&filter, FMGR_TYPE_DAF);
  2730. #endif 
  2731.     FMGR_FILTER_SET(&filter, FMGR_TYPE_VM);
  2732. #ifdef AMRWB_DECODE
  2733.     FMGR_FILTER_SET(&filter, FMGR_TYPE_AWB);
  2734. #endif 
  2735. #if !defined(MT6205B)
  2736.     FMGR_FILTER_SET(&filter, FMGR_TYPE_AIF);
  2737.     FMGR_FILTER_SET(&filter, FMGR_TYPE_AIFF);
  2738.     FMGR_FILTER_SET(&filter, FMGR_TYPE_AIFC);
  2739.     FMGR_FILTER_SET(&filter, FMGR_TYPE_AU);
  2740.     FMGR_FILTER_SET(&filter, FMGR_TYPE_SND);
  2741. #endif /* !defined(MT6205B) */ 
  2742. #if defined(MP4_CODEC) && defined(AAC_DECODE)
  2743.     FMGR_FILTER_SET(&filter, FMGR_TYPE_M4A);
  2744. #endif 
  2745. #if defined(EXT_AUDIO_CHIP) || defined(MMF_DECODE)
  2746.     FMGR_FILTER_SET(&filter, FMGR_TYPE_MMF);
  2747. #endif 
  2748. #ifdef WMA_DECODE
  2749.     FMGR_FILTER_SET(&filter, FMGR_TYPE_WMA);
  2750. #endif 
  2751.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
  2752.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER_DOT);
  2753.     mmi_fmgr_select_path_and_enter(
  2754.         APP_JATAAYU_MMS,
  2755.         FMGR_SELECT_FILE | FMGR_SELECT_REPEAT,
  2756.         filter,
  2757.         (S8*) L"root",
  2758.         mmi_jmms_callback_filemgr_select_audio);
  2759. #endif /* ( defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  2760. }
  2761. /*****************************************************************************
  2762.  * FUNCTION
  2763.  *  mmi_jmms_callback_filemgr_select_audio
  2764.  * DESCRIPTION
  2765.  *  callback fn for filemgr when user select an audio.
  2766.  * PARAMETERS
  2767.  *  path            [IN]        
  2768.  *  is_short        [IN]        
  2769.  * RETURNS
  2770.  *  void
  2771.  *****************************************************************************/
  2772. void mmi_jmms_callback_filemgr_select_audio(void *path, int is_short)
  2773. {
  2774.     /*----------------------------------------------------------------*/
  2775.     /* Local Variables                                                */
  2776.     /*----------------------------------------------------------------*/
  2777.     mdi_result audio_result = 0;
  2778.     U32 audio_du;
  2779.     U32 media_size = 0;
  2780.     /*----------------------------------------------------------------*/
  2781.     /* Code Body                                                      */
  2782.     /*----------------------------------------------------------------*/
  2783.     if (path)
  2784.     {
  2785. #ifdef __DRM_SUPPORT__
  2786.         JC_BOOLEAN is_fwd_lock;
  2787.         is_fwd_lock = jMMS_is_fwd_lock_content(path);
  2788.         if(is_fwd_lock)
  2789.         {
  2790.             DisplayPopup((PU8) GetString(STR_GLOBAL_DRM_PROHIBITED), IMG_GLOBAL_WARNING, 1, JMMS_POPUP_TIME, ERROR_TONE);
  2791.             return;
  2792.         }
  2793. #endif
  2794.         g_jmms_context->compose_context->media_path =
  2795.             (S8*) jdd_MemAlloc((pfnUnicodeStrlen(path) + 1), sizeof(JC_CHAR));
  2796.         if (g_jmms_context->compose_context->media_path == NULL)
  2797.         {
  2798.             DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  2799.             return;
  2800.         }
  2801.         pfnUnicodeStrcpy((S8*) g_jmms_context->compose_context->media_path, (S8*) path);
  2802. #ifdef __DRM_SUPPORT__
  2803.         if(!jMMS_is_sep_delivery_content((JC_CHAR*)g_jmms_context->compose_context->media_path))
  2804. #endif
  2805.         {
  2806.     audio_result = mdi_audio_get_duration((S8*) g_jmms_context->compose_context->media_path, &audio_du);
  2807.     if(audio_result != GDI_SUCCEED )
  2808.     {
  2809.                 DisplayPopup((PU8) GetString(STR_ID_JMMS_CORRUPTED_MEDIA_FILE), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  2810.                 if( g_jmms_context->compose_context->media_path != NULL)
  2811.                 {
  2812.                     jdd_MemFree(g_jmms_context->compose_context->media_path);
  2813.                     g_jmms_context->compose_context->media_path = NULL;
  2814.                 }
  2815.                 return;
  2816.     }
  2817.         }
  2818. if (mmi_jmms_selected_media_valid_size_check_for_mms(path, is_short, &media_size, E_FALSE) != E_TRUE)
  2819. {
  2820.             if( g_jmms_context->compose_context->media_path != NULL)
  2821.             {
  2822.                 jdd_MemFree(g_jmms_context->compose_context->media_path);
  2823.                 g_jmms_context->compose_context->media_path = NULL;
  2824.             }
  2825.             return;
  2826. }
  2827. #ifdef __DRM_SUPPORT__
  2828.         if (mmi_jmms_is_compose_add_as_drm(path) && !jMMS_is_sep_delivery_content(path))
  2829.         {
  2830.             mmi_jmms_confirm_add_drm_media(mmi_jmms_fm_add_audio);
  2831.         }
  2832.         else
  2833. #endif /* __DRM_SUPPORT__ */ 
  2834.         {
  2835.             mmi_jmms_fm_add_audio();
  2836.         }
  2837.     }
  2838.     else
  2839.     {
  2840.         GoBackToHistory(SCR_ID_JMMS_EDIT_CONTENT_INSERT);
  2841.     }
  2842. }
  2843. /*****************************************************************************
  2844.  * FUNCTION
  2845.  *  mmi_jmms_fm_add_audio
  2846.  * DESCRIPTION
  2847.  *  fn for filemgr when user select an audio.
  2848.  * PARAMETERS
  2849.  *  void
  2850.  *  a(?)        [IN/OUT]        Nil(?)
  2851.  *  b(?)        [IN]            Nil(?)
  2852.  * RETURNS
  2853.  *  void
  2854.  *****************************************************************************/
  2855. void mmi_jmms_fm_add_audio(void)
  2856. {
  2857.     /*----------------------------------------------------------------*/
  2858.     /* Local Variables                                                */
  2859.     /*----------------------------------------------------------------*/
  2860.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  2861.     /*----------------------------------------------------------------*/
  2862.     /* Code Body                                                      */
  2863.     /*----------------------------------------------------------------*/
  2864.     err_code = mmi_jmms_compose_add_media(
  2865.                 g_jmms_context->compose_context->media_path,
  2866.                 E_MEDIA_AUDIO,
  2867.                 0,
  2868.                 g_jmms_context->compose_context->curr_page_index);
  2869.     if (err_code == JMMS_COMP_FAIL)
  2870.     {
  2871.         DeleteUptoScrID(SCR_FMGR_EXPLORER); /* sanjeev added */
  2872.     }
  2873.     else if (err_code == JMMS_COMP_OK)
  2874.     {
  2875.         g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index -1 ].audio_dur_max_set = 1;
  2876.         GoBackToHistory(SCR_ID_JMMS_EDIT_CONTENT);
  2877.     }
  2878.     else if (err_code == JMMS_COMP_POPUP_OK)
  2879.     {
  2880.         g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index -1 ].audio_dur_max_set = 1;
  2881.         DeleteUptoScrID(SCR_ID_JMMS_EDIT_CONTENT);
  2882.     }
  2883.     jdd_MemFree(g_jmms_context->compose_context->media_path);
  2884.     g_jmms_context->compose_context->media_path = NULL;
  2885. }
  2886. /* Insert video */
  2887. /*****************************************************************************
  2888.  * FUNCTION
  2889.  *  mmi_jmms_entry_filemgr_insert_video
  2890.  * DESCRIPTION
  2891.  *  entry fn for filemgr from insert video.
  2892.  * PARAMETERS
  2893.  *  void
  2894.  *  a(?)        [IN/OUT]        Nil(?)
  2895.  *  b(?)        [IN]            Nil(?)
  2896.  * RETURNS
  2897.  *  void
  2898.  *****************************************************************************/
  2899. void mmi_jmms_entry_filemgr_insert_video(void)
  2900. {
  2901. #if ( defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  2902.     /*----------------------------------------------------------------*/
  2903.     /* Local Variables                                                */
  2904.     /*----------------------------------------------------------------*/
  2905.     FMGR_FILTER filter;
  2906.     /*----------------------------------------------------------------*/
  2907.     /* Code Body                                                      */
  2908.     /*----------------------------------------------------------------*/
  2909.     FMGR_FILTER_INIT(&filter);
  2910. #if defined(ISP_SUPPORT)
  2911.     FMGR_FILTER_SET(&filter, FMGR_TYPE_3GP);
  2912.     FMGR_FILTER_SET(&filter, FMGR_TYPE_MP4);
  2913.     //FMGR_FILTER_SET(&filter, FMGR_TYPE_MPG);
  2914.     FMGR_FILTER_SET(&filter, FMGR_TYPE_3G2);
  2915. #elif defined(CAMERA_MODULE)
  2916.     FMGR_FILTER_SET(&filter, FMGR_TYPE_AVI);
  2917. #endif 
  2918.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
  2919.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER_DOT);
  2920.     mmi_fmgr_select_path_and_enter(