|
|
| version 1.2, 2003/11/21 09:28:02 | version 1.9, 2005/02/11 21:17:22 |
|---|---|
| Line 12 struct _dprm *next; | Line 12 struct _dprm *next; |
| UINT16 width; | UINT16 width; |
| UINT16 num; | UINT16 num; |
| VRAMHDL icon; | VRAMHDL icon; |
| char str[96]; | OEMCHAR str[96]; |
| } _DLGPRM, *DLGPRM; | } _DLGPRM, *DLGPRM; |
| #define PRMNEXT_EMPTY ((DLGPRM)-1) | #define PRMNEXT_EMPTY ((DLGPRM)-1) |
| Line 29 typedef struct { | Line 29 typedef struct { |
| typedef struct { | typedef struct { |
| void *font; | void *font; |
| short fontsize; | SINT16 fontsize; |
| short scrollbar; | SINT16 scrollbar; |
| short dispmax; | SINT16 dispmax; |
| short basepos; | SINT16 basepos; |
| } DLGLIST; | } DLGLIST; |
| typedef struct { | typedef struct { |
| short minval; | SINT16 minval; |
| short maxval; | SINT16 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 104 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); |
| } | } |
| static DLGPRM resappend(MENUDLG dlg, const char *str) { | static DLGPRM resappend(MENUDLG dlg, const OEMCHAR *str) { |
| DLGPRM prm; | DLGPRM prm; |
| Line 122 static DLGPRM resappend(MENUDLG dlg, con | Line 123 static DLGPRM resappend(MENUDLG dlg, con |
| prm->icon = NULL; | prm->icon = NULL; |
| prm->str[0] = '\0'; | prm->str[0] = '\0'; |
| if (str) { | if (str) { |
| milstr_ncpy(prm->str, str, sizeof(prm->str)); | milstr_ncpy(prm->str, str, NELEMENTS(prm->str)); |
| } | } |
| } | } |
| return(prm); | return(prm); |
| Line 155 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 164 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) { | static BRESULT gettextsz(DLGHDL hdl, POINT_T *sz) { |
| DLGPRM prm; | DLGPRM prm; |
| Line 224 static void getmid(POINT_T *pt, const RE | Line 223 static void getmid(POINT_T *pt, const RE |
| } | } |
| static BOOL _cre_settext(MENUDLG dlg, DLGHDL hdl, const void *arg) { | static BRESULT _cre_settext(MENUDLG dlg, DLGHDL hdl, const void *arg) { |
| const char *str; | const OEMCHAR *str; |
| str = (char *)arg; | str = (OEMCHAR *)arg; |
| if (str == NULL) { | if (str == NULL) { |
| str = str_null; | str = str_null; |
| } | } |
| Line 241 const char *str; | Line 240 const char *str; |
| 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; | VRAMHDL icon; |
| const char *string; | const OEMCHAR *string; |
| int color; | int color; |
| POINT_T fp; | POINT_T fp; |
| POINT_T p; | POINT_T p; |
| if (hdl->prm == NULL) { | if (hdl->prm == NULL) { |
| return; | return; |
| Line 286 const char *string; | Line 285 const char *string; |
| // ---- base | // ---- base |
| static BOOL dlgbase_create(MENUDLG dlg, DLGHDL hdl, const void *arg) { | static BRESULT dlgbase_create(MENUDLG dlg, DLGHDL hdl, const void *arg) { |
| RECT_T rct; | RECT_T rct; |
| 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 301 static BOOL dlgbase_create(MENUDLG dlg, | Line 300 static BOOL dlgbase_create(MENUDLG dlg, |
| rct.left = 0; | rct.left = 0; |
| rct.top = 0; | rct.top = 0; |
| rct.bottom = MENUDLG_CYCAPTION; | rct.bottom = MENUDLG_CYCAPTION; |
| menuvram_caption(hdl->vram, &rct, MICON_NULL, (char *)arg); | menuvram_caption(hdl->vram, &rct, MICON_NULL, (OEMCHAR *)arg); |
| return(SUCCESS); | return(SUCCESS); |
| dbcre_err: | dbcre_err: |
| Line 312 dbcre_err: | Line 311 dbcre_err: |
| static void dlgbase_paint(MENUDLG dlg, DLGHDL hdl) { | static void dlgbase_paint(MENUDLG dlg, DLGHDL hdl) { |
| char *title; | OEMCHAR *title; |
| title = NULL; | title = NULL; |
| if (hdl->prm) { | if (hdl->prm) { |
| Line 380 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 427 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 438 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 464 static void *dlglist_setfont(DLGHDL hdl, | Line 459 static void *dlglist_setfont(DLGHDL hdl, |
| if ((pt.y <= 0) || (pt.y >= 65536)) { | if ((pt.y <= 0) || (pt.y >= 65536)) { |
| pt.y = 16; | pt.y = 16; |
| } | } |
| hdl->c.dl.fontsize = (short)pt.y; | hdl->c.dl.fontsize = (SINT16)pt.y; |
| hdl->c.dl.dispmax = (short)(hdl->vram->height / pt.y); | hdl->c.dl.dispmax = (SINT16)(hdl->vram->height / pt.y); |
| return(ret); | return(ret); |
| } | } |
| Line 475 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 489 static void dlglist_reset(MENUDLG dlg, D | Line 483 static void dlglist_reset(MENUDLG dlg, D |
| hdl->c.dl.basepos = 0; | hdl->c.dl.basepos = 0; |
| } | } |
| static BOOL dlglist_create(MENUDLG dlg, DLGHDL hdl, const void *arg) { | static BRESULT dlglist_create(MENUDLG dlg, DLGHDL hdl, const void *arg) { |
| int width; | int width; |
| int height; | int height; |
| 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 689 static BOOL dlglist_append(MENUDLG dlg, | Line 683 static BOOL dlglist_append(MENUDLG dlg, |
| while(*sto) { | while(*sto) { |
| sto = &((*sto)->next); | sto = &((*sto)->next); |
| } | } |
| *sto = resappend(dlg, (char *)arg); | *sto = resappend(dlg, (OEMCHAR *)arg); |
| if (*sto) { | if (*sto) { |
| r = dlglist_drawsub(hdl, hdl->prmcnt, FALSE); | r = dlglist_drawsub(hdl, hdl->prmcnt, FALSE); |
| hdl->prmcnt++; | hdl->prmcnt++; |
| Line 731 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)); | milstr_ncpy(dp->str, arg->str, NELEMENTS(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, | |
| DLCUR_INCUR = 6 | |
| }; | |
| 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); |
| } | } |
| else if (hdl->c.dl.scrollbar) { | y -= MENUDLG_CYVSCR; |
| return(2); | y -= dlglist_barpos(hdl); |
| if (y < 0) { | |
| return(DLCUR_PGUP); | |
| } | |
| else if (y < (int)hdl->c.dl.scrollbar) { | |
| 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 807 static void dlglist_setbasepos(MENUDLG d | Line 832 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->dragflg = DLCUR_INCUR; | |
| } | |
| dlglist_setval(dlg, hdl, val); | |
| dlg->proc(DLGMSG_COMMAND, hdl->id, 0); | dlg->proc(DLGMSG_COMMAND, hdl->id, 0); |
| break; | break; |
| Line 825 static void dlglist_onclick(MENUDLG dlg, | Line 855 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 835 static void dlglist_onclick(MENUDLG dlg, | Line 865 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; | |
| } | } |
| } | } |
| static void dlglist_move(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus) { | static void dlglist_move(MENUDLG dlg, DLGHDL hdl, int x, int y, int focus) { |
| int flg; | int flg; |
| int val; | |
| 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) { | case DLCUR_INCUR: |
| dlglist_setval(dlg, hdl, (y / hdl->c.dl.fontsize) + | if (flg == DLCUR_INLIST) { |
| hdl->c.dl.basepos); | val = dlglist_getpos(hdl, y); |
| dlg->proc(DLGMSG_COMMAND, hdl->id, 0); | if (val != hdl->val) { |
| dlg->dragflg = DLCUR_INLIST; | |
| dlglist_setval(dlg, hdl, val); | |
| dlg->proc(DLGMSG_COMMAND, hdl->id, 0); | |
| } | |
| } | } |
| break; | break; |
| Line 860 static void dlglist_move(MENUDLG dlg, DL | Line 908 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 882 static void dlglist_move(MENUDLG dlg, DL | Line 930 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 890 static void dlglist_rel(MENUDLG dlg, DLG | Line 938 static void dlglist_rel(MENUDLG dlg, DLG |
| dlglist_setbtn(hdl, dlg->dragflg - 1); | dlglist_setbtn(hdl, dlg->dragflg - 1); |
| drawctrls(dlg, hdl); | drawctrls(dlg, hdl); |
| break; | break; |
| case DLCUR_INCUR: | |
| dlg->proc(DLGMSG_COMMAND, hdl->id, 1); | |
| break; | |
| } | } |
| (void)x; | |
| (void)y; | |
| (void)focus; | (void)focus; |
| } | } |
| Line 919 static void dlgslider_setflag(DLGHDL hdl | Line 969 static void dlgslider_setflag(DLGHDL hdl |
| else { | else { |
| type = 2 + (21 << 8) + (11 << 16); | type = 2 + (21 << 8) + (11 << 16); |
| } | } |
| hdl->c.ds.type = (BYTE)type; | hdl->c.ds.type = (UINT8)type; |
| if (!(hdl->flag & MSS_VERT)) { | if (!(hdl->flag & MSS_VERT)) { |
| hdl->c.ds.sldh = (BYTE)(type >> 16); | hdl->c.ds.sldh = (UINT8)(type >> 16); |
| hdl->c.ds.sldv = (BYTE)(type >> 8); | hdl->c.ds.sldv = (UINT8)(type >> 8); |
| } | } |
| else { | else { |
| hdl->c.ds.sldh = (BYTE)(type >> 8); | hdl->c.ds.sldh = (UINT8)(type >> 8); |
| hdl->c.ds.sldv = (BYTE)(type >> 16); | hdl->c.ds.sldv = (UINT8)(type >> 16); |
| } | } |
| } | } |
| Line 971 static int dlgslider_setpos(DLGHDL hdl, | Line 1021 static int dlgslider_setpos(DLGHDL hdl, |
| return(val); | return(val); |
| } | } |
| static BOOL dlgslider_create(MENUDLG dlg, DLGHDL hdl, const void *arg) { | static BRESULT dlgslider_create(MENUDLG dlg, DLGHDL hdl, const void *arg) { |
| hdl->c.ds.minval = (short)(long)arg; | hdl->c.ds.minval = (SINT16)(long)arg; |
| hdl->c.ds.maxval = (short)((long)arg >> 16); | hdl->c.ds.maxval = (SINT16)((long)arg >> 16); |
| hdl->c.ds.moving = 0; | hdl->c.ds.moving = 0; |
| dlgslider_setflag(hdl); | dlgslider_setflag(hdl); |
| hdl->c.ds.pos = dlgslider_setpos(hdl, 0); | hdl->c.ds.pos = dlgslider_setpos(hdl, 0); |
| Line 1036 static void dlgslider_paint(MENUDLG dlg, | Line 1086 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 1048 static void dlgslider_setval(MENUDLG dlg | Line 1097 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 1088 static void dlgslider_onclick(MENUDLG dl | Line 1136 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 1130 static void dlgslider_move(MENUDLG dlg, | Line 1177 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 1166 static void *dlgtablist_setfont(DLGHDL h | Line 1211 static void *dlgtablist_setfont(DLGHDL h |
| return(ret); | return(ret); |
| } | } |
| static BOOL dlgtablist_create(MENUDLG dlg, DLGHDL hdl, const void *arg) { | static BRESULT dlgtablist_create(MENUDLG dlg, DLGHDL hdl, const void *arg) { |
| RECT_T rct; | RECT_T rct; |
| Line 1177 static BOOL dlgtablist_create(MENUDLG dl | Line 1222 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 1283 static void dlgtablist_paint(MENUDLG dlg | Line 1327 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 1292 static void dlgtablist_setval(MENUDLG dl | Line 1335 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 1303 static void dlgtablist_append(MENUDLG dl | Line 1345 static void dlgtablist_append(MENUDLG dl |
| while(*sto) { | while(*sto) { |
| sto = &((*sto)->next); | sto = &((*sto)->next); |
| } | } |
| res = resappend(dlg, (char *)arg); | res = resappend(dlg, (OEMCHAR *)arg); |
| if (res) { | if (res) { |
| *sto = res; | *sto = res; |
| fontmng_getsize(hdl->c.dtl.font, (char *)arg, &pt); | fontmng_getsize(hdl->c.dtl.font, (OEMCHAR *)arg, &pt); |
| res->width = pt.x; | res->width = pt.x; |
| hdl->prmcnt++; | hdl->prmcnt++; |
| } | } |
| } | } |
| 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 1344 static void dlgtablist_onclick(MENUDLG d | Line 1385 static void dlgtablist_onclick(MENUDLG d |
| static void dlgedit_paint(MENUDLG dlg, DLGHDL hdl) { | static void dlgedit_paint(MENUDLG dlg, DLGHDL hdl) { |
| RECT_T rct; | RECT_T rct; |
| POINT_T pt; | POINT_T pt; |
| const char *string; | const OEMCHAR *string; |
| rct = hdl->rect; | rct = hdl->rect; |
| menuvram_box2(dlg->vram, &rct, | menuvram_box2(dlg->vram, &rct, |
| Line 1402 static void dlgframe_paint(MENUDLG dlg, | Line 1443 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 1422 const MENURES2 *src; | Line 1468 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 1456 static void dlgradio_setval(MENUDLG dlg, | Line 1496 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 1502 static void dlgcheck_paint(MENUDLG dlg, | Line 1541 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 1511 static void dlgcheck_setval(MENUDLG dlg, | Line 1549 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 1553 static void dlgtext_paint(MENUDLG dlg, D | Line 1590 static void dlgtext_paint(MENUDLG dlg, D |
| static void dlgtext_itemset(MENUDLG dlg, DLGHDL hdl, const void *arg) { | static void dlgtext_itemset(MENUDLG dlg, DLGHDL hdl, const void *arg) { |
| const void *str; | const OEMCHAR *str; |
| if (hdl->prm) { | if (hdl->prm) { |
| str = (char *)arg; | str = (OEMCHAR *)arg; |
| if (str == NULL) { | if (str == NULL) { |
| str = str_null; | str = str_null; |
| } | } |
| milstr_ncpy(hdl->prm->str, str, sizeof(hdl->prm->str)); | milstr_ncpy(hdl->prm->str, str, NELEMENTS(hdl->prm->str)); |
| fontmng_getsize(hdl->c.dt.font, str, &hdl->c.dt.pt); | fontmng_getsize(hdl->c.dt.font, str, &hdl->c.dt.pt); |
| } | } |
| (void)dlg; | (void)dlg; |
| Line 1602 static void iconpaint(MENUDLG dlg, DLGHD | Line 1639 static void iconpaint(MENUDLG dlg, DLGHD |
| } | } |
| } | } |
| static BOOL dlgicon_create(MENUDLG dlg, DLGHDL hdl, const void *arg) { | static BRESULT dlgicon_create(MENUDLG dlg, DLGHDL hdl, const void *arg) { |
| hdl->prm = resappend(dlg, NULL); | hdl->prm = resappend(dlg, NULL); |
| resattachicon(dlg, hdl->prm, (UINT16)(long)arg, | resattachicon(dlg, hdl->prm, (UINT16)(long)arg, |
| Line 1620 static void dlgicon_paint(MENUDLG dlg, D | Line 1657 static void dlgicon_paint(MENUDLG dlg, D |
| } | } |
| } | } |
| static BOOL dlgvram_create(MENUDLG dlg, DLGHDL hdl, const void *arg) { | static BRESULT dlgvram_create(MENUDLG dlg, DLGHDL hdl, const void *arg) { |
| hdl->c.dv.vram = (VRAMHDL)arg; | hdl->c.dv.vram = (VRAMHDL)arg; |
| (void)dlg; | (void)dlg; |
| Line 1663 static void dlgbox_paint(MENUDLG dlg, DL | Line 1700 static void dlgbox_paint(MENUDLG dlg, DL |
| // ---- procs | // ---- procs |
| static BOOL _cre(MENUDLG dlg, DLGHDL hdl, const void *arg) { | static BRESULT _cre(MENUDLG dlg, DLGHDL hdl, const void *arg) { |
| (void)dlg; | (void)dlg; |
| (void)hdl; | (void)hdl; |
| (void)arg; | (void)arg; |
| return(0); | return(SUCCESS); |
| } | } |
| #if 0 // not used | #if 0 // not used |
| Line 1696 static void _setval(MENUDLG dlg, DLGHDL | Line 1733 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; |
| } | } |
| typedef BOOL (*DLGCRE)(MENUDLG dlg, DLGHDL hdl, const void *arg); | typedef BRESULT (*DLGCRE)(MENUDLG dlg, DLGHDL hdl, const void *arg); |
| typedef void (*DLGPAINT)(MENUDLG dlg, DLGHDL hdl); | typedef void (*DLGPAINT)(MENUDLG dlg, DLGHDL hdl); |
| 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 1836 static BOOL dc_cb2(void *vpItem, void *v | Line 1871 static BOOL dc_cb2(void *vpItem, void *v |
| if (hdl->flag & MENU_REDRAW) { | if (hdl->flag & MENU_REDRAW) { |
| hdl->flag &= ~MENU_REDRAW; | hdl->flag &= ~MENU_REDRAW; |
| if ((!(hdl->flag & MENU_DISABLE)) && | if ((!(hdl->flag & MENU_DISABLE)) && |
| ((unsigned int)hdl->type < (sizeof(dlgpaint)/sizeof(DLGPAINT)))) { | ((UINT)hdl->type < NELEMENTS(dlgpaint))) { |
| dlgpaint[hdl->type](dlg, hdl); | dlgpaint[hdl->type](dlg, hdl); |
| menubase_setrect(dlg->vram, &hdl->rect); | menubase_setrect(dlg->vram, &hdl->rect); |
| } | } |
| Line 1904 static int defproc(int msg, MENUID id, l | Line 1939 static int defproc(int msg, MENUID id, l |
| } | } |
| BOOL menudlg_create(int width, int height, const char *str, | BRESULT menudlg_create(int width, int height, const OEMCHAR *str, |
| int (*proc)(int msg, MENUID id, long param)) { | int (*proc)(int msg, MENUID id, long param)) { |
| MENUBASE *mb; | MENUBASE *mb; |
| Line 1923 BOOL menudlg_create(int width, int heigh | Line 1958 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 2009 void menudlg_destroy(void) { | Line 2044 void menudlg_destroy(void) { |
| // ---- | // ---- |
| BOOL menudlg_appends(const MENUPRM *res, int count) { | BRESULT menudlg_appends(const MENUPRM *res, int count) { |
| BOOL r; | BRESULT r; |
| r = SUCCESS; | r = SUCCESS; |
| while(count--) { | while(count--) { |
| Line 2022 BOOL menudlg_appends(const MENUPRM *res, | Line 2057 BOOL menudlg_appends(const MENUPRM *res, |
| return(r); | return(r); |
| } | } |
| BRESULT 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) { |
| MENUDLG dlg; | MENUDLG dlg; |
| Line 2068 BOOL menudlg_append(int type, MENUID id, | Line 2102 BOOL menudlg_append(int type, MENUID id, |
| dhdl.prm = NULL; | dhdl.prm = NULL; |
| dhdl.prmcnt = 0; | dhdl.prmcnt = 0; |
| dhdl.val = 0; | dhdl.val = 0; |
| if (((unsigned int)type >= (sizeof(dlgcre)/sizeof(DLGCRE))) || | if (((UINT)type >= NELEMENTS(dlgcre)) || |
| (dlgcre[type](dlg, &dhdl, arg))) { | (dlgcre[type](dlg, &dhdl, arg))) { |
| goto mda_err; | goto mda_err; |
| } | } |
| Line 2134 void menudlg_moving(int x, int y, int bt | Line 2168 void menudlg_moving(int x, int y, int bt |
| y -= hdl->rect.top; | y -= hdl->rect.top; |
| dlg->btn = 1; | dlg->btn = 1; |
| dlg->lastid = hdl->id; | dlg->lastid = hdl->id; |
| if ((unsigned int)hdl->type < | if ((UINT)hdl->type < NELEMENTS(dlgclick)) { |
| (sizeof(dlgclick)/sizeof(DLGCLICK))) { | |
| dlgclick[hdl->type](dlg, hdl, x, y); | dlgclick[hdl->type](dlg, hdl, x, y); |
| } | } |
| } | } |
| Line 2147 void menudlg_moving(int x, int y, int bt | Line 2180 void menudlg_moving(int x, int y, int bt |
| focus = rect_in(&hdl->rect, x, y); | focus = rect_in(&hdl->rect, x, y); |
| x -= hdl->rect.left; | x -= hdl->rect.left; |
| y -= hdl->rect.top; | 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); | dlgmov[hdl->type](dlg, hdl, x, y, focus); |
| } | } |
| if (btn == 2) { | if (btn == 2) { |
| dlg->btn = 0; | dlg->btn = 0; |
| if ((unsigned int)hdl->type < | if ((UINT)hdl->type < NELEMENTS(dlgrel)) { |
| (sizeof(dlgrel)/sizeof(DLGREL))) { | dlgrel[hdl->type](dlg, hdl, focus); |
| dlgrel[hdl->type](dlg, hdl, x, y, focus); | |
| } | } |
| } | } |
| } | } |
| Line 2213 void *menudlg_msg(int ctrl, MENUID id, v | Line 2245 void *menudlg_msg(int ctrl, MENUID id, v |
| case DMSG_SETVAL: | case DMSG_SETVAL: |
| ret = (void *)hdl->val; | ret = (void *)hdl->val; |
| if ((unsigned int)hdl->type < | if ((UINT)hdl->type < NELEMENTS(dlgsetval)) { |
| (sizeof(dlgsetval)/sizeof(DLGSETVAL))) { | |
| dlgsetval[hdl->type](dlg, hdl, (int)arg); | dlgsetval[hdl->type](dlg, hdl, (int)arg); |
| } | } |
| break; | break; |
| Line 2273 void *menudlg_msg(int ctrl, MENUID id, v | Line 2304 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 ((UINT)hdl->type < NELEMENTS(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); |