void GUIDEMO_ShowIntro(const char * s, const char * sExp) {
  GUI_CONTEXT ContextOld;
  GUI_SaveContext(&ContextOld);
  _sInfo = s;
  _sExplain = sExp;
  GUI_SetDefault();
  GUIDEMO_HideInfoWin();
  GUI_SetBkColor(GUI_BLUE);
  GUI_SetColor(GUI_WHITE);
  GUI_Clear();
  //GUI_SetFont(&GUI_FontComic18B_ASCII);
  GUI_SetFont(&GUI_FontHZ12);
  GUI_DispStringHCenterAt(s, LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() / 3 - 10);
  if (_sExplain) {
    GUI_SetFont(&GUI_Font8_ASCII);
    GUI_DispStringHCenterAt(_sExplain, LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() / 2 - 10);
  }
  GUIDEMO_Delay(_sExplain ? 2000 : 4000);
#if GUI_WINSUPPORT
  _UpdateInfoWin();
  _UpdateCmdWin();
#endif
  GUI_RestoreContext(&ContextOld);
  #if GUI_WINSUPPORT
    WM_ExecIdle();
  #endif
  GUIDEMO_NotifyStartNext();
  GUI_SetBkColor(GUI_RED);
  GUI_Clear();
}
Example #2
0
void GUIDEMO_Intro(void) {
  int xCenter = LCD_GET_XSIZE() / 2;
  int y;
  char acText[50] = "Version of uC/GUI: ";
  strcat(acText, GUI_GetVersionString());
  GUI_SetBkColor(GUI_BLUE);
  GUI_SetColor(GUI_YELLOW);
  GUI_Clear();
  GUI_SetFont(&GUI_Font13B_1);
  GUI_DispStringHCenterAt("uC/GUI", xCenter, y= 10);
  GUI_SetFont(&GUI_Font10_ASCII);
  GUI_SetColor(GUI_WHITE);
  GUI_DispStringHCenterAt("Universal graphic software"
                          "\nfor embedded applications"
                          , xCenter, y += 20);
  GUI_SetFont(&GUI_Font10S_ASCII);
  GUI_DispStringHCenterAt("Compiled " __DATE__ " "__TIME__, xCenter, y += 25);
  GUI_DispStringHCenterAt(acText, xCenter, y += 16);
  GUIDEMO_Delay(5000);

  GUI_Clear();
  GUI_DrawBitmap(&bmMicriumLogo, (LCD_GET_XSIZE() - bmMicriumLogo.XSize) / 2, 6);
  GUI_SetFont(&GUI_Font13B_1);
  GUI_DispStringHCenterAt("www.micrium.com", LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() - 50);
  GUIDEMO_Delay(5000);


}
Example #3
0
/*
  *******************************************************************
  *
  *              main()
  *
  *******************************************************************
*/
void MainTask_test(void) {
  int Cnt =0;
  int i,YPos;
  int LCDXSize = LCD_GET_XSIZE();
  int LCDYSize = LCD_GET_YSIZE();
  const GUI_BITMAP *pBitmap;
  GUI_Init();
  GUI_SetBkColor(GUI_RED); GUI_Clear();
  GUI_Delay(1000);
  GUI_SetBkColor(GUI_BLUE); GUI_Clear();
  GUI_Delay(1000);
  GUI_SetColor(GUI_WHITE);
  for (i=0; i<1000; i+=10) {
    GUI_DrawHLine(i,0,100);
    GUI_DispStringAt("Line ",0,i);
    GUI_DispDecMin(i);
  }
  GUI_Delay(1000);
  GUI_SetColor(0x0);
  GUI_SetBkColor(0xffffff);
  for (i=0; i<160; i++) {
    int len = (i<80) ? i : 160-i;
    GUI_DrawHLine(i,20,len+20);
  }
  GUI_Delay(1000);
  GUI_Clear();
  if (LCD_GET_YSIZE()>(100+bmMicriumLogo_1bpp.YSize)) {
    pBitmap=&bmMicriumLogo;
  } else {
    GUI_SetColor(GUI_BLUE);
    pBitmap=&bmMicriumLogo_1bpp;
  }
  GUI_DrawBitmap(pBitmap,(LCDXSize-pBitmap->XSize)/2,10);
  YPos=20+pBitmap->YSize;
  GUI_SetFont(&GUI_FontComic24B_1);
  GUI_DispStringHCenterAt("www.micrium.com",LCDXSize/2,YPos);
  GUI_Delay(1000);
  GUI_SetColor(GUI_RED);
  GUI_DispStringHCenterAt("© 2004\n", LCDXSize/2,YPos+30);
  GUI_SetFont(&GUI_Font10S_1);
  GUI_DispStringHCenterAt("Micriµm Inc.",LCDXSize/2,YPos+60);;
  GUI_Delay(1000);
}
Example #4
0
void GUI_GetClientRect   (GUI_RECT* pRect) {
  if (!pRect)
    return;
  #if GUI_WINSUPPORT
    WM_GetClientRect(pRect);
  #else
    pRect->x0 = 0;
    pRect->y0 = 0;
    pRect->x1 = LCD_GET_XSIZE();
    pRect->y1 = LCD_GET_YSIZE();
  #endif
}
Example #5
0
void GUIDEMO_Intro(void) {
  int xCenter = LCD_GET_XSIZE() / 2;
  int y;
  char acText[50] = "Version of uC/GUI: ";
  strcat(acText, GUI_GetVersionString());
  GUI_SetBkColor(GUI_BLUE);
  GUI_SetColor(GUI_LIGHTRED);
  GUI_Clear();
  GUI_SetFont(&GUI_Font24B_1);
  GUI_DispStringHCenterAt("uC/GUI", xCenter, y= 15);
  GUI_SetColor(GUI_WHITE);
  GUI_SetFont(&GUI_Font13H_ASCII);
  GUI_DispStringHCenterAt("Universal graphic software"
                          "\nfor embedded applications"
                          , xCenter, y += 30);
  GUI_SetColor(GUI_LIGHTRED);
  GUI_SetFont(&GUI_Font16_ASCII);
  GUI_DispStringHCenterAt("Any CPU - Any LCD - Any Application"
                          , xCenter, y += 40);
  GUI_SetFont(&GUI_Font10S_ASCII);
  GUI_DispStringHCenterAt("Compiled " __DATE__ " "__TIME__, xCenter, y += 25);
  GUI_SetFont(&GUI_Font13HB_1);
  GUI_SetColor(GUI_WHITE);
  GUI_DispStringHCenterAt(acText, xCenter, y += 21);
  GUI_SetFont(&GUI_FontComic18B_1);
  GUI_SetColor(GUI_WHITE);
  GUI_DispStringHCenterAt("www.micrium.com", LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() - 40);
  GUI_DrawBitmap(&bmMicriumLogo, (LCD_GET_XSIZE() - bmMicriumLogo.XSize) / 2, 150);
  GUI_SetFont(&GUI_Font10S_ASCII);
  GUI_DispStringAt("GUI_OS: ", 0,210); GUI_DispDecMin(GUI_OS);
  GUI_DispStringAt("GUI_ALLOC_SIZE: ",0, 220); GUI_DispDecMin(GUI_ALLOC_SIZE);
  GUI_DispStringAt("Compiler: "
  #ifdef _MSC_VER
    "Microsoft"
  #elif defined (NC308)
    "Mitsubishi NC308"
  #elif defined (NC30)
    "Mitsubishi NC30"
  #elif defined (__TID__)
    #if (((__TID__ >>8) &0x7f) == 48)            /* IAR MC80 */
      "IAR M32C"
    #elif (((__TID__ >>8) &0x7f) == 85)          /* IAR V850 */
      "IAR V850"
    #else                                        /* IAR MC16 */
      "IAR M32C"
    #endif
  #else
    "Unknown"
  #endif
    ,0, 230);
  GUIDEMO_Delay(5000);
}
Example #6
0
void GUIDEMO_Speed(void) {
  int t = GUI_GetTime();
  int i = 0;
  int XSize = LCD_GET_XSIZE();
  int YSize = LCD_GET_YSIZE();
  I32 NumPixels=0;
  U16 aColorIndex[8];
  GUIDEMO_ShowIntro("High speed",
                    "Multi layer clipping"
                    "\nHighly optimized drivers"
                    );
  for (i = 0; i< 8; i++) {
    aColorIndex[i] = GUI_Color2Index(_aColor[i]);
  }  
  for (i = 0; (((t + 8000) - (int)GUI_GetTime()) > 0) && !GUIDEMO_CheckCancel(); i++) {
    GUI_RECT r;
    GUI_SetColorIndex(aColorIndex[i&7]);
    /* Calculate random positions */
    r.x0 = rand() % XSize - XSize / 2;
    r.y0 = rand() % YSize - YSize / 2;
    r.x1 = r.x0 + rand() % XSize;
    r.y1 = r.y0 + rand() % YSize;
    GUI_FillRect(r.x0, r.y0, r.x1, r.y1);
    /* Clip rectangle to visible area and add the number of pixels (for speed computation) */
    if (r.x1 >= XSize)
      r.x1 = XSize - 1;
    if (r.y1 >= YSize)
      r.y1 = YSize - 1;
    if (r.x0 < 0 )
      r.x0 = 0;
    if (r.y1 < 0)
      r.y1 = 0;
    NumPixels += (r.x1 - r.x0) * (r.y1 - r.y0);
    /* Allow short breaks so we do not use all available CPU time ... */
  }
  t = (GUI_GetTime() - t) / 100;
  GUI_Clear();
  GUIDEMO_NotifyStartNext();
  #if GUIDEMO_LARGE
    GUI_SetFont(&GUI_FontComic24B_ASCII);
  #else
    GUI_SetFont(&GUI_Font16B_ASCII);
  #endif
  GUI_SetColor(GUI_WHITE);
  GUI_DispStringAt("Pixels/sec: ", 10, (LCD_GetYSize() - GUI_GetFontSizeY()) / 2);
  if (t == 0)
    t++;
  GUI_DispDecMin(10 * (NumPixels / t));
  GUIDEMO_Wait();
}
Example #7
0
int GUI_MEMDEV_CompareWithLCD(GUI_MEMDEV_Handle hMem, int*px, int*py, int *pExp, int*pAct) {
  /* Make sure memory handle is valid */
  if (!hMem) {
    hMem = GUI_Context.hDevData;
  }
  if (!hMem) {
    return 1;
  }
  {
    GUI_MEMDEV* pDevData = (GUI_MEMDEV*) GUI_ALLOC_LOCK(hMem);  /* Convert to pointer */
    int y     = pDevData->y0;
    int x0    = pDevData->x0;
    int XMax  = pDevData->XSize+x0;
    int YMax  = pDevData->YSize+y;
    int Max;
    int MagX = LCD_GetXMag();
    int MagY = LCD_GetYMag();
    /* Calculate limits */
    if (y < 0)
			y=0;
    if (x0 < 0)
			x0=0;
    Max = LCD_GET_YSIZE();
		if (YMax > Max)
			YMax = Max;
    Max = LCD_GET_XSIZE();
		if (XMax > Max)
			XMax = Max;
    for (; y < YMax; y++) {
      int x=x0;
      LCD_PIXELINDEX* pData = GUI_MEMDEV_XY2PTR(x,y);
      for (x=x0; x<XMax; x++) {
        int Exp = *pData++;
        int Act = LCD_L0_GetPixelIndex(x * MagX, y * MagY);
        if (Act != Exp) {
          *px    = x;
          *py    = y;
          *pAct  = Act;
          *pExp  = Exp;
          return 1;
        }
      }
    }
  }
  GUI_ALLOC_UNLOCK(hMem);
  return 0;
}
Example #8
0
/*********************************************************************
*
*       MESSAGEBOX_Create
*/
WM_HWIN MESSAGEBOX_Create(const char * sMessage, const char * sCaption, int Flags) {
  GUI_WIDGET_CREATE_INFO _aDialogCreate[3];                                     /* 0: FrameWin, 1: Text, 2: Button */
  int BorderSize = FRAMEWIN_GetDefaultBorderSize();                             /* Default border size of frame window */
  int xSizeFrame = MESSAGEBOX_XSIZEOK + 2 * BorderSize + MESSAGEBOX_BORDER * 2; /* XSize of frame window */
  int ySizeFrame;                                                               /* YSize of frame window */
  int x0, y0;                                                                   /* Position of frame window */
  int xSizeMessage;                                                             /* Length in pixels of message */
  int xSizeCaption;                                                             /* Length in pixels of caption */
  int ySizeCaption;                                                             /* YSize of caption */
  int ySizeMessage;                                                             /* YSize of message */
  WM_HWIN hBox;
  GUI_RECT Rect;
  const GUI_FONT GUI_UNI_PTR * pOldFont;
  /* Zeroinit variables */
  memset(_aDialogCreate, 0, sizeof(_aDialogCreate));
  /* Get dimension of message */
  pOldFont = GUI_SetFont(TEXT_GetDefaultFont());
  GUI_GetTextExtend(&Rect, sMessage, 255);
  xSizeMessage = Rect.x1 - Rect.x0 + MESSAGEBOX_BORDER * 2;
  ySizeMessage = Rect.y1 - Rect.y0 + 1;
  if (xSizeFrame < (xSizeMessage + 4 + MESSAGEBOX_BORDER * 2)) {
    xSizeFrame = xSizeMessage + 4 + MESSAGEBOX_BORDER * 2;
  }
  ySizeCaption = GUI_GetYSizeOfFont(FRAMEWIN_GetDefaultFont());
  ySizeFrame = ySizeMessage +            /* size of message */
               MESSAGEBOX_YSIZEOK +      /* size of button */
               ySizeCaption +            /* caption size */
               MESSAGEBOX_BORDER * 3 +   /* inner border - text, text - button, button - bottom */
               BorderSize * 2 +          /* top & bottom border */
               1;                        /* inner border */
  /* Get xsize of caption */
  xSizeCaption = GUI_GetStringDistX(sCaption);
  if (xSizeFrame < xSizeCaption + BorderSize * 2) {
    xSizeFrame = xSizeCaption + BorderSize * 2;
  }
  /* Check maximum */
  if (xSizeFrame > LCD_GET_XSIZE()) {
    xSizeFrame = LCD_GET_XSIZE();
  }
  if (ySizeFrame > LCD_GET_YSIZE()) {
    ySizeFrame = LCD_GET_YSIZE();
  }
  /* Calculate position of framewin */
  x0 = GUI_OrgX + (LCD_GET_XSIZE() - xSizeFrame) / 2;
  y0 = GUI_OrgY + (LCD_GET_YSIZE() - ySizeFrame) / 2;
  /* restore modified Context */
  GUI_SetFont(pOldFont);
  /* Fill frame win resource */
  _aDialogCreate[0].pfCreateIndirect = FRAMEWIN_CreateIndirect;
  _aDialogCreate[0].pName            = sCaption;
  _aDialogCreate[0].x0               = x0;
  _aDialogCreate[0].y0               = y0;
  _aDialogCreate[0].xSize            = xSizeFrame;
  _aDialogCreate[0].ySize            = ySizeFrame;
  if (Flags & GUI_MESSAGEBOX_CF_MOVEABLE) {
    _aDialogCreate[0].Flags          = FRAMEWIN_CF_MOVEABLE;
  }
  /* Fill text resource */
  _aDialogCreate[1].pfCreateIndirect = TEXT_CreateIndirect;
  _aDialogCreate[1].pName            = sMessage;
  _aDialogCreate[1].x0               = (xSizeFrame - xSizeMessage - BorderSize * 2) / 2;
  _aDialogCreate[1].y0               = MESSAGEBOX_BORDER;
  _aDialogCreate[1].xSize            = xSizeMessage;
  _aDialogCreate[1].ySize            = ySizeMessage;
  _aDialogCreate[1].Para             = GUI_TA_TOP | GUI_TA_HCENTER;
  /* Fill button resource */
  _aDialogCreate[2].pfCreateIndirect = BUTTON_CreateIndirect;
  _aDialogCreate[2].pName            = "OK";
  _aDialogCreate[2].Id               = GUI_ID_OK;
  _aDialogCreate[2].x0               = (xSizeFrame - MESSAGEBOX_XSIZEOK - BorderSize * 2) / 2;
  _aDialogCreate[2].y0               = MESSAGEBOX_BORDER * 2 + ySizeMessage;
  _aDialogCreate[2].xSize            = MESSAGEBOX_XSIZEOK;
  _aDialogCreate[2].ySize            = MESSAGEBOX_YSIZEOK;
  /* Create dialog */
  hBox = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), MESSAGEBOX_Callback, 0, 0, 0);
  if (Flags & GUI_MESSAGEBOX_CF_MODAL) {
    WM_MakeModal(hBox);
  }
  return hBox;
}
Example #9
0
/*********************************************************************
*
*       GUI_MEMDEV_CompareWithLCD
*/
int GUI_MEMDEV_CompareWithLCD(GUI_MEMDEV_Handle hMem, int*px, int*py, int *pExp, int*pAct) {
  int Ret = 0;
  /* Make sure memory handle is valid */
  if (!hMem) {
    hMem = GUI_Context.hDevData;
  }
  if (!hMem) {
    return 1;
  }
  GUI_LOCK();
  {
    GUI_MEMDEV * pDevData = (GUI_MEMDEV*) GUI_ALLOC_h2p(hMem);  /* Convert to pointer */
    int y    = pDevData->y0;
    int x0   = pDevData->x0;
    int XMax = pDevData->XSize + x0;
    int YMax = pDevData->YSize + y;
    int Max;
    int MagX = LCD_GetXMag();
    int MagY = LCD_GetYMag();
    /* Calculate limits */
    if (y < 0) {
			y = 0;
    }
    if (x0 < 0) {
			x0 = 0;
    }
    Max = LCD_GET_YSIZE();
		if (YMax > Max) {
			YMax = Max;
    }
    Max = LCD_GET_XSIZE();
		if (XMax > Max) {
			XMax = Max;
    }
    for (; y < YMax; y++) {
      int x = x0;
      U8 * pData = (U8 *)GUI_MEMDEV__XY2PTR(x, y);
      for (x = x0; x < XMax; x++) {
        int Exp = *pData++;
        int Act = LCD_L0_GetPixelIndex(x * MagX, y * MagY);
        #if (GUI_NUM_LAYERS > 1)
        if (LCD_GetBitsPerPixelEx(GUI_Context.SelLayer) > 8)
        #else
        if (LCD_GetBitsPerPixel() > 8)
        #endif
        {
          Exp |= (*pData++) << 8;
        }
        if (Act != Exp) {
          *px    = x;
          *py    = y;
          *pAct  = Act;
          *pExp  = Exp;
          Ret = 1;
          goto Skip;
        }
      }
    }
  }
Skip:
  GUI_UNLOCK();
  return Ret;
}