예제 #1
0
/**
 * Layout Microchip and Pervasive Displays logo on EPD
 */
void Show_Logo(void)
{
    GFX_GOL_PictureControlCreate(
        ID_Logo,                           
        PDI_Logo_Pos_X,
        PDI_Logo_Pos_Y,
        PDI_logo_1_WIDTH+PDI_Logo_Pos_X,
        PDI_logo_1_HEIGHT+PDI_Logo_Pos_Y,  
        GFX_GOL_PICTURECONTROL_DRAW_STATE |
        GFX_GOL_PICTURECONTROL_FRAME_STATE,
        1,                                 
        (void *)&PDI_logo_1,               
        &homeDemoScheme);

    GFX_GOL_PictureControlCreate(
        ID_Microchip_Logo,                 
        Microchip_Logo_Pos_X,
        Microchip_Logo_Pos_Y,
        Microchip_logo_1_WIDTH + Microchip_Logo_Pos_X,
        Microchip_logo_1_HEIGHT + Microchip_Logo_Pos_Y,  
        GFX_GOL_PICTURECONTROL_DRAW_STATE |                         
        GFX_GOL_PICTURECONTROL_FRAME_STATE,
        1,                                 
        (void *) &Microchip_logo_1,        
        &homeDemoScheme);

    GFX_GOL_StaticTextCreate(
        ID_HOME_TITLE1,
        Home_Title1_Pos_X, 
        Home_Title1_Pos_Y, 
        Home_Title1_Pos_X + GFX_TextStringWidthGet(
                        Home_Title1_Str,
                        scheme.pFont) + 2,
        Home_Title1_Pos_Y + GFX_TextStringHeightGet(scheme.pFont) + 2,
        GFX_GOL_STATICTEXT_DRAW_STATE,
        Home_Title1_Str,
        GFX_ALIGN_CENTER,
        &scheme);                          

    GFX_GOL_StaticTextCreate(
        ID_HOME_TITLE2,
        Home_Title2_Pos_X, 
        Home_Title2_Pos_Y, 
        Home_Title2_Pos_X + GFX_TextStringWidthGet(
                        Home_Title2_Str,
                        scheme.pFont) + 2,
        Home_Title2_Pos_Y + GFX_TextStringHeightGet(scheme.pFont) + 2,
        GFX_GOL_STATICTEXT_DRAW_STATE,
        Home_Title2_Str,
        GFX_ALIGN_CENTER,
        &scheme);                           
}
예제 #2
0
// *****************************************************************************
GFX_GOL_EDITBOX  *GFX_GOL_EditBoxCreate(
                                uint16_t            ID,
                                uint16_t            left,
                                uint16_t            top,
                                uint16_t            right,
                                uint16_t            bottom,
                                uint16_t            state,
                                GFX_XCHAR           *pText,
                                uint16_t            charMax,
                                GFX_ALIGNMENT       alignment,
                                GFX_GOL_OBJ_SCHEME  *pScheme)
{
    GFX_GOL_EDITBOX *pEb = NULL;
    
    // ending zero is not included into charMax
    pEb = (GFX_GOL_EDITBOX*) GFX_malloc(sizeof(GFX_GOL_EDITBOX) + (charMax + 1)*sizeof(GFX_XCHAR));

    if (pEb == NULL)
        return pEb;

    // allocate space for the text buffer
    pEb->pText    = (GFX_XCHAR*)((uint8_t*)pEb + sizeof(GFX_GOL_EDITBOX));
    // initialize to contain nothing
    *pEb->pText             = 0;
    pEb->length             = 0;
    pEb->charMax            = charMax;

    pEb->hdr.ID      	    = ID;
    pEb->hdr.pNxtObj 	    = NULL;
    pEb->hdr.type    	    = GFX_GOL_EDITBOX_TYPE;
    pEb->hdr.left    	    = left;
    pEb->hdr.top     	    = top;
    pEb->hdr.right   	    = right;
    pEb->hdr.bottom  	    = bottom;
    pEb->hdr.state   	    = state;

    pEb->hdr.DrawObj        = GFX_GOL_EditBoxDraw;      // draw function
    pEb->hdr.FreeObj        = NULL;                     // free function
    pEb->hdr.actionGet      = GFX_GOL_EditBoxActionGet; // action get function
    pEb->hdr.actionSet      = GFX_GOL_EditBoxActionSet; // default action function

    // copy the text to the buffer
    if(pText != NULL)
        GFX_GOL_EditBoxTextSet(pEb, pText);

    // set the alignment
    GFX_GOL_EditBoxTextAlignmentSet(pEb, alignment);

    // Set the style scheme to be used
    pEb->hdr.pGolScheme = (GFX_GOL_OBJ_SCHEME *)pScheme;

    pEb->textHeight = GFX_TextStringHeightGet(pEb->hdr.pGolScheme->pFont);

    GFX_GOL_ObjectAdd((GFX_GOL_OBJ_HEADER *)pEb);

    return pEb;
}
예제 #3
0
// *****************************************************************************
void GFX_GOL_CheckBoxTextSet(
                                GFX_GOL_CHECKBOX *pObject,
                                GFX_XCHAR * pText)
{
   if (pText == NULL)
    {
        pObject->pText = NULL;
        pObject->textHeight = 0;
    }
    else
    {
        pObject->pText = pText;
        pObject->textHeight = GFX_TextStringHeightGet(
                                    pObject->hdr.pGolScheme->pFont);
    }
}
예제 #4
0
/*********************************************************************
* Function: GFX_GOL_ROUNDDIAL  *GFX_GOL_RoundDialCreate(uint16_t ID, uint16_t x, uint16_t y, uint16_t radius,
*						uint16_t state, uint16_t res, uint16_t value, uint16_t max,
*						GFX_GOL_SCHEME *pScheme)
*
*
* Notes: Creates a ROUNDDIAL object and adds it to the current active list.
*        If the creation is successful, the pointer to the created Object 
*        is returned. If not successful, NULL is returned.
*
********************************************************************/
GFX_GOL_ROUNDDIAL *GFX_GOL_RoundDialCreate
(
    uint16_t ID, int16_t left, int16_t top, int16_t right, int16_t bottom, uint8_t rad, uint16_t state,
    const ROUNDDIALITEM* pItems, uint16_t nItems, uint16_t startPos, GFX_ALIGNMENT alignment,
    GFX_GOL_OBJ_SCHEME  *pScheme
)
{

    int16_t txtHeight, txtWidth;

    GFX_GOL_ROUNDDIAL *pDia = NULL;

    // sanity check
    if ((pItems == NULL) || (nItems == 0))
        return NULL;

    // allocate memory for the control
    pDia = (GFX_GOL_ROUNDDIAL*) GFX_malloc(sizeof (GFX_GOL_ROUNDDIAL));
    if (pDia == NULL)
        return (pDia);

    pDia->hdr.imageStored = false;
    
    if (startPos >= nItems)
        startPos = nItems - 1;

    pDia->hdr.ID = ID;
    pDia->hdr.pNxtObj = NULL;
    pDia->hdr.type = GFX_GOL_ROUNDDIAL_TYPE;
    pDia->hdr.state = state; // set state

    pDia->hdr.left = left;
    pDia->hdr.top = top;
    pDia->hdr.right = right;
    pDia->hdr.bottom = bottom;

    pDia->hdr.DrawObj = GFX_GOL_RoundDialDraw;		        // draw function
    pDia->hdr.actionGet = GFX_GOL_RoundDailActionGet;		// message function
    pDia->hdr.actionSet = GFX_GOL_RoundDailActionSet;	       // default message function
    pDia->alignment = alignment;

    pDia->radius = rad;

    // record the data items
    pDia->pItems = pItems;
    pDia->nItems = nItems;

    // current position bit shifted to allow rotational steps
    pDia->pos = startPos;
    pDia->posOffset = startPos;

    // Set the style scheme to be used
     pDia->hdr.pGolScheme = (GFX_GOL_OBJ_SCHEME *) pScheme;

    // calculate the range of values either side of the current one that will be visible
    if (pDia->alignment == GFX_ALIGN_VCENTER) {
        txtHeight = GFX_TextStringHeightGet(pDia->hdr.pGolScheme->pFont) + ROUNDDIAL_VALUE_GAP;
        pDia->bandHeight = txtHeight;
        pDia->numericRange = (bottom - top) / txtHeight;

        pDia->center = (top + bottom) >> 1;
    } else {
예제 #5
0
/**
 * Layout buttons on EPD
 */
void Show_Button(void)
{
    uint16_t Button_Width, Button_Height;

    Button_Width  = GFX_TextStringWidthGet(Button4_Str, scheme2.pFont) + 8;
    Button_Height = GFX_TextStringHeightGet(scheme2.pFont) + 2;

    GFX_GOL_ButtonCreate(
        ID_BUTTON1,                                    
        Button1_pos_x,
        Button1_pos_y,
        Button1_pos_x + Button_Width,
        Button1_pos_y + Button_Height,
        3,                                             
        GFX_GOL_BUTTON_DRAW_STATE,
        NULL, NULL,                                    
        Button1_Str,                                   
        GFX_ALIGN_LEFT | GFX_ALIGN_VCENTER,
        &scheme2);

     GFX_GOL_ButtonCreate(
        ID_BUTTON2,                                    
        Button2_pos_x,
        Button2_pos_y,
        Button2_pos_x + Button_Width,
        Button2_pos_y + Button_Height,
        3,                                             
        GFX_GOL_BUTTON_DRAW_STATE,
        NULL, NULL,                                    
        Button2_Str,                                   
        GFX_ALIGN_LEFT | GFX_ALIGN_VCENTER,
        &scheme2);

    GFX_GOL_ButtonCreate(
        ID_BUTTON3,                                    
        Button3_pos_x,
        Button3_pos_y,
        Button3_pos_x + Button_Width,
        Button3_pos_y + Button_Height,
        3,                                             
        GFX_GOL_BUTTON_DRAW_STATE,
        NULL, NULL,                                    
        Button3_Str,                                   
        GFX_ALIGN_LEFT | GFX_ALIGN_VCENTER,
        &scheme2);

    GFX_GOL_ButtonCreate(
        ID_BUTTON4,                                    
        Button4_pos_x,
        Button4_pos_y,
        Button4_pos_x + Button_Width,
        Button4_pos_y + Button_Height,
        3,                                             
        GFX_GOL_BUTTON_DRAW_STATE, 
        NULL, NULL,                                    
        Button4_Str,                                   
        GFX_ALIGN_LEFT | GFX_ALIGN_VCENTER,
        &scheme2);

    GFX_GOL_ButtonCreate(
        ID_BUTTON5,                                    
        Button5_pos_x,
        Button5_pos_y,
        Button5_pos_x + Button_Width,
        Button5_pos_y + Button_Height,
        3,                                             
        GFX_GOL_BUTTON_DRAW_STATE,
        NULL, NULL,                                    
        Button5_Str,                                   
        GFX_ALIGN_LEFT | GFX_ALIGN_VCENTER,
        &scheme2);
}
예제 #6
0
uint16_t CreateOptions(void)
{
  int width = GFX_MaxXGet();
  int height = GFX_TextStringHeightGet(optscheme.pFont);
  uint16_t newstate;


  if (GFX_GOL_GroupboxCreate(ID_CONTYPE_BOX, 0, 0, width, (height * 2) + 10,
    GFX_GOL_GROUPBOX_DRAW_STATE, "Connection type", GFX_ALIGN_VCENTER,
      &optscheme) == NULL)
  {
    return -1;    
  }

  newstate = GFX_GOL_RADIOBUTTON_DRAW_STATE | GFX_GOL_RADIOBUTTON_GROUP_STATE;
  if (CONNECT_TYPE == ISO_9141_SLOW) newstate |= GFX_GOL_RADIOBUTTON_CHECKED_STATE;

  width -= 3;
  if (GFX_GOL_RadioButtonCreate(ID_RADIOBUTTON1, 3, height + 2, (width / 3), (height * 2) + 6,
      newstate, "ISO 9141 SLOW", GFX_ALIGN_CENTER, &optscheme) == NULL)
  {
    return -1;
  };

  newstate = GFX_GOL_RADIOBUTTON_DRAW_STATE;
  if (CONNECT_TYPE == KWP_SLOW) newstate |= GFX_GOL_RADIOBUTTON_CHECKED_STATE;

  if (GFX_GOL_RadioButtonCreate(ID_RADIOBUTTON2, (width / 3), height + 2, (width / 3) * 2, (height * 2) + 6,
      newstate, "KWP SLOW", GFX_ALIGN_CENTER, &optscheme) == NULL)
  {
    return -1;
  };

  newstate = GFX_GOL_RADIOBUTTON_DRAW_STATE;
  if (CONNECT_TYPE == KWP_FAST) newstate |= GFX_GOL_RADIOBUTTON_CHECKED_STATE;

  if (GFX_GOL_RadioButtonCreate(ID_RADIOBUTTON3, (width / 3) * 2, height + 2, width, (height * 2) + 6,
      newstate, "KWP FAST", GFX_ALIGN_CENTER, &optscheme) == NULL)
  {
    return -1;
  };

  newstate = GFX_GOL_CHECKBOX_DRAW_STATE;
  if (TRYING_CONN) newstate |= GFX_GOL_CHECKBOX_CHECKED_STATE;

  if (GFX_GOL_CheckBoxCreate(ID_AUTO_CHECKBOX, 3, (height * 3) + 12, (width / 2), (height * 4) + 20,
      newstate, "AUTO CONNECT", GFX_ALIGN_CENTER, &optscheme) == NULL)
  {
    return -1;
  };

  if (GFX_GOL_CheckBoxCreate (ID_TESTKLINE_BUT, 3, (height * 5) + 12, (width / 2), (height * 6) + 20,
    GFX_GOL_CHECKBOX_DRAW_STATE, "TEST K LINE", GFX_ALIGN_HCENTER | GFX_ALIGN_VCENTER, &optscheme) == NULL)
  {
    return -1;
  }

  pKLINE_INPUT_TERMINAL = (GFX_GOL_StaticTextCreate ( ID_TESTKLINE_INPUT,
    (width / 2) + 3, (height * 5) + 12, width, (height * 6) + 20, GFX_GOL_STATICTEXT_DRAW_STATE,
    GetHighLowString(true), GFX_ALIGN_LEFT | GFX_ALIGN_TOP, &optscheme));
    if (pKLINE_INPUT_TERMINAL == NULL)
    {
      return -1;
    }else                  // use given scheme
    {
//      pKLINE_INPUT_TERMINAL->hdr.actionGet = TerminalActionGet;
    }

    if (GFX_GOL_CheckBoxCreate (ID_TESTKLINE_INPUT, 3, (height * 5) + 12, (width / 2), (height * 6) + 20,
    GFX_GOL_CHECKBOX_DRAW_STATE, "TEST K LINE", GFX_ALIGN_HCENTER | GFX_ALIGN_VCENTER, &optscheme) == NULL)
  {
    return -1;
  }

/*  newstate = GFX_GOL_CHECKBOX_DRAW_STATE;
  if (TRYING_CONN) newstate |= GFX_GOL_RADIOBUTTON_CHECKED_STATE;

  if (GFX_GOL_CheckBoxCreate(ID_MANUAL_RADIO, (width / 2), (height * 3) + 12, (width / 2) * 2, (height * 4) + 20,
      newstate, "MANU", GFX_ALIGN_CENTER, &optscheme) == NULL)
  {
    return -1;
  };*/

  return 0;
}