uint32 IMainUI_Show(IMainUI* pUI){ CtlAddItem ai; AEERect rRect; boolean ok; pUI->glbVar->appState = APP_STATE_MAINUI; IDisplay_ClearScreen(pUI->glbVar->pIDisplay); IRESOURCE_LoadResource(pUI->glbVar->pIResouce, IDS_MAINUI_TITLE); IMENUCTL_SetTitle(pUI->pMenu, NULL, 0, pUI->glbVar->pIResouce->idsResource); // Add Items in the Menu IRESOURCE_LoadResource(pUI->glbVar->pIResouce, IDS_MAINUI_LOCATE); // Add Items in the Menu //ai.pText = pUI->glbVar->pIResouce->idsResource; ai.pImage = NULL; ai.pszResImage = ai.pszResText = NULL; ai.wImage = NULL; ai.wText = NULL; ai.dwData = 0; // Add New ai.wFont = AEE_FONT_NORMAL; ai.wItemID = IDS_MAINUI_LOCATE; //位置上报 IRESOURCE_LoadResource(pUI->glbVar->pIResouce, IDS_MAINUI_LOCATE); ai.pText = pUI->glbVar->pIResouce->idsResource; ai.wItemID = IDS_MAINUI_LOCATE; ok = IMENUCTL_AddItemEx(pUI->pMenu, &ai); //拍照上传 IRESOURCE_LoadResource(pUI->glbVar->pIResouce, IDS_MAINUI_PHOTO); ai.pText = pUI->glbVar->pIResouce->idsResource; ai.wItemID = IDS_MAINUI_PHOTO; IMENUCTL_AddItemEx(pUI->pMenu, &ai); SETAEERECT(&rRect, 0, 5, pUI->glbVar->pDevice->cxScreen, pUI->glbVar->pDevice->cyScreen - IDISPLAY_GetFontMetrics( pUI->glbVar->pIDisplay, AEE_FONT_NORMAL, NULL, NULL ) - 10); IMENUCTL_SetRect(pUI->pMenu, &rRect); IMENUCTL_SetActive(pUI->pMenu, FALSE); IMENUCTL_Redraw(pUI->pMenu); IRESOURCE_LoadResource(pUI->glbVar->pIResouce, IDS_MAINUI_SETTINGS); IMENUCTL_AddItem(pUI->pSK, NULL, NULL, IDS_MAINUI_SETTINGS, pUI->glbVar->pIResouce->idsResource, 0); IMENUCTL_Redraw(pUI->pSK); pUI->focusCTL = MAINUI_INIT; return AEE_SUCCESS; }
/*============================================================================= FUNCTION c_SampleCameraApp_PrintStatus DESCRIPTION This is a helper function that will print to the screen the status for the application as well as the command that the soft keys control. PROTOTYPE: static void c_SampleCameraApp_PrintStatus(SampleCameraApp* pMe) PARAMETERS: pMe: Pointer to the applet data stucture DEPENDENCIES none RETURN VALUE none SIDE EFFECTS none =============================================================================*/ static void c_SampleCameraApp_PrintStatus(c_samplecamera* pMe) { int nErr = AEE_EFAILED; char *pszBuf = NULL; char pszBuf2[100]; AECHAR wszBuf[100]; int32 nMode = 0; //clear the screen IDisplay_ClearScreen(pMe->Applet.m_pIDisplay); //If zoom is supported update the screen with Zoom information if (pMe->bSupportZoom) { AEEParmInfo ZoomInfo; int32 nCurrentZoom; // retrieve the current setting and the parameter information nErr = ICAMERA_GetParm(pMe->pICamera, CAM_PARM_ZOOM, &nCurrentZoom, (int32 *)&ZoomInfo); if (nErr) DBGPRINTF("Unable to get CAM_PARM_ZOOM %d", pMe->nPreviewType); // create a string with the current value and the range of possible values SNPRINTF(pszBuf2, sizeof(pszBuf2), "Zoom %d(%d to %d)", nCurrentZoom, ZoomInfo.nMin, ZoomInfo.nMax); STRTOWSTR(pszBuf2, wszBuf, sizeof(wszBuf)); IDisplay_DrawText(pMe->Applet.m_pIDisplay, AEE_FONT_NORMAL, wszBuf, -1, pMe->ZoomStatusTextRect.x, pMe->ZoomStatusTextRect.y, &pMe->ZoomStatusTextRect, IDF_ALIGN_LEFT | IDF_ALIGN_TOP); //print our directions on how to control the zoom STRTOWSTR("Up/Dn to Zoom", wszBuf, sizeof(wszBuf)); IDisplay_DrawText(pMe->Applet.m_pIDisplay, AEE_FONT_NORMAL, wszBuf, -1, pMe->ZoomTextRect.x, pMe->ZoomTextRect.y, &pMe->ZoomTextRect, IDF_ALIGN_CENTER | IDF_ALIGN_TOP); } //Print out the current camera mode to the screen pszBuf = c_SampleCameraApp_GetModeStr(pMe); SNPRINTF(pszBuf2, sizeof(pszBuf2), "Mode: %s", pszBuf); STRTOWSTR(pszBuf2, wszBuf, sizeof(wszBuf)); IDisplay_DrawText(pMe->Applet.m_pIDisplay, AEE_FONT_NORMAL, wszBuf, -1, pMe->Status1TextRect.x, pMe->Status1TextRect.y, &pMe->Status1TextRect, IDF_ALIGN_LEFT | IDF_ALIGN_TOP); // Depending on the preview type display the file name that will store the // output of the camera's snapshot or video if (pMe->nPreviewType == CAM_PREVIEW_MOVIE) SNPRINTF(pszBuf2, sizeof(pszBuf2), "File Name: %s", MOVIE_FILE_NAME); else if (pMe->nPreviewType == CAM_PREVIEW_SNAPSHOT) SNPRINTF(pszBuf2, sizeof(pszBuf2), "File Name: %s", SNAPSHOT_FILE_NAME); STRTOWSTR(pszBuf2, wszBuf, sizeof(wszBuf)); IDisplay_DrawText(pMe->Applet.m_pIDisplay, AEE_FONT_NORMAL, wszBuf, -1, pMe->Status2TextRect.x, pMe->Status2TextRect.y, &pMe->Status2TextRect, IDF_ALIGN_LEFT | IDF_ALIGN_TOP); //Get the current mode of the camera, and update the screen to specify what // commands the first soft key controls ICAMERA_GetMode(pMe->pICamera, &nMode, NULL); if (nMode == CAM_MODE_READY) { if (pMe->nPreviewType == CAM_PREVIEW_MOVIE) pszBuf = "Switch to Snapshot"; else pszBuf = "Switch to Movie"; } else pszBuf = "Stop"; STRTOWSTR(pszBuf, wszBuf, sizeof(wszBuf)); IDisplay_DrawText(pMe->Applet.m_pIDisplay, AEE_FONT_NORMAL, wszBuf, -1, pMe->SoftKey1TextRect.x, pMe->SoftKey1TextRect.y, &pMe->SoftKey1TextRect, IDF_ALIGN_LEFT | IDF_ALIGN_BOTTOM); //Update the screen to specify what commands the second soft key controls switch (nMode) { case CAM_MODE_READY: pszBuf = "Preview"; break; case CAM_MODE_PREVIEW: { if (pMe->nPreviewType == CAM_PREVIEW_MOVIE) pszBuf = "RecordMovie"; else pszBuf = "RecordSnapshot"; break; } case CAM_MODE_MOVIE: pszBuf = ""; break; case CAM_MODE_SNAPSHOT: pszBuf = ""; break; } STRTOWSTR(pszBuf, wszBuf, sizeof(wszBuf)); IDisplay_DrawText(pMe->Applet.m_pIDisplay, AEE_FONT_NORMAL, wszBuf, -1, pMe->SoftKey2TextRect.x, pMe->SoftKey2TextRect.y, &pMe->SoftKey2TextRect, IDF_ALIGN_RIGHT | IDF_ALIGN_BOTTOM); // Update the screen with all of the changes IDisplay_Update(pMe->Applet.m_pIDisplay); }