|
|
| version 1.1, 2003/11/21 06:51:10 | version 1.6, 2004/07/01 11:42:54 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "strres.h" | |
| #include "fontmng.h" | #include "fontmng.h" |
| #include "vramhdl.h" | #include "vramhdl.h" |
| #include "vrammix.h" | #include "vrammix.h" |
| Line 8 | Line 9 |
| typedef struct _dprm { | typedef struct _dprm { |
| struct _dprm *next; | struct _dprm *next; |
| int width; | UINT16 width; |
| UINT16 num; | |
| VRAMHDL icon; | VRAMHDL icon; |
| char str[128]; | char str[96]; |
| } _DLGPRM, *DLGPRM; | } _DLGPRM, *DLGPRM; |
| #define PRMNEXT_EMPTY ((DLGPRM)-1) | #define PRMNEXT_EMPTY ((DLGPRM)-1) |
| Line 37 typedef struct { | Line 39 typedef struct { |
| short minval; | short minval; |
| short maxval; | short maxval; |
| int pos; | int pos; |
| BYTE type; | UINT8 type; |
| BYTE moving; | UINT8 moving; |
| BYTE sldh; | UINT8 sldh; |
| BYTE sldv; | UINT8 sldv; |
| } DLGSLD; | } DLGSLD; |
| typedef struct { | typedef struct { |
| Line 102 static BOOL seaprmempty(void *vpItem, vo | Line 104 static BOOL seaprmempty(void *vpItem, vo |
| ((DLGPRM)vpItem)->icon = NULL; | ((DLGPRM)vpItem)->icon = NULL; |
| return(TRUE); | return(TRUE); |
| } | } |
| (void)vpArg; | |
| return(FALSE); | return(FALSE); |
| } | } |
| Line 115 static DLGPRM resappend(MENUDLG dlg, con | Line 118 static DLGPRM resappend(MENUDLG dlg, con |
| } | } |
| if (prm) { | if (prm) { |
| prm->next = NULL; | prm->next = NULL; |
| prm->icon = NULL; | |
| prm->width = 0; | prm->width = 0; |
| prm->num = 0; | |
| prm->icon = NULL; | |
| prm->str[0] = '\0'; | prm->str[0] = '\0'; |
| if (str) { | if (str) { |
| milstr_ncpy(prm->str, str, sizeof(prm->str)); | milsjis_ncpy(prm->str, str, sizeof(prm->str)); |
| } | } |
| } | } |
| return(prm); | return(prm); |
| Line 130 static void resattachicon(MENUDLG dlg, D | Line 134 static void resattachicon(MENUDLG dlg, D |
| if (prm) { | if (prm) { |
| menuicon_unlock(prm->icon); | menuicon_unlock(prm->icon); |
| prm->num = icon; | |
| prm->icon = menuicon_lock(icon, width, height, dlg->vram->bpp); | prm->icon = menuicon_lock(icon, width, height, dlg->vram->bpp); |
| } | } |
| } | } |
| Line 151 static DLGPRM ressea(DLGHDL hdl, int pos | Line 156 static DLGPRM ressea(DLGHDL hdl, int pos |
| return(NULL); | return(NULL); |
| } | } |
| static BOOL dsbyid(void *vpItem, void *vpArg) { | static BOOL dsbyid(void *vpItem, void *vpArg) { |
| if (((DLGHDL)vpItem)->id == (MENUID)(unsigned long)vpArg) { | if (((DLGHDL)vpItem)->id == (MENUID)(unsigned long)vpArg) { |
| Line 160 static BOOL dsbyid(void *vpItem, void *v | Line 164 static BOOL dsbyid(void *vpItem, void *v |
| return(FALSE); | return(FALSE); |
| } | } |
| static DLGHDL dlghdlsea(MENUDLG dlg, MENUID id) { | static DLGHDL dlghdlsea(MENUDLG dlg, MENUID id) { |
| return((DLGHDL)listarray_enum(dlg->dlg, dsbyid, (void *)(long)id)); | return((DLGHDL)listarray_enum(dlg->dlg, dsbyid, (void *)(long)id)); |
| } | } |
| static BOOL gettextsz(DLGHDL hdl, POINT_T *sz) { | |
| DLGPRM prm; | |
| prm = hdl->prm; | |
| if (prm == NULL) { | |
| goto gts_err; | |
| } | |
| *sz = hdl->c.dt.pt; | |
| if (prm->icon) { | |
| if (sz->x) { | |
| #if defined(SIZE_QVGA) | |
| sz->x += 1; | |
| #else | |
| sz->x += 2; | |
| #endif | |
| } | |
| sz->x += sz->y; | |
| } | |
| return(SUCCESS); | |
| gts_err: | |
| return(FAILURE); | |
| } | |
| static void getleft(POINT_T *pt, const RECT_T *rect, const POINT_T *sz) { | static void getleft(POINT_T *pt, const RECT_T *rect, const POINT_T *sz) { |
| Line 174 static void getleft(POINT_T *pt, const R | Line 201 static void getleft(POINT_T *pt, const R |
| (void)sz; | (void)sz; |
| } | } |
| static void getcenter(POINT_T *pt, const RECT_T *rect, const POINT_T *sz) { | static void getcenter(POINT_T *pt, const RECT_T *rect, const POINT_T *sz) { |
| pt->x = rect->left; | pt->x = rect->left; |
| Line 188 static void getright(POINT_T *pt, const | Line 214 static void getright(POINT_T *pt, const |
| pt->y = rect->top; | pt->y = rect->top; |
| } | } |
| static void getmid(POINT_T *pt, const RECT_T *rect, const POINT_T *sz) { | static void getmid(POINT_T *pt, const RECT_T *rect, const POINT_T *sz) { |
| pt->x = rect->left; | pt->x = rect->left; |
| Line 200 static void getmid(POINT_T *pt, const RE | Line 225 static void getmid(POINT_T *pt, const RE |
| static BOOL _cre_settext(MENUDLG dlg, DLGHDL hdl, const void *arg) { | static BOOL _cre_settext(MENUDLG dlg, DLGHDL hdl, const void *arg) { |
| hdl->prm = resappend(dlg, (char *)arg); | const char *str; |
| str = (char *)arg; | |
| if (str == NULL) { | |
| str = str_null; | |
| } | |
| hdl->prm = resappend(dlg, str); | |
| hdl->c.dt.font = dlg->font; | hdl->c.dt.font = dlg->font; |
| fontmng_getsize(dlg->font, (char *)arg, &hdl->c.dt.pt); | fontmng_getsize(dlg->font, str, &hdl->c.dt.pt); |
| return(SUCCESS); | return(SUCCESS); |
| } | } |
| static void dlg_text(MENUDLG dlg, DLGHDL hdl, | static void dlg_text(MENUDLG dlg, DLGHDL hdl, |
| const POINT_T *pt, const RECT_T *rect) { | const POINT_T *pt, const RECT_T *rect) { |
| VRAMHDL icon; | |
| const char *string; | const char *string; |
| int color; | int color; |
| POINT_T fp; | |
| POINT_T p; | POINT_T p; |
| if (hdl->prm == NULL) { | if (hdl->prm == NULL) { |
| goto dgtx_exit; | return; |
| } | |
| string = hdl->prm->str; | |
| if (string == NULL) { | |
| goto dgtx_exit; | |
| } | } |
| if (!(hdl->flag & MENU_GRAY)) { | fp = *pt; |
| color = MVC_TEXT; | icon = hdl->prm->icon; |
| if (icon) { | |
| if (icon->alpha) { | |
| vramcpy_cpyex(dlg->vram, &fp, icon, NULL); | |
| } | |
| else { | |
| vramcpy_cpy(dlg->vram, &fp, icon, NULL); | |
| } | |
| fp.x += icon->width; | |
| #if defined(SIZE_QVGA) | |
| fp.x += 1; | |
| #else | |
| fp.x += 2; | |
| #endif | |
| } | } |
| else { | string = hdl->prm->str; |
| p.x = pt->x + MENU_DSTEXT; | if (string) { |
| p.y = pt->y + MENU_DSTEXT; | if (!(hdl->flag & MENU_GRAY)) { |
| vrammix_text(dlg->vram, hdl->c.dt.font, string, | color = MVC_TEXT; |
| } | |
| else { | |
| p.x = fp.x + MENU_DSTEXT; | |
| p.y = fp.y + MENU_DSTEXT; | |
| vrammix_text(dlg->vram, hdl->c.dt.font, string, | |
| menucolor[MVC_GRAYTEXT2], &p, rect); | menucolor[MVC_GRAYTEXT2], &p, rect); |
| color = MVC_GRAYTEXT1; | color = MVC_GRAYTEXT1; |
| } | |
| vrammix_text(dlg->vram, hdl->c.dt.font, string, | |
| menucolor[color], &fp, rect); | |
| } | } |
| p.x = pt->x; | |
| p.y = pt->y; | |
| vrammix_text(dlg->vram, hdl->c.dt.font, string, | |
| menucolor[color], &p, rect); | |
| dgtx_exit: | |
| return; | |
| } | } |
| Line 249 static BOOL dlgbase_create(MENUDLG dlg, | Line 291 static BOOL dlgbase_create(MENUDLG dlg, |
| rct.right = hdl->rect.right - hdl->rect.left - | rct.right = hdl->rect.right - hdl->rect.left - |
| ((MENU_FBORDER + MENU_BORDER) * 2); | ((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) { | if (hdl->vram == NULL) { |
| goto dbcre_err; | goto dbcre_err; |
| } | } |
| Line 337 static void dlgclose_move(MENUDLG dlg, D | Line 379 static void dlgclose_move(MENUDLG dlg, D |
| } | } |
| static void dlgclose_rel(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus) { | static void dlgclose_rel(MENUDLG dlg, DLGHDL hdl, int focus) { |
| if (focus) { | if (focus) { |
| dlg->proc(DLGMSG_CLOSE, 0, 0); | dlg->proc(DLGMSG_CLOSE, 0, 0); |
| } | } |
| (void)hdl; | (void)hdl; |
| (void)x; | |
| (void)y; | |
| } | } |
| Line 352 static void dlgclose_rel(MENUDLG dlg, DL | Line 392 static void dlgclose_rel(MENUDLG dlg, DL |
| static void dlgbtn_paint(MENUDLG dlg, DLGHDL hdl) { | static void dlgbtn_paint(MENUDLG dlg, DLGHDL hdl) { |
| POINT_T sz; | |
| POINT_T pt; | POINT_T pt; |
| UINT c; | UINT c; |
| Line 364 static void dlgbtn_paint(MENUDLG dlg, DL | Line 405 static void dlgbtn_paint(MENUDLG dlg, DL |
| } | } |
| menuvram_box2(dlg->vram, &hdl->rect, c); | menuvram_box2(dlg->vram, &hdl->rect, c); |
| if (hdl->prm) { | if (gettextsz(hdl, &sz) == SUCCESS) { |
| getmid(&pt, &hdl->rect, &hdl->c.dt.pt); | getmid(&pt, &hdl->rect, &sz); |
| if (hdl->val) { | if (hdl->val) { |
| pt.x += MENU_DSTEXT; | pt.x += MENU_DSTEXT; |
| pt.y += MENU_DSTEXT; | pt.y += MENU_DSTEXT; |
| Line 383 static void dlgbtn_onclick(MENUDLG dlg, | Line 424 static void dlgbtn_onclick(MENUDLG dlg, |
| (void)y; | (void)y; |
| } | } |
| static void dlgbtn_move(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus) { | static void dlgbtn_move(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus) { |
| if (hdl->val != focus) { | if (hdl->val != focus) { |
| Line 394 static void dlgbtn_move(MENUDLG dlg, DLG | Line 434 static void dlgbtn_move(MENUDLG dlg, DLG |
| (void)y; | (void)y; |
| } | } |
| static void dlgbtn_rel(MENUDLG dlg, DLGHDL hdl, int focus) { | |
| static void dlgbtn_rel(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus) { | if (hdl->val != 0) { |
| if (focus) { | |
| hdl->val = 0; | hdl->val = 0; |
| drawctrls(dlg, hdl); | drawctrls(dlg, hdl); |
| } | |
| if (focus) { | |
| dlg->proc(DLGMSG_COMMAND, hdl->id, 0); | dlg->proc(DLGMSG_COMMAND, hdl->id, 0); |
| } | } |
| (void)x; | |
| (void)y; | |
| } | } |
| Line 431 static void dlglist_reset(MENUDLG dlg, D | Line 470 static void dlglist_reset(MENUDLG dlg, D |
| DLGPRM next; | DLGPRM next; |
| vram_filldat(hdl->vram, NULL, 0xffffff); | vram_filldat(hdl->vram, NULL, 0xffffff); |
| dp = hdl->prm; | dp = hdl->prm; |
| while(dp) { | while(dp) { |
| next = dp->next; | next = dp->next; |
| Line 452 static BOOL dlglist_create(MENUDLG dlg, | Line 490 static BOOL dlglist_create(MENUDLG dlg, |
| width = hdl->rect.right - hdl->rect.left - (MENU_LINE * 4); | width = hdl->rect.right - hdl->rect.left - (MENU_LINE * 4); |
| height = hdl->rect.bottom - hdl->rect.top - (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) { | if (hdl->vram == NULL) { |
| goto dlcre_err; | goto dlcre_err; |
| } | } |
| Line 493 static void dlglist_drawitem(DLGHDL hdl, | Line 531 static void dlglist_drawitem(DLGHDL hdl, |
| vramcpy_cpy(hdl->vram, &fp, icon, NULL); | vramcpy_cpy(hdl->vram, &fp, icon, NULL); |
| } | } |
| fp.x += icon->width; | fp.x += icon->width; |
| } | |
| #if defined(SIZE_QVGA) | #if defined(SIZE_QVGA) |
| fp.x += 1; | fp.x += 1; |
| #else | #else |
| fp.x += 2; | fp.x += 2; |
| #endif | #endif |
| } | |
| vrammix_text(hdl->vram, hdl->c.dl.font, prm->str, | vrammix_text(hdl->vram, hdl->c.dl.font, prm->str, |
| menucolor[focus?MVC_CURTEXT:MVC_TEXT], &fp, rct); | menucolor[focus?MVC_CURTEXT:MVC_TEXT], &fp, rct); |
| } | } |
| Line 687 static BOOL dlglist_setex(MENUDLG dlg, D | Line 725 static BOOL dlglist_setex(MENUDLG dlg, D |
| } | } |
| resattachicon(dlg, dp, arg->icon, hdl->c.dl.fontsize, | resattachicon(dlg, dp, arg->icon, hdl->c.dl.fontsize, |
| hdl->c.dl.fontsize); | hdl->c.dl.fontsize); |
| milstr_ncpy(dp->str, arg->str, sizeof(dp->str)); | milsjis_ncpy(dp->str, arg->str, sizeof(dp->str)); |
| return(dlglist_drawsub(hdl, arg->pos, (arg->pos == hdl->val))); | return(dlglist_drawsub(hdl, arg->pos, (arg->pos == hdl->val))); |
| } | } |
| static int dlglist_getpos(DLGHDL hdl, int y) { | |
| int val; | |
| val = (y / hdl->c.dl.fontsize) + hdl->c.dl.basepos; | |
| if ((unsigned int)val < (unsigned int)hdl->prmcnt) { | |
| return(val); | |
| } | |
| else { | |
| return(-1); | |
| } | |
| } | |
| enum { | |
| DLCUR_OUT = -1, | |
| DLCUR_INLIST = 0, | |
| DLCUR_UP = 1, | |
| DLCUR_INBAR = 2, | |
| DLCUR_DOWN = 3, | |
| DLCUR_PGUP = 4, | |
| DLCUR_PGDN = 5 | |
| }; | |
| static int dlglist_getpc(DLGHDL hdl, int x, int y) { | static int dlglist_getpc(DLGHDL hdl, int x, int y) { |
| x -= (MENU_LINE * 2); | |
| if ((unsigned int)x >= (unsigned int)hdl->vram->width) { | if ((unsigned int)x >= (unsigned int)hdl->vram->width) { |
| goto dlgp_out; | goto dlgp_out; |
| } | } |
| y -= (MENU_LINE * 2); | |
| if ((unsigned int)y >= (unsigned int)hdl->vram->height) { | if ((unsigned int)y >= (unsigned int)hdl->vram->height) { |
| goto dlgp_out; | goto dlgp_out; |
| } | } |
| if ((hdl->prmcnt < hdl->c.dl.dispmax) || | if ((hdl->prmcnt < hdl->c.dl.dispmax) || |
| (x < (hdl->vram->width - MENUDLG_CXVSCR))) { | (x < (hdl->vram->width - MENUDLG_CXVSCR))) { |
| return(0); | return(DLCUR_INLIST); |
| } | } |
| else if (y < MENUDLG_CYVSCR) { | else if (y < MENUDLG_CYVSCR) { |
| return(1); | return(DLCUR_UP); |
| } | } |
| else if (y >= (hdl->vram->height - MENUDLG_CYVSCR)) { | else if (y >= (hdl->vram->height - MENUDLG_CYVSCR)) { |
| return(3); | return(DLCUR_DOWN); |
| } | |
| y -= MENUDLG_CYVSCR; | |
| y -= dlglist_barpos(hdl); | |
| if (y < 0) { | |
| return(DLCUR_PGUP); | |
| } | } |
| else if (hdl->c.dl.scrollbar) { | else if (y < (int)hdl->c.dl.scrollbar) { |
| return(2); | return(DLCUR_INBAR); |
| } | |
| else { | |
| return(DLCUR_PGDN); | |
| } | } |
| dlgp_out: | dlgp_out: |
| return(-1); | return(DLCUR_OUT); |
| } | } |
| static void dlglist_setval(MENUDLG dlg, DLGHDL hdl, int val) { | static void dlglist_setval(MENUDLG dlg, DLGHDL hdl, int val) { |
| Line 763 static void dlglist_setbasepos(MENUDLG d | Line 831 static void dlglist_setbasepos(MENUDLG d |
| static void dlglist_onclick(MENUDLG dlg, DLGHDL hdl, int x, int y) { | static void dlglist_onclick(MENUDLG dlg, DLGHDL hdl, int x, int y) { |
| int flg; | int flg; |
| int val; | |
| flg = dlglist_getpc(hdl, x, y); | x -= (MENU_LINE * 2); |
| y -= (MENU_LINE * 2); | y -= (MENU_LINE * 2); |
| flg = dlglist_getpc(hdl, x, y); | |
| dlg->dragflg = flg; | dlg->dragflg = flg; |
| switch(flg) { | switch(flg) { |
| case 0: | case DLCUR_INLIST: |
| dlglist_setval(dlg, hdl, (y / hdl->c.dl.fontsize) + | val = dlglist_getpos(hdl, y); |
| hdl->c.dl.basepos); | if ((val == hdl->val) && (val != -1)) { |
| dlg->proc(DLGMSG_COMMAND, hdl->id, 0); | dlg->proc(DLGMSG_COMMAND, hdl->id, 1); |
| } | |
| else { | |
| dlglist_setval(dlg, hdl, val); | |
| dlg->proc(DLGMSG_COMMAND, hdl->id, 0); | |
| } | |
| break; | break; |
| case 1: | case 1: |
| Line 781 static void dlglist_onclick(MENUDLG dlg, | Line 856 static void dlglist_onclick(MENUDLG dlg, |
| drawctrls(dlg, hdl); | drawctrls(dlg, hdl); |
| break; | break; |
| case 2: | case DLCUR_INBAR: |
| y -= MENUDLG_CYVSCR; | y -= MENUDLG_CYVSCR; |
| y -= dlglist_barpos(hdl); | y -= dlglist_barpos(hdl); |
| if ((unsigned int)y < (unsigned int)hdl->c.dl.scrollbar) { | if ((unsigned int)y < (unsigned int)hdl->c.dl.scrollbar) { |
| Line 791 static void dlglist_onclick(MENUDLG dlg, | Line 866 static void dlglist_onclick(MENUDLG dlg, |
| dlg->lasty = -1; | dlg->lasty = -1; |
| } | } |
| break; | break; |
| case DLCUR_PGUP: | |
| dlglist_setbasepos(dlg, hdl, hdl->c.dl.basepos | |
| - hdl->c.dl.dispmax); | |
| drawctrls(dlg, hdl); | |
| break; | |
| case DLCUR_PGDN: | |
| dlglist_setbasepos(dlg, hdl, hdl->c.dl.basepos | |
| + hdl->c.dl.dispmax); | |
| drawctrls(dlg, hdl); | |
| break; | |
| } | } |
| } | } |
| Line 799 static void dlglist_move(MENUDLG dlg, DL | Line 886 static void dlglist_move(MENUDLG dlg, DL |
| int flg; | int flg; |
| int height; | int height; |
| flg = dlglist_getpc(hdl, x, y); | x -= (MENU_LINE * 2); |
| y -= (MENU_LINE * 2); | y -= (MENU_LINE * 2); |
| flg = dlglist_getpc(hdl, x, y); | |
| switch(dlg->dragflg) { | switch(dlg->dragflg) { |
| case 0: | case DLCUR_INLIST: |
| if (flg == 0) { | if (flg == 0) { |
| dlglist_setval(dlg, hdl, (y / hdl->c.dl.fontsize) + | dlglist_setval(dlg, hdl, dlglist_getpos(hdl, y)); |
| hdl->c.dl.basepos); | |
| dlg->proc(DLGMSG_COMMAND, hdl->id, 0); | dlg->proc(DLGMSG_COMMAND, hdl->id, 0); |
| } | } |
| break; | break; |
| Line 816 static void dlglist_move(MENUDLG dlg, DL | Line 903 static void dlglist_move(MENUDLG dlg, DL |
| drawctrls(dlg, hdl); | drawctrls(dlg, hdl); |
| break; | break; |
| case 2: | case DLCUR_INBAR: |
| if (dlg->lasty >= 0) { | if (dlg->lasty >= 0) { |
| y -= MENUDLG_CYVSCR; | y -= MENUDLG_CYVSCR; |
| y -= dlg->lasty; | y -= dlg->lasty; |
| Line 838 static void dlglist_move(MENUDLG dlg, DL | Line 925 static void dlglist_move(MENUDLG dlg, DL |
| (void)focus; | (void)focus; |
| } | } |
| static void dlglist_rel(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus) { | static void dlglist_rel(MENUDLG dlg, DLGHDL hdl, int focus) { |
| switch(dlg->dragflg) { | switch(dlg->dragflg) { |
| case 1: | case 1: |
| Line 847 static void dlglist_rel(MENUDLG dlg, DLG | Line 934 static void dlglist_rel(MENUDLG dlg, DLG |
| drawctrls(dlg, hdl); | drawctrls(dlg, hdl); |
| break; | break; |
| } | } |
| (void)x; | |
| (void)y; | |
| (void)focus; | (void)focus; |
| } | } |
| Line 992 static void dlgslider_paint(MENUDLG dlg, | Line 1077 static void dlgslider_paint(MENUDLG dlg, |
| menuvram_res2put(dlg->vram, &src, &pt); | menuvram_res2put(dlg->vram, &src, &pt); |
| } | } |
| static void dlgslider_setval(MENUDLG dlg, DLGHDL hdl, int val) { | static void dlgslider_setval(MENUDLG dlg, DLGHDL hdl, int val) { |
| int pos; | int pos; |
| Line 1004 static void dlgslider_setval(MENUDLG dlg | Line 1088 static void dlgslider_setval(MENUDLG dlg |
| } | } |
| } | } |
| static void dlgslider_onclick(MENUDLG dlg, DLGHDL hdl, int x, int y) { | static void dlgslider_onclick(MENUDLG dlg, DLGHDL hdl, int x, int y) { |
| int width; | int width; |
| Line 1044 static void dlgslider_onclick(MENUDLG dl | Line 1127 static void dlgslider_onclick(MENUDLG dl |
| } | } |
| } | } |
| static void dlgslider_move(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus) { | static void dlgslider_move(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus) { |
| int range; | int range; |
| Line 1086 static void dlgslider_move(MENUDLG dlg, | Line 1168 static void dlgslider_move(MENUDLG dlg, |
| } | } |
| static void dlgslider_rel(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus) { | static void dlgslider_rel(MENUDLG dlg, DLGHDL hdl, int focus) { |
| if (hdl->c.ds.moving) { | if (hdl->c.ds.moving) { |
| hdl->c.ds.moving = 0; | hdl->c.ds.moving = 0; |
| drawctrls(dlg, hdl); | drawctrls(dlg, hdl); |
| } | } |
| (void)x; | |
| (void)y; | |
| (void)focus; | (void)focus; |
| } | } |
| Line 1133 static BOOL dlgtablist_create(MENUDLG dl | Line 1213 static BOOL dlgtablist_create(MENUDLG dl |
| return(SUCCESS); | return(SUCCESS); |
| } | } |
| static void dlgtablist_paint(MENUDLG dlg, DLGHDL hdl) { | static void dlgtablist_paint(MENUDLG dlg, DLGHDL hdl) { |
| VRAMHDL dst; | VRAMHDL dst; |
| Line 1239 static void dlgtablist_paint(MENUDLG dlg | Line 1318 static void dlgtablist_paint(MENUDLG dlg |
| } | } |
| } | } |
| static void dlgtablist_setval(MENUDLG dlg, DLGHDL hdl, int val) { | static void dlgtablist_setval(MENUDLG dlg, DLGHDL hdl, int val) { |
| if (hdl->val != val) { | if (hdl->val != val) { |
| Line 1248 static void dlgtablist_setval(MENUDLG dl | Line 1326 static void dlgtablist_setval(MENUDLG dl |
| } | } |
| } | } |
| static void dlgtablist_append(MENUDLG dlg, DLGHDL hdl, const void *arg) { | static void dlgtablist_append(MENUDLG dlg, DLGHDL hdl, const void *arg) { |
| DLGPRM res; | DLGPRM res; |
| Line 1268 static void dlgtablist_append(MENUDLG dl | Line 1345 static void dlgtablist_append(MENUDLG dl |
| } | } |
| } | } |
| static void dlgtablist_onclick(MENUDLG dlg, DLGHDL hdl, int x, int y) { | static void dlgtablist_onclick(MENUDLG dlg, DLGHDL hdl, int x, int y) { |
| DLGPRM prm; | DLGPRM prm; |
| Line 1358 static void dlgframe_paint(MENUDLG dlg, | Line 1434 static void dlgframe_paint(MENUDLG dlg, |
| // ---- radio | // ---- radio |
| typedef struct { | |
| MENUDLG dlg; | |
| MENUID group; | |
| } MDCB1; | |
| static void dlgradio_paint(MENUDLG dlg, DLGHDL hdl) { | static void dlgradio_paint(MENUDLG dlg, DLGHDL hdl) { |
| POINT_T pt; | POINT_T pt; |
| Line 1378 const MENURES2 *src; | Line 1459 const MENURES2 *src; |
| dlg_text(dlg, hdl, &pt, &hdl->rect); | dlg_text(dlg, hdl, &pt, &hdl->rect); |
| } | } |
| typedef struct { | |
| MENUDLG dlg; | |
| MENUID group; | |
| } MDCB1; | |
| static BOOL drsv_cb(void *vpItem, void *vpArg) { | static BOOL drsv_cb(void *vpItem, void *vpArg) { |
| DLGHDL item; | DLGHDL item; |
| Line 1412 static void dlgradio_setval(MENUDLG dlg, | Line 1487 static void dlgradio_setval(MENUDLG dlg, |
| } | } |
| } | } |
| static void dlgradio_onclick(MENUDLG dlg, DLGHDL hdl, int x, int y) { | static void dlgradio_onclick(MENUDLG dlg, DLGHDL hdl, int x, int y) { |
| if (x < (hdl->c.dt.pt.x + MENUDLG_SXRADIO)) { | if (x < (hdl->c.dt.pt.x + MENUDLG_SXRADIO)) { |
| Line 1458 static void dlgcheck_paint(MENUDLG dlg, | Line 1532 static void dlgcheck_paint(MENUDLG dlg, |
| dlg_text(dlg, hdl, &pt, &hdl->rect); | dlg_text(dlg, hdl, &pt, &hdl->rect); |
| } | } |
| static void dlgcheck_setval(MENUDLG dlg, DLGHDL hdl, int val) { | static void dlgcheck_setval(MENUDLG dlg, DLGHDL hdl, int val) { |
| if (hdl->val != val) { | if (hdl->val != val) { |
| Line 1467 static void dlgcheck_setval(MENUDLG dlg, | Line 1540 static void dlgcheck_setval(MENUDLG dlg, |
| } | } |
| } | } |
| static void dlgcheck_onclick(MENUDLG dlg, DLGHDL hdl, int x, int y) { | static void dlgcheck_onclick(MENUDLG dlg, DLGHDL hdl, int x, int y) { |
| if (x < (hdl->c.dt.pt.x + MENUDLG_SXCHECK)) { | if (x < (hdl->c.dt.pt.x + MENUDLG_SXCHECK)) { |
| Line 1482 static void dlgcheck_onclick(MENUDLG dlg | Line 1554 static void dlgcheck_onclick(MENUDLG dlg |
| static void dlgtext_paint(MENUDLG dlg, DLGHDL hdl) { | static void dlgtext_paint(MENUDLG dlg, DLGHDL hdl) { |
| POINT_T sz; | |
| POINT_T pt; | POINT_T pt; |
| void (*getpt)(POINT_T *pt, const RECT_T *rect, const POINT_T *sz); | void (*getpt)(POINT_T *pt, const RECT_T *rect, const POINT_T *sz); |
| vram_filldat(dlg->vram, &hdl->rect, menucolor[MVC_STATIC]); | vram_filldat(dlg->vram, &hdl->rect, menucolor[MVC_STATIC]); |
| if (hdl->prm) { | if (gettextsz(hdl, &sz) == SUCCESS) { |
| switch(hdl->flag & MST_POSMASK) { | switch(hdl->flag & MST_POSMASK) { |
| case MST_LEFT: | case MST_LEFT: |
| default: | default: |
| Line 1501 static void dlgtext_paint(MENUDLG dlg, D | Line 1574 static void dlgtext_paint(MENUDLG dlg, D |
| getpt = getright; | getpt = getright; |
| break; | break; |
| } | } |
| getpt(&pt, &hdl->rect, &hdl->c.dt.pt); | getpt(&pt, &hdl->rect, &sz); |
| dlg_text(dlg, hdl, &pt, &hdl->rect); | dlg_text(dlg, hdl, &pt, &hdl->rect); |
| } | } |
| } | } |
| static void dlgtext_itemset(MENUDLG dlg, DLGHDL hdl, const void *arg) { | |
| static void dlgtext_itemset(MENUDLG dlg, DLGHDL hdl, const void *str) { | const void *str; |
| if (hdl->prm) { | if (hdl->prm) { |
| if (str) { | str = (char *)arg; |
| milstr_ncpy(hdl->prm->str, (char *)str, sizeof(hdl->prm->str)); | if (str == NULL) { |
| fontmng_getsize(hdl->c.dt.font, (char *)str, &hdl->c.dt.pt); | str = str_null; |
| } | |
| else { | |
| hdl->prm->str[0] = '\0'; | |
| hdl->c.dt.pt.x = 0; | |
| } | } |
| milsjis_ncpy(hdl->prm->str, str, sizeof(hdl->prm->str)); | |
| fontmng_getsize(hdl->c.dt.font, str, &hdl->c.dt.pt); | |
| } | |
| (void)dlg; | |
| } | |
| static void dlgtext_iconset(MENUDLG dlg, DLGHDL hdl, const void *arg) { | |
| if (hdl->prm) { | |
| resattachicon(dlg, hdl->prm, (UINT16)(long)arg, | |
| hdl->c.dt.pt.y, hdl->c.dt.pt.y); | |
| } | } |
| (void)dlg; | (void)dlg; |
| } | } |
| Line 1643 static void _setval(MENUDLG dlg, DLGHDL | Line 1724 static void _setval(MENUDLG dlg, DLGHDL |
| (void)val; | (void)val; |
| } | } |
| static void _moverel(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus) { | static void _moverel(MENUDLG dlg, DLGHDL hdl, int focus) { |
| (void)dlg; | (void)dlg; |
| (void)hdl; | (void)hdl; |
| (void)x; | |
| (void)y; | |
| (void)focus; | (void)focus; |
| } | } |
| Line 1657 typedef void (*DLGPAINT)(MENUDLG dlg, DL | Line 1736 typedef void (*DLGPAINT)(MENUDLG dlg, DL |
| typedef void (*DLGSETVAL)(MENUDLG dlg, DLGHDL hdl, int val); | typedef void (*DLGSETVAL)(MENUDLG dlg, DLGHDL hdl, int val); |
| typedef void (*DLGCLICK)(MENUDLG dlg, DLGHDL hdl, int x, int y); | typedef void (*DLGCLICK)(MENUDLG dlg, DLGHDL hdl, int x, int y); |
| typedef void (*DLGMOV)(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus); | typedef void (*DLGMOV)(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus); |
| typedef void (*DLGREL)(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus); | typedef void (*DLGREL)(MENUDLG dlg, DLGHDL hdl, int focus); |
| static const DLGCRE dlgcre[] = { | static const DLGCRE dlgcre[] = { |
| dlgbase_create, // DLGTYPE_BASE | dlgbase_create, // DLGTYPE_BASE |
| Line 1870 BOOL menudlg_create(int width, int heigh | Line 1949 BOOL menudlg_create(int width, int heigh |
| MENUDLG_CYCAPTION + MENUDLG_BORDER; | MENUDLG_CYCAPTION + MENUDLG_BORDER; |
| mb = &menubase; | mb = &menubase; |
| dlg->font = mb->font; | 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) { | if (dlg->vram == NULL) { |
| goto mdcre_err; | goto mdcre_err; |
| } | } |
| Line 1969 BOOL menudlg_appends(const MENUPRM *res, | Line 2048 BOOL menudlg_appends(const MENUPRM *res, |
| return(r); | return(r); |
| } | } |
| BOOL menudlg_append(int type, MENUID id, MENUFLG flg, const void *arg, | BOOL menudlg_append(int type, MENUID id, MENUFLG flg, const void *arg, |
| int posx, int posy, int width, int height) { | int posx, int posy, int width, int height) { |
| Line 2101 void menudlg_moving(int x, int y, int bt | Line 2179 void menudlg_moving(int x, int y, int bt |
| dlg->btn = 0; | dlg->btn = 0; |
| if ((unsigned int)hdl->type < | if ((unsigned int)hdl->type < |
| (sizeof(dlgrel)/sizeof(DLGREL))) { | (sizeof(dlgrel)/sizeof(DLGREL))) { |
| dlgrel[hdl->type](dlg, hdl, x, y, focus); | dlgrel[hdl->type](dlg, hdl, focus); |
| } | } |
| } | } |
| } | } |
| Line 2180 void *menudlg_msg(int ctrl, MENUID id, v | Line 2258 void *menudlg_msg(int ctrl, MENUID id, v |
| case DMSG_SETTEXT: | case DMSG_SETTEXT: |
| switch(hdl->type) { | switch(hdl->type) { |
| case DLGTYPE_BUTTON: | |
| case DLGTYPE_RADIO: | case DLGTYPE_RADIO: |
| case DLGTYPE_CHECK: | case DLGTYPE_CHECK: |
| case DLGTYPE_EDIT: | case DLGTYPE_EDIT: |
| Line 2190 void *menudlg_msg(int ctrl, MENUID id, v | Line 2269 void *menudlg_msg(int ctrl, MENUID id, v |
| } | } |
| break; | break; |
| case DMSG_SETICON: | |
| switch(hdl->type) { | |
| case DLGTYPE_BUTTON: | |
| case DLGTYPE_RADIO: | |
| case DLGTYPE_CHECK: | |
| case DLGTYPE_EDIT: | |
| case DLGTYPE_TEXT: | |
| dlgtext_iconset(dlg, hdl, arg); | |
| drawctrls(dlg, hdl); | |
| break; | |
| } | |
| break; | |
| case DMSG_ITEMAPPEND: | case DMSG_ITEMAPPEND: |
| switch(hdl->type) { | switch(hdl->type) { |
| case DLGTYPE_LIST: | case DLGTYPE_LIST: |
| Line 2206 void *menudlg_msg(int ctrl, MENUID id, v | Line 2298 void *menudlg_msg(int ctrl, MENUID id, v |
| break; | break; |
| case DMSG_ITEMRESET: | case DMSG_ITEMRESET: |
| if ((dlg->btn) && (dlg->lastid == hdl->id)) { | |
| dlg->btn = 0; | |
| if ((unsigned int)hdl->type < | |
| (sizeof(dlgrel)/sizeof(DLGREL))) { | |
| dlgrel[hdl->type](dlg, hdl, FALSE); | |
| } | |
| } | |
| if (hdl->type == DLGTYPE_LIST) { | if (hdl->type == DLGTYPE_LIST) { |
| dlglist_reset(dlg, hdl); | dlglist_reset(dlg, hdl); |
| drawctrls(dlg, hdl); | drawctrls(dlg, hdl); |