⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smi_wm.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 2 页
字号:
          saveChar = virtScreen[row][i];
          virtScreen[row][i] = NULL_TERM;
          /*
           * print out the string
           */
          dspl_TextOut (j, row, DSPL_TXTATTR_NORMAL, 
                        (char *)&virtScreen [row][j]);
          virtScreen[row][i] = saveChar;
        }     
        i++;
      }

      memcpy (&LCDScreen[row][0], &virtScreen[row][0], screensize_x);
    }

  if (topArea NEQ NULL)
    if (topArea->cursActive)
    {
      /* db: 6,8 uses the standard cursor size, use a define later! */
      dspl_SetCursorPos ((USHORT)(topArea->x+topArea->cursx),
                         (USHORT)(topArea->y+topArea->cursy), 6, 8);
    }  
    else
    {
      /* db: 6,8 uses the standard cursor size, use a define later! */
      dspl_SetCursorPos ((USHORT)(screensize_x-1), (USHORT)(screensize_y-1), 6, 8);
    }
  else
  {
    /* db: 6,8 uses the standard cursor size, use a define later! */
    dspl_SetCursorPos ((USHORT)(screensize_x-1), (USHORT)(screensize_y-1), 6, 8);
  }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_WM                   |
| STATE   : code                  ROUTINE : wm_areaRefresh           |
+--------------------------------------------------------------------+

  PURPOSE : if area *a is visible perform a refresh.

*/

GLOBAL void wm_areaRefresh (T_AREA *a)
{
  if (a->state EQ AREA_DISPLAYED)
    wm_refresh ();
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_WM                   |
| STATE   : code                  ROUTINE : wm_setCursor             |
+--------------------------------------------------------------------+

  PURPOSE : if visible is TRUE the cursor is set to the positions x,y
            and the koordinates are stores in the cursx ,cursy vars
            in the area datas.

*/

GLOBAL void wm_setCursor (T_AREA *a,
                          BOOL    visible,
                          USHORT  y,
                          USHORT  x)
{
  a->cursActive = visible;

  if (visible)
  {
    a->cursy = y;
    a->cursx = x;
    /* db: 6,8 uses the standard cursor size, use a define later! */
    dspl_SetCursorPos ((USHORT)(a->x+a->cursx), (USHORT)(a->y+a->cursy), 6, 8);
  }
  else
  {
    /* db: 6,8 uses the standard cursor size, use a define later! */
    dspl_SetCursorPos (0,0,6,8);
  }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_WM                   |
| STATE   : code                  ROUTINE : wm_createArea            |
+--------------------------------------------------------------------+

  PURPOSE : Create a output area and return a handle to this area.

*/

GLOBAL USHORT wm_createArea (USHORT x,
                             USHORT y,
                             USHORT dx,
                             USHORT dy)
{
  USHORT i=0;

  if (numOfAreas < MAX_AREAS)
  {
    while (i < MAX_AREAS)
    {
      if (areaTable[i].free)
      {
        areaTable[i].free       = FALSE;
        areaTable[i].x          = x;
        areaTable[i].y          = y;
        areaTable[i].dx         = dx;
        areaTable[i].dy         = dy;
        areaTable[i].cursx      = 0;
        areaTable[i].cursy      = 0;
        areaTable[i].cursActive = FALSE;
        
        areaTable[i].funcType   = FN_NONE;
        areaTable[i].func       = 0;
        areaTable[i].state      = AREA_HIDDEN;

        numOfAreas++;

        areaList[areaListIdx++] = i;
        wm_areaClearScreen (&areaTable[i]);

        return i;
      }
      i++;
    }
  }
  return 0xffff;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_WM                   |
| STATE   : code                  ROUTINE : wm_showArea              |
+--------------------------------------------------------------------+

  PURPOSE : Let the area specified by aHandle appear
            on the LC Display.

*/

GLOBAL void wm_showArea (USHORT aHandle)
{
  if (hValid (aHandle))
  {
    if (areaTable[aHandle].state EQ AREA_HIDDEN)
    {
      areaTable[aHandle].state = AREA_DISPLAYED;
      wm_refresh ();
    }
  }  
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_WM                   |
| STATE   : code                  ROUTINE : wm_hideArea              |
+--------------------------------------------------------------------+

  PURPOSE : Let the area specified by aHandle disappear
            on the LC Display.

*/

GLOBAL void wm_hideArea (USHORT aHandle)
{
  if (hValid (aHandle))
  {
    if (areaTable[aHandle].state EQ AREA_DISPLAYED)
    {
      areaTable[aHandle].state = AREA_HIDDEN;
      wm_refresh ();
    }
  }  
}


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_WM                   |
| STATE   : code                  ROUTINE : wm_topArea               |
+--------------------------------------------------------------------+

  PURPOSE : Set the area specified by aHandle on the top of the window
            stack.

*/

GLOBAL void wm_topArea (USHORT aHandle)
{
  USHORT i;

  if (hValid (aHandle) AND &areaTable[aHandle] NEQ topArea)
  {
    i = 0;

    /*
     * search the aHandle in the areaList
     */
    while (i<areaListIdx AND areaList[i] NEQ aHandle)
      i++;

    /*
     * skip the list entry
     */
    i++;

    /*
     * and move the rest of the list one entry downwards
     */
    while (i<areaListIdx)
    {
      areaList[i-1] = areaList[i];
      i++;
    }

    areaList[areaListIdx-1] = aHandle;

    if (areaTable[aHandle].state EQ AREA_DISPLAYED)
    {
      wm_refresh ();
    }
  }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_WM                   |
| STATE   : code                  ROUTINE : wm_clearArea             |
+--------------------------------------------------------------------+

  PURPOSE : Clears the output area specified by aHandle.

*/

GLOBAL void wm_clearArea (USHORT aHandle)
{
  if (hValid (aHandle))
  {
    wm_areaClearScreen (&areaTable[aHandle]);
    wm_refresh ();
  }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_WM                   |
| STATE   : code                  ROUTINE : wm_areaWrite             |
+--------------------------------------------------------------------+

  PURPOSE : Outputs the string text in the area referenced
            by the aHandle.

*/

GLOBAL void wm_areaWrite    (USHORT  aHandle,
                             UBYTE   row,
                             UBYTE   col,
                             char   *text)
{
  if (!hValid (aHandle) OR !strlen (text))
    return;

  wm_areaOutput (&areaTable[aHandle], row, col, text);

  if (areaTable[aHandle].state EQ AREA_DISPLAYED)
    wm_refresh (); 
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_WM                   |
| STATE   : code                  ROUTINE : wm_getArea               |
+--------------------------------------------------------------------+

  PURPOSE : if the handle aHandle is valid this function returns
            the adress of this area.

*/

GLOBAL T_AREA *wm_getArea (USHORT  aHandle)
{
  if (!hValid (aHandle) OR areaTable[aHandle].free)
    return (T_AREA *) NULL;
  
  return &areaTable[aHandle];
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -