mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[ui] update persistence size controls
* Also refactor ToggleImageOptions()
This commit is contained in:
		
							parent
							
								
									0fa19d7019
								
							
						
					
					
						commit
						1004a6e066
					
				
					 7 changed files with 170 additions and 106 deletions
				
			
		|  | @ -1,24 +1,18 @@ | ||||||
| This file lists any change that has been applied to the en-US translation of | This file lists any change that has been applied to the en-US translation of | ||||||
| rufus.loc since its original version. Translators are expected to keep their | rufus.loc since its original version. | ||||||
| translations up to date by monitoring this file on regular basis and applying |  | ||||||
| the same changes. |  | ||||||
| 
 | 
 | ||||||
| When editing an existing translation, make sure you always follow: | When editing an existing translation, make sure to follow: | ||||||
| https://github.com/pbatard/rufus/wiki/Localization#Editing_a_translation | https://github.com/pbatard/rufus/wiki/Localization#Editing_a_translation | ||||||
| 
 | 
 | ||||||
| Remember to also update the version number for your translation ('v x.y.z') |  | ||||||
| once you have matched all the changes that occurred for the en-US translation. |  | ||||||
| 
 |  | ||||||
| !!IMPORTANT!! The changes below may NOT contain the full message and only tell |  | ||||||
| you WHERE, in the English translation, you should look to find the full message |  | ||||||
| content. PLEASE, do not just look at this Changelog when updating your |  | ||||||
| translation, but always use the English section of rufus.loc as your base. |  | ||||||
| For instance, MSG_114, that was introduced in v1.0.8 is MORE than one line! |  | ||||||
| 
 |  | ||||||
| o v3.2 (2018.??.??) | o v3.2 (2018.??.??) | ||||||
|   - *NEW*      MSG_087 |   - *NEW*      MSG_087 | ||||||
|  |     *NEW*      MSG_123 | ||||||
|  |     *NEW*      MSG_124 | ||||||
|  |     *NEW*      MSG_125 | ||||||
|  |     *NEW*      MSG_126 | ||||||
|  |     *NEW*      MSG_127 | ||||||
|   - *NEW*      MSG_172 |   - *NEW*      MSG_172 | ||||||
|   - *NEW*      MSG_199 |   - *NEW*      MSG_240 | ||||||
|   - *NEW*      MSG_306 |   - *NEW*      MSG_306 | ||||||
| 
 | 
 | ||||||
| o v3.0 (2018.03.27) | o v3.0 (2018.03.27) | ||||||
|  | @ -80,7 +74,8 @@ o v2.16 (2017.07.17) | ||||||
|   - *NEW* MSG_298 "The ISO file you have selected does not match its declared size: %s of data is missing!\n\nIf you obtained " |   - *NEW* MSG_298 "The ISO file you have selected does not match its declared size: %s of data is missing!\n\nIf you obtained " | ||||||
|     "this file from the Internet, you should try to download a new copy and verify that the MD5 or SHA checksums match the " |     "this file from the Internet, you should try to download a new copy and verify that the MD5 or SHA checksums match the " | ||||||
|     "official ones.\n\nNote that you can compute the MD5 or SHA in Rufus by clicking the '#' button." |     "official ones.\n\nNote that you can compute the MD5 or SHA in Rufus by clicking the '#' button." | ||||||
|   Note: You can test MSG_297/MSG_298 using https://rufus.akeo.ie/testing/arch_trunc.iso (A truncated version of archlinux-2017.07.01-x86_64.iso) |   Note: You can test MSG_297/MSG_298 using https://github.com/pbatard/rufus/raw/master/res/loc/test/arch_trunc.iso | ||||||
|  |   A truncated version of archlinux-2017.07.01-x86_64.iso) | ||||||
| 
 | 
 | ||||||
| o v2.12 (2017.01.16) | o v2.12 (2017.01.16) | ||||||
|   - *NEW* MSG_288 "Missing elevated privileges" |   - *NEW* MSG_288 "Missing elevated privileges" | ||||||
|  | @ -138,7 +133,7 @@ o v2.4 (2015.09.03) | ||||||
|     Note: You can see the message above by hovering on the language button |     Note: You can see the message above by hovering on the language button | ||||||
|   - *NEW* MSG_274 "ISOHybrid image detected" |   - *NEW* MSG_274 "ISOHybrid image detected" | ||||||
|     Note: You can test this message and the one below by downloading and trying to write the latest menu_c32_test.iso (120 KB) from: |     Note: You can test this message and the one below by downloading and trying to write the latest menu_c32_test.iso (120 KB) from: | ||||||
|     https://github.com/pbatard/rufus/raw/master/res/localization/menu_c32_test.iso |     https://github.com/pbatard/rufus/raw/master/res/loc/test/menu_c32_test.iso | ||||||
| 	- *NEW* MSG_275 "The image you have selected is..." [TRANSLATORS: Please refer to the English section of 'rufus.loc' for the FULL message] | 	- *NEW* MSG_275 "The image you have selected is..." [TRANSLATORS: Please refer to the English section of 'rufus.loc' for the FULL message] | ||||||
| 	  For more info on the messages below, also see the comments in the English section of rufus.loc | 	  For more info on the messages below, also see the comments in the English section of rufus.loc | ||||||
|   - *NEW* MSG_276 "Write in %s mode (Recommended)" |   - *NEW* MSG_276 "Write in %s mode (Recommended)" | ||||||
|  | @ -151,8 +146,8 @@ o v2.4 (2015.09.03) | ||||||
| o v2.0 (2015.02.04) | o v2.0 (2015.02.04) | ||||||
|   - *NEW CONTROL* IDC_WINDOWS_INSTALL "Standard Windows installation" (Main dialog) |   - *NEW CONTROL* IDC_WINDOWS_INSTALL "Standard Windows installation" (Main dialog) | ||||||
|   - *NEW CONTROL* IDC_WINDOWS_TO_GO "Windows To Go" (Main dialog) |   - *NEW CONTROL* IDC_WINDOWS_TO_GO "Windows To Go" (Main dialog) | ||||||
|   Note: to see the 2 controls above displayed, you will need to load the "Windows To Go.iso" image from |   Note: to see the 2 controls above displayed, you will need to load the "windows_to_go.iso" image from | ||||||
|   https://github.com/pbatard/rufus/raw/master/res/localization/Windows%20To%20Go.iso (356 KB) |   https://github.com/pbatard/rufus/raw/master/res/loc/test/windows_to_go.iso (356 KB) | ||||||
|   Also see the comment for IDC_WINDOWS_TO_GO in the English translation. |   Also see the comment for IDC_WINDOWS_TO_GO in the English translation. | ||||||
|   - *NEW* MSG_096 "The file system currently selected can not be used with this type of ISO (...)" |   - *NEW* MSG_096 "The file system currently selected can not be used with this type of ISO (...)" | ||||||
|   - *NEW* MSG_097 "'Windows To Go' can only be applied if the file system is NTFS." |   - *NEW* MSG_097 "'Windows To Go' can only be applied if the file system is NTFS." | ||||||
|  |  | ||||||
|  | @ -308,6 +308,11 @@ t MSG_119 "advanced drive properties" | ||||||
| t MSG_120 "advanced format options" | t MSG_120 "advanced format options" | ||||||
| t MSG_121 "Show %s" | t MSG_121 "Show %s" | ||||||
| t MSG_122 "Hide %s" | t MSG_122 "Hide %s" | ||||||
|  | t MSG_123 "Persistent partition size" | ||||||
|  | t MSG_124 "No persistence" | ||||||
|  | t MSG_125 "Use this slider to set the size of the persistent partition. Setting the size to 0 disables the persistent partition." | ||||||
|  | t MSG_126 "Use this field to enter the size of the persistent partition. Setting the size to 0 disables the persistent partition." | ||||||
|  | t MSG_127 "Set the persistent partition size unit." | ||||||
| t MSG_150 "Type of computer you plan to use this bootable drive with. It is your responsibility to determine whether " | t MSG_150 "Type of computer you plan to use this bootable drive with. It is your responsibility to determine whether " | ||||||
| 	"your target is of BIOS or UEFI type before you start creating the drive, as it may fail to boot otherwise." | 	"your target is of BIOS or UEFI type before you start creating the drive, as it may fail to boot otherwise." | ||||||
| # You shouldn't translate 'Legacy Mode' as this is an option that usually appears in English in the UEFI settings. | # You shouldn't translate 'Legacy Mode' as this is an option that usually appears in English in the UEFI settings. | ||||||
|  | @ -372,7 +377,6 @@ t MSG_196 "IMPORTANT: THIS DRIVE USES A NONSTANDARD SECTOR SIZE!\n\n" | ||||||
| t MSG_197 "Nonstandard sector size detected" | t MSG_197 "Nonstandard sector size detected" | ||||||
| t MSG_198 "'Windows To Go' can only be installed on a GPT partitioned drive if it has " | t MSG_198 "'Windows To Go' can only be installed on a GPT partitioned drive if it has " | ||||||
| 	"the FIXED attribute set. The current drive was not detected as FIXED." | 	"the FIXED attribute set. The current drive was not detected as FIXED." | ||||||
| t MSG_199 "Persistent partition size" |  | ||||||
| 
 | 
 | ||||||
| t MSG_201 "Cancelling - Please wait..." | t MSG_201 "Cancelling - Please wait..." | ||||||
| t MSG_202 "Scanning image..." | t MSG_202 "Scanning image..." | ||||||
|  |  | ||||||
							
								
								
									
										104
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										104
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -90,7 +90,7 @@ RUFUS_UPDATE update = { { 0,0,0 },{ 0,0 }, NULL, NULL }; | ||||||
| HINSTANCE hMainInstance; | HINSTANCE hMainInstance; | ||||||
| HWND hMainDialog, hMultiToolbar, hSaveToolbar, hHashToolbar, hAdvancedDeviceToolbar, hAdvancedFormatToolbar, hUpdatesDlg = NULL; | HWND hMainDialog, hMultiToolbar, hSaveToolbar, hHashToolbar, hAdvancedDeviceToolbar, hAdvancedFormatToolbar, hUpdatesDlg = NULL; | ||||||
| HFONT hInfoFont; | HFONT hInfoFont; | ||||||
| uint8_t image_options = 0x00; | uint8_t image_options = IMOP_WINTOGO; | ||||||
| uint16_t rufus_version[3], embedded_sl_version[2]; | uint16_t rufus_version[3], embedded_sl_version[2]; | ||||||
| uint32_t dur_mins, dur_secs, DrivePort[MAX_DRIVES];; | uint32_t dur_mins, dur_secs, DrivePort[MAX_DRIVES];; | ||||||
| loc_cmd* selected_locale = NULL; | loc_cmd* selected_locale = NULL; | ||||||
|  | @ -102,8 +102,9 @@ BOOL use_own_c32[NB_OLD_C32] = { FALSE, FALSE }, mbr_selected_by_user = FALSE; | ||||||
| BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE, has_uefi_csm; | BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE, has_uefi_csm; | ||||||
| BOOL enable_HDDs = FALSE, force_update = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE; | BOOL enable_HDDs = FALSE, force_update = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE; | ||||||
| BOOL advanced_mode_device, advanced_mode_format, allow_dual_uefi_bios, detect_fakes, enable_vmdk, force_large_fat32, usb_debug; | BOOL advanced_mode_device, advanced_mode_format, allow_dual_uefi_bios, detect_fakes, enable_vmdk, force_large_fat32, usb_debug; | ||||||
| BOOL use_fake_units, preserve_timestamps = FALSE, fast_zeroing = FALSE; | BOOL use_fake_units, preserve_timestamps = FALSE, fast_zeroing = FALSE, app_changed_size = FALSE; | ||||||
| BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, enable_file_indexing, large_drive = FALSE, write_as_image = FALSE; | BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, enable_file_indexing, large_drive = FALSE, write_as_image = FALSE; | ||||||
|  | uint64_t persistence_size = 0; | ||||||
| float fScale = 1.0f; | float fScale = 1.0f; | ||||||
| int dialog_showing = 0, selection_default = BT_IMAGE, windows_to_go_selection = 0, persistence_unit_selection = -1; | int dialog_showing = 0, selection_default = BT_IMAGE, windows_to_go_selection = 0, persistence_unit_selection = -1; | ||||||
| int default_fs, fs, bt, pt, tt; // file system, boot type, partition type, target type
 | int default_fs, fs, bt, pt, tt; // file system, boot type, partition type, target type
 | ||||||
|  | @ -112,6 +113,7 @@ char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; | ||||||
| char embedded_sl_version_ext[2][32]; | char embedded_sl_version_ext[2][32]; | ||||||
| char ClusterSizeLabel[MAX_CLUSTER_SIZES][64]; | char ClusterSizeLabel[MAX_CLUSTER_SIZES][64]; | ||||||
| char msgbox[1024], msgbox_title[32], *ini_file = NULL, *image_path = NULL, *short_image_path; | char msgbox[1024], msgbox_title[32], *ini_file = NULL, *image_path = NULL, *short_image_path; | ||||||
|  | char image_option_txt[128]; | ||||||
| StrArray DriveID, DriveLabel, DriveHub, BlockingProcess, ImageList; | StrArray DriveID, DriveLabel, DriveHub, BlockingProcess, ImageList; | ||||||
| // Number of steps for each FS for FCC_STRUCTURE_PROGRESS
 | // Number of steps for each FS for FCC_STRUCTURE_PROGRESS
 | ||||||
| const int nb_steps[FS_MAX] = { 5, 5, 12, 1, 10 }; | const int nb_steps[FS_MAX] = { 5, 5, 12, 1, 10 }; | ||||||
|  | @ -600,26 +602,6 @@ static void SetMBRProps(void) | ||||||
| 	IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, needs_masquerading?1:0)); | 	IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, needs_masquerading?1:0)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void SetImageOptions(void) |  | ||||||
| { |  | ||||||
| 	if ((bt != BT_IMAGE) || (image_path == NULL)) { |  | ||||||
| 		if (image_options & IMOP_WINTOGO) |  | ||||||
| 			ToggleImageOption(IMOP_WINTOGO); |  | ||||||
| 		if (image_options & IMOP_PERSISTENCE) |  | ||||||
| 			ToggleImageOption(IMOP_PERSISTENCE); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if ( (!HAS_WINTOGO(img_report) && ( (image_options & IMOP_WINTOGO))) || |  | ||||||
| 		 ( HAS_WINTOGO(img_report) && (!(image_options & IMOP_WINTOGO))) ) { |  | ||||||
| 		ToggleImageOption(IMOP_WINTOGO); |  | ||||||
| 	} |  | ||||||
| 	if ( (!HAS_PERSISTENCE(img_report) && ( (image_options & IMOP_PERSISTENCE))) || |  | ||||||
| 		 ( HAS_PERSISTENCE(img_report) && (!(image_options & IMOP_PERSISTENCE))) ) { |  | ||||||
| 		ToggleImageOption(IMOP_PERSISTENCE); |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void SetProposedLabel(int ComboIndex) | static void SetProposedLabel(int ComboIndex) | ||||||
| { | { | ||||||
| 	const char no_label[] = STR_NO_LABEL, empty[] = ""; | 	const char no_label[] = STR_NO_LABEL, empty[] = ""; | ||||||
|  | @ -731,8 +713,8 @@ static void EnableBootOptions(BOOL enable, BOOL remove_checkboxes) | ||||||
| 
 | 
 | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION), actual_enable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION), actual_enable); | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SLIDER), actual_enable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SLIDER), actual_enable); | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), actual_enable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), (persistence_size != 0) && actual_enable); | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_PERSISTENCE_UNITS), actual_enable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_PERSISTENCE_UNITS), (persistence_size != 0) && actual_enable); | ||||||
| 	EnableMBRBootOptions(actual_enable, remove_checkboxes); | 	EnableMBRBootOptions(actual_enable, remove_checkboxes); | ||||||
| 
 | 
 | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_LABEL), actual_enable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_LABEL), actual_enable); | ||||||
|  | @ -1001,8 +983,6 @@ static void DisplayISOProps(void) | ||||||
| 	} | 	} | ||||||
| 	PRINT_ISO_PROP(img_report.has_symlinks, "  Note: This ISO uses symbolic links, which will not be replicated due to file system limitations."); | 	PRINT_ISO_PROP(img_report.has_symlinks, "  Note: This ISO uses symbolic links, which will not be replicated due to file system limitations."); | ||||||
| 	PRINT_ISO_PROP(img_report.has_symlinks, "  Because of this, some features from this image may not work..."); | 	PRINT_ISO_PROP(img_report.has_symlinks, "  Because of this, some features from this image may not work..."); | ||||||
| 
 |  | ||||||
| 	SetImageOptions(); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Insert the image name into the Boot selection dropdown
 | // Insert the image name into the Boot selection dropdown
 | ||||||
|  | @ -1084,6 +1064,7 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 			UpdateImage(); | 			UpdateImage(); | ||||||
| 			uprintf("Using image: %s (%s)", short_image_path, SizeToHumanReadable(img_report.image_size, FALSE, FALSE)); | 			uprintf("Using image: %s (%s)", short_image_path, SizeToHumanReadable(img_report.image_size, FALSE, FALSE)); | ||||||
| 		} | 		} | ||||||
|  | 		ToggleImageOptions(); | ||||||
| 		EnableControls(TRUE); | 		EnableControls(TRUE); | ||||||
| 		// Set Target and FS accordingly
 | 		// Set Target and FS accordingly
 | ||||||
| 		if (img_report.is_iso) { | 		if (img_report.is_iso) { | ||||||
|  | @ -1643,12 +1624,15 @@ static void InitDialog(HWND hDlg) | ||||||
| 	CreateTooltip(hTargetSystem, lmprintf(MSG_150), 30000); | 	CreateTooltip(hTargetSystem, lmprintf(MSG_150), 30000); | ||||||
| 	CreateTooltip(GetDlgItem(hDlg, IDS_CSM_HELP_TXT), lmprintf(MSG_151), 30000); | 	CreateTooltip(GetDlgItem(hDlg, IDS_CSM_HELP_TXT), lmprintf(MSG_151), 30000); | ||||||
| 	CreateTooltip(GetDlgItem(hDlg, IDC_IMAGE_OPTION), lmprintf(MSG_305), 30000); | 	CreateTooltip(GetDlgItem(hDlg, IDC_IMAGE_OPTION), lmprintf(MSG_305), 30000); | ||||||
|  | 	CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_SLIDER), lmprintf(MSG_125), 30000); | ||||||
|  | 	CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_SIZE), lmprintf(MSG_126), 30000); | ||||||
|  | 	CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS), lmprintf(MSG_127), 30000); | ||||||
| 
 | 
 | ||||||
| 	if (!advanced_mode_device)	// Hide as needed, since we display the advanced controls by default
 | 	if (!advanced_mode_device)	// Hide as needed, since we display the advanced controls by default
 | ||||||
| 		ToggleAdvancedDeviceOptions(FALSE); | 		ToggleAdvancedDeviceOptions(FALSE); | ||||||
| 	if (!advanced_mode_format) | 	if (!advanced_mode_format) | ||||||
| 		ToggleAdvancedFormatOptions(FALSE); | 		ToggleAdvancedFormatOptions(FALSE); | ||||||
| 	ToggleImageOption(0); | 	ToggleImageOptions(); | ||||||
| 
 | 
 | ||||||
| 	// Process commandline parameters
 | 	// Process commandline parameters
 | ||||||
| 	if (iso_provided) { | 	if (iso_provided) { | ||||||
|  | @ -1860,14 +1844,14 @@ out: | ||||||
| static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||||
| { | { | ||||||
| 	static DWORD DeviceNum = 0; | 	static DWORD DeviceNum = 0; | ||||||
| 	static uint64_t LastRefresh = 0, pos; | 	static uint64_t LastRefresh = 0; | ||||||
| 	static BOOL first_log_display = TRUE, isMarquee = FALSE, queued_hotplug_event = FALSE; | 	static BOOL first_log_display = TRUE, isMarquee = FALSE, queued_hotplug_event = FALSE; | ||||||
| 	static ULONG ulRegister = 0; | 	static ULONG ulRegister = 0; | ||||||
| 	static LONG lPos; |  | ||||||
| 	static LPITEMIDLIST pidlDesktop = NULL; | 	static LPITEMIDLIST pidlDesktop = NULL; | ||||||
| 	static SHChangeNotifyEntry NotifyEntry; | 	static SHChangeNotifyEntry NotifyEntry; | ||||||
| 	static DWORD_PTR thread_affinity[4]; | 	static DWORD_PTR thread_affinity[4]; | ||||||
| 	static HFONT hyperlink_font = NULL; | 	static HFONT hyperlink_font = NULL; | ||||||
|  | 	LONG lPos; | ||||||
| 	BOOL set_selected_fs; | 	BOOL set_selected_fs; | ||||||
| 	DRAWITEMSTRUCT* pDI; | 	DRAWITEMSTRUCT* pDI; | ||||||
| 	LPTOOLTIPTEXT lpttt; | 	LPTOOLTIPTEXT lpttt; | ||||||
|  | @ -2044,18 +2028,52 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 			SetFileSystemAndClusterSize(NULL); | 			SetFileSystemAndClusterSize(NULL); | ||||||
| 			windows_to_go_selection = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_IMAGE_OPTION)); | 			windows_to_go_selection = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_IMAGE_OPTION)); | ||||||
| 			break; | 			break; | ||||||
|  | 		case IDC_PERSISTENCE_SIZE: | ||||||
|  | 			if (HIWORD(wParam) == EN_CHANGE) { | ||||||
|  | 				uint64_t pos; | ||||||
|  | 				// We get EN_CHANGE when we change the size automatically, so we need to detect that
 | ||||||
|  | 				if (app_changed_size) { | ||||||
|  | 					app_changed_size = FALSE; | ||||||
|  | 					break; | ||||||
|  | 				} | ||||||
|  | 				GetWindowTextA(GetDlgItem(hDlg, IDC_PERSISTENCE_SIZE), tmp, sizeof(tmp)); | ||||||
|  | 				lPos = atol(tmp); | ||||||
|  | 				persistence_unit_selection = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS)); | ||||||
|  | 				persistence_size = lPos * MB; | ||||||
|  | 				for (i = 0; i < persistence_unit_selection; i++) | ||||||
|  | 					persistence_size *= 1024; | ||||||
|  | 				if (persistence_size > SelectedDrive.DiskSize - img_report.projected_size) | ||||||
|  | 					persistence_size = SelectedDrive.DiskSize - img_report.projected_size; | ||||||
|  | 				pos = persistence_size / MB; | ||||||
|  | 				for (i = 0; i < persistence_unit_selection; i++) | ||||||
|  | 					pos /= 1024; | ||||||
|  | 				lPos = (LONG)pos; | ||||||
|  | 				SendMessage(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SLIDER), TBM_SETPOS, TRUE, lPos); | ||||||
|  | 				if (persistence_size >= (SelectedDrive.DiskSize - img_report.projected_size)) { | ||||||
|  | 					static_sprintf(tmp, "%d", lPos); | ||||||
|  | 					app_changed_size = TRUE; | ||||||
|  | 					SetWindowTextU(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), tmp); | ||||||
|  | 				} | ||||||
|  | 			} else if (HIWORD(wParam) == EN_KILLFOCUS) { | ||||||
|  | 				if (persistence_size == 0) { | ||||||
|  | 					TogglePersistenceControls(FALSE); | ||||||
|  | 					static_sprintf(tmp, "0 (%s)", lmprintf(MSG_124)); | ||||||
|  | 					app_changed_size = TRUE; | ||||||
|  | 					SetWindowTextU(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), tmp); | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			break; | ||||||
| 		case IDC_PERSISTENCE_UNITS: | 		case IDC_PERSISTENCE_UNITS: | ||||||
| 			if (HIWORD(wParam) != CBN_SELCHANGE) | 			if (HIWORD(wParam) != CBN_SELCHANGE) | ||||||
| 				break; | 				break; | ||||||
| 			if (ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS)) == persistence_unit_selection) | 			if (ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS)) == persistence_unit_selection) | ||||||
| 				break; | 				break; | ||||||
| 			GetWindowTextA(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), tmp, sizeof(tmp)); | 			GetWindowTextA(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), tmp, sizeof(tmp)); | ||||||
| 			pos = atol(tmp) * MB; | 			persistence_size = atol(tmp) * MB; | ||||||
| 			for (i = 0; i < persistence_unit_selection; i++) | 			for (i = 0; i < persistence_unit_selection; i++) | ||||||
| 				pos *= 1024; | 				persistence_size *= 1024; | ||||||
| 			persistence_unit_selection = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS)); | 			persistence_unit_selection = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS)); | ||||||
| 			// TODO: Use projected size. For now force the selected ISO to a 4 GB size
 | 			SetPersistenceSize(persistence_size, SelectedDrive.DiskSize - img_report.projected_size); | ||||||
| 			SetPersistenceSize(pos, SelectedDrive.DiskSize - 4 * GB); |  | ||||||
| 			break; | 			break; | ||||||
| 		case IDC_NB_PASSES: | 		case IDC_NB_PASSES: | ||||||
| 			if (HIWORD(wParam) != CBN_SELCHANGE) | 			if (HIWORD(wParam) != CBN_SELCHANGE) | ||||||
|  | @ -2115,7 +2133,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 			if ((selected_fs == -1) && (SelectedDrive.DeviceNumber != 0)) | 			if ((selected_fs == -1) && (SelectedDrive.DeviceNumber != 0)) | ||||||
| 				GetDrivePartitionData(SelectedDrive.DeviceNumber, tmp, sizeof(tmp), TRUE); | 				GetDrivePartitionData(SelectedDrive.DeviceNumber, tmp, sizeof(tmp), TRUE); | ||||||
| 			SetFileSystemAndClusterSize(tmp); | 			SetFileSystemAndClusterSize(tmp); | ||||||
| 			SetImageOptions(); | 			ToggleImageOptions(); | ||||||
| 			SetProposedLabel(ComboBox_GetCurSel(hDeviceList)); | 			SetProposedLabel(ComboBox_GetCurSel(hDeviceList)); | ||||||
| 			EnableControls(TRUE); | 			EnableControls(TRUE); | ||||||
| 			tt = (int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)); | 			tt = (int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)); | ||||||
|  | @ -2399,8 +2417,19 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 
 | 
 | ||||||
| 	case WM_HSCROLL: | 	case WM_HSCROLL: | ||||||
| 		lPos = (LONG)SendMessage(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SLIDER), TBM_GETPOS, 0, 0); | 		lPos = (LONG)SendMessage(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SLIDER), TBM_GETPOS, 0, 0); | ||||||
| 		sprintf(tmp, "%ld", lPos); | 		if (lPos != 0) { | ||||||
| 		SetWindowTextA(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), tmp); | 			if (persistence_size == 0) | ||||||
|  | 				TogglePersistenceControls(TRUE); | ||||||
|  | 			sprintf(tmp, "%ld", lPos); | ||||||
|  | 		} else { | ||||||
|  | 			TogglePersistenceControls(FALSE); | ||||||
|  | 			static_sprintf(tmp, "0 (%s)", lmprintf(MSG_124)); | ||||||
|  | 		} | ||||||
|  | 		persistence_size = lPos * MB; | ||||||
|  | 		for (i = 0; i < persistence_unit_selection; i++) | ||||||
|  | 			persistence_size *= 1024; | ||||||
|  | 		app_changed_size = TRUE; | ||||||
|  | 		SetWindowTextU(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), tmp); | ||||||
| 		break; | 		break; | ||||||
| 
 | 
 | ||||||
| 	case WM_DROPFILES: | 	case WM_DROPFILES: | ||||||
|  | @ -3012,6 +3041,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| relaunch: | relaunch: | ||||||
| 	ubprintf("Localization set to '%s'", selected_locale->txt[0]); | 	ubprintf("Localization set to '%s'", selected_locale->txt[0]); | ||||||
| 	right_to_left_mode = ((selected_locale->ctrl_id) & LOC_RIGHT_TO_LEFT); | 	right_to_left_mode = ((selected_locale->ctrl_id) & LOC_RIGHT_TO_LEFT); | ||||||
|  | 	// We always launch with the image options displaying
 | ||||||
|  | 	image_options = IMOP_WINTOGO; | ||||||
|  | 	image_option_txt[0] = 0; | ||||||
| 	SetProcessDefaultLayout(right_to_left_mode?LAYOUT_RTL:0); | 	SetProcessDefaultLayout(right_to_left_mode?LAYOUT_RTL:0); | ||||||
| 	if (get_loc_data_file(loc_file, selected_locale)) | 	if (get_loc_data_file(loc_file, selected_locale)) | ||||||
| 		WriteSettingStr(SETTING_LOCALE, selected_locale->txt[0]); | 		WriteSettingStr(SETTING_LOCALE, selected_locale->txt[0]); | ||||||
|  |  | ||||||
|  | @ -230,7 +230,8 @@ enum fs_type { | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| enum boot_type { | enum boot_type { | ||||||
| 	BT_MSDOS = 0, | 	BT_NON_BOOTABLE = 0, | ||||||
|  | 	BT_MSDOS, | ||||||
| 	BT_FREEDOS, | 	BT_FREEDOS, | ||||||
| 	BT_IMAGE, | 	BT_IMAGE, | ||||||
| 	BT_SYSLINUX_V4,		// Start of indexes that only display in advanced mode
 | 	BT_SYSLINUX_V4,		// Start of indexes that only display in advanced mode
 | ||||||
|  | @ -239,7 +240,6 @@ enum boot_type { | ||||||
| 	BT_GRUB4DOS, | 	BT_GRUB4DOS, | ||||||
| 	BT_GRUB2, | 	BT_GRUB2, | ||||||
| 	BT_UEFI_NTFS, | 	BT_UEFI_NTFS, | ||||||
| 	BT_NON_BOOTABLE, |  | ||||||
| 	BT_MAX | 	BT_MAX | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 232, 326 | IDD_DIALOG DIALOGEX 12, 12, 232, 326 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_ACCEPTFILES | EXSTYLE WS_EX_ACCEPTFILES | ||||||
| CAPTION "Rufus 3.2.1341" | CAPTION "Rufus 3.2.1342" | ||||||
| FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP |     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP | ||||||
|  | @ -392,8 +392,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 3,2,1341,0 |  FILEVERSION 3,2,1342,0 | ||||||
|  PRODUCTVERSION 3,2,1341,0 |  PRODUCTVERSION 3,2,1342,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -411,13 +411,13 @@ BEGIN | ||||||
|             VALUE "Comments", "https://akeo.ie" |             VALUE "Comments", "https://akeo.ie" | ||||||
|             VALUE "CompanyName", "Akeo Consulting" |             VALUE "CompanyName", "Akeo Consulting" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "3.2.1341" |             VALUE "FileVersion", "3.2.1342" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" |             VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" | ||||||
|             VALUE "OriginalFilename", "rufus-3.2.exe" |             VALUE "OriginalFilename", "rufus-3.2.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "3.2.1341" |             VALUE "ProductVersion", "3.2.1342" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
							
								
								
									
										113
									
								
								src/ui.c
									
										
									
									
									
								
							
							
						
						
									
										113
									
								
								src/ui.c
									
										
									
									
									
								
							|  | @ -237,7 +237,7 @@ void GetFullWidth(HWND hDlg) | ||||||
| 	bsw = max(bsw, GetTextSize(hBootType, lmprintf(MSG_281, lmprintf(MSG_280))).cx + ddw); | 	bsw = max(bsw, GetTextSize(hBootType, lmprintf(MSG_281, lmprintf(MSG_280))).cx + ddw); | ||||||
| 
 | 
 | ||||||
| 	// Initialize full width to the UI's default size
 | 	// Initialize full width to the UI's default size
 | ||||||
| 	GetWindowRect(GetDlgItem(hDlg, IDC_IMAGE_OPTION), &rc); | 	GetWindowRect(GetDlgItem(hDlg, IDS_DEVICE_TXT), &rc); | ||||||
| 	MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); | 	MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); | ||||||
| 	fw = rc.right - rc.left - ddw; | 	fw = rc.right - rc.left - ddw; | ||||||
| 
 | 
 | ||||||
|  | @ -399,20 +399,22 @@ void PositionMainControls(HWND hDlg) | ||||||
| 	hCtrl = GetDlgItem(hDlg, IDC_PERSISTENCE_SLIDER); | 	hCtrl = GetDlgItem(hDlg, IDC_PERSISTENCE_SLIDER); | ||||||
| 	GetWindowRect(hCtrl, &rc); | 	GetWindowRect(hCtrl, &rc); | ||||||
| 	MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); | 	MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); | ||||||
| 	SetWindowPos(hCtrl, hTargetSystem, mw, rc.top, bsw, rc.bottom - rc.top, 0); | 	SetWindowPos(hCtrl, GetDlgItem(hDlg, IDC_IMAGE_OPTION), mw, rc.top, bsw, rc.bottom - rc.top, 0); | ||||||
| 
 | 
 | ||||||
| 	// Reposition the Persistence Units dropdown (no need to resize)
 | 	// Reposition the Persistence Units dropdown (no need to resize)
 | ||||||
| 	hCtrl = GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS); | 	hCtrl = GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS); | ||||||
| 	GetWindowRect(hCtrl, &rc); | 	GetWindowRect(hCtrl, &rc); | ||||||
| 	MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); | 	MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); | ||||||
| 	sz.cx = fw - (rc.right - rc.left); | 	sz.cx = fw - (rc.right - rc.left); | ||||||
| 	SetWindowPos(hCtrl, hTargetSystem, mw + sz.cx, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0); | 	SetWindowPos(hCtrl, GetDlgItem(hDlg, IDC_PERSISTENCE_SIZE), mw + sz.cx, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0); | ||||||
|  | 	ShowWindow(hCtrl, SW_HIDE); | ||||||
| 
 | 
 | ||||||
| 	// Reposition and resize the Persistence Size edit
 | 	// Reposition and resize the Persistence Size edit
 | ||||||
| 	hCtrl = GetDlgItem(hDlg, IDC_PERSISTENCE_SIZE); | 	hCtrl = GetDlgItem(hDlg, IDC_PERSISTENCE_SIZE); | ||||||
| 	GetWindowRect(hCtrl, &rc); | 	GetWindowRect(hCtrl, &rc); | ||||||
| 	MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); | 	MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); | ||||||
| 	SetWindowPos(hCtrl, hTargetSystem, mw + bsw + ssw, rc.top, sz.cx - bsw - 2*ssw, rc.bottom - rc.top, 0); | 	SetWindowPos(hCtrl, GetDlgItem(hDlg, IDC_PERSISTENCE_SLIDER), mw + bsw + ssw, rc.top, fw - bsw - ssw, rc.bottom - rc.top, 0); | ||||||
|  | 	EnableWindow(hCtrl, FALSE); | ||||||
| 
 | 
 | ||||||
| 	// Reposition the CSM help tip
 | 	// Reposition the CSM help tip
 | ||||||
| 	hCtrl = GetDlgItem(hDlg, IDS_CSM_HELP_TXT); | 	hCtrl = GetDlgItem(hDlg, IDS_CSM_HELP_TXT); | ||||||
|  | @ -635,9 +637,40 @@ void ToggleAdvancedFormatOptions(BOOL enable) | ||||||
| 	InvalidateRect(hMainDialog, NULL, TRUE); | 	InvalidateRect(hMainDialog, NULL, TRUE); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // Toggle the display of peristence unit dropdown and resize the size field
 | ||||||
|  | void TogglePersistenceControls(BOOL display) | ||||||
|  | { | ||||||
|  | 	RECT rc; | ||||||
|  | 	HWND hSize, hUnits; | ||||||
|  | 	LONG style, width = fw - bsw - ssw; | ||||||
|  | 	hSize = GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE); | ||||||
|  | 	hUnits = GetDlgItem(hMainDialog, IDC_PERSISTENCE_UNITS); | ||||||
|  | 
 | ||||||
|  | 	style = GetWindowLong(hSize, GWL_EXSTYLE); | ||||||
|  | 	if (display) | ||||||
|  | 		style |= WS_EX_RIGHT; | ||||||
|  | 	else | ||||||
|  | 		style &= ~WS_EX_RIGHT; | ||||||
|  | 	SetWindowLong(hSize, GWL_EXSTYLE, style); | ||||||
|  | 
 | ||||||
|  | 	if (display) { | ||||||
|  | 		GetWindowRect(hUnits, &rc); | ||||||
|  | 		MapWindowPoints(NULL, hMainDialog, (POINT*)&rc, 2); | ||||||
|  | 		width -= (rc.right - rc.left) + ssw; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	GetWindowRect(hSize, &rc); | ||||||
|  | 	MapWindowPoints(NULL, hMainDialog, (POINT*)&rc, 2); | ||||||
|  | 	SetWindowPos(hSize, GetDlgItem(hMainDialog, IDC_PERSISTENCE_SLIDER), mw + bsw + ssw, rc.top, width, rc.bottom - rc.top, 0); | ||||||
|  | 
 | ||||||
|  | 	EnableWindow(hSize, display ? TRUE : FALSE); | ||||||
|  | 	EnableWindow(hUnits, display ? TRUE : FALSE); | ||||||
|  | 	ShowWindow(hUnits, display ? SW_SHOW : SW_HIDE); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void SetPersistenceSize(uint64_t pos, uint64_t max) | void SetPersistenceSize(uint64_t pos, uint64_t max) | ||||||
| { | { | ||||||
| 	char tmp[12]; | 	char tmp[64]; | ||||||
| 	int i, proposed_unit_selection = 0; | 	int i, proposed_unit_selection = 0; | ||||||
| 	LONGLONG base_unit = MB; | 	LONGLONG base_unit = MB; | ||||||
| 	HWND hCtrl; | 	HWND hCtrl; | ||||||
|  | @ -670,61 +703,60 @@ void SetPersistenceSize(uint64_t pos, uint64_t max) | ||||||
| 	SendMessage(hCtrl, TBM_SETRANGEMIN, (WPARAM)FALSE, (LPARAM)0); | 	SendMessage(hCtrl, TBM_SETRANGEMIN, (WPARAM)FALSE, (LPARAM)0); | ||||||
| 	SendMessage(hCtrl, TBM_SETRANGEMAX, (WPARAM)FALSE, (LPARAM)max); | 	SendMessage(hCtrl, TBM_SETRANGEMAX, (WPARAM)FALSE, (LPARAM)max); | ||||||
| 	SendMessage(hCtrl, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)pos); | 	SendMessage(hCtrl, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)pos); | ||||||
| 	static_sprintf(tmp, "%ld", (LONG)pos); | 	if (pos != 0) { | ||||||
| 	SetWindowTextA(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), tmp); | 		static_sprintf(tmp, "%ld", (LONG)pos); | ||||||
|  | 	} else { | ||||||
|  | 		static_sprintf(tmp, "0 (%s)", lmprintf(MSG_124)); | ||||||
|  | 	} | ||||||
|  | 	app_changed_size = TRUE; | ||||||
|  | 	SetWindowTextU(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), tmp); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Toggle the Image Option dropdown (Windows To Go or persistence settings)
 | // Toggle the Image Option dropdown (Windows To Go or persistence settings)
 | ||||||
| void ToggleImageOption(uint8_t mask) | void ToggleImageOptions(void) | ||||||
| { | { | ||||||
| 	static BOOL relaunch = FALSE; | 	BOOL has_wintogo, has_persistence; | ||||||
| 	static char image_option_txt[128] = ""; | 	uint8_t entry_image_options = image_options; | ||||||
| 	int i, shift = (popcnt8(image_options) >= 2) ? 0 : rh; | 	int i, shift = rh; | ||||||
| 
 | 
 | ||||||
| 	assert(popcnt8(mask) <= 1); | 	has_wintogo = ((bt == BT_IMAGE) && (image_path != NULL) && (img_report.is_iso) && (nWindowsVersion >= WINDOWS_8) && (HAS_WINTOGO(img_report))); | ||||||
|  | 	has_persistence = ((bt == BT_IMAGE) && (image_path != NULL) && (img_report.is_iso) && (HAS_PERSISTENCE(img_report))); | ||||||
| 
 | 
 | ||||||
| 	// mask is set to 0 when called during (re)init
 | 	assert(popcnt8(image_options) <= 1); | ||||||
| 	if (mask == 0) { |  | ||||||
| 		if (relaunch) { |  | ||||||
| 			if ((selection_default == BT_IMAGE) && (image_path != NULL)) |  | ||||||
| 				goto skip; |  | ||||||
| 		} else { |  | ||||||
| 			relaunch = TRUE; |  | ||||||
| 			// Keep a copy of the original image option translation, as it'll be easier to toggle
 |  | ||||||
| 			GetWindowTextU(GetDlgItem(hMainDialog, IDS_IMAGE_OPTION_TXT), image_option_txt, sizeof(image_option_txt)); |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	if (mask & IMOP_WINTOGO) { | 	// Keep a copy of the "Image Option" text (so that we don't have to duplicate its transation in the .loc)
 | ||||||
| 		if (nWindowsVersion < WINDOWS_8) | 	if (image_option_txt[0] == 0) | ||||||
| 			return; | 		GetWindowTextU(GetDlgItem(hMainDialog, IDS_IMAGE_OPTION_TXT), image_option_txt, sizeof(image_option_txt)); | ||||||
|  | 
 | ||||||
|  | 	if ( ((has_wintogo) && !(image_options & IMOP_WINTOGO)) || | ||||||
|  | 		 ((!has_wintogo) && (image_options & IMOP_WINTOGO)) ) { | ||||||
| 		image_options ^= IMOP_WINTOGO; | 		image_options ^= IMOP_WINTOGO; | ||||||
| 		// Set the Windows To Go selection in the dropdown
 | 		// Set the Windows To Go selection in the dropdown
 | ||||||
| 		IGNORE_RETVAL(ComboBox_SetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION), windows_to_go_selection)); | 		IGNORE_RETVAL(ComboBox_SetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION), windows_to_go_selection)); | ||||||
| 	} else if (mask & IMOP_PERSISTENCE) { | 	} | ||||||
|  | 
 | ||||||
|  | 	if (((has_persistence) && !(image_options & IMOP_PERSISTENCE)) || | ||||||
|  | 		((!has_persistence) && (image_options & IMOP_PERSISTENCE))) { | ||||||
| 		image_options ^= IMOP_PERSISTENCE; | 		image_options ^= IMOP_PERSISTENCE; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (popcnt8(image_options) >= 2) | 	if ( ((entry_image_options != 0) && (has_wintogo || has_persistence)) || | ||||||
|  | 		 ((entry_image_options == 0) && !(has_wintogo || has_persistence)) ) | ||||||
| 		shift = 0; | 		shift = 0; | ||||||
| 
 | 
 | ||||||
| 	if (shift != 0) { | 	if (shift != 0) { | ||||||
| 		if ((mask == 0) || (image_options == 0)) | 		if (entry_image_options != 0) | ||||||
| 			shift = -shift; | 			shift = -shift; | ||||||
| 		section_vpos[1] += shift; | 		section_vpos[1] += shift; | ||||||
| 		section_vpos[2] += shift; | 		section_vpos[2] += shift; | ||||||
| 
 | 
 | ||||||
| 		if (popcnt8(image_options) <= 1) { | 		for (i = 0; i < ARRAYSIZE(image_option_move_ids); i++) | ||||||
| 			// Move the controls up or down
 | 			MoveCtrlY(hMainDialog, image_option_move_ids[i], shift); | ||||||
| 			for (i = 0; i < ARRAYSIZE(image_option_move_ids); i++) |  | ||||||
| 				MoveCtrlY(hMainDialog, image_option_move_ids[i], shift); |  | ||||||
| 
 | 
 | ||||||
| 			// Resize the main dialog and log window
 | 		// Resize the main dialog and log window
 | ||||||
| 			ResizeDialogs(shift); | 		ResizeDialogs(shift); | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| skip: |  | ||||||
| 	// Hide or show the boot options
 | 	// Hide or show the boot options
 | ||||||
| 	for (i = 0; i < ARRAYSIZE(image_option_toggle_ids); i++) { | 	for (i = 0; i < ARRAYSIZE(image_option_toggle_ids); i++) { | ||||||
| 		ShowWindow(GetDlgItem(hMainDialog, image_option_toggle_ids[i][0]), | 		ShowWindow(GetDlgItem(hMainDialog, image_option_toggle_ids[i][0]), | ||||||
|  | @ -735,10 +767,9 @@ skip: | ||||||
| 		SetWindowTextU(GetDlgItem(hMainDialog, IDS_IMAGE_OPTION_TXT), image_option_txt); | 		SetWindowTextU(GetDlgItem(hMainDialog, IDS_IMAGE_OPTION_TXT), image_option_txt); | ||||||
| 		IGNORE_RETVAL(ComboBox_SetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION), windows_to_go_selection)); | 		IGNORE_RETVAL(ComboBox_SetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION), windows_to_go_selection)); | ||||||
| 	} else if (image_options & IMOP_PERSISTENCE) { | 	} else if (image_options & IMOP_PERSISTENCE) { | ||||||
| 		SetWindowTextU(GetDlgItem(hMainDialog, IDS_IMAGE_OPTION_TXT), lmprintf(MSG_199)); | 		SetWindowTextU(GetDlgItem(hMainDialog, IDS_IMAGE_OPTION_TXT), lmprintf(MSG_123)); | ||||||
| 		// TODO: Use projected size and reuse existing pos. For now force the selected ISO to a 4 GB size
 | 		TogglePersistenceControls(persistence_size != 0); | ||||||
| 		uint64_t max_size = SelectedDrive.DiskSize - 4 * GB; | 		SetPersistenceSize(persistence_size, SelectedDrive.DiskSize - img_report.projected_size); | ||||||
| 		SetPersistenceSize(max_size / 2, max_size); |  | ||||||
| 	} | 	} | ||||||
| 	// If you don't force a redraw here, all kind of bad UI artifacts happen...
 | 	// If you don't force a redraw here, all kind of bad UI artifacts happen...
 | ||||||
| 	InvalidateRect(hMainDialog, NULL, TRUE); | 	InvalidateRect(hMainDialog, NULL, TRUE); | ||||||
|  |  | ||||||
							
								
								
									
										8
									
								
								src/ui.h
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								src/ui.h
									
										
									
									
									
								
							|  | @ -46,10 +46,11 @@ | ||||||
| extern HWND hMultiToolbar, hSaveToolbar, hHashToolbar, hAdvancedDeviceToolbar, hAdvancedFormatToolbar; | extern HWND hMultiToolbar, hSaveToolbar, hHashToolbar, hAdvancedDeviceToolbar, hAdvancedFormatToolbar; | ||||||
| extern HFONT hInfoFont; | extern HFONT hInfoFont; | ||||||
| extern UINT_PTR UM_LANGUAGE_MENU_MAX; | extern UINT_PTR UM_LANGUAGE_MENU_MAX; | ||||||
| extern BOOL advanced_mode_device, advanced_mode_format, force_large_fat32; | extern BOOL advanced_mode_device, advanced_mode_format, force_large_fat32, app_changed_size; | ||||||
| extern loc_cmd* selected_locale; | extern loc_cmd* selected_locale; | ||||||
|  | extern uint64_t persistence_size; | ||||||
| extern const char *sfd_name, *flash_type[BADLOCKS_PATTERN_TYPES]; | extern const char *sfd_name, *flash_type[BADLOCKS_PATTERN_TYPES]; | ||||||
| extern char *short_image_path; | extern char *short_image_path, image_option_txt[128]; | ||||||
| extern int advanced_device_section_height, advanced_format_section_height; | extern int advanced_device_section_height, advanced_format_section_height; | ||||||
| extern int windows_to_go_selection, persistence_unit_selection; | extern int windows_to_go_selection, persistence_unit_selection; | ||||||
| extern int selection_default, cbw, ddw, ddbh, bh; | extern int selection_default, cbw, ddw, ddbh, bh; | ||||||
|  | @ -63,9 +64,10 @@ extern void PositionMainControls(HWND hDlg); | ||||||
| extern void AdjustForLowDPI(HWND hDlg); | extern void AdjustForLowDPI(HWND hDlg); | ||||||
| extern void SetSectionHeaders(HWND hDlg); | extern void SetSectionHeaders(HWND hDlg); | ||||||
| extern void SetPersistenceSize(uint64_t pos, uint64_t max); | extern void SetPersistenceSize(uint64_t pos, uint64_t max); | ||||||
|  | extern void TogglePersistenceControls(BOOL display); | ||||||
| extern void ToggleAdvancedDeviceOptions(BOOL enable); | extern void ToggleAdvancedDeviceOptions(BOOL enable); | ||||||
| extern void ToggleAdvancedFormatOptions(BOOL enable); | extern void ToggleAdvancedFormatOptions(BOOL enable); | ||||||
| extern void ToggleImageOption(uint8_t mask); | extern void ToggleImageOptions(void); | ||||||
| extern void CreateSmallButtons(HWND hDlg); | extern void CreateSmallButtons(HWND hDlg); | ||||||
| extern void CreateAdditionalControls(HWND hDlg); | extern void CreateAdditionalControls(HWND hDlg); | ||||||
| extern void InitProgress(BOOL bOnlyFormat); | extern void InitProgress(BOOL bOnlyFormat); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue