Ejemplo n.º 1
0
static void Delete(TERMINAL_Obj* pObj) {
  if (pObj->hpText) {
    GUI_ALLOC_Free(pObj->hpText);
    pObj->hpText = 0;
    GUI_DEBUG_LOG("TERMINAL: Delete: Deleting attached string\n");
  }
}
Ejemplo n.º 2
0
/*********************************************************************
*
*       GUI_MEASDEV_Delete
*/
void GUI_MEASDEV_Delete(GUI_MEASDEV_Handle hMemDev) {
  /* Make sure memory device is not used */
  if ((GUI_Context.hDevData = hMemDev) != 0) {
	  GUI_SelectLCD();
  }
  GUI_ALLOC_Free(hMemDev);
}
Ejemplo n.º 3
0
/*********************************************************************
*
*       _OnDelete
*/
static void _OnDelete(GRAPH_DATA_Handle hDataObj) {
  GRAPH_DATA_XY_OBJ * pDataXYObj;
  pDataXYObj = (GRAPH_DATA_XY_OBJ *)GUI_ALLOC_h2p(hDataObj);
  if (pDataXYObj->hData) {
    GUI_ALLOC_Free(pDataXYObj->hData);
  }
}
Ejemplo n.º 4
0
/*********************************************************************
*
*       GUI_CURSOR_Select
*/
const GUI_CURSOR GUI_UNI_PTR * GUI_CURSOR_Select(const GUI_CURSOR GUI_UNI_PTR * pCursor) {
  int AllocSize;
  const GUI_BITMAP GUI_UNI_PTR * pBM;
  const GUI_CURSOR GUI_UNI_PTR * pOldCursor;
  GUI_LOCK();
  pOldCursor = _pCursor;
  if (pCursor != _pCursor) {
    int i;
    pBM = pCursor->pBitmap;
    i = pBM->pPal->NumEntries > 4 ? 4 : pBM->pPal->NumEntries;
    while (i--) {
      LCD_COLOR Color = *(pBM->pPal->pPalEntries + i);
      _ColorIndex[i] = LCD_Color2Index(Color);
    }
    _Hide();
    AllocSize = pBM->XSize * pBM->YSize * sizeof(LCD_PIXELINDEX);
    if (AllocSize != _AllocSize) {
      GUI_ALLOC_Free(_hBuffer);
      _hBuffer = 0;
    }
    _hBuffer = GUI_ALLOC_AllocZero(AllocSize);
    _CursorOn = 1;
    _pCursor = pCursor;
    _CalcRect();
    _Show();
  }
  GUI_UNLOCK();
  return pOldCursor;
}
/*******************************************************************
*
*       _DemoSineWave
*/
static void _DemoSineWave(void) {
  PARAM Param;
  I16 * pStart;
  int t0, Cnt = 0;
  GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
  GUI_HMEM hMem = GUI_ALLOC_AllocZero(405 * sizeof(I16));
  GUI_SetColor(GUI_WHITE);
  GUI_SetBkColor(GUI_RED);
  GUI_ClearRect(0, 55, LCD_XSIZE, 75);
  GUI_SetFont(&GUI_FontComic18B_1);
  GUI_DispStringAt("Sine wave", 20, 55);
  pStart = GUI_ALLOC_h2p(hMem);
  _GetSineData(pStart, 405);
  GUI_SetFont(&GUI_Font6x8);
  t0 = GUI_GetTime();
  while((GUI_GetTime() - t0) < 10000) {
    int t1, tDiff2;
    if (Cnt++ % 90) {
      Param.aY++;
    } else {
      Param.aY = pStart;
    }
    t1 = GUI_GetTime();
    GUI_MEMDEV_Draw(&Rect, _Draw2, &Param, 0, 0);
    tDiff2 = GUI_GetTime() - t1;
    if (tDiff2 < 100) {
      GUI_Delay(100 - tDiff2);
    }
  }
  GUI_ALLOC_Free(hMem);
}
Ejemplo n.º 6
0
/*********************************************************************
*
*       GUI_ARRAY_InsertBlankItem
*
* Purpose:
*   Inserts a blank element in a GUI_ARRAY.
*
* Parameters:
*   Index   Index of the element to insert before
*           0 means: Insert before first element
*           1 means: Insert before second element
*
* Return value:
*   1 if successful
*   0 if failed
*
* Notes:
*   (1) Index changes
*       The index of all items after the one inserted will change
*       (Increment by 1)
*/
char GUI_ARRAY_InsertBlankItem(GUI_ARRAY* pThis, unsigned int Index) {
  GUI_ARRAY_CHECK(pThis);    /* Sanity checks at higher debug levels only */

  if (Index >= (unsigned)pThis->NumItems) {
    GUI_DEBUG_ERROROUT("GUI_ARRAY_InsertBlankItem: Illegal index");
  } else {
    WM_HMEM hNewBuffer;
    hNewBuffer = GUI_ALLOC_AllocZero(sizeof(WM_HMEM) * (pThis->NumItems + 1));
    if (hNewBuffer == 0) {
      GUI_DEBUG_ERROROUT("GUI_ARRAY_InsertBlankItem: Failed to alloc buffer");
    } else {
      WM_HMEM *pOldBuffer;
      WM_HMEM *pNewBuffer;
      pNewBuffer = (WM_HMEM*) GUI_ALLOC_h2p(hNewBuffer);
      pOldBuffer = (WM_HMEM*) GUI_ALLOC_h2p(pThis->haHandle);
      memcpy(pNewBuffer, pOldBuffer, Index * sizeof(WM_HMEM));
      memcpy(pNewBuffer + (Index + 1), pOldBuffer + Index, (pThis->NumItems - Index) * sizeof(WM_HMEM));
      GUI_ALLOC_Free(pThis->haHandle);
      pThis->haHandle = hNewBuffer;
      pThis->NumItems++;
      return 1;               /* Successfull */
    }
  }
  return 0;                   /* Failed */
}
Ejemplo n.º 7
0
/*********************************************************************
*
*       LISTVIEW_DeleteColumn
*/
void LISTVIEW_DeleteColumn(LISTVIEW_Handle hObj, unsigned Index) {
  if (hObj) {
    LISTVIEW_Obj* pObj;
    WM_LOCK();
    pObj = LISTVIEW_H2P(hObj);
    if (Index < GUI_ARRAY_GetNumItems(&pObj->AlignArray)) {
      unsigned NumRows, i;
      GUI_ARRAY* pRow;
      HEADER_DeleteItem(pObj->hHeader, Index);
      GUI_ARRAY_DeleteItem(&pObj->AlignArray, Index);
      NumRows = GUI_ARRAY_GetNumItems(&pObj->RowArray);
      for (i = 0; i < NumRows; i++) {
        LISTVIEW_ITEM * pItem;
        pRow = (GUI_ARRAY*)GUI_ARRAY_GetpItem(&pObj->RowArray, i);
        /* Delete attached info items */
        pItem = (LISTVIEW_ITEM *)GUI_ARRAY_GetpItem(pRow, Index);
        if (pItem->hItemInfo) {
          GUI_ALLOC_Free(pItem->hItemInfo);
        }
        /* Delete cell */
        GUI_ARRAY_DeleteItem(pRow, Index);
      }
      LISTVIEW__UpdateScrollParas(hObj, pObj);
      LISTVIEW__InvalidateInsideArea(hObj, pObj);
    }
    WM_UNLOCK();
  }
}
Ejemplo n.º 8
0
/*********************************************************************
*
*       GUI_TIMER_Delete
*/
void GUI_TIMER_Delete(GUI_TIMER_HANDLE hObj) {
/* Unlink Timer */
  GUI_LOCK();
  _Unlink(hObj);
  GUI_ALLOC_Free(hObj);
  GUI_UNLOCK();
}
Ejemplo n.º 9
0
static void _DemoRandomGraph(void) {
  PARAM Param;
  int tDiff, t0, Cnt = 0;
  GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
  GUI_HMEM hMem = GUI_ALLOC_AllocZero((LCD_XSIZE - 20) * sizeof(I16));
  _ShowText("Random graph");
  Param.aY = (I16*)GUI_ALLOC_h2p(hMem);
  /*
  GUI_SetFont(&GUI_Font6x8);
  GUI_DispStringAt("msec/graph:", 10, 50);
  */
  _LabelMS();
  t0 = GUI_GetTime();
  while(((tDiff = (GUI_GetTime() - t0)) < 10000) && !GUIDEMO_CheckCancel()) {
    int t1, tDiff2;
    _GetRandomData(Param.aY, tDiff, (LCD_XSIZE - 20));
    t1 = GUI_GetTime();
    GUI_MEMDEV_Draw(&Rect, _Draw, &Param, 0, GUI_MEMDEV_NOTRANS);
    tDiff2 = GUI_GetTime() - t1;
    if (tDiff2 < 100) {
      GUI_Delay(100 - tDiff2);
    }
    if(!((++Cnt)%10)) {
      _DisplayTime(tDiff2);
      /*
      GUI_GotoXY(80, 50);
      GUI_SetColor(GUI_WHITE);
      GUI_SetBkColor(GUI_RED);
      GUI_DispDecSpace(tDiff2, 3);
      */
    }
  }
  GUI_ALLOC_Free(hMem);
}
Ejemplo n.º 10
0
/*********************************************************************
*
*       _FreeAttached
*
* Purpose:
*   Delete attached objects (if any).
*/
static void _FreeAttached(LISTVIEW_Obj * pObj) {
  int i, j, NumRows, NumColumns;
  NumRows    = LISTVIEW__GetNumRows(pObj);
  NumColumns = LISTVIEW__GetNumColumns(pObj);
  for (i = 0; i < NumRows; i++) {
    LISTVIEW_ROW* pRow;
    pRow = (LISTVIEW_ROW*) GUI_ARRAY_GetpItem(&pObj->RowArray, i);
    /* Delete attached info items */
    for (j = 0; j < NumColumns; j++) {
      LISTVIEW_CELL* pCell;
      pCell = (LISTVIEW_CELL*) GUI_ARRAY_GetpItem(&pRow->CellArray, j);
      if (pCell) {
        if (pCell->hCellInfo) {
          GUI_ALLOC_Free(pCell->hCellInfo);
        }
      }
    }
    /* Delete row */
    GUI_ARRAY_Delete(&pRow->CellArray);
  }
  /* Delete sort object */
  if (pObj->hSort) {
    ((LISTVIEW_SORT *)GUI_ALLOC_h2p(pObj->hSort))->fpFree(pObj->hSort);
  }
  GUI_ARRAY_Delete(&pObj->ColumnArray);
  GUI_ARRAY_Delete(&pObj->RowArray);
}
/*******************************************************************
*
*       _DemoRandomGraph
*/
static void _DemoRandomGraph(void) {
  PARAM Param;
  int tDiff, t0;
  GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
  GUI_HMEM hMem = GUI_ALLOC_AllocZero((LCD_XSIZE - 20) * sizeof(I16));
  GUI_SetColor(GUI_WHITE);
  GUI_SetBkColor(GUI_RED);
  GUI_ClearRect(0, 55, LCD_XSIZE, 75);
  GUI_SetFont(&GUI_FontComic18B_1);
  GUI_DispStringAt("Random graph", 20, 55);
  GUI_Lock();
  Param.aY = GUI_ALLOC_h2p(hMem);
  GUI_SetFont(&GUI_Font6x8);
  t0 = GUI_GetTime();
  while((tDiff = (GUI_GetTime() - t0)) < 10000) {
    int t1, tDiff2;
    _GetRandomData(Param.aY, tDiff, (LCD_XSIZE - 20));
    t1 = GUI_GetTime();
    GUI_MEMDEV_Draw(&Rect, _Draw, &Param, 0, 0);
    tDiff2 = GUI_GetTime() - t1;
    if (tDiff2 < 100) {
      GUI_Delay(100 - tDiff2);
    }
  }
  GUI_Unlock();
  GUI_ALLOC_Free(hMem);
}
Ejemplo n.º 12
0
/*********************************************************************
*
*       GUI_USAGE_DecUseCnt
*
* Purpose: Decrements the usage count and deletes the usage object if
*          the counter reaches 0.
*/
void GUI_USAGE_DecUseCnt(GUI_USAGE_Handle  hUsage) {
    GUI_USAGE* pThis;
    GUI_LOCK();
    pThis = GUI_USAGE_H2P(hUsage);
    if (--pThis->UseCnt == 0) {
        GUI_ALLOC_Free(hUsage);
    }
    GUI_UNLOCK();
}
Ejemplo n.º 13
0
/*********************************************************************
*
*       _DeleteLinkItem
*
* Purpose:
* Returns:
*
*/
static void _DeleteLinkItem(GUI_HMEM hLinkToDelete) {
  GUI_HMEM hLink;
  TIMER_LINK* pLink;
  TIMER_LINK* pLinkToDelete;
  if (hLinkToDelete) {
    pLinkToDelete = (TIMER_LINK*)GUI_ALLOC_h2p(hLinkToDelete);
    if (_hFirst == hLinkToDelete) {
      _hFirst = pLinkToDelete->hNext;
      GUI_ALLOC_Free(hLinkToDelete);
    } else {
      for (hLink = _hFirst; hLink; hLink = pLink->hNext) {
        pLink = (TIMER_LINK*)GUI_ALLOC_h2p(hLink);
        if (pLink->hNext == hLinkToDelete) {
          pLink->hNext = pLinkToDelete->hNext;
          GUI_ALLOC_Free(hLinkToDelete);
          break;                         /* We found it ! */
        }
      }
    }
  }
}
Ejemplo n.º 14
0
/*********************************************************************
*
*       GUI_JPEG_Draw
*/
int GUI_JPEG_Draw(const void * pFileData, int DataSize, int x0, int y0) {
  #if (GUI_WINSUPPORT)
    GUI_RECT r;
  #endif
  int Ret = 0;
  GUI_HMEM hBuffer = 0;
	struct jpeg_decompress_struct cinfo;
	struct jpeg_error_mgr jerr;
  GUI_LOCK();
  _Init(&jerr, &cinfo, pFileData, DataSize);
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0,y0);
    r.x1 = (r.x0 = x0) + cinfo.image_width - 1;
    r.y1 = (r.y0 = y0) + cinfo.image_height - 1;
    WM_ITERATE_START(&r) {
  #endif
    if (hBuffer) {
      _Init(&jerr, &cinfo, pFileData, DataSize);
    }
    /* 4. Set up parameters for decompression (optional ...) */
    /* 5. jpeg_start_decompress(...); Should normally return quickly */
	  jpeg_start_decompress(&cinfo);
    /* 6. while (scan lines remain to be read) */
	  /*     jpeg_read_scanlines(...); */
    if (!hBuffer) {
      hBuffer = GUI_ALLOC_AllocNoInit(cinfo.image_width * 3);
    }
    while (cinfo.output_scanline < cinfo.output_height) {
      U8* p;
      p = (U8*)GUI_ALLOC_h2p(hBuffer);
      jpeg_read_scanlines(&cinfo, &p, 1);
      if (cinfo.jpeg_color_space == JCS_GRAYSCALE) {
        _WritePixelsGray(p, x0, y0 + cinfo.output_scanline, cinfo.image_width);
      } else {
        _WritePixelsRGB(p, x0, y0 + cinfo.output_scanline, cinfo.image_width);
      }
    }
    /* 7. jpeg_finish_decompress(...); */
    /*    Complete the decompression cycle.  This causes working memory associated */
    /*    with the JPEG object to be released. */
	  jpeg_finish_decompress(&cinfo);
    /* 8. Release the JPEG decompression object. */
    jpeg_destroy_decompress(&cinfo);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_ALLOC_Free(hBuffer);
  GUI_UNLOCK();
  return Ret;
}
Ejemplo n.º 15
0
static void _DemoOrData(void) {
  int i;
  PARAM Param;
  GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
  GUI_HMEM hMem = GUI_ALLOC_AllocZero((LCD_XSIZE + 90) * sizeof(I16));
  _ShowText("Several waves...");
  Param.aY = (I16*)GUI_ALLOC_h2p(hMem);
  _GetSineData(Param.aY, LCD_XSIZE + 90);
  GUI_MEMDEV_Draw(&Rect, _Draw, &Param, 0, GUI_MEMDEV_NOTRANS);
  for (i = 0; (i < 90) && !GUIDEMO_CheckCancel(); i++) {
    _DrawOrData(GUI_GREEN, ++Param.aY);
    GUI_Delay(10);
  }
  GUI_ALLOC_Free(hMem);
}
Ejemplo n.º 16
0
static void _DemoSineWave(void) {
  PARAM Param;
  I16 * pStart;
  int t0, Cnt = 0;
  GUI_HMEM hMem;
  GUI_RECT Rect;
  Rect.x0 = 19;
  Rect.y0 = (LCD_YSIZE - 20) - _YSize;
  Rect.x1 = LCD_XSIZE - 2;
  Rect.y1 = LCD_YSIZE - 21;
  hMem = GUI_ALLOC_AllocZero((LCD_XSIZE + 90) * sizeof(I16));
  _ShowText("Sine wave");
  GUI_LOCK();
  pStart = (I16*)GUI_ALLOC_h2p(hMem);
  GUI_UNLOCK();    /* Note: unlocking is permitted only if no further allocation is done so hMem stays valid */
  _GetSineData(pStart, LCD_XSIZE + 90);
  /*
  GUI_SetFont(&GUI_Font6x8);
  GUI_DispStringAt("msec/graph:", 10, 50);
  */
  _LabelMS();
  t0 = GUI_GetTime();
  while(((GUI_GetTime() - t0) < 10000) && !GUIDEMO_CheckCancel()) {
    U32 t1, tDiff2;
    if (Cnt % 90) {
      Param.aY++;
    } else {
      Param.aY = pStart;
    }
    t1 = GUI_GetTime();
    GUI_MEMDEV_Draw(&Rect, _Draw2, &Param, 0, GUI_MEMDEV_NOTRANS);
    tDiff2 = GUI_GetTime() - t1;
    if (tDiff2 < 100) {
      GUI_Delay(100 - tDiff2);
    }
    if(!((++Cnt) % 10)) {
      _DisplayTime(tDiff2);
      /*
      GUI_GotoXY(80, 50);
      GUI_SetColor(GUI_WHITE);
      GUI_SetBkColor(GUI_RED);
      GUI_DispDecSpace(tDiff2, 3);
      */
    }
  }
  GUI_ALLOC_Free(hMem);
}
Ejemplo n.º 17
0
/*********************************************************************
*
*       GUI_ALLOC_Realloc
*
* Purpose:
*   Reallocate a memory block. This is typically used to grow memory
*   blocks. The contents of the old memory block are copied into the
*   new block (or as much as fits in case of shrinkage).
*   In case of error the old memory block (and its handle) remain
*   unchanged.
*
* Return value:
*   On success:    Handle of newly allocated memory block
*   On error:      0
*/
GUI_HMEM GUI_ALLOC_Realloc(GUI_HMEM hOld, int NewSize) {
  GUI_HMEM hNew;
  hNew = GUI_ALLOC_AllocNoInit(NewSize);
  if (hNew && hOld) {
    void *pNew, *pOld;
    int Size, OldSize;
    OldSize = GUI_ALLOC_GetSize(hOld);
    Size = (OldSize < NewSize) ? OldSize : NewSize;
    GUI_LOCK();
    pNew = GUI_ALLOC_h2p(hNew);
    pOld = GUI_ALLOC_h2p(hOld);
    memcpy(pNew, pOld, Size);
    GUI_UNLOCK();
    GUI_ALLOC_Free(hOld);
  }
  return hNew;
}
/*******************************************************************
*
*       _DemoOrData
*/
static void _DemoOrData(void) {
  int i;
  PARAM Param;
  GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
  GUI_HMEM hMem = GUI_ALLOC_AllocZero(405 * sizeof(I16));
  GUI_SetColor(GUI_WHITE);
  GUI_SetBkColor(GUI_RED);
  GUI_ClearRect(0, 55, LCD_XSIZE, 75);
  GUI_SetFont(&GUI_FontComic18B_1);
  GUI_DispStringAt("Several waves...", 20 ,55);
  Param.aY = GUI_ALLOC_h2p(hMem);
  _GetSineData(Param.aY, 405);
  GUI_MEMDEV_Draw(&Rect, _Draw, &Param, 0, 0);
  for (i = 0; (i < 90); i++) {
    _DrawOrData(GUI_GREEN, ++Param.aY);
    GUI_Delay(10);
  }
  GUI_ALLOC_Free(hMem);
}
Ejemplo n.º 19
0
/*********************************************************************
*
*       _FreeAttached
*
* Purpose:
*   Delete attached objects (if any).
*/
static void _FreeAttached(LISTVIEW_Obj * pObj) {
  int i, j, NumRows, NumColumns;
  NumRows    = GUI_ARRAY_GetNumItems(&pObj->RowArray);
  NumColumns = GUI_ARRAY_GetNumItems(&pObj->AlignArray);
  for (i = 0; i < NumRows; i++) {
    GUI_ARRAY * pRow;
    pRow = (GUI_ARRAY *)GUI_ARRAY_GetpItem(&pObj->RowArray, i);
    /* Delete attached info items */
    for (j = 0; j < NumColumns; j++) {
      LISTVIEW_ITEM * pItem;
      pItem = (LISTVIEW_ITEM *)GUI_ARRAY_GetpItem(pRow, j);
      if (pItem->hItemInfo) {
        GUI_ALLOC_Free(pItem->hItemInfo);
      }
    }
    /* Delete row */
    GUI_ARRAY_Delete(pRow);
  }
  GUI_ARRAY_Delete(&pObj->AlignArray);
  GUI_ARRAY_Delete(&pObj->RowArray);
}
Ejemplo n.º 20
0
static void _DemoSineWave(void) {
  PARAM Param;
  I16 * pStart;
  int t0, Cnt = 0;
  GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
  GUI_HMEM hMem = GUI_ALLOC_AllocZero((LCD_XSIZE + 90) * sizeof(I16));
  _ShowText("Sine wave");
  pStart = (I16*)GUI_ALLOC_h2p(hMem);
  _GetSineData(pStart, LCD_XSIZE + 90);
  /*
  GUI_SetFont(&GUI_Font6x8);
  GUI_DispStringAt("msec/graph:", 10, 50);
  */
  _LabelMS();
  t0 = GUI_GetTime();
  while(((GUI_GetTime() - t0) < 10000) && !GUIDEMO_CheckCancel()) {
    int t1, tDiff2;
    if (Cnt % 90) {
      Param.aY++;
    } else {
      Param.aY = pStart;
    }
    t1 = GUI_GetTime();
    GUI_MEMDEV_Draw(&Rect, _Draw2, &Param, 0, GUI_MEMDEV_NOTRANS);
    tDiff2 = GUI_GetTime() - t1;
    if (tDiff2 < 100) {
      GUI_Delay(100 - tDiff2);
    }
    if(!((++Cnt) % 10)) {
      _DisplayTime(tDiff2);
      /*
      GUI_GotoXY(80, 50);
      GUI_SetColor(GUI_WHITE);
      GUI_SetBkColor(GUI_RED);
      GUI_DispDecSpace(tDiff2, 3);
      */
    }
  }
  GUI_ALLOC_Free(hMem);
}
Ejemplo n.º 21
0
/*********************************************************************
*
*       LISTVIEW_DeleteRow
*/
void LISTVIEW_DeleteRow(LISTVIEW_Handle hObj, unsigned Index) {
    if (hObj) {
        LISTVIEW_Obj* pObj;
        unsigned NumRows;
        WM_LOCK();
        pObj = LISTVIEW_H2P(hObj);
        NumRows = GUI_ARRAY_GetNumItems(&pObj->RowArray);
        if (Index < NumRows) {
            unsigned NumColumns, i;
            GUI_ARRAY* pRow;
            pRow = (GUI_ARRAY*)GUI_ARRAY_GetpItem(&pObj->RowArray, Index);
            /* Delete attached info items */
            NumColumns = GUI_ARRAY_GetNumItems(pRow);
            for (i = 0; i < NumColumns; i++) {
                LISTVIEW_ITEM * pItem;
                pItem = (LISTVIEW_ITEM *)GUI_ARRAY_GetpItem(pRow, i);
                if (pItem->hItemInfo) {
                    GUI_ALLOC_Free(pItem->hItemInfo);
                }
            }
            /* Delete row */
            GUI_ARRAY_Delete(pRow);
            GUI_ARRAY_DeleteItem(&pObj->RowArray, Index);
            /* Adjust properties */
            if (pObj->Sel == (signed int)Index) {
                pObj->Sel = -1;
            }
            if (pObj->Sel > (signed int)Index) {
                pObj->Sel--;
            }
            if (LISTVIEW__UpdateScrollParas(hObj, pObj)) {
                LISTVIEW__InvalidateInsideArea(hObj, pObj);
            } else {
                _InvalidateRowAndBelow(hObj, pObj, Index);
            }
        }
        WM_UNLOCK();
    }
}
Ejemplo n.º 22
0
static void _DemoRandomGraph(void) {
  PARAM Param;
  int tDiff, t0;
  int Cnt = 0;
  GUI_HMEM hMem;
  GUI_RECT Rect;
  int lcd_xsize;
  int lcd_ysize;
  lcd_xsize = LCD_GetXSize();
  lcd_ysize = LCD_GetYSize();
  Rect.x0 = 19;
  Rect.y0 = (lcd_ysize - 20) - _YSize;
  Rect.x1 = lcd_xsize - 2;
  Rect.y1 = lcd_ysize - 21;
  hMem = GUI_ALLOC_AllocZero((LCD_GetXSize() - 20) * sizeof(I16));
  _ShowText("Random graph");
  GUI_LOCK();
  Param.aY = (I16*)GUI_ALLOC_h2p(hMem);
  GUI_UNLOCK();    /* Note: unlocking is permitted only if no further allocation is done so hMem stays valid */
  _LabelMS();
  t0 = GUI_GetTime();
  while(((tDiff = (GUI_GetTime() - t0)) < 10000) && !GUIDEMO_CheckCancel()) {
    U32 t1, tDiff2;
    _GetRandomData(Param.aY, tDiff, (lcd_xsize - 20));
    t1 = GUI_GetTime();
    GUI_MEMDEV_Draw(&Rect, _Draw, &Param, 0, GUI_MEMDEV_NOTRANS);
    tDiff2 = GUI_GetTime() - t1;
    if (tDiff2 < 100) {
      GUI_Delay(100 - tDiff2);
    }
    if(!((++Cnt)%10)) {
      _DisplayTime(tDiff2);
    }
  }
  GUI_ALLOC_Free(hMem);
}
Ejemplo n.º 23
0
/*********************************************************************
*
*       GUI_ALLOC_FreePtr
*/
void GUI_ALLOC_FreePtr(GUI_HMEM *ph) {
  GUI_LOCK();
  GUI_ALLOC_Free(*ph);
  *ph =0;
  GUI_UNLOCK();
}
Ejemplo n.º 24
0
/*********************************************************************
*
*       _Free
*
* Purpose:
*   Frees the memory used by the attached LISTVIEW_SORT object.
*
* Parameter:
*   hObj - Handle of LISTVIEW_SORT object
*/
static void _Free(WM_HMEM hObj) {
    LISTVIEW_SORT * pSort;
    pSort = (LISTVIEW_SORT *)GUI_ALLOC_h2p(hObj);
    GUI_ALLOC_Free(pSort->hSortArray);
    GUI_ALLOC_Free(hObj);
}