--- np2/embed/menubase/menudlg.c 2004/06/28 12:31:32 1.5 +++ np2/embed/menubase/menudlg.c 2005/02/07 14:46:09 1.7 @@ -291,7 +291,7 @@ static BOOL dlgbase_create(MENUDLG dlg, rct.right = hdl->rect.right - hdl->rect.left - ((MENU_FBORDER + MENU_BORDER) * 2); - hdl->vram = vram_create(rct.right, MENUDLG_CYCAPTION, FALSE, DEFAULT_BPP); + hdl->vram = vram_create(rct.right, MENUDLG_CYCAPTION, FALSE, menubase.bpp); if (hdl->vram == NULL) { goto dbcre_err; } @@ -490,7 +490,7 @@ static BOOL dlglist_create(MENUDLG dlg, width = hdl->rect.right - hdl->rect.left - (MENU_LINE * 4); height = hdl->rect.bottom - hdl->rect.top - (MENU_LINE * 4); - hdl->vram = vram_create(width, height, FALSE, DEFAULT_BPP); + hdl->vram = vram_create(width, height, FALSE, menubase.bpp); if (hdl->vram == NULL) { goto dlcre_err; } @@ -1862,7 +1862,7 @@ static BOOL dc_cb2(void *vpItem, void *v if (hdl->flag & MENU_REDRAW) { hdl->flag &= ~MENU_REDRAW; if ((!(hdl->flag & MENU_DISABLE)) && - ((unsigned int)hdl->type < (sizeof(dlgpaint)/sizeof(DLGPAINT)))) { + ((UINT)hdl->type < NELEMETS(dlgpaint))) { dlgpaint[hdl->type](dlg, hdl); menubase_setrect(dlg->vram, &hdl->rect); } @@ -1949,7 +1949,7 @@ BOOL menudlg_create(int width, int heigh MENUDLG_CYCAPTION + MENUDLG_BORDER; mb = &menubase; dlg->font = mb->font; - dlg->vram = vram_create(width, height, FALSE, DEFAULT_BPP); + dlg->vram = vram_create(width, height, FALSE, mb->bpp); if (dlg->vram == NULL) { goto mdcre_err; } @@ -2093,7 +2093,7 @@ BOOL menudlg_append(int type, MENUID id, dhdl.prm = NULL; dhdl.prmcnt = 0; dhdl.val = 0; - if (((unsigned int)type >= (sizeof(dlgcre)/sizeof(DLGCRE))) || + if (((UINT)type >= NELEMENTS(dlgcre)) || (dlgcre[type](dlg, &dhdl, arg))) { goto mda_err; } @@ -2159,8 +2159,7 @@ void menudlg_moving(int x, int y, int bt y -= hdl->rect.top; dlg->btn = 1; dlg->lastid = hdl->id; - if ((unsigned int)hdl->type < - (sizeof(dlgclick)/sizeof(DLGCLICK))) { + if ((UINT)hdl->type < NELEMENTS(dlgclick)) { dlgclick[hdl->type](dlg, hdl, x, y); } } @@ -2172,13 +2171,12 @@ void menudlg_moving(int x, int y, int bt focus = rect_in(&hdl->rect, x, y); x -= hdl->rect.left; y -= hdl->rect.top; - if ((unsigned int)hdl->type < (sizeof(dlgmov)/sizeof(DLGMOV))) { + if ((UINT)hdl->type < NELEMENTS(dlgmov)) { dlgmov[hdl->type](dlg, hdl, x, y, focus); } if (btn == 2) { dlg->btn = 0; - if ((unsigned int)hdl->type < - (sizeof(dlgrel)/sizeof(DLGREL))) { + if ((UINT)hdl->type < NELEMENTS(dlgrel)) { dlgrel[hdl->type](dlg, hdl, focus); } } @@ -2238,8 +2236,7 @@ void *menudlg_msg(int ctrl, MENUID id, v case DMSG_SETVAL: ret = (void *)hdl->val; - if ((unsigned int)hdl->type < - (sizeof(dlgsetval)/sizeof(DLGSETVAL))) { + if ((UINT)hdl->type < NELEMENTS(dlgsetval)) { dlgsetval[hdl->type](dlg, hdl, (int)arg); } break; @@ -2300,8 +2297,7 @@ void *menudlg_msg(int ctrl, MENUID id, v case DMSG_ITEMRESET: if ((dlg->btn) && (dlg->lastid == hdl->id)) { dlg->btn = 0; - if ((unsigned int)hdl->type < - (sizeof(dlgrel)/sizeof(DLGREL))) { + if ((UINT)hdl->type < NELEMENTS(dlgrel)) { dlgrel[hdl->type](dlg, hdl, FALSE); } }