Exemplo n.º 1
0
void BrewApp::DrawScreen() {

    AECHAR szBuf[64] = {0};
    int nStrLen = 0;
    RGBVAL oldTextColor;

    IDISPLAY_ClearScreen(this->m_pIDisplay); // Erase whole screen.

    // Load the string resource into a buffer:
    nStrLen = ISHELL_LoadResString(this->m_pIShell, 
                                   BREWAPP_RES_FILE,
                                   IDS_STRING_1001, szBuf, sizeof(szBuf));

    // If the text was successfully loaded from resource file into buffer:
    if (0 <  nStrLen) {
        // Set user-text color to black:
        oldTextColor = IDisplay_SetColor(this->m_pIDisplay, 
                                         CLR_USER_TEXT, 
                                         RGB_BLACK);

        IDisplay_DrawText(this->m_pIDisplay, // Display instance.
                        AEE_FONT_BOLD, // Use Bold font.
                        szBuf,         // String buffer containing text.
                        -1,     // Automatically compute string length.
                        0,      // x-coordinate ignored since IDF_ALIGN_CENTER.
                        0,      // y-coordinate ignored since IDF_ALIGN_MIDDLE.
                        NULL,   // No clipping.
                        IDF_ALIGN_CENTER | // Center-align horizontally.
                        IDF_ALIGN_MIDDLE); // Middle-align vertically.
    }

    // Restore previous color:
    IDisplay_SetColor(this->m_pIDisplay, CLR_USER_TEXT, oldTextColor);
    IDisplay_Update (this->m_pIDisplay);
}
Exemplo n.º 2
0
/*=============================================================================
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);
}