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

[ui] use 'Segoe UI Symbol' when available

* This is required to display Thai in RTF fields (#217)
* Also fix the position of the Advanced groupbox
This commit is contained in:
Pete Batard 2015-12-30 15:27:52 +01:00
parent 4757a4ac48
commit 0f56c2d1ef
4 changed files with 51 additions and 17 deletions

View file

@ -456,6 +456,7 @@ extern BOOL AppendVHDFooter(const char* vhd_path);
extern int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid); extern int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid);
extern void LostTranslatorCheck(void); extern void LostTranslatorCheck(void);
extern LONG ValidateSignature(HWND hDlg, const char* path); extern LONG ValidateSignature(HWND hDlg, const char* path);
extern BOOL IsFontAvailable(const char* font_name);
DWORD WINAPI FormatThread(void* param); DWORD WINAPI FormatThread(void* param);
DWORD WINAPI SaveImageThread(void* param); DWORD WINAPI SaveImageThread(void* param);

View file

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376 IDD_DIALOG DIALOGEX 12, 12, 242, 376
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
CAPTION "Rufus 2.7.820" CAPTION "Rufus 2.7.821"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0 FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -58,12 +58,12 @@ BEGIN
CONTROL "Windows To Go",IDC_WINDOWS_TO_GO,"Button",BS_AUTORADIOBUTTON,23,210,205,8 CONTROL "Windows To Go",IDC_WINDOWS_TO_GO,"Button",BS_AUTORADIOBUTTON,23,210,205,8
CONTROL "Create extended label and icon files",IDC_SET_ICON, CONTROL "Create extended label and icon files",IDC_SET_ICON,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,221,216,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,221,216,10
GROUPBOX "Advanced Options",IDS_ADVANCED_OPTIONS_GRP,7,234,227,55 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,247,216,10 CONTROL "List USB Hard Drives",IDC_ENABLE_FIXED_DISKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,246,216,10
CONTROL "Add fixes for old BIOSes (extra partition, align, etc.)",IDC_EXTRA_PARTITION, CONTROL "Add fixes for old BIOSes (extra partition, align, etc.)",IDC_EXTRA_PARTITION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,259,216,10 "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,272,112,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,270,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP 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 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 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 "About...",IDC_ABOUT,8,339,50,14
@ -319,8 +319,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,7,820,0 FILEVERSION 2,7,821,0
PRODUCTVERSION 2,7,820,0 PRODUCTVERSION 2,7,821,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -337,13 +337,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.7.820" VALUE "FileVersion", "2.7.821"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.7.820" VALUE "ProductVersion", "2.7.821"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
@ -361,8 +361,11 @@ END
// Icon with lowest ID value placed first to ensure application icon // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems. // remains consistent on all systems.
IDI_ICON ICON "../res/rufus.ico" IDI_ICON ICON "../res/rufus.ico"
IDI_UP ICON "../res/up.ico" IDI_UP ICON "../res/up.ico"
IDI_DOWN ICON "../res/down.ico" IDI_DOWN ICON "../res/down.ico"
#endif // Neutral resources #endif // Neutral resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View file

@ -39,7 +39,7 @@ char WindowsVersionStr[128] = "Windows ";
* [Knuth] The Art of Computer Programming, part 3 (6.4) * [Knuth] The Art of Computer Programming, part 3 (6.4)
*/ */
/* /*
* For the used double hash method the table size has to be a prime. To * For the used double hash method the table size has to be a prime. To
* correct the user given table size we need a prime test. This trivial * correct the user given table size we need a prime test. This trivial
* algorithm is adequate because the code is called only during init and * algorithm is adequate because the code is called only during init and
@ -563,7 +563,7 @@ DWORD RunCommand(const char* cmd, const char* dir, BOOL log)
goto out; goto out;
} }
// We need an inheritable pipe endpoint handle // We need an inheritable pipe endpoint handle
DuplicateHandle(GetCurrentProcess(), hOutputWrite, GetCurrentProcess(), &hDupOutputWrite, DuplicateHandle(GetCurrentProcess(), hOutputWrite, GetCurrentProcess(), &hDupOutputWrite,
0L, TRUE, DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS); 0L, TRUE, DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS);
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
si.wShowWindow = SW_HIDE; si.wShowWindow = SW_HIDE;
@ -618,6 +618,25 @@ BOOL CompareGUID(const GUID *guid1, const GUID *guid2) {
return FALSE; return FALSE;
} }
static BOOL CALLBACK EnumFontFamExProc(const LOGFONTA *lpelfe,
const TEXTMETRICA *lpntme, DWORD FontType, LPARAM lParam)
{
return TRUE;
}
BOOL IsFontAvailable(const char* font_name) {
LOGFONTA lf = { 0 };
HDC hDC = GetDC(hMainDialog);
if (font_name == NULL)
return FALSE;
lf.lfCharSet = DEFAULT_CHARSET;
safe_strcpy(lf.lfFaceName, LF_FACESIZE, font_name);
return EnumFontFamiliesExA(hDC, &lf, EnumFontFamExProc, 0, 0);
}
/* /*
* Set or restore a Local Group Policy DWORD key indexed by szPath/SzPolicy * Set or restore a Local Group Policy DWORD key indexed by szPath/SzPolicy
*/ */
@ -677,9 +696,9 @@ DWORD WINAPI SetLGPThread(LPVOID param)
static DWORD original_val; static DWORD original_val;
HKEY path_key = NULL, policy_key = NULL; HKEY path_key = NULL, policy_key = NULL;
// MSVC is finicky about these ones => redefine them // MSVC is finicky about these ones => redefine them
const IID my_IID_IGroupPolicyObject = const IID my_IID_IGroupPolicyObject =
{ 0xea502723L, 0xa23d, 0x11d1, { 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3 } }; { 0xea502723L, 0xa23d, 0x11d1, { 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3 } };
const IID my_CLSID_GroupPolicyObject = const IID my_CLSID_GroupPolicyObject =
{ 0xea502722L, 0xa23d, 0x11d1, { 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3 } }; { 0xea502722L, 0xa23d, 0x11d1, { 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3 } };
GUID ext_guid = REGISTRY_EXTENSION_GUID; GUID ext_guid = REGISTRY_EXTENSION_GUID;
// Can be anything really // Can be anything really

View file

@ -1662,6 +1662,16 @@ LPCDLGTEMPLATE GetDialogTemplate(int Dialog_ID)
dwBuf = (DWORD*)rcTemplate; dwBuf = (DWORD*)rcTemplate;
dwBuf[2] = WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL; dwBuf[2] = WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL;
} }
// All our dialogs are set to use 'Segoe UI Symbol':
// 1. So that we can replace the font name with 'MS Shell Dlg' if needed (XP)
// 2. So that Thai displays properly on RTF controls (don't work with regular 'Segoe UI')
// If 'Segoe UI Symbol' is available, we're done here
if (IsFontAvailable("Segoe UI Symbol"))
return rcTemplate;
// 'Segoe UI Symbol' is not available => Fall back to the best we have
wBuf = (WCHAR*)rcTemplate; wBuf = (WCHAR*)rcTemplate;
wBuf = &wBuf[14]; // Move to class name wBuf = &wBuf[14]; // Move to class name
// Skip class name and title // Skip class name and title
@ -1680,10 +1690,11 @@ LPCDLGTEMPLATE GetDialogTemplate(int Dialog_ID)
// We can't simply zero the characters we don't want, as the size of the font // We can't simply zero the characters we don't want, as the size of the font
// string determines the next item lookup. So we must memmove the remaining of // string determines the next item lookup. So we must memmove the remaining of
// our buffer. Oh, and those items are DWORD aligned. // our buffer. Oh, and those items are DWORD aligned.
if (nWindowsVersion <= WINDOWS_XP) { if (IsFontAvailable("Segoe UI")) {
wcscpy(wBuf, L"MS Shell Dlg"); // 'Segoe UI Symbol' -> 'Segoe UI'
} else {
wBuf[8] = 0; wBuf[8] = 0;
} else {
wcscpy(wBuf, L"MS Shell Dlg");
} }
len = wcslen(wBuf); len = wcslen(wBuf);
wBuf[len + 1] = 0; wBuf[len + 1] = 0;