PictureEditor.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:158k
源码类别:
MTK
开发平台:
C/C++
- nInlinePenSize = 0;
- break;
- }
- #ifndef __MMI_TOUCH_SCREEN__ /* PMT MANISH 20050616 */
- switch (gpPicEditPen->penMove)
- {
- case PIC_EDIT_PEN_MOVE_1:
- nInlinePenMoveFactor = 0;
- break;
- case PIC_EDIT_PEN_MOVE_2:
- nInlinePenMoveFactor = 1;
- break;
- case PIC_EDIT_PEN_MOVE_3:
- nInlinePenMoveFactor = 2;
- break;
- case PIC_EDIT_PEN_MOVE_4:
- nInlinePenMoveFactor = 3;
- break;
- default:
- nInlinePenMoveFactor = 0;
- break;
- }
- #endif /* __MMI_TOUCH_SCREEN__ */
- for (iCount = 0; iCount < MAX_TYPE_PEN_COLOR; ++iCount)
- {
- pInlinePenColorIndexList[iCount] = (U8*) GetString((U16) (iCount + 1 + STR_PE_COLOR_NONE));
- inlinePERGBlist[iCount][0] = (U8) ((0xFF000000 & gPEColorRGB[iCount + 1]) >> 24);
- inlinePERGBlist[iCount][1] = (U8) ((0x00FF0000 & gPEColorRGB[iCount + 1]) >> 16);
- inlinePERGBlist[iCount][2] = (U8) ((0x0000FF00 & gPEColorRGB[iCount + 1]) >> 8);
- }
- inlinePERGBlist[iCount - 1][0] = (U8) ((0xFF000000 & gPEColorRGB[iCount - 1]) >> 24);
- inlinePERGBlist[iCount - 1][1] = (U8) ((0x00FF0000 & gPEColorRGB[iCount - 1]) >> 16);
- inlinePERGBlist[iCount - 1][2] = (U8) ((0x0000FF00 & gPEColorRGB[iCount - 1]) >> 8);
- inputBuffer = GetCurrNInputBuffer(SCR_PE_PEN_SETTING, &inputBufferSize); /* added for inline edit history */
- RegisterHighlightHandler(PicEditPenSettingInlineEdit);
- g_pe_color_index = nInlinePenColorIndex + 1;
- SetPicEditPenSettingInlineItemData();
- if (inputBuffer != NULL)
- SetCategory57Data(PicEditInLineItems,
- #ifdef __MMI_TOUCH_SCREEN__
- 4,
- #else
- 6,
- #endif
- inputBuffer);
- ShowCategory57Screen(STR_PE_EDIT_OPT_PEN_SETTING, GetRootTitleIcon(MENU_PICTURE_EDITOR),
- STR_GLOBAL_OK, IMG_GLOBAL_OK, STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
- #ifdef __MMI_TOUCH_SCREEN__
- 4,
- #else
- 6,
- #endif
- NULL, PicEditInLineItems, 0, guiBuffer);
- DisableCategory57ScreenDone();
- RegisterInlineSelectHighlightHandler(&PicEditInLineItems[PE_PEN_SIZE_SELECT], PicEditPenSettingSelectInlineEdit);
- #ifndef __MMI_TOUCH_SCREEN__
- RegisterInlineSelectHighlightHandler(&PicEditInLineItems[PE_PEN_MOVE_SELECT], PicEditPenSettingSelectInlineEdit);
- #endif
- RegisterInlineSelectHighlightHandler(&PicEditInLineItems[PE_PEN_COLOR_SELECT], PicEditPenSettingSelectInlineEdit);
- PicEditPenSettingSelectInlineEdit(-1);
- /* SetExitHandler(SCR_PE_PEN_SETTING, ExitScr4PicEditPenSetting); */
- }
- /*****************************************************************************
- * FUNCTION
- * ExitScr4PicEditPenSetting
- * DESCRIPTION
- * Exit function for EntryScr4PicEditPenSetting
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitScr4PicEditPenSetting(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h;
- S16 nHistory = 0;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- CloseCategory57Screen();
- h.scrnID = SCR_PE_PEN_SETTING;
- h.entryFuncPtr = EntryScr4PicEditPenSetting;
- pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
- GetCategory57History(h.guiBuffer);
- inputBufferSize = (S16) GetCategory57DataSize(); /* added for inline edit history */
- GetCategory57Data((U8*) h.inputBuffer); /* added for inline edit history */
- AddNHistory(h, inputBufferSize); /* added for inline edit history */
- }
- /*****************************************************************************
- * FUNCTION
- * GoBackPicEditPenSettingHistory
- * DESCRIPTION
- * Go Back function for Pen settign screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void GoBackPicEditPenSettingHistory(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- CloseCategory57Screen();
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * PicEditPenSettingInlineEdit
- * DESCRIPTION
- * Changes the softkeys for pen setting screen
- * PARAMETERS
- * nIndex [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void PicEditPenSettingInlineEdit(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- nSelPEPenSetting = (U8) nIndex;
- ChangePenSettingSoftkey();
- }
- /*****************************************************************************
- * FUNCTION
- * PicEditPenSettingSelectInlineEdit
- * DESCRIPTION
- * changes softkey when inline item selected on pen setting screen
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void PicEditPenSettingSelectInlineEdit(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((nSelPEPenSetting == PE_PEN_COLOR_SELECT) && (index != -1))
- {
- g_pe_color_index = index;
- }
- ChangePenSettingSoftkey();
- }
- /*****************************************************************************
- * FUNCTION
- * ChangePenSettingSoftkey
- * DESCRIPTION
- * Changes softkey on pen setting screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ChangePenSettingSoftkey(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (CheckPicEditPenSettingChange())
- {
- ChangeRightSoftkey(STR_GLOBAL_DONE, IMG_GLOBAL_BACK);
- SetRightSoftkeyFunction(EntryScr4PicEditPenSettingSaveConfirm, KEY_EVENT_UP);
- }
- else
- {
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetRightSoftkeyFunction(GoBackPicEditPenSettingHistory, KEY_EVENT_UP);
- }
- if ((nSelPEPenSetting == PE_PEN_COLOR_SELECT) && (g_pe_color_index + 1 == PE_COLOR_CUSTOM_1))
- {
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- SetCategory57LeftSoftkeyFunction(EntryScr4PicEditCustomColor);
- }
- else
- {
- ChangeLeftSoftkey((U16) NULL, (U16) NULL);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * EntryScr4PicEditPenSettingSaveConfirm
- * DESCRIPTION
- * Confirmation screen for save pen settings
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryScr4PicEditPenSettingSaveConfirm(void)
- {
- #if (0)
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* (0) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- get_string(STR_GLOBAL_SAVE),
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- SetLeftSoftkeyFunction(SavePicEditPenSetting, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackPicEditPenSettingConfirmHistory, KEY_EVENT_UP);
- /* playRequestedTone(WARNING_TONE) ; */
- /* SetExitHandler(SCR_PE_PEN_SETTING_SAVE, ExitScr4PicEditPenSettingSaveConfirm); */
- }
- /*****************************************************************************
- * FUNCTION
- * ExitScr4PicEditPenSettingSaveConfirm
- * DESCRIPTION
- * Exit function EntryScr4PicEditPenSettingSaveConfirm
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitScr4PicEditPenSettingSaveConfirm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h; /* Variable to hold the history data */
- S16 nHistory = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- stopRequestedTone(WARNING_TONE);
- h.scrnID = SCR_PE_PEN_SETTING_SAVE;
- h.entryFuncPtr = EntryScr4PicEditPenSettingSaveConfirm;
- pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
- GetCategoryHistory(h.guiBuffer);
- }
- /*****************************************************************************
- * FUNCTION
- * GoBackPicEditPenSettingConfirmHistory
- * DESCRIPTION
- * Go Back History for save pen setting coonfirmatioon screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void GoBackPicEditPenSettingConfirmHistory(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- CloseCategory57Screen();
- DeleteUptoScrID(SCR_PE_EDIT_PIC_OPT);
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * SavePicEditPenSetting
- * DESCRIPTION
- * Saves Pen setting
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void SavePicEditPenSetting(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 infoPalette[MAX_TYPE_PEN_COLOR * 4];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gpPicEditPen->penColorIndex = (U8) nInlinePenColorIndex + 1;
- switch (nInlinePenSize)
- {
- case 0:
- gpPicEditPen->penPixel = PIC_EDIT_PEN_PIXEL_1;
- break;
- case 1:
- gpPicEditPen->penPixel = PIC_EDIT_PEN_PIXEL_2;
- break;
- case 2:
- gpPicEditPen->penPixel = PIC_EDIT_PEN_PIXEL_3;
- break;
- case 3:
- gpPicEditPen->penPixel = PIC_EDIT_PEN_PIXEL_4;
- break;
- default:
- gpPicEditPen->penPixel = PIC_EDIT_PEN_PIXEL_1;
- break;
- }
- #ifndef __MMI_TOUCH_SCREEN__ /* PMT MANISH 20050616 */
- switch (nInlinePenMoveFactor)
- {
- case 0:
- gpPicEditPen->penMove = PIC_EDIT_PEN_MOVE_1;
- break;
- case 1:
- gpPicEditPen->penMove = PIC_EDIT_PEN_MOVE_2;
- break;
- case 2:
- gpPicEditPen->penMove = PIC_EDIT_PEN_MOVE_3;
- break;
- case 3:
- gpPicEditPen->penMove = PIC_EDIT_PEN_MOVE_4;
- break;
- default:
- gpPicEditPen->penMove = PIC_EDIT_PEN_MOVE_1;
- break;
- }
- #endif /* __MMI_TOUCH_SCREEN__ */
- CloseCategory57Screen();
- GetPaletteInfo(infoPalette);
- memcpy(gpPEFileBuff + 54, &infoPalette, MAX_TYPE_PEN_COLOR * gPEBitsPerPixel);
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, PE_NOTIFYDURATION, SUCCESS_TONE);
- DeleteUptoScrID(SCR_PE_EDIT_PIC);
- }
- /*****************************************************************************
- * FUNCTION
- * SetPicEditFillPicInlineItemData
- * DESCRIPTION
- * Setup inline item data for fill image background
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void SetPicEditFillPicInlineItemData(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetInlineItemActivation(&PicEditInLineItems[0], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemCaption(&PicEditInLineItems[0], (PU8) (get_string(STR_PE_EDIT_OPT_FILL_PIC)));
- SetInlineItemActivation(&PicEditInLineItems[1], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(
- &PicEditInLineItems[1],
- MAX_TYPE_PEN_COLOR - 1,
- pInlinePenColorIndexList,
- &nInlinePenColorIndex);
- RegisterInlineSelectHighlightHandler(&PicEditInLineItems[1], PicEditPenColorHiLiteHandler);
- }
- /*****************************************************************************
- * FUNCTION
- * EntryScr4PicEditFillPic
- * DESCRIPTION
- * Entry function for filling image with selected color
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryScr4PicEditFillPic(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer; /* added for inline edit history */
- U16 inputBufferSize; /* added for inline edit history */
- U8 iCount;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* ExecuteCurrExitHandler(); */
- EntryNewScreen(SCR_PE_FILL_PIC, ExitScr4PicEditFillPic, NULL, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_PE_FILL_PIC);
- //Pixtel patch
- // nInlinePenColorIndex=gpPicEditPen->penBackgrdColorIndex;
- for (iCount = 0; iCount < MAX_TYPE_PEN_COLOR; iCount++)
- {
- pInlinePenColorIndexList[iCount] = (U8*) GetString((U16) (iCount + 1 + STR_PE_COLOR_NONE));
- inlinePERGBlist[iCount][0] = (U8) ((0xFF000000 & gPEColorRGB[iCount + 1]) >> 24);
- inlinePERGBlist[iCount][1] = (U8) ((0x00FF0000 & gPEColorRGB[iCount + 1]) >> 16);
- inlinePERGBlist[iCount][2] = (U8) ((0x0000FF00 & gPEColorRGB[iCount + 1]) >> 8);
- }
- inputBuffer = GetCurrNInputBuffer(SCR_PE_FILL_PIC, &inputBufferSize); /* added for inline edit history */
- RegisterHighlightHandler(ChangeSoftkeyFillPic);
- g_pe_color_index = nInlinePenColorIndex + 1;
- InitializeCategory57Screen();
- SetPicEditFillPicInlineItemData();
- if (inputBuffer != NULL)
- {
- SetCategory57Data(PicEditInLineItems, 2, inputBuffer);
- }
- ShowCategory57Screen(
- STR_PE_EDIT_OPT_FILL_PIC,
- GetRootTitleIcon(MENU_PICTURE_EDITOR),
- 0,
- 0,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- 2,
- NULL,
- PicEditInLineItems,
- 0,
- guiBuffer);
- EnableCategory57ScreenDone();
- SetCategory57RightSoftkeyFunctions(EntryScr4PicEditFillPicSaveConfirm, GoBackHistory);
- }
- /*****************************************************************************
- * FUNCTION
- * ExitScr4PicEditFillPic
- * DESCRIPTION
- * Exit function for EntryScr4PicEditFillPic
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitScr4PicEditFillPic(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h;
- S16 nHistory = 0;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- CloseCategory57Screen();
- h.scrnID = SCR_PE_FILL_PIC;
- h.entryFuncPtr = EntryScr4PicEditFillPic;
- pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
- GetCategory57History(h.guiBuffer);
- inputBufferSize = (S16) GetCategory57DataSize(); /* added for inline edit history */
- GetCategory57Data((U8*) h.inputBuffer); /* added for inline edit history */
- AddNHistory(h, inputBufferSize); /* added for inline edit history */
- }
- /*****************************************************************************
- * FUNCTION
- * ChangeSoftkeyFillPic
- * DESCRIPTION
- * Changes softkeys when inline item selected
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ChangeSoftkeyFillPic(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (gpPicEditPen->penBackgrdColorIndex != (U8) g_pe_color_index)
- {
- ChangeRightSoftkey(STR_GLOBAL_DONE, IMG_GLOBAL_BACK);
- ChangeLeftSoftkey((U16) NULL, (U16) NULL);
- SetRightSoftkeyFunction(EntryScr4PicEditFillPicSaveConfirm, KEY_EVENT_UP);
- }
- else
- {
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- /* ChangeLeftSoftkey(STR_GLOBAL_OK,IMG_GLOBAL_OK); */
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetCategory57LeftSoftkeyFunction(EntryScr4PicEditFillPicSaveConfirm);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * PicEditFillPicSelectInlineEdit
- * DESCRIPTION
- * Changes softkeys when inline item selected
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void PicEditFillPicSelectInlineEdit(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pe_color_index = index + 1;
- ChangeSoftkeyFillPic(index);
- }
- /*****************************************************************************
- * FUNCTION
- * EntryScr4PicEditFillPicSaveConfirm
- * DESCRIPTION
- * Confirmation screen for filling image with color selected
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryScr4PicEditFillPicSaveConfirm(void)
- {
- #if (0)
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* (0) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- get_string(STR_PE_EDIT_OPT_FILL_PIC),
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- SetLeftSoftkeyFunction(SavePicEditFillPic, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackPicEditFillPicConfirmHistory, KEY_EVENT_UP);
- /* playRequestedTone(WARNING_TONE) ; */
- /* SetExitHandler(SCR_PE_FILL_PIC_SAVE, ExitScr4PicEditFillPicSaveConfirm); */
- }
- /*****************************************************************************
- * FUNCTION
- * ExitScr4PicEditFillPicSaveConfirm
- * DESCRIPTION
- * Exit function for EntryScr4PicEditFillPicSaveConfirm
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitScr4PicEditFillPicSaveConfirm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h; /* Variable to hold the history data */
- S16 nHistory = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- stopRequestedTone(WARNING_TONE);
- h.scrnID = SCR_PE_FILL_PIC_SAVE;
- h.entryFuncPtr = EntryScr4PicEditFillPicSaveConfirm;
- pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
- GetCategoryHistory(h.guiBuffer);
- }
- /*****************************************************************************
- * FUNCTION
- * GoBackPicEditFillPicConfirmHistory
- * DESCRIPTION
- * Go Back history function for the confirmation screen for filling image
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void GoBackPicEditFillPicConfirmHistory(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- CloseCategory57Screen();
- DeleteUptoScrID(SCR_PE_EDIT_PIC_OPT);
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * SavePicEditFillPic
- * DESCRIPTION
- * Fills image with the color selected
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void SavePicEditFillPic(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 infoPalette[MAX_TYPE_PEN_COLOR * 4];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gpPicEditPen->penBackgrdColorIndex = (U8) nInlinePenColorIndex + 1;
- CloseCategory57Screen();
- GetPaletteInfo(infoPalette);
- gPEImageWidth_bak = gPEImageWidth;
- gPEImageHeight_bak = gPEImageHeight;
- SET_PE_IMAGE_EDIT(gPEAttrib);
- UNSET_PE_MARK_IMAGE(gPEAttrib);
- UNSET_PE_COPY_IMAGE(gPEAttrib);
- memcpy(&gpPEFileBuff[54], &infoPalette, MAX_TYPE_PEN_COLOR * gPEBitsPerPixel);
- memset(
- &gpPEFileBuff[PIC_EDIT_FILE_HEADER_SIZE],
- ((gpPicEditPen->penBackgrdColorIndex) | (gpPicEditPen->penBackgrdColorIndex << 4)),
- (gpPicEditPen->maxY - gpPicEditPen->minY) * GetImageWidth(gpPicEditPen->minX, gpPicEditPen->maxX));
- SavePEContext();
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, PE_NOTIFYDURATION, SUCCESS_TONE);
- DeleteUptoScrID(SCR_PE_EDIT_PIC);
- }
- /*****************************************************************************
- * FUNCTION
- * EntryScr4PicEditScrResize
- * DESCRIPTION
- * Entry screen for resize image
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryScr4PicEditScrResize(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 iCount;
- U8 *inputBuffer; /* added for inline edit history */
- U16 inputBufferSize; /* added for inline edit history */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* ExecuteCurrExitHandler(); */
- EntryNewScreen(SCR_PE_SCR_RESIZE, ExitScr4PicEditScrResize, NULL, NULL);
- InitializeCategory57Screen();
- guiBuffer = GetCurrGuiBuffer(SCR_PE_SCR_RESIZE);
- //Pixtel patch
- // memset( (void *)PicEditInLineItems, 0, sizeof( InlineItem )*MAX_RESIZE_INLINE_EDIT );
- for (iCount = 0; iCount < MAX_TYPE_SCR_TYPE; ++iCount)
- {
- #ifdef __MMI_MAINLCD_240X320__
- pInlinePEScrList[iCount] = (U8*) GetString((U16) (iCount + STR_PE_RESIZE_32)); /* 110805 resize region Calvin added */
- #else
- pInlinePEScrList[iCount] = (U8*) GetString((U16) (iCount + STR_PE_RESIZE_16));
- #endif
- }
- inputBuffer = GetCurrNInputBuffer(SCR_PE_SCR_RESIZE, &inputBufferSize); /* added for inline edit history */
- //Pixtel patch
- // FillPicEditResizeInLine(PicEditInLineItems);
- RegisterHighlightHandler(ChangeResizeSoftKey);
- /* Pixtel patch */
- if (inputBuffer != NULL) /* added for inline edit history */
- {
- SetCategory57Data(PicEditInLineItems, MAX_RESIZE_INLINE_EDIT, inputBuffer); /* sets the data */
- }
- else
- {
- memset((void*)PicEditInLineItems, 0, sizeof(InlineItem) * MAX_RESIZE_INLINE_EDIT);
- FillPicEditResizeInLine(PicEditInLineItems);
- }
- DisableCategory57ScreenDone();
- ShowCategory57Screen(
- STR_PE_EDIT_OPT_RESIZE,
- GetRootTitleIcon(MENU_PICTURE_EDITOR),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- MAX_RESIZE_INLINE_EDIT,
- (U16*) NULL,
- PicEditInLineItems,
- 0,
- guiBuffer);
- DisableCategory57ScreenDone();
- SetLeftSoftkeyFunction(ValidateScrWidthHeight, KEY_EVENT_UP);
- SetCategory57RightSoftkeyFunctions(ValidateScrWidthHeight, GoBackHistory);
- /* SetExitHandler(SCR_PE_SCR_RESIZE, ExitScr4PicEditScrResize); */
- }
- /*****************************************************************************
- * FUNCTION
- * ExitScr4PicEditScrResize
- * DESCRIPTION
- * Exit function for EntryScr4PicEditScrResize
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitScr4PicEditScrResize(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h;
- S16 nHistory = 0;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- CloseCategory57Screen();
- h.scrnID = SCR_PE_SCR_RESIZE;
- h.entryFuncPtr = EntryScr4PicEditScrResize;
- pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
- GetCategoryHistory(h.guiBuffer);
- inputBufferSize = (S16) GetCategory57DataSize(); /* added for inline edit history */
- GetCategory57Data((U8*) h.inputBuffer); /* added for inline edit history */
- AddNHistory(h, inputBufferSize); /* added for inline edit history */
- }
- /*****************************************************************************
- * FUNCTION
- * FillPicEditResizeInLine
- * DESCRIPTION
- * Fills the Inline buffer for resize image screen
- * PARAMETERS
- * ResizeInline [?]
- * RETURNS
- * void
- *****************************************************************************/
- void FillPicEditResizeInLine(InlineItem *ResizeInline)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetInlineItemActivation(&ResizeInline[0], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemCaption(&ResizeInline[0], (PU8) (GetString(STR_PE_RESIZE_TO)));
- SetInlineItemActivation(&ResizeInline[1], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(&ResizeInline[1], (S32) MAX_TYPE_SCR_TYPE, pInlinePEScrList, &nInlinePEScr);
- RegisterInlineSelectHighlightHandler(&ResizeInline[1], HighlightResizeInlineItemHandler);
- SetInlineItemActivation(&ResizeInline[2], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemCaption(&ResizeInline[2], (PU8) (GetString(STR_PE_RESIZE_WIDTH)));
- SetInlineItemActivation(&ResizeInline[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemTextEdit(&ResizeInline[3], (PU8) nInlinePEScrWidth, PE_RESIZE_BUF_SIZE, INPUT_TYPE_NUMERIC); /* 100405 image editor Calvin */
- RightJustifyInlineItem(&ResizeInline[3]);
- EnableInlineItemBoundary(&ResizeInline[3]);
- SetInlineItemActivation(&ResizeInline[4], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemCaption(&ResizeInline[4], (PU8) (GetString(STR_PE_RESIZE_HEIGHT)));
- SetInlineItemActivation(&ResizeInline[5], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemTextEdit(&ResizeInline[5], (PU8) nInlinePEScrHeight, PE_RESIZE_BUF_SIZE, INPUT_TYPE_NUMERIC); /* 100405 image editor Calvin */
- RightJustifyInlineItem(&ResizeInline[5]);
- EnableInlineItemBoundary(&ResizeInline[5]);
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightResizeInlineItemHandler
- * DESCRIPTION
- * Highlight Handler for Inline Item selected
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightResizeInlineItemHandler(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 scrWParam[4 * ENCODING_LENGTH], scrHParam[4 * ENCODING_LENGTH];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (index == PE_SCR_4)
- {
- if (!nInlinePenColorIndex)
- {
- /* Leo start 20050824 */
- // sprintf((PS8)scrWParam,"%d",nInlinePenSize);
- // sprintf((PS8)scrHParam,"%d",nInlinePenMoveFactor);
- /* Leo end 20050824 */
- sprintf((PS8) scrWParam, "%d", gPEImageWidth);
- sprintf((PS8) scrHParam, "%d", gPEImageHeight);
- nInlinePenColorIndex = 1;
- AnsiiToUnicodeString((PS8) nInlinePEScrWidth, (PS8) scrWParam);
- AnsiiToUnicodeString((PS8) nInlinePEScrHeight, (PS8) scrHParam);
- EnableInlineItem(PicEditInLineItems, 3);
- EnableInlineItem(PicEditInLineItems, 5);
- }
- }
- else
- {
- if (nInlinePenColorIndex)
- {
- UnicodeToAnsii((PS8) scrWParam, (PS8) nInlinePEScrWidth);
- UnicodeToAnsii((PS8) scrHParam, (PS8) nInlinePEScrHeight);
- nInlinePenSize = (U16) atoi((PS8) scrWParam);
- nInlinePenMoveFactor = (U16) atoi((PS8) scrHParam);
- nInlinePenColorIndex = 0;
- }
- sprintf((PS8) scrWParam, "");
- sprintf((PS8) scrHParam, "");
- AnsiiToUnicodeString((PS8) nInlinePEScrWidth, (PS8) scrWParam);
- AnsiiToUnicodeString((PS8) nInlinePEScrHeight, (PS8) scrHParam);
- DisableInlineItem(PicEditInLineItems, 3);
- DisableInlineItem(PicEditInLineItems, 5);
- }
- RedrawCategoryFunction();
- }
- /*****************************************************************************
- * FUNCTION
- * ChangeResizeSoftKey
- * DESCRIPTION
- * Change softkey for Resize screen
- * PARAMETERS
- * nIndex [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ChangeResizeSoftKey(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- SetCategory57LeftSoftkeyFunction(ValidateScrWidthHeight);
- }
- /*****************************************************************************
- * FUNCTION
- * SetResizeInlineItemValues
- * DESCRIPTION
- * Sets Resize Inline item values
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void SetResizeInlineItemValues(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- nInlinePEScr = (U32) GetPicEditScr();
- //nInlinePenSize used as temp buffer for inline Width
- // nInlinePenSize =(S32)gPEImageWidth;
- // gPEImageWidth_bak =(S32)gPEImageWidth;
- //nInlinePenMoveFactor used as temp buffer for inline Height
- // nInlinePenMoveFactor =(S32)gPEImageHeight;
- // gPEImageHeight_bak =(S32)gPEImageHeight;
- //nInlinePenColorIndex used as flag for Inline Resize Screen
- nInlinePenColorIndex = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * ValidateScrWidthHeight
- * DESCRIPTION
- * Validates and sets the values for width and height of image
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ValidateScrWidthHeight(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 scrWParam[4 * ENCODING_LENGTH], scrHParam[4 * ENCODING_LENGTH];
- U16 nWidth, nHeight;
- BOOL bFlag = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- CloseCategory57Screen();
- gPEImageWidth_bak = gPEImageWidth;
- gPEImageHeight_bak = gPEImageHeight;
- gPEImageResized = MMI_TRUE;
- switch (nInlinePEScr)
- {
- case PE_SCR_1:
- gPEImageWidth = PE_SCR_SIZE_1;
- gPEImageHeight = PE_SCR_SIZE_1;
- break;
- case PE_SCR_2:
- gPEImageWidth = PE_SCR_SIZE_2;
- gPEImageHeight = PE_SCR_SIZE_2;
- break;
- case PE_SCR_3:
- gPEImageWidth = PE_SCR_SIZE_MAX;
- gPEImageHeight = PE_SCR_SIZE_MAX;
- break;
- case PE_SCR_4:
- UnicodeToAnsii((PS8) scrWParam, (PS8) nInlinePEScrWidth);
- UnicodeToAnsii((PS8) scrHParam, (PS8) nInlinePEScrHeight);
- nWidth = (U16) atoi((PS8) scrWParam);
- nHeight = (U16) atoi((PS8) scrHParam);
- if (((nWidth >= PE_SCR_SIZE_MIN) && (nWidth <= PE_SCR_SIZE_MAX)) &&
- ((nHeight >= PE_SCR_SIZE_MIN) && (nHeight <= PE_SCR_SIZE_MAX)))
- {
- gPEImageWidth = nWidth;
- gPEImageHeight = nHeight;
- }
- else
- {
- /* 092005 Image Editor Size Calvin */
- #ifdef __MMI_MAINLCD_240X320__
- DisplayPopup(
- (U8*) GetString(STR_PE_RESIZE_ERROR_BIG),
- IMG_GLOBAL_WARNING,
- 0,
- PE_NOTIFYDURATION,
- (U8) WARNING_TONE);
- #else /* __MMI_MAINLCD_240X320__ */
- DisplayPopup(
- (U8*) GetString(STR_PE_RESIZE_ERROR),
- IMG_GLOBAL_WARNING,
- 0,
- PE_NOTIFYDURATION,
- (U8) WARNING_TONE);
- #endif /* __MMI_MAINLCD_240X320__ */
- /* 092005 Calvin end */
- bFlag = TRUE;
- }
- break;
- default:
- gPEImageWidth = PE_SCR_SIZE_2;
- gPEImageHeight = PE_SCR_SIZE_2;
- break;
- }
- if (!bFlag)
- {
- /* CloseCategory57Screen(); */
- UNSET_PE_PEN_DOWN(gPEAttrib);
- /* check if image is resized to smaller size */
- if (!SetPicEditPenMarkBoundary())
- {
- SavePEContext();
- gPECurrentAction = SEL_PE_EDIT_OPT_SAVE_PIC;
- SetPicEditPenBoundary();
- ResizePicEditImageDataBuff();
- if (IS_PE_ZOOM_IMAGE(gPEAttrib))
- {
- SetPicEditZoomWindow(FALSE);
- }
- SET_PE_IMAGE_EDIT(gPEAttrib);
- UNSET_PE_MARK_IMAGE(gPEAttrib);
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, PE_NOTIFYDURATION, SUCCESS_TONE);
- DeleteUptoScrID(SCR_PE_EDIT_PIC);
- }
- else
- {
- gPECurrentAction = SEL_PE_EDIT_OPT_RESIZE;
- DeleteUptoScrID(SCR_PE_EDIT_PIC);
- GoBackHistory();
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * EntryScr4PicEditHelp
- * DESCRIPTION
- * Entry screen for help
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryScr4PicEditHelp(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- S8 *buffer;
- S32 bufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* ExecuteCurrExitHandler(); */
- EntryNewScreen(SCR_PE_HELP, ExitScr4PicEditHelp, NULL, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_PE_HELP);
- /* Leo add 20050705 start */
- #ifdef __MMI_TOUCH_SCREEN__
- buffer = GetString(STR_PE_HELP_DESCRIPTION_TOUCH);
- #else
- buffer = GetString(STR_PE_HELP_DESCRIPTION);
- #endif
- /* Leo add 20050705 end */
- bufferSize = pfnUnicodeStrlen(buffer);
- ShowCategory74Screen(
- STR_PE_EDIT_OPT_HELP,
- GetRootTitleIcon(MENU_PICTURE_EDITOR),
- 0,
- 0,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- (PU8) buffer,
- bufferSize,
- guiBuffer);
- /* go back to option menu */
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- /* SetExitHandler (SCR_PE_HELP,ExitScr4PicEditHelp); */
- }
- /*****************************************************************************
- * FUNCTION
- * ExitScr4PicEditHelp
- * DESCRIPTION
- * Exit function for EntryScr4PicEditHelp
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitScr4PicEditHelp(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h;
- S16 nHistory = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- h.scrnID = SCR_PE_HELP;
- h.entryFuncPtr = EntryScr4PicEditHelp;
- pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
- GetCategoryHistory(h.guiBuffer);
- AddHistory(h);
- }
- /*****************************************************************************
- * FUNCTION
- * EntryScr4PicEditCustomColor
- * DESCRIPTION
- * Entry screen function for custom color setting change
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryScr4PicEditCustomColor(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* ExecuteCurrExitHandler(); */
- EntryNewScreen(SCR_PE_CUSTOM_COLOR, ExitScr4PicEditCustomColor, NULL, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_PE_CUSTOM_COLOR);
- inlineCustomRGB[0] = inlinePERGBlist[PE_COLOR_CUSTOM_1][0];
- inlineCustomRGB[1] = inlinePERGBlist[PE_COLOR_CUSTOM_1][1];
- inlineCustomRGB[2] = inlinePERGBlist[PE_COLOR_CUSTOM_1][2];
- ShowCategory91Screen(
- STR_PE_COLOR_SEL,
- GetRootTitleIcon(MENU_PICTURE_EDITOR),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- &inlineCustomRGB[0],
- &inlineCustomRGB[1],
- &inlineCustomRGB[2],
- &highlighted_slider,
- guiBuffer);
- SetLeftSoftkeyFunction(SavePicEditCustomColor, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- /* SetExitHandler(SCR_PE_CUSTOM_COLOR, ExitScr4PicEditCustomColor); */
- }
- /*****************************************************************************
- * FUNCTION
- * ExitScr4PicEditCustomColor
- * DESCRIPTION
- * Exit function for EntryScr4PicEditCustomColor
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitScr4PicEditCustomColor(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h;
- S16 nHistory = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- h.scrnID = SCR_PE_CUSTOM_COLOR;
- h.entryFuncPtr = EntryScr4PicEditCustomColor;
- pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
- GetCategoryHistory(h.guiBuffer);
- AddHistory(h);
- }
- /*****************************************************************************
- * FUNCTION
- * SavePicEditCustomColor
- * DESCRIPTION
- * Saves custom color settings
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void SavePicEditCustomColor(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 infoPalette[MAX_TYPE_PEN_COLOR * 4];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- inlinePERGBlist[PE_COLOR_CUSTOM_1][0] = inlineCustomRGB[0];
- inlinePERGBlist[PE_COLOR_CUSTOM_1][1] = inlineCustomRGB[1];
- inlinePERGBlist[PE_COLOR_CUSTOM_1][2] = inlineCustomRGB[2];
- gPEColorRGB[PE_COLOR_CUSTOM_1] &= 0x000000FF;
- gPEColorRGB[PE_COLOR_CUSTOM_1] |=
- ((((U32) inlineCustomRGB[0]) << 24) | (((U32) inlineCustomRGB[1]) << 16) |
- (((U32) inlineCustomRGB[2]) << 8));
- /* Removed by Leo gpPicEditPen->penColorIndex=(U8)nInlinePenColorIndex+1; */
- GetPaletteInfo(infoPalette);
- memcpy(gpPEFileBuff + 54, &infoPalette, MAX_TYPE_PEN_COLOR * gPEBitsPerPixel);
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * EntryScr4PicEditSaveImageConfirm
- * DESCRIPTION
- * Confirmation screen for Saving image
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryScr4PicEditSaveImageConfirm(void)
- {
- #if (0)
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* (0) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- get_string(STR_GLOBAL_SAVE),
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- SetLeftSoftkeyFunction(PicEditSaveImage, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackPicEditSaveImageConfirmHistory, KEY_EVENT_UP);
- playRequestedTone(WARNING_TONE);
- /* SetExitHandler(SCR_PE_SAVE_IMAGE_CONFIRM, ExitScr4PicEditPenSettingSaveConfirm); */
- }
- /*****************************************************************************
- * FUNCTION
- * ExitScr4PicEditSaveImageConfirm
- * DESCRIPTION
- * Exit screen function for EntryScr4PicEditSaveImageConfirm
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitScr4PicEditSaveImageConfirm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h; /* Variable to hold the history data */
- S16 nHistory = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- stopRequestedTone(WARNING_TONE);
- h.scrnID = SCR_PE_SAVE_IMAGE_CONFIRM;
- h.entryFuncPtr = EntryScr4PicEditSaveImageConfirm;
- pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
- GetCategoryHistory(h.guiBuffer);
- }
- /*****************************************************************************
- * FUNCTION
- * GoBackPicEditSaveImageConfirmHistory
- * DESCRIPTION
- * Go back histroy fucntion for saving image confirmation screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void GoBackPicEditSaveImageConfirmHistory(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- InitPicEditPen();
- GoBacknHistory(1);
- }
- /*****************************************************************************
- * FUNCTION
- * PicEditSaveImage
- * DESCRIPTION
- * Saves image
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void PicEditSaveImage(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 result;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- result = SavePicEditImageDataBuff();
- if (result == FS_NO_ERROR)
- {
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, PE_NOTIFYDURATION, SUCCESS_TONE);
- }
- else
- {
- DisplayPopup(
- (U8*) get_string(GetFileSystemErrorString(result)),
- IMG_GLOBAL_ERROR,
- 1,
- PE_NOTIFYDURATION,
- ERROR_TONE);
- }
- InitPicEditPen();
- DeleteNHistory(1);
- }
- /*****************************************************************************
- * FUNCTION
- * SetPicEditPenAtCenter
- * DESCRIPTION
- * Sets Pen at the center of the image if bflag TRUE
- * PARAMETERS
- * bFlag [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetPicEditPenAtCenter(BOOL bFlag)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (bFlag)
- {
- gpPicEditPen->penX = (U16) (UI_device_width / 2) + PE_IMAGE_WIDTH_EXTRA;
- gpPicEditPen->penY = (U16) (UI_device_height / 2) + PE_IMAGE_HEIGHT_EXTRA;
- }
- else
- {
- gpPicEditPen->penX = gpPicEditPen->minX;
- gpPicEditPen->penY = gpPicEditPen->minY;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * SetPicEditPenBoundary
- * DESCRIPTION
- * Sets Pen boundary wrt to the image size
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void SetPicEditPenBoundary(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 nWidth, nHeight;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (nInlinePEScr)
- {
- case PE_SCR_1:
- nWidth = PE_SCR_SIZE_1;
- nHeight = PE_SCR_SIZE_1;
- break;
- case PE_SCR_2:
- nWidth = PE_SCR_SIZE_2;
- nHeight = PE_SCR_SIZE_2;
- break;
- case PE_SCR_3:
- nWidth = PE_SCR_SIZE_MAX;
- nHeight = PE_SCR_SIZE_MAX;
- break;
- case PE_SCR_4:
- nWidth = gPEImageWidth;
- nHeight = gPEImageHeight;
- break;
- default:
- nWidth = PE_SCR_SIZE_2;
- nHeight = PE_SCR_SIZE_2;
- break;
- }
- gpPicEditPen->minX = SET_WINDOW_MINX(nWidth);
- gpPicEditPen->maxX = gpPicEditPen->minX + (U16) nWidth;
- gpPicEditPen->minY = SET_WINDOW_MINY(nHeight);
- gpPicEditPen->maxY = gpPicEditPen->minY + (U16) nHeight;
- }
- /*****************************************************************************
- * FUNCTION
- * SavePicEditImageDataBuff
- * DESCRIPTION
- * Saves Image data buffer
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- S32 SavePicEditImageDataBuff(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- FILE_HANDLE fileHandle;
- S8 fileBuf[100 * ENCODING_LENGTH]; /* padding for filepath */
- S8 fileName[100 * ENCODING_LENGTH]; /* padding for filepath */
- S8 localBuffer[30 * ENCODING_LENGTH];
- U32 wByte = 0;
- S32 result;
- U16 image_size;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __ASCII
- pfnUnicodeStrcpy((PS8) fileName, PICTURE_EDITOR_PATH);
- #else
- AnsiiToUnicodeString((PS8) fileName, PICTURE_EDITOR_PATH);
- #endif
- memset(fileName, 0, sizeof(fileName));
- sprintf(fileBuf, "%c:\", MMI_PUBLIC_DRV);
- AnsiiToUnicodeString((S8*) fileName, (S8*) fileBuf);
- pfnUnicodeStrcat((S8*) fileName, (S8*) FMGR_DEFAULT_FOLDER_IMAGES);
- fileHandle = FS_Open((U16*) fileName, FS_OPEN_DIR | FS_READ_ONLY);
- if (fileHandle < 0)
- {
- fileHandle = pcreateDir(fileName);
- pfclose(fileHandle);
- }
- else
- {
- pfclose(fileHandle);
- }
- if (IS_PE_ADD_IMAGE(gPEAttrib))
- {
- // wByte=0;
- // while(1)
- // {
- // sprintf(localBuffer,"Picture%d.bmp",(wByte%MAXIMUM_PICTURE_EDITOR_IMAGES)+1);
- sprintf(localBuffer, "Picture%d.bmp", gPicEditCurrPic + 1);
- AnsiiToUnicodeString((S8*) fileBuf, (S8*) localBuffer);
- // if (!SearchPicEditFileName(fileBuf)) break; else wByte++;
- // }
- }
- else
- {
- pfnUnicodeStrcpy((S8*) fileBuf, (S8*) gPicEditorInfo[gPicEditCurrPic].ImageName);
- }
- pfnUnicodeStrcat((S8*) fileName, (S8*) fileBuf);
- if ((fileHandle = FS_Open((PU16) fileName, FS_READ_WRITE | FS_CREATE_ALWAYS)) < 0)
- {
- return fileHandle;
- }
- image_size = PIC_EDIT_FILE_HEADER_SIZE + ((GetImageWidth(0, gPEImageWidth) * gPEImageHeight));
- memcpy((S8*) & gpPEFileBuff[2], &image_size, 2);
- /* pfwrite(gpPEFileBuff,1,PIC_EDIT_FILE_BUFF,fileHandle,&wByte); */
- result = FS_Write(fileHandle, gpPEFileBuff, image_size, &wByte); /* (gpPEFileBuff,1,image_size,fileHandle,&wByte); */
- if (result < 0)
- {
- FS_Close(fileHandle);
- return result;
- }
- FS_Close(fileHandle);
- if (IS_PE_ADD_IMAGE(gPEAttrib))
- {
- /* AddPictureEditorImage(( S8*)fileBuf); */
- AddPictureEditorImageAtIndex((S8*) fileBuf, gPicEditCurrPic);
- WritePicEditListToNVRAM();
- }
- return FS_NO_ERROR;
- }
- /*****************************************************************************
- * FUNCTION
- * SearchPicEditFileName
- * DESCRIPTION
- * Search file name in the images already present
- * PARAMETERS
- * sFile [?]
- * RETURNS
- * void
- *****************************************************************************/
- U8 SearchPicEditFileName(S8 *sFile)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 jCount;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* for (jCount=0;jCount<gPEImageCount;jCount++) */
- for (jCount = 0; jCount < MAXIMUM_PICTURE_EDITOR_IMAGES; jCount++)
- {
- if ((gPicEditorInfo[jCount].ImagesId) &&
- (!pfnUnicodeStrcmp((S8*) sFile, (S8*) gPicEditorInfo[jCount].ImageName)))
- {
- return 1;
- }
- }
- return 0;
- }
- /*****************************************************************************
- * FUNCTION
- * GetPicEditCurrentImageName
- * DESCRIPTION
- * Gets the image name for image selected
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U8 *GetPicEditCurrentImageName(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return gPicEditorInfo[gPicEditCurrPic].ImageName;
- }
- /*****************************************************************************
- * FUNCTION
- * GetPicEditCurrentImageId
- * DESCRIPTION
- * Gets the image id for image selected
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U16 GetPicEditCurrentImageId(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return gPicEditorInfo[gPicEditCurrPic].ImagesId;
- }
- /*****************************************************************************
- * FUNCTION
- * SetPicEditPenMarkBoundary
- * DESCRIPTION
- * Sets the mark boundary
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- extern PicEditMarkBox gPicEditZoomWindow;
- BOOL SetPicEditPenMarkBoundary(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 nWidth, nHeight;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (nInlinePEScr)
- {
- case PE_SCR_1:
- nWidth = PE_SCR_SIZE_1;
- nHeight = PE_SCR_SIZE_1;
- break;
- case PE_SCR_2:
- nWidth = PE_SCR_SIZE_2;
- nHeight = PE_SCR_SIZE_2;
- break;
- case PE_SCR_3:
- nWidth = PE_SCR_SIZE_MAX;
- nHeight = PE_SCR_SIZE_MAX;
- break;
- case PE_SCR_4:
- nWidth = gPEImageWidth;
- nHeight = gPEImageHeight;
- break;
- default:
- nWidth = PE_SCR_SIZE_2;
- nHeight = PE_SCR_SIZE_2;
- break;
- }
- if (((gpPicEditPen->maxX - gpPicEditPen->minX) >= nWidth) && ((gpPicEditPen->maxY - gpPicEditPen->minY) >= nHeight))
- {
- gPicEditZoomWindow.minX = gPicEditMark.minX = gpPicEditPen->penX = gpPicEditPen->minX;
- gPicEditZoomWindow.minY = gPicEditMark.minY = gpPicEditPen->penY = gpPicEditPen->minY;
- gPicEditZoomWindow.maxX = gPicEditMark.maxX = gPicEditMark.minX + nWidth;
- gPicEditZoomWindow.maxY = gPicEditMark.maxY = gPicEditMark.minY + nHeight;
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * GetPicEditScr
- * DESCRIPTION
- * Gets the image size
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U8 GetPicEditScr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((gPEImageWidth == PE_SCR_SIZE_1) && (gPEImageHeight == PE_SCR_SIZE_1))
- {
- return PE_SCR_1;
- }
- else if ((gPEImageWidth == PE_SCR_SIZE_2) && (gPEImageHeight == PE_SCR_SIZE_2))
- {
- return PE_SCR_2;
- }
- else if ((gPEImageWidth == PE_SCR_SIZE_MAX) && (gPEImageHeight == PE_SCR_SIZE_MAX))
- {
- return PE_SCR_3;
- }
- else
- {
- return PE_SCR_4;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * CheckPicEditPenSettingChange
- * DESCRIPTION
- * Checks if pen setting changed
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- BOOL CheckPicEditPenSettingChange(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 penPixel;
- #ifndef __MMI_TOUCH_SCREEN__
- U8 penMove;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (nInlinePenColorIndex != gpPicEditPen->penColorIndex - 1)
- {
- return TRUE;
- }
- switch (nInlinePenSize)
- {
- case 0:
- penPixel = PIC_EDIT_PEN_PIXEL_1;
- break;
- case 1:
- penPixel = PIC_EDIT_PEN_PIXEL_2;
- break;
- case 2:
- penPixel = PIC_EDIT_PEN_PIXEL_3;
- break;
- case 3:
- penPixel = PIC_EDIT_PEN_PIXEL_4;
- break;
- default:
- penPixel = PIC_EDIT_PEN_PIXEL_1;
- break;
- }
- #ifndef __MMI_TOUCH_SCREEN__ /* PMT MANISH 20050616 */
- switch (nInlinePenMoveFactor)
- {
- case 0:
- penMove = PIC_EDIT_PEN_MOVE_1;
- break;
- case 1:
- penMove = PIC_EDIT_PEN_MOVE_2;
- break;
- case 2:
- penMove = PIC_EDIT_PEN_MOVE_3;
- break;
- case 3:
- penMove = PIC_EDIT_PEN_MOVE_4;
- break;
- default:
- penMove = PIC_EDIT_PEN_MOVE_1;
- break;
- }
- #endif /* __MMI_TOUCH_SCREEN__ */
- if (gpPicEditPen->penPixel != penPixel)
- {
- return TRUE;
- }
- #ifndef __MMI_TOUCH_SCREEN__
- if (gpPicEditPen->penMove != penMove)
- {
- return TRUE;
- }
- #endif /* __MMI_TOUCH_SCREEN__ */
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * ReadPicEditListFromNVRAM
- * DESCRIPTION
- * Reads image names present from NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ReadPicEditListFromNVRAM(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error = 0;
- int nCount;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION(("Reading Picture List from NVRAM"));
- gPEImageCount = 0;
- if (ReadRecord(NVRAM_PICTURE_EDITOR_LID, (U16) (1), (void*)&gPicEditorInfo, NVRAM_PICTURE_EDITOR_SIZE, &error) < 0)
- {
- PRINT_INFORMATION(("PICTURE EDITOR : ReadRecord failed (ecode %d)", (int)error));
- memset(&gPicEditorInfo, ' ', NVRAM_PICTURE_EDITOR_SIZE);
- WriteRecord(NVRAM_PICTURE_EDITOR_LID, (U16) (1), (void*)&gPicEditorInfo, NVRAM_PICTURE_EDITOR_SIZE, &error);
- }
- for (nCount = 0; nCount < MAXIMUM_PICTURE_EDITOR_IMAGES; nCount++)
- if (gPicEditorInfo[nCount].ImagesId)
- {
- gPEImageCount++;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * WritePicEditListToNVRAM
- * DESCRIPTION
- * Writes the image names in NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void WritePicEditListToNVRAM(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION(("Picture Name List To Write Record NVRAM"));
- if (WriteRecord(
- NVRAM_PICTURE_EDITOR_LID,
- (U16) (1),
- (void*)&gPicEditorInfo,
- NVRAM_PICTURE_EDITOR_SIZE,
- &error) != NVRAM_PICTURE_EDITOR_SIZE)
- {
- PRINT_INFORMATION(("PICTURE EDITOR : WriteRecord failed (ecode %d)", (int)error));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * AddPictureEditorImage
- * DESCRIPTION
- * Add image to the image editor pictures
- * PARAMETERS
- * fileName [IN]
- * RETURNS
- * void
- *****************************************************************************/
- S8 AddPictureEditorImage(S8 *fileName)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 searchId, jCount, nIndex = 0;
- BOOL bFound = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((gPEImageCount) == MAXIMUM_PICTURE_EDITOR_IMAGES)
- {
- return 0;
- }
- for (jCount = 0; jCount < MAXIMUM_PICTURE_EDITOR_IMAGES; jCount++)
- {
- if (!
- ((gPicEditorInfo[jCount].ImagesId >= (U16) PICTURE_EDITOR_IMAGE_BASE) &&
- (gPicEditorInfo[jCount].ImagesId <= PICTURE_EDITOR_IMAGE_BASE_END)))
- {
- nIndex = jCount;
- break;
- }
- }
- if (!nIndex)
- {
- return 0;
- }
- for (searchId = (U16) PICTURE_EDITOR_IMAGE_BASE; searchId <= PICTURE_EDITOR_IMAGE_BASE_END; searchId++)
- {
- bFound = FALSE;
- for (jCount = 0; jCount < MAXIMUM_PICTURE_EDITOR_IMAGES; jCount++)
- {
- if (gPicEditorInfo[jCount].ImagesId == searchId)
- {
- bFound = TRUE;
- break;
- }
- }
- if (bFound == FALSE)
- {
- break;
- }
- }
- gPicEditorInfo[nIndex].ImagesId = searchId;
- memset((S8*) gPicEditorInfo[nIndex].ImageName, ' ', sizeof(U8) * MAX_IMAGE_NAME_WIDTH);
- pfnUnicodeStrcpy((S8*) gPicEditorInfo[nIndex].ImageName, fileName);
- gPEImageCount++;
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * AddPictureEditorImageAtIndex
- * DESCRIPTION
- * Add image to the image editor pictures
- * PARAMETERS
- * fileName [IN]
- * nIndex [IN]
- * RETURNS
- * void
- *****************************************************************************/
- S8 AddPictureEditorImageAtIndex(S8 *fileName, U8 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 searchId, jCount;
- BOOL bFound = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!
- ((gPicEditorInfo[nIndex].ImagesId >= (U16) PICTURE_EDITOR_IMAGE_BASE) &&
- (gPicEditorInfo[nIndex].ImagesId <= PICTURE_EDITOR_IMAGE_BASE_END)))
- {
- if ((gPEImageCount) == MAXIMUM_PICTURE_EDITOR_IMAGES)
- {
- return 0;
- }
- for (searchId = (U16) PICTURE_EDITOR_IMAGE_BASE; searchId <= PICTURE_EDITOR_IMAGE_BASE_END; searchId++)
- {
- bFound = FALSE;
- for (jCount = 0; jCount < MAXIMUM_PICTURE_EDITOR_IMAGES; jCount++)
- {
- if (gPicEditorInfo[jCount].ImagesId == searchId)
- {
- bFound = TRUE;
- break;
- }
- }
- if (bFound == FALSE)
- {
- break;
- }
- }
- gPicEditorInfo[nIndex].ImagesId = searchId;
- gPEImageCount++;
- }
- memset((S8*) gPicEditorInfo[nIndex].ImageName, ' ', sizeof(U8) * MAX_IMAGE_NAME_WIDTH);
- pfnUnicodeStrcpy((S8*) gPicEditorInfo[nIndex].ImageName, fileName);
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * DeletePictureEditorImage
- * DESCRIPTION
- * Deletes Image from image editor images
- *
- * Returns FALSE if fail else TRUE
- * PARAMETERS
- * ImageId [IN]
- * RETURNS
- * S8
- *****************************************************************************/
- S8 DeletePictureEditorImage(U16 ImageId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* U8 iCount,jCount; */
- U8 iCount;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* for(iCount=0;iCount<gPEImageCount;iCount++) */
- for (iCount = 0; iCount < MAXIMUM_PICTURE_EDITOR_IMAGES; iCount++)
- {
- if (gPicEditorInfo[iCount].ImagesId == ImageId)
- {
- break;
- }
- }
- /* if(iCount==gPEImageCount) return 0; */
- if (iCount == MAXIMUM_PICTURE_EDITOR_IMAGES)
- {
- return 0;
- }
- // for(jCount=iCount;jCount<gPEImageCount-1;jCount++)
- // memcpy(&gPicEditorInfo[jCount],&gPicEditorInfo[jCount+1],sizeof(DYNIMAGEINFO));
- // gPEImageCount--;
- // memset(&gPicEditorInfo[gPEImageCount],0,sizeof(DYNIMAGEINFO));
- memset(&gPicEditorInfo[iCount], 0, sizeof(DYNIMAGEINFO));
- gPEImageCount--;
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * GetPictureEditorImageInfo
- * DESCRIPTION
- * Gets Image editor Info (Common function)
- *
- * Return image count
- * PARAMETERS
- * pictureEditorInfo [IN]
- * RETURNS
- * U8
- *****************************************************************************/
- U8 GetPictureEditorImageInfo(DYNIMAGEINFO **pictureEditorInfo)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *pictureEditorInfo = gPicEditorInfo;
- return gPEImageCount;
- }
- /*****************************************************************************
- * FUNCTION
- * GetPictureEditorImageNameInFileSystem
- * DESCRIPTION
- * Gets image name of the image by image id input
- *
- * Returns NULL if not found else pointer to the image name
- * PARAMETERS
- * ImageId [IN]
- * RETURNS
- * S8*
- *****************************************************************************/
- S8 *GetPictureEditorImageNameInFileSystem(U16 ImageId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int nCount = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ImageId >= PICTURE_EDITOR_IMAGE_BASE && ImageId <= PICTURE_EDITOR_IMAGE_BASE_END)
- {
- /* for(nCount=0;nCount<gPEImageCount;nCount++) */
- for (nCount = 0; nCount < MAXIMUM_PICTURE_EDITOR_IMAGES; nCount++)
- {
- if (gPicEditorInfo[nCount].ImagesId == ImageId)
- {
- return (S8*) gPicEditorInfo[nCount].ImageName;
- }
- }
- }
- return NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * GetPictureEditorImageNameWithPathInFileSystem
- * DESCRIPTION
- * Get image name with full path by image id input
- *
- * returns poiinter to the image name with full path if found else NULL
- * PARAMETERS
- * ImageId [IN]
- * RETURNS
- * S8*
- *****************************************************************************/
- S8 *GetPictureEditorImageNameWithPathInFileSystem(U16 ImageId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *fileName = NULL;
- static S8 imageData[MAX_IMAGE_NAME_PATH_WIDTH + MAX_IMAGE_NAME_WIDTH];
- #ifdef MMI_ON_HARDWARE_P
- S8 imagePath[100];
- #endif
- int nCount = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ImageId >= PICTURE_EDITOR_IMAGE_BASE && ImageId <= PICTURE_EDITOR_IMAGE_BASE_END)
- {
- /* for(nCount=0;nCount<gPEImageCount;nCount++) */
- for (nCount = 0; nCount < MAXIMUM_PICTURE_EDITOR_IMAGES; nCount++)
- {
- if (gPicEditorInfo[nCount].ImagesId == ImageId)
- {
- fileName = (U8*) gPicEditorInfo[nCount].ImageName;
- break;
- }
- }
- /* if(nCount==gPEImageCount) return NULL; */
- if (nCount == MAXIMUM_PICTURE_EDITOR_IMAGES)
- {
- return NULL;
- }
- #ifdef MMI_ON_HARDWARE_P
- memset(imagePath, 0, sizeof(imagePath));
- sprintf(imagePath, "%c:\", MMI_PUBLIC_DRV);
- AnsiiToUnicodeString(imageData, imagePath);
- pfnUnicodeStrcat((S8*) imageData, (S8*) FMGR_DEFAULT_FOLDER_IMAGES);
- #else /* MMI_ON_HARDWARE_P */
- #ifdef __ASCII
- pfnUnicodeStrcpy((PS8) imageData, PICTURE_EDITOR_PATH);
- #else
- AnsiiToUnicodeString((PS8) imageData, PICTURE_EDITOR_PATH);
- #endif
- #endif /* MMI_ON_HARDWARE_P */
- pfnUnicodeStrcat((PS8) imageData, (PS8) fileName);
- return imageData;
- }
- return NULL;
- }
- #endif /* __MMI_PICTURE_EDITOR_SUPPORT__ */