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_c64burstmod_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; int xsize, ysize; uilib_localize_dialog(hwnd, c64burstmod_dialog); uilib_adjust_group_width(hwnd, c64burstmod_left_total_group); uilib_get_group_extent(hwnd, c64burstmod_leftgroup, &xsize, &ysize); uilib_adjust_group_width(hwnd, c64burstmod_leftgroup); uilib_move_group(hwnd, c64burstmod_rightgroup, xsize + 30); resources_get_int("BurstMod", &res_value); CheckDlgButton(hwnd, IDC_C64BURSTMOD_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); temp_hwnd = GetDlgItem(hwnd, IDC_C64BURSTMOD_CIA); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"CIA-1"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"CIA-2"); if (res_value) { SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value - 1, 0); } else { SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)0, 0); } enable_c64burstmod_controls(hwnd); }
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 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_rs232user_dialog(HWND hwnd) { HWND temp_hwnd; RECT rect; int res_value; int res_value_loop; int active_value; int xsize, ysize; uilib_localize_dialog(hwnd, rs232user_dialog); uilib_get_group_extent(hwnd, rs232user_leftgroup, &xsize, &ysize); uilib_adjust_group_width(hwnd, rs232user_leftgroup); uilib_move_group(hwnd, rs232user_rightgroup, xsize + 30); GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xsize + 160, rect.bottom - rect.top, TRUE); resources_get_int("RsUserEnable", &res_value); CheckDlgButton(hwnd, IDC_RS232USER_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); temp_hwnd = GetDlgItem(hwnd, IDC_RS232USER_DEVICE); for (res_value_loop = 0; res_value_loop < MAXRS232; res_value_loop++) { TCHAR st[20]; _stprintf(st, translate_text(IDS_RS232_DEVICE_I), res_value_loop + 1); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st); } SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); resources_get_int("RsUserDev", &res_value); active_value = 0; for (res_value_loop = 0; res_value_loop < MAXRS232; res_value_loop++) { if (res_value_loop == res_value) active_value = res_value_loop; } SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0); temp_hwnd = GetDlgItem(hwnd, IDC_RS232USER_BAUDRATE); for (res_value_loop = 0; res_value_loop < NUM_OF_BAUDRATES; res_value_loop++) { TCHAR st[10]; _itot(baudrates[res_value_loop], st, 10); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st); } resources_get_int("RsUserBaud", &res_value); active_value = 0; for (res_value_loop = 0; res_value_loop < MAXRS232; res_value_loop++) { if (baudrates[res_value_loop] == res_value) active_value = res_value_loop; } SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0); enable_rs232user_controls(hwnd); }
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_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_ds12c887rtc_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; int res_value_loop; int active_value; int xsize, ysize; int *ui_ds12c887rtc_base; if (machine_class == VICE_MACHINE_VIC20) { ui_ds12c887rtc_base = ui_vic20_ds12c887rtc_base; } else if (machine_class == VICE_MACHINE_C128) { ui_ds12c887rtc_base = ui_c128_ds12c887rtc_base; } else { ui_ds12c887rtc_base = ui_c64_ds12c887rtc_base; } uilib_localize_dialog(hwnd, ds12c887rtc_dialog); uilib_adjust_group_width(hwnd, ds12c887rtc_left_total_group); uilib_get_group_extent(hwnd, ds12c887rtc_leftgroup, &xsize, &ysize); uilib_adjust_group_width(hwnd, ds12c887rtc_leftgroup); uilib_move_group(hwnd, ds12c887rtc_rightgroup, xsize + 30); resources_get_int("DS12C887RTC", &res_value); CheckDlgButton(hwnd, IDC_DS12C887RTC_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("DS12C887RTCRunMode", &res_value); CheckDlgButton(hwnd, IDC_DS12C887RTC_RUNMODE, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("DS12C887RTCSave", &res_value); CheckDlgButton(hwnd, IDC_DS12C887RTC_SAVE, res_value ? BST_CHECKED : BST_UNCHECKED); temp_hwnd = GetDlgItem(hwnd, IDC_DS12C887RTC_BASE); for (res_value_loop = 0; ui_ds12c887rtc_base[res_value_loop] != -1; res_value_loop++) { TCHAR st[40]; _stprintf(st, "$%X", ui_ds12c887rtc_base[res_value_loop]); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st); } resources_get_int("DS12C887RTCbase", &res_value); active_value = 0; for (res_value_loop = 0; ui_ds12c887rtc_base[res_value_loop] != -1; res_value_loop++) { if (ui_ds12c887rtc_base[res_value_loop] == res_value) { active_value = res_value_loop; } } SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0); enable_ds12c887rtc_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_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_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_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_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); }
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_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_soundexpander_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; int xsize, ysize; uilib_localize_dialog(hwnd, soundexpander_dialog); if (machine_class == VICE_MACHINE_VIC20) { uilib_localize_dialog(hwnd, soundexpander_mascuerade_dialog); } uilib_get_group_extent(hwnd, soundexpander_leftgroup, &xsize, &ysize); uilib_adjust_group_width(hwnd, soundexpander_left_total_group); uilib_move_group(hwnd, soundexpander_rightgroup, xsize + 30); resources_get_int("SFXSoundExpander", &res_value); CheckDlgButton(hwnd, IDC_SFX_SOUNDEXPANDER_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); if (machine_class == VICE_MACHINE_VIC20) { resources_get_int("SFXSoundExpanderIOSwap", &res_value); CheckDlgButton(hwnd, IDC_SFX_SOUNDEXPANDER_IO_SWAP, res_value ? BST_CHECKED : BST_UNCHECKED); } temp_hwnd = GetDlgItem(hwnd, IDC_SFX_SOUNDEXPANDER_TYPE); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"3526"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"3812"); resources_get_int("SFXSoundExpanderChip", &res_value); if (res_value == 3526) { SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)0, 0); } else { SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)1, 0); } enable_soundexpander_controls(hwnd); }
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_fullscreen_dialog(HWND hwnd) { HWND setting_hwnd; DirectDrawDeviceList *dev; ValueList *value; int xpos; int xstart; int xend; int distance; int size; double fval; TCHAR newval[64]; video_canvas_t *canvas; uilib_localize_dialog_param *fullscreen_dialog_trans = (video_dx9_enabled()) ? fullscreen_dialog_dx9_trans : fullscreen_dialog_ddraw_trans; uilib_dialog_group *fullscreen_left_group = (video_dx9_enabled()) ? fullscreen_left_dx9_group : fullscreen_left_ddraw_group; uilib_dialog_group *fullscreen_right_group = (video_dx9_enabled()) ? fullscreen_right_dx9_group : fullscreen_right_ddraw_group; canvas = video_canvas_for_hwnd(GetParent(GetParent(hwnd))); fullscreen_getmodes(); /* translate all dialog items */ uilib_localize_dialog(hwnd, fullscreen_dialog_trans); /* adjust the size of the elements in the left group */ uilib_adjust_group_width(hwnd, fullscreen_left_group); /* adjust the size of the elements in the rest group */ uilib_adjust_group_width(hwnd, fullscreen_rest_group); /* get the max x of the right group */ uilib_get_group_max_x(hwnd, fullscreen_right_group, &xend); /* get the min x of the right group */ uilib_get_group_min_x(hwnd, fullscreen_right_group, &xstart); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, fullscreen_left_group, &xpos); if (xpos + 10 > xstart) { /* set the position of the right group */ uilib_move_group(hwnd, fullscreen_right_group, xpos + 10); /* get the max x of the right group */ uilib_get_group_max_x(hwnd, fullscreen_right_group, &xpos); /* calculate the distance between the old and new max x of the right group */ distance = xpos - xend; /* get the size of the driver element */ uilib_get_element_size(hwnd, IDC_FULLSCREEN_DEVICE, &size); /* set the size of the driver element */ uilib_set_element_width(hwnd, IDC_FULLSCREEN_DEVICE, size + distance); } validate_mode(&fullscreen_device, &fullscreen_width, &fullscreen_height, &fullscreen_bitdepth, &fullscreen_refreshrate); setting_hwnd = GetDlgItem(hwnd, IDC_FULLSCREEN_DEVICE); SendMessage(setting_hwnd, CB_RESETCONTENT, 0, 0); dev = devices; while (dev != NULL) { SendMessage(setting_hwnd, CB_ADDSTRING, 0, (LPARAM)dev->desc); dev = dev->next; } SendMessage(setting_hwnd, CB_SETCURSEL, (WPARAM)fullscreen_device, 0); get_bitdepthlist(fullscreen_device); setting_hwnd = GetDlgItem(hwnd, IDC_FULLSCREEN_BITDEPTH); SendMessage(setting_hwnd, CB_RESETCONTENT, 0, 0); value = bitdepthlist; while (value != NULL) { SendMessage(setting_hwnd, CB_ADDSTRING, 0, (LPARAM)value->text); value = value->next; } SendMessage(setting_hwnd, CB_SETCURSEL, (WPARAM)GetIndexFromList(bitdepthlist, fullscreen_bitdepth), 0); get_resolutionlist(fullscreen_device, fullscreen_bitdepth); setting_hwnd = GetDlgItem(hwnd, IDC_FULLSCREEN_RESOLUTION); SendMessage(setting_hwnd, CB_RESETCONTENT, 0, 0); value = resolutionlist; while (value != NULL) { SendMessage(setting_hwnd, CB_ADDSTRING, 0, (LPARAM)value->text); value = value->next; } SendMessage(setting_hwnd, CB_SETCURSEL, (WPARAM)GetIndexFromList(resolutionlist, (fullscreen_width << 16) + fullscreen_height), 0); get_refreshratelist(fullscreen_device, fullscreen_bitdepth, fullscreen_width, fullscreen_height); setting_hwnd = GetDlgItem(hwnd, IDC_FULLSCREEN_REFRESHRATE); SendMessage(setting_hwnd, CB_RESETCONTENT, 0, 0); value = refresh_rates; while (value != NULL) { SendMessage(setting_hwnd, CB_ADDSTRING, 0, (LPARAM)value->text); value = value->next; } SendMessage(setting_hwnd, CB_SETCURSEL, (WPARAM)GetIndexFromList(refresh_rates, fullscreen_refreshrate), 0); EnableWindow(GetDlgItem(hwnd, IDC_TOGGLE_VIDEO_VBLANK_SYNC), !video_dx9_enabled()); CheckDlgButton(hwnd, IDC_TOGGLE_VIDEO_VBLANK_SYNC, vblank_sync ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd, IDC_TOGGLE_VIDEO_DX_PRIMARY, dx_primary ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwnd, IDC_TOGGLE_KEEP_ASPECT_RATIO), video_dx9_enabled()); if (video_dx9_enabled()) { CheckDlgButton(hwnd, IDC_TOGGLE_KEEP_ASPECT_RATIO, keep_aspect_ratio ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd, IDC_TOGGLE_TRUE_ASPECT_RATIO, true_aspect_ratio ? BST_CHECKED : BST_UNCHECKED); enable_aspect_ratio(hwnd); fval = ((double)aspect_ratio) / 1000.0; _stprintf(newval, TEXT("%.3f"), (float)fval); SetDlgItemText(hwnd, IDC_ASPECT_RATIO, newval); fval = canvas->geometry->pixel_aspect_ratio; _stprintf(newval, TEXT("%.3f"), (float)fval); SetDlgItemText(hwnd, IDC_GEOMETRY_ASPECT_RATIO, newval); } }
static void init_printer_dialog(unsigned int num, HWND hwnd) { HWND printer_hwnd; int i, res_value, res_value_loop; char printer_name[30]; const char *res_string; int current = 0; int xmax; int xpos; int size; const int *ui_printer = #ifdef HAVE_OPENCBM (opencbmlib_is_available()) ? ui_printer_opencbm : #endif ui_printer_normal; /* translate all dialog items */ uilib_localize_dialog(hwnd, printer_dialog_trans); if (num != 0) { /* translate the iec dialog item(s) */ uilib_localize_dialog(hwnd, printer_iec_dialog_trans); } /* adjust the size of the elements in the left group */ uilib_adjust_group_width(hwnd, printer_left_group); /* get the max x of the bottom right group */ uilib_get_group_max_x(hwnd, printer_bottom_right_group, &xmax); /* get the size of one of the elements of the bottom right group */ uilib_get_element_size(hwnd, IDC_PRINTER_OUTPUT_FILE3_NAME, &size); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, printer_left_group, &xpos); /* move the top right group to the correct position */ uilib_move_group(hwnd, printer_top_right_group, xpos + 10); /* move the bottom right group to the correct position */ uilib_move_group(hwnd, printer_bottom_right_group, xpos + 10); /* get the max x of the bottom right group */ uilib_get_group_max_x(hwnd, printer_bottom_right_group, &xpos); /* set the size of the bottom right group */ uilib_set_group_width(hwnd, printer_bottom_right_group, size + xpos - xmax); /* get the max x of the printer emulation drop down element */ uilib_get_element_max_x(hwnd, IDC_PRINTER_TYPE, &xpos); /* adjust the size of the elements in formfeed group */ uilib_adjust_group_width(hwnd, formfeed_group); /* move the send formfeed button */ uilib_move_element(hwnd, IDC_PRINTER_FORMFEED, xpos + 10); if (num == 0) { sprintf(printer_name, "PrinterUserport"); } else { sprintf(printer_name, "Printer%d", num); } resources_get_int(printer_name, &res_value); printer_hwnd = GetDlgItem(hwnd, IDC_PRINTER_TYPE); for (res_value_loop = 0; ui_printer[res_value_loop]; res_value_loop++) { SendMessage(printer_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(ui_printer[res_value_loop])); } SendMessage(printer_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); resources_get_string_sprintf("%sDriver", &res_string, printer_name); printer_hwnd = GetDlgItem(hwnd, IDC_PRINTER_DRIVER); if (num == 6) { for (res_value_loop = 0; ui_plotter_driver[res_value_loop]; res_value_loop++) { SendMessage(printer_hwnd, CB_ADDSTRING, 0, (LPARAM)ui_plotter_driver[res_value_loop]); if (!strcmp(ui_plotter_driver_1520[res_value_loop], res_string)) { current = res_value_loop; } } } else { if (num == 0) { for (res_value_loop = 0; ui_userprinter_driver[res_value_loop]; res_value_loop++) { SendMessage(printer_hwnd, CB_ADDSTRING, 0, (LPARAM)ui_userprinter_driver[res_value_loop]); if (!strcmp(ui_userprinter_driver_ascii[res_value_loop], res_string)) { current = res_value_loop; } } } else { for (res_value_loop = 0; ui_printer_driver[res_value_loop]; res_value_loop++) { SendMessage(printer_hwnd, CB_ADDSTRING, 0, (LPARAM)ui_printer_driver[res_value_loop]); if (!strcmp(ui_printer_driver_ascii[res_value_loop], res_string)) { current = res_value_loop; } } } } SendMessage(printer_hwnd, CB_SETCURSEL, (WPARAM)current, 0); resources_get_string_sprintf("%sOutput", &res_string, printer_name); printer_hwnd = GetDlgItem(hwnd, IDC_PRINTER_OUTPUT); for (res_value_loop = 0; ui_printer_output[res_value_loop]; res_value_loop++) { SendMessage(printer_hwnd, CB_ADDSTRING, 0, (LPARAM)ui_printer_output[res_value_loop]); if (!strcmp(ui_printer_output_ascii[res_value_loop], res_string)) { current = res_value_loop; } } SendMessage(printer_hwnd, CB_SETCURSEL, (WPARAM)current, 0); resources_get_int_sprintf("%sTextDevice", &res_value, printer_name); printer_hwnd = GetDlgItem(hwnd, IDC_PRINTER_TEXTOUT); for (res_value_loop = 0; ui_printer_text_device[res_value_loop]; res_value_loop++) { SendMessage(printer_hwnd, CB_ADDSTRING, 0, (LPARAM)ui_printer_text_device[res_value_loop]); } SendMessage(printer_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); if (num > 0 && (iec_available_busses() & IEC_BUS_IEC)) { resources_get_int_sprintf("IECDevice%d", &res_value, num); CheckDlgButton(hwnd, IDC_PRINTER_USEIECDEVICE, res_value ? BST_CHECKED : BST_UNCHECKED); } else { ShowWindow(GetDlgItem(hwnd, IDC_PRINTER_USEIECDEVICE), FALSE); CheckDlgButton(hwnd, IDC_PRINTER_USEIECDEVICE, BST_UNCHECKED); } for (i = 0; i < 3; i++) { resources_get_string_sprintf("PrinterTextDevice%d", &res_string, i + 1); if (res_string) { strncpy(printertextdevice[i], res_string, MAX_PATH); } } enable_printer_controls(num, hwnd); }
static void init_dialog(HWND hwnd) { int n, res; int xpos; int xstart; HWND parent_hwnd; HWND element; parent_hwnd = GetParent(hwnd); /* translate all dialog items */ uilib_localize_dialog(hwnd, cbm2_dialog_trans); /* translate all generic items */ for (n = 0; generic_items[n].text != NULL; n++) { element = GetDlgItem(hwnd, generic_items[n].idm); SetWindowText(element, generic_items[n].text); } /* translate ok and cancel */ uilib_localize_dialog(parent_hwnd, ok_cancel_trans); /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, cbm2_main_group); /* get the min x of the 610 button */ uilib_get_element_min_x(hwnd, IDC_SELECT_CBMII_610, &xstart); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, cbm2_left_group, &xpos); /* move and resize the left group element */ uilib_move_and_set_element_width(hwnd, IDC_MACHINE_DEFAULTS, xstart - 10, xpos - xstart + 20); /* get the max x of the left group element */ uilib_get_element_max_x(hwnd, IDC_MACHINE_DEFAULTS, &xpos); /* move the right group element */ uilib_move_element(hwnd, IDC_MODEL_LINE, xpos + 10); /* move the right group elements */ uilib_move_group(hwnd, cbm2_move_right_group, xpos + 20); xstart = xpos + 20; /* get the max x of the right group */ uilib_get_group_max_x(hwnd, cbm2_right_group, &xpos); /* move and resize the right group element */ uilib_move_and_set_element_width(hwnd, IDC_MODEL_LINE, xstart - 10, xpos - xstart + 20); resources_get_int("ModelLine", &res); switch (res) { case 0: n = IDC_SELECT_CBMII_HW0; break; case 1: n = IDC_SELECT_CBMII_HW1; break; case 2: n = IDC_SELECT_CBMII_HW2; break; } CheckRadioButton(hwnd, IDC_SELECT_CBMII_HW0, IDC_SELECT_CBMII_HW2, n); }
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_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_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_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); } }
void CPageConfigTfe::init_tfe_dialog(HWND hwnd) { HWND temp_hwnd; int active_value; int tfe_enable; int xsize, ysize; char *interface_name = NULL; uilib_get_group_extent(hwnd, ms_leftgroup, &xsize, &ysize); uilib_adjust_group_width(hwnd, ms_leftgroup); uilib_move_group(hwnd, ms_rightgroup, xsize + 30); //resources_get_value("ETHERNET_ACTIVE", (void *)&tfe_enabled); get_tfe_enabled(&tfe_enable); //resources_get_value("ETHERNET_AS_RR", (void *)&tfe_as_rr_net); active_value = (tfe_enable ? 1 : 0); temp_hwnd=GetDlgItem(hwnd,IDC_TFE_SETTINGS_ENABLE); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Disabled"); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Uthernet"); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0); //resources_get_value("ETHERNET_INTERFACE", (void *)&interface_name); interface_name = (char *) get_tfe_interface(); if (tfe_enumadapter_open()) { int cnt = 0; char *pname; char *pdescription; temp_hwnd=GetDlgItem(hwnd,IDC_TFE_SETTINGS_INTERFACE); for (cnt = 0; tfe_enumadapter(&pname, &pdescription); cnt++) { BOOL this_entry = FALSE; if (strcmp(pname, interface_name) == 0) { this_entry = TRUE; } SetWindowText(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE_NAME), pname); SetWindowText(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE_DESC), pdescription); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)pname); lib_free(pname); lib_free(pdescription); if (this_entry) { SendMessage(GetDlgItem(hwnd, IDC_TFE_SETTINGS_INTERFACE), CB_SETCURSEL, (WPARAM)cnt, 0); } } tfe_enumadapter_close(); } if (gray_ungray_items(hwnd)) { /* we have a problem: TFE is disabled. Give a message to the user */ // TC (18 Dec 2017) this vicekb URL is a broken link now, so I copied it to the AppleWin repo, here: // . https://github.com/AppleWin/AppleWin/blob/master/docs/VICE%20Knowledge%20Base%20-%20Article%2013-005.htm MessageBox( hwnd, "TFE support is not available on your system,\n" "there is some important part missing. Please have a\n" "look at the VICE knowledge base support page\n" "\n http://vicekb.trikaliotis.net/13-005\n\n" "for possible reasons and to activate networking with VICE.", "TFE support", MB_ICONINFORMATION|MB_OK); /* just quit the dialog before it is open */ SendMessage( hwnd, WM_COMMAND, IDCANCEL, 0); } }
static void init_memory_dialog(HWND hwnd) { int n, res; int xpos; int xstart; HWND parent_hwnd; parent_hwnd = GetParent(hwnd); /* translate all dialog items */ uilib_localize_dialog(hwnd, cbm2_memory_dialog_trans); /* translate ok and cancel */ uilib_localize_dialog(parent_hwnd, ok_cancel_trans); /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, cbm2_memory_main_group); /* get the min x of the 128K ram element */ uilib_get_element_min_x(hwnd, IDC_SELECT_CBMII_MEM_128, &xstart); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, cbm2_memory_left_group, &xpos); /* move and resize the left group element */ uilib_move_and_set_element_width(hwnd, IDC_CBM2_MEMORY, xstart - 10, xpos - xstart + 20); /* get the max x of the left group element */ uilib_get_element_max_x(hwnd, IDC_CBM2_MEMORY, &xpos); /* move the right group element */ uilib_move_element(hwnd, IDC_RAM_BANKS, xpos + 10); /* move the right group elements */ uilib_move_group(hwnd, cbm2_memory_move_right_group, xpos + 20); xstart = xpos + 20; /* get the max x of the right group */ uilib_get_group_max_x(hwnd, cbm2_memory_right_group, &xpos); /* move and resize the right group element */ uilib_move_and_set_element_width(hwnd, IDC_RAM_BANKS, xstart - 10, xpos - xstart + 20); resources_get_int("Ram08", &n); CheckDlgButton(hwnd, IDC_TOGGLE_CBMII_RAM08, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int("Ram1", &n); CheckDlgButton(hwnd, IDC_TOGGLE_CBMII_RAM1, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int("Ram2", &n); CheckDlgButton(hwnd, IDC_TOGGLE_CBMII_RAM2, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int("Ram4", &n); CheckDlgButton(hwnd, IDC_TOGGLE_CBMII_RAM4, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int("Ram6", &n); CheckDlgButton(hwnd, IDC_TOGGLE_CBMII_RAM6, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int("RamC", &n); CheckDlgButton(hwnd, IDC_TOGGLE_CBMII_RAMC, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int("RamSize", &res); switch (res) { case 128: n = IDC_SELECT_CBMII_MEM_128; break; case 256: n = IDC_SELECT_CBMII_MEM_256; break; case 512: n = IDC_SELECT_CBMII_MEM_512; break; case 1024: n = IDC_SELECT_CBMII_MEM_1024; break; } CheckRadioButton(hwnd, IDC_SELECT_CBMII_MEM_128, IDC_SELECT_CBMII_MEM_1024, n); }