From 8fb4b091d55e46b7cf9a2d872b979181292a541f Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Fri, 12 Jan 2018 17:26:55 +0000 Subject: [PATCH] [internal] UI redesign, part 0 * Super initial work. Super broken. Super long way from being finalized yet. And *NO*, since you don't know where this is going, you don't get to have a say on this, as any comment will be deleted. You have been warned! --- configure | 20 +- configure.ac | 2 +- res/appstore/AppxManifest.xml | 2 +- res/appstore/packme.cmd | 2 +- res/localization/rufus.loc | 7 +- src/license.h | 3 + src/localization.c | 4 +- src/localization_data.h | 39 +- src/localization_data.sh | 2 +- src/resource.h | 17 +- src/rufus.c | 828 ++++++++++++++++++++++------------ src/rufus.h | 2 +- src/rufus.rc | 162 +++---- src/stdlg.c | 19 +- 14 files changed, 702 insertions(+), 407 deletions(-) diff --git a/configure b/configure index 6267b5bc..2ec6482a 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for rufus 2.18. +# Generated by GNU Autoconf 2.69 for rufus 3.0. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='rufus' PACKAGE_TARNAME='rufus' -PACKAGE_VERSION='2.18' -PACKAGE_STRING='rufus 2.18' +PACKAGE_VERSION='3.0' +PACKAGE_STRING='rufus 3.0' PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues' PACKAGE_URL='https://rufus.akeo.ie' @@ -1228,7 +1228,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures rufus 2.18 to adapt to many kinds of systems. +\`configure' configures rufus 3.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1294,7 +1294,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of rufus 2.18:";; + short | recursive ) echo "Configuration of rufus 3.0:";; esac cat <<\_ACEOF @@ -1385,7 +1385,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -rufus configure 2.18 +rufus configure 3.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1440,7 +1440,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by rufus $as_me 2.18, which was +It was created by rufus $as_me 3.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2303,7 +2303,7 @@ fi # Define the identity of the package. PACKAGE='rufus' - VERSION='2.18' + VERSION='3.0' cat >>confdefs.h <<_ACEOF @@ -4481,7 +4481,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by rufus $as_me 2.18, which was +This file was extended by rufus $as_me 3.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4535,7 +4535,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -rufus config.status 2.18 +rufus config.status 3.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 8c41e9ff..e72cf42f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([rufus], [2.18], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.akeo.ie]) +AC_INIT([rufus], [3.0], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.akeo.ie]) AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies]) AC_CONFIG_SRCDIR([src/rufus.c]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/res/appstore/AppxManifest.xml b/res/appstore/AppxManifest.xml index f8171429..34c89fed 100644 --- a/res/appstore/AppxManifest.xml +++ b/res/appstore/AppxManifest.xml @@ -8,7 +8,7 @@ for an interesting struggle, when you also happen to have a comma in one of the fields... --> diff --git a/res/appstore/packme.cmd b/res/appstore/packme.cmd index e976ff2c..121bcd87 100644 --- a/res/appstore/packme.cmd +++ b/res/appstore/packme.cmd @@ -1,5 +1,5 @@ @echo off -set VERSION=2.18 +set VERSION=3.0 rem Make sure you don't have anything you don't want included in the package, as anything residing in the rem current directory will be included, including any previous .appx, which makes for nice recursion... diff --git a/res/localization/rufus.loc b/res/localization/rufus.loc index 39112cac..dc4478d0 100644 --- a/res/localization/rufus.loc +++ b/res/localization/rufus.loc @@ -98,7 +98,8 @@ v 1.0.22 # Main dialog g IDD_DIALOG t IDS_DEVICE_TXT "Device" -t IDS_PARTITION_TYPE_TXT "Partition scheme and target system type" +t IDS_PARTITION_TYPE_TXT "Partition scheme" +t IDS_TARGET_SYSTEM_TXT "Target system type" t IDS_FILESYSTEM_TXT "File system" t IDS_CLUSTERSIZE_TXT "Cluster size" t IDS_LABEL_TXT "New volume label" @@ -213,8 +214,8 @@ t MSG_031 "%s partition scheme for BIOS or %s" t MSG_032 "%s partition scheme for BIOS" t MSG_033 "%s partition scheme for UEFI" # Number of bad block check passes (singular for 1 pass, plural for 2 or more passes) -t MSG_034 "%d Pass" -t MSG_035 "%d Passes" +t MSG_034 "%d mass" +t MSG_035 "%d masses" t MSG_036 "ISO Image" t MSG_037 "Application" t MSG_038 "Abort" diff --git a/src/license.h b/src/license.h index f2ad6031..a1fe2087 100644 --- a/src/license.h +++ b/src/license.h @@ -34,6 +34,9 @@ RUFUS_URL "\\line\n" const char* additional_copyrights = "{\\rtf1\\ansi\n" +"Based on a GUI redesign concept by Fahad Al-Riyami\\line\n" +"Used with kind authorization\\line\n" +"\\line\n" "Icon by PC Unleashed:\\line\n" "http://pcunleashed.com\\line\n" "Freeware\\line\n" diff --git a/src/localization.c b/src/localization.c index fe0b89c5..fb25b6b5 100644 --- a/src/localization.c +++ b/src/localization.c @@ -426,9 +426,9 @@ static char *output_msg[2]; static uint64_t last_msg_time[2] = { 0, 0 }; static void PrintInfoMessage(char* msg) { - SetWindowTextU(hInfo, msg); + SetWindowTextU(hProgress, msg); // Make sure our field gets redrawn - SendMessage(hInfo, WM_PAINT, 0, 0); + SendMessage(hProgress, WM_PAINT, 0, 0); } static void PrintStatusMessage(char* msg) { SendMessageLU(hStatus, SB_SETTEXTW, SBT_OWNERDRAW | SB_SECTION_LEFT, msg); diff --git a/src/localization_data.h b/src/localization_data.h index 25b03d28..4575ac62 100644 --- a/src/localization_data.h +++ b/src/localization_data.h @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * Localization tables - autogenerated from resource.h - * Copyright © 2013-2016 Pete Batard + * Copyright © 2013-2018 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ const loc_control_id control_id[] = { LOC_CTRL(IDD_UPDATE_POLICY), LOC_CTRL(IDD_NEW_VERSION), LOC_CTRL(IDD_CHECKSUM), + LOC_CTRL(IDD_LIST), LOC_CTRL(IDC_DEVICE), LOC_CTRL(IDC_FILESYSTEM), LOC_CTRL(IDC_START), @@ -54,12 +55,17 @@ const loc_control_id control_id[] = { LOC_CTRL(IDC_SELECT_ISO), LOC_CTRL(IDC_SET_ICON), LOC_CTRL(IDC_RUFUS_MBR), + LOC_CTRL(IDC_TARGET_SYSTEM), LOC_CTRL(IDC_INFO), + LOC_CTRL(IDC_LANG), LOC_CTRL(IDC_DISK_ID), LOC_CTRL(IDC_EXTRA_PARTITION), LOC_CTRL(IDC_ENABLE_FIXED_DISKS), LOC_CTRL(IDC_STATUS_TOOLBAR), LOC_CTRL(IDC_HASH), + LOC_CTRL(IDC_SAVE), + LOC_CTRL(IDC_SELECTED_IMAGE), + LOC_CTRL(IDC_BOOT_OPTION), LOC_CTRL(IDC_ABOUT_LICENSE), LOC_CTRL(IDC_ABOUT_ICON), LOC_CTRL(IDC_ABOUT_UPDATES), @@ -110,6 +116,25 @@ const loc_control_id control_id[] = { LOC_CTRL(IDC_SELECTION_CHOICE14), LOC_CTRL(IDC_SELECTION_CHOICE15), LOC_CTRL(IDC_SELECTION_CHOICEMAX), + LOC_CTRL(IDC_LIST_ICON), + LOC_CTRL(IDC_LIST_TEXT), + LOC_CTRL(IDC_LIST_LINE), + LOC_CTRL(IDC_LIST_ITEM1), + LOC_CTRL(IDC_LIST_ITEM2), + LOC_CTRL(IDC_LIST_ITEM3), + LOC_CTRL(IDC_LIST_ITEM4), + LOC_CTRL(IDC_LIST_ITEM5), + LOC_CTRL(IDC_LIST_ITEM6), + LOC_CTRL(IDC_LIST_ITEM7), + LOC_CTRL(IDC_LIST_ITEM8), + LOC_CTRL(IDC_LIST_ITEM9), + LOC_CTRL(IDC_LIST_ITEM10), + LOC_CTRL(IDC_LIST_ITEM11), + LOC_CTRL(IDC_LIST_ITEM12), + LOC_CTRL(IDC_LIST_ITEM13), + LOC_CTRL(IDC_LIST_ITEM14), + LOC_CTRL(IDC_LIST_ITEM15), + LOC_CTRL(IDC_LIST_ITEMMAX), LOC_CTRL(IDS_DEVICE_TXT), LOC_CTRL(IDS_PARTITION_TYPE_TXT), LOC_CTRL(IDS_FILESYSTEM_TXT), @@ -123,6 +148,16 @@ const loc_control_id control_id[] = { LOC_CTRL(IDS_NEW_VERSION_DOWNLOAD_GRP), LOC_CTRL(IDS_NEW_VERSION_NOTES_GRP), LOC_CTRL(IDS_CHECK_NOW_GRP), + LOC_CTRL(IDS_TARGET_SYSTEM_TXT), + LOC_CTRL(IDS_SELETED_IMAGE_TXT), + LOC_CTRL(IDS_BOOT_OPTION_TXT), + LOC_CTRL(IDS_SELECTED_IMAGE_TXT), + LOC_CTRL(IDS_BOOT_TYPE_TXT), + LOC_CTRL(IDS_DEVICE_OPTIONS_TXT), + LOC_CTRL(IDS_FORMAT_OPTIONS_TXT), + LOC_CTRL(IDS_ADVANCED_OPTIONS_TXT), + LOC_CTRL(IDS_FORMAT_OPTIONS_TXT2), + LOC_CTRL(IDS_STATUS_TXT), LOC_CTRL(MSG_000), LOC_CTRL(MSG_001), LOC_CTRL(MSG_002), @@ -423,6 +458,7 @@ const loc_control_id control_id[] = { LOC_CTRL(MSG_297), LOC_CTRL(MSG_298), LOC_CTRL(MSG_299), + LOC_CTRL(MSG_300), LOC_CTRL(MSG_MAX), LOC_CTRL(IDOK), LOC_CTRL(IDCANCEL), @@ -446,4 +482,5 @@ loc_dlg_list loc_dlg[] = { LOC_DLG(IDD_UPDATE_POLICY), LOC_DLG(IDD_NEW_VERSION), LOC_DLG(IDD_CHECKSUM), + LOC_DLG(IDD_LIST), }; diff --git a/src/localization_data.sh b/src/localization_data.sh index de5fab48..13aa439c 100755 --- a/src/localization_data.sh +++ b/src/localization_data.sh @@ -12,7 +12,7 @@ cat > cmd.sed <<\_EOF 1i /*\ * Rufus: The Reliable USB Formatting Utility\ * Localization tables - autogenerated from resource.h\ - * Copyright © 2013-2017 Pete Batard \ + * Copyright © 2013-2018 Pete Batard \ *\ * This program is free software: you can redistribute it and/or modify\ * it under the terms of the GNU General Public License as published by\ diff --git a/src/resource.h b/src/resource.h index 8f8f0398..13548dfa 100644 --- a/src/resource.h +++ b/src/resource.h @@ -91,12 +91,17 @@ #define IDC_SELECT_ISO 1016 #define IDC_SET_ICON 1017 #define IDC_RUFUS_MBR 1018 +#define IDC_TARGET_SYSTEM 1019 #define IDC_INFO 1020 +#define IDC_LANG 1021 #define IDC_DISK_ID 1022 #define IDC_EXTRA_PARTITION 1023 #define IDC_ENABLE_FIXED_DISKS 1024 #define IDC_STATUS_TOOLBAR 1025 #define IDC_HASH 1026 +#define IDC_SAVE 1027 +#define IDC_SELECTED_IMAGE 1028 +#define IDC_BOOT_OPTION 1029 #define IDC_ABOUT_LICENSE 1030 #define IDC_ABOUT_ICON 1031 #define IDC_ABOUT_UPDATES 1032 @@ -179,6 +184,16 @@ #define IDS_NEW_VERSION_DOWNLOAD_GRP 2010 #define IDS_NEW_VERSION_NOTES_GRP 2011 #define IDS_CHECK_NOW_GRP 2012 +#define IDS_TARGET_SYSTEM_TXT 2013 +#define IDS_SELETED_IMAGE_TXT 2014 +#define IDS_BOOT_OPTION_TXT 2015 +#define IDS_SELECTED_IMAGE_TXT 2016 +#define IDS_BOOT_TYPE_TXT 2017 +#define IDS_DEVICE_OPTIONS_TXT 2018 +#define IDS_FORMAT_OPTIONS_TXT 2019 +#define IDS_ADVANCED_OPTIONS_TXT 2020 +#define IDS_FORMAT_OPTIONS_TXT2 2020 +#define IDS_STATUS_TXT 2021 #define MSG_000 3000 #define MSG_001 3001 #define MSG_002 3002 @@ -489,7 +504,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 505 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1079 +#define _APS_NEXT_CONTROL_VALUE 1112 #define _APS_NEXT_SYMED_VALUE 4000 #endif #endif diff --git a/src/rufus.c b/src/rufus.c index c496721f..62e5e159 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -1,6 +1,6 @@ /* * Rufus: The Reliable USB Formatting Utility - * Copyright © 2011-2017 Pete Batard + * Copyright © 2011-2018 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,10 +47,117 @@ #include "../res/grub/grub_version.h" #include "../res/grub2/grub2_version.h" -const char* cmdline_hogger = "rufus.com"; -const char* FileSystemLabel[FS_MAX] = { "FAT", "FAT32", "NTFS", "UDF", "exFAT", "ReFS" }; -const char* ep_reg = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"; -const char* vs_reg = "Software\\Microsoft\\VisualStudio"; +static int togo_move_ids[] = { + IDS_PARTITION_TYPE_TXT, + IDC_PARTITION_TYPE, + IDS_TARGET_SYSTEM_TXT, + IDC_TARGET_SYSTEM, + IDS_FORMAT_OPTIONS_TXT, + IDS_FILESYSTEM_TXT, + IDC_FILESYSTEM, + IDS_CLUSTERSIZE_TXT, + IDC_CLUSTERSIZE, + IDS_LABEL_TXT, + IDC_LABEL, + IDC_ADVANCED, + IDC_BADBLOCKS, + IDC_NBPASSES, + IDC_SET_ICON, + IDS_ADVANCED_OPTIONS_TXT, + IDC_ENABLE_FIXED_DISKS, + IDC_QUICKFORMAT, + IDC_EXTRA_PARTITION, + IDC_RUFUS_MBR, + IDC_DISK_ID, + IDS_STATUS_TXT, + IDC_PROGRESS, + IDC_INFO, + IDC_ABOUT, + IDC_LOG, + IDC_TEST, + IDC_START, + IDCANCEL, + IDC_STATUS, + IDC_STATUS_TOOLBAR, +}; + +static int togo_toggle_ids[] = { + IDS_BOOT_OPTION_TXT, + IDC_BOOT_OPTION, +}; + +static int advanced_move1_ids[] = { + IDS_BOOT_OPTION_TXT, + IDC_BOOT_OPTION, + IDS_PARTITION_TYPE_TXT, + IDC_PARTITION_TYPE, + IDS_TARGET_SYSTEM_TXT, + IDC_TARGET_SYSTEM, + IDS_FORMAT_OPTIONS_TXT, + IDS_FILESYSTEM_TXT, + IDC_FILESYSTEM, + IDS_CLUSTERSIZE_TXT, + IDC_CLUSTERSIZE, + IDS_LABEL_TXT, + IDC_LABEL, + IDC_ADVANCED, + IDC_BADBLOCKS, + IDC_NBPASSES, + IDC_SET_ICON, + IDS_ADVANCED_OPTIONS_TXT, + IDC_ENABLE_FIXED_DISKS, + IDC_QUICKFORMAT, + IDC_EXTRA_PARTITION, + IDC_RUFUS_MBR, + IDC_DISK_ID, + IDS_STATUS_TXT, + IDC_PROGRESS, + IDC_INFO, + IDC_ABOUT, + IDC_LOG, + IDC_TEST, + IDC_START, + IDCANCEL, + IDC_STATUS, + IDC_STATUS_TOOLBAR +}; + +static int advanced_move2_ids[] = { + IDS_ADVANCED_OPTIONS_TXT, + IDC_ENABLE_FIXED_DISKS, + IDC_QUICKFORMAT, + IDC_EXTRA_PARTITION, + IDC_RUFUS_MBR, + IDC_DISK_ID, + IDS_STATUS_TXT, + IDC_PROGRESS, + IDC_INFO, + IDC_ABOUT, + IDC_LOG, + IDC_TEST, + IDC_START, + IDCANCEL, + IDC_STATUS, + IDC_STATUS_TOOLBAR +}; + +static int advanced_toggle_ids[] = { + IDC_SAVE, + IDS_SELECTED_IMAGE_TXT, + IDC_SELECTED_IMAGE, + IDC_HASH, + IDC_ENABLE_FIXED_DISKS, + IDC_QUICKFORMAT, + IDC_EXTRA_PARTITION, + IDC_RUFUS_MBR, + IDC_DISK_ID, + IDS_ADVANCED_OPTIONS_TXT +}; + +static const char* cmdline_hogger = "rufus.com"; +static const char* FileSystemLabel[FS_MAX] = { "FAT", "FAT32", "NTFS", "UDF", "exFAT", "ReFS" }; +static const char* ep_reg = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"; +static const char* vs_reg = "Software\\Microsoft\\VisualStudio"; // Number of steps for each FS for FCC_STRUCTURE_PROGRESS const int nb_steps[FS_MAX] = { 5, 5, 12, 1, 10 }; static const char* PartitionTypeLabel[2] = { "MBR", "GPT" }; @@ -63,20 +170,27 @@ static BOOL relaunch = FALSE; static BOOL dont_display_image_name = FALSE; static BOOL user_changed_label = FALSE; static BOOL app_changed_label = FALSE; -extern BOOL enable_iso, enable_joliet, enable_rockridge, enable_ntfs_compression; -extern uint8_t* grub2_buf; -extern long grub2_len; -extern const char* old_c32_name[NB_OLD_C32]; -extern const char* cert_name[3]; -static int selection_default; +static int64_t last_iso_blocking_status; +static int selection_default, row_height, advanced_section_height; +static int device_vpos, format_vpos, advanced_vpos, status_vpos; static UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU; static RECT relaunch_rc = { -65536, -65536, 0, 0}; static UINT uBootChecked = BST_CHECKED, uQFChecked = BST_CHECKED, uMBRChecked = BST_UNCHECKED; static HFONT hInfoFont; static HBRUSH hInfoBrush; -static WNDPROC info_original_proc = NULL; -char ClusterSizeLabel[MAX_CLUSTER_SIZES][64]; -char msgbox[1024], msgbox_title[32], *ini_file = NULL; +static WNDPROC info_original_proc = NULL, progress_original_proc = NULL; +static HANDLE format_thid = NULL, dialog_handle = NULL; +static HWND hBoot = NULL, hSelectISO = NULL, hStart = NULL; +static HICON hIconDisc, hIconSave, hIconDown, hIconUp, hIconLang; +static char szTimer[12] = "00:00:00"; +static unsigned int timer; + +extern BOOL enable_iso, enable_joliet, enable_rockridge, enable_ntfs_compression; +extern uint8_t* grub2_buf; +extern long grub2_len; +extern char* szStatusMessage; +extern const char* old_c32_name[NB_OLD_C32]; +extern const char* cert_name[3]; /* * Globals @@ -84,7 +198,7 @@ char msgbox[1024], msgbox_title[32], *ini_file = NULL; OPENED_LIBRARIES_VARS; HINSTANCE hMainInstance; HWND hMainDialog, hLangToolbar = NULL, hUpdatesDlg = NULL; -BUTTON_IMAGELIST bi_iso = { 0 }, bi_up = { 0 }, bi_down = { 0 }; +BUTTON_IMAGELIST bi_iso = { 0 }, bi_up = { 0 }, bi_down = { 0 }, bi_save = { 0 }; char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], temp_dir[MAX_PATH], sysnative_dir[MAX_PATH]; char* image_path = NULL; float fScale = 1.0f; @@ -94,27 +208,22 @@ loc_cmd* selected_locale = NULL; WORD selected_langid = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT); DWORD MainThreadId; HWND hDeviceList, hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL; -HWND hLogDlg = NULL, hProgress = NULL, hInfo, hDiskID, hStatusToolbar; +HWND hLogDlg = NULL, hProgress = NULL, hDiskID, hStatusToolbar; BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, mbr_selected_by_user = FALSE, togo_mode; BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE; BOOL enable_HDDs = FALSE, force_update = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE; BOOL advanced_mode, allow_dual_uefi_bios, detect_fakes, enable_vmdk, force_large_fat32, usb_debug, use_fake_units, preserve_timestamps; BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, disable_file_indexing, large_drive = FALSE, prefer_gpt = FALSE; -int dialog_showing = 0, lang_button_id = 0; +int dialog_showing = 0; uint16_t rufus_version[3], embedded_sl_version[2]; char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; char embedded_sl_version_ext[2][32]; +char ClusterSizeLabel[MAX_CLUSTER_SIZES][64]; +char msgbox[1024], msgbox_title[32], *ini_file = NULL; RUFUS_UPDATE update = { {0,0,0}, {0,0}, NULL, NULL}; StrArray DriveID, DriveLabel, DriveHub, BlockingProcess; uint32_t DrivePort[MAX_DRIVES]; -extern char* szStatusMessage; -static HANDLE format_thid = NULL, dialog_handle = NULL; -static HWND hBoot = NULL, hSelectISO = NULL, hStart = NULL; -static HICON hIconDisc, hIconDown, hIconUp, hIconLang; -static char szTimer[12] = "00:00:00"; -static unsigned int timer; -static int64_t last_iso_blocking_status; static void ToggleToGo(void); /* @@ -816,6 +925,7 @@ void UpdateProgress(int op, float percent) */ static void EnableControls(BOOL bEnable) { + // TODO EnableWindow(GetDlgItem(hMainDialog, IDC_DEVICE), bEnable); EnableWindow(hStart, (ComboBox_GetCurSel(hDeviceList)<0)?FALSE:bEnable); EnableWindow(GetDlgItem(hMainDialog, IDC_ABOUT), bEnable); @@ -1100,9 +1210,9 @@ out: ExitThread(0); } -// Move a control along the Y axis according to the advanced mode setting -static __inline void MoveCtrlY(HWND hDlg, int nID, float vertical_shift) { - ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, nID), 0, (int)vertical_shift, 0, 0, fScale); +// Move a control along the Y axis +static __inline void MoveCtrlY(HWND hDlg, int nID, int vertical_shift) { + ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, nID), 0, vertical_shift, 0, 0, 1.0f); } static void SetPassesTooltip(void) @@ -1112,64 +1222,58 @@ static void SetPassesTooltip(void) pattern[0], pattern[1], pattern[2], pattern[3]), -1); } -// Toggle "advanced" mode -static void ToggleAdvanced(BOOL enable) +static void ResizeDialogs(int shift) { - // Compute the shift according to the weird values we measured at different scales: - // {1.0, 82}, {1.25, 88}, {1.5, 90}, {2.0, 96}, {2.5, 94} (Seriously, WTF is wrong with your scaling Microsoft?!?!) - // https://www.wolframalpha.com/input/?i=cubic+fit+{1%2C82}%2C{1.25%2C88}%2C{1.5%2C90}%2C{2%2C96}%2C{2.5%2C94} - float dialog_shift = -3.22807f*fScale*fScale*fScale + 6.69173f*fScale*fScale + 15.8822f*fScale + 62.9737f; RECT rect; POINT point; - BOOL needs_resel = FALSE; - int i, toggle; - if (!enable) - dialog_shift = -dialog_shift; - - // Increase or decrease the Window size + // Resize the main dialog GetWindowRect(hMainDialog, &rect); point.x = (rect.right - rect.left); point.y = (rect.bottom - rect.top); - MoveWindow(hMainDialog, rect.left, rect.top, point.x, - point.y + (int)(fScale*dialog_shift), TRUE); + MoveWindow(hMainDialog, rect.left, rect.top, point.x, point.y + shift, TRUE); - // Move the controls up or down - MoveCtrlY(hMainDialog, IDC_STATUS, dialog_shift); - MoveCtrlY(hMainDialog, IDC_STATUS_TOOLBAR, dialog_shift); - MoveCtrlY(hMainDialog, IDC_START, dialog_shift); - MoveCtrlY(hMainDialog, IDC_INFO, dialog_shift); - MoveCtrlY(hMainDialog, IDC_PROGRESS, dialog_shift); - MoveCtrlY(hMainDialog, IDC_ABOUT, dialog_shift); - MoveCtrlY(hMainDialog, IDC_LOG, dialog_shift); - MoveCtrlY(hMainDialog, IDCANCEL, dialog_shift); -#ifdef RUFUS_TEST - MoveCtrlY(hMainDialog, IDC_TEST, dialog_shift); -#endif - - // And do the same for the log dialog while we're at it + // Resize the log GetWindowRect(hLogDlg, &rect); point.x = (rect.right - rect.left); point.y = (rect.bottom - rect.top); - MoveWindow(hLogDlg, rect.left, rect.top, point.x, - point.y + (int)(fScale*dialog_shift), TRUE); - MoveCtrlY(hLogDlg, IDC_LOG_CLEAR, dialog_shift); - MoveCtrlY(hLogDlg, IDC_LOG_SAVE, dialog_shift); - MoveCtrlY(hLogDlg, IDCANCEL, dialog_shift); + MoveWindow(hLogDlg, rect.left, rect.top, point.x, point.y + shift, TRUE); + MoveCtrlY(hLogDlg, IDC_LOG_CLEAR, shift); + MoveCtrlY(hLogDlg, IDC_LOG_SAVE, shift); + MoveCtrlY(hLogDlg, IDCANCEL, shift); GetWindowRect(hLog, &rect); point.x = (rect.right - rect.left); - point.y = (rect.bottom - rect.top) + (int)(fScale*dialog_shift); + point.y = (rect.bottom - rect.top) + shift; SetWindowPos(hLog, NULL, 0, 0, point.x, point.y, SWP_NOZORDER); // Don't forget to scroll the edit to the bottom after resize Edit_Scroll(hLog, 0, Edit_GetLineCount(hLog)); +} + +// Toggle "advanced" mode +static void ToggleAdvanced(BOOL enable) +{ + int i, shift1 = row_height, shift2 = advanced_section_height; + BOOL needs_resel = FALSE; + + if (!enable) { + shift2 = -shift2; + shift1 = -shift1; + } + status_vpos += shift1 + shift2; + format_vpos += shift1; + + // Move the controls up or down + for (i = 0; i= 1.9f)?44.0f:((fScale >= 1.2f)?40.0f:38.0f); - RECT rect; - POINT point; - int toggle; + int i, shift = row_height; // Windows To Go mode is only available for Windows 8 or later due to the lack // of an ISO mounting API on previous versions. @@ -1222,60 +1324,25 @@ static void ToggleToGo(void) togo_mode = !togo_mode; if (!togo_mode) - dialog_shift = -dialog_shift; - - // Increase or decrease the Window size - GetWindowRect(hMainDialog, &rect); - point.x = (rect.right - rect.left); - point.y = (rect.bottom - rect.top); - MoveWindow(hMainDialog, rect.left, rect.top, point.x, - point.y + (int)(fScale*dialog_shift), TRUE); + shift = -shift; + format_vpos += shift; + advanced_vpos += shift; + status_vpos += shift; // Move the controls up or down - MoveCtrlY(hMainDialog, IDC_STATUS, dialog_shift); - MoveCtrlY(hMainDialog, IDC_STATUS_TOOLBAR, dialog_shift); - MoveCtrlY(hMainDialog, IDC_START, dialog_shift); - MoveCtrlY(hMainDialog, IDC_INFO, dialog_shift); - MoveCtrlY(hMainDialog, IDC_PROGRESS, dialog_shift); - MoveCtrlY(hMainDialog, IDC_ABOUT, dialog_shift); - MoveCtrlY(hMainDialog, IDC_LOG, dialog_shift); - MoveCtrlY(hMainDialog, IDCANCEL, dialog_shift); - MoveCtrlY(hMainDialog, IDC_SET_ICON, dialog_shift); - MoveCtrlY(hMainDialog, IDS_ADVANCED_OPTIONS_GRP, dialog_shift); - MoveCtrlY(hMainDialog, IDC_ENABLE_FIXED_DISKS, dialog_shift); - MoveCtrlY(hMainDialog, IDC_EXTRA_PARTITION, dialog_shift); - MoveCtrlY(hMainDialog, IDC_RUFUS_MBR, dialog_shift); - MoveCtrlY(hMainDialog, IDC_DISK_ID, dialog_shift); - ResizeMoveCtrl(hMainDialog, GetDlgItem(hMainDialog, IDS_FORMAT_OPTIONS_GRP), 0, 0, 0, (int)dialog_shift, fScale); + for (i = 0; i= 54) @@ -1726,17 +1744,323 @@ static void InitDialog(HWND hDlg) else if (s16 >= 20) s16 = 24; + // Load system icons (NB: Use the excellent http://www.nirsoft.net/utils/iconsext.html to find icon IDs) + hShell32DllInst = GetLibraryHandle("Shell32"); + hIconDisc = (HICON)LoadImage(hShell32DllInst, MAKEINTRESOURCE(12), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); + hIconSave = (HICON)LoadImage(hShell32DllInst, MAKEINTRESOURCE(16761), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); + + if (nWindowsVersion >= WINDOWS_8) { + // Use the icon from the Windows 8+ 'Language' Control Panel + hUserLanguagesCplDllInst = GetLibraryHandle("UserLanguagesCpl"); + hIconLang = (HICON)LoadImage(hUserLanguagesCplDllInst, MAKEINTRESOURCE(1), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); + } else { + // Otherwise use the globe icon, from the Internet Options Control Panel + hINetCplDllInst = GetLibraryHandle("inetcpl.cpl"); + hIconLang = (HICON)LoadImage(hINetCplDllInst, MAKEINTRESOURCE(1313), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); + } + + hIconDown = (HICON)LoadImage(hShell32DllInst, MAKEINTRESOURCE(16750), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); + hIconUp = (HICON)LoadImage(hShell32DllInst, MAKEINTRESOURCE(16749), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); + + // Create the language toolbar + hLangToolbar = CreateWindowExW(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_TABSTOP | TBSTYLE_TRANSPARENT | CCS_NOPARENTALIGN | + CCS_NORESIZE | CCS_NODIVIDER, 0, 0, 0, 0, hMainDialog, NULL, hMainInstance, NULL); + hLangToolbarImageList = ImageList_Create(i16, i16, ILC_COLOR32, 1, 0); + ImageList_AddIcon(hLangToolbarImageList, hIconLang); + SendMessage(hLangToolbar, TB_SETIMAGELIST, (WPARAM)0, (LPARAM)hLangToolbarImageList); + SendMessage(hLangToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); + memset(tbLangToolbarButtons, 0, sizeof(TBBUTTON)); + tbLangToolbarButtons[0].idCommand = IDC_LANG; + tbLangToolbarButtons[0].fsStyle = BTNS_WHOLEDROPDOWN; + tbLangToolbarButtons[0].fsState = TBSTATE_ENABLED; + SendMessage(hLangToolbar, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&tbLangToolbarButtons); // Add just the 1 button + + // Add trailing space to the "Format Options" text + hCtrl = GetDlgItem(hDlg, IDS_FORMAT_OPTIONS_GRP); + GetWindowTextW(hCtrl, wtmp, ARRAYSIZE(wtmp)); + wtmp[wcslen(wtmp)] = ' '; + SetWindowTextW(hCtrl, wtmp); + + // Set the icons on the the buttons + //bi_iso.himl = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); + //ImageList_ReplaceIcon(bi_iso.himl, -1, hIconDisc); + //SetRect(&bi_iso.margin, 0, 1, 0, 0); + //bi_iso.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; + bi_save.himl = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); + ImageList_ReplaceIcon(bi_save.himl, -1, hIconSave); + SetRect(&bi_save.margin, 0, 1, 0, 0); + bi_save.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; + bi_down.himl = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); + ImageList_ReplaceIcon(bi_down.himl, -1, hIconDown); + SetRect(&bi_down.margin, 0, 0, 0, 0); + bi_down.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; + bi_up.himl = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); + ImageList_ReplaceIcon(bi_up.himl, -1, hIconUp); + SetRect(&bi_up.margin, 0, 0, 0, 0); + bi_up.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; + + //SendMessage(hSelectISO, BCM_SETIMAGELIST, 0, (LPARAM)&bi_iso); + hCtrl = GetDlgItem(hDlg, IDC_SAVE); + SendMessage(hCtrl, BCM_SETIMAGELIST, 0, (LPARAM)&bi_save); + SendMessage(GetDlgItem(hDlg, IDC_ADVANCED), BCM_SETIMAGELIST, 0, + (LPARAM)(advanced_mode ? &bi_up : &bi_down)); +} + +static inline int GetControlWidth(HWND hDlg, int id) +{ + return GetTextSize(GetDlgItem(hDlg, id)).cx; +} + + +// https://stackoverflow.com/a/20926332/1069307 +// https://msdn.microsoft.com/en-us/library/windows/desktop/bb226818.aspx +static int GetMaxTextWidth(HWND hDlg) +{ + int checkbox_internal_spacing = 12; +// const int dluCheckboxHeight = 10; // 10 vertical dlus + RECT rc = { 0, 0, 4, 8 }; + SIZE bu; + + // cb = checkbox, dd = dropdown, ib = image button + int width, cb_width, dd_width, ib_width, max_width = 100; + int top_half_start_x, bottom_half_start_x; + + // Compute base unit sizes since GetDialogBaseUnits() returns garbage data. + // See http://support.microsoft.com/kb/125681 + MapDialogRect(hDlg, &rc); + bu.cx = rc.right; + bu.cy = rc.bottom; + uprintf("bu.cx = %d, bu.cy = %d", bu.cx, bu.cy); + + GetWindowRect(hSelectISO, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + ib_width = rc.right - rc.left; + uprintf("button.width = %d", ib_width); + + // TODO: figure out the specifics of each Windows version + if (nWindowsVersion == WINDOWS_10) + checkbox_internal_spacing = 10; + + cb_width = MulDiv(checkbox_internal_spacing, bu.cx, 4); +// Integer checkboxHeight = MulDiv(10, sz.cy, 8); + + // Use Windows To Go checkbox and NB passed dropdown to + // compute the size of a blank checkbox and dropdown + GetWindowRect(GetDlgItem(hDlg, IDC_WINDOWS_TO_GO), &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + top_half_start_x = rc.left; + GetWindowRect(GetDlgItem(hDlg, IDC_ENABLE_FIXED_DISKS), &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + bottom_half_start_x = rc.left; + GetWindowRect(GetDlgItem(hDlg, IDC_NBPASSES), &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + dd_width = rc.right - rc.left; + +// width = GetControlWidth(hDlg, IDS_PARTITION_TYPE_TXT); +// max_text_width = max(max_text_width, width); +// uprintf("mw = %d", max_text_width); + width = GetControlWidth(hDlg, IDC_EXTRA_PARTITION); + max_width = max(max_width, width); + uprintf("mw = %d", max_width); + + return bottom_half_start_x + cb_width + max_width; +} + +static void PositionControls(HWND hDlg) +{ + RECT rc, rcDeviceList, rcBootType, rcSelectedImage; + HWND hCtrl; + SIZE sz; + HFONT hf; + int i16 = GetSystemMetrics(SM_CXSMICON); + int max_text_width = GetMaxTextWidth(hDlg); + // TODO: dynamicize this + int dialog_width = 770; + + // Set the section header fonts and resize the static controls accordingly + hf = CreateFontA(48, 0, 0, 0, FW_SEMIBOLD, FALSE, FALSE, FALSE, DEFAULT_CHARSET, + 0, 0, PROOF_QUALITY, 0, "Segoe UI"); + SendDlgItemMessageA(hDlg, IDS_DEVICE_OPTIONS_TXT, WM_SETFONT, (WPARAM)hf, TRUE); + hCtrl = GetDlgItem(hDlg, IDS_DEVICE_OPTIONS_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + sz = GetTextSize(hCtrl); + SetWindowPos(hCtrl, NULL, rc.left, rc.top, sz.cx, sz.cy, SWP_NOZORDER); + SendDlgItemMessageA(hDlg, IDS_FORMAT_OPTIONS_TXT, WM_SETFONT, (WPARAM)hf, TRUE); + hCtrl = GetDlgItem(hDlg, IDS_FORMAT_OPTIONS_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + sz = GetTextSize(hCtrl); + SetWindowPos(hCtrl, NULL, rc.left, rc.top, sz.cx, sz.cy, SWP_NOZORDER); + SendDlgItemMessageA(hDlg, IDS_ADVANCED_OPTIONS_TXT, WM_SETFONT, (WPARAM)hf, TRUE); + hCtrl = GetDlgItem(hDlg, IDS_ADVANCED_OPTIONS_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + sz = GetTextSize(hCtrl); + SetWindowPos(hCtrl, NULL, rc.left, rc.top, sz.cx, sz.cy, SWP_NOZORDER); + SendDlgItemMessageA(hDlg, IDS_STATUS_TXT, WM_SETFONT, (WPARAM)hf, TRUE); + hCtrl = GetDlgItem(hDlg, IDS_STATUS_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + sz = GetTextSize(hCtrl); + SetWindowPos(hCtrl, NULL, rc.left, rc.top, sz.cx, sz.cy, SWP_NOZORDER); + + // Get the height of the Boot Options (Windows To Go) + hCtrl = GetDlgItem(hDlg, IDS_PARTITION_TYPE_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + row_height = rc.top; + hCtrl = GetDlgItem(hDlg, IDS_BOOT_OPTION_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + row_height -= rc.top; + uprintf("row height = %d", row_height); + + // Get the height of the advanced section + hCtrl = GetDlgItem(hDlg, IDS_ADVANCED_OPTIONS_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + advanced_section_height = rc.top; + hCtrl = GetDlgItem(hDlg, IDS_STATUS_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + advanced_section_height = rc.top - advanced_section_height; + + // Get the vertical position of the sections text + hCtrl = GetDlgItem(hDlg, IDS_DEVICE_OPTIONS_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + sz = GetTextSize(hCtrl); + device_vpos = rc.top + 2 * sz.cy / 3; + hCtrl = GetDlgItem(hDlg, IDS_FORMAT_OPTIONS_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + sz = GetTextSize(hCtrl); + format_vpos = rc.top + 2 * sz.cy / 3; + hCtrl = GetDlgItem(hDlg, IDS_ADVANCED_OPTIONS_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + sz = GetTextSize(hCtrl); + advanced_vpos = rc.top + 2 * sz.cy / 3; + hCtrl = GetDlgItem(hDlg, IDS_STATUS_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + sz = GetTextSize(hCtrl); + status_vpos = rc.top + 2 * sz.cy / 3; + + // Make the toolbar window just big enough to hold the button + // Set the top margin to 4 DIPs and the right margin so that it's aligned with the Device List Combobox + SendMessage(hLangToolbar, TB_GETRECT, IDC_LANG, (LPARAM)&rc); + GetWindowRect(hDeviceList, &rcDeviceList); + MapWindowPoints(NULL, hDlg, (POINT*)&rcDeviceList, 2); + // TODO: use + SetWindowPos(hLangToolbar, HWND_TOP, dialog_width - rc.right, + (int)(4.0f * fScale), rc.right, rc.bottom, 0); + ShowWindow(hLangToolbar, SW_SHOWNORMAL); + + // TEST TEST TEST + hCtrl = GetDlgItem(hDlg, IDC_DISK_ID); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + SetWindowPos(hCtrl, NULL, max_text_width, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0); + + // Reposition and resize the Advanced button + hCtrl = GetDlgItem(hDlg, IDS_FORMAT_OPTIONS_TXT); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + // TODO: remove hardcoded shift + SetWindowPos(GetDlgItem(hDlg, IDC_ADVANCED), hCtrl, dialog_width - 40, + rc.top, i16 + (int)(4.0f * fScale), i16 / 2 + (int)(8.0f * fScale), 0); + + // Reposition and resize the Select Image and Hash button + GetWindowRect(hBootType, &rcBootType); + MapWindowPoints(NULL, hDlg, (POINT*)&rcBootType, 2); + GetWindowRect(hSelectISO, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + SetWindowPos(hSelectISO, NULL, rc.left, rcBootType.top - 1, + rc.right - rc.left, rcBootType.bottom - rcBootType.top + 2, SWP_NOZORDER); + + hCtrl = GetDlgItem(hDlg, IDC_SAVE); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + SetWindowPos(hCtrl, NULL, rc.left, rcDeviceList.top - 1, + rc.right - rc.left, rcDeviceList.bottom - rcDeviceList.top + 2, SWP_NOZORDER); + + hCtrl = GetDlgItem(hDlg, IDC_SELECTED_IMAGE); + GetWindowRect(hCtrl, &rcSelectedImage); + MapWindowPoints(NULL, hDlg, (POINT*)&rcSelectedImage, 2); + hCtrl = GetDlgItem(hDlg, IDC_HASH); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + SetWindowPos(hCtrl, NULL, rc.left, rcSelectedImage.top - 1, + rc.right - rc.left, rcSelectedImage.bottom - rcSelectedImage.top + 2, SWP_NOZORDER); + + // The things one needs to do to keep things looking good... + if (fScale > 1.4f) { + ResizeMoveCtrl(hDlg, GetDlgItem(hMainDialog, IDS_ADVANCED_OPTIONS_GRP), 0, +1, 0, 0, fScale); + } +} + +// Create the horizontal section lines +void OnPaint(HDC hdc) +{ + HPEN hp = CreatePen(0, 3, RGB(0, 0, 0)); + SelectObject(hdc, hp); + MoveToEx(hdc, 50, device_vpos, NULL); + LineTo(hdc, 700, device_vpos); + MoveToEx(hdc, 50, format_vpos, NULL); + LineTo(hdc, 700, format_vpos); + if (advanced_mode) { + MoveToEx(hdc, 50, advanced_vpos, NULL); + LineTo(hdc, 700, advanced_vpos); + } + MoveToEx(hdc, 50, status_vpos, NULL); + LineTo(hdc, 700, status_vpos); +} + +static void InitDialog(HWND hDlg) +{ + DWORD len; + HDC hdc; + int i, lfHeight; + char tmp[128], *token, *buf, *ext; + static char* resource[2] = { MAKEINTRESOURCEA(IDR_SL_LDLINUX_V4_SYS), MAKEINTRESOURCEA(IDR_SL_LDLINUX_V6_SYS) }; + +#ifdef RUFUS_TEST + ShowWindow(GetDlgItem(hDlg, IDC_TEST), SW_SHOW); +#endif + + hdc = GetDC(hDlg); + lfHeight = -MulDiv(9, GetDeviceCaps(hdc, LOGPIXELSY), 72); + if (hdc != NULL) + ReleaseDC(hDlg, hdc); + + // Quite a burden to carry around as parameters + hMainDialog = hDlg; + MainThreadId = GetCurrentThreadId(); + hDeviceList = GetDlgItem(hDlg, IDC_DEVICE); + hPartitionScheme = GetDlgItem(hDlg, IDC_PARTITION_TYPE); + hFileSystem = GetDlgItem(hDlg, IDC_FILESYSTEM); + hClusterSize = GetDlgItem(hDlg, IDC_CLUSTERSIZE); + hLabel = GetDlgItem(hDlg, IDC_LABEL); + hProgress = GetDlgItem(hDlg, IDC_PROGRESS); + hBoot = GetDlgItem(hDlg, IDC_BOOT); + hBootType = GetDlgItem(hDlg, IDC_BOOTTYPE); + hSelectISO = GetDlgItem(hDlg, IDC_SELECT_ISO); + hNBPasses = GetDlgItem(hDlg, IDC_NBPASSES); + hDiskID = GetDlgItem(hDlg, IDC_DISK_ID); + hStart = GetDlgItem(hDlg, IDC_START); + // Create the font and brush for the Info edit box hInfoFont = CreateFontA(lfHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0, PROOF_QUALITY, 0, "Segoe UI"); SendDlgItemMessageA(hDlg, IDC_INFO, WM_SETFONT, (WPARAM)hInfoFont, TRUE); hInfoBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); - HideCaret(hInfo); // Create the title bar icon SetTitleBarIcon(hDlg); GetWindowTextA(hDlg, tmp, sizeof(tmp)); - // Count of Microsoft for making it more attractive to read a + // Count on Microsoft for making it more attractive to read a // version using strtok() than using GetFileVersionInfo() token = strtok(tmp, " "); for (i=0; (i<3) && ((token = strtok(NULL, ".")) != NULL); i++) @@ -1797,8 +2121,8 @@ static void InitDialog(HWND hDlg) SetPassesTooltip(); // Fill up the boot type dropdown if (nWindowsVersion < WINDOWS_10) // The diskcopy.dll with the MS-DOS floppy image was removed in Windows 10 - IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "MS-DOS"), BT_MSDOS)); - IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "FreeDOS"), BT_FREEDOS)); + IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "MS-DOS (MBR only)"), BT_MSDOS)); + IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "FreeDOS (MBR only)"), BT_FREEDOS)); IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_036)), BT_ISO)); IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_095)), BT_IMG)); SetComboEntry(hBootType, selection_default); @@ -1819,93 +2143,11 @@ static void InitDialog(HWND hDlg) CheckDlgButton(hDlg, IDC_BOOT, BST_CHECKED); CheckDlgButton(hDlg, IDC_SET_ICON, BST_CHECKED); - // Load system icons (NB: Use the excellent http://www.nirsoft.net/utils/iconsext.html to find icon IDs) - hShell32DllInst = GetLibraryHandle("Shell32"); - hIconDisc = (HICON)LoadImage(hShell32DllInst, MAKEINTRESOURCE(12), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); + CreateAdditionalControls(hDlg); + PositionControls(hDlg); - if (nWindowsVersion >= WINDOWS_8) { - // Use the icon from the Windows 8+ 'Language' Control Panel - hUserLanguagesCplDllInst = GetLibraryHandle("UserLanguagesCpl"); - hIconLang = (HICON)LoadImage(hUserLanguagesCplDllInst, MAKEINTRESOURCE(1), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); - } else { - // Otherwise use the globe icon, from the Internet Options Control Panel - hINetCplDllInst = GetLibraryHandle("inetcpl.cpl"); - hIconLang = (HICON)LoadImage(hINetCplDllInst, MAKEINTRESOURCE(1313), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); - } - - hIconDown = (HICON)LoadImage(hShell32DllInst, MAKEINTRESOURCE(16750), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); - hIconUp = (HICON)LoadImage(hShell32DllInst, MAKEINTRESOURCE(16749), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); - - // Create the language toolbar - hLangToolbar = CreateWindowExW(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_TABSTOP | TBSTYLE_TRANSPARENT | CCS_NOPARENTALIGN | - CCS_NORESIZE | CCS_NODIVIDER, 0, 0, 0, 0, hMainDialog, NULL, hMainInstance, NULL); - hLangToolbarImageList = ImageList_Create(i16, i16, ILC_COLOR32, 1, 0); - ImageList_AddIcon(hLangToolbarImageList, hIconLang); - SendMessage(hLangToolbar, TB_SETIMAGELIST, (WPARAM)0, (LPARAM)hLangToolbarImageList); - SendMessage(hLangToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); - memset(tbLangToolbarButtons, 0, sizeof(TBBUTTON)); - tbLangToolbarButtons[0].idCommand = lang_button_id; - tbLangToolbarButtons[0].fsStyle = BTNS_WHOLEDROPDOWN; - tbLangToolbarButtons[0].fsState = TBSTATE_ENABLED; - SendMessage(hLangToolbar, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&tbLangToolbarButtons); // Add just the 1 button - SendMessage(hLangToolbar, TB_GETRECT, lang_button_id, (LPARAM)&rcToolbarButton); - - // Make the toolbar window just big enough to hold the button - // Set the top margin to 4 DIPs and the right margin so that it's aligned with the Device List Combobox - GetWindowRect(hDeviceList, &rcDeviceList); - MapWindowPoints(NULL, hDlg, (POINT*)&rcDeviceList, 2); - SetWindowPos(hLangToolbar, HWND_TOP, rcDeviceList.right - rcToolbarButton.right, - (int)(4.0f * fScale), rcToolbarButton.right, rcToolbarButton.bottom, 0); - ShowWindow(hLangToolbar, SW_SHOWNORMAL); - - // Add trailing space to the "Format Options" text - hCtrl = GetDlgItem(hDlg, IDS_FORMAT_OPTIONS_GRP); - GetWindowTextW(hCtrl, wtmp, ARRAYSIZE(wtmp)); - wtmp[wcslen(wtmp)] = ' '; - SetWindowTextW(hCtrl, wtmp); - - // Reposition and resize the Advanced button - GetWindowRect(hCtrl, &rcFormatGroup); - MapWindowPoints(NULL, hDlg, (POINT*)&rcFormatGroup, 2); - sz = GetTextSize(hCtrl); - GetWindowRect(GetDlgItem(hDlg, IDC_ADVANCED), &rcAdvancedOptions); - // The label of a group box is always 8 pixels to the right, *regardless* of the zoom level - SetWindowPos(GetDlgItem(hDlg, IDC_ADVANCED), hCtrl, rcFormatGroup.left + 8 + sz.cx, - rcFormatGroup.top, i16 + (int)(4.0f * fScale), i16/2 + (int)(8.0f * fScale), 0); - - // Reposition and resize the Select Image button - GetWindowRect(hBootType, &rcBootType); - MapWindowPoints(NULL, hDlg, (POINT*)&rcBootType, 2); - GetWindowRect(hSelectISO, &rcSelectImage); - MapWindowPoints(NULL, hDlg, (POINT*)&rcSelectImage, 2); - SetWindowPos(hSelectISO, NULL, rcSelectImage.left, rcBootType.top - 1, - rcSelectImage.right - rcSelectImage.left, rcBootType.bottom - rcBootType.top + 2, SWP_NOZORDER); - - // The things one needs to do to keep things looking good... - if (fScale > 1.4f) { - ResizeMoveCtrl(hDlg, GetDlgItem(hMainDialog, IDS_ADVANCED_OPTIONS_GRP), 0, +1, 0, 0, fScale); - } - - // Subclass the Info box so that we can align its text vertically - info_original_proc = (WNDPROC)SetWindowLongPtr(hInfo, GWLP_WNDPROC, (LONG_PTR)InfoCallback); - - // Set the icons on the the buttons - bi_iso.himl = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); - ImageList_ReplaceIcon(bi_iso.himl, -1, hIconDisc); - SetRect(&bi_iso.margin, 0, 1, 0, 0); - bi_iso.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; - bi_down.himl = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); - ImageList_ReplaceIcon(bi_down.himl, -1, hIconDown); - SetRect(&bi_down.margin, 0, 0, 0, 0); - bi_down.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; - bi_up.himl = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); - ImageList_ReplaceIcon(bi_up.himl, -1, hIconUp); - SetRect(&bi_up.margin, 0, 0, 0, 0); - bi_up.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; - - SendMessage(hSelectISO, BCM_SETIMAGELIST, 0, (LPARAM)&bi_iso); - SendMessage(GetDlgItem(hDlg, IDC_ADVANCED), BCM_SETIMAGELIST, 0, - (LPARAM)(advanced_mode?&bi_up:&bi_down)); + // Subclass the progress bar so that we can write on it + progress_original_proc = (WNDPROC)SetWindowLongPtr(hProgress, GWLP_WNDPROC, (LONG_PTR)ProgressCallback); // Set the various tooltips CreateTooltip(hFileSystem, lmprintf(MSG_157), -1); @@ -1931,7 +2173,6 @@ static void InitDialog(HWND hDlg) // Set a label for the Advanced Mode and Select Image button for screen readers SetWindowTextU(GetDlgItem(hDlg, IDC_ADVANCED), lmprintf(MSG_160)); - SetWindowTextU(hSelectISO, lmprintf(MSG_165)); if (!advanced_mode) // Hide as needed, since we display the advanced controls by default ToggleAdvanced(FALSE); @@ -1994,22 +2235,22 @@ static void SetBoot(int fs, int tt, int pt) IGNORE_RETVAL(ComboBox_ResetContent(hBootType)); if ((tt == TT_BIOS) && (IS_FAT(fs))) { if (nWindowsVersion < WINDOWS_10) // The diskcopy.dll with the MS-DOS floppy image was removed in Windows 10 - IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "MS-DOS"), BT_MSDOS)); - IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "FreeDOS"), BT_FREEDOS)); + IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "MS-DOS (MBR only)"), BT_MSDOS)); + IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "FreeDOS (MBR only)"), BT_FREEDOS)); } IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_036)), BT_ISO)); IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_095)), BT_IMG)); // If needed (advanced mode) also append "bare" Syslinux and other options if ( (tt == TT_BIOS) && ((IS_FAT(fs) || (fs == FS_NTFS)) && (advanced_mode)) ) { - static_sprintf(tmp, "Syslinux %s", embedded_sl_version_str[0]); + static_sprintf(tmp, "Syslinux %s (MBR only)", embedded_sl_version_str[0]); IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, tmp), BT_SYSLINUX_V4)); - static_sprintf(tmp, "Syslinux %s", embedded_sl_version_str[1]); + static_sprintf(tmp, "Syslinux %s (MBR only)", embedded_sl_version_str[1]); IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, tmp), BT_SYSLINUX_V6)); - IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "ReactOS"), BT_REACTOS)); + IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "ReactOS (MBR only)"), BT_REACTOS)); IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, - "Grub " GRUB2_PACKAGE_VERSION), BT_GRUB2)); + "Grub " GRUB2_PACKAGE_VERSION " (MBR only)"), BT_GRUB2)); IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, - "Grub4DOS " GRUB4DOS_VERSION), BT_GRUB4DOS)); + "Grub4DOS " GRUB4DOS_VERSION " (MBR only)"), BT_GRUB4DOS)); } if (advanced_mode) IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "UEFI:NTFS"), BT_UEFI_NTFS)); @@ -2247,7 +2488,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA POINT Point; RECT DialogRect, DesktopRect, LangToolbarRect; LONG progress_style; - HDC hDC; + HDC hdc; + PAINTSTRUCT ps; int nDeviceIndex, fs, tt, pt, i, nWidth, nHeight, nb_devices, selected_language, offset; char tmp[128]; wchar_t* wbuffer = NULL; @@ -2704,10 +2946,10 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA case WM_INITDIALOG: // Make sure fScale is set before the first call to apply localization, so that move/resize scale appropriately - hDC = GetDC(hDlg); - fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f; - if (hDC != NULL) - ReleaseDC(hDlg, hDC); + hdc = GetDC(hDlg); + fScale = GetDeviceCaps(hdc, LOGPIXELSX) / 96.0f; + if (hdc != NULL) + ReleaseDC(hDlg, hdc); apply_localization(IDD_DIALOG, hDlg); SetUpdateCheck(); togo_mode = TRUE; // We display the ToGo controls by default and need to hide them @@ -2767,6 +3009,12 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA } break; + case WM_PAINT: + hdc = BeginPaint(hDlg, &ps); + OnPaint(hdc); + EndPaint(hDlg, &ps); + break; + case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case TBN_DROPDOWN: @@ -2774,7 +3022,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA // We only care about the language button on the language toolbar if (lpnmtb->hdr.hwndFrom == hLangToolbar - && lpnmtb->iItem == lang_button_id) { + && lpnmtb->iItem == IDC_LANG) { // Get toolbar button rect and map it to actual screen pixels SendMessage(lpnmtb->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmtb->iItem, (LPARAM)&LangToolbarRect); MapWindowPoints(lpnmtb->hdr.hwndFrom, NULL, (POINT*)&LangToolbarRect, 2); diff --git a/src/rufus.h b/src/rufus.h index 9cdf4077..ebb6c435 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -1,6 +1,6 @@ /* * Rufus: The Reliable USB Formatting Utility - * Copyright © 2011-2017 Pete Batard + * Copyright © 2011-2018 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/rufus.rc b/src/rufus.rc index 4eed5dec..1211428a 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -30,67 +30,73 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // Dialog // -IDD_DIALOG DIALOGEX 12, 12, 242, 376 +IDD_DIALOG DIALOGEX 12, 12, 242, 394 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 2.18.1220" -FONT 8, "Segoe UI Symbol", 400, 0, 0x0 +CAPTION "Rufus 3.0.1220" +FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN - LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 - COMBOBOX IDC_DEVICE,8,17,226,33,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Partition scheme and target system type",IDS_PARTITION_TYPE_TXT,9,35,222,8 - COMBOBOX IDC_PARTITION_TYPE,8,46,226,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "File system",IDS_FILESYSTEM_TXT,9,64,222,10 - COMBOBOX IDC_FILESYSTEM,8,75,226,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Cluster size",IDS_CLUSTERSIZE_TXT,9,93,222,10 - COMBOBOX IDC_CLUSTERSIZE,8,104,226,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "New volume label",IDS_LABEL_TXT,9,121,222,10 - EDITTEXT IDC_LABEL,8,131,226,12,ES_AUTOHSCROLL - GROUPBOX "Format Options",IDS_FORMAT_OPTIONS_GRP,7,149,227,89 - PUSHBUTTON "",IDC_ADVANCED,220,148,14,10,BS_ICON - CONTROL "Check device for bad blocks",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,112,10 - COMBOBOX IDC_NBPASSES,128,159,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Quick format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,121,10 - CONTROL "Create a bootable disk using",IDC_BOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,185,112,10 - COMBOBOX IDC_BOOTTYPE,128,184,75,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "...",IDC_SELECT_ISO,207,183,21,14,BS_ICON - CONTROL "Standard Windows installation",IDC_WINDOWS_INSTALL, - "Button",BS_AUTORADIOBUTTON | WS_GROUP,23,198,205,8 - CONTROL "Windows To Go",IDC_WINDOWS_TO_GO,"Button",BS_AUTORADIOBUTTON,23,210,205,8 + LTEXT "Device",IDS_DEVICE_TXT,9,19,101,8 + COMBOBOX IDC_DEVICE,8,30,200,33,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Boot Type",IDS_BOOT_TYPE_TXT,9,45,35,8 + COMBOBOX IDC_BOOTTYPE,8,55,175,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Boot Option",IDS_BOOT_OPTION_TXT,8,92,201,8 + COMBOBOX IDC_BOOT_OPTION,7,102,175,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Partition scheme",IDS_PARTITION_TYPE_TXT,9,116,108,8 + COMBOBOX IDC_PARTITION_TYPE,8,129,109,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Target system type",IDS_TARGET_SYSTEM_TXT,130,116,71,10 + COMBOBOX IDC_TARGET_SYSTEM,132,129,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "File system",IDS_FILESYSTEM_TXT,9,162,110,10 + COMBOBOX IDC_FILESYSTEM,8,173,108,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Cluster size",IDS_CLUSTERSIZE_TXT,130,161,71,10 + COMBOBOX IDC_CLUSTERSIZE,132,173,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "New volume label",IDS_LABEL_TXT,9,188,222,10 + EDITTEXT IDC_LABEL,8,198,226,12,ES_AUTOHSCROLL + PUSHBUTTON "",IDC_ADVANCED,217,146,14,10,BS_ICON + CONTROL "Check device for bad blocks",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,218,112,10 + COMBOBOX IDC_NBPASSES,124,216,16,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Quick format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,276,121,10 + PUSHBUTTON "SELECT",IDC_SELECT_ISO,191,51,44,14,BS_ICON CONTROL "Create extended label and icon files",IDC_SET_ICON, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,221,216,10 - GROUPBOX "Advanced Options",IDS_ADVANCED_OPTIONS_GRP,7,233,227,55 - CONTROL "List USB Hard Drives",IDC_ENABLE_FIXED_DISKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,246,216,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,231,216,10 + CONTROL "List USB Hard Drives",IDC_ENABLE_FIXED_DISKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,263,216,10 CONTROL "Add fixes for old BIOSes (extra partition, align, etc.)",IDC_EXTRA_PARTITION, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,258,216,10 - CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,271,112,10 - COMBOBOX IDC_DISK_ID,128,269,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,298,225,9 - EDITTEXT IDC_INFO,8,316,225,12,ES_CENTER | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE - PUSHBUTTON "About...",IDC_ABOUT,8,339,50,14 - PUSHBUTTON "Log",IDC_LOG,63,339,21,14 - PUSHBUTTON "T",IDC_TEST,90,339,12,14,NOT WS_VISIBLE - DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 - PUSHBUTTON "Close",IDCANCEL,183,339,50,14 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,290,216,10 + CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,304,110,10 + COMBOBOX IDC_DISK_ID,128,305,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,341,225,9 + PUSHBUTTON "About...",IDC_ABOUT,8,359,50,14 + PUSHBUTTON "Log",IDC_LOG,63,359,21,14 + PUSHBUTTON "T",IDC_TEST,90,359,12,14,NOT WS_VISIBLE + DEFPUSHBUTTON "START",IDC_START,127,359,50,14 + PUSHBUTTON "CLOSE",IDCANCEL,183,359,50,14 + PUSHBUTTON "#",IDC_HASH,215,77,21,14,BS_ICON + PUSHBUTTON "...",IDC_SAVE,215,28,21,14,BS_ICON + LTEXT "Selected Image",IDS_SELECTED_IMAGE_TXT,8,69,204,8 + COMBOBOX IDC_SELECTED_IMAGE,7,79,199,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Device Settings ",IDS_DEVICE_OPTIONS_TXT,9,3,53,11,NOT WS_GROUP + LTEXT "Status ",IDS_STATUS_TXT,11,325,23,9,NOT WS_GROUP + LTEXT "Format Options ",IDS_FORMAT_OPTIONS_TXT,9,147,57,9,NOT WS_GROUP + LTEXT "Advanced Options ",IDS_ADVANCED_OPTIONS_TXT,7,250,67,9,NOT WS_GROUP END IDD_ABOUTBOX DIALOGEX 0, 0, 319, 237 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "About Rufus" -FONT 8, "Segoe UI Symbol", 400, 0, 0x0 +FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN ICON IDI_ICON,IDC_ABOUT_ICON,11,8,20,20 - CONTROL "",IDC_ABOUT_BLURB,"RichEdit20W",ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY,45,7,268,107 - CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL | WS_TABSTOP,46,115,267,91,WS_EX_STATICEDGE + CONTROL "",IDC_ABOUT_BLURB,"RichEdit20W",0x884,45,7,268,107 + CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",WS_VSCROLL | WS_TABSTOP | 0x804,46,115,267,91,WS_EX_STATICEDGE PUSHBUTTON "License",IDC_ABOUT_LICENSE,46,215,50,14,WS_GROUP PUSHBUTTON "Updates",IDC_ABOUT_UPDATES,100,215,50,14,NOT WS_VISIBLE | WS_GROUP DEFPUSHBUTTON "OK",IDOK,251,215,50,14,WS_GROUP END IDD_CHECKSUM DIALOGEX 0, 0, 301, 70 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Checksums" -FONT 8, "Segoe UI Symbol", 400, 0, 0x0 +FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "MD5:",IDC_STATIC,9,10,18,8 EDITTEXT IDC_MD5,40,9,197,12,ES_LOWERCASE | ES_AUTOHSCROLL | ES_READONLY @@ -102,18 +108,18 @@ BEGIN END IDD_LICENSE DIALOGEX 0, 0, 335, 205 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Rufus License" -FONT 8, "Segoe UI Symbol", 400, 0, 0x0 +FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN DEFPUSHBUTTON "Close",IDCANCEL,278,187,50,14 EDITTEXT IDC_LICENSE_TEXT,7,7,321,176,ES_MULTILINE | ES_READONLY | WS_VSCROLL END IDD_LOG DIALOGEX 0, 0, 366, 376 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Log" -FONT 8, "Segoe UI Symbol", 400, 0, 0x0 +FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN EDITTEXT IDC_LOG_EDIT,0,0,366,346,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_CLIENTEDGE PUSHBUTTON "Clear Log",IDC_LOG_CLEAR,198,354,50,14 @@ -122,9 +128,9 @@ BEGIN END IDD_NOTIFICATION DIALOGEX 0, 0, 263, 63 -STYLE DS_SETFONT | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME +STYLE DS_SETFONT | DS_FIXEDSYS | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME CAPTION "Rufus" -FONT 8, "Segoe UI Symbol", 400, 0, 0x0 +FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "",IDC_NOTIFICATION_LINE,0,0,263,39 LTEXT "",IDC_STATIC,0,0,263,38 @@ -136,9 +142,9 @@ BEGIN END IDD_SELECTION DIALOGEX 0, 0, 312, 71 -STYLE DS_SETFONT | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME +STYLE DS_SETFONT | DS_FIXEDSYS | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME CAPTION "Rufus" -FONT 8, "Segoe UI Symbol", 400, 0, 0x0 +FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "",IDC_SELECTION_LINE,0,0,312,47 LTEXT "",IDC_STATIC,0,0,312,46 @@ -165,9 +171,9 @@ BEGIN END IDD_LIST DIALOGEX 0, 0, 312, 59 -STYLE DS_SETFONT | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME +STYLE DS_SETFONT | DS_FIXEDSYS | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME CAPTION "Rufus" -FONT 8, "Segoe UI Symbol", 400, 0, 0x0 +FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "",IDC_LIST_LINE,0,0,312,32 LTEXT "",IDC_STATIC,0,0,312,31 @@ -175,31 +181,31 @@ BEGIN LTEXT "Message",IDC_LIST_TEXT,35,5,269,8 PUSHBUTTON "OK",IDOK,254,39,50,14 LTEXT "List 1",IDC_LIST_ITEM1,35,17,269,10,SS_PATHELLIPSIS - LTEXT "List 2",IDC_LIST_ITEM2,35,28,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 3",IDC_LIST_ITEM3,35,39,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 4",IDC_LIST_ITEM4,35,50,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 5",IDC_LIST_ITEM5,35,61,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 6",IDC_LIST_ITEM6,35,72,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 7",IDC_LIST_ITEM7,35,73,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 8",IDC_LIST_ITEM8,35,84,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 9",IDC_LIST_ITEM9,35,95,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 10",IDC_LIST_ITEM10,35,106,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 11",IDC_LIST_ITEM11,35,117,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 12",IDC_LIST_ITEM12,35,128,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 13",IDC_LIST_ITEM13,35,139,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 14",IDC_LIST_ITEM14,35,150,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 15",IDC_LIST_ITEM15,35,161,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS - LTEXT "List 16",IDC_LIST_ITEMMAX,35,172,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS + LTEXT "List 2",IDC_LIST_ITEM2,35,28,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 3",IDC_LIST_ITEM3,35,39,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 4",IDC_LIST_ITEM4,35,50,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 5",IDC_LIST_ITEM5,35,61,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 6",IDC_LIST_ITEM6,35,72,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 7",IDC_LIST_ITEM7,35,73,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 8",IDC_LIST_ITEM8,35,84,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 9",IDC_LIST_ITEM9,35,95,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 10",IDC_LIST_ITEM10,35,106,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 11",IDC_LIST_ITEM11,35,117,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 12",IDC_LIST_ITEM12,35,128,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 13",IDC_LIST_ITEM13,35,139,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 14",IDC_LIST_ITEM14,35,150,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 15",IDC_LIST_ITEM15,35,161,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE + LTEXT "List 16",IDC_LIST_ITEMMAX,35,172,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE END IDD_UPDATE_POLICY DIALOGEX 0, 0, 287, 198 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Update policy and settings" -FONT 8, "Segoe UI Symbol", 400, 0, 0x0 +FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN ICON IDI_ICON,IDC_ABOUT_ICON,11,8,20,20 DEFPUSHBUTTON "Close",IDCANCEL,221,172,50,14,WS_GROUP - CONTROL "",IDC_POLICY,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL | WS_TABSTOP,46,8,235,132,WS_EX_STATICEDGE + CONTROL "",IDC_POLICY,"RichEdit20W",WS_VSCROLL | WS_TABSTOP | 0x804,46,8,235,132,WS_EX_STATICEDGE GROUPBOX "Settings",IDS_UPDATE_SETTINGS_GRP,45,145,165,46 LTEXT "Check for updates",IDS_UPDATE_FREQUENCY_TXT,51,159,76,11 COMBOBOX IDC_UPDATE_FREQUENCY,133,155,66,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -210,9 +216,9 @@ BEGIN END IDD_NEW_VERSION DIALOGEX 0, 0, 384, 268 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Check For Updates - Rufus" -FONT 8, "Segoe UI Symbol", 400, 0, 0x0 +FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN PUSHBUTTON "Close",IDCANCEL,167,244,50,14,WS_GROUP CONTROL "",IDC_RELEASE_NOTES,"RichEdit20W",WS_VSCROLL | 0x804,15,77,352,88,WS_EX_STATICEDGE @@ -366,8 +372,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,18,1220,0 - PRODUCTVERSION 2,18,1220,0 + FILEVERSION 3,0,1220,0 + PRODUCTVERSION 3,0,1220,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -384,13 +390,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "2.18.1220" + VALUE "FileVersion", "3.0.1220" VALUE "InternalName", "Rufus" - VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)" + VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "2.18.1220" + VALUE "ProductVersion", "3.0.1220" END END BLOCK "VarFileInfo" diff --git a/src/stdlg.c b/src/stdlg.c index 3e549b61..a698abab 100644 --- a/src/stdlg.c +++ b/src/stdlg.c @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * Standard Dialog Routines (Browse for folder, About, etc) - * Copyright © 2011-2017 Pete Batard + * Copyright © 2011-2018 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -606,7 +606,7 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP ShowWindow(GetDlgItem(hDlg, IDC_ABOUT_UPDATES), SW_SHOW); static_sprintf(about_blurb, about_blurb_format, lmprintf(MSG_174|MSG_RTF), lmprintf(MSG_175|MSG_RTF, rufus_version[0], rufus_version[1], rufus_version[2]), - right_to_left_mode?"Akeo \\\\ Pete Batard 2011-2017 © Copyright":"Copyright © 2011-2017 Pete Batard / Akeo", + right_to_left_mode?"Akeo \\\\ Pete Batard 2011-2018 © Copyright":"Copyright © 2011-2018 Pete Batard / Akeo", lmprintf(MSG_176|MSG_RTF), lmprintf(MSG_177|MSG_RTF), lmprintf(MSG_178|MSG_RTF)); for (i=0; i= 1500) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) - // In versions of Windows prior to Vista, the iPaddedBorderWidth member - // is not present, so we need to subtract its size from cbSize. - ncm.cbSize -= sizeof(ncm.iPaddedBorderWidth); -#endif SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); hDlgFont = CreateFontIndirect(&(ncm.lfMessageFont)); // Set the dialog to use the system message box font @@ -987,13 +980,6 @@ INT_PTR CALLBACK ListCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa // TODO: This shouldn't be needed when using DS_SHELLFONT // Get the system message box font. See http://stackoverflow.com/a/6057761 ncm.cbSize = sizeof(ncm); - // If we're compiling with the Vista SDK or later, the NONCLIENTMETRICS struct - // will be the wrong size for previous versions, so we need to adjust it. -#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) - // In versions of Windows prior to Vista, the iPaddedBorderWidth member - // is not present, so we need to subtract its size from cbSize. - ncm.cbSize -= sizeof(ncm.iPaddedBorderWidth); -#endif SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); hDlgFont = CreateFontIndirect(&(ncm.lfMessageFont)); // Set the dialog to use the system message box font @@ -1692,7 +1678,6 @@ out: * The following is used to work around dialog template limitations when switching from LTR to RTL * or switching the font. This avoids having to multiply similar templates in the RC. * TODO: Can we use http://stackoverflow.com/questions/6057239/which-font-is-the-default-for-mfc-dialog-controls? - * TODO: We are supposed to use Segoe with font size 9 in Vista or later */ // Produce a dialog template from our RC, and update its RTL and Font settings dynamically