示例#1
0
static void init_sound_record_dialog(HWND hwnd)
{
    HWND temp_hwnd;
    const char *sound_record_file;
    TCHAR *st_sound_record_file;
    int xpos;
    RECT rect;

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

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

    /* get the max x of the sound record format element */
    uilib_get_element_max_x(hwnd, IDC_SOUND_RECORD_FORMAT_LABEL, &xpos);

    /* move the sound record format indicator element to the correct position */
    uilib_move_element(hwnd, IDC_SOUND_RECORD_FORMAT, xpos + 10);

    /* get the max x of the sound record file element */
    uilib_get_element_max_x(hwnd, IDC_SOUND_RECORD_FILE_LABEL, &xpos);

    /* move the browse button to the correct position */
    uilib_move_element(hwnd, IDC_SOUND_RECORD_BROWSE, xpos + 10);

    /* get the max x of the right group */
    uilib_get_group_max_x(hwnd, sound_record_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_SOUND_RECORD_FORMAT);
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"AIFF");
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"IFF");
#ifdef USE_LAMEMP3
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"MP3");
#endif
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"VOC");
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"WAV");
#ifdef USE_LAMEMP3
    SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)4, 0);
#else
    SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)3, 0);
#endif

    resources_get_string("SoundRecordDeviceArg", &sound_record_file);
    st_sound_record_file = system_mbstowcs_alloc(sound_record_file);
    SetDlgItemText(hwnd, IDC_SOUND_RECORD_FILE, sound_record_file != NULL ? st_sound_record_file : TEXT(""));
    system_mbstowcs_free(st_sound_record_file);

    enable_sound_record_controls(hwnd);
}
示例#2
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);
}
示例#3
0
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);
}
示例#4
0
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);
}
示例#5
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);
    }
}
示例#6
0
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);

}
示例#7
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);
}
示例#8
0
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);
}
示例#9
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);
}
示例#10
0
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);
}
示例#11
0
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);
}