embed: synchronizes with np2

refs #90
 svn merge -r 128:129 https://amethyst.yui.ne.jp/svn-dev/x1/xmil/branches/yui/WORK_01
This commit is contained in:
yui 2015-11-14 04:12:57 +00:00
parent e23dea772a
commit 0ce70d82a0
9 changed files with 49 additions and 54 deletions

View File

@ -39,7 +39,7 @@ static void dlginit(void) {
OEMCHAR work[128];
menudlg_appends(res_about, sizeof(res_about)/sizeof(MENUPRM));
menudlg_appends(res_about, NELEMENTS(res_about));
milstr_ncpy(work, str_xmil, NELEMENTS(work));
milstr_ncat(work, str_space, NELEMENTS(work));
milstr_ncat(work, xmilversion, NELEMENTS(work));

View File

@ -1,6 +1,5 @@
#include "compiler.h"
#include "strres.h"
// #include "codecnv.h"
#include "dosio.h"
#include "soundmng.h"
#include "pccore.h"
@ -96,7 +95,7 @@ const OEMCHAR *ext;
} FSELPRM;
typedef struct {
BRESULT result;
BOOL result;
LISTARRAY flist;
FLIST fbase;
const OEMCHAR *filter;
@ -135,7 +134,7 @@ static BRESULT fappend(LISTARRAY flist, FLINFO *fli) {
return(FAILURE);
}
fl->isdir = (fli->attr & 0x10)?1:0;
file_cpyname(fl->name, fli->path, sizeof(fl->name));
file_cpyname(fl->name, fli->path, NELEMENTS(fl->name));
st = &filesel.fbase;
while(1) {
cur = *st;
@ -156,7 +155,7 @@ static BRESULT fappend(LISTARRAY flist, FLINFO *fli) {
return(SUCCESS);
}
static BRESULT checkext(const OEMCHAR *path, const OEMCHAR *ext) {
static BOOL checkext(const OEMCHAR *path, const OEMCHAR *ext) {
const OEMCHAR *p;
@ -178,7 +177,7 @@ static void dlgsetlist(void) {
LISTARRAY flist;
FLISTH flh;
FLINFO fli;
BRESULT append;
BOOL append;
FLIST fl;
ITEMEXPRM prm;
@ -220,7 +219,7 @@ static void dlgsetlist(void) {
static void dlginit(void) {
menudlg_appends(res_fs, sizeof(res_fs)/sizeof(MENUPRM));
menudlg_appends(res_fs, NELEMENTS(res_fs));
menudlg_seticon(DID_PARENT, MICON_FOLDERPARENT);
menudlg_settext(DID_FILE, file_getname(filesel.path));
menudlg_settext(DID_FILTER, filesel.filter);
@ -229,7 +228,7 @@ static void dlginit(void) {
dlgsetlist();
}
static BRESULT dlgupdate(void) {
static BOOL dlgupdate(void) {
FLIST fl;
@ -237,8 +236,8 @@ static BRESULT dlgupdate(void) {
if (fl == NULL) {
return(FALSE);
}
file_setseparator(filesel.path, sizeof(filesel.path));
file_catname(filesel.path, fl->name, sizeof(filesel.path));
file_setseparator(filesel.path, NELEMENTS(filesel.path));
file_catname(filesel.path, fl->name, NELEMENTS(filesel.path));
if (fl->isdir) {
dlgsetlist();
menudlg_settext(DID_FILE, NULL);
@ -310,7 +309,7 @@ static int dlgcmd(int msg, MENUID id, long param) {
return(0);
}
static BRESULT selectfile(const FSELPRM *prm, OEMCHAR *path, int size,
static BOOL selectfile(const FSELPRM *prm, OEMCHAR *path, int size,
const OEMCHAR *def) {
const OEMCHAR *title;
@ -318,11 +317,11 @@ const OEMCHAR *title;
soundmng_stop();
ZeroMemory(&filesel, sizeof(filesel));
if ((def) && (def[0])) {
file_cpyname(filesel.path, def, sizeof(filesel.path));
file_cpyname(filesel.path, def, NELEMENTS(filesel.path));
}
else {
file_cpyname(filesel.path, file_getcd(str_null),
sizeof(filesel.path));
NELEMENTS(filesel.path));
file_cutname(filesel.path);
}
title = NULL;
@ -357,7 +356,7 @@ void filesel_fdd(REG8 drv) {
OEMCHAR path[MAX_PATH];
if (drv < 4) {
if (selectfile(&fddprm, path, sizeof(path), fddfile_diskname(drv))) {
if (selectfile(&fddprm, path, NELEMENTS(path), fddfile_diskname(drv))) {
diskdrv_setfdd(drv, path, 0);
}
}

View File

@ -97,7 +97,7 @@ static void drawctrls(MENUDLG dlg, DLGHDL hdl);
// ----
static BRESULT seaprmempty(void *vpItem, void *vpArg) {
static BOOL seaprmempty(void *vpItem, void *vpArg) {
if (((DLGPRM)vpItem)->next == PRMNEXT_EMPTY) {
menuicon_unlock(((DLGPRM)vpItem)->icon);
@ -156,7 +156,7 @@ static DLGPRM ressea(DLGHDL hdl, int pos) {
return(NULL);
}
static BRESULT dsbyid(void *vpItem, void *vpArg) {
static BOOL dsbyid(void *vpItem, void *vpArg) {
if (((DLGHDL)vpItem)->id == (MENUID)(unsigned long)vpArg) {
return(TRUE);
@ -541,7 +541,7 @@ static void dlglist_drawitem(DLGHDL hdl, DLGPRM prm, int focus,
menucolor[focus?MVC_CURTEXT:MVC_TEXT], &fp, rct);
}
static BRESULT dlglist_drawsub(DLGHDL hdl, int pos, int focus) {
static BOOL dlglist_drawsub(DLGHDL hdl, int pos, int focus) {
DLGPRM prm;
POINT_T pt;
@ -672,9 +672,9 @@ static void dlglist_drawbar(DLGHDL hdl) {
MVC4(MVC_LIGHT, MVC_DARK, MVC_HILIGHT, MVC_SHADOW));
}
static BRESULT dlglist_append(MENUDLG dlg, DLGHDL hdl, const void *arg) {
static BOOL dlglist_append(MENUDLG dlg, DLGHDL hdl, const void *arg) {
BRESULT r;
BOOL r;
DLGPRM *sto;
int barsize;
@ -706,7 +706,7 @@ static BRESULT dlglist_append(MENUDLG dlg, DLGHDL hdl, const void *arg) {
return(r);
}
static BRESULT dlglist_setex(MENUDLG dlg, DLGHDL hdl, const ITEMEXPRM *arg) {
static BOOL dlglist_setex(MENUDLG dlg, DLGHDL hdl, const ITEMEXPRM *arg) {
DLGPRM dp;
UINT cnt;
@ -790,7 +790,7 @@ dlgp_out:
static void dlglist_setval(MENUDLG dlg, DLGHDL hdl, int val) {
BRESULT r;
BOOL r;
if ((unsigned int)val >= (unsigned int)hdl->prmcnt) {
val = -1;
@ -1468,7 +1468,7 @@ const MENURES2 *src;
dlg_text(dlg, hdl, &pt, &hdl->rect);
}
static BRESULT drsv_cb(void *vpItem, void *vpArg) {
static BOOL drsv_cb(void *vpItem, void *vpArg) {
DLGHDL item;
@ -1705,7 +1705,7 @@ static BRESULT _cre(MENUDLG dlg, DLGHDL hdl, const void *arg) {
(void)dlg;
(void)hdl;
(void)arg;
return(0);
return(SUCCESS);
}
#if 0 // not used
@ -1839,7 +1839,7 @@ typedef struct {
RECT_T rect;
} MDCB2;
static BRESULT dc_cb(void *vpItem, void *vpArg) {
static BOOL dc_cb(void *vpItem, void *vpArg) {
DLGHDL hdl;
MDCB2 *mdcb;
@ -1861,7 +1861,7 @@ dccb_exit:
}
static BRESULT dc_cb2(void *vpItem, void *vpArg) {
static BOOL dc_cb2(void *vpItem, void *vpArg) {
MENUDLG dlg;
DLGHDL hdl;
@ -1871,7 +1871,7 @@ static BRESULT dc_cb2(void *vpItem, void *vpArg) {
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 < NELEMENTS(dlgpaint))) {
dlgpaint[hdl->type](dlg, hdl);
menubase_setrect(dlg->vram, &hdl->rect);
}
@ -1908,7 +1908,7 @@ dcs_end:
return;
}
static void drawlock(BRESULT lock) {
static void drawlock(BOOL lock) {
MENUDLG dlg;
@ -2005,14 +2005,14 @@ mdcre_err:
}
static BRESULT mdds_cb(void *vpItem, void *vpArg) {
static BOOL mdds_cb(void *vpItem, void *vpArg) {
vram_destroy(((DLGHDL)vpItem)->vram);
(void)vpArg;
return(FALSE);
}
static BRESULT delicon(void *vpItem, void *vpArg) {
static BOOL delicon(void *vpItem, void *vpArg) {
menuicon_unlock(((DLGPRM)vpItem)->icon);
(void)vpArg;
@ -2102,7 +2102,7 @@ BRESULT menudlg_append(int type, MENUID id, MENUFLG flg, const void *arg,
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;
}
@ -2125,7 +2125,7 @@ typedef struct {
DLGHDL ret;
} MDCB3;
static BRESULT hps_cb(void *vpItem, void *vpArg) {
static BOOL hps_cb(void *vpItem, void *vpArg) {
DLGHDL hdl;
MDCB3 *mdcb;
@ -2168,8 +2168,7 @@ void menudlg_moving(int x, int y, int btn) {
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);
}
}
@ -2181,13 +2180,12 @@ void menudlg_moving(int x, int y, int btn) {
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);
}
}
@ -2247,8 +2245,7 @@ void *menudlg_msg(int ctrl, MENUID id, void *arg) {
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;
@ -2309,8 +2306,7 @@ void *menudlg_msg(int ctrl, MENUID id, void *arg) {
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);
}
}
@ -2401,7 +2397,7 @@ typedef struct {
MENUFLG flag;
} MDCB4;
static BRESULT mddph_cb(void *vpItem, void *vpArg) {
static BOOL mddph_cb(void *vpItem, void *vpArg) {
DLGHDL hdl;
MDCB4 *mdcb;
@ -2415,7 +2411,7 @@ static BRESULT mddph_cb(void *vpItem, void *vpArg) {
return(FALSE);
}
void menudlg_disppagehidden(MENUID page, BRESULT hidden) {
void menudlg_disppagehidden(MENUID page, BOOL hidden) {
MENUDLG dlg;
MDCB4 mdcb;

View File

@ -104,7 +104,7 @@ void menudlg_moving(int x, int y, int btn);
void *menudlg_msg(int ctrl, MENUID id, void *arg);
void menudlg_setpage(MENUID page);
void menudlg_disppagehidden(MENUID page, BRESULT hidden);
void menudlg_disppagehidden(MENUID page, BOOL hidden);
#ifdef __cplusplus
}

View File

@ -76,7 +76,7 @@ static const MSYSITEM s_root[] = {
// ---- regist
static BRESULT seaempty(void *vpItem, void *vpArg) {
static BOOL seaempty(void *vpItem, void *vpArg) {
if (((MENUHDL)vpItem)->flag & MENU_DELETED) {
return(TRUE);
@ -881,7 +881,7 @@ static void focusmove(MENUSYS *sys, int depth, int dir) {
}
}
static void focusenter(MENUSYS *sys, int depth, BRESULT exec) {
static void focusenter(MENUSYS *sys, int depth, BOOL exec) {
MENUHDL menu;
MSYSWND wnd;
@ -962,7 +962,7 @@ typedef struct {
MENUID id;
} ITEMSEA;
static BRESULT _itemsea(void *vpItem, void *vpArg) {
static BOOL _itemsea(void *vpItem, void *vpArg) {
if (((MENUHDL)vpItem)->id == ((ITEMSEA *)vpArg)->id) {
((ITEMSEA *)vpArg)->ret = (MENUHDL)vpItem;

View File

@ -607,7 +607,7 @@ VRAMHDL menuvram_resload(const MENURES *res, int bpp) {
VRAMHDL ret;
int size;
BRESULT alpha;
BOOL alpha;
alpha = (res->alpha)?TRUE:FALSE;
ret = vram_create(res->width, res->height, alpha, bpp);
@ -916,7 +916,7 @@ mvpt_exit:
static void putbtn(VRAMHDL vram, const RECT_T *rect,
const MENURES2 *res, BRESULT focus) {
const MENURES2 *res, BOOL focus) {
RECT_T rct;
POINT_T pt;
UINT mvc4;
@ -949,12 +949,12 @@ static void putbtn(VRAMHDL vram, const RECT_T *rect,
menuvram_res3put(vram, res, &pt, MVC_TEXT);
}
void menuvram_minimizebtn(VRAMHDL vram, const RECT_T *rect, BRESULT focus) {
void menuvram_minimizebtn(VRAMHDL vram, const RECT_T *rect, BOOL focus) {
putbtn(vram, rect, &menures_minimize, focus);
}
void menuvram_closebtn(VRAMHDL vram, const RECT_T *rect, BRESULT focus) {
void menuvram_closebtn(VRAMHDL vram, const RECT_T *rect, BOOL focus) {
putbtn(vram, rect, &menures_close, focus);
}

View File

@ -53,8 +53,8 @@ void menuvram_base(VRAMHDL vram);
VRAMHDL menuvram_create(int width, int height, UINT bpp);
void menuvram_caption(VRAMHDL vram, const RECT_T *rect,
UINT16 icon, const OEMCHAR *caption);
void menuvram_minimizebtn(VRAMHDL vram, const RECT_T *rect, BRESULT focus);
void menuvram_closebtn(VRAMHDL vram, const RECT_T *rect, BRESULT focus);
void menuvram_minimizebtn(VRAMHDL vram, const RECT_T *rect, BOOL focus);
void menuvram_closebtn(VRAMHDL vram, const RECT_T *rect, BOOL focus);
#ifdef __cplusplus
}

View File

@ -3,7 +3,7 @@
#include "vramhdl.h"
VRAMHDL vram_create(int width, int height, BRESULT alpha, int bpp) {
VRAMHDL vram_create(int width, int height, BOOL alpha, int bpp) {
int size;
int allocsize;

View File

@ -59,7 +59,7 @@ typedef struct {
extern "C" {
#endif
VRAMHDL vram_create(int width, int height, BRESULT alpha, int bpp);
VRAMHDL vram_create(int width, int height, BOOL alpha, int bpp);
void vram_destroy(VRAMHDL hdl);
BRESULT vram_allocalpha(VRAMHDL hdl);
void vram_zerofill(VRAMHDL hdl, const RECT_T *rect);