From 47d6e815b63f9c27454c469aa965183aa40490e5 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 24 Jan 2018 20:58:39 +0100 Subject: [PATCH] Adding the hard disk image now shows a progress bar indicating progress so that the end user is no longer left with a non-responding dialog and no idea what's going on. --- src/disk/hdd_image.c | 14 ++++++++------ src/win/86Box.rc | 5 ++++- src/win/resource.h | 4 +++- src/win/win_settings.c | 37 ++++++++++++++++++++++++++++++++++++- 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/src/disk/hdd_image.c b/src/disk/hdd_image.c index a4f72f7b8..1722e20f6 100644 --- a/src/disk/hdd_image.c +++ b/src/disk/hdd_image.c @@ -8,15 +8,13 @@ * * Handling of hard disk image files. * - * Version: @(#)hdd_image.c 1.0.9 2017/12/09 + * Version: @(#)hdd_image.c 1.0.10 2018/01/24 * - * Authors: Sarah Walker, - * Miran Grca, + * Authors: Miran Grca, * Fred N. van Kempen, * - * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. - * Copyright 2017 Fred N. van Kempen. + * Copyright 2016-2018 Miran Grca. + * Copyright 2017,2018 Fred N. van Kempen. */ #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE @@ -354,10 +352,12 @@ prepare_new_hard_disk: empty_sector_1mb = (char *) malloc(1048576); memset(empty_sector_1mb, 0, 1048576); + pclog("Writing image sectors: ["); if (s > 0) { for (i = 0; i < s; i++) { + pclog("#"); fwrite(empty_sector, 1, 512, hdd_images[id].file); } } @@ -366,9 +366,11 @@ prepare_new_hard_disk: { for (i = 0; i < t; i++) { + pclog("#"); fwrite(empty_sector_1mb, 1, 1045876, hdd_images[id].file); } } + pclog("]\n"); free(empty_sector_1mb); } diff --git a/src/win/86Box.rc b/src/win/86Box.rc index be0b5b9be..ee9a1e009 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -8,7 +8,7 @@ * * Application resource script for Windows. * - * Version: @(#)86Box.rc 1.0.24 2018/01/19 + * Version: @(#)86Box.rc 1.0.25 2018/01/24 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -516,6 +516,9 @@ BEGIN LTEXT "LUN:",IDT_1724,168,72,15,8 COMBOBOX IDC_COMBO_HD_CHANNEL_IDE,134,71,77,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Progress:",IDT_1752,7,7,204,9 + CONTROL "IMGCreateProgress",IDC_PBAR_IMG_CREATE,"msctls_progress32",PBS_SMOOTH | + WS_BORDER,7,16,204,12 END DLG_CFG_REMOVABLE_DEVICES DIALOG DISCARDABLE 97, 0, 267, 202 diff --git a/src/win/resource.h b/src/win/resource.h index 1bfd88785..5c8b707b5 100644 --- a/src/win/resource.h +++ b/src/win/resource.h @@ -8,7 +8,7 @@ * * Windows resource defines. * - * Version: @(#)resource.h 1.0.17 2018/01/18 + * Version: @(#)resource.h 1.0.18 2018/01/24 * * Authors: Sarah Walker, * Miran Grca, @@ -85,6 +85,7 @@ #define IDT_1749 1749 /* File name: */ #define IDT_1750 1750 /* Disk size: */ #define IDT_1751 1751 /* RPM mode: */ +#define IDT_1752 1752 /* Progress: */ /* @@ -170,6 +171,7 @@ #define IDC_EDIT_HD_CYL 1143 #define IDC_EDIT_HD_SIZE 1144 #define IDC_COMBO_HD_TYPE 1145 +#define IDC_PBAR_IMG_CREATE 1146 #define IDC_REMOV_DEVICES 1150 /* removable dev config */ #define IDC_LIST_FLOPPY_DRIVES 1151 diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 0eca3f706..940a22b77 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -8,7 +8,7 @@ * * Windows 86Box Settings dialog handler. * - * Version: @(#)win_settings.c 1.0.32 2018/01/24 + * Version: @(#)win_settings.c 1.0.33 2018/01/24 * * Author: Miran Grca, * @@ -2807,6 +2807,15 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM } h = GetDlgItem(hdlg, IDC_EDIT_HD_FILE_NAME); EnableWindow(h, FALSE); + + h = GetDlgItem(hdlg, IDT_1752); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + + h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + no_update = 0; return TRUE; @@ -2939,11 +2948,36 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM size -= r; r >>= 11; + if (size || r) { + h = GetDlgItem(hdlg, IDT_1731); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + + h = GetDlgItem(hdlg, IDC_EDIT_HD_FILE_NAME); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + + h = GetDlgItem(hdlg, IDC_CFILE); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + + h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE); + SendMessage(h, PBM_SETRANGE32, (WPARAM) 0, (LPARAM) (size + r - 1)); + SendMessage(h, PBM_SETPOS, (WPARAM) 0, (LPARAM) 0); + EnableWindow(h, TRUE); + ShowWindow(h, SW_SHOW); + + h = GetDlgItem(hdlg, IDT_1752); + EnableWindow(h, TRUE); + ShowWindow(h, SW_SHOW); + } + if (size) { for (i = 0; i < size; i++) { fwrite(buf, 1, 512, f); + SendMessage(h, PBM_SETPOS, (WPARAM) i, (LPARAM) 0); } } @@ -2954,6 +2988,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM for (i = 0; i < r; i++) { fwrite(big_buf, 1, 1048576, f); + SendMessage(h, PBM_SETPOS, (WPARAM) (size + i), (LPARAM) 0); } free(big_buf); }