/* * brew_bdb_end -- * Close down the BREW port of Berkeley DB. */ void brew_bdb_end() { void *p; p = ((BDBApp *)GETAPPINSTANCE())->db_global_values; free(p); }
static void getDisplayInfo(DisplayInfo& info) { IDisplay* display = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIDisplay; PlatformRefPtr<IBitmap> bitmap = adoptPlatformRef(IDisplay_GetDestination(display)); AEEBitmapInfo bitmapInfo; IBitmap_GetInfo(bitmap.get(), &bitmapInfo, sizeof(AEEBitmapInfo)); info.width = bitmapInfo.cx; info.height = bitmapInfo.cy; info.depth = bitmapInfo.nDepth; }
/*=========================================================================== FUNCTION: CGMENUCTL_HandleEvent DESCRIPTION: The event handler for a CGMeuCtl. PARAMETERS: pCtl [in] - A pointer to a CGMeuCtl instance eCode [in] - Event code wParam [in] - 16-bit event data dwParam [in] - 32-bit event data DEPENDENCIES: None RETURN VALUE: TRUE - If the event was handled by the control FALSE - if the event was not handled SIDE EFFECTS: None ===========================================================================*/ extern boolean CGMENUCTL_HandleEvent(CGMeuCtl* pCtl, AEEEvent eCode, uint16 wParam, uint32 dwParam) { AEEApplet* pApp = (AEEApplet*)GETAPPINSTANCE(); GMenuItem *item = NULL; DBGPRINTF("MENU: eCode:%x wParam:%x", eCode, wParam); // Only handle the event of the control is currently active if (pCtl && pCtl->m_bIsActive) { switch (eCode) { // Update the control's display is a digit is pressed. case EVT_KEY_PRESS: switch (wParam) { case AVK_SELECT: //通知上层 item = (GMenuItem *)TQueueList_GetElem(pCtl->m_pDataList, pCtl->m_Index); if (item == NULL) { DBGPRINTF("TQueueList_GetElem Failed at pos:%d total:%d", pCtl->m_Index, pCtl->m_pageSize); return FALSE; } DBGPRINTF("TQueueList_GetElem pos:%d wText:%d", pCtl->m_Index, item->wText); ISHELL_PostEvent(pApp->m_pIShell, pApp->clsID, EVT_COMMAND, item->wText, 0); return TRUE; case AVK_DOWN: pCtl->m_Index ++; if (pCtl->m_Index >= pCtl->m_pageSize - 1) pCtl->m_Index = pCtl->m_pageSize - 1; CGMENUCTL_Redraw(pCtl); return TRUE; case AVK_UP: pCtl->m_Index --; if (pCtl->m_Index <= 0) pCtl->m_Index = 0; CGMENUCTL_Redraw(pCtl); return TRUE; } break; } } return FALSE; }
TextCodecBrew::TextCodecBrew(const TextEncoding& encoding) : m_charsetConverter(0) , m_encoding(encoding) , m_numBufferedBytes(0) { String format = String::format("%s>%s", encoding.name(), m_internalEncodingName); IShell* shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell; AEECLSID classID = ISHELL_GetHandler(shell, AEEIID_ICharsetConv, format.latin1().data()); ISHELL_CreateInstance(shell, classID, reinterpret_cast<void**>(&m_charsetConverter)); ASSERT(m_charsetConverter); }
/* * brew_bdb_begin -- * Initialize the BREW port of Berkeley DB. */ int brew_bdb_begin() { void *p; /* * The BREW ARM compiler can't handle statics or globals, so we have * store them off the AEEApplet and initialize them in in-line code. */ p = ((BDBApp *)GETAPPINSTANCE())->db_global_values; if (p == NULL) { if ((p = malloc(sizeof(DB_GLOBALS))) == NULL) return (ENOMEM); memset(p, 0, sizeof(DB_GLOBALS)); ((BDBApp *)GETAPPINSTANCE())->db_global_values = p; TAILQ_INIT(&DB_GLOBAL(db_envq)); DB_GLOBAL(db_line) = "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="; } return (0); }
extern void CGMENUCTL_SetScImage(CGMeuCtl* pCtl, const char * pszResFile, uint16 nResID) { AEEApplet* pApp = (AEEApplet*)GETAPPINSTANCE(); if (pCtl->m_pImageSe) { GM_RELEASEIF(pCtl->m_pImageSe); } pCtl->m_pImageSe = ISHELL_LoadResImage(pApp->m_pIShell, pszResFile, nResID); if (!pCtl->m_pImageSe) { return; } }
static void getDisplayInfo(DisplayInfo& info) { IDisplay* display = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIDisplay; IBitmap* bitmap = IDisplay_GetDestination(display); ASSERT(bitmap); AEEBitmapInfo bitmapInfo; IBitmap_GetInfo(bitmap, &bitmapInfo, sizeof(AEEBitmapInfo)); info.width = bitmapInfo.cx; info.height = bitmapInfo.cy; info.depth = bitmapInfo.nDepth; IBitmap_Release(bitmap); }
SkFILE* sk_fopen(const char path[], SkFILE_Flags flags) { int err; OpenFileMode mode; IFileMgr* fileMgr; IFile* file; IShell* shell; shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell; err = ISHELL_CreateInstance(shell, AEECLSID_FILEMGR, (void**)&fileMgr); if (err!= SUCCESS) return NULL; if (flags & kWrite_SkFILE_Flag) mode = _OFM_READWRITE; else /* kRead_SkFILE_Flag */ mode = _OFM_READ; file = IFILEMGR_OpenFile(fileMgr, path, mode); IFILEMGR_Release(fileMgr); return (SkFILE*)file; }
void setSharedTimerFireTime(double fireTime) { ASSERT(sharedTimerFiredFunction); CALLBACK_Cancel(&sharedTimerCallback); double interval = fireTime - currentTime(); int intervalInMS; if (interval < 0) intervalInMS = 0; else { interval *= 1000; intervalInMS = static_cast<int>(interval); } sharedTimerCallback.pfnCancel = 0; sharedTimerCallback.pfnNotify = invokeCallback; sharedTimerCallback.pNotifyData = 0; IShell* shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell; ISHELL_SetTimerEx(shell, intervalInMS, &sharedTimerCallback); }
/*=========================================================================== FUNCTION: CGMENUCTL_Redraw DESCRIPTION: Redraws the control on the device screen. If the control currently has focus, the control is drawn with a border. PARAMETERS: pCtl [in] - A pointer to a CGMeuCtl instance DEPENDENCIES: None RETURN VALUE: None SIDE EFFECTS: Updates the device screen. ===========================================================================*/ extern void CGMENUCTL_Redraw(CGMeuCtl* pMe) { AEEApplet* pApp = (AEEApplet*)GETAPPINSTANCE(); AEERect rRect; if (pMe) { int i, j, height, h, a, b; AEEImageInfo infSe, infIc; AEERect rec; int xx, yy, dxx, dyy; RGBVAL oldColor; GMenuItem * pData = NULL; TQueueList * p = pMe->m_pDataList; ZEROAT(&infSe); IDISPLAY_EraseRect(pApp->m_pIDisplay, &pMe->m_Rect); h = IDISPLAY_GetFontMetrics(pApp->m_pIDisplay, AEE_FONT_NORMAL, &a, &b); //绘制背景图 if (pMe->m_pImageBk) { IIMAGE_SetDrawSize(pMe->m_pImageBk, pMe->m_Rect.dx, pMe->m_Rect.dy); IIMAGE_Draw(pMe->m_pImageBk, pMe->m_Rect.x, pMe->m_Rect.y); } //确定菜单高度 if (pMe->m_pImageSe) { IIMAGE_GetInfo(pMe->m_pImageSe, &infSe); IIMAGE_SetDrawSize(pMe->m_pImageSe, pMe->m_Rect.dx, infSe.cy); } else { infSe.cx = pMe->m_Rect.dx; infSe.cy = h; } //绘制菜单项 i = 0; j = 0; height = pMe->m_Rect.y + 5; while (p) { AECHAR iTemText[256]; if (i < pMe->m_startIndex) { p = p->pNext; i++; continue; } if (j >= pMe->m_pageSize) { break; } pData = (GMenuItem*)p->pData; //加载菜单ICON if (pData->pImage == NULL && pData->pszResImage != NULL && pData->wImage != 0) { pData->pImage = ISHELL_LoadResImage(pApp->m_pIShell, pData->pszResImage, pData->wImage); } //加载菜单Text if (pData->pszResText != NULL && pData->wText != 0) { MEMSET(iTemText, 0, sizeof(AECHAR)*256); ISHELL_LoadResString(pApp->m_pIShell, pData->pszResText, pData->wText, iTemText, sizeof(AECHAR)* 256); pData->pText = iTemText; } if (i == pMe->m_Index) { if (pMe->m_pImageSe) IIMAGE_Draw(pMe->m_pImageSe, pMe->m_Rect.x, height + 2); ZEROAT(&infIc); if (pData->pImage) { IIMAGE_GetInfo(pData->pImage, &infIc); IIMAGE_Draw(pData->pImage, pMe->m_Rect.x, height + (infSe.cy - infIc.cy) / 2); } xx = pMe->m_Rect.x + infIc.cx + 2; yy = height + (infSe.cy - h) / 2 + 2; dxx = pMe->m_Rect.x + pMe->m_Rect.dx - xx; dyy = h; SETAEERECT(&rec, xx, yy, dxx, dyy); oldColor = IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, pMe->m_Colors.cSelText); if (pMe->m_Properties & 0x02) IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText + pMe->m_textPos, -1, xx + 1, yy, &rec, IDF_TEXT_TRANSPARENT); IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText + pMe->m_textPos, -1, xx, yy, &rec, IDF_TEXT_TRANSPARENT); if (pMe->m_isActive) { if (IDISPLAY_MeasureText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText) > dxx) { if (IDISPLAY_MeasureText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText + pMe->m_textPos) > dxx) { pMe->m_textPos++; } else pMe->m_textPos = 0; //单行太长的话,动态显示 ISHELL_SetTimer(pApp->m_pIShell, 300, (PFNNOTIFY)CGMENUCTL_Redraw, (void*)pMe); } } height += infSe.cy; IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, oldColor); } else { ZEROAT(&infIc); if (pData->pImage) { IIMAGE_GetInfo(pData->pImage, &infIc); IIMAGE_Draw(pData->pImage, pMe->m_Rect.x, height + (infSe.cy - infIc.cy) / 2); } xx = pMe->m_Rect.x + infIc.cx + 2; yy = height + (infSe.cy - h) / 2 + 2; dxx = pMe->m_Rect.x + pMe->m_Rect.dx - xx; dyy = h; SETAEERECT(&rec, xx, yy, dxx, dyy); oldColor = IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, pMe->m_Colors.cText); if (pMe->m_Properties & 0x01) IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText, -1, xx + 1, yy, &rec, IDF_TEXT_TRANSPARENT); IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText, -1, xx, yy, &rec, IDF_TEXT_TRANSPARENT); height += infSe.cy; IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, oldColor); } p = p->pNext; i++; j++; } IDISPLAY_Update(pApp->m_pIDisplay); return ; } }