1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[ui] improve application look on high DPI displays

* Fix Quick Format option overlapping boot option dropdown
* Fix vertical spacing between "Create bootable disk" and "Create extended label and icon files"
* Fix vertical spacing of progress bar in non advanced mode
* Align and resize Advanced Options button
* Align and resize Select Image button
* Fix vertical centering of Status text
* Add 64x64px icon so that the About dialog looks better at 200% size
This commit is contained in:
Pete Batard 2015-05-15 00:36:42 +01:00
parent 28e3cf2537
commit c84075385e
5 changed files with 59 additions and 41 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View file

@ -331,7 +331,7 @@ DWORD DownloadFile(const char* url, const char* file, HWND hProgressDialog)
HttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, (LPVOID)&DownloadStatus, &dwSize, NULL);
if (DownloadStatus != 200) {
error_code = ERROR_INTERNET_ITEM_NOT_FOUND;
uprintf("Unable to access file: Server status %d\n", DownloadStatus);
uprintf("Unable to access file: %d\n", DownloadStatus);
goto out;
}
dwSize = sizeof(dwTotalSize);

View file

@ -1053,7 +1053,10 @@ static void SetPassesTooltip(void)
// Toggle "advanced" mode
static void ToggleAdvanced(void)
{
float dialog_shift = 82.0f;
// 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;
int toggle;
@ -1127,7 +1130,8 @@ static void ToggleImage(BOOL enable)
// Toggle the Windows To Go radio choice
static void ToggleToGo(void)
{
float dialog_shift = 38.0f;
// {1.0, 38}, {1.25, 40}, {1.5, 40}, {2.0, 44}, {2.5, 44}
float dialog_shift = (fScale >= 1.9f)?44.0f:((fScale >= 1.2f)?40.0f:38.0f);
RECT rect;
POINT point;
int toggle;
@ -1554,7 +1558,7 @@ void InitDialog(HWND hDlg)
HINSTANCE hShell32DllInst, hUserLanguagesCplDllInst, hINetCplDllInst;
HIMAGELIST hLangToolbarImageList;
TBBUTTON tbLangToolbarButtons[1];
RECT rcDeviceList, rcToolbarButton;
RECT rcDeviceList, rcToolbarButton, rcFormatGroup, rcAdvancedOptions, rcBootType, rcSelectImage;
DWORD len;
SIZE sz;
HWND hCtrl;
@ -1727,19 +1731,33 @@ void InitDialog(HWND hDlg)
(int)(4.0f * fScale), rcToolbarButton.right, rcToolbarButton.bottom, 0);
ShowWindow(hLangToolbar, SW_SHOWNORMAL);
// Reposition the Advanced button
// Add trailing space to the "Format Options" text
hCtrl = GetDlgItem(hDlg, IDS_FORMAT_OPTIONS_GRP);
sz = GetTextSize(hCtrl);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_ADVANCED), (int)((1.0f * sz.cx) / fScale), 0, 0, 0);
// Add a space to the "Format Options" text
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, 0);
// The things one needs to do to keep things looking good...
if (nWindowsVersion == WINDOWS_7) {
ResizeMoveCtrl(hDlg, GetDlgItem(hMainDialog, IDS_ADVANCED_OPTIONS_GRP), 0, -1, 0, 2);
ResizeMoveCtrl(hDlg, hProgress, 0, 1, 0, 0);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_ADVANCED), -1, 0, 0, 0);
}
// Subclass the Info box so that we can align its text vertically
@ -1987,11 +2005,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
#endif
return (INT_PTR)FALSE;
// The things one must do to get an ellipsis on the status bar...
// The things one must do to get an ellipsis text alignment on the status bar...
case WM_DRAWITEM:
if (wParam == IDC_STATUS) {
pDI = (DRAWITEMSTRUCT*)lParam;
pDI->rcItem.top += (int)(2.0f * fScale);
pDI->rcItem.top -= (int)((4.0f * fScale) - 6.0f);
pDI->rcItem.left += (int)(4.0f * fScale);
SetBkMode(pDI->hDC, TRANSPARENT);
switch(pDI->itemID) {

View file

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.2.659"
CAPTION "Rufus 2.2.660"
FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -44,15 +44,15 @@ BEGIN
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,13,ES_AUTOHSCROLL
EDITTEXT IDC_LABEL,8,131,226,12,ES_AUTOHSCROLL
GROUPBOX "Format Options",IDS_FORMAT_OPTIONS_GRP,7,149,227,89
PUSHBUTTON "",IDC_ADVANCED,15,148,14,10,BS_ICON
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,183,75,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_SELECT_ISO,207,182,21,14,BS_ICON
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
@ -157,7 +157,7 @@ END
IDD_DIALOG_XP DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.2.659"
CAPTION "Rufus 2.2.660"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -169,15 +169,15 @@ BEGIN
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,13,ES_AUTOHSCROLL
EDITTEXT IDC_LABEL,8,131,226,12,ES_AUTOHSCROLL
GROUPBOX "Format Options",IDS_FORMAT_OPTIONS_GRP,7,149,227,89
PUSHBUTTON "",IDC_ADVANCED,15,148,14,10,BS_ICON
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,183,75,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "",IDC_SELECT_ISO,207,182,21,14,BS_ICON
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
@ -283,7 +283,7 @@ END
IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 2.2.659"
CAPTION "Rufus 2.2.660"
FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -295,15 +295,15 @@ BEGIN
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,13,ES_AUTOHSCROLL
EDITTEXT IDC_LABEL,8,131,226,12,ES_AUTOHSCROLL
GROUPBOX "Format Options",IDS_FORMAT_OPTIONS_GRP,7,149,227,89
PUSHBUTTON "",IDC_ADVANCED,15,148,14,10,BS_ICON
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,183,75,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "",IDC_SELECT_ISO,207,182,21,14,BS_ICON
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
@ -415,7 +415,7 @@ END
IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 2.2.659"
CAPTION "Rufus 2.2.660"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -427,15 +427,15 @@ BEGIN
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,13,ES_AUTOHSCROLL
EDITTEXT IDC_LABEL,8,131,226,12,ES_AUTOHSCROLL
GROUPBOX "Format Options",IDS_FORMAT_OPTIONS_GRP,7,149,227,89
PUSHBUTTON "",IDC_ADVANCED,15,148,14,10,BS_ICON
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,183,75,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "",IDC_SELECT_ISO,207,182,21,14,BS_ICON
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
@ -671,8 +671,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,2,659,0
PRODUCTVERSION 2,2,659,0
FILEVERSION 2,2,660,0
PRODUCTVERSION 2,2,660,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -689,13 +689,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.2.659"
VALUE "FileVersion", "2.2.660"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.2.659"
VALUE "ProductVersion", "2.2.660"
END
END
BLOCK "VarFileInfo"

View file

@ -61,7 +61,7 @@ static const SETTEXTEX friggin_microsoft_unicode_amateurs = {ST_DEFAULT, CP_UTF8
static BOOL notification_is_question;
static const notification_info* notification_more_info;
static BOOL settings_commcheck = FALSE;
static WNDPROC original_wndproc = NULL;
static WNDPROC update_original_proc = NULL;
/*
* We need a sub-callback to read the content of the edit box on exit and update
@ -1165,7 +1165,7 @@ static void CreateStaticFont(HDC dc, HFONT* hyperlink_font) {
* Work around the limitations of edit control, to display a hand cursor for hyperlinks
* NB: The LTEXT control must have SS_NOTIFY attribute for this to work
*/
INT_PTR CALLBACK subclass_callback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK update_subclass_callback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
@ -1176,7 +1176,7 @@ INT_PTR CALLBACK subclass_callback(HWND hDlg, UINT message, WPARAM wParam, LPARA
}
break;
}
return CallWindowProc(original_wndproc, hDlg, message, wParam, lParam);
return CallWindowProc(update_original_proc, hDlg, message, wParam, lParam);
}
/*
@ -1201,7 +1201,7 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR
SetTitleBarIcon(hDlg);
CenterDialog(hDlg);
// Subclass the callback so that we can change the cursor
original_wndproc = (WNDPROC)SetWindowLongPtr(hDlg, GWLP_WNDPROC, (LONG_PTR)subclass_callback);
update_original_proc = (WNDPROC)SetWindowLongPtr(hDlg, GWLP_WNDPROC, (LONG_PTR)update_subclass_callback);
hNotes = GetDlgItem(hDlg, IDC_RELEASE_NOTES);
SendMessage(hNotes, EM_AUTOURLDETECT, 1, 0);
SendMessageA(hNotes, EM_SETTEXTEX, (WPARAM)&friggin_microsoft_unicode_amateurs, (LPARAM)update.release_notes);
@ -1351,7 +1351,7 @@ SIZE GetTextSize(HWND hCtrl)
int len;
HFONT hFont;
// Compute the size of the text of the format group
// Compute the size of the text
hDC = GetDC(hCtrl);
if (hDC == NULL)
goto out;