コード例 #1
0
ファイル: uipetset.c プロジェクト: r-type/vice-libretro
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);
}
コード例 #2
0
ファイル: uidrivec64dtv.c プロジェクト: r-type/vice-libretro
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);
}
コード例 #3
0
ファイル: uiperipheral.c プロジェクト: r-type/vice-libretro
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);
    }
}
コード例 #4
0
ファイル: uicbm2set.c プロジェクト: BigBoss21X/vice-emu
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);
}
コード例 #5
0
ファイル: uicbm2set.c プロジェクト: BigBoss21X/vice-emu
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);
}
コード例 #6
0
ファイル: uirom.c プロジェクト: peterled/vice
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);
}
コード例 #7
0
ファイル: uipetset.c プロジェクト: r-type/vice-libretro
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);
}