Exemplo n.º 1
0
// ------------------------------------------------------
// Return the left position of a string in a gadget
void Gadgets::__Get_String_Left(LPGADGET gadget,
                                char *string, LPCOORDINATE pos)
{
    pos->x = 3;
    pos->y = (((gadget->height - 1) - Get_Font_Height()) / 2);
    if(pos->y < 1) pos->y = 1;
}
Exemplo n.º 2
0
// ------------------------------------------------------
// Return the right justified position of a string in a gadget
void Gadgets::__Get_String_Right(LPGADGET gadget,
                                 char *string, LPCOORDINATE pos)
{
    pos->x = (((gadget->width - 1) - Get_Size_Text(string))) - 3;
    if(pos->x < 1) pos->x = 1;
    pos->y = (((gadget->height - 1) - Get_Font_Height()) / 2);
    if(pos->y < 1) pos->y = 1;
}
Exemplo n.º 3
0
// ------------------------------------------------------
// Return the left position of a string in a gadget
void Gadgets::__Get_String_Center(LPGADGET gadget,
                                  char *string, LPCOORDINATE pos)
{
    pos->x = (((gadget->width - 1) - Get_Size_Text(string)) / 2) - 1;
    if(pos->x < -1) pos->x = -1;
    pos->y = (((gadget->height - 1) - Get_Font_Height()) / 2);
    if(pos->y < 0) pos->y = 0;
}
Exemplo n.º 4
0
//更新温度数据
void Update_Temp_Data(S_Show_Data *pDst, INT8U Area_No)
{
    S_Point P0;
    INT16U Width,Height;
    INT16U Min_Width;//, Min_Height;
    INT16S Temp;

    Width = Get_Area_Width(Area_No);
    Height = Get_Area_Height(Area_No);

    Min_Width = Get_Temp_Min_Width(Area_No);
    //Min_Height = Get_Temp_Min_Height(Area_No);
 
    if(Width > Min_Width)
      P0.X = (Width - Min_Width) / 2;
    else
      P0.X = 0;
/*
    if(Height > Prog_Status.File_Para[Area_No].Temp_Para.Text_Height)
      P0.Y = (Height - Prog_Status.File_Para[Area_No].Temp_Para.Text_Height)/2;
    else
      P0.Y = 0;//(Height - Prog_Status.File_Para[Area_No].Temp_Para.Text_Height)/2;
    Copy_Filled_Rect(&Show_Data_Bak, Area_No, &P0, Prog_Status.File_Para[Area_No].Temp_Para.Text_Width, Prog_Status.File_Para[Area_No].Temp_Para.Text_Height, &Show_Data, &P0);//&Point);
*/

    P0.X = P0.X + Prog_Status.File_Para[Area_No].Temp_Para.Text_Width;
    if(Prog_Status.File_Para[Area_No].Temp_Para.Text_Width)
      P0.X += SPACE_WIDTH;//Get_Font_Width(Prog_Status.File_Para[Area_No].Temp_Para.);

    if(Height > Get_Font_Height(Prog_Status.File_Para[Area_No].Temp_Para.Temp_Font))
      P0.Y = (Height - Get_Font_Height(Prog_Status.File_Para[Area_No].Temp_Para.Temp_Font))/2;
    else
      P0.Y = 0;

    Temp = Get_Cur_Temp(); //--获取当前温度
    Show_Temp(pDst, Area_No, P0.X, P0.Y, Temp, \
               Prog_Status.File_Para[Area_No].Temp_Para.Temp_Type, Prog_Status.File_Para[Area_No].Temp_Para.Temp_Font,Prog_Status.File_Para[Area_No].Temp_Para.Temp_Color);

      
    //Prog_Status.Area_Status[Area_No].Step = 100; //一步显示到位,直接100%
}
Exemplo n.º 5
0
//显示定时信息的最小高度
INT16U Get_Temp_Min_Height(INT8U Area_No)
{
    INT16U StrHeight;
    //INT16U Height;

    StrHeight = Get_Font_Height(Prog_Status.File_Para[Area_No].Temp_Para.Temp_Font);

    if(Prog_Status.File_Para[Area_No].Temp_Para.Text_Height > StrHeight)
        return Prog_Status.File_Para[Area_No].Temp_Para.Text_Height;
    else
        return StrHeight;
}
Exemplo n.º 6
0
//資函扮寂�幣議恷弌互業,俶勣乎互業嘉嬬�幣忿��幣頼侭嗤議扮寂方象
//Area_No葎蛍曝催
INT16U Get_Time_Min_Height(INT8U Area_No)
{
    INT16U Height,Height0;

    if(Prog_Status.File_Para[Area_No].Time_Para.SmLineFlag == SLINE_MODE)//汽佩
    {
        Height = Prog_Status.File_Para[Area_No].Time_Para.Text_Height;

        if(Prog_Status.File_Para[Area_No].Time_Para.Date_Type > 0)
        {
            Height0 = Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Date_Font);
            Height = MAX_2(Height, Height0);
        }

        if(Prog_Status.File_Para[Area_No].Time_Para.Week_Type > 0)
        {
            Height0 = Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Week_Font);
            Height = MAX_2(Height, Height0);
        }

        if(Prog_Status.File_Para[Area_No].Time_Para.Time_Type > 0)
        {
            Height0 = Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Time_Font);
            Height = MAX_2(Height, Height0);
        }
    }
    else
    {
        Height = Prog_Status.File_Para[Area_No].Time_Para.Text_Height;

        if(Prog_Status.File_Para[Area_No].Time_Para.Date_Type > 0)
        {
            if(Height > 0)
              Height += Prog_Status.File_Para[Area_No].Time_Para.LineSpace;
            Height += Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Date_Font);
        }
        
        if(Prog_Status.File_Para[Area_No].Time_Para.Week_Type > 0)
        {
           if(Height > 0)
             Height += Prog_Status.File_Para[Area_No].Time_Para.LineSpace;
           Height += Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Week_Font);
        }
        if(Prog_Status.File_Para[Area_No].Time_Para.Time_Type > 0)
        {
           if(Height > 0)
             Height += Prog_Status.File_Para[Area_No].Time_Para.LineSpace; 
           Height += Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Time_Font);
   
        }
    }

    return Height;
}
Exemplo n.º 7
0
//厚仟扮寂方象
void Update_Time_Data(S_Show_Data *pDst, INT8U Area_No)
{
  INT16U X, Y;
  S_Point P0;
  INT16U Width,Height;
  INT16U Min_Width, Min_Height;
  time_t CurSec;
  S_Time sTime;
  struct tm tTime, *ptm;
  
  Width = Get_Area_Width(Area_No);
  Height = Get_Area_Height(Area_No);

  Min_Width = Get_Time_Min_Width(Area_No);
  Min_Height = Get_Time_Min_Height(Area_No);

  //頁倦俶勣距屁扮餓
  if(Prog_Status.File_Para[Area_No].Time_Para.Hour_Diff != 0 ||\
     Prog_Status.File_Para[Area_No].Time_Para.Min_Diff != 0)
  {
    S_Time_2_tm(&Cur_Time, &tTime);
    CurSec = mktime(&tTime);
    
    if(Prog_Status.File_Para[Area_No].Time_Para.Diff_Flag EQ 0)
      CurSec += Prog_Status.File_Para[Area_No].Time_Para.Hour_Diff*3600 +\
                Prog_Status.File_Para[Area_No].Time_Para.Min_Diff*60;
    else
      CurSec -= Prog_Status.File_Para[Area_No].Time_Para.Hour_Diff*3600 +\
                Prog_Status.File_Para[Area_No].Time_Para.Min_Diff*60;
    
    ptm = localtime(&CurSec);
    tm_2_S_Time(ptm, &sTime); 
  }
  else
  {
    mem_cpy(&sTime, &Cur_Time, sizeof(Cur_Time), &sTime, sizeof(sTime));
  }
  
  if(Prog_Status.File_Para[Area_No].Time_Para.SmLineFlag == SLINE_MODE)//汽佩
  {
    if(Width > Min_Width)
    {
      P0.X = (Width - Min_Width) / 2;
    }
    else
    {
      P0.X = 0;
    }
/*
    if(Height > Prog_Status.File_Para[Area_No].Time_Para.Text_Height)
      P0.Y = (Height - Prog_Status.File_Para[Area_No].Time_Para.Text_Height)/2;
    else
      P0.Y = 0;//(Height - Prog_Status.File_Para[Area_No].Time_Para.Text_Height)/2;
    Copy_Filled_Rect(&Show_Data_Bak, Area_No, &P0, Prog_Status.File_Para[Area_No].Time_Para.Text_Width, Prog_Status.File_Para[Area_No].Time_Para.Text_Height, &Show_Data, &P0);//&Point);
*/
    X = P0.X + Prog_Status.File_Para[Area_No].Time_Para.Text_Width;
    if(X > P0.X)
      X += Prog_Status.File_Para[Area_No].Time_Para.LineSpace;//Get_Font_Width(Prog_Status.File_Para[Area_No].Time_Para.);
    else
      X = P0.X;

    if(Prog_Status.File_Para[Area_No].Time_Para.Date_Type > 0)//俶勣�幣晩豚?
    {
        P0.X = X;
        if(Height > Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Date_Font))
          P0.Y = (Height - Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Date_Font))/2;
        else
          P0.Y = 0;

        Show_Date(pDst, Area_No, P0.X, P0.Y, &sTime, \
                  Prog_Status.File_Para[Area_No].Time_Para.Date_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Date_Font, Prog_Status.File_Para[Area_No].Time_Para.Date_Color);

        X +=  Prog_Status.File_Para[Area_No].Time_Para.LineSpace + Get_DateStr_Pix_Width(Prog_Status.File_Para[Area_No].Time_Para.Date_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Date_Font);
    }

    if(Prog_Status.File_Para[Area_No].Time_Para.Week_Type > 0)//俶勣佛豚?
    {
        P0.X = X;
        if(Height > Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Week_Font))
          P0.Y = (Height - Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Week_Font))/2;
        else
          P0.Y = 0;

        Show_Week(pDst, Area_No, P0.X, P0.Y, &sTime, \
                  Prog_Status.File_Para[Area_No].Time_Para.Week_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Week_Font, Prog_Status.File_Para[Area_No].Time_Para.Week_Color);

        X += Prog_Status.File_Para[Area_No].Time_Para.LineSpace + Get_WeekStr_Type_Max_Pix_Width(Prog_Status.File_Para[Area_No].Time_Para.Week_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Week_Font);
    }

    if(Prog_Status.File_Para[Area_No].Time_Para.Time_Type > 0)//俶勣扮寂?
    {
        P0.X = X;
        if(Height > Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Time_Font))
          P0.Y = (Height - Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Time_Font))/2;
        else
          P0.Y = 0;

        Show_Time(pDst, Area_No, P0.X, P0.Y, &sTime, \
                  Prog_Status.File_Para[Area_No].Time_Para.Time_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Time_Font, Prog_Status.File_Para[Area_No].Time_Para.Time_Color);

        X += Prog_Status.File_Para[Area_No].Time_Para.LineSpace + Get_TimeStr_Pix_Width(Prog_Status.File_Para[Area_No].Time_Para.Time_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Time_Font);
    }
  }
  else //謹佩
  {
      if(Height > Min_Height)
      {
        P0.Y = (Height - Min_Height) / 2;
      }
      else
      {
        P0.Y = 0;
      }
/*
      if(Width > Prog_Status.File_Para[Area_No].Time_Para.Text_Width)
        P0.X = (Width - Prog_Status.File_Para[Area_No].Time_Para.Text_Width)/2;
      else
        P0.X = 0;//(Height - Prog_Status.File_Para[Area_No].Time_Para.Text_Height)/2;
      Copy_Filled_Rect(&Show_Data_Bak, Area_No, &P0, Prog_Status.File_Para[Area_No].Time_Para.Text_Width, Prog_Status.File_Para[Area_No].Time_Para.Text_Height, &Show_Data, &P0);//&Point);
*/
      Y = P0.Y + Prog_Status.File_Para[Area_No].Time_Para.Text_Height;
      
      if(Prog_Status.File_Para[Area_No].Time_Para.Text_Height > 0)
        Y += Prog_Status.File_Para[Area_No].Time_Para.LineSpace;

      if(Prog_Status.File_Para[Area_No].Time_Para.Date_Type > 0)//俶勣�幣晩豚?
      {
          P0.Y = Y;
          if(Width > Get_DateStr_Pix_Width(Prog_Status.File_Para[Area_No].Time_Para.Date_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Date_Font))
            P0.X = (Width - Get_DateStr_Pix_Width(Prog_Status.File_Para[Area_No].Time_Para.Date_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Date_Font))/2;
          else
            P0.X = 0;

          Show_Date(pDst, Area_No, P0.X, P0.Y, &sTime, \
                    Prog_Status.File_Para[Area_No].Time_Para.Date_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Date_Font, Prog_Status.File_Para[Area_No].Time_Para.Date_Color);

          Y += Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Date_Font);//Get_DateStr_Pix_Width(Prog_Status.File_Para[Area_No].Time_Para.Date_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Date_Font);
          Y += Prog_Status.File_Para[Area_No].Time_Para.LineSpace;
      }

      if(Prog_Status.File_Para[Area_No].Time_Para.Week_Type > 0)//俶勣佛豚?
      {
          P0.Y = Y;
          if(Width > Get_WeekStr_Pix_Width(Prog_Status.File_Para[Area_No].Time_Para.Week_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Week_Font, Cur_Time.Time[T_WEEK]))
            P0.X = (Width - Get_WeekStr_Pix_Width(Prog_Status.File_Para[Area_No].Time_Para.Week_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Week_Font, Cur_Time.Time[T_WEEK]))/2;
          else
            P0.X = 0;

          Show_Week(pDst, Area_No, P0.X, P0.Y, &sTime, \
                    Prog_Status.File_Para[Area_No].Time_Para.Week_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Week_Font, Prog_Status.File_Para[Area_No].Time_Para.Week_Color);

          Y += Get_Font_Height(Prog_Status.File_Para[Area_No].Time_Para.Week_Font);//Prog_Status.File_Para[Area_No].Time_Para.LineSpace + Get_WeekStr_Type_Max_Pix_Width(Prog_Status.File_Para[Area_No].Time_Para.Week_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Week_Font);
          Y += Prog_Status.File_Para[Area_No].Time_Para.LineSpace;
      }

      if(Prog_Status.File_Para[Area_No].Time_Para.Time_Type > 0)//俶勣扮寂?
      {
          P0.Y = Y;
          if(Width > Get_TimeStr_Pix_Width(Prog_Status.File_Para[Area_No].Time_Para.Time_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Time_Font))
            P0.X = (Width - Get_TimeStr_Pix_Width(Prog_Status.File_Para[Area_No].Time_Para.Time_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Time_Font))/2;
          else
            P0.X = 0;

          Show_Time(pDst, Area_No, P0.X, P0.Y, &sTime, \
                    Prog_Status.File_Para[Area_No].Time_Para.Time_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Time_Font, Prog_Status.File_Para[Area_No].Time_Para.Time_Color);

          //X += Prog_Status.File_Para[Area_No].Time_Para.LineSpace + Get_TimeStr_Pix_Width(Prog_Status.File_Para[Area_No].Time_Para.Time_Type - 1, Prog_Status.File_Para[Area_No].Time_Para.Time_Font);
      }
  }
  
  //Prog_Status.Area_Status[Area_No].Step = 100; //匯化�幣欺了�岷俊100%
}
Exemplo n.º 8
0
//更新表盘数据
void Update_Clock_Data(S_Show_Data *pDst, INT8U Area_No)
{
  S_Point P0;
  INT16S tmp;
  INT16U Width,Height;
  INT8U Font;
  INT16U StrWidth, StrHeight;
  time_t CurSec;
  S_Time sTime;
  struct tm tTime, *ptm;
  
  Width = Get_Area_Width(Area_No);
  Height = Get_Area_Height(Area_No);

  //是否需要调整时差
  if(Prog_Status.File_Para[Area_No].Clock_Para.Hour_Diff != 0 ||\
     Prog_Status.File_Para[Area_No].Clock_Para.Min_Diff != 0)
  {
    S_Time_2_tm(&Cur_Time, &tTime);
    CurSec = mktime(&tTime);
    
    if(Prog_Status.File_Para[Area_No].Clock_Para.Diff_Flag EQ 0) //增加
      CurSec += Prog_Status.File_Para[Area_No].Clock_Para.Hour_Diff*3600 +\
                Prog_Status.File_Para[Area_No].Clock_Para.Min_Diff*60;
    else
      CurSec -= Prog_Status.File_Para[Area_No].Clock_Para.Hour_Diff*3600 +\
                Prog_Status.File_Para[Area_No].Clock_Para.Min_Diff*60;
    
    ptm = localtime(&CurSec);
    tm_2_S_Time(ptm, &sTime); 
  }
  else
  {
    mem_cpy(&sTime, &Cur_Time, sizeof(Cur_Time), &sTime, sizeof(sTime)); 
  }
  
  /*
  //----------固定文本---------
  tmp = (INT16S)(Width * Prog_Status.File_Para[Area_No].Clock_Para.Text_X / 100) - (INT16S)Prog_Status.File_Para[Area_No].Clock_Para.Text_Width/2;
  if(tmp > 0)
    P0.X = (INT16U)tmp;
  else
    P0.X = 0;

  tmp = (INT16S)(Height * Prog_Status.File_Para[Area_No].Clock_Para.Text_Y / 100) - (INT16S)(Prog_Status.File_Para[Area_No].Clock_Para.Text_Height/2);
  if(tmp > 0)
    P0.Y = (INT16U)tmp;
  else
    P0.Y = 0;

  Copy_Filled_Rect(&Show_Data_Bak, Area_No, &P0, Prog_Status.File_Para[Area_No].Clock_Para.Text_Width, Prog_Status.File_Para[Area_No].Clock_Para.Text_Height, &Show_Data, &P0);//&Point);
*/
  //---------星期---------
  if(Prog_Status.File_Para[Area_No].Clock_Para.Week_Type > 0)
  {
      INT8U Font = Prog_Status.File_Para[Area_No].Clock_Para.Week_Font; //字体
      INT16U StrWidth = Get_WeekStr_Pix_Width(Prog_Status.File_Para[Area_No].Clock_Para.Week_Type - 1, Font, Cur_Time.Time[T_WEEK]);
      INT8U StrHeight = Get_Font_Height(Font);

      tmp = (INT16S)(Width*Prog_Status.File_Para[Area_No].Clock_Para.Week_X / 100) - (INT16S)StrWidth / 2;
      if(tmp > 0)
        P0.X = tmp;
      else
        P0.X = 0;

      tmp = (INT16S)Height * Prog_Status.File_Para[Area_No].Clock_Para.Week_Y / 100 - (INT16S)StrHeight/2;
      if(tmp > 0)
        P0.Y = tmp;
      else
        P0.Y = 0;

      Show_Week(pDst, Area_No, P0.X, P0.Y, &Cur_Time, Prog_Status.File_Para[Area_No].Clock_Para.Week_Type - 1, Prog_Status.File_Para[Area_No].Clock_Para.Week_Font, Prog_Status.File_Para[Area_No].Clock_Para.Week_Color);
   }

  //显示日期
  if(Prog_Status.File_Para[Area_No].Clock_Para.Date_Type > 0)
  {
      Font = Prog_Status.File_Para[Area_No].Clock_Para.Date_Font; //字体
      StrWidth = Get_DateStr_Pix_Width(Prog_Status.File_Para[Area_No].Clock_Para.Date_Type - 1,Font);
      StrHeight = Get_Font_Height(Font);

      tmp = Width*Prog_Status.File_Para[Area_No].Clock_Para.Date_X / 100 - StrWidth / 2;
      if(tmp > 0)
        P0.X = tmp;
      else
        P0.X = 0;

      tmp = Height * Prog_Status.File_Para[Area_No].Clock_Para.Date_Y / 100 - StrHeight/2;
      if(tmp > 0)
        P0.Y = tmp;
      else
        P0.Y = 0;

      Show_Date(pDst, Area_No, P0.X, P0.Y, &Cur_Time, Prog_Status.File_Para[Area_No].Clock_Para.Date_Type - 1, Prog_Status.File_Para[Area_No].Clock_Para.Date_Font, Prog_Status.File_Para[Area_No].Clock_Para.Date_Color);
   }
  
   Show_Clock(pDst, Area_No, &sTime, (S_Clock_Para *)&Prog_Status.File_Para[Area_No].Clock_Para);
}