static void init_functionrom_dialog(HWND hwnd) { int res_value; const char *romfile; TCHAR *st_romfile; resources_get_int("InternalFunctionROM", &res_value); CheckDlgButton(hwnd, IDC_C128_FUNCTIONROM_INTERNAL, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_string("InternalFunctionName", &romfile); st_romfile = system_mbstowcs_alloc(romfile); SetDlgItemText(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_NAME, st_romfile != NULL ? st_romfile : TEXT("")); system_mbstowcs_free(st_romfile); resources_get_int("ExternalFunctionROM", &res_value); CheckDlgButton(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_string("ExternalFunctionName", &romfile); st_romfile = system_mbstowcs_alloc(romfile); SetDlgItemText(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_NAME, st_romfile != NULL ? st_romfile : TEXT("")); system_mbstowcs_free(st_romfile); enable_functionrom_controls(hwnd); }
static void init_romset_dialog(HWND hwnd) { int res_value, idc_active; const char *name; TCHAR *st_name; /* translate all dialog items */ uilib_localize_dialog(hwnd, romset_dialog_trans); /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, romset_main_group); resources_get_int("RomsetSourceFile", &res_value); idc_active = IDC_ROMSET_SELECT_ARCHIVE + res_value; update_romset_dialog(hwnd, idc_active); resources_get_string("RomsetArchiveName", &name); st_name = system_mbstowcs_alloc(name); SetDlgItemText(hwnd, IDC_ROMSET_ARCHIVE_NAME, name != NULL ? st_name : TEXT("")); system_mbstowcs_free(st_name); resources_get_string("RomsetFileName", &name); st_name = system_mbstowcs_alloc(name); SetDlgItemText(hwnd, IDC_ROMSET_FILE_NAME, name != NULL ? st_name : TEXT("")); system_mbstowcs_free(st_name); }
static void printer_set_active(HWND hwnd) { TCHAR *st; st = system_mbstowcs_alloc(printertextdevice[0]); SetDlgItemText(hwnd, IDC_PRINTER_OUTPUT_FILE1_NAME, st); system_mbstowcs_free(st); st = system_mbstowcs_alloc(printertextdevice[1]); SetDlgItemText(hwnd, IDC_PRINTER_OUTPUT_FILE2_NAME, st); system_mbstowcs_free(st); st = system_mbstowcs_alloc(printertextdevice[2]); SetDlgItemText(hwnd, IDC_PRINTER_OUTPUT_FILE3_NAME, st); system_mbstowcs_free(st); }
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_plus256k_dialog(HWND hwnd) { int res_value; const char *plus256kfile; TCHAR *st_plus256kfile; int xsize, ysize; uilib_localize_dialog(hwnd, plus256k_dialog); uilib_adjust_group_width(hwnd, plus256k_group1); uilib_get_group_extent(hwnd, plus256k_leftgroup, &xsize, &ysize); uilib_adjust_group_width(hwnd, plus256k_leftgroup); uilib_move_group(hwnd, plus256k_rightgroup, xsize + 30); resources_get_int("PLUS256K", &res_value); CheckDlgButton(hwnd, IDC_PLUS256K_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_string("PLUS256Kfilename", &plus256kfile); st_plus256kfile = system_mbstowcs_alloc(plus256kfile); SetDlgItemText(hwnd, IDC_PLUS256K_FILE, plus256kfile != NULL ? st_plus256kfile : TEXT("")); system_mbstowcs_free(st_plus256kfile); enable_plus256k_controls(hwnd); }
static void update_romset_archive(HWND hwnd) { HWND temp_hwnd; int num, index, active; const char *conf; active = 0; num = romset_archive_get_number(); resources_get_string("RomsetArchiveActive", &conf); temp_hwnd = GetDlgItem(hwnd, IDC_ROMSET_ARCHIVE_ACTIVE); SendMessage(temp_hwnd, CB_RESETCONTENT, 0, 0); for (index = 0; index < num; index++) { TCHAR *st_name; char *name; name = romset_archive_get_item(index); if (!strcmp(conf, name)) { active = index; } st_name = system_mbstowcs_alloc(name); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st_name); system_mbstowcs_free(st_name); } SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active, 0); update_romset_list(hwnd); }
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_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); }
int archdep_default_logger(const char *level_string, const char *txt) { TCHAR *st_out; char *out = lib_msprintf("*** %s %s\n", level_string, txt); st_out = system_mbstowcs_alloc(out); OutputDebugString(st_out); system_mbstowcs_free(st_out); lib_free(out); return 0; }
static void init_ramcart_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; const char *ramcartfile; TCHAR *st_ramcartfile; int res_value_loop; int active_value; int xsize, ysize; int xsize2; uilib_localize_dialog(hwnd, ramcart_dialog); uilib_get_group_extent(hwnd, ramcart_leftgroup1, &xsize, &ysize); uilib_adjust_group_width(hwnd, ramcart_maingroup); uilib_adjust_group_width(hwnd, ramcart_leftgroup1); uilib_move_and_adjust_group_width(hwnd, ramcart_rightgroup1, xsize + 30); uilib_get_group_extent(hwnd, ramcart_leftgroup2, &xsize2, &ysize); uilib_adjust_group_width(hwnd, ramcart_leftgroup2); uilib_move_group(hwnd, ramcart_rightgroup2, xsize2 + 30); resources_get_int("RAMCART", &res_value); CheckDlgButton(hwnd, IDC_RAMCART_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("RAMCARTImageWrite", &res_value); CheckDlgButton(hwnd, IDC_RAMCART_WRITE_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("RAMCART_RO", &res_value); CheckDlgButton(hwnd, IDC_RAMCART_RO, res_value ? BST_CHECKED : BST_UNCHECKED); temp_hwnd = GetDlgItem(hwnd, IDC_RAMCART_SIZE); for (res_value_loop = 0; ui_ramcart_size[res_value_loop] != 0; res_value_loop++) { TCHAR st[10]; _itot(ui_ramcart_size[res_value_loop], st, 10); _tcscat(st, translate_text(IDS_SPACE_KB)); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st); } resources_get_int("RAMCARTsize", &res_value); active_value = 0; for (res_value_loop = 0; ui_ramcart_size[res_value_loop] != 0; res_value_loop++) { if (ui_ramcart_size[res_value_loop] == res_value) { active_value = res_value_loop; } } SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0); resources_get_string("RAMCARTfilename", &ramcartfile); st_ramcartfile = system_mbstowcs_alloc(ramcartfile); SetDlgItemText(hwnd, IDC_RAMCART_FILE, ramcartfile != NULL ? st_ramcartfile : TEXT("")); system_mbstowcs_free(st_ramcartfile); enable_ramcart_controls(hwnd); }
static void init_speed_dialog(HWND hwnd) { int res_value; char *speedstr; TCHAR *st_speedstr; resources_get_int("Speed", &res_value); speedstr = lib_msprintf("%i", res_value); st_speedstr = system_mbstowcs_alloc(speedstr); SetDlgItemText(hwnd, IDC_CUSTOM_SPEED, st_speedstr); system_mbstowcs_free(st_speedstr); lib_free(speedstr); }
int archdep_default_logger(const char *level_string, const char *txt) { char *out = lib_msprintf ("*** %s %s\n", level_string, txt); #ifdef __ANDROID__ __android_log_print (ANDROID_LOG_VERBOSE, "libc64emu", "%s", out); #else //__ANDROID__ TCHAR *st_out; st_out = system_mbstowcs_alloc(out); OutputDebugString(st_out); system_mbstowcs_free(st_out); #endif //__ANDROID__ lib_free (out); return 0; }
static void update_romset_list(HWND hwnd) { char *list; TCHAR *st_list; if (IsDlgButtonChecked(hwnd, IDC_ROMSET_SELECT_ARCHIVE) == BST_CHECKED) { list = romset_archive_list(); } else { list = machine_romset_file_list(); } st_list = system_mbstowcs_alloc(list); SetDlgItemText(hwnd, IDC_ROMSET_PREVIEW, st_list); system_mbstowcs_free(st_list); lib_free(list); }
DIR *opendir(const char *path) { DIR *dir; TCHAR *st_filter; dir = lib_malloc(sizeof(DIR)); dir->filter = util_concat(path, "\\*", NULL); st_filter = system_mbstowcs_alloc(dir->filter); dir->handle = FindFirstFile(st_filter, &dir->find_data); system_mbstowcs_free(st_filter); if (dir->handle == INVALID_HANDLE_VALUE) { return NULL; } dir->first_passed = 0; return dir; }
static void init_petreu_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; const char *petreufile; TCHAR *st_petreufile; int res_value_loop; int active_value; int xsize, ysize; uilib_localize_dialog(hwnd, petreu_dialog); uilib_get_group_extent(hwnd, petreu_leftgroup, &xsize, &ysize); uilib_adjust_group_width(hwnd, petreu_leftgroup); uilib_move_group(hwnd, petreu_rightgroup, xsize + 30); resources_get_int("PETREU", &res_value); CheckDlgButton(hwnd, IDC_PETREU_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); temp_hwnd = GetDlgItem(hwnd, IDC_PETREU_SIZE); for (res_value_loop = 0; res_value_loop < NUM_OF_PETREU_SIZE; res_value_loop++) { TCHAR st[10]; _itot(ui_petreu_size[res_value_loop], st, 10); _tcscat(st, translate_text(IDS_SPACE_KB)); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st); } resources_get_int("PETREUsize", &res_value); active_value = 0; for (res_value_loop = 0; res_value_loop < NUM_OF_PETREU_SIZE; res_value_loop++) { if (ui_petreu_size[res_value_loop] == res_value) active_value = res_value_loop; } SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0); resources_get_string("PETREUfilename", &petreufile); st_petreufile = system_mbstowcs_alloc(petreufile); SetDlgItemText(hwnd, IDC_PETREU_FILE, petreufile != NULL ? st_petreufile : TEXT("")); system_mbstowcs_free(st_petreufile); enable_petreu_controls(hwnd); }
static void init_plus60k_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; const char *plus60kfile; TCHAR *st_plus60kfile; int res_value_loop; int active_value; int xsize, ysize; uilib_localize_dialog(hwnd, plus60k_dialog); uilib_get_group_extent(hwnd, plus60k_leftgroup, &xsize, &ysize); uilib_adjust_group_width(hwnd, plus60k_leftgroup); uilib_move_group(hwnd, plus60k_rightgroup, xsize + 30); resources_get_int("PLUS60K", &res_value); CheckDlgButton(hwnd, IDC_PLUS60K_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); temp_hwnd = GetDlgItem(hwnd, IDC_PLUS60K_BASE); for (res_value_loop = 0; res_value_loop < NUM_OF_PLUS60K_BASE; res_value_loop++) { TCHAR st[10]; _stprintf(st, "$%X", ui_plus60k_base[res_value_loop]); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st); } resources_get_int("PLUS60Kbase", &res_value); active_value = 0; for (res_value_loop = 0; res_value_loop < NUM_OF_PLUS60K_BASE; res_value_loop++) { if (ui_plus60k_base[res_value_loop] == res_value) active_value = res_value_loop; } SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0); resources_get_string("PLUS60Kfilename", &plus60kfile); st_plus60kfile = system_mbstowcs_alloc(plus60kfile); SetDlgItemText(hwnd, IDC_PLUS60K_FILE, plus60kfile != NULL ? st_plus60kfile : TEXT("")); system_mbstowcs_free(st_plus60kfile); enable_plus60k_controls(hwnd); }
static void init_palette_dialog(HWND hwnd, Chip_Parameters *chip_type) { int n; const char *path; TCHAR *st_path; HWND filename_hwnd; current_chip2 = chip_type; filename_hwnd = GetDlgItem(hwnd, IDC_VIDEO_CUSTOM_NAME); SendMessage(filename_hwnd, CB_RESETCONTENT, 0, 0); n = 0 ; while (chip_type->palette_names[n] != NULL) { SendMessage(filename_hwnd, CB_ADDSTRING, 0, (LPARAM)chip_type->palette_names[n]); n++; } resources_get_string(chip_type->res_PaletteFile_name, &path); palette_file2 = lib_stralloc(path); st_path = system_mbstowcs_alloc(path); SetDlgItemText(hwnd, IDC_VIDEO_CUSTOM_NAME, st_path); system_mbstowcs_free(st_path); }
static void init_mapping_dialog(HWND hwnd) { int idc_index, i; 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_magicvoice_dialog(HWND hwnd) { int res_value; const char *magicvoicefile; TCHAR *st_magicvoicefile; int xsize, ysize; uilib_localize_dialog(hwnd, magicvoice_dialog); uilib_adjust_group_width(hwnd, magicvoice_group1); uilib_get_group_extent(hwnd, magicvoice_leftgroup, &xsize, &ysize); uilib_adjust_group_width(hwnd, magicvoice_leftgroup); uilib_move_group(hwnd, magicvoice_rightgroup, xsize + 30); resources_get_int("MagicVoiceCartridgeEnabled", &res_value); CheckDlgButton(hwnd, IDC_MAGICVOICE_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_string("MagicVoiceImage", &magicvoicefile); st_magicvoicefile = system_mbstowcs_alloc(magicvoicefile); SetDlgItemText(hwnd, IDC_MAGICVOICE_FILE, magicvoicefile != NULL ? st_magicvoicefile : TEXT("")); system_mbstowcs_free(st_magicvoicefile); enable_magicvoice_controls(hwnd); }
static void init_v364speech_dialog(HWND hwnd) { int res_value; const char *v364speechfile; TCHAR *st_v364speechfile; int xsize, ysize; uilib_localize_dialog(hwnd, v364speech_dialog); uilib_adjust_group_width(hwnd, v364speech_group1); uilib_get_group_extent(hwnd, v364speech_leftgroup, &xsize, &ysize); uilib_adjust_group_width(hwnd, v364speech_leftgroup); uilib_move_group(hwnd, v364speech_rightgroup, xsize + 30); resources_get_int("SpeechEnabled", &res_value); CheckDlgButton(hwnd, IDC_V364SPEECH_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_string("SpeechImage", &v364speechfile); st_v364speechfile = system_mbstowcs_alloc(v364speechfile); SetDlgItemText(hwnd, IDC_V364SPEECH_FILE, v364speechfile != NULL ? st_v364speechfile : TEXT("")); system_mbstowcs_free(st_v364speechfile); enable_v364speech_controls(hwnd); }
void ui_video_settings_dialog(HWND hwnd, int chip_type1, int chip_type2) { PROPSHEETPAGE psp[5]; PROPSHEETHEADER psh; int i; Chip_Parameters *chip_param; for (i = 0; i < 5; i++) { psp[i].dwSize = sizeof(PROPSHEETPAGE); psp[i].dwFlags = PSP_USETITLE /*| PSP_HASHELP*/ ; psp[i].hInstance = winmain_instance; #ifdef _ANONYMOUS_UNION psp[i].pszIcon = NULL; #else psp[i].u2.pszIcon = NULL; #endif psp[i].lParam = 0; psp[i].pfnCallback = NULL; } chip_param = &chip_param_table[chip_type1]; if (chip_param->palette_mode == UI_VIDEO_PAL) { psp[0].pfnDlgProc = dialog_fullscreen_proc; psp[0].pszTitle = translate_text(IDS_FULLSCREEN); psp[1].pfnDlgProc = dialog_advanced_proc; psp[1].pszTitle = system_mbstowcs_alloc(chip_param->page_title); psp[1].lParam = (LPARAM)chip_param; psp[2].pfnDlgProc = dialog_new_pal_proc; psp[2].pszTitle = translate_text(IDS_NEW_PAL); psp[3].pfnDlgProc = dialog_color_proc; psp[3].pszTitle = translate_text(IDS_COLORS); #ifdef _ANONYMOUS_UNION psp[0].pszTemplate = MAKEINTRESOURCE(translate_res(IDD_FULLSCREEN_SETTINGS_DIALOG)); psp[1].pszTemplate = MAKEINTRESOURCE(translate_res(IDD_VIDEO_ADVANCED_DIALOG)); psp[2].pszTemplate = MAKEINTRESOURCE(translate_res(IDD_VIDEO_NEW_PAL_DIALOG)); psp[3].pszTemplate = MAKEINTRESOURCE(translate_res(IDD_VIDEO_COLORS_DIALOG)); #else psp[0].DUMMYUNIONNAME.pszTemplate = MAKEINTRESOURCE(translate_res(IDD_FULLSCREEN_SETTINGS_DIALOG)); psp[1].DUMMYUNIONNAME.pszTemplate = MAKEINTRESOURCE(translate_res(IDD_VIDEO_ADVANCED_DIALOG)); psp[2].DUMMYUNIONNAME.pszTemplate = MAKEINTRESOURCE(translate_res(IDD_VIDEO_NEW_PAL_DIALOG)); psp[3].DUMMYUNIONNAME.pszTemplate = MAKEINTRESOURCE(translate_res(IDD_VIDEO_COLORS_DIALOG)); #endif psh.nPages = 4; } else { psp[0].pfnDlgProc = dialog_fullscreen_proc; psp[0].pszTitle = translate_text(IDS_FULLSCREEN); psp[1].pfnDlgProc = dialog_palette_proc; psp[1].pszTitle = system_mbstowcs_alloc(chip_param->page_title); psp[1].lParam = (LPARAM)chip_param; #ifdef _ANONYMOUS_UNION psp[0].pszTemplate = MAKEINTRESOURCE(translate_res(IDD_FULLSCREEN_SETTINGS_DIALOG)); psp[1].pszTemplate = MAKEINTRESOURCE(translate_res(IDD_VIDEO_PALETTE_DIALOG)); #else psp[0].DUMMYUNIONNAME.pszTemplate = MAKEINTRESOURCE(translate_res(IDD_FULLSCREEN_SETTINGS_DIALOG)); psp[1].DUMMYUNIONNAME.pszTemplate = MAKEINTRESOURCE(translate_res(IDD_VIDEO_PALETTE_DIALOG)); #endif psh.nPages = 2; } if (chip_type2 != UI_VIDEO_CHIP_NONE) { int index = psh.nPages; chip_param = &chip_param_table[chip_type2]; psp[index].pfnDlgProc = dialog_palette_proc; psp[index].pszTitle = system_mbstowcs_alloc(chip_param->page_title); psp[index].lParam = (LPARAM)chip_param; #ifdef _ANONYMOUS_UNION psp[index].pszTemplate = MAKEINTRESOURCE(translate_res(IDD_VIDEO_PALETTE_DIALOG)); #else psp[index].DUMMYUNIONNAME.pszTemplate = MAKEINTRESOURCE(translate_res(IDD_VIDEO_PALETTE_DIALOG)); #endif psh.nPages++; } psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; psh.hwndParent = hwnd; psh.hInstance = winmain_instance; psh.pszCaption = translate_text(IDS_VIDEO_SETTINGS); #ifdef _ANONYMOUS_UNION psh.pszIcon = NULL; psh.nStartPage = 0; psh.ppsp = psp; #else psh.DUMMYUNIONNAME.pszIcon = NULL; psh.u2.nStartPage = 0; psh.u3.ppsp = psp; #endif psh.pfnCallback = NULL; PropertySheet(&psh); }
static void init_advanced_dialog(HWND hwnd, Chip_Parameters *chip_type) { int n, val; double fval; TCHAR newval[64]; const char *path; TCHAR *st_path; HWND filename_hwnd; current_chip = chip_type; resources_get_int("ColorGamma", &val); fval = ((double)val) / 1000.0; _stprintf(newval, TEXT("%.3f"), (float)fval); SetDlgItemText(hwnd, IDC_VIDEO_COLORS_GAM, newval); /* As long as 'phase' isn't implemented, set a constant entry */ SetDlgItemText(hwnd, IDC_VIDEO_COLORS_PHA, TEXT("N/A")); resources_get_int("PALScanLineShade", &val); fval = ((double)val) / 1000.0; _stprintf(newval, TEXT("%.3f"), (float)fval); SetDlgItemText(hwnd, IDC_VIDEO_ADVANCED_SHADE, newval); resources_get_int("PALBlur", &val); fval = ((double)val) / 1000.0; _stprintf(newval, TEXT("%.3f"), (float)fval); SetDlgItemText(hwnd, IDC_VIDEO_ADVANCED_BLUR, newval); filename_hwnd = GetDlgItem(hwnd, IDC_VIDEO_ADVANCED_MODE); SendMessage(filename_hwnd, CB_RESETCONTENT, 0, 0); n = 0; while (modes[n] != NULL) { SendMessage(filename_hwnd, CB_ADDSTRING, 0, (LPARAM)modes[n]); n++; } resources_get_int("PALMode", &val); SendMessage(filename_hwnd, CB_SETCURSEL, (WPARAM)val, 0); if (chip_type->res_ExternalPalette_name) { resources_get_int(chip_type->res_ExternalPalette_name, &n); CheckDlgButton(hwnd, IDC_TOGGLE_VIDEO_EXTPALETTE, n ? BST_CHECKED : BST_UNCHECKED); res_extpalette = n; } else { res_extpalette = 0; EnableWindow(GetDlgItem(hwnd, IDC_TOGGLE_VIDEO_EXTPALETTE), FALSE); } EnableWindow(GetDlgItem(hwnd, IDC_VIDEO_CUSTOM_BROWSE), res_extpalette); EnableWindow(GetDlgItem(hwnd, IDC_VIDEO_CUSTOM_NAME), res_extpalette); filename_hwnd = GetDlgItem(hwnd, IDC_VIDEO_CUSTOM_NAME); SendMessage(filename_hwnd, CB_RESETCONTENT, 0, 0); n = 0 ; while (chip_type->palette_names[n] != NULL) { SendMessage(filename_hwnd, CB_ADDSTRING, 0, (LPARAM)chip_type->palette_names[n]); n++; } resources_get_string(chip_type->res_PaletteFile_name, &path); palette_file = lib_stralloc(path); st_path = system_mbstowcs_alloc(path); SetDlgItemText(hwnd, IDC_VIDEO_CUSTOM_NAME, st_path); system_mbstowcs_free(st_path); }
static void init_rom_dialog(HWND hwnd, unsigned int type) { unsigned int n = 0; int xpos; int i; HWND element; if (type == UIROM_TYPE_MAIN) { /* translate all dialog items */ uilib_localize_dialog(hwnd, main_trans); /* adjust the size of the elements in the main left group */ uilib_adjust_group_width(hwnd, main_left_group); /* get the max x of the main left group */ uilib_get_group_max_x(hwnd, main_left_group, &xpos); /* move the main middle group to the correct position */ uilib_move_group(hwnd, main_middle_group, xpos + 10); /* get the max x of the main middle group */ uilib_get_group_max_x(hwnd, main_middle_group, &xpos); /* move the main right group to the correct position */ uilib_move_group(hwnd, main_right_group, xpos + 10); } else if (type == UIROM_TYPE_DRIVE) { /* translate all dialog items */ uilib_localize_dialog(hwnd, drive_trans); /* translate generic items */ for (i = 0; generic_trans[i].text != NULL; i++) { element = GetDlgItem(hwnd, generic_trans[i].idm); SetWindowText(element, generic_trans[i].text); } /* adjust the size of the elements in the drive left group */ uilib_adjust_group_width(hwnd, drive_left_group); /* get the max x of the drive left group */ uilib_get_group_max_x(hwnd, drive_left_group, &xpos); /* move the drive middle group to the correct position */ uilib_move_group(hwnd, drive_middle_group, xpos + 10); /* get the max x of the drive middle group */ uilib_get_group_max_x(hwnd, drive_middle_group, &xpos); /* move the drive right group to the correct position */ uilib_move_group(hwnd, drive_right_group, xpos + 10); } while (settings[n].realname != NULL) { if (settings[n].type == type) { const char *filename; TCHAR *st_filename; resources_get_string(settings[n].resname, &filename); st_filename = system_mbstowcs_alloc(filename); SetDlgItemText(hwnd, settings[n].idc_filename, st_filename != NULL ? st_filename : TEXT("")); system_mbstowcs_free(st_filename); } n++; } }
static void init_functionrom_dialog(HWND hwnd) { int res_value; const char *romfile; TCHAR *st_romfile; int xstart; int xpos; int size; HWND temp_hwnd; /* translate all dialog items */ uilib_localize_dialog(hwnd, functionrom_dialog_trans); /* adjust the size of the enable group elements */ uilib_adjust_group_width(hwnd, enable_group); /* adjust the size of the file name group elements */ uilib_adjust_group_width(hwnd, file_name_group); /* get the max x of the file name indicator group */ uilib_get_group_max_x(hwnd, file_name_indicator_group, &xstart); /* get the size of the file name indicator group elements */ uilib_get_group_width(hwnd, file_name_indicator_group, &size); /* get the max x of the file name group */ uilib_get_group_max_x(hwnd, file_name_group, &xpos); /* move the file name indicator group to the correct position */ uilib_move_group(hwnd, file_name_indicator_group, xpos + 10); /* get the max x of the file name indicator group */ uilib_get_group_max_x(hwnd, file_name_indicator_group, &xpos); /* set the size of the file name indicator group */ uilib_set_element_width(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_NAME, size - (xpos - xstart)); uilib_set_element_width(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_NAME, size - (xpos - xstart)); /* get the size of the internal function rom type label */ uilib_get_element_max_x(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_TYPE_LABEL, &xpos); /* move the internal function rom type box */ uilib_move_element(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_TYPE, xpos + 10); /* move the external function rom type box */ uilib_move_element(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_TYPE, xpos + 10); resources_get_string("InternalFunctionName", &romfile); st_romfile = system_mbstowcs_alloc(romfile); SetDlgItemText(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_NAME, st_romfile != NULL ? st_romfile : TEXT("")); system_mbstowcs_free(st_romfile); resources_get_string("ExternalFunctionName", &romfile); st_romfile = system_mbstowcs_alloc(romfile); SetDlgItemText(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_NAME, st_romfile != NULL ? st_romfile : TEXT("")); system_mbstowcs_free(st_romfile); temp_hwnd = GetDlgItem(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_TYPE); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_NONE)); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"ROM"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"RAM"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"RAM+RTC"); resources_get_int("InternalFunctionROM", &res_value); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); temp_hwnd = GetDlgItem(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_TYPE); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_NONE)); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"ROM"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"RAM"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"RAM+RTC"); resources_get_int("ExternalFunctionROM", &res_value); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); resources_get_int("InternalFunctionROMRTCSave", &res_value); CheckDlgButton(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_RTC_SAVE, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("ExternalFunctionROMRTCSave", &res_value); CheckDlgButton(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_RTC_SAVE, res_value ? BST_CHECKED : BST_UNCHECKED); }
static void init_romset_dialog(HWND hwnd) { int res_value = 0; int idc_active; int dist, xmax, xmin; const char *name = NULL; TCHAR *st_name; /* translate all dialog items */ uilib_localize_dialog(hwnd, romset_dialog_trans); /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, romset_main_group); /* get the max x of the romset archive load button */ uilib_get_element_max_x(hwnd, IDC_ROMSET_ARCHIVE_LOAD, &xmax); /* get the min x of the romset archive save button */ uilib_get_element_min_x(hwnd, IDC_ROMSET_ARCHIVE_SAVE, &xmin); /* calculate the distance between buttons */ dist = xmin - xmax; /* adjust the size of the load/save buttons group */ uilib_adjust_group_width(hwnd, romset_archive_loadsave_group); /* get the max x of the romset archive load button */ uilib_get_element_max_x(hwnd, IDC_ROMSET_ARCHIVE_LOAD, &xmax); /* move the romset archive save button */ uilib_move_element(hwnd, IDC_ROMSET_ARCHIVE_SAVE, xmax + dist); /* get the max x of the romset load button */ uilib_get_element_max_x(hwnd, IDC_ROMSET_FILE_LOAD, &xmax); /* get the min x of the romset save button */ uilib_get_element_min_x(hwnd, IDC_ROMSET_FILE_SAVE, &xmin); /* calculate the distance between buttons */ dist = xmin - xmax; /* adjust the size of the load/save buttons group */ uilib_adjust_group_width(hwnd, romset_loadsave_group); /* get the max x of the romset load button */ uilib_get_element_max_x(hwnd, IDC_ROMSET_FILE_LOAD, &xmax); /* move the romset save button */ uilib_move_element(hwnd, IDC_ROMSET_FILE_SAVE, xmax + dist); resources_get_int("RomsetSourceFile", &res_value); idc_active = IDC_ROMSET_SELECT_ARCHIVE + res_value; update_romset_dialog(hwnd, idc_active); resources_get_string("RomsetArchiveName", &name); st_name = system_mbstowcs_alloc(name); SetDlgItemText(hwnd, IDC_ROMSET_ARCHIVE_NAME, name != NULL ? st_name : TEXT("")); system_mbstowcs_free(st_name); resources_get_string("RomsetFileName", &name); st_name = system_mbstowcs_alloc(name); SetDlgItemText(hwnd, IDC_ROMSET_FILE_NAME, name != NULL ? st_name : TEXT("")); system_mbstowcs_free(st_name); }
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_dialog(HWND hwnd, unsigned int num) { const char *disk_image, *dir; TCHAR *st_disk_image, *st_dir; int devtype, n; int xpos, xpos1, xpos2, xpos3; int distance1, distance2; RECT rect; uilib_localize_dialog_param *diskdevice_dialog = #ifdef HAVE_OPENCBM (opencbmlib_is_available()) ? diskdevice_opencbm_dialog : #endif diskdevice_normal_dialog; if (num >= 8 && num <= 11) { /* translate all dialog items */ uilib_localize_dialog(hwnd, diskdevice_dialog); /* adjust the size of the elements in the diskdevice_left_group */ uilib_adjust_group_width(hwnd, diskdevice_left_group); /* adjust the size of the 'read-only' element */ uilib_adjust_group_width(hwnd, diskdevice_read_only); /* get the min x of the read only element */ uilib_get_element_min_x(hwnd, IDC_TOGGLE_ATTACH_READONLY, &xpos3); /* get the min x of the autostart element */ uilib_get_element_min_x(hwnd, IDC_AUTOSTART, &xpos2); /* get the max x of the first browse element */ uilib_get_element_max_x(hwnd, IDC_BROWSEDISK, &xpos1); /* calculate the distance between the browse button and the autostart button */ distance1 = xpos2 - xpos1; /* get the max x of the autostart element */ uilib_get_element_max_x(hwnd, IDC_AUTOSTART, &xpos2); /* calculate the distance between the browse button and the read only element */ distance2 = xpos3 - xpos2; /* get the max x of the disk_device_left_group items */ uilib_get_group_max_x(hwnd, diskdevice_left_group, &xpos); /* move the filename elements and browse buttons to the right position */ uilib_move_group(hwnd, diskdevice_middle_group, xpos + 10); /* get the max x of the first browse element */ uilib_get_element_max_x(hwnd, IDC_BROWSEDISK, &xpos); /* move the autostart element to the right position */ uilib_move_element(hwnd, IDC_AUTOSTART, xpos + distance1); /* resize the autostart element */ uilib_adjust_element_width(hwnd, IDC_AUTOSTART); /* get the max x of the autostart element */ uilib_get_element_max_x(hwnd, IDC_AUTOSTART, &xpos); /* move the read only element to the right position */ uilib_move_element(hwnd, IDC_TOGGLE_ATTACH_READONLY, xpos + distance2); #ifdef HAVE_OPENCBM if (opencbmlib_is_available()) { /* adjust the size of the real iec element */ uilib_adjust_element_width(hwnd, IDC_SELECTREAL); /* get the max x of the real iec element */ uilib_get_element_max_x(hwnd, IDC_SELECTREAL, &xpos1); } else { xpos1 = 0; } #else xpos1 = 0; #endif /* get the max x of the second browse button */ uilib_get_element_max_x(hwnd, IDC_BROWSEDIR, &xpos2); if (xpos2 > xpos1) { xpos = xpos2 + 20; } else { xpos = xpos1 + 20; } /* move the diskdevice_right_group to the right position */ uilib_move_group(hwnd, diskdevice_right_group, xpos); /* move the p00 group element to the right position */ uilib_move_element(hwnd, IDC_DISKDEVICE_OPTIONS, xpos - 5); /* adjust the diskdevice_right_group elements size */ uilib_adjust_group_width(hwnd, diskdevice_right_group); /* adjust the p00 group element size */ uilib_adjust_element_width(hwnd, IDC_DISKDEVICE_OPTIONS); /* get the width of the disk_device_right_group items */ uilib_get_group_width(hwnd, diskdevice_right_group, &xpos1); /* get the width of the p00 group element */ uilib_get_element_width(hwnd, IDC_DISKDEVICE_OPTIONS, &xpos2); if (xpos2 + 5 > xpos1) { xpos = xpos2 + 15; } else { xpos = xpos1 + 10; } /* set the width of the p00 group element */ uilib_set_element_width(hwnd, IDC_DISKDEVICE_OPTIONS, xpos); /* adjust the none element size */ uilib_adjust_element_width(hwnd, IDC_SELECTNONE); /* adjust the size of the use iec device element */ uilib_adjust_element_width(hwnd, IDC_TOGGLE_USEIECDEVICE); /* get the max x of the window filling elements */ uilib_get_group_max_x(hwnd, diskdevice_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); disk_image = file_system_get_disk_name(num); st_disk_image = system_mbstowcs_alloc(disk_image); SetDlgItemText(hwnd, IDC_DISKIMAGE, st_disk_image != NULL ? st_disk_image : TEXT("")); system_mbstowcs_free(st_disk_image); resources_get_string_sprintf("FSDevice%dDir", &dir, num); st_dir = system_mbstowcs_alloc(dir); SetDlgItemText(hwnd, IDC_DIR, st_dir != NULL ? st_dir : TEXT("")); system_mbstowcs_free(st_dir); resources_get_int_sprintf("FSDevice%dConvertP00", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_READP00, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("FSDevice%dSaveP00", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_WRITEP00, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("FSDevice%dHideCBMFiles", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_HIDENONP00, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("AttachDevice%dReadonly", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_ATTACH_READONLY, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("FileSystemDevice%d", &devtype, num); switch (devtype) { case ATTACH_DEVICE_FS: if (disk_image != NULL) { n = IDC_SELECTDISK; } else { n = IDC_SELECTDIR; } break; #ifdef HAVE_OPENCBM case ATTACH_DEVICE_REAL: n = IDC_SELECTREAL; break; #endif default: n = IDC_SELECTNONE; } #ifdef HAVE_OPENCBM if (opencbmlib_is_available()) { CheckRadioButton(hwnd, IDC_SELECTDISK, IDC_SELECTREAL, n); } else { CheckRadioButton(hwnd, IDC_SELECTDISK, IDC_SELECTDIR, n); } #else CheckRadioButton(hwnd, IDC_SELECTDISK, IDC_SELECTDIR, n); #endif enable_controls_for_disk_device_type(hwnd, n); if (iec_available_busses() & IEC_BUS_IEC) { resources_get_int_sprintf("IECDevice%d", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_USEIECDEVICE, n ? BST_CHECKED : BST_UNCHECKED); } else { CheckDlgButton(hwnd, IDC_TOGGLE_USEIECDEVICE, BST_UNCHECKED); ShowWindow(GetDlgItem(hwnd, IDC_TOGGLE_USEIECDEVICE), FALSE); } enable_controls(hwnd); } }