static void init_mapping_dialog(HWND hwnd) { int idc_index, i; int xpos; RECT rect; /* translate all dialog items */ uilib_localize_dialog(hwnd, mapping_dialog_trans); /* translate ok and cancel items */ uilib_localize_dialog(hwnd, ok_cancel_trans); /* adjust the size of the elements in the buttons group */ uilib_adjust_group_width(hwnd, mapping_buttons_group); /* adjust the size of the elements in the left group */ uilib_adjust_group_width(hwnd, mapping_left_group); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, mapping_left_group, &xpos); /* move the middle group to the correct position */ uilib_move_group(hwnd, mapping_middle_group, xpos + 10); /* get the max x of the middle group */ uilib_get_group_max_x(hwnd, mapping_middle_group, &xpos); /* move the right group to the correct position */ uilib_move_group(hwnd, mapping_right_group, xpos + 10); /* get the max x of the right group */ uilib_get_group_max_x(hwnd, mapping_right_group, &xpos); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos + 10, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, mapping_move_buttons_group, 0); /* recenter the ok and cancel buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, ok_cancel_move_group, 0); idc_index = mapping_index_get(); CheckRadioButton(hwnd, mapping_entry[0].idc_select, mapping_entry[uikeyboard_mapping_num - 1].idc_select, idc_index); for (i = 0; i < uikeyboard_mapping_num; i++) { const char *fname; TCHAR *st_fname; resources_get_string(mapping_entry[i].res_filename, &fname); st_fname = system_mbstowcs_alloc(fname); SetDlgItemText(hwnd, mapping_entry[i].idc_filename, fname != NULL ? st_fname : TEXT("")); system_mbstowcs_free(st_fname); } enable_mapping_controls(hwnd, idc_index); }
static void init_easyflash_dialog(HWND hwnd) { int res_value; int xpos; RECT rect; /* translate all dialog items */ uilib_localize_dialog(hwnd, easyflash_dialog_trans); /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, easyflash_group); /* get the max x of the main group */ uilib_get_group_max_x(hwnd, easyflash_group, &xpos); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos + 10, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); resources_get_int("EasyFlashJumper", &res_value); CheckDlgButton(hwnd, IDC_EASYFLASH_JUMPER, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("EasyFlashWriteCRT", &res_value); CheckDlgButton(hwnd, IDC_EASYFLASH_AUTOSAVE, res_value ? BST_CHECKED : BST_UNCHECKED); }
static void init_autostart_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; const char *autostartfile; TCHAR *st_autostartfile; int xsize, ysize; int xsize2; RECT rect; uilib_localize_dialog(hwnd, autostart_dialog); uilib_get_group_extent(hwnd, autostart_leftgroup1, &xsize, &ysize); uilib_adjust_group_width(hwnd, autostart_leftgroup1); uilib_move_and_adjust_group_width(hwnd, autostart_rightgroup1, xsize + 30); uilib_get_group_extent(hwnd, autostart_leftgroup2, &xsize2, &ysize); uilib_adjust_group_width(hwnd, autostart_leftgroup2); uilib_move_group(hwnd, autostart_rightgroup2, xsize2 + 30); /* get the max x of the rightgroup3 elements */ uilib_get_group_max_x(hwnd, autostart_rightgroup3, &xsize); /* resize the text fill-in box */ uilib_move_and_set_element_width(hwnd, IDC_AUTOSTART_DISK_IMAGE_FILE, 9, xsize - 9); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xsize + 20, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); resources_get_int("AutostartWarp", &res_value); CheckDlgButton(hwnd, IDC_AUTOSTART_WARP, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("AutostartRunWithColon", &res_value); CheckDlgButton(hwnd, IDC_AUTOSTART_USE_COLON_WITH_RUN, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("AutostartBasicLoad", &res_value); CheckDlgButton(hwnd, IDC_AUTOSTART_LOAD_TO_BASIC, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("AutostartDelayRandom", &res_value); CheckDlgButton(hwnd, IDC_AUTOSTART_RANDOM_DELAY, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("AutostartHandleTrueDriveEmulation", &res_value); CheckDlgButton(hwnd, IDC_AUTOSTART_HANDLE_TRUE_DRIVE_EMULATION, res_value ? BST_CHECKED : BST_UNCHECKED); temp_hwnd = GetDlgItem(hwnd, IDC_AUTOSTART_PRG_MODE); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_AUTOSTART_VIRTUAL_FS)); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_AUTOSTART_INJECT)); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_AUTOSTART_DISK)); resources_get_int("AutostartPrgMode", &res_value); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); resources_get_string("AutostartPrgDiskImage", &autostartfile); st_autostartfile = system_mbstowcs_alloc(autostartfile); SetDlgItemText(hwnd, IDC_AUTOSTART_DISK_IMAGE_FILE, autostartfile != NULL ? st_autostartfile : TEXT("")); system_mbstowcs_free(st_autostartfile); }
static void init_sound_record_dialog(HWND hwnd) { HWND temp_hwnd; const char *sound_record_file; TCHAR *st_sound_record_file; int xpos; RECT rect; /* translate all dialog items */ uilib_localize_dialog(hwnd, sound_record_dialog_trans); /* adjust the size of the elements in the datasette_sub_group */ uilib_adjust_group_width(hwnd, sound_record_group); /* get the max x of the sound record format element */ uilib_get_element_max_x(hwnd, IDC_SOUND_RECORD_FORMAT_LABEL, &xpos); /* move the sound record format indicator element to the correct position */ uilib_move_element(hwnd, IDC_SOUND_RECORD_FORMAT, xpos + 10); /* get the max x of the sound record file element */ uilib_get_element_max_x(hwnd, IDC_SOUND_RECORD_FILE_LABEL, &xpos); /* move the browse button to the correct position */ uilib_move_element(hwnd, IDC_SOUND_RECORD_BROWSE, xpos + 10); /* get the max x of the right group */ uilib_get_group_max_x(hwnd, sound_record_right_group, &xpos); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos + 20, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); temp_hwnd = GetDlgItem(hwnd, IDC_SOUND_RECORD_FORMAT); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"AIFF"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"IFF"); #ifdef USE_LAMEMP3 SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"MP3"); #endif SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"VOC"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"WAV"); #ifdef USE_LAMEMP3 SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)4, 0); #else SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)3, 0); #endif resources_get_string("SoundRecordDeviceArg", &sound_record_file); st_sound_record_file = system_mbstowcs_alloc(sound_record_file); SetDlgItemText(hwnd, IDC_SOUND_RECORD_FILE, sound_record_file != NULL ? st_sound_record_file : TEXT("")); system_mbstowcs_free(st_sound_record_file); enable_sound_record_controls(hwnd); }
static void init_mouse_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; int xpos; RECT rect; /* translate all dialog items */ uilib_localize_dialog(hwnd, mouse_dialog_trans); /* adjust the size of the elements in the left group */ uilib_adjust_group_width(hwnd, mouse_left_group); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, mouse_left_group, &xpos); /* move the right group to the correct position */ uilib_move_group(hwnd, mouse_right_group, xpos + 10); /* get the max x of the right group */ uilib_get_group_max_x(hwnd, mouse_right_group, &xpos); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos + 20, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); temp_hwnd = GetDlgItem(hwnd, IDC_MOUSE_TYPE); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"1351"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"NEOS"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"AMIGA"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Paddle"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Atari CX-22"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Atari ST"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Smart"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"MicroMys"); resources_get_int("Mousetype", &res_value); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); temp_hwnd = GetDlgItem(hwnd, IDC_MOUSE_PORT); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Joy1"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Joy2"); resources_get_int("Mouseport", &res_value); res_value--; SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); enable_mouse_controls(hwnd); }
static void init_rs232_dialog(HWND hwnd) { const char *device; TCHAR *st_device; int xpos; RECT rect; /* translate all dialog items */ uilib_localize_dialog(hwnd, rs232_dialog_trans); /* adjust the size of the elements in the left group */ uilib_adjust_group_width(hwnd, left_group); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, left_group, &xpos); /* move the right group to the correct position */ uilib_move_group(hwnd, right_group, xpos + 10); /* get the max x of the right group */ uilib_get_group_max_x(hwnd, right_group, &xpos); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos + 20, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); resources_get_string("RsDevice1", &device); st_device = system_mbstowcs_alloc(device); SetDlgItemText(hwnd, IDC_RS232_DEVICE1, device != NULL ? st_device : TEXT("")); system_mbstowcs_free(st_device); resources_get_string("RsDevice2", &device); st_device = system_mbstowcs_alloc(device); SetDlgItemText(hwnd, IDC_RS232_DEVICE2, device != NULL ? st_device : TEXT("")); system_mbstowcs_free(st_device); resources_get_string("RsDevice3", &device); st_device = system_mbstowcs_alloc(device); SetDlgItemText(hwnd, IDC_RS232_DEVICE3, device != NULL ? st_device : TEXT("")); system_mbstowcs_free(st_device); resources_get_string("RsDevice4", &device); st_device = system_mbstowcs_alloc(device); SetDlgItemText(hwnd, IDC_RS232_DEVICE4, device != NULL ? st_device : TEXT("")); system_mbstowcs_free(st_device); }
static void init_plus4model_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; int xpos; RECT rect; EnableWindow(GetDlgItem(hwnd, IDC_PLUS4MODEL_LIST), 1); /* translate all dialog items */ uilib_localize_dialog(hwnd, plus4model_dialog_trans); /* adjust the size of the elements in the left group */ uilib_adjust_group_width(hwnd, plus4model_left_group); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, plus4model_left_group, &xpos); /* move the right group to the correct position */ uilib_move_group(hwnd, plus4model_right_group, xpos + 10); /* get the max x of the right group */ uilib_get_group_max_x(hwnd, plus4model_right_group, &xpos); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos + 20, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); temp_hwnd = GetDlgItem(hwnd, IDC_PLUS4MODEL_LIST); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"C16 PAL"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"C16 NTSC"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Plus4 PAL"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Plus4 NTSC"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"V364 NTSC"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"C232 NTSC"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_UNKNOWN)); res_value = plus4model_get(); if (res_value > 6) { res_value = 6; } SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); }
static void init_cia_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; int xpos; RECT rect; uilib_dialog_group *left_group = (amount == 2) ? cia2_left_group : cia1_left_group; uilib_dialog_group *right_group = (amount == 2) ? cia2_right_group : cia1_right_group; uilib_localize_dialog_param *dialog_trans = (amount == 2) ? cia2_dialog_trans : cia1_dialog_trans ; /* translate all dialog items */ uilib_localize_dialog(hwnd, dialog_trans); /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, left_group); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, left_group, &xpos); /* move the right group to the correct position */ uilib_move_group(hwnd, right_group, xpos + 10); /* get the max x of the right group */ uilib_get_group_max_x(hwnd, right_group, &xpos); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos + 20, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); resources_get_int("CIA1Model", &res_value); temp_hwnd = GetDlgItem(hwnd, IDC_C64CIA1_LIST); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_6526_OLD)); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_6526A_NEW)); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); if (amount == 2) { resources_get_int("CIA2Model", &res_value); temp_hwnd = GetDlgItem(hwnd, IDC_C64CIA2_LIST); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_6526_OLD)); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_6526A_NEW)); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); } }
static void init_rr_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; int xpos; RECT rect; /* translate all dialog items */ uilib_localize_dialog(hwnd, rr_dialog_trans); /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, rr_main_group); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, rr_left_group, &xpos); /* move the right group to the correct location */ uilib_move_group(hwnd, rr_right_group, xpos + 10); /* get the max x of the window group */ uilib_get_group_max_x(hwnd, rr_window_group, &xpos); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos + 20, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); resources_get_int("RRFlashJumper", &res_value); CheckDlgButton(hwnd, IDC_RR_FLASH_JUMPER, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("RRBankJumper", &res_value); CheckDlgButton(hwnd, IDC_RR_BANK_JUMPER, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("RRBiosWrite", &res_value); CheckDlgButton(hwnd, IDC_RR_SAVE_WHEN_CHANGED, res_value ? BST_CHECKED : BST_UNCHECKED); temp_hwnd = GetDlgItem(hwnd, IDC_RR_REVISION); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)CARTRIDGE_NAME_RETRO_REPLAY); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)CARTRIDGE_NAME_NORDIC_REPLAY); resources_get_int("RRrevision", &res_value); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); }
static void init_vsid_dialog(HWND hwnd) { HWND temp_hwnd; int xpos; int i; TCHAR st[10]; RECT rect; /* translate all dialog items */ uilib_localize_dialog(hwnd, vsid_dialog_trans); /* adjust the size of the elements in the left group */ uilib_adjust_group_width(hwnd, vsid_left_group); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, vsid_left_group, &xpos); /* move the right group to the correct position */ uilib_move_group(hwnd, vsid_right_group, xpos + 10); /* get the max x of the right group */ uilib_get_group_max_x(hwnd, vsid_right_group, &xpos); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos + 20, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); temp_hwnd = GetDlgItem(hwnd, IDC_VSID_TUNE); for (i = 0; i < songs; i++) { _stprintf(st, TEXT("%d"), i + 1); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st); } SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)current_song - 1, 0); }
static void init_resources_dialog(HWND hwnd, unsigned int type) { unsigned int n = 0; int xpos1, xpos2; int size; RECT rect; int idc; int i; HWND element; if (type == UIROM_TYPE_MAIN) { /* translate all dialog items */ uilib_localize_dialog(hwnd, main_res_trans); idc = IDC_COMPUTER_RESOURCES; } else if (type == UIROM_TYPE_DRIVE) { /* translate all dialog items */ uilib_localize_dialog(hwnd, drive_res_trans); /* translate generic items */ for (i = 0; generic_res_trans[i].text != NULL; i++) { element = GetDlgItem(hwnd, generic_res_trans[i].idm); SetWindowText(element, generic_res_trans[i].text); } idc = IDC_DRIVE_RESOURCES; } /* get the max x of the group element */ uilib_get_element_max_x(hwnd, idc, &xpos1); /* get the size of the group element */ uilib_get_element_size(hwnd, idc, &size); /* adjust the size of the group element */ uilib_adjust_element_width(hwnd, idc); /* get the max x of the group element */ uilib_get_element_max_x(hwnd, idc, &xpos2); if (xpos2 < xpos1) { /* restore the size of the group element */ uilib_set_element_width(hwnd, idc, size); } else { /* resize the dialog window */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos2 + 10, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); } while (settings[n].realname != NULL) { if (settings[n].type == type) { int enable; resources_get_int_sprintf("Romset%s", &enable, settings[n].resname); CheckDlgButton(hwnd, settings[n].idc_resource, enable ? BST_CHECKED : BST_UNCHECKED); } n++; } }
static void init_dialog(HWND hwnd, int num) { int drive_type, drive_extend_image_policy, drive_idle_method, n; int drive_true_emulation, iecdevice, enabled; int xpos; int xstart; HWND parent_hwnd; HWND element; parent_hwnd = GetParent(hwnd); /* translate all dialog items */ uilib_localize_dialog(hwnd, drive_dialog_trans); /* translate the parent window items */ uilib_localize_dialog(parent_hwnd, parent_dialog_trans); /* translate the generic items */ for (n = 0; generic_items[n].text != NULL; n++) { element = GetDlgItem(hwnd, generic_items[n].idm); SetWindowText(element, generic_items[n].text); } /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, drive_main_group); /* get the max x of the elements in the left group */ uilib_get_group_max_x(hwnd, drive_left_group, &xpos); /* get the min x of the none element of the left group */ uilib_get_element_min_x(hwnd, IDC_SELECT_DRIVE_TYPE_NONE, &xstart); /* resize and move the left group element to the correct position */ uilib_move_and_set_element_width(hwnd, IDC_DRIVE_TYPE, xstart - 10, xpos - xstart + 20); /* get the max x of the left group element */ uilib_get_element_max_x(hwnd, IDC_DRIVE_TYPE, &xpos); /* move the middle group elements to the correct position */ uilib_move_group(hwnd, drive_middle_move_group, xpos + 20); uilib_move_element(hwnd, IDC_40_TRACK_HANDLING, xpos + 10); uilib_move_element(hwnd, IDC_DRIVE_EXPANSION, xpos + 10); xstart = xpos + 20; /* get the max x of the middle group */ uilib_get_group_max_x(hwnd, drive_middle_group, &xpos); /* resize and move the middle group boxes to the correct position */ uilib_move_and_set_element_width(hwnd, IDC_40_TRACK_HANDLING, xstart - 10, xpos - xstart + 20); uilib_move_and_set_element_width(hwnd, IDC_DRIVE_EXPANSION, xstart - 10, xpos - xstart + 20); /* get the max x of the middle group element */ uilib_get_element_max_x(hwnd, IDC_DRIVE_EXPANSION, &xpos); /* move the right group elements to the correct position */ uilib_move_group(hwnd, drive_right_move_group, xpos + 20); uilib_move_element(hwnd, IDC_IDLE_METHOD, xpos + 10); xstart = xpos + 20; /* get the max x of the right group */ uilib_get_group_max_x(hwnd, drive_right_group, &xpos); /* resize and move the right group element to the correct position */ uilib_move_and_set_element_width(hwnd, IDC_IDLE_METHOD, xstart - 10, xpos - xstart + 20); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(parent_hwnd, move_buttons_group, 0); resources_get_int_sprintf("IECDevice%i", &iecdevice, num); resources_get_int("DriveTrueEmulation", &drive_true_emulation); enabled = drive_true_emulation && !iecdevice; EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_1540), enabled && drive_check_type(DRIVE_TYPE_1540, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_1541), enabled && drive_check_type(DRIVE_TYPE_1541, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_1541II), enabled && drive_check_type(DRIVE_TYPE_1541II, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_1570), enabled && drive_check_type(DRIVE_TYPE_1570, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_1571), enabled && drive_check_type(DRIVE_TYPE_1571, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_1581), enabled && drive_check_type(DRIVE_TYPE_1581, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_2000), enabled && drive_check_type(DRIVE_TYPE_2000, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_4000), enabled && drive_check_type(DRIVE_TYPE_4000, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_NONE), enabled); resources_get_int_sprintf("Drive%dType", &drive_type, num); resources_get_int_sprintf("Drive%dExtendImagePolicy", &drive_extend_image_policy, num); resources_get_int_sprintf("Drive%dIdleMethod", &drive_idle_method, num); dialog_drive_type[num - 8] = drive_type; switch (drive_type) { case DRIVE_TYPE_NONE: n = IDC_SELECT_DRIVE_TYPE_NONE; break; case DRIVE_TYPE_1540: n = IDC_SELECT_DRIVE_TYPE_1540; break; case DRIVE_TYPE_1541: n = IDC_SELECT_DRIVE_TYPE_1541; break; case DRIVE_TYPE_1541II: n = IDC_SELECT_DRIVE_TYPE_1541II; break; case DRIVE_TYPE_1570: n = IDC_SELECT_DRIVE_TYPE_1570; break; case DRIVE_TYPE_1571: n = IDC_SELECT_DRIVE_TYPE_1571; break; case DRIVE_TYPE_1581: n = IDC_SELECT_DRIVE_TYPE_1581; break; case DRIVE_TYPE_2000: n = IDC_SELECT_DRIVE_TYPE_2000; break; case DRIVE_TYPE_4000: n = IDC_SELECT_DRIVE_TYPE_4000; break; } if (!enabled) { n = IDC_SELECT_DRIVE_TYPE_NONE; } CheckRadioButton(hwnd, IDC_SELECT_DRIVE_TYPE_1541, IDC_SELECT_DRIVE_TYPE_NONE, n); enable_controls_for_drive_settings(hwnd, n); dialog_drive_extend[num - 8] = drive_extend_image_policy; switch (drive_extend_image_policy) { case DRIVE_EXTEND_NEVER: n = IDC_SELECT_DRIVE_EXTEND_NEVER; break; case DRIVE_EXTEND_ASK: n = IDC_SELECT_DRIVE_EXTEND_ASK; break; case DRIVE_EXTEND_ACCESS: n = IDC_SELECT_DRIVE_EXTEND_ACCESS; break; } CheckRadioButton(hwnd, IDC_SELECT_DRIVE_EXTEND_NEVER, IDC_SELECT_DRIVE_EXTEND_ACCESS, n); dialog_drive_idle[num - 8] = drive_idle_method; switch (drive_idle_method) { case DRIVE_IDLE_NO_IDLE: n = IDC_SELECT_DRIVE_IDLE_NO_IDLE; break; case DRIVE_IDLE_TRAP_IDLE: n = IDC_SELECT_DRIVE_IDLE_TRAP_IDLE; break; case DRIVE_IDLE_SKIP_CYCLES: n = IDC_SELECT_DRIVE_IDLE_SKIP_CYCLES; break; } CheckRadioButton(hwnd, IDC_SELECT_DRIVE_IDLE_NO_IDLE, IDC_SELECT_DRIVE_IDLE_SKIP_CYCLES, n); resources_get_int_sprintf("Drive%dRAM2000", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_DRIVE_EXPANSION_2000, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("Drive%dRAM4000", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_DRIVE_EXPANSION_4000, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("Drive%dRAM6000", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_DRIVE_EXPANSION_6000, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("Drive%dRAM8000", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_DRIVE_EXPANSION_8000, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("Drive%dRAMA000", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_DRIVE_EXPANSION_A000, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("Drive%dRTCSave", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_DRIVE_RTC_SAVE, n ? BST_CHECKED : BST_UNCHECKED); }
static void init_midi_dialog(HWND hwnd) { HWND temp_hwnd; MMRESULT ret; MIDIINCAPS mic; MIDIOUTCAPS moc; int num, i; int res_value; int number; int xpos; RECT rect; /* translate all dialog items */ uilib_localize_dialog(hwnd, midi_dialog_trans); /* adjust the size of the elements in the left group */ uilib_adjust_group_width(hwnd, midi_left_group); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, midi_left_group, &xpos); /* move the right group to the correct position */ uilib_move_group(hwnd, midi_right_group, xpos + 10); /* get the max x of the window group */ uilib_get_group_max_x(hwnd, midi_window_group, &xpos); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos + 10, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); resources_get_int("MIDIEnable", &res_value); CheckDlgButton(hwnd, IDC_MIDI_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); temp_hwnd = GetDlgItem(hwnd, IDC_MIDI_TYPE); for (i = 0; midi_interface[i].name != NULL; i++) { SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)midi_interface[i].name); } resources_get_int("MIDIMode", &res_value); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); temp_hwnd = GetDlgItem(hwnd, IDC_MIDI_IN_DEVICE); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_NONE)); num = midiInGetNumDevs(); if (num != 0) { for (i = 0; i < num; i++) { ret = midiInGetDevCaps(i, &mic, sizeof(MIDIINCAPS)); if (ret == MMSYSERR_NOERROR) { SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)mic.szPname); } else { SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Error getting name"); } } resources_get_int("MIDIInDev", &number); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)(number + 1), 0); } else { SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)0, 0); } temp_hwnd = GetDlgItem(hwnd, IDC_MIDI_OUT_DEVICE); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_NONE)); num = midiOutGetNumDevs(); if (num != 0) { for (i = 0; i < num; i++) { ret = midiOutGetDevCaps(i, &moc, sizeof(MIDIOUTCAPS)); if (ret == MMSYSERR_NOERROR) { SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)moc.szPname); } else { SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Error getting name"); } } resources_get_int("MIDIOutDev", &number); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)(number + 1), 0); } else { SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)0, 0); } enable_midi_controls(hwnd); }
static void init_sound_dialog(HWND hwnd) { HWND snd_hwnd; int i, res_value; const char *devicename; char tmp[20]; int xpos; RECT rect; /* translate all dialog items */ uilib_localize_dialog(hwnd, sound_dialog); /* adjust the size of the elements in the driver group */ uilib_adjust_group_width(hwnd, sound_driver_group); /* get the max x of the direct x driver element */ uilib_get_element_max_x(hwnd, IDC_SOUND_DIRECTX, &xpos); /* move the wmm driver element to the correct location */ uilib_move_element(hwnd, IDC_SOUND_WMM, xpos + 10); /* adjust the size of the elements in the left group */ uilib_adjust_group_width(hwnd, sound_left_group); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, sound_left_group, &xpos); /* move the right group to the correct location */ uilib_move_group(hwnd, sound_right_group, xpos + 10); /* get the max x of the window filling group */ uilib_get_group_max_x(hwnd, sound_filling_group, &xpos); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos + 10, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); snd_hwnd = GetDlgItem(hwnd, IDC_SOUND_FREQ); resources_get_int("SoundSampleRate", &res_value); for (i = 0; i < sizeof(ui_sound_freq) / sizeof(*ui_sound_freq); i ++) { sprintf(tmp, "%d Hz", ui_sound_freq[i]); SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)TEXT(tmp)); if (ui_sound_freq[i] == res_value) { SendMessage(snd_hwnd, CB_SETCURSEL, i, 0); } } snd_hwnd = GetDlgItem(hwnd, IDC_SOUND_BUFFER); resources_get_int("SoundBufferSize", &res_value); for (i = 0; i < sizeof(ui_sound_buffer) / sizeof(*ui_sound_buffer); i ++) { sprintf(tmp, "%d msec", ui_sound_buffer[i]); SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)TEXT(tmp)); if (ui_sound_buffer[i] == res_value) { SendMessage(snd_hwnd, CB_SETCURSEL, i, 0); } } snd_hwnd = GetDlgItem(hwnd, IDC_SOUND_SYNCH); SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_FLEXIBLE)); SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_ADJUSTING)); SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_EXACT)); resources_get_int("SoundSpeedAdjustment", &res_value); switch (res_value) { case SOUND_ADJUST_FLEXIBLE: default: res_value = 0; break; case SOUND_ADJUST_ADJUSTING: res_value = 1; break; case SOUND_ADJUST_EXACT: res_value = 2; break; } SendMessage(snd_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); resources_get_string("SoundDeviceName", (void *)&devicename); if (devicename && !strcasecmp("wmm", devicename)) { res_value = IDC_SOUND_WMM; } else { res_value = IDC_SOUND_DIRECTX; } CheckRadioButton(hwnd, IDC_SOUND_DIRECTX, IDC_SOUND_WMM, res_value); snd_hwnd = GetDlgItem(hwnd, IDC_SOUND_FRAGMENT_SIZE); SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_SOUND_FRAGMENT_SIZE_SMALL)); SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_SOUND_FRAGMENT_SIZE_MEDIUM)); SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_SOUND_FRAGMENT_SIZE_LARGE)); resources_get_int("SoundFragmentSize", &res_value); SendMessage(snd_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); }
static void init_mmc64_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; int res_value_loop; const char *mmc64_image_file; TCHAR *st_mmc64_image_file; const char *mmc64_bios_file; TCHAR *st_mmc64_bios_file; int xpos; RECT rect; /* translate all dialog items */ uilib_localize_dialog(hwnd, mmc64_dialog_trans); /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, mmc64_main_group); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, mmc64_left_group, &xpos); /* move the right group to the correct location */ uilib_move_group(hwnd, mmc64_right_group, xpos + 10); /* get the max x of the window group */ uilib_get_group_max_x(hwnd, mmc64_window_group, &xpos); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos + 20, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); resources_get_int("MMC64", &res_value); CheckDlgButton(hwnd, IDC_MMC64_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); temp_hwnd = GetDlgItem(hwnd, IDC_MMC64_REVISION); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Rev A"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Rev B"); resources_get_int("MMC64_revision", &res_value); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); resources_get_int("MMC64_flashjumper", &res_value); CheckDlgButton(hwnd, IDC_MMC64_FLASHJUMPER, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("MMC64_bios_write", &res_value); CheckDlgButton(hwnd, IDC_MMC64_BIOS_SAVE, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_string("MMC64BIOSfilename", &mmc64_bios_file); st_mmc64_bios_file = system_mbstowcs_alloc(mmc64_bios_file); SetDlgItemText(hwnd, IDC_MMC64_BIOS_FILE, mmc64_bios_file != NULL ? st_mmc64_bios_file : TEXT("")); system_mbstowcs_free(st_mmc64_bios_file); resources_get_int("MMC64_RO", &res_value); CheckDlgButton(hwnd, IDC_MMC64_IMAGE_RO, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_string("MMC64imagefilename", &mmc64_image_file); st_mmc64_image_file = system_mbstowcs_alloc(mmc64_image_file); SetDlgItemText(hwnd, IDC_MMC64_IMAGE_FILE, mmc64_image_file != NULL ? st_mmc64_image_file : TEXT("")); system_mbstowcs_free(st_mmc64_image_file); resources_get_int("MMC64_sd_type", &res_value); temp_hwnd = GetDlgItem(hwnd, IDC_MMC64_SDTYPE); for (res_value_loop = 0; ui_mmc64_sdtype[res_value_loop]; res_value_loop++) { SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)ui_mmc64_sdtype[res_value_loop]); } SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); enable_mmc64_controls(hwnd); }
static void init_datasette_dialog(HWND hwnd) { HWND snd_hwnd; int res_value; int res_value_loop; int active_value; int xpos_max; int group_max; RECT rect; /* translate all dialog items */ uilib_localize_dialog(hwnd, datasette_dialog); /* adjust the size of the elements in the datasette_sub_group */ uilib_adjust_group_width(hwnd, datasette_sub_group); /* adjust the size of the 'reset with cpu' element */ uilib_adjust_element_width(hwnd, IDC_DATASETTE_RESET_WITH_CPU); /* adjust the size of the motor group element */ uilib_adjust_element_width(hwnd, IDC_DATASETTE_MOTOR_GROUP); /* get the max x of the datasette_sub_group */ uilib_get_group_max_x(hwnd, datasette_sub_group, &xpos_max); /* get the max x of the motor group element */ uilib_get_element_max_x(hwnd, IDC_DATASETTE_MOTOR_GROUP, &group_max); /* calculate the max x of the motor group element and the datasette_sub_group elements */ if (group_max < xpos_max + 10) { group_max = xpos_max + 10; } /* set the width of the motor group element to 'surround' the datasette_sub_group elements */ uilib_set_element_width(hwnd, IDC_DATASETTE_MOTOR_GROUP, group_max); /* get the max x of the datasette_main_group elements */ uilib_get_group_max_x(hwnd, datasette_main_group, &xpos_max); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos_max + 10, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); resources_get_int("DatasetteResetWithCPU", &res_value); CheckDlgButton(hwnd, IDC_DATASETTE_RESET_WITH_CPU, res_value ? BST_CHECKED : BST_UNCHECKED); snd_hwnd = GetDlgItem(hwnd, IDC_DATASETTE_ZERO_GAP_DELAY); for (res_value_loop = 0; res_value_loop < 7; res_value_loop++) { TCHAR st[10]; _stprintf(st, TEXT("%d"), ui_datasette_zero_gap_delay[res_value_loop]); SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)st); } resources_get_int("DatasetteZeroGapDelay", &res_value); active_value = 4; /* default */ for (res_value_loop = 0; res_value_loop < 7; res_value_loop++) { if (ui_datasette_zero_gap_delay[res_value_loop] == res_value) { active_value = res_value_loop; } } SendMessage(snd_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0); snd_hwnd = GetDlgItem(hwnd, IDC_DATASETTE_SPEED_TUNING); for (res_value_loop = 0; res_value_loop < 8; res_value_loop++) { TCHAR st[10]; _stprintf(st, TEXT("%d"), res_value_loop); SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)st); } resources_get_int("DatasetteSpeedTuning", &res_value); SendMessage(snd_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); }