mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[ui] fix whole screen refresh and progress bar issues
* Whole screen was being refreshed when calling InvalidateRect() in ResizeMoveCtrl() * Progress bar bounding rectangle could be erased at 0.0% * No progress was displayed when writing ISOHybrid images in DD mode * Also fix an issue when write error would not display the error string
This commit is contained in:
		
							parent
							
								
									39cb35e20c
								
							
						
					
					
						commit
						cdacc6f342
					
				
					 4 changed files with 16 additions and 14 deletions
				
			
		|  | @ -1601,7 +1601,7 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage) | |||
| 				if (s) | ||||
| 					uprintf("write error: Wrote %d bytes, expected %d bytes", wSize, rSize); | ||||
| 				else | ||||
| 					uprintf("write error at sector %d: %s", wb / SelectedDrive.SectorSize, WindowsErrorString()); | ||||
| 					uprintf("write error at sector %" PRIi64 ": %s", wb / SelectedDrive.SectorSize, WindowsErrorString()); | ||||
| 				if (i < WRITE_RETRIES - 1) { | ||||
| 					li.QuadPart = wb; | ||||
| 					uprintf("  RETRYING...\n"); | ||||
|  | @ -1728,7 +1728,7 @@ DWORD WINAPI FormatThread(void* param) | |||
| 	} | ||||
| 	CHECK_FOR_USER_CANCEL; | ||||
| 
 | ||||
| 	if (!zero_drive) { | ||||
| 	if (!zero_drive && !write_as_image) { | ||||
| 		PrintInfoDebug(0, MSG_226); | ||||
| 		AnalyzeMBR(hPhysicalDrive, "Drive"); | ||||
| 		if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { | ||||
|  | @ -1746,7 +1746,7 @@ DWORD WINAPI FormatThread(void* param) | |||
| 	// Note, Microsoft's way of cleaning partitions (IOCTL_DISK_CREATE_DISK, which is what we apply
 | ||||
| 	// in InitializeDisk) is *NOT ENOUGH* to reset a disk and can render it inoperable for partitioning
 | ||||
| 	// or formatting under Windows. See https://github.com/pbatard/rufus/issues/759 for details.
 | ||||
| 	if ((bt != BT_IMAGE) || (img_report.is_iso)) { | ||||
| 	if ((bt != BT_IMAGE) || (img_report.is_iso && !write_as_image)) { | ||||
| 		if ((!ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, SelectedDrive.SectorSize, use_large_fat32)) || | ||||
| 			(!InitializeDisk(hPhysicalDrive))) { | ||||
| 			uprintf("Could not reset partitions\n"); | ||||
|  |  | |||
							
								
								
									
										12
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -1775,7 +1775,7 @@ static __inline const char* IsAlphaOrBeta(void) | |||
| static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam, LPARAM lParam) | ||||
| { | ||||
| 	HDC hDC; | ||||
| 	RECT rc; | ||||
| 	RECT rc, rc2; | ||||
| 	PAINTSTRUCT ps; | ||||
| 	SIZE size; | ||||
| 	LONG full_right; | ||||
|  | @ -1840,11 +1840,10 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam | |||
| 	case WM_PAINT: | ||||
| 		hDC = BeginPaint(hCtrl, &ps); | ||||
| 		GetClientRect(hCtrl, &rc); | ||||
| 		rc2 = rc; | ||||
| 		InflateRect(&rc, -1, -1); | ||||
| 		SelectObject(hDC, GetStockObject(DC_PEN)); | ||||
| 		SelectObject(hDC, GetStockObject(NULL_BRUSH)); | ||||
| 		SetDCPenColor(hDC, PROGRESS_BAR_BOX_COLOR); | ||||
| 		Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); | ||||
| 		InflateRect(&rc, -1, -1); | ||||
| 		// TODO: Handle SetText message so we can avoid this call
 | ||||
| 		GetWindowTextW(hProgress, winfo, ARRAYSIZE(winfo)); | ||||
| 		SelectObject(hDC, hInfoFont); | ||||
|  | @ -1901,6 +1900,9 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam | |||
| 		ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, | ||||
| 			ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL | (right_to_left_mode ? ETO_RTLREADING : 0), | ||||
| 			&rc, winfo, (int)wcslen(winfo), NULL); | ||||
| 		// Bounding rectangle
 | ||||
| 		SetDCPenColor(hDC, PROGRESS_BAR_BOX_COLOR); | ||||
| 		Rectangle(hDC, rc2.left, rc2.top, rc2.right, rc2.bottom); | ||||
| 		EndPaint(hCtrl, &ps); | ||||
| 		return (INT_PTR)TRUE; | ||||
| 	} | ||||
|  | @ -3285,7 +3287,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | |||
| 					goto aborted_start; | ||||
| 
 | ||||
| 				DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, nDeviceIndex); | ||||
| 				InitProgress(zero_drive); | ||||
| 				InitProgress(zero_drive || write_as_image); | ||||
| 				format_thid = CreateThread(NULL, 0, FormatThread, (LPVOID)(uintptr_t)DeviceNum, 0, NULL); | ||||
| 				if (format_thid == NULL) { | ||||
| 					uprintf("Unable to start formatting thread"); | ||||
|  |  | |||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | |||
| IDD_DIALOG DIALOGEX 12, 12, 232, 326 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| EXSTYLE WS_EX_ACCEPTFILES | ||||
| CAPTION "Rufus 3.0.1268" | ||||
| CAPTION "Rufus 3.0.1269" | ||||
| FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | ||||
| BEGIN | ||||
|     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP | ||||
|  | @ -389,8 +389,8 @@ END | |||
| // | ||||
| 
 | ||||
| VS_VERSION_INFO VERSIONINFO | ||||
|  FILEVERSION 3,0,1268,0 | ||||
|  PRODUCTVERSION 3,0,1268,0 | ||||
|  FILEVERSION 3,0,1269,0 | ||||
|  PRODUCTVERSION 3,0,1269,0 | ||||
|  FILEFLAGSMASK 0x3fL | ||||
| #ifdef _DEBUG | ||||
|  FILEFLAGS 0x1L | ||||
|  | @ -407,13 +407,13 @@ BEGIN | |||
|         BEGIN | ||||
|             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" | ||||
|             VALUE "FileDescription", "Rufus" | ||||
|             VALUE "FileVersion", "3.0.1268" | ||||
|             VALUE "FileVersion", "3.0.1269" | ||||
|             VALUE "InternalName", "Rufus" | ||||
|             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", "3.0.1268" | ||||
|             VALUE "ProductVersion", "3.0.1269" | ||||
|         END | ||||
|     END | ||||
|     BLOCK "VarFileInfo" | ||||
|  |  | |||
|  | @ -485,7 +485,7 @@ void ResizeMoveCtrl(HWND hDlg, HWND hCtrl, int dx, int dy, int dw, int dh, float | |||
| 	MoveWindow(hCtrl, point.x + (int)(scale*(float)dx), point.y + (int)(scale*(float)dy), | ||||
| 		(rect.right - rect.left) + (int)(scale*(float)dw + border.cx), | ||||
| 		(rect.bottom - rect.top) + (int)(scale*(float)dh + border.cy), TRUE); | ||||
| 	InvalidateRect(hCtrl, NULL, TRUE); | ||||
| 	// Don't be tempted to call InvalidateRect() here - it causes intempestive whole screen refreshes
 | ||||
| } | ||||
| 
 | ||||
| void ResizeButtonHeight(HWND hDlg, int id) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue