mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[ui] use a toolbar button for the checksum
* Also fix tabbing order for controls * Also provide the name of the image in the checksum report
This commit is contained in:
parent
957bb9c495
commit
c7c83a16ed
8 changed files with 118 additions and 85 deletions
|
@ -517,8 +517,8 @@ t MSG_267 "Applying Windows image: %0.1f%% completed"
|
|||
t MSG_268 "Applying Windows image..."
|
||||
t MSG_269 "Preserve timestamps"
|
||||
t MSG_270 "USB debug"
|
||||
t MSG_271 "Computing image checksum: %0.1f%% completed"
|
||||
t MSG_272 "Click here to compute the SHA-1 and MD5 checksums for the selected image"
|
||||
t MSG_271 "Computing image checksums: %0.1f%% completed"
|
||||
t MSG_272 "Compute the SHA1 and MD5 checksums for the selected image"
|
||||
t MSG_273 "Change the application language"
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -523,18 +523,27 @@ static void md5_final(MD5_CONTEXT *ctx)
|
|||
*/
|
||||
INT_PTR CALLBACK ChecksumCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int i;
|
||||
HFONT hFont;
|
||||
HDC hDC;
|
||||
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
apply_localization(IDD_CHECKSUM, hDlg);
|
||||
// Create the font and brush for the Info edit box
|
||||
hFont = CreateFontA(-MulDiv(9, GetDeviceCaps(GetDC(hDlg), LOGPIXELSY), 72),
|
||||
hDC = GetDC(hDlg);
|
||||
hFont = CreateFontA(-MulDiv(9, GetDeviceCaps(hDC, LOGPIXELSY), 72),
|
||||
0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
|
||||
0, 0, PROOF_QUALITY, 0, "Courier New");
|
||||
if (hDC != NULL)
|
||||
ReleaseDC(hDlg, hDC);
|
||||
SendDlgItemMessageA(hDlg, IDC_MD5, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
SendDlgItemMessageA(hDlg, IDC_SHA1, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
SetWindowTextA(GetDlgItem(hDlg, IDC_MD5), md5str);
|
||||
SetWindowTextA(GetDlgItem(hDlg, IDC_SHA1), sha1str);
|
||||
for (i=(int)safe_strlen(image_path); (i>0)&&(image_path[i]!='\\'); i--);
|
||||
SetWindowTextU(hDlg, &image_path[i+1]);
|
||||
// Set focus on the OK button
|
||||
SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hDlg, IDOK), TRUE);
|
||||
CenterDialog(hDlg);
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
|
@ -543,6 +552,8 @@ INT_PTR CALLBACK ChecksumCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
|
|||
case IDCANCEL:
|
||||
reset_localization(IDD_CHECKSUM);
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
// Reset focus to our toolbar
|
||||
PostMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)hStatusToolbar, TRUE);
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ const loc_control_id control_id[] = {
|
|||
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_ABOUT_LICENSE),
|
||||
LOC_CTRL(IDC_ABOUT_ICON),
|
||||
|
|
|
@ -95,7 +95,8 @@
|
|||
#define IDC_DISK_ID 1022
|
||||
#define IDC_EXTRA_PARTITION 1023
|
||||
#define IDC_ENABLE_FIXED_DISKS 1024
|
||||
#define IDC_HASH 1025
|
||||
#define IDC_STATUS_TOOLBAR 1025
|
||||
#define IDC_HASH 1026
|
||||
#define IDC_ABOUT_LICENSE 1030
|
||||
#define IDC_ABOUT_ICON 1031
|
||||
#define IDC_ABOUT_UPDATES 1032
|
||||
|
|
47
src/rufus.c
47
src/rufus.c
|
@ -103,7 +103,6 @@ static BOOL log_displayed = FALSE;
|
|||
static BOOL iso_provided = FALSE;
|
||||
static BOOL user_notified = FALSE;
|
||||
static BOOL relaunch = FALSE;
|
||||
static BOOL hash_enabled = FALSE;
|
||||
extern BOOL force_large_fat32, enable_iso, enable_joliet, enable_rockridge, enable_ntfs_compression, preserve_timestamps, usb_debug;
|
||||
extern uint8_t* grub2_buf;
|
||||
extern long grub2_len;
|
||||
|
@ -132,7 +131,7 @@ float fScale = 1.0f;
|
|||
int default_fs;
|
||||
uint32_t dur_mins, dur_secs;
|
||||
HWND hDeviceList, hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL;
|
||||
HWND hLogDlg = NULL, hProgress = NULL, hInfo, hDiskID, hHash;
|
||||
HWND hLogDlg = NULL, hProgress = NULL, hInfo, hDiskID, hStatusToolbar;
|
||||
BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, detect_fakes = TRUE, mbr_selected_by_user = FALSE;
|
||||
BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE;
|
||||
BOOL enable_HDDs = FALSE, advanced_mode = TRUE, force_update = FALSE, use_fake_units = TRUE;
|
||||
|
@ -805,14 +804,6 @@ void UpdateProgress(int op, float percent)
|
|||
SetTaskbarProgressValue(pos, MAX_PROGRESS);
|
||||
}
|
||||
|
||||
static void EnableHash(BOOL bEnable)
|
||||
{
|
||||
// Can't use EnableWindow() for hHash as it overrides our WM_PAINT suppression
|
||||
// and we'd end up with an out of place disabled button
|
||||
hash_enabled = bEnable;
|
||||
SendMessage(hStatus, SB_SETTEXTW, SBT_OWNERDRAW | SB_SECTION_MIDDLE, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Toggle controls according to operation
|
||||
*/
|
||||
|
@ -827,7 +818,7 @@ static void EnableControls(BOOL bEnable)
|
|||
EnableWindow(hNBPasses, bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_ADVANCED), bEnable);
|
||||
EnableWindow(hLangToolbar, bEnable);
|
||||
EnableHash(bEnable);
|
||||
EnableWindow(hStatusToolbar, bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_ENABLE_FIXED_DISKS), bEnable);
|
||||
SetDlgItemTextU(hMainDialog, IDCANCEL, lmprintf(bEnable?MSG_006:MSG_007));
|
||||
if (selection_default == BT_IMG)
|
||||
|
@ -860,7 +851,8 @@ BOOL CALLBACK LogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
// Set the font to Unicode so that we can display anything
|
||||
hdc = GetDC(NULL);
|
||||
lfHeight = -MulDiv(8, GetDeviceCaps(hdc, LOGPIXELSY), 72);
|
||||
ReleaseDC(NULL, hdc);
|
||||
if (hdc != NULL)
|
||||
ReleaseDC(NULL, hdc);
|
||||
hf = CreateFontA(lfHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
|
||||
DEFAULT_CHARSET, 0, 0, PROOF_QUALITY, 0, "Arial Unicode MS");
|
||||
SendDlgItemMessageA(hDlg, IDC_LOG_EDIT, WM_SETFONT, (WPARAM)hf, TRUE);
|
||||
|
@ -1022,6 +1014,7 @@ DWORD WINAPI ISOScanThread(LPVOID param)
|
|||
SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0);
|
||||
PrintInfoDebug(0, MSG_203);
|
||||
safe_free(image_path);
|
||||
EnableWindow(hStatusToolbar, FALSE);
|
||||
PrintStatus(0, MSG_086);
|
||||
SetMBRProps();
|
||||
goto out;
|
||||
|
@ -1038,8 +1031,9 @@ DWORD WINAPI ISOScanThread(LPVOID param)
|
|||
if ( (!iso_report.has_bootmgr) && (!HAS_SYSLINUX(iso_report)) && (!IS_WINPE(iso_report.winpe)) && (!IS_GRUB(iso_report))
|
||||
&& (!iso_report.has_efi) && (!IS_REACTOS(iso_report) && (!iso_report.has_kolibrios) && (!iso_report.is_bootable_img)) ) {
|
||||
PrintInfo(0, MSG_081);
|
||||
MessageBoxU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK|MB_ICONINFORMATION|MB_IS_RTL);
|
||||
safe_free(image_path);
|
||||
EnableWindow(hStatusToolbar, FALSE);
|
||||
MessageBoxU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK|MB_ICONINFORMATION|MB_IS_RTL);
|
||||
PrintStatus(0, MSG_086);
|
||||
SetMBRProps();
|
||||
} else {
|
||||
|
@ -1113,7 +1107,7 @@ static void ToggleAdvanced(void)
|
|||
|
||||
// Move the controls up or down
|
||||
MoveCtrlY(hMainDialog, IDC_STATUS, dialog_shift);
|
||||
MoveCtrlY(hMainDialog, IDC_HASH, 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);
|
||||
|
@ -1136,7 +1130,7 @@ static void ToggleAdvanced(void)
|
|||
GetWindowRect(hLog, &rect);
|
||||
point.x = (rect.right - rect.left);
|
||||
point.y = (rect.bottom - rect.top) + (int)(fScale*dialog_shift);
|
||||
SetWindowPos(hLog, 0, 0, 0, point.x, point.y, 0);
|
||||
SetWindowPos(hLog, NULL, 0, 0, point.x, point.y, SWP_NOZORDER);
|
||||
// Don't forget to scroll the edit to the bottom after resize
|
||||
SendMessage(hLog, EM_LINESCROLL, 0, SendMessage(hLog, EM_GETLINECOUNT, 0, 0));
|
||||
|
||||
|
@ -1195,7 +1189,7 @@ static void ToggleToGo(void)
|
|||
|
||||
// Move the controls up or down
|
||||
MoveCtrlY(hMainDialog, IDC_STATUS, dialog_shift);
|
||||
MoveCtrlY(hMainDialog, IDC_HASH, 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);
|
||||
|
@ -1226,7 +1220,7 @@ static void ToggleToGo(void)
|
|||
GetWindowRect(hLog, &rect);
|
||||
point.x = (rect.right - rect.left);
|
||||
point.y = (rect.bottom - rect.top) + (int)(fScale*dialog_shift);
|
||||
SetWindowPos(hLog, 0, 0, 0, point.x, point.y, 0);
|
||||
SetWindowPos(hLog, NULL, 0, 0, point.x, point.y, SWP_NOZORDER);
|
||||
// Don't forget to scroll the edit to the bottom after resize
|
||||
SendMessage(hLog, EM_LINESCROLL, 0, SendMessage(hLog, EM_GETLINECOUNT, 0, 0));
|
||||
|
||||
|
@ -1645,7 +1639,8 @@ void InitDialog(HWND hDlg)
|
|||
hDC = GetDC(hDlg);
|
||||
fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f;
|
||||
lfHeight = -MulDiv(9, GetDeviceCaps(hDC, LOGPIXELSY), 72);
|
||||
ReleaseDC(hDlg, hDC);
|
||||
if (hDC != NULL)
|
||||
ReleaseDC(hDlg, hDC);
|
||||
// Adjust icon size lookup
|
||||
s16 = i16;
|
||||
if (s16 >= 54)
|
||||
|
@ -1703,8 +1698,6 @@ void InitDialog(HWND hDlg)
|
|||
selection_default = BT_FREEDOS;
|
||||
// Create the status line and initialize the taskbar icon for progress overlay
|
||||
CreateStatusBar();
|
||||
// Create the hash sign on the status bar
|
||||
EnableHash(FALSE);
|
||||
CreateTaskbarList();
|
||||
SetTaskbarProgressState(TASKBAR_NORMAL);
|
||||
|
||||
|
@ -1780,7 +1773,7 @@ void InitDialog(HWND hDlg)
|
|||
// 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, NULL, rcDeviceList.right - rcToolbarButton.right,
|
||||
SetWindowPos(hLangToolbar, HWND_TOP, rcDeviceList.right - rcToolbarButton.right,
|
||||
(int)(4.0f * fScale), rcToolbarButton.right, rcToolbarButton.bottom, 0);
|
||||
ShowWindow(hLangToolbar, SW_SHOWNORMAL);
|
||||
|
||||
|
@ -1805,7 +1798,7 @@ void InitDialog(HWND hDlg)
|
|||
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);
|
||||
rcSelectImage.right - rcSelectImage.left, rcBootType.bottom - rcBootType.top + 2, SWP_NOZORDER);
|
||||
|
||||
// The things one needs to do to keep things looking good...
|
||||
if (nWindowsVersion == WINDOWS_7) {
|
||||
|
@ -1855,7 +1848,7 @@ void InitDialog(HWND hDlg)
|
|||
CreateTooltip(GetDlgItem(hDlg, IDC_ABOUT), lmprintf(MSG_172), -1);
|
||||
CreateTooltip(GetDlgItem(hDlg, IDC_WINDOWS_INSTALL), lmprintf(MSG_199), -1);
|
||||
CreateTooltip(GetDlgItem(hDlg, IDC_WINDOWS_TO_GO), lmprintf(MSG_200), -1);
|
||||
CreateTooltip(hHash, lmprintf(MSG_272), -1);
|
||||
CreateTooltip(hStatusToolbar, lmprintf(MSG_272), -1);
|
||||
CreateTooltip(hLangToolbar, lmprintf(MSG_273), -1);
|
||||
|
||||
// Set a label for the Advanced Mode and Select Image button for screen readers
|
||||
|
@ -2080,10 +2073,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
DrawTextExU(pDI->hDC, szStatusMessage, -1, &pDI->rcItem,
|
||||
DT_LEFT|DT_END_ELLIPSIS|DT_PATH_ELLIPSIS, NULL);
|
||||
return (INT_PTR)TRUE;
|
||||
case SB_SECTION_MIDDLE:
|
||||
SetTextColor(pDI->hDC, ((image_path==NULL)||(!hash_enabled))?GetSysColor(COLOR_3DSHADOW):GetSysColor(COLOR_BTNTEXT));
|
||||
DrawTextExA(pDI->hDC, "#", -1, &pDI->rcItem, DT_CENTER, NULL);
|
||||
return (INT_PTR)TRUE;
|
||||
case SB_SECTION_RIGHT:
|
||||
SetTextColor(pDI->hDC, GetSysColor(COLOR_3DSHADOW));
|
||||
DrawTextExA(pDI->hDC, szTimer, -1, &pDI->rcItem, DT_LEFT, NULL);
|
||||
|
@ -2314,7 +2303,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
iso_provided = FALSE; // One off thing...
|
||||
} else {
|
||||
safe_free(image_path);
|
||||
EnableHash(FALSE);
|
||||
EnableWindow(hStatusToolbar, FALSE);
|
||||
image_path = FileDialog(FALSE, NULL, (selection_default == BT_IMG)?&img_ext:&iso_ext, 0);
|
||||
if (image_path == NULL) {
|
||||
CreateTooltip(hSelectISO, lmprintf(MSG_173), -1);
|
||||
|
@ -2421,7 +2410,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
format_op_in_progress = FALSE;
|
||||
break;
|
||||
case IDC_HASH:
|
||||
if ((format_thid == NULL) && (image_path != NULL) && (hash_enabled)) {
|
||||
if ((format_thid == NULL) && (image_path != NULL)) {
|
||||
FormatStatus = 0;
|
||||
format_op_in_progress = TRUE;
|
||||
no_confirmation_on_cancel = TRUE;
|
||||
|
|
13
src/rufus.h
13
src/rufus.h
|
@ -152,13 +152,10 @@ typedef struct {
|
|||
} notification_info; // To provide a "More info..." on notifications
|
||||
|
||||
/* Status Bar sections */
|
||||
#define SB_SECTION_LEFT 0
|
||||
#define SB_SECTION_MIDDLE 1
|
||||
#define SB_SECTION_RIGHT 2
|
||||
|
||||
/* Distance, from the right border, of the Status Bar separators */
|
||||
#define SB_EDGE_1 77.0f
|
||||
#define SB_EDGE_2 58.0f
|
||||
#define SB_SECTION_LEFT 0
|
||||
#define SB_SECTION_MIDDLE 1
|
||||
#define SB_SECTION_RIGHT 2
|
||||
#define SB_TIMER_SECTION_SIZE 58.0f
|
||||
|
||||
/* Timers used throughout the program */
|
||||
enum timer_type {
|
||||
|
@ -356,7 +353,7 @@ enum WindowsVersion {
|
|||
extern HINSTANCE hMainInstance;
|
||||
extern HWND hMainDialog, hLogDlg, hStatus, hDeviceList, hCapacity;
|
||||
extern HWND hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog;
|
||||
extern HWND hInfo, hProgress, hDiskID, hHash;
|
||||
extern HWND hInfo, hProgress, hDiskID, hStatusToolbar;
|
||||
extern float fScale;
|
||||
extern char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH];
|
||||
extern char* image_path;
|
||||
|
|
22
src/rufus.rc
22
src/rufus.rc
|
@ -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.3.691"
|
||||
CAPTION "Rufus 2.3.692"
|
||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
||||
|
@ -86,16 +86,16 @@ BEGIN
|
|||
DEFPUSHBUTTON "OK",IDOK,251,215,50,14,WS_GROUP
|
||||
END
|
||||
|
||||
IDD_CHECKSUM DIALOGEX 0, 0, 301, 69
|
||||
IDD_CHECKSUM DIALOGEX 0, 0, 301, 63
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Checksums"
|
||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,244,49,50,14,WS_GROUP
|
||||
EDITTEXT IDC_SHA1,40,31,197,12,ES_LOWERCASE | ES_AUTOHSCROLL | ES_READONLY
|
||||
EDITTEXT IDC_MD5,40,15,197,12,ES_LOWERCASE | ES_AUTOHSCROLL | ES_READONLY
|
||||
LTEXT "MD5:",IDC_STATIC,13,16,18,8
|
||||
LTEXT "SHA-1:",IDC_STATIC,13,32,22,8
|
||||
LTEXT "MD5:",IDC_STATIC,11,10,18,8
|
||||
EDITTEXT IDC_MD5,38,9,197,12,ES_LOWERCASE | ES_AUTOHSCROLL | ES_READONLY
|
||||
LTEXT "SHA1:",IDC_STATIC,11,26,20,8
|
||||
EDITTEXT IDC_SHA1,38,25,197,12,ES_LOWERCASE | ES_AUTOHSCROLL | ES_READONLY
|
||||
DEFPUSHBUTTON "OK",IDOK,243,43,50,14,WS_GROUP
|
||||
END
|
||||
|
||||
IDD_LICENSE DIALOGEX 0, 0, 335, 205
|
||||
|
@ -298,8 +298,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,3,691,0
|
||||
PRODUCTVERSION 2,3,691,0
|
||||
FILEVERSION 2,3,692,0
|
||||
PRODUCTVERSION 2,3,692,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -316,13 +316,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "2.3.691"
|
||||
VALUE "FileVersion", "2.3.692"
|
||||
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.3.691"
|
||||
VALUE "ProductVersion", "2.3.692"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
98
src/stdlg.c
98
src/stdlg.c
|
@ -56,7 +56,7 @@ static char* szMessageText = NULL;
|
|||
static char* szMessageTitle = NULL;
|
||||
static HWND hBrowseEdit;
|
||||
extern HWND hUpdatesDlg;
|
||||
static WNDPROC pOrgBrowseWndproc, pOrgHashWdnProc;
|
||||
static WNDPROC pOrgBrowseWndproc;
|
||||
static const SETTEXTEX friggin_microsoft_unicode_amateurs = {ST_DEFAULT, CP_UTF8};
|
||||
static BOOL notification_is_question;
|
||||
static const notification_info* notification_more_info;
|
||||
|
@ -395,28 +395,19 @@ fallback:
|
|||
return filepath;
|
||||
}
|
||||
|
||||
// Subclass the Hash button, so that it will be active but not display in the UI
|
||||
static INT_PTR CALLBACK HashCallback(HWND hCtrl, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
if (message == WM_PAINT) {
|
||||
// Even though we really don't want to paint anything, we *MUST* call Begin/EndPaint
|
||||
BeginPaint(hCtrl , &ps);
|
||||
EndPaint(hCtrl, &ps);
|
||||
return TRUE;
|
||||
}
|
||||
return CallWindowProc(pOrgHashWdnProc, hCtrl, message, wParam, lParam);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create the application status bar
|
||||
*/
|
||||
void CreateStatusBar(void)
|
||||
{
|
||||
SIZE sz = {0, 0};
|
||||
RECT rect;
|
||||
LONG height;
|
||||
LONG x, y, width, height;
|
||||
int edge[3];
|
||||
TBBUTTON tbbStatusToolbarButtons[1];
|
||||
TBBUTTONINFO tbi;
|
||||
HFONT hFont;
|
||||
HDC hDC;
|
||||
|
||||
// Create the status bar (WS_CLIPSIBLINGS since we have an overlapping button)
|
||||
hStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_TOOLTIPS | WS_CLIPSIBLINGS,
|
||||
|
@ -427,10 +418,22 @@ void CreateStatusBar(void)
|
|||
GetClientRect(hStatus, &rect);
|
||||
height = rect.bottom;
|
||||
|
||||
// Set the font we'll use to display the '#' sign in the toolbar button
|
||||
hFont = CreateFontA(-MulDiv(10, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72),
|
||||
0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
|
||||
0, 0, PROOF_QUALITY, 0, (nWindowsVersion >= WINDOWS_VISTA)?"Segoe UI":"Arial Unicode MS");
|
||||
|
||||
// Find the width of our hash sign
|
||||
hDC = GetDC(hMainDialog);
|
||||
SelectObject(hDC, hFont);
|
||||
GetTextExtentPoint32W(hDC, L"#", 1, &sz);
|
||||
if (hDC != NULL)
|
||||
ReleaseDC(hMainDialog, hDC);
|
||||
|
||||
// Create 3 status areas
|
||||
GetClientRect(hMainDialog, &rect);
|
||||
edge[0] = rect.right - (int)(SB_EDGE_1 * fScale);
|
||||
edge[1] = rect.right - (int)(SB_EDGE_2 * fScale);
|
||||
edge[1] = rect.right - (int)(SB_TIMER_SECTION_SIZE * fScale);
|
||||
edge[0] = edge[1] - (8 + sz.cx + 8 + 1); // There's 8 absolute pixels on right and left of the text
|
||||
edge[2] = rect.right;
|
||||
SendMessage(hStatus, SB_SETPARTS, (WPARAM)ARRAYSIZE(edge), (LPARAM)&edge);
|
||||
|
||||
|
@ -441,22 +444,51 @@ void CreateStatusBar(void)
|
|||
// This is supposed to create a toolips for a statusbar section (when SBARS_TOOLTIPS is in use)... but doesn't :(
|
||||
// SendMessageLU(hStatus, SB_SETTIPTEXT, (WPARAM)2, (LPARAM)"HELLO");
|
||||
|
||||
// Manually create the Hash button on the status bar
|
||||
hHash = CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, TEXT("#"), WS_CHILD | WS_VISIBLE | WS_TABSTOP,
|
||||
edge[0], rect.bottom - height +1, edge[1] - edge[0] - 1, height - 1, hMainDialog,
|
||||
(HMENU)IDC_HASH, hMainInstance, NULL);
|
||||
// Compute the dimensions for the hash button
|
||||
x = edge[0];
|
||||
y = rect.bottom - height + 1;
|
||||
width = edge[1] - edge[0] - 1;
|
||||
// How I wish there was a way to figure out how to make Windows controls look good
|
||||
// at all scales, without adding all these crappy empirical adjustments...
|
||||
if ((fScale > 1.20f) && (fScale <2.40f))
|
||||
height -= 1;
|
||||
if (nWindowsVersion <= WINDOWS_7)
|
||||
height += 1;
|
||||
|
||||
// Subclass our button so that we can hide it from the UI
|
||||
pOrgHashWdnProc = (WNDPROC)SetWindowLongPtr(hHash, GWLP_WNDPROC, (LONG_PTR)HashCallback);
|
||||
// Create the status toolbar
|
||||
hStatusToolbar = CreateWindowEx(WS_EX_TRANSPARENT, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_TABSTOP | WS_DISABLED |
|
||||
TBSTYLE_LIST | CCS_NOPARENTALIGN | CCS_NODIVIDER | CCS_NORESIZE,
|
||||
x, y, width, height, hMainDialog, (HMENU)IDC_STATUS_TOOLBAR, hMainInstance, NULL);
|
||||
|
||||
// Set the font we'll use to display the '#' sign
|
||||
hFont = CreateFontA(-MulDiv(10, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72),
|
||||
0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
|
||||
0, 0, PROOF_QUALITY, 0, (nWindowsVersion >= WINDOWS_VISTA)?"Segoe UI":"Arial Unicode MS");
|
||||
SendDlgItemMessageA(hMainDialog, IDC_HASH, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
// Set the button properties
|
||||
SendMessage(hStatusToolbar, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
SendMessage(hStatusToolbar, TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_MIXEDBUTTONS);
|
||||
SendMessage(hStatusToolbar, TB_SETIMAGELIST, 0, (LPARAM)NULL);
|
||||
SendMessage(hStatusToolbar, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)NULL);
|
||||
SendMessage(hStatusToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(0,0));
|
||||
|
||||
// Update our Z-order, just to be on the safe side
|
||||
SetWindowPos(hStatus, hHash, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
|
||||
// Set our text
|
||||
memset(tbbStatusToolbarButtons, 0, sizeof(TBBUTTON));
|
||||
tbbStatusToolbarButtons[0].idCommand = IDC_HASH;
|
||||
tbbStatusToolbarButtons[0].fsStyle = BTNS_SHOWTEXT;
|
||||
tbbStatusToolbarButtons[0].fsState = TBSTATE_ENABLED;
|
||||
tbbStatusToolbarButtons[0].iString = (INT_PTR)L"#";
|
||||
SendMessage(hStatusToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
|
||||
SendMessage(hStatusToolbar, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&tbbStatusToolbarButtons);
|
||||
|
||||
SendMessage(hStatusToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(width, height - 1));
|
||||
// Yeah, you'd think that TB_SETBUTTONSIZE would work for the width... but you'd be wrong.
|
||||
// The only working method that actually enforces the requested width is TB_SETBUTTONINFO
|
||||
tbi.cbSize = sizeof(tbi);
|
||||
tbi.dwMask = TBIF_SIZE | TBIF_COMMAND;
|
||||
tbi.cx = (WORD)width;
|
||||
tbi.idCommand = IDC_HASH;
|
||||
SendMessage(hStatusToolbar, TB_SETBUTTONINFO, (WPARAM)IDC_HASH, (LPARAM)&tbi);
|
||||
|
||||
// Need to resend the positioning for the toolbar to become active... One of Windows' mysteries
|
||||
// Also use this opportunity to set our Z-order for tab stop
|
||||
SetWindowPos(hStatusToolbar, GetDlgItem(hMainDialog, IDCANCEL), x, y, width, height, 0);
|
||||
ShowWindow(hStatusToolbar, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -931,7 +963,8 @@ LONG GetEntryWidth(HWND hDropDown, const char *entry)
|
|||
if (hFont != NULL)
|
||||
SelectObject(hDC, hDefFont);
|
||||
|
||||
ReleaseDC(hDropDown, hDC);
|
||||
if (hDC != NULL)
|
||||
ReleaseDC(hDropDown, hDC);
|
||||
return size.cx;
|
||||
}
|
||||
|
||||
|
@ -1362,7 +1395,8 @@ void SetTitleBarIcon(HWND hDlg)
|
|||
i16 = GetSystemMetrics(SM_CXSMICON);
|
||||
hDC = GetDC(hDlg);
|
||||
fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f;
|
||||
ReleaseDC(hDlg, hDC);
|
||||
if (hDC != NULL)
|
||||
ReleaseDC(hDlg, hDC);
|
||||
// Adjust icon size lookup
|
||||
s16 = i16;
|
||||
s32 = (int)(32.0f*fScale);
|
||||
|
|
Loading…
Reference in a new issue