static void init_pet8296_dialog(HWND hwnd) { int n; int xstart; int xpos; HWND parent_hwnd; parent_hwnd = GetParent(hwnd); /* translate all dialog items */ uilib_localize_dialog(hwnd, pet8296_dialog_trans); /* translate all dialog items of the parent */ uilib_localize_dialog(parent_hwnd, parent_dialog_trans); /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, pet8296_main_group); /* get the min x of the ram 9 element */ uilib_get_element_min_x(hwnd, IDC_TOGGLE_PET_8296_RAM9, &xstart); /* get the max x of the main group */ uilib_get_group_max_x(hwnd, pet8296_main_group, &xpos); /* resize and move the group box to the correct position */ uilib_move_and_set_element_width(hwnd, IDC_PET_RAM_SETTINGS, xstart - 10, xpos - xstart + 20); resources_get_int("Ram9", &n); CheckDlgButton(hwnd, IDC_TOGGLE_PET_8296_RAM9, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int("RamA", &n); CheckDlgButton(hwnd, IDC_TOGGLE_PET_8296_RAMA, n ? BST_CHECKED : BST_UNCHECKED); }
static void init_autostart_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; const char *autostartfile; TCHAR *st_autostartfile; int xsize, ysize; int xsize2; RECT rect; uilib_localize_dialog(hwnd, autostart_dialog); uilib_get_group_extent(hwnd, autostart_leftgroup1, &xsize, &ysize); uilib_adjust_group_width(hwnd, autostart_leftgroup1); uilib_move_and_adjust_group_width(hwnd, autostart_rightgroup1, xsize + 30); uilib_get_group_extent(hwnd, autostart_leftgroup2, &xsize2, &ysize); uilib_adjust_group_width(hwnd, autostart_leftgroup2); uilib_move_group(hwnd, autostart_rightgroup2, xsize2 + 30); /* get the max x of the rightgroup3 elements */ uilib_get_group_max_x(hwnd, autostart_rightgroup3, &xsize); /* resize the text fill-in box */ uilib_move_and_set_element_width(hwnd, IDC_AUTOSTART_DISK_IMAGE_FILE, 9, xsize - 9); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xsize + 20, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); resources_get_int("AutostartWarp", &res_value); CheckDlgButton(hwnd, IDC_AUTOSTART_WARP, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("AutostartRunWithColon", &res_value); CheckDlgButton(hwnd, IDC_AUTOSTART_USE_COLON_WITH_RUN, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("AutostartBasicLoad", &res_value); CheckDlgButton(hwnd, IDC_AUTOSTART_LOAD_TO_BASIC, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("AutostartDelayRandom", &res_value); CheckDlgButton(hwnd, IDC_AUTOSTART_RANDOM_DELAY, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("AutostartHandleTrueDriveEmulation", &res_value); CheckDlgButton(hwnd, IDC_AUTOSTART_HANDLE_TRUE_DRIVE_EMULATION, res_value ? BST_CHECKED : BST_UNCHECKED); temp_hwnd = GetDlgItem(hwnd, IDC_AUTOSTART_PRG_MODE); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_AUTOSTART_VIRTUAL_FS)); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_AUTOSTART_INJECT)); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_AUTOSTART_DISK)); resources_get_int("AutostartPrgMode", &res_value); SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0); resources_get_string("AutostartPrgDiskImage", &autostartfile); st_autostartfile = system_mbstowcs_alloc(autostartfile); SetDlgItemText(hwnd, IDC_AUTOSTART_DISK_IMAGE_FILE, autostartfile != NULL ? st_autostartfile : TEXT("")); system_mbstowcs_free(st_autostartfile); }
static void init_model_dialog(HWND hwnd) { int n, res; HWND parent_hwnd; HWND element; int xstart, xpos; parent_hwnd = GetParent(hwnd); /* translate all dialog items */ uilib_localize_dialog(hwnd, model_dialog_trans); /* translate all dialog items of the parent */ uilib_localize_dialog(parent_hwnd, parent_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); } /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, model_main_group); /* get the min x of the right group */ uilib_get_group_min_x(hwnd, model_right_group, &xstart); /* get the max x of the right group */ uilib_get_group_max_x(hwnd, model_right_group, &xpos); /* resize and move the group box to the correct position */ uilib_move_and_set_element_width(hwnd, IDC_PET_MEMORY, xstart - 10, xpos - xstart + 20); resources_get_int("RamSize", &res); switch (res) { case 4: n = IDC_SELECT_PET_MEM4K; break; case 8: n = IDC_SELECT_PET_MEM8K; break; case 16: n = IDC_SELECT_PET_MEM16K; break; case 32: n = IDC_SELECT_PET_MEM32K; break; case 96: n = IDC_SELECT_PET_MEM96K; break; case 128: n = IDC_SELECT_PET_MEM128K; break; } CheckRadioButton(hwnd, IDC_SELECT_PET_MEM4K, IDC_SELECT_PET_MEM128K, n); }
static void init_dialog(HWND hwnd, int num) { int drive_type, drive_extend_image_policy, drive_idle_method, n; int drive_true_emulation, iecdevice, enabled; int xpos; int xstart; HWND parent_hwnd; HWND element; parent_hwnd = GetParent(hwnd); /* translate all dialog items */ uilib_localize_dialog(hwnd, drive_dialog_trans); /* translate the parent window items */ uilib_localize_dialog(parent_hwnd, parent_dialog_trans); /* translate the generic items */ for (n = 0; generic_items[n].text != NULL; n++) { element = GetDlgItem(hwnd, generic_items[n].idm); SetWindowText(element, generic_items[n].text); } /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, drive_main_group); /* get the max x of the elements in the left group */ uilib_get_group_max_x(hwnd, drive_left_group, &xpos); /* get the min x of the none element of the left group */ uilib_get_element_min_x(hwnd, IDC_SELECT_DRIVE_TYPE_NONE, &xstart); /* resize and move the left group element to the correct position */ uilib_move_and_set_element_width(hwnd, IDC_DRIVE_TYPE, xstart - 10, xpos - xstart + 20); /* get the max x of the left group element */ uilib_get_element_max_x(hwnd, IDC_DRIVE_TYPE, &xpos); /* move the middle group elements to the correct position */ uilib_move_group(hwnd, drive_middle_move_group, xpos + 20); uilib_move_element(hwnd, IDC_40_TRACK_HANDLING, xpos + 10); uilib_move_element(hwnd, IDC_DRIVE_EXPANSION, xpos + 10); xstart = xpos + 20; /* get the max x of the middle group */ uilib_get_group_max_x(hwnd, drive_middle_group, &xpos); /* resize and move the middle group boxes to the correct position */ uilib_move_and_set_element_width(hwnd, IDC_40_TRACK_HANDLING, xstart - 10, xpos - xstart + 20); uilib_move_and_set_element_width(hwnd, IDC_DRIVE_EXPANSION, xstart - 10, xpos - xstart + 20); /* get the max x of the middle group element */ uilib_get_element_max_x(hwnd, IDC_DRIVE_EXPANSION, &xpos); /* move the right group elements to the correct position */ uilib_move_group(hwnd, drive_right_move_group, xpos + 20); uilib_move_element(hwnd, IDC_IDLE_METHOD, xpos + 10); xstart = xpos + 20; /* get the max x of the right group */ uilib_get_group_max_x(hwnd, drive_right_group, &xpos); /* resize and move the right group element to the correct position */ uilib_move_and_set_element_width(hwnd, IDC_IDLE_METHOD, xstart - 10, xpos - xstart + 20); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(parent_hwnd, move_buttons_group, 0); resources_get_int_sprintf("IECDevice%i", &iecdevice, num); resources_get_int("DriveTrueEmulation", &drive_true_emulation); enabled = drive_true_emulation && !iecdevice; EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_1540), enabled && drive_check_type(DRIVE_TYPE_1540, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_1541), enabled && drive_check_type(DRIVE_TYPE_1541, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_1541II), enabled && drive_check_type(DRIVE_TYPE_1541II, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_1570), enabled && drive_check_type(DRIVE_TYPE_1570, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_1571), enabled && drive_check_type(DRIVE_TYPE_1571, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_1581), enabled && drive_check_type(DRIVE_TYPE_1581, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_2000), enabled && drive_check_type(DRIVE_TYPE_2000, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_4000), enabled && drive_check_type(DRIVE_TYPE_4000, num - 8)); EnableWindow(GetDlgItem(hwnd, IDC_SELECT_DRIVE_TYPE_NONE), enabled); resources_get_int_sprintf("Drive%dType", &drive_type, num); resources_get_int_sprintf("Drive%dExtendImagePolicy", &drive_extend_image_policy, num); resources_get_int_sprintf("Drive%dIdleMethod", &drive_idle_method, num); dialog_drive_type[num - 8] = drive_type; switch (drive_type) { case DRIVE_TYPE_NONE: n = IDC_SELECT_DRIVE_TYPE_NONE; break; case DRIVE_TYPE_1540: n = IDC_SELECT_DRIVE_TYPE_1540; break; case DRIVE_TYPE_1541: n = IDC_SELECT_DRIVE_TYPE_1541; break; case DRIVE_TYPE_1541II: n = IDC_SELECT_DRIVE_TYPE_1541II; break; case DRIVE_TYPE_1570: n = IDC_SELECT_DRIVE_TYPE_1570; break; case DRIVE_TYPE_1571: n = IDC_SELECT_DRIVE_TYPE_1571; break; case DRIVE_TYPE_1581: n = IDC_SELECT_DRIVE_TYPE_1581; break; case DRIVE_TYPE_2000: n = IDC_SELECT_DRIVE_TYPE_2000; break; case DRIVE_TYPE_4000: n = IDC_SELECT_DRIVE_TYPE_4000; break; } if (!enabled) { n = IDC_SELECT_DRIVE_TYPE_NONE; } CheckRadioButton(hwnd, IDC_SELECT_DRIVE_TYPE_1541, IDC_SELECT_DRIVE_TYPE_NONE, n); enable_controls_for_drive_settings(hwnd, n); dialog_drive_extend[num - 8] = drive_extend_image_policy; switch (drive_extend_image_policy) { case DRIVE_EXTEND_NEVER: n = IDC_SELECT_DRIVE_EXTEND_NEVER; break; case DRIVE_EXTEND_ASK: n = IDC_SELECT_DRIVE_EXTEND_ASK; break; case DRIVE_EXTEND_ACCESS: n = IDC_SELECT_DRIVE_EXTEND_ACCESS; break; } CheckRadioButton(hwnd, IDC_SELECT_DRIVE_EXTEND_NEVER, IDC_SELECT_DRIVE_EXTEND_ACCESS, n); dialog_drive_idle[num - 8] = drive_idle_method; switch (drive_idle_method) { case DRIVE_IDLE_NO_IDLE: n = IDC_SELECT_DRIVE_IDLE_NO_IDLE; break; case DRIVE_IDLE_TRAP_IDLE: n = IDC_SELECT_DRIVE_IDLE_TRAP_IDLE; break; case DRIVE_IDLE_SKIP_CYCLES: n = IDC_SELECT_DRIVE_IDLE_SKIP_CYCLES; break; } CheckRadioButton(hwnd, IDC_SELECT_DRIVE_IDLE_NO_IDLE, IDC_SELECT_DRIVE_IDLE_SKIP_CYCLES, n); resources_get_int_sprintf("Drive%dRAM2000", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_DRIVE_EXPANSION_2000, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("Drive%dRAM4000", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_DRIVE_EXPANSION_4000, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("Drive%dRAM6000", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_DRIVE_EXPANSION_6000, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("Drive%dRAM8000", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_DRIVE_EXPANSION_8000, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("Drive%dRAMA000", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_DRIVE_EXPANSION_A000, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int_sprintf("Drive%dRTCSave", &n, num); CheckDlgButton(hwnd, IDC_TOGGLE_DRIVE_RTC_SAVE, n ? BST_CHECKED : BST_UNCHECKED); }
static void init_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); }
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_io_dialog(HWND hwnd) { int n, res; HWND parent_hwnd; HWND element; int xpos; int xstart; parent_hwnd = GetParent(hwnd); /* translate all dialog items */ uilib_localize_dialog(hwnd, io_dialog_trans); /* translate all dialog items of the parent */ uilib_localize_dialog(parent_hwnd, parent_dialog_trans); /* translate all generic items */ for (n = 0; generic_items2[n].text != NULL; n++) { element = GetDlgItem(hwnd, generic_items2[n].idm); SetWindowText(element, generic_items2[n].text); } /* adjust the size of the elements in the main group */ uilib_adjust_group_width(hwnd, io_main_group); /* get the min x of the video auto element */ uilib_get_element_min_x(hwnd, IDC_SELECT_PET_VIDEO_AUTO, &xstart); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, io_left_group, &xpos); /* resize and move the left group boxes to the correct positions */ uilib_move_and_set_element_width(hwnd, IDC_PET_VIDEO, xstart - 10, xpos - xstart + 20); uilib_move_and_set_element_width(hwnd, IDC_PET_IO_SIZE, xstart - 10, xpos - xstart + 20); /* get the max x of the video group element */ uilib_get_element_max_x(hwnd, IDC_PET_VIDEO, &xpos); /* move the right move group to the correct position */ uilib_move_group(hwnd, io_right_move_group, xpos + 20); /* move the right group boxes to the correct position */ uilib_move_element(hwnd, IDC_PET_CRTC, xpos + 10); uilib_move_element(hwnd, IDC_PET_KEYBOARD, xpos + 10); xstart = xpos + 20; /* get the max x of the right group */ uilib_get_group_max_x(hwnd, io_right_group, &xpos); /* resize and move the right group boxes to the correct positions */ uilib_move_and_set_element_width(hwnd, IDC_PET_CRTC, xstart - 10, xpos - xstart + 20); uilib_move_and_set_element_width(hwnd, IDC_PET_KEYBOARD, xstart - 10, xpos - xstart + 20); resources_get_int("Crtc", &n); CheckDlgButton(hwnd, IDC_TOGGLE_PET_CRTC, n ? BST_CHECKED : BST_UNCHECKED); resources_get_int("VideoSize", &res); switch (res) { case 0: n = IDC_SELECT_PET_VIDEO_AUTO; break; case 40: n = IDC_SELECT_PET_VIDEO_40; break; case 80: n = IDC_SELECT_PET_VIDEO_80; break; } CheckRadioButton(hwnd, IDC_SELECT_PET_VIDEO_AUTO, IDC_SELECT_PET_VIDEO_80, n); resources_get_int("IOSize", &res); switch (res) { case 0x100: n = IDC_SELECT_PET_IO256; break; case 0x800: n = IDC_SELECT_PET_IO2K; break; } CheckRadioButton(hwnd, IDC_SELECT_PET_IO2K, IDC_SELECT_PET_IO256, n); resources_get_int("KeymapIndex", &res); switch (res) { case 2: n = IDC_SELECT_PET_KEYB_GRAPHICS; break; case 0: n = IDC_SELECT_PET_KEYB_BUSINESS; break; } CheckRadioButton(hwnd, IDC_SELECT_PET_KEYB_GRAPHICS, IDC_SELECT_PET_KEYB_BUSINESS, n); }