Beispiel #1
0
static void init_machine_dialog(HWND hwnd)
{
    HWND machine_hwnd;
    int res_value;
    int res_value_loop;
    int xpos;

    /* translate all dialog items */
    uilib_localize_dialog(hwnd, machine_dialog_trans);

    /* adjust the size of the  machine type element */
    uilib_adjust_element_width(hwnd, IDC_MACHINE_TYPE);

    /* get the max x of the machine type element */
    uilib_get_element_max_x(hwnd, IDC_MACHINE_TYPE, &xpos);

    /* move the machine type indicator element */
    uilib_move_element(hwnd, IDC_C128_MACHINE_TYPE, xpos + 10);

    resources_get_int("MachineType", &res_value);
    machine_hwnd = GetDlgItem(hwnd, IDC_C128_MACHINE_TYPE);
    for (res_value_loop = 0; ui_machine[res_value_loop] != 0; res_value_loop++) {
        SendMessage(machine_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(ui_machine[res_value_loop]));
    }
    SendMessage(machine_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0);

    enable_machine_controls(hwnd);
}
Beispiel #2
0
static void init_resources_dialog(HWND hwnd, unsigned int type)
{
    unsigned int n = 0;
    int xpos1, xpos2;
    int size;
    RECT rect;
    int idc;
    int i;
    HWND element;

    if (type == UIROM_TYPE_MAIN) {
        /* translate all dialog items */
        uilib_localize_dialog(hwnd, main_res_trans);

        idc = IDC_COMPUTER_RESOURCES;
    } else if (type == UIROM_TYPE_DRIVE) {
        /* translate all dialog items */
        uilib_localize_dialog(hwnd, drive_res_trans);

        /* translate generic items */
        for (i = 0; generic_res_trans[i].text != NULL; i++) {
            element = GetDlgItem(hwnd, generic_res_trans[i].idm);
            SetWindowText(element, generic_res_trans[i].text);
        }
        
        idc = IDC_DRIVE_RESOURCES;
    }

    /* get the max x of the group element */
    uilib_get_element_max_x(hwnd, idc, &xpos1);

    /* get the size of the group element */
    uilib_get_element_size(hwnd, idc, &size);

    /* adjust the size of the group element */
    uilib_adjust_element_width(hwnd, idc);

    /* get the max x of the group element */
    uilib_get_element_max_x(hwnd, idc, &xpos2);

    if (xpos2 < xpos1) {
        /* restore the size of the group element */
        uilib_set_element_width(hwnd, idc, size);
    } else {
        /* resize the dialog window */
        GetWindowRect(hwnd, &rect);
        MoveWindow(hwnd, rect.left, rect.top, xpos2 + 10, rect.bottom - rect.top, TRUE);

        /* recenter the buttons in the newly resized dialog window */
        uilib_center_buttons(hwnd, move_buttons_group, 0);
    }

    while (settings[n].realname != NULL) {
        if (settings[n].type == type) {
            int enable;

            resources_get_int_sprintf("Romset%s", &enable, settings[n].resname);

            CheckDlgButton(hwnd, settings[n].idc_resource, enable ? BST_CHECKED : BST_UNCHECKED);
        }
        n++;
    }
}
Beispiel #3
0
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);
    }
}
Beispiel #4
0
static void init_datasette_dialog(HWND hwnd)
{
    HWND snd_hwnd;
    int res_value;
    int res_value_loop;
    int active_value;
    int xpos_max;
    int group_max;
    RECT rect;

    /* translate all dialog items */
    uilib_localize_dialog(hwnd, datasette_dialog);

    /* adjust the size of the elements in the datasette_sub_group */
    uilib_adjust_group_width(hwnd, datasette_sub_group);

    /* adjust the size of the  'reset with cpu' element */
    uilib_adjust_element_width(hwnd, IDC_DATASETTE_RESET_WITH_CPU);

    /* adjust the size of the motor group element */
    uilib_adjust_element_width(hwnd, IDC_DATASETTE_MOTOR_GROUP);

    /* get the max x of the datasette_sub_group */
    uilib_get_group_max_x(hwnd, datasette_sub_group, &xpos_max);

    /* get the max x of the motor group element */
    uilib_get_element_max_x(hwnd, IDC_DATASETTE_MOTOR_GROUP, &group_max);

    /* calculate the max x of the motor group element and the
       datasette_sub_group elements */
    if (group_max < xpos_max + 10) {
        group_max = xpos_max + 10;
    }

    /* set the width of the motor group element to 'surround' the
       datasette_sub_group elements */
    uilib_set_element_width(hwnd, IDC_DATASETTE_MOTOR_GROUP, group_max);

    /* get the max x of the datasette_main_group elements */
    uilib_get_group_max_x(hwnd, datasette_main_group, &xpos_max);

    /* set the width of the dialog to 'surround' all the elements */
    GetWindowRect(hwnd, &rect);
    MoveWindow(hwnd, rect.left, rect.top, xpos_max + 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("DatasetteResetWithCPU", &res_value);
    CheckDlgButton(hwnd, IDC_DATASETTE_RESET_WITH_CPU, res_value ? BST_CHECKED : BST_UNCHECKED);

    snd_hwnd = GetDlgItem(hwnd, IDC_DATASETTE_ZERO_GAP_DELAY);
    for (res_value_loop = 0; res_value_loop < 7; res_value_loop++) {
        TCHAR st[10];

        _stprintf(st, TEXT("%d"), ui_datasette_zero_gap_delay[res_value_loop]);
        SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)st);
    }
    resources_get_int("DatasetteZeroGapDelay", &res_value);
    active_value = 4; /* default */
    for (res_value_loop = 0; res_value_loop < 7; res_value_loop++) {
        if (ui_datasette_zero_gap_delay[res_value_loop] == res_value) {
            active_value = res_value_loop;
        }
    }
    SendMessage(snd_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0);

    snd_hwnd = GetDlgItem(hwnd, IDC_DATASETTE_SPEED_TUNING);
    for (res_value_loop = 0; res_value_loop < 8; res_value_loop++) {
        TCHAR st[10];
        _stprintf(st, TEXT("%d"), res_value_loop);
        SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)st);
    }
    resources_get_int("DatasetteSpeedTuning", &res_value);
    SendMessage(snd_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0);
}