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_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); } }