static TUI_MENU_CALLBACK(set_directory_callback) { char s[256]; int drive = (int)param; const char *v; if (!(check_current_drive_type(ATTACH_DEVICE_FS, drive))) { return "N/A"; } if (been_activated) { *s = '\0'; if (tui_input_string("Change directory name", "New name:", s, 255) == -1) { return NULL; } if (*s == '\0') { return NULL; } resources_set_string_sprintf("FSDevice%iDir", s, drive); ui_update_menus(); } resources_get_string_sprintf("FSDevice%iDir", &v, drive); return v; }
static int output_graphics_open(unsigned int prnr, output_parameter_t *output_parameter) { const char *filename; int device = 0; output_gfx[prnr].gfxoutputdrv = gfxoutput_get_driver("BMP"); if (output_gfx[prnr].gfxoutputdrv == NULL) { return -1; } switch (prnr) { case 0: resources_get_int("Printer4TextDevice", &device); break; case 1: resources_get_int("Printer5TextDevice", &device); break; case 2: resources_get_int("PrinterUserportTextDevice", &device); break; } resources_get_string_sprintf("PrinterTextDevice%d", &filename, device + 1); if (filename == NULL) { filename = "prngfx"; } output_gfx[prnr].filename = lib_malloc(strlen(filename) + 3); sprintf(output_gfx[prnr].filename, "%s00", filename); output_gfx[prnr].screenshot.width = output_parameter->maxcol; output_gfx[prnr].screenshot.height = output_parameter->maxrow; output_gfx[prnr].screenshot.dpi_x = output_parameter->dpi_x; output_gfx[prnr].screenshot.dpi_y = output_parameter->dpi_y; output_gfx[prnr].screenshot.y_offset = 0; output_gfx[prnr].screenshot.palette = output_parameter->palette; lib_free(output_gfx[prnr].line); output_gfx[prnr].line = lib_malloc(output_parameter->maxcol); memset(output_gfx[prnr].line, OUTPUT_PIXEL_WHITE, output_parameter->maxcol); output_gfx[prnr].line_pos = 0; output_gfx[prnr].line_no = 0; output_gfx[prnr].screenshot.convert_line = output_graphics_line_data; output_gfx[prnr].isopen = 0; return 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); }
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); } }
/** \brief Create printer driver selection widget * * Creates a group of radio buttons to select the driver of printer # \a device. * Uses a custom property "DeviceNumber" for the radio buttons and the widget * itself to pass the device number to the event handler and to allow * printer_driver_widget_update() to select the proper radio button index. * * Printer 4/5: [ascii, mps803, nl10, raw] * Printer 6 : [1520, raw] * * \param[in] device device number (4-6) * * \return GtkGrid */ GtkWidget *printer_driver_widget_create(int device) { GtkWidget *grid; GtkWidget *radio_ascii = NULL; GtkWidget *radio_mps803 = NULL; GtkWidget *radio_nl10 = NULL; GtkWidget *radio_raw = NULL; GtkWidget *radio_1520 = NULL; GSList *group = NULL; const char *driver; /* build grid */ grid = uihelpers_create_grid_with_label("Driver", 1); /* set DeviceNumber property to allow the update function to work */ resource_widget_set_int(grid, "DeviceNumber", device); if (device == 4 || device == 5) { /* 'normal' printers */ /* ASCII */ radio_ascii = gtk_radio_button_new_with_label(group, "ASCII"); g_object_set_data(G_OBJECT(radio_ascii), "DeviceNumber", GINT_TO_POINTER(device)); g_object_set(radio_ascii, "margin-left", 16, NULL); gtk_grid_attach(GTK_GRID(grid), radio_ascii, 0, 1, 1, 1); /* MPS803 */ radio_mps803 = gtk_radio_button_new_with_label(group, "MPS-803"); gtk_radio_button_join_group(GTK_RADIO_BUTTON(radio_mps803), GTK_RADIO_BUTTON(radio_ascii)); g_object_set_data(G_OBJECT(radio_mps803), "DeviceNumber", GINT_TO_POINTER(device)); g_object_set(radio_mps803, "margin-left", 16, NULL); gtk_grid_attach(GTK_GRID(grid), radio_mps803, 0, 2, 1, 1); /* NL10 */ radio_nl10 = gtk_radio_button_new_with_label(group, "NL10"); gtk_radio_button_join_group(GTK_RADIO_BUTTON(radio_nl10), GTK_RADIO_BUTTON(radio_mps803)); g_object_set_data(G_OBJECT(radio_nl10), "DeviceNumber", GINT_TO_POINTER(device)); g_object_set(radio_nl10, "margin-left", 16, NULL); gtk_grid_attach(GTK_GRID(grid), radio_nl10, 0, 3, 1, 1); /* RAW */ radio_raw = gtk_radio_button_new_with_label(group, "RAW"); gtk_radio_button_join_group(GTK_RADIO_BUTTON(radio_raw), GTK_RADIO_BUTTON(radio_nl10)); g_object_set_data(G_OBJECT(radio_raw), "DeviceNumber", GINT_TO_POINTER(device)); g_object_set(radio_raw, "margin-left", 16, NULL); gtk_grid_attach(GTK_GRID(grid), radio_raw, 0, 4, 1, 1); } else if (device == 6) { /* plotter */ /* 1520 */ radio_1520 = gtk_radio_button_new_with_label(group, "1520"); g_object_set_data(G_OBJECT(radio_1520), "DeviceNumber", GINT_TO_POINTER(device)); g_object_set(radio_1520, "margin-left", 16, NULL); gtk_grid_attach(GTK_GRID(grid), radio_1520, 0, 1, 1, 1); /* RAW */ radio_raw = gtk_radio_button_new_with_label(group, "RAW"); gtk_radio_button_join_group(GTK_RADIO_BUTTON(radio_raw), GTK_RADIO_BUTTON(radio_1520)); g_object_set_data(G_OBJECT(radio_raw), "DeviceNumber", GINT_TO_POINTER(device)); g_object_set(radio_raw, "margin-left", 16, NULL); gtk_grid_attach(GTK_GRID(grid), radio_raw, 0, 2, 1, 1); } else { fprintf(stderr, "%s:%d:%s(): invalid device #%d\n", __FILE__, __LINE__, __func__, device); archdep_vice_exit(1); } /* set current driver from resource */ resources_get_string_sprintf("Printer%dDriver", &driver, device); printer_driver_widget_update(grid, driver); /* connect signal handlers */ g_signal_connect(radio_raw, "toggled", G_CALLBACK(on_radio_toggled), (gpointer)"raw"); if (device == 4 || device == 5) { g_signal_connect(radio_ascii, "toggled", G_CALLBACK(on_radio_toggled), (gpointer)"ascii"); g_signal_connect(radio_mps803, "toggled", G_CALLBACK(on_radio_toggled), (gpointer)"mps803"); g_signal_connect(radio_nl10, "toggled", G_CALLBACK(on_radio_toggled), (gpointer)"nl10"); } else if (device == 6) { g_signal_connect(radio_1520, "toggled", G_CALLBACK(on_radio_toggled), (gpointer)"1520"); } gtk_widget_show_all(grid); return grid; }
static MRESULT EXPENTRY pm_drive(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { static int drive = 0; switch (msg) { case WM_INITDLG: { int val, i = 0; HWND ihwnd = WinWindowFromID(hwnd, CBS_IMAGE); while (i < 10 && ui_status.imageHist[i][0]) { WinLboxInsertItem(ihwnd, ui_status.imageHist[i++]); } WinLboxInsertItem(ihwnd, ""); resources_get_int("DriveTrueEmulation", &val); WinCheckButton(hwnd, CB_TRUEDRIVE, val); WinCheckButton(hwnd, RB_DRIVE8|drive, 1); WinSendMsg(hwnd, WM_SWITCH, (void*)drive, 0); WinSendMsg(hwnd, WM_DRIVESTATE, (void*)ui_status.lastDriveState, NULL); for (i = 0; i < 3; i++) { WinSendMsg(hwnd, WM_TRACK, (void*)i, (void*)(int)(ui_status.lastTrack[i] * 2)); } } break; case WM_COMMAND: switch (LONGFROMMP(mp1)) { case PB_CREATE: create_dialog(hwnd); return FALSE; case PB_ATTACH: ViceFileDialog(hwnd, 0x0100 | (drive + 1), FDS_OPEN_DIALOG); return FALSE; case PB_DETACH: file_system_detach_disk(drive + 8); return FALSE; case PB_FLIPADD: fliplist_add_image(drive + 8); return FALSE; case PB_FLIPREMOVE: fliplist_remove(drive + 8, NULL); return FALSE; case PB_FLIP: fliplist_attach_head(drive + 8, FLIP_NEXT); return FALSE; } break; case WM_CONTROL: { switch (SHORT1FROMMP(mp1)) { case RB_DRIVE8: case RB_DRIVE9: case RB_DRIVE10: case RB_DRIVE11: WinSendMsg(hwnd, WM_SWITCH, (void*)(SHORT1FROMMP(mp1) & 0x3), 0); break; case CB_TRUEDRIVE: toggle("DriveTrueEmulation"); WinSendMsg(hwnd, WM_SWITCH, (void*)drive, 0); break; case CB_CONVERTP00: toggle_drive_res("FSDevice%dConvertP00", drive);//); WinSendMsg(hwnd, WM_SWITCH, (void*)drive, 0); break; case CB_SAVEP00: toggle_drive_res("FileDevice%dSaveP00", drive); break; case CB_ALLOWACCESS: toggle_drive_res("FileSystemDevice%d", drive); WinSendMsg(hwnd, WM_SWITCH, (void*)drive, 0); break; case CB_HIDENONP00: toggle_drive_res("FSDevice%dHideCBMFiles", drive); break; case CB_MEM2000: toggle_drive_res("Drive%dRAM2000", drive); break; case CB_MEM4000: toggle_drive_res("Drive%dRAM4000", drive); break; case CB_MEM6000: toggle_drive_res("Drive%dRAM6000", drive); break; case CB_MEM8000: toggle_drive_res("Drive%dRAM8000", drive); break; case CB_MEMA000: toggle_drive_res("Drive%dRAMA000", drive); break; case CB_READONLY: toggle_drive_res("AttachDevice%dReadonly", drive); break; case CB_PARALLEL: if (drive == 0 || drive == 1) { toggle_drive_res("Drive%dParallelCable", drive); } break; case RB_NEVER: case RB_ASK: case RB_ALWAYS: if (drive == 0 || drive == 1) { resources_set_int_sprintf("Drive%dExtendImagePolicy", (SHORT1FROMMP(mp1) & 0x3), drive + 8); } break; case RB_NONE: case RB_TRAP: case RB_SKIP: if (drive == 0 || drive == 1) { resources_set_int_sprintf("Drive%dIdleMethod", (SHORT1FROMMP(mp1) & 0x3), drive + 8); } break; case CBS_IMAGE: if (SHORT2FROMMP(mp1) == CBN_ENTER) { char psz[CCHMAXPATH]; WinLboxQuerySelectedItemText(hwnd, CBS_IMAGE, psz, CCHMAXPATH); if (!strlen(psz)) { file_system_detach_disk(drive + 8); return FALSE; } if (file_system_attach_disk(drive + 8, psz)) { WinMessageBox(HWND_DESKTOP, hwnd, "Cannot attach specified file.", "VICE/2 Error", 0, MB_OK); } } return FALSE; case CBS_PATH: switch (SHORT2FROMMP(mp1)) { case SPBN_CHANGE: { char path[255]; WinSendDlgMsg(hwnd, CBS_PATH, SPBM_QUERYVALUE, &path, 255); if (!chdir(path)) { resources_set_string_sprintf("FSDevice%dDir", path, drive + 8); } } break; case SPBN_KILLFOCUS: { const char *path; resources_get_string_sprintf("FSDevice%dDir", &path, drive + 8); WinSendDlgMsg(hwnd, CBS_PATH, SPBM_SETARRAY, &path, 1); WinSetDlgSpinVal(hwnd, CBS_PATH, 0); } break; } return FALSE; case CBS_TYPE: if (SHORT2FROMMP(mp1) == CBN_ENTER && (drive == 0 || drive == 1)) { const int nr = WinQueryLboxSelectedItem((HWND)mp2); const int val = WinLboxItemHandle((HWND)mp2, nr); resources_set_int_sprintf("Drive%dType", val, drive + 8); } return FALSE; } } break; case WM_DRIVEIMAGE: { HWND ihwnd = WinWindowFromID(hwnd, CBS_IMAGE); const char *name = (char *)mp1; int pos; for (pos = 0; pos < 9; pos++) { WinDeleteLboxItem(ihwnd, 0); } pos = 0; while (pos < 10 && ui_status.imageHist[pos][0]) { WinLboxInsertItem(ihwnd, ui_status.imageHist[pos++]); } WinLboxInsertItem(ihwnd, ""); if (drive == (int)mp2) { WinLboxSelectItem(ihwnd, name[0] ? 0 : pos); } } return FALSE; case WM_TRACK: if (!(ui_status.lastDriveState & (1 << (int)mp1))) { break; } WinSetDlgSpinVal(hwnd, SPB_TRACK8+(int)mp1, (int)((int)mp2 / 2)); WinShowDlg(hwnd, SS_HALFTRACK8 + (int)mp1, ((int)mp2 % 2)); break; case WM_DRIVELEDS: WinShowDlg(hwnd, SS_LED8+(int)mp1, (int)mp2); break; case WM_DRIVESTATE: WinShowDlg(hwnd, SPB_TRACK8, (int)mp1 & 1 == 1); WinShowDlg(hwnd, SS_HALFTRACK8, (int)mp1 & 1 == 1); WinShowDlg(hwnd, SPB_TRACK9, (int)mp1 & 2 == 1); WinShowDlg(hwnd, SS_HALFTRACK9, (int)mp1 & 2 == 1); WinShowDlg(hwnd, SS_LED8, 0); WinShowDlg(hwnd, SS_LED9, 0); break; case WM_SWITCH: drive = (int)mp1; { const HWND lbox = WinWindowFromID(hwnd, CBS_TYPE); int type = 0; int val; int res; int drive89 = (drive == 0 || drive == 1); resources_get_int("DriveTrueEmulation", &val); WinLboxEmpty(lbox); if (drive89) { int i, nr; WinCheckButton(hwnd, RB_NEVER | get_drive_res("Drive%dExtendImagePolicy", drive), 1); WinCheckButton(hwnd, RB_NONE | get_drive_res("Drive%dIdleMethod", drive), 1); nr = 0; res = get_drive_res("Drive%dType", drive); for (i = 0; i < nDRIVES; i++) { if (!drive_check_type(driveRes[i], drive)) { continue; } WinLboxInsertItem(lbox, driveName[i]); WinLboxSetItemHandle(lbox, nr, driveRes[i]); if (res == driveRes[i]) { type = nr; } nr++; } } else { WinCheckButton(hwnd, RB_NEVER, 0); WinCheckButton(hwnd, RB_ASK, 0); WinCheckButton(hwnd, RB_ALWAYS, 0); WinCheckButton(hwnd, RB_NONE, 0); WinCheckButton(hwnd, RB_SKIP, 0); WinCheckButton(hwnd, RB_TRAP, 0); } WinLboxSelectItem(lbox, type); WinCheckButton(hwnd, CB_PARALLEL, drive89 && get_drive_res("Drive%dParallelCable", drive) != 0); WinCheckButton(hwnd, CB_MEM2000, drive89 && get_drive_res("Drive%dRAM2000", drive) != 0); WinCheckButton(hwnd, CB_MEM4000, drive89 && get_drive_res("Drive%dRAM4000", drive) != 0); WinCheckButton(hwnd, CB_MEM6000, drive89 && get_drive_res("Drive%dRAM6000", drive) != 0); WinCheckButton(hwnd, CB_MEM8000, drive89 && get_drive_res("Drive%dRAM8000", drive) != 0); WinCheckButton(hwnd, CB_MEMA000, drive89 && get_drive_res("Drive%dRAMA000", drive) != 0); WinEnableControl(hwnd, CB_PARALLEL, drive89 && val); WinEnableControl(hwnd, RB_NEVER, drive89 && val); WinEnableControl(hwnd, RB_ASK, drive89 && val); WinEnableControl(hwnd, RB_ALWAYS, drive89 && val); WinEnableControl(hwnd, RB_NONE, drive89 && val); WinEnableControl(hwnd, RB_SKIP, drive89 && val); WinEnableControl(hwnd, RB_TRAP, drive89 && val); WinEnableControl(hwnd, CBS_TYPE, drive89 && val); WinEnableControl(hwnd, CB_MEM2000, drive89 && val); WinEnableControl(hwnd, CB_MEM4000, drive89 && val); WinEnableControl(hwnd, CB_MEM6000, drive89 && val); WinEnableControl(hwnd, CB_MEM8000, drive89 && val); WinEnableControl(hwnd, CB_MEMA000, drive89 && val); { int acc = get_drive_res("FileSystemDevice%d", drive) != 0; int conv = get_drive_res("FSDevice%dConvertP00", drive) != 0; if (!conv) { resources_set_int_sprintf("FSDevice%dHideCBMFiles", 0, drive + 8); } WinCheckButton(hwnd, CB_ALLOWACCESS, acc); WinCheckButton(hwnd, CB_CONVERTP00, conv); WinCheckButton(hwnd, CB_SAVEP00, get_drive_res("FSDevice%dSaveP00", drive) != 0); WinCheckButton(hwnd, CB_HIDENONP00, get_drive_res("FSDevice%dHideCBMFiles", drive) != 0); WinEnableControl(hwnd, CB_ALLOWACCESS, !(drive89 && val)); WinEnableControl(hwnd, CB_SAVEP00, !(drive89 && val) && acc); WinEnableControl(hwnd, CB_CONVERTP00, !(drive89 && val) && acc); WinEnableControl(hwnd, CBS_PATH, !(drive89 && val) && acc); WinEnableControl(hwnd, CB_HIDENONP00, !(drive89 && val) && acc && conv); WinCheckButton(hwnd, CB_READONLY, get_drive_res("AttachDevice%dReadonly", drive) != 0); } { char tmp[CCHMAXPATH]; int max = WinDlgLboxQueryCount(hwnd, CBS_IMAGE); int pos = -1; do { WinLboxQueryItem(hwnd, CBS_IMAGE, ++pos, tmp, CCHMAXPATH); } while (pos < max && strcmp(ui_status.lastImage[drive], tmp)); WinDlgLboxSelectItem(hwnd, CBS_IMAGE, pos); } { const char *path; resources_get_string_sprintf("FSDevice%dDir", &path, drive + 8); WinSendDlgMsg(hwnd, CBS_PATH, SPBM_SETARRAY, &path, 1); WinSetDlgSpinVal(hwnd, CBS_PATH, 0); } } return FALSE; } return WinDefDlgProc (hwnd, msg, mp1, mp2); }