trunk/src/emu/ui/filemngr.c
| r242745 | r242746 | |
| 106 | 106 | // record the menu item |
| 107 | 107 | item_append(buffer, tmp_name.cstr(), 0, (void *) image); |
| 108 | 108 | } |
| 109 | item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); |
| 110 | item_append("Reset", NULL, 0, (void *)1); |
| 109 | 111 | |
| 110 | 112 | custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; |
| 111 | 113 | } |
| r242745 | r242746 | |
| 117 | 119 | |
| 118 | 120 | void ui_menu_file_manager::handle() |
| 119 | 121 | { |
| 120 | | // update the selected device |
| 121 | | selected_device = (device_image_interface *) get_selection(); |
| 122 | | |
| 123 | 122 | // process the menu |
| 124 | 123 | const ui_menu_event *event = process(0); |
| 125 | | if (event != NULL && event->iptkey == IPT_UI_SELECT) |
| 124 | if (event != NULL && event->itemref != NULL && event->iptkey == IPT_UI_SELECT) |
| 126 | 125 | { |
| 127 | | selected_device = (device_image_interface *) event->itemref; |
| 128 | | if (selected_device != NULL) |
| 126 | if ((FPTR)event->itemref == 1) |
| 127 | machine().schedule_hard_reset(); |
| 128 | else |
| 129 | 129 | { |
| 130 | | ui_menu::stack_push(selected_device->get_selection_menu(machine(), container)); |
| 131 | | |
| 132 | | // reset the existing menu |
| 133 | | reset(UI_MENU_RESET_REMEMBER_POSITION); |
| 130 | selected_device = (device_image_interface *) event->itemref; |
| 131 | if (selected_device != NULL) |
| 132 | { |
| 133 | ui_menu::stack_push(selected_device->get_selection_menu(machine(), container)); |
| 134 | |
| 135 | // reset the existing menu |
| 136 | reset(UI_MENU_RESET_REMEMBER_POSITION); |
| 137 | } |
| 134 | 138 | } |
| 135 | 139 | } |
| 136 | 140 | } |
trunk/src/emu/ui/miscmenu.c
| r242745 | r242746 | |
| 9 | 9 | |
| 10 | 10 | *********************************************************************/ |
| 11 | 11 | |
| 12 | #include <ctype.h> |
| 13 | |
| 12 | 14 | #include "emu.h" |
| 15 | #include "emuopts.h" |
| 16 | |
| 17 | #include "cheat.h" |
| 13 | 18 | #include "osdnet.h" |
| 14 | | #include "emuopts.h" |
| 15 | | #include "ui/ui.h" |
| 16 | 19 | #include "rendutil.h" |
| 17 | | #include "cheat.h" |
| 20 | |
| 18 | 21 | #include "uiinput.h" |
| 22 | #include "ui/ui.h" |
| 23 | #include "ui/miscmenu.h" |
| 19 | 24 | #include "ui/filemngr.h" |
| 20 | | #include "ui/miscmenu.h" |
| 21 | | #include "audit.h" |
| 22 | | #include "crsshair.h" |
| 23 | | #include <ctype.h> |
| 24 | | #include "imagedev/cassette.h" |
| 25 | | #include "imagedev/bitbngr.h" |
| 26 | 25 | |
| 27 | 26 | |
| 28 | | |
| 29 | 27 | /*************************************************************************** |
| 30 | 28 | CONSTANTS |
| 31 | 29 | ***************************************************************************/ |
| r242745 | r242746 | |
| 257 | 255 | item_append(slot->device().tag()+1, option == NULL ? "------" : option->name(), (slot->fixed() || slot_get_length(slot) == 0) ? 0 : (MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), (void *)slot); |
| 258 | 256 | } |
| 259 | 257 | item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); |
| 260 | | item_append("Reset", NULL, 0, NULL); |
| 258 | item_append("Reset", NULL, 0, (void *)1); |
| 261 | 259 | } |
| 262 | 260 | |
| 263 | 261 | ui_menu_slot_devices::~ui_menu_slot_devices() |
| r242745 | r242746 | |
| 275 | 273 | |
| 276 | 274 | if (menu_event != NULL && menu_event->itemref != NULL) |
| 277 | 275 | { |
| 278 | | if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT) { |
| 276 | if ((FPTR)menu_event->itemref == 1 && menu_event->iptkey == IPT_UI_SELECT) |
| 277 | machine().schedule_hard_reset(); |
| 278 | else if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT) |
| 279 | { |
| 279 | 280 | device_slot_interface *slot = (device_slot_interface *)menu_event->itemref; |
| 280 | 281 | const char *val = (menu_event->iptkey == IPT_UI_LEFT) ? slot_get_prev(slot) : slot_get_next(slot); |
| 281 | | set_slot_device(slot,val); |
| 282 | set_slot_device(slot, val); |
| 282 | 283 | reset(UI_MENU_RESET_REMEMBER_REF); |
| 283 | 284 | } |
| 284 | | } else if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT) { |
| 285 | | machine().schedule_hard_reset(); |
| 286 | 285 | } |
| 287 | 286 | } |
| 288 | 287 | |
| r242745 | r242746 | |
| 315 | 314 | } |
| 316 | 315 | |
| 317 | 316 | item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); |
| 318 | | item_append("Reset", NULL, 0, NULL); |
| 317 | item_append("Reset", NULL, 0, (void *)1); |
| 319 | 318 | } |
| 320 | 319 | |
| 321 | 320 | ui_menu_bios_selection::~ui_menu_bios_selection() |
| r242745 | r242746 | |
| 333 | 332 | |
| 334 | 333 | if (menu_event != NULL && menu_event->itemref != NULL) |
| 335 | 334 | { |
| 336 | | if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT) { |
| 335 | if ((FPTR)menu_event->itemref == 1 && menu_event->iptkey == IPT_UI_SELECT) |
| 336 | machine().schedule_hard_reset(); |
| 337 | else if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT) |
| 338 | { |
| 337 | 339 | device_t *dev = (device_t *)menu_event->itemref; |
| 338 | 340 | int cnt = 0; |
| 339 | 341 | for (const rom_entry *rom = dev->rom_region(); !ROMENTRY_ISEND(rom); rom++) |
| r242745 | r242746 | |
| 358 | 360 | } |
| 359 | 361 | reset(UI_MENU_RESET_REMEMBER_REF); |
| 360 | 362 | } |
| 361 | | } else if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT) { |
| 362 | | machine().schedule_hard_reset(); |
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | |
| 367 | |
| 366 | 368 | ui_menu_network_devices::ui_menu_network_devices(running_machine &machine, render_container *container) : ui_menu(machine, container) |
| 367 | 369 | { |
| 368 | 370 | } |
| r242745 | r242746 | |
| 842 | 844 | |
| 843 | 845 | void ui_menu_settings::handle() |
| 844 | 846 | { |
| 845 | | /* process the menu */ |
| 847 | // process the menu |
| 846 | 848 | const ui_menu_event *menu_event = process(0); |
| 847 | 849 | |
| 848 | | /* handle events */ |
| 850 | // handle events |
| 849 | 851 | if (menu_event != NULL && menu_event->itemref != NULL) |
| 850 | 852 | { |
| 851 | | ioport_field *field = (ioport_field *)menu_event->itemref; |
| 852 | | ioport_field::user_settings settings; |
| 853 | | int changed = false; |
| 854 | | |
| 855 | | switch (menu_event->iptkey) |
| 853 | // reset |
| 854 | if ((FPTR)menu_event->itemref == 1) |
| 856 | 855 | { |
| 857 | | /* if selected, reset to default value */ |
| 858 | | case IPT_UI_SELECT: |
| 859 | | field->get_user_settings(settings); |
| 860 | | settings.value = field->defvalue(); |
| 861 | | field->set_user_settings(settings); |
| 862 | | changed = true; |
| 863 | | break; |
| 864 | | |
| 865 | | /* left goes to previous setting */ |
| 866 | | case IPT_UI_LEFT: |
| 867 | | field->select_previous_setting(); |
| 868 | | changed = true; |
| 869 | | break; |
| 870 | | |
| 871 | | /* right goes to next setting */ |
| 872 | | case IPT_UI_RIGHT: |
| 873 | | field->select_next_setting(); |
| 874 | | changed = true; |
| 875 | | break; |
| 856 | if (menu_event->iptkey == IPT_UI_SELECT) |
| 857 | machine().schedule_hard_reset(); |
| 876 | 858 | } |
| 877 | | |
| 878 | | /* if anything changed, rebuild the menu, trying to stay on the same field */ |
| 879 | | if (changed) |
| 880 | | reset(UI_MENU_RESET_REMEMBER_REF); |
| 859 | // actual settings |
| 860 | else |
| 861 | { |
| 862 | ioport_field *field = (ioport_field *)menu_event->itemref; |
| 863 | ioport_field::user_settings settings; |
| 864 | int changed = false; |
| 865 | |
| 866 | switch (menu_event->iptkey) |
| 867 | { |
| 868 | /* if selected, reset to default value */ |
| 869 | case IPT_UI_SELECT: |
| 870 | field->get_user_settings(settings); |
| 871 | settings.value = field->defvalue(); |
| 872 | field->set_user_settings(settings); |
| 873 | changed = true; |
| 874 | break; |
| 875 | |
| 876 | /* left goes to previous setting */ |
| 877 | case IPT_UI_LEFT: |
| 878 | field->select_previous_setting(); |
| 879 | changed = true; |
| 880 | break; |
| 881 | |
| 882 | /* right goes to next setting */ |
| 883 | case IPT_UI_RIGHT: |
| 884 | field->select_next_setting(); |
| 885 | changed = true; |
| 886 | break; |
| 887 | } |
| 888 | |
| 889 | /* if anything changed, rebuild the menu, trying to stay on the same field */ |
| 890 | if (changed) |
| 891 | reset(UI_MENU_RESET_REMEMBER_REF); |
| 892 | } |
| 881 | 893 | } |
| 882 | 894 | } |
| 883 | 895 | |
| r242745 | r242746 | |
| 949 | 961 | dip->mask = dip->state = 0; |
| 950 | 962 | *diplist_tailptr = dip; |
| 951 | 963 | diplist_tailptr = &dip->next; |
| 952 | | if (core_stricmp(dip->name, "FAKE") != 0) |
| 953 | | dipcount++; |
| 964 | dipcount++; |
| 954 | 965 | } |
| 955 | 966 | |
| 956 | 967 | /* apply the bits */ |
| r242745 | r242746 | |
| 964 | 975 | } |
| 965 | 976 | } |
| 966 | 977 | if (type == IPT_DIPSWITCH) |
| 967 | | custombottom = dipcount * (DIP_SWITCH_HEIGHT + DIP_SWITCH_SPACING) + DIP_SWITCH_SPACING; |
| 978 | custombottom = dipcount ? dipcount * (DIP_SWITCH_HEIGHT + DIP_SWITCH_SPACING) + DIP_SWITCH_SPACING : 0; |
| 979 | |
| 980 | item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); |
| 981 | item_append("Reset", NULL, 0, (void *)1); |
| 968 | 982 | } |
| 969 | 983 | |
| 970 | 984 | ui_menu_settings::~ui_menu_settings() |
| r242745 | r242746 | |
| 978 | 992 | |
| 979 | 993 | void ui_menu_settings_dip_switches::custom_render(void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2) |
| 980 | 994 | { |
| 981 | | ioport_field *field = (ioport_field *)selectedref; |
| 982 | | dip_descriptor *dip; |
| 983 | | |
| 984 | | if (field==NULL || field->first_diplocation() == NULL) |
| 995 | // catch if no diploc has to be drawn |
| 996 | if (bottom == 0) |
| 985 | 997 | return; |
| 986 | 998 | |
| 987 | | /* add borders */ |
| 999 | // add borders |
| 988 | 1000 | y1 = y2 + UI_BOX_TB_BORDER; |
| 989 | 1001 | y2 = y1 + bottom; |
| 990 | 1002 | |
| 991 | | /* draw extra menu area */ |
| 1003 | // draw extra menu area |
| 992 | 1004 | machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); |
| 993 | 1005 | y1 += (float)DIP_SWITCH_SPACING; |
| 994 | 1006 | |
| 995 | | /* iterate over DIP switches */ |
| 996 | | for (dip = diplist; dip != NULL; dip = dip->next) |
| 1007 | // iterate over DIP switches |
| 1008 | for (dip_descriptor *dip = diplist; dip != NULL; dip = dip->next) |
| 997 | 1009 | { |
| 998 | | if (core_stricmp(dip->name, "FAKE") != 0) |
| 1010 | const ioport_diplocation *diploc; |
| 1011 | UINT32 selectedmask = 0; |
| 1012 | |
| 1013 | // determine the mask of selected bits |
| 1014 | if ((FPTR)selectedref != 1) |
| 999 | 1015 | { |
| 1000 | | const ioport_diplocation *diploc; |
| 1001 | | UINT32 selectedmask = 0; |
| 1002 | | |
| 1003 | | /* determine the mask of selected bits */ |
| 1004 | | if (field != NULL) |
| 1016 | ioport_field *field = (ioport_field *)selectedref; |
| 1017 | |
| 1018 | if (field != NULL && field->first_diplocation() != NULL) |
| 1005 | 1019 | for (diploc = field->first_diplocation(); diploc != NULL; diploc = diploc->next()) |
| 1006 | 1020 | if (strcmp(dip->name, diploc->name()) == 0) |
| 1007 | 1021 | selectedmask |= 1 << (diploc->number() - 1); |
| 1008 | | |
| 1009 | | /* draw one switch */ |
| 1010 | | custom_render_one(x1, y1, x2, y1 + DIP_SWITCH_HEIGHT, dip, selectedmask); |
| 1011 | | y1 += (float)(DIP_SWITCH_SPACING + DIP_SWITCH_HEIGHT); |
| 1012 | 1022 | } |
| 1023 | |
| 1024 | // draw one switch |
| 1025 | custom_render_one(x1, y1, x2, y1 + DIP_SWITCH_HEIGHT, dip, selectedmask); |
| 1026 | y1 += (float)(DIP_SWITCH_SPACING + DIP_SWITCH_HEIGHT); |
| 1013 | 1027 | } |
| 1014 | 1028 | } |
| 1015 | 1029 | |