src/mess/osd/windows/dialog.c
| r7991 | r7992 | |
| 1298 | 1298 | // win_dialog_add_seqselect |
| 1299 | 1299 | //============================================================ |
| 1300 | 1300 | |
| 1301 | | int win_dialog_add_portselect(dialog_box *dialog, const input_field_config *field, const RECT *r) |
| 1301 | int win_dialog_add_portselect(dialog_box *dialog, const input_field_config *field) |
| 1302 | 1302 | { |
| 1303 | 1303 | dialog_box *di = dialog; |
| 1304 | 1304 | short x; |
| r7991 | r7992 | |
| 1356 | 1356 | strcpy(s + len, port_suffix[seq]); |
| 1357 | 1357 | this_port_name = s; |
| 1358 | 1358 | |
| 1359 | | if (!r) |
| 1360 | | { |
| 1361 | | // no positions specified |
| 1362 | | dialog_new_control(di, &x, &y); |
| 1359 | // no positions specified |
| 1360 | dialog_new_control(di, &x, &y); |
| 1363 | 1361 | |
| 1364 | | if (dialog_write_item(di, WS_CHILD | WS_VISIBLE | SS_LEFT | SS_NOPREFIX, x, y, |
| 1365 | | dialog->layout->label_width, DIM_NORMAL_ROW_HEIGHT, this_port_name, DLGITEM_STATIC, NULL)) |
| 1366 | | return 1; |
| 1367 | | x += dialog->layout->label_width + DIM_HORIZONTAL_SPACING; |
| 1362 | if (dialog_write_item(di, WS_CHILD | WS_VISIBLE | SS_LEFT | SS_NOPREFIX, x, y, |
| 1363 | dialog->layout->label_width, DIM_NORMAL_ROW_HEIGHT, this_port_name, DLGITEM_STATIC, NULL)) |
| 1364 | return 1; |
| 1365 | x += dialog->layout->label_width + DIM_HORIZONTAL_SPACING; |
| 1368 | 1366 | |
| 1369 | | if (dialog_add_single_seqselect(di, x, y, DIM_EDIT_WIDTH, DIM_NORMAL_ROW_HEIGHT, |
| 1370 | | field, is_analog[seq], seq_types[seq])) |
| 1371 | | return 1; |
| 1372 | | y += DIM_VERTICAL_SPACING + DIM_NORMAL_ROW_HEIGHT; |
| 1373 | | x += DIM_EDIT_WIDTH + DIM_HORIZONTAL_SPACING; |
| 1367 | if (dialog_add_single_seqselect(di, x, y, DIM_EDIT_WIDTH, DIM_NORMAL_ROW_HEIGHT, |
| 1368 | field, is_analog[seq], seq_types[seq])) |
| 1369 | return 1; |
| 1370 | y += DIM_VERTICAL_SPACING + DIM_NORMAL_ROW_HEIGHT; |
| 1371 | x += DIM_EDIT_WIDTH + DIM_HORIZONTAL_SPACING; |
| 1374 | 1372 | |
| 1375 | | dialog_finish_control(di, x, y); |
| 1376 | | } |
| 1377 | | else |
| 1378 | | { |
| 1379 | | // positions specified |
| 1380 | | x = r[seq].left; |
| 1381 | | y = r[seq].top; |
| 1382 | | width = r[seq].right - r[seq].left; |
| 1383 | | height = r[seq].bottom - r[seq].top; |
| 1384 | | |
| 1385 | | calc_dlgunits_multiple(); |
| 1386 | | x /= pixels_to_xdlgunits; |
| 1387 | | y /= pixels_to_ydlgunits; |
| 1388 | | width /= pixels_to_xdlgunits; |
| 1389 | | height /= pixels_to_ydlgunits; |
| 1390 | | |
| 1391 | | if (dialog_add_single_seqselect(di, x, y, width, height, |
| 1392 | | field, is_analog[seq], seq_types[seq])) |
| 1393 | | return 1; |
| 1394 | | } |
| 1373 | dialog_finish_control(di, x, y); |
| 1395 | 1374 | } |
| 1396 | 1375 | return 0; |
| 1397 | 1376 | } |
src/mess/osd/windows/menu.c
| r7991 | r7992 | |
| 100 | 100 | |
| 101 | 101 | static int add_filter_entry(char *dest, size_t dest_len, const char *description, const char *extensions); |
| 102 | 102 | |
| 103 | | /*************************************************************************** |
| 104 | 103 | |
| 105 | | Constants |
| 106 | 104 | |
| 107 | | ***************************************************************************/ |
| 108 | | |
| 109 | | typedef enum |
| 110 | | { |
| 111 | | ARTWORK_CUSTTYPE_JOYSTICK = 0, |
| 112 | | ARTWORK_CUSTTYPE_KEYBOARD, |
| 113 | | ARTWORK_CUSTTYPE_MISC, |
| 114 | | ARTWORK_CUSTTYPE_INVALID |
| 115 | | } artwork_cust_type; |
| 116 | | |
| 117 | | |
| 118 | | |
| 119 | | /*************************************************************************** |
| 120 | | |
| 121 | | Type definitions |
| 122 | | |
| 123 | | ***************************************************************************/ |
| 124 | | |
| 125 | | struct inputform_customization |
| 126 | | { |
| 127 | | UINT32 ipt; |
| 128 | | int x, y; |
| 129 | | int width, height; |
| 130 | | }; |
| 131 | | |
| 132 | | |
| 133 | 105 | //============================================================ |
| 134 | | // artwork_get_inputscreen_customizations |
| 135 | | //============================================================ |
| 136 | | |
| 137 | | int artwork_get_inputscreen_customizations(struct inputform_customization *customizations, int customizations_length) |
| 138 | | { |
| 139 | | /* terminate list */ |
| 140 | | customizations->ipt = IPT_END; |
| 141 | | customizations->x = -1; |
| 142 | | customizations->y = -1; |
| 143 | | customizations->width = -1; |
| 144 | | customizations->height = -1; |
| 145 | | |
| 146 | | return 0; |
| 147 | | } |
| 148 | | |
| 149 | | |
| 150 | | //============================================================ |
| 151 | 106 | // input_item_from_serial_number |
| 152 | 107 | //============================================================ |
| 153 | 108 | |
| r7991 | r7992 | |
| 237 | 192 | dialog_box *dlg; |
| 238 | 193 | const input_port_config *port; |
| 239 | 194 | const input_field_config *field; |
| 240 | | struct inputform_customization customizations[128]; |
| 241 | | RECT *pr; |
| 242 | | int this_inputclass, this_player, portslot_count, i; |
| 195 | int this_inputclass, this_player, portslot_count = 0, i; |
| 243 | 196 | |
| 244 | 197 | struct |
| 245 | 198 | { |
| 246 | 199 | const input_field_config *field; |
| 247 | | const RECT *pr; |
| 248 | 200 | } portslots[256]; |
| 249 | 201 | |
| 250 | | /* check to see if there is any custom artwork for this configure dialog, |
| 251 | | * and if so, retrieve the info */ |
| 252 | | portslot_count = artwork_get_inputscreen_customizations(customizations, ARRAY_LENGTH(customizations)); |
| 253 | | |
| 254 | | /* zero out the portslots that correspond to customizations */ |
| 255 | | memset(portslots, 0, sizeof(portslots[0]) * portslot_count); |
| 256 | | |
| 257 | 202 | /* create the dialog */ |
| 258 | 203 | dlg = win_dialog_init(title, NULL); |
| 259 | 204 | if (!dlg) |
| r7991 | r7992 | |
| 276 | 221 | |
| 277 | 222 | if (this_player == player) |
| 278 | 223 | { |
| 279 | | /* check to see if the custom artwork for this configure dialog |
| 280 | | * says anything about this input */ |
| 281 | | pr = NULL; |
| 282 | | for (i = 0; customizations[i].ipt != IPT_END; i++) |
| 283 | | { |
| 284 | | if (field->type == customizations[i].ipt) |
| 285 | | { |
| 286 | | pr = (RECT *) alloca(sizeof(*pr)); |
| 287 | | pr->left = customizations[i].x; |
| 288 | | pr->top = customizations[i].y; |
| 289 | | pr->right = pr->left + customizations[i].width; |
| 290 | | pr->bottom = pr->top + customizations[i].height; |
| 291 | | break; |
| 292 | | } |
| 293 | | } |
| 294 | | |
| 295 | 224 | /* store this InputPort/RECT combo in our list. we do not |
| 296 | 225 | * necessarily want to add it yet because we the INI might |
| 297 | 226 | * want to reorder the tab order */ |
| 298 | | if (customizations[i].ipt == IPT_END) |
| 299 | | i = portslot_count++; |
| 300 | | if (i < ARRAY_LENGTH(portslots)) |
| 227 | if (portslot_count < ARRAY_LENGTH(portslots)) |
| 301 | 228 | { |
| 302 | | portslots[i].field = field; |
| 303 | | portslots[i].pr = pr; |
| 229 | portslots[portslot_count].field = field; |
| 304 | 230 | } |
| 231 | portslot_count++; |
| 305 | 232 | } |
| 306 | 233 | } |
| 307 | 234 | } |
| r7991 | r7992 | |
| 314 | 241 | { |
| 315 | 242 | if (portslots[i].field) |
| 316 | 243 | { |
| 317 | | if (win_dialog_add_portselect(dlg, portslots[i].field, portslots[i].pr)) |
| 244 | if (win_dialog_add_portselect(dlg, portslots[i].field)) |
| 318 | 245 | goto done; |
| 319 | 246 | } |
| 320 | 247 | } |