mirror of https://github.com/pbatard/rufus.git
parent
65b19bb463
commit
091aa93cf6
|
@ -366,6 +366,7 @@
|
||||||
<ClInclude Include="..\src\smart.h" />
|
<ClInclude Include="..\src\smart.h" />
|
||||||
<ClInclude Include="..\src\sys_types.h" />
|
<ClInclude Include="..\src\sys_types.h" />
|
||||||
<ClInclude Include="..\src\dev.h" />
|
<ClInclude Include="..\src\dev.h" />
|
||||||
|
<ClInclude Include="..\src\ui.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Manifest Include="..\src\rufus.manifest" />
|
<Manifest Include="..\src\rufus.manifest" />
|
||||||
|
|
|
@ -149,6 +149,9 @@
|
||||||
<ClInclude Include="..\src\process.h">
|
<ClInclude Include="..\src\process.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\src\ui.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\res\rufus.ico">
|
<None Include="..\res\rufus.ico">
|
||||||
|
|
|
@ -532,8 +532,7 @@ t MSG_275 "The image you have selected is an 'ISOHybrid' image. This means it ca
|
||||||
t MSG_276 "Write in %s mode (Recommended)"
|
t MSG_276 "Write in %s mode (Recommended)"
|
||||||
# '%s' below will be replaced with your translation for MSG_095 ("DD Image")
|
# '%s' below will be replaced with your translation for MSG_095 ("DD Image")
|
||||||
t MSG_277 "Write in %s mode"
|
t MSG_277 "Write in %s mode"
|
||||||
# The following will be used for new controls of the Rufus 3.0 interface
|
t MSG_278 "Checking for conflicting processes..."
|
||||||
# They are added as messages, so that I will have them available when needed.
|
|
||||||
t MSG_279 "Non bootable"
|
t MSG_279 "Non bootable"
|
||||||
t MSG_280 "Disk or ISO image"
|
t MSG_280 "Disk or ISO image"
|
||||||
t MSG_281 "%s (Please select)"
|
t MSG_281 "%s (Please select)"
|
||||||
|
|
475
src/rufus.c
475
src/rufus.c
|
@ -41,121 +41,13 @@
|
||||||
#include "msapi_utf8.h"
|
#include "msapi_utf8.h"
|
||||||
#include "localization.h"
|
#include "localization.h"
|
||||||
|
|
||||||
|
#include "ui.h"
|
||||||
#include "drive.h"
|
#include "drive.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "bled/bled.h"
|
#include "bled/bled.h"
|
||||||
#include "../res/grub/grub_version.h"
|
#include "../res/grub/grub_version.h"
|
||||||
#include "../res/grub2/grub2_version.h"
|
#include "../res/grub2/grub2_version.h"
|
||||||
|
|
||||||
// TODO: move this somewhere else (ui.h?)
|
|
||||||
static int image_option_move_ids[] = {
|
|
||||||
IDS_PARTITION_TYPE_TXT,
|
|
||||||
IDC_PARTITION_TYPE,
|
|
||||||
IDS_TARGET_SYSTEM_TXT,
|
|
||||||
IDC_TARGET_SYSTEM,
|
|
||||||
IDS_CSM_HELP_TXT,
|
|
||||||
IDC_ADVANCED_DEVICE_TOOLBAR,
|
|
||||||
IDC_LIST_USB_HDD,
|
|
||||||
IDC_OLD_BIOS_FIXES,
|
|
||||||
IDC_RUFUS_MBR,
|
|
||||||
IDC_DISK_ID,
|
|
||||||
IDS_FORMAT_OPTIONS_TXT,
|
|
||||||
IDS_LABEL_TXT,
|
|
||||||
IDC_LABEL,
|
|
||||||
IDS_FILESYSTEM_TXT,
|
|
||||||
IDC_FILESYSTEM,
|
|
||||||
IDS_CLUSTERSIZE_TXT,
|
|
||||||
IDC_CLUSTERSIZE,
|
|
||||||
IDC_ADVANCED_FORMAT_TOOLBAR,
|
|
||||||
IDC_QUICKFORMAT,
|
|
||||||
IDC_BADBLOCKS,
|
|
||||||
IDC_NBPASSES,
|
|
||||||
IDC_EXTENDED_LABEL,
|
|
||||||
IDS_STATUS_TXT,
|
|
||||||
IDC_PROGRESS,
|
|
||||||
IDC_ABOUT,
|
|
||||||
IDC_LOG,
|
|
||||||
IDC_MULTI_TOOLBAR,
|
|
||||||
IDC_TEST,
|
|
||||||
IDC_START,
|
|
||||||
IDCANCEL,
|
|
||||||
IDC_STATUS,
|
|
||||||
IDC_STATUS_TOOLBAR,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int image_option_toggle_ids[] = {
|
|
||||||
IDS_IMAGE_OPTION_TXT,
|
|
||||||
IDC_IMAGE_OPTION,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int advanced_device_move_ids[] = {
|
|
||||||
IDC_LIST_USB_HDD,
|
|
||||||
IDC_OLD_BIOS_FIXES,
|
|
||||||
IDC_RUFUS_MBR,
|
|
||||||
IDS_FORMAT_OPTIONS_TXT,
|
|
||||||
IDS_LABEL_TXT,
|
|
||||||
IDC_LABEL,
|
|
||||||
IDS_FILESYSTEM_TXT,
|
|
||||||
IDC_FILESYSTEM,
|
|
||||||
IDS_CLUSTERSIZE_TXT,
|
|
||||||
IDC_CLUSTERSIZE,
|
|
||||||
IDC_ADVANCED_FORMAT_TOOLBAR,
|
|
||||||
IDC_QUICKFORMAT,
|
|
||||||
IDC_BADBLOCKS,
|
|
||||||
IDC_NBPASSES,
|
|
||||||
IDC_EXTENDED_LABEL,
|
|
||||||
IDS_STATUS_TXT,
|
|
||||||
IDC_PROGRESS,
|
|
||||||
IDC_ABOUT,
|
|
||||||
IDC_LOG,
|
|
||||||
IDC_MULTI_TOOLBAR,
|
|
||||||
IDC_TEST,
|
|
||||||
IDC_START,
|
|
||||||
IDCANCEL,
|
|
||||||
IDC_STATUS,
|
|
||||||
IDC_STATUS_TOOLBAR
|
|
||||||
};
|
|
||||||
|
|
||||||
static int advanced_device_toggle_ids[] = {
|
|
||||||
IDC_SAVE,
|
|
||||||
IDC_LIST_USB_HDD,
|
|
||||||
IDC_OLD_BIOS_FIXES,
|
|
||||||
IDC_RUFUS_MBR,
|
|
||||||
IDC_DISK_ID,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int advanced_format_move_ids[] = {
|
|
||||||
IDS_STATUS_TXT,
|
|
||||||
IDC_PROGRESS,
|
|
||||||
IDC_ABOUT,
|
|
||||||
IDC_LOG,
|
|
||||||
IDC_MULTI_TOOLBAR,
|
|
||||||
IDC_TEST,
|
|
||||||
IDC_START,
|
|
||||||
IDCANCEL,
|
|
||||||
IDC_STATUS,
|
|
||||||
IDC_STATUS_TOOLBAR
|
|
||||||
};
|
|
||||||
|
|
||||||
static int advanced_format_toggle_ids[] = {
|
|
||||||
IDC_QUICKFORMAT,
|
|
||||||
IDC_BADBLOCKS,
|
|
||||||
IDC_NBPASSES,
|
|
||||||
IDC_EXTENDED_LABEL,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int dd_image_toggle_ids[] = {
|
|
||||||
IDC_QUICKFORMAT,
|
|
||||||
IDC_PARTITION_TYPE,
|
|
||||||
IDC_TARGET_SYSTEM,
|
|
||||||
IDC_IMAGE_OPTION,
|
|
||||||
IDC_FILESYSTEM,
|
|
||||||
IDC_CLUSTERSIZE,
|
|
||||||
IDC_LABEL,
|
|
||||||
IDC_QUICKFORMAT,
|
|
||||||
IDC_EXTENDED_LABEL,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char* cmdline_hogger = "rufus.com";
|
static const char* cmdline_hogger = "rufus.com";
|
||||||
static const char* FileSystemLabel[FS_MAX] = { "FAT", "FAT32", "NTFS", "UDF", "exFAT", "ReFS" };
|
static const char* FileSystemLabel[FS_MAX] = { "FAT", "FAT32", "NTFS", "UDF", "exFAT", "ReFS" };
|
||||||
static const char* ep_reg = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer";
|
static const char* ep_reg = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer";
|
||||||
|
@ -176,7 +68,8 @@ static int64_t last_iso_blocking_status;
|
||||||
// TODO: rename 'selection_default' to something more explicit
|
// TODO: rename 'selection_default' to something more explicit
|
||||||
static int selection_default, row_height, advanced_device_section_height, advanced_format_section_height, image_index;
|
static int selection_default, row_height, advanced_device_section_height, advanced_format_section_height, image_index;
|
||||||
static int device_vpos, format_vpos, status_vpos;
|
static int device_vpos, format_vpos, status_vpos;
|
||||||
static int cb_width, sep_width, margin_width, half_width, full_width, hash_button_width, small_button_width, small_sep_width;
|
static int bw, hw, fw; // Main button width, half dropdown width, full dropdown width
|
||||||
|
static int cb_width, dd_width, sw, mw, bsw, hbw, sbw, ssw;
|
||||||
static UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU;
|
static UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU;
|
||||||
static RECT relaunch_rc = { -65536, -65536, 0, 0};
|
static RECT relaunch_rc = { -65536, -65536, 0, 0};
|
||||||
static UINT uQFChecked = BST_CHECKED, uMBRChecked = BST_UNCHECKED;
|
static UINT uQFChecked = BST_CHECKED, uMBRChecked = BST_UNCHECKED;
|
||||||
|
@ -279,6 +172,9 @@ static void SetAllowedFileSystems(void)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset(allowed_filesystem, 0, sizeof(allowed_filesystem));
|
memset(allowed_filesystem, 0, sizeof(allowed_filesystem));
|
||||||
|
// Nothing is allowed if we don't have a drive
|
||||||
|
if (ComboBox_GetCurSel(hDeviceList) < 0)
|
||||||
|
return;
|
||||||
switch (selection_default) {
|
switch (selection_default) {
|
||||||
case BT_NON_BOOTABLE:
|
case BT_NON_BOOTABLE:
|
||||||
for (i = 0; i < FS_MAX; i++)
|
for (i = 0; i < FS_MAX; i++)
|
||||||
|
@ -456,7 +352,6 @@ static BOOL SetClusterSizes(int FSType)
|
||||||
|
|
||||||
if ((SelectedDrive.ClusterSize[FSType].Allowed == 0)
|
if ((SelectedDrive.ClusterSize[FSType].Allowed == 0)
|
||||||
|| (SelectedDrive.ClusterSize[FSType].Default == 0)) {
|
|| (SelectedDrive.ClusterSize[FSType].Default == 0)) {
|
||||||
uprintf("The drive is incompatible with FS type #%d\n", FSType);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,6 +379,7 @@ static BOOL SetFileSystemAndClusterSize(char* fs_type)
|
||||||
LONGLONG i;
|
LONGLONG i;
|
||||||
char tmp[128] = "", *entry;
|
char tmp[128] = "", *entry;
|
||||||
|
|
||||||
|
// TODO: something better with FS reselection
|
||||||
IGNORE_RETVAL(ComboBox_ResetContent(hFileSystem));
|
IGNORE_RETVAL(ComboBox_ResetContent(hFileSystem));
|
||||||
IGNORE_RETVAL(ComboBox_ResetContent(hClusterSize));
|
IGNORE_RETVAL(ComboBox_ResetContent(hClusterSize));
|
||||||
default_fs = FS_UNKNOWN;
|
default_fs = FS_UNKNOWN;
|
||||||
|
@ -851,7 +747,7 @@ static void EnableControls(BOOL bEnable)
|
||||||
SendMessage(hMultiToolbar, TB_ENABLEBUTTON, (WPARAM)IDC_SETTINGS, (LPARAM)bEnable);
|
SendMessage(hMultiToolbar, TB_ENABLEBUTTON, (WPARAM)IDC_SETTINGS, (LPARAM)bEnable);
|
||||||
|
|
||||||
// Checksum button is enabled if an image has been selected
|
// Checksum button is enabled if an image has been selected
|
||||||
EnableWindow(GetDlgItem(hMainDialog, IDC_HASH), bEnable && (image_path != NULL));
|
EnableWindow(GetDlgItem(hMainDialog, IDC_HASH), bEnable && (bt == BT_IMAGE) && (image_path != NULL));
|
||||||
|
|
||||||
// Toggle CLOSE/CANCEL
|
// Toggle CLOSE/CANCEL
|
||||||
SetDlgItemTextU(hMainDialog, IDCANCEL, lmprintf(bEnable ? MSG_006 : MSG_007));
|
SetDlgItemTextU(hMainDialog, IDCANCEL, lmprintf(bEnable ? MSG_006 : MSG_007));
|
||||||
|
@ -1280,7 +1176,7 @@ static void ToggleAdvancedDeviceOptions(BOOL enable)
|
||||||
GetWindowRect(hDeviceList, &rc);
|
GetWindowRect(hDeviceList, &rc);
|
||||||
MapWindowPoints(NULL, hMainDialog, (POINT*)&rc, 2);
|
MapWindowPoints(NULL, hMainDialog, (POINT*)&rc, 2);
|
||||||
SetWindowPos(hDeviceList, HWND_TOP, rc.left, rc.top,
|
SetWindowPos(hDeviceList, HWND_TOP, rc.left, rc.top,
|
||||||
enable ? full_width - small_sep_width - small_button_width : full_width, rc.bottom - rc.top, 0);
|
enable ? fw - ssw - sbw : fw, rc.bottom - rc.top, 0);
|
||||||
|
|
||||||
// Resize the main dialog and log window
|
// Resize the main dialog and log window
|
||||||
ResizeDialogs(shift);
|
ResizeDialogs(shift);
|
||||||
|
@ -1366,12 +1262,6 @@ static void ToggleImageOption(void)
|
||||||
InvalidateRect(hMainDialog, NULL, TRUE);
|
InvalidateRect(hMainDialog, NULL, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle the display of the hash button
|
|
||||||
static __inline void ToggleHash(void)
|
|
||||||
{
|
|
||||||
EnableWindow(GetDlgItem(hMainDialog, IDC_HASH), (bt == BT_IMAGE) && (image_path != NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SetBootTypeDropdownWidth()
|
static void SetBootTypeDropdownWidth()
|
||||||
{
|
{
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
|
@ -1408,6 +1298,7 @@ static void UpdateImage(void)
|
||||||
ComboBox_InsertStringU(hBootType, index, short_image_path);
|
ComboBox_InsertStringU(hBootType, index, short_image_path);
|
||||||
ComboBox_SetItemData(hBootType, index, BT_IMAGE);
|
ComboBox_SetItemData(hBootType, index, BT_IMAGE);
|
||||||
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, index));
|
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, index));
|
||||||
|
bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||||
SetBootTypeDropdownWidth();
|
SetBootTypeDropdownWidth();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1462,12 +1353,18 @@ DWORD WINAPI ISOScanThread(LPVOID param)
|
||||||
EnableControls(TRUE);
|
EnableControls(TRUE);
|
||||||
SetMBRProps();
|
SetMBRProps();
|
||||||
} else {
|
} else {
|
||||||
|
if (!dont_display_image_name) {
|
||||||
|
for (i = (int)safe_strlen(image_path); (i > 0) && (image_path[i] != '\\'); i--);
|
||||||
|
short_image_path = &image_path[i + 1];
|
||||||
|
PrintStatus(0, MSG_205, short_image_path);
|
||||||
|
UpdateImage();
|
||||||
|
uprintf("Using image: %s (%s)", short_image_path, SizeToHumanReadable(img_report.image_size, FALSE, FALSE));
|
||||||
|
}
|
||||||
EnableControls(TRUE);
|
EnableControls(TRUE);
|
||||||
// Set Target and FS accordingly
|
// Set Target and FS accordingly
|
||||||
if (img_report.is_iso) {
|
if (img_report.is_iso) {
|
||||||
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, image_index));
|
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, image_index));
|
||||||
SetPartitionSchemeAndTargetSystem(FALSE);
|
SetPartitionSchemeAndTargetSystem(FALSE);
|
||||||
// TODO: Maybe we should just call PopulateProperties() here?
|
|
||||||
SetFileSystemAndClusterSize(NULL);
|
SetFileSystemAndClusterSize(NULL);
|
||||||
SetFSFromISO();
|
SetFSFromISO();
|
||||||
SetMBRProps();
|
SetMBRProps();
|
||||||
|
@ -1476,13 +1373,6 @@ DWORD WINAPI ISOScanThread(LPVOID param)
|
||||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE << 16) | IDC_FILESYSTEM,
|
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE << 16) | IDC_FILESYSTEM,
|
||||||
ComboBox_GetCurSel(hFileSystem));
|
ComboBox_GetCurSel(hFileSystem));
|
||||||
}
|
}
|
||||||
if (!dont_display_image_name) {
|
|
||||||
for (i = (int)safe_strlen(image_path); (i > 0) && (image_path[i] != '\\'); i--);
|
|
||||||
short_image_path = &image_path[i + 1];
|
|
||||||
PrintStatus(0, MSG_205, short_image_path);
|
|
||||||
UpdateImage();
|
|
||||||
uprintf("Using image: %s (%s)", short_image_path, SizeToHumanReadable(img_report.image_size, FALSE, FALSE));
|
|
||||||
}
|
|
||||||
// Lose the focus on the select ISO (but place it on Close)
|
// Lose the focus on the select ISO (but place it on Close)
|
||||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0);
|
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0);
|
||||||
// Lose the focus from Close and set it back to Start
|
// Lose the focus from Close and set it back to Start
|
||||||
|
@ -2033,6 +1923,72 @@ static inline int GetTextWidth(HWND hDlg, int id)
|
||||||
return GetTextSize(GetDlgItem(hDlg, id), NULL).cx;
|
return GetTextSize(GetDlgItem(hDlg, id), NULL).cx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://stackoverflow.com/a/20926332/1069307
|
||||||
|
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb226818.aspx
|
||||||
|
static void GetBasicControlsWidth(HWND hDlg)
|
||||||
|
{
|
||||||
|
int checkbox_internal_spacing = 12, dropdown_internal_spacing = 15;
|
||||||
|
RECT rc = { 0, 0, 4, 8 };
|
||||||
|
SIZE bu;
|
||||||
|
|
||||||
|
// Compute base unit sizes since GetDialogBaseUnits() returns garbage data.
|
||||||
|
// See http://support.microsoft.com/kb/125681
|
||||||
|
MapDialogRect(hDlg, &rc);
|
||||||
|
bu.cx = rc.right;
|
||||||
|
bu.cy = rc.bottom;
|
||||||
|
|
||||||
|
// TODO: figure out the specifics of each Windows version
|
||||||
|
if (nWindowsVersion == WINDOWS_10) {
|
||||||
|
checkbox_internal_spacing = 10;
|
||||||
|
dropdown_internal_spacing = 13;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Checkbox and (blank) dropdown widths
|
||||||
|
cb_width = MulDiv(checkbox_internal_spacing, bu.cx, 4);
|
||||||
|
dd_width = MulDiv(dropdown_internal_spacing, bu.cx, 4);
|
||||||
|
|
||||||
|
// Spacing width between half-length dropdowns (sep) as well as left margin
|
||||||
|
GetWindowRect(GetDlgItem(hDlg, IDC_TARGET_SYSTEM), &rc);
|
||||||
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
|
sw = rc.left;
|
||||||
|
GetWindowRect(GetDlgItem(hDlg, IDC_PARTITION_TYPE), &rc);
|
||||||
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
|
sw -= rc.right;
|
||||||
|
mw = rc.left;
|
||||||
|
|
||||||
|
// Small button and small separator widths
|
||||||
|
GetWindowRect(GetDlgItem(hDlg, IDC_SAVE), &rc);
|
||||||
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
|
sbw = rc.right - rc.left;
|
||||||
|
ssw = rc.left;
|
||||||
|
GetWindowRect(hDeviceList, &rc);
|
||||||
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
|
ssw -= rc.right;
|
||||||
|
|
||||||
|
// Hash button width
|
||||||
|
GetWindowRect(GetDlgItem(hDlg, IDC_HASH), &rc);
|
||||||
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
|
hbw = rc.right - rc.left;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute the minimum size of the main buttons
|
||||||
|
static void GetMainButtonsWidth(HWND hDlg)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
RECT rc;
|
||||||
|
|
||||||
|
GetWindowRect(GetDlgItem(hDlg, main_button_ids[0]), &rc);
|
||||||
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
|
bw = rc.right - rc.left;
|
||||||
|
uprintf("initial bw = %d", bw);
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAYSIZE(main_button_ids); i++)
|
||||||
|
bw = max(GetTextWidth(hDlg, main_button_ids[i]) + cb_width, bw);
|
||||||
|
// The 'CLOSE' button is also be used to display 'CANCEL' => measure that too
|
||||||
|
bw = max(bw, GetTextSize(GetDlgItem(hDlg, IDCANCEL), lmprintf(MSG_007)).cx + cb_width);
|
||||||
|
uprintf("adjusted bw = %d", bw);
|
||||||
|
}
|
||||||
|
|
||||||
// The following goes over the data that gets populated into the half-width dropdowns
|
// The following goes over the data that gets populated into the half-width dropdowns
|
||||||
// (Partition scheme, Target System, Disk ID, File system, Cluster size, Nb passes)
|
// (Partition scheme, Target System, Disk ID, File system, Cluster size, Nb passes)
|
||||||
// to figure out the minimum width we should allocate.
|
// to figure out the minimum width we should allocate.
|
||||||
|
@ -2046,10 +2002,11 @@ static void GetHalfDropwdownWidth(HWND hDlg)
|
||||||
// TODO: verify that this works if we just resized from a language with larger width?
|
// TODO: verify that this works if we just resized from a language with larger width?
|
||||||
GetWindowRect(GetDlgItem(hDlg, IDC_PARTITION_TYPE), &rc);
|
GetWindowRect(GetDlgItem(hDlg, IDC_PARTITION_TYPE), &rc);
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
half_width = rc.right - rc.left - cb_width;
|
uprintf("initial hw = %d", rc.right - rc.left);
|
||||||
|
hw = rc.right - rc.left - dd_width;
|
||||||
|
|
||||||
// "Super Floppy Disk" is the longuest entry in the Partition Scheme dropdown
|
// "Super Floppy Disk" is the longuest entry in the Partition Scheme dropdown
|
||||||
half_width = max(half_width, GetTextSize(GetDlgItem(hDlg, IDC_PARTITION_TYPE), (char*)sfd_name).cx);
|
hw = max(hw, GetTextSize(GetDlgItem(hDlg, IDC_PARTITION_TYPE), (char*)sfd_name).cx);
|
||||||
|
|
||||||
// This is basically the same as SetClusterSizeLabels() except we're adding (Default) to each entry
|
// This is basically the same as SetClusterSizeLabels() except we're adding (Default) to each entry
|
||||||
for (i = 512, j = 1, msg_id = MSG_026; j<MAX_CLUSTER_SIZES; i <<= 1, j++) {
|
for (i = 512, j = 1, msg_id = MSG_026; j<MAX_CLUSTER_SIZES; i <<= 1, j++) {
|
||||||
|
@ -2058,115 +2015,100 @@ static void GetHalfDropwdownWidth(HWND hDlg)
|
||||||
msg_id++;
|
msg_id++;
|
||||||
}
|
}
|
||||||
safe_sprintf(tmp, 64, "%d %s", i, lmprintf(msg_id));
|
safe_sprintf(tmp, 64, "%d %s", i, lmprintf(msg_id));
|
||||||
half_width = max(half_width, GetTextSize(GetDlgItem(hDlg, IDC_CLUSTERSIZE), lmprintf(MSG_030, tmp)).cx);
|
hw = max(hw, GetTextSize(GetDlgItem(hDlg, IDC_CLUSTERSIZE), lmprintf(MSG_030, tmp)).cx);
|
||||||
}
|
}
|
||||||
// We don't go over file systems, because none of them will be longer than "Super Floppy Disk"
|
// We don't go over file systems, because none of them will be longer than "Super Floppy Disk"
|
||||||
// We do however go over the BIOS vs UEFI entries, as some of these are translated
|
// We do however go over the BIOS vs UEFI entries, as some of these are translated
|
||||||
for (msg_id = MSG_031; msg_id <= MSG_033; msg_id++)
|
for (msg_id = MSG_031; msg_id <= MSG_033; msg_id++)
|
||||||
half_width = max(half_width, GetTextSize(GetDlgItem(hDlg, IDC_TARGET_SYSTEM), lmprintf(msg_id)).cx);
|
hw = max(hw, GetTextSize(GetDlgItem(hDlg, IDC_TARGET_SYSTEM), lmprintf(msg_id)).cx);
|
||||||
|
|
||||||
// Just in case, we also do the number of passes
|
// Just in case, we also do the number of passes
|
||||||
for (i = 1; i <= 4; i++)
|
for (i = 1; i <= 4; i++)
|
||||||
half_width = max(half_width, GetTextSize(GetDlgItem(hDlg, IDC_TARGET_SYSTEM),
|
hw = max(hw, GetTextSize(GetDlgItem(hDlg, IDC_TARGET_SYSTEM),
|
||||||
lmprintf((i == 1) ? MSG_034 : MSG_035, i)).cx);
|
lmprintf((i == 1) ? MSG_034 : MSG_035, i)).cx);
|
||||||
|
|
||||||
// Finally, we must ensure that we'll have enough space for the 2 checkbox controls
|
// Finally, we must ensure that we'll have enough space for the 2 checkbox controls
|
||||||
// that end up with a half dropdown
|
// that end up with a half dropdown
|
||||||
half_width = max(half_width, GetTextWidth(hDlg, IDC_RUFUS_MBR) - sep_width);
|
hw = max(hw, GetTextWidth(hDlg, IDC_RUFUS_MBR) - sw);
|
||||||
half_width = max(half_width, GetTextWidth(hDlg, IDC_BADBLOCKS) - sep_width);
|
hw = max(hw, GetTextWidth(hDlg, IDC_BADBLOCKS) - sw);
|
||||||
|
|
||||||
// Add the width of a blank checkbox
|
// Add the width of a blank dropdown
|
||||||
half_width += cb_width;
|
hw += dd_width;
|
||||||
|
uprintf("adjusted hw = %d, 2*bw + ssw = %d", hw, 2 * bw + ssw);
|
||||||
uprintf("half_width = %d", half_width);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* | full_width |
|
* mw = margin width
|
||||||
* 8 ->|<- 96 ->|<- 24 ->|<- 96 ->|<- 8
|
* fw = full dropdown width
|
||||||
* margin_width | half_width | sep_width | half_width | margin_width
|
* hd = half dropdown width
|
||||||
|
* bsw = boot selection dropdown width
|
||||||
|
* sw = separator width
|
||||||
|
* ssw = small separator width
|
||||||
|
* bw = button width
|
||||||
|
* sbw = small button width
|
||||||
|
* hbw = hash button width
|
||||||
|
*
|
||||||
|
* | fw |
|
||||||
|
* | bsw | ssw | hbw | ssw | bw |
|
||||||
|
* 8 ->|<- 96 ->|<- 24 ->|<- 96 ->|<- 8
|
||||||
|
* mw | hw | sw | hw | mw
|
||||||
|
* | bw | ssw | bw |
|
||||||
*/
|
*/
|
||||||
static void GetFullWidth(HWND hDlg)
|
static void GetFullWidth(HWND hDlg)
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
int i, control[] = { IDC_LIST_USB_HDD, IDC_OLD_BIOS_FIXES, IDC_QUICKFORMAT, IDC_EXTENDED_LABEL };
|
int i, control[] = { IDC_LIST_USB_HDD, IDC_OLD_BIOS_FIXES, IDC_QUICKFORMAT, IDC_EXTENDED_LABEL };
|
||||||
|
|
||||||
|
// Compute the minimum size needed for the Boot Selection dropdown
|
||||||
|
GetWindowRect(GetDlgItem(hDlg, IDC_BOOT_TYPE), &rc);
|
||||||
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
|
uprintf("initial bsw = %d", rc.right - rc.left);
|
||||||
|
bsw = max(rc.right - rc.left, GetTextSize(hBootType, lmprintf(MSG_281, lmprintf(MSG_280))).cx + dd_width);
|
||||||
|
uprintf("updated bsw = %d", bsw);
|
||||||
|
uprintf("ssw = %d, sbw = %d", ssw, sbw);
|
||||||
|
|
||||||
// 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, IDC_IMAGE_OPTION), &rc);
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
full_width = rc.right - rc.left - cb_width;
|
uprintf("initial fw = %d", rc.right - rc.left);
|
||||||
|
fw = rc.right - rc.left - dd_width;
|
||||||
// Initialize the min width according to the longest message from the Boot Type drowpdown
|
|
||||||
full_width = max(full_width, GetTextSize(GetDlgItem(hDlg, IDC_BOOT_TYPE), lmprintf(MSG_281, lmprintf(MSG_280))).cx);
|
|
||||||
|
|
||||||
// Go through the Image Options for Windows To Go
|
// Go through the Image Options for Windows To Go
|
||||||
full_width = max(full_width, GetTextSize(GetDlgItem(hDlg, IDC_IMAGE_OPTION), lmprintf(MSG_301)).cx);
|
fw = max(fw, GetTextSize(GetDlgItem(hDlg, IDC_IMAGE_OPTION), lmprintf(MSG_301)).cx);
|
||||||
full_width = max(full_width, GetTextSize(GetDlgItem(hDlg, IDC_IMAGE_OPTION), lmprintf(MSG_302)).cx);
|
fw = max(fw, GetTextSize(GetDlgItem(hDlg, IDC_IMAGE_OPTION), lmprintf(MSG_302)).cx);
|
||||||
|
|
||||||
|
|
||||||
// Now deal with full length checkbox lines
|
// Now deal with full length checkbox lines
|
||||||
for (i=0; i<ARRAYSIZE(control); i++)
|
for (i=0; i<ARRAYSIZE(control); i++)
|
||||||
full_width = max(full_width, GetTextWidth(hDlg, control[i]));
|
fw = max(fw, GetTextWidth(hDlg, control[i]));
|
||||||
|
|
||||||
// All of the above is for text only, so we need to add cb space
|
// All of the above is for text only, so we need to add dd space
|
||||||
full_width += cb_width;
|
fw += dd_width;
|
||||||
|
|
||||||
// Our min also needs to be longer than 2 half length dropdowns + spacer
|
// Our min also needs to be longer than 2 half length dropdowns + spacer
|
||||||
full_width = max(full_width, 2 * half_width + sep_width);
|
fw = max(fw, 2 * hw + sw);
|
||||||
|
uprintf("adjusted fw = %d", fw);
|
||||||
|
uprintf("bsw + 2*ssw + hbw + bw = %d", bsw + 2*ssw + hbw + bw);
|
||||||
|
|
||||||
|
|
||||||
|
// Now that we have our minimum full width, adjust the button width if needed
|
||||||
|
// Adjust according to min full width
|
||||||
|
bw = max(bw, (fw - 2 * ssw - sw) / 4);
|
||||||
|
// Adjust according to min boot selection width
|
||||||
|
bw = max(bw, (bsw + hbw - sw) / 3);
|
||||||
|
|
||||||
|
uprintf("fw = %d, 4bw + 2ssw + sw = %d", fw, 4 * bw + 2 * ssw + sw);
|
||||||
|
uprintf("bsw + 2ssw + hbw + bw = %d", bsw + 2 * ssw + hbw + bw);
|
||||||
|
|
||||||
|
// Adjust according to min half width
|
||||||
|
bw = max(bw, (hw / 2) - ssw);
|
||||||
|
|
||||||
|
// Now that our button width is set, we can adjust the rest
|
||||||
|
hw = max(hw, 2 * bw + ssw);
|
||||||
|
fw = max(fw, 2 * hw + sw);
|
||||||
|
|
||||||
|
bsw = max(bsw, fw - bw - 2 * ssw - hbw);
|
||||||
|
|
||||||
// TODO: Also pick a few choice messages from info/status
|
// TODO: Also pick a few choice messages from info/status
|
||||||
uprintf("full_width = %d", full_width);
|
|
||||||
|
|
||||||
// TESTING
|
|
||||||
// GetWindowRect(GetDlgItem(hDlg, IDC_DISK_ID), &rc);
|
|
||||||
// MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
|
||||||
// SetWindowPos(GetDlgItem(hDlg, IDC_DISK_ID), NULL, margin_width + half_width + sep_width, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// https://stackoverflow.com/a/20926332/1069307
|
|
||||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb226818.aspx
|
|
||||||
static void GetBasicControlsWidth(HWND hDlg)
|
|
||||||
{
|
|
||||||
int checkbox_internal_spacing = 12;
|
|
||||||
RECT rc = { 0, 0, 4, 8 };
|
|
||||||
SIZE bu;
|
|
||||||
|
|
||||||
// Compute base unit sizes since GetDialogBaseUnits() returns garbage data.
|
|
||||||
// See http://support.microsoft.com/kb/125681
|
|
||||||
MapDialogRect(hDlg, &rc);
|
|
||||||
bu.cx = rc.right;
|
|
||||||
bu.cy = rc.bottom;
|
|
||||||
|
|
||||||
// TODO: figure out the specifics of each Windows version
|
|
||||||
if (nWindowsVersion == WINDOWS_10)
|
|
||||||
checkbox_internal_spacing = 10;
|
|
||||||
|
|
||||||
// Checkbox width
|
|
||||||
cb_width = MulDiv(checkbox_internal_spacing, bu.cx, 4);
|
|
||||||
|
|
||||||
// Spacing width between half-length dropdowns (sep) as well as left margin
|
|
||||||
GetWindowRect(GetDlgItem(hDlg, IDC_TARGET_SYSTEM), &rc);
|
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
|
||||||
sep_width = rc.left;
|
|
||||||
GetWindowRect(GetDlgItem(hDlg, IDC_PARTITION_TYPE), &rc);
|
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
|
||||||
sep_width -= rc.right;
|
|
||||||
margin_width = rc.left;
|
|
||||||
|
|
||||||
// Small button and small separator widths
|
|
||||||
GetWindowRect(GetDlgItem(hDlg, IDC_SAVE), &rc);
|
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
|
||||||
small_button_width = rc.right - rc.left;
|
|
||||||
small_sep_width = rc.left;
|
|
||||||
GetWindowRect(hDeviceList, &rc);
|
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
|
||||||
small_sep_width -= rc.right;
|
|
||||||
|
|
||||||
// Hash button width
|
|
||||||
GetWindowRect(GetDlgItem(hDlg, IDC_HASH), &rc);
|
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
|
||||||
hash_button_width = rc.right - rc.left;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetSectionHeaders(HWND hDlg)
|
static void SetSectionHeaders(HWND hDlg)
|
||||||
|
@ -2198,13 +2140,18 @@ static void SetSectionHeaders(HWND hDlg)
|
||||||
|
|
||||||
static void PositionControls(HWND hDlg)
|
static void PositionControls(HWND hDlg)
|
||||||
{
|
{
|
||||||
RECT rc, rcBootType, rcSelectedImage;
|
RECT rc, rcSelectedImage;
|
||||||
HWND hCtrl;
|
HWND hCtrl;
|
||||||
SIZE sz;
|
SIZE sz;
|
||||||
// TODO: dynamicize button_fudge
|
// TODO: dynamicize button_fudge
|
||||||
int dropdown_height, button_fudge = 2;
|
int i, x, dropdown_height, button_fudge = 2;
|
||||||
// TODO: compute button width intependtly and use it to compute half_width
|
|
||||||
int i, width = (half_width - small_sep_width) / 2, x, control[3] = { IDC_SELECT, IDC_START, IDCANCEL };
|
// Start by resizing the whole dialog
|
||||||
|
GetWindowRect(hDlg, &rc);
|
||||||
|
uprintf("initial dialog width = %d (mw = %d)", rc.right - rc.left, mw);
|
||||||
|
// Don't ask me why we need 3 times the margin width here instead of 2...
|
||||||
|
// TODO: If that doesn't work, just pick additonal space from initial fw and reuse that
|
||||||
|
SetWindowPos(hDlg, NULL, -1, -1, 3*mw + fw, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER);
|
||||||
|
|
||||||
// Resize the height of the label and progress bar to the height of standard dropdowns
|
// Resize the height of the label and progress bar to the height of standard dropdowns
|
||||||
hCtrl = GetDlgItem(hDlg, IDC_DEVICE);
|
hCtrl = GetDlgItem(hDlg, IDC_DEVICE);
|
||||||
|
@ -2272,54 +2219,61 @@ static void PositionControls(HWND hDlg)
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
SetWindowPos(hMultiToolbar, HWND_TOP, rc.left, rc.top, sz.cx, dropdown_height, 0);
|
SetWindowPos(hMultiToolbar, HWND_TOP, rc.left, rc.top, sz.cx, dropdown_height, 0);
|
||||||
|
|
||||||
// Reposition and resize the SELECT and # buttons
|
|
||||||
GetWindowRect(hBootType, &rcBootType);
|
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rcBootType, 2);
|
|
||||||
GetWindowRect(hSelectImage, &rc);
|
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
|
||||||
SetWindowPos(hSelectImage, NULL, rc.left, rcBootType.top - 1,
|
|
||||||
rc.right - rc.left, dropdown_height + button_fudge, SWP_NOZORDER);
|
|
||||||
|
|
||||||
// Resize the START and CANCEL/CLOSE buttons
|
|
||||||
GetWindowRect(hStart, &rc);
|
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
|
||||||
SetWindowPos(hStart, NULL, rc.left, rc.top,
|
|
||||||
rc.right - rc.left, dropdown_height + button_fudge, SWP_NOZORDER);
|
|
||||||
hCtrl = GetDlgItem(hDlg, IDCANCEL);
|
|
||||||
GetWindowRect(hCtrl, &rc);
|
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
|
||||||
SetWindowPos(hCtrl, NULL, rc.left, rc.top,
|
|
||||||
rc.right - rc.left, dropdown_height + button_fudge, SWP_NOZORDER);
|
|
||||||
|
|
||||||
// Reposition the main buttons
|
// Reposition the main buttons
|
||||||
for (i = 0; i < ARRAYSIZE(control); i++)
|
for (i = 0; i < ARRAYSIZE(main_button_ids); i++) {
|
||||||
width = max(GetTextWidth(hDlg, control[i]) + cb_width, width);
|
hCtrl = GetDlgItem(hDlg, main_button_ids[i]);
|
||||||
// The 'CLOSE' button is also be used to display 'CANCEL' => measure that too
|
|
||||||
width = max(width, GetTextSize(GetDlgItem(hDlg, IDCANCEL), lmprintf(MSG_007)).cx + cb_width);
|
|
||||||
uprintf("MAX BUTTON = %d", width);
|
|
||||||
for (i = 0; i < ARRAYSIZE(control); i++) {
|
|
||||||
hCtrl = GetDlgItem(hDlg, control[i]);
|
|
||||||
GetWindowRect(hCtrl, &rc);
|
GetWindowRect(hCtrl, &rc);
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
if (i % 2 == 0)
|
x = mw + fw - bw;
|
||||||
x = margin_width + full_width - width;
|
if (i % 2 == 1)
|
||||||
else
|
x -= bw + ssw;
|
||||||
x = rc.left;
|
SetWindowPos(hCtrl, HWND_TOP, x, rc.top, bw, rc.bottom - rc.top, 0);
|
||||||
SetWindowPos(hCtrl, HWND_TOP, x, rc.top, width, rc.bottom - rc.top, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reposition the Hash button
|
// Reposition the Hash button
|
||||||
hCtrl = GetDlgItem(hDlg, IDC_HASH);
|
hCtrl = GetDlgItem(hDlg, IDC_HASH);
|
||||||
GetWindowRect(hCtrl, &rc);
|
GetWindowRect(hCtrl, &rc);
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
x -= small_sep_width + hash_button_width;
|
x -= ssw + hbw;
|
||||||
SetWindowPos(hCtrl, HWND_TOP, x, rc.top, hash_button_width, rc.bottom - rc.top, 0);
|
SetWindowPos(hCtrl, HWND_TOP, x, rc.top, hbw, rc.bottom - rc.top, 0);
|
||||||
|
|
||||||
// Resize the boot selection button
|
// Reposition the Save button
|
||||||
|
hCtrl = GetDlgItem(hDlg, IDC_SAVE);
|
||||||
|
GetWindowRect(hCtrl, &rc);
|
||||||
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
|
SetWindowPos(hCtrl, HWND_TOP, mw + fw - sbw, rc.top, sbw, rc.bottom - rc.top, 0);
|
||||||
|
|
||||||
|
if (advanced_mode_device) {
|
||||||
|
// Still need to adjust the width of the device selection dropdown
|
||||||
|
GetWindowRect(hDeviceList, &rc);
|
||||||
|
MapWindowPoints(NULL, hMainDialog, (POINT*)&rc, 2);
|
||||||
|
SetWindowPos(hDeviceList, HWND_TOP, rc.left, rc.top, fw - ssw - sbw, rc.bottom - rc.top, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resize the full width controls
|
||||||
|
for (i = 0; i < ARRAYSIZE(full_width_controls); i++) {
|
||||||
|
hCtrl = GetDlgItem(hDlg, full_width_controls[i]);
|
||||||
|
GetWindowRect(hCtrl, &rc);
|
||||||
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
|
SetWindowPos(hCtrl, HWND_TOP, rc.left, rc.top, fw, rc.bottom - rc.top, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resize the half drowpdowns
|
||||||
|
for (i = 0; i < ARRAYSIZE(half_width_ids); i++) {
|
||||||
|
hCtrl = GetDlgItem(hDlg, half_width_ids[i]);
|
||||||
|
GetWindowRect(hCtrl, &rc);
|
||||||
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
|
// First 5 controls are on the left handside
|
||||||
|
// First 2 controls may overflow into separator
|
||||||
|
SetWindowPos(hCtrl, HWND_TOP, (i < 5) ? rc.left : mw + hw + sw, rc.top,
|
||||||
|
(i <2) ? hw + sw : hw, rc.bottom - rc.top, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resize the boot selection dropdown
|
||||||
hCtrl = GetDlgItem(hDlg, IDC_BOOT_TYPE);
|
hCtrl = GetDlgItem(hDlg, IDC_BOOT_TYPE);
|
||||||
GetWindowRect(hCtrl, &rc);
|
GetWindowRect(hCtrl, &rc);
|
||||||
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
|
||||||
SetWindowPos(hCtrl, HWND_TOP, rc.left, rc.top, x - margin_width - small_sep_width, rc.bottom - rc.top, 0);
|
SetWindowPos(hCtrl, HWND_TOP, rc.left, rc.top, bsw, rc.bottom - rc.top, 0);
|
||||||
|
|
||||||
hCtrl = GetDlgItem(hDlg, IDC_DEVICE);
|
hCtrl = GetDlgItem(hDlg, IDC_DEVICE);
|
||||||
GetWindowRect(hCtrl, &rc);
|
GetWindowRect(hCtrl, &rc);
|
||||||
|
@ -2346,12 +2300,12 @@ void OnPaint(HDC hdc)
|
||||||
{
|
{
|
||||||
HPEN hp = CreatePen(0, 3, RGB(0, 0, 0));
|
HPEN hp = CreatePen(0, 3, RGB(0, 0, 0));
|
||||||
SelectObject(hdc, hp);
|
SelectObject(hdc, hp);
|
||||||
MoveToEx(hdc, margin_width + 10, device_vpos, NULL);
|
MoveToEx(hdc, mw + 10, device_vpos, NULL);
|
||||||
LineTo(hdc, margin_width + full_width, device_vpos);
|
LineTo(hdc, mw + fw, device_vpos);
|
||||||
MoveToEx(hdc, margin_width + 10, format_vpos, NULL);
|
MoveToEx(hdc, mw + 10, format_vpos, NULL);
|
||||||
LineTo(hdc, margin_width + full_width, format_vpos);
|
LineTo(hdc, mw + fw, format_vpos);
|
||||||
MoveToEx(hdc, margin_width + 10, status_vpos, NULL);
|
MoveToEx(hdc, mw + 10, status_vpos, NULL);
|
||||||
LineTo(hdc, margin_width + full_width, status_vpos);
|
LineTo(hdc, mw + fw, status_vpos);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitDialog(HWND hDlg)
|
static void InitDialog(HWND hDlg)
|
||||||
|
@ -2387,6 +2341,7 @@ static void InitDialog(HWND hDlg)
|
||||||
hStart = GetDlgItem(hDlg, IDC_START);
|
hStart = GetDlgItem(hDlg, IDC_START);
|
||||||
|
|
||||||
GetBasicControlsWidth(hDlg);
|
GetBasicControlsWidth(hDlg);
|
||||||
|
GetMainButtonsWidth(hDlg);
|
||||||
GetHalfDropwdownWidth(hDlg);
|
GetHalfDropwdownWidth(hDlg);
|
||||||
GetFullWidth(hDlg);
|
GetFullWidth(hDlg);
|
||||||
|
|
||||||
|
@ -2440,8 +2395,6 @@ static void InitDialog(HWND hDlg)
|
||||||
}
|
}
|
||||||
|
|
||||||
selection_default = BT_IMAGE;
|
selection_default = BT_IMAGE;
|
||||||
// Create the status line and initialize the taskbar icon for progress overlay
|
|
||||||
CreateStatusBar();
|
|
||||||
CreateTaskbarList();
|
CreateTaskbarList();
|
||||||
SetTaskbarProgressState(TASKBAR_NORMAL);
|
SetTaskbarProgressState(TASKBAR_NORMAL);
|
||||||
|
|
||||||
|
@ -2478,6 +2431,8 @@ static void InitDialog(HWND hDlg)
|
||||||
CreateAdditionalControls(hDlg);
|
CreateAdditionalControls(hDlg);
|
||||||
SetSectionHeaders(hDlg);
|
SetSectionHeaders(hDlg);
|
||||||
PositionControls(hDlg);
|
PositionControls(hDlg);
|
||||||
|
// Create the status line and initialize the taskbar icon for progress overlay
|
||||||
|
CreateStatusBar();
|
||||||
|
|
||||||
// Subclass the progress bar so that we can write on it
|
// Subclass the progress bar so that we can write on it
|
||||||
progress_original_proc = (WNDPROC)SetWindowLongPtr(hProgress, GWLP_WNDPROC, (LONG_PTR)ProgressCallback);
|
progress_original_proc = (WNDPROC)SetWindowLongPtr(hProgress, GWLP_WNDPROC, (LONG_PTR)ProgressCallback);
|
||||||
|
@ -2502,8 +2457,6 @@ static void InitDialog(HWND hDlg)
|
||||||
CreateTooltip(hPartitionScheme, lmprintf(MSG_150), -1);
|
CreateTooltip(hPartitionScheme, lmprintf(MSG_150), -1);
|
||||||
CreateTooltip(hTargetSystem, lmprintf(MSG_151), 30000);
|
CreateTooltip(hTargetSystem, lmprintf(MSG_151), 30000);
|
||||||
CreateTooltip(GetDlgItem(hDlg, IDS_CSM_HELP_TXT), lmprintf(MSG_152), 30000);
|
CreateTooltip(GetDlgItem(hDlg, IDS_CSM_HELP_TXT), lmprintf(MSG_152), 30000);
|
||||||
// CreateTooltip(GetDlgItem(hDlg, IDC_WINDOWS_INSTALL), lmprintf(MSG_199), -1);
|
|
||||||
// CreateTooltip(GetDlgItem(hDlg, IDC_WINDOWS_TO_GO), lmprintf(MSG_200), -1);
|
|
||||||
CreateTooltip(GetDlgItem(hDlg, IDC_HASH), lmprintf(MSG_272), -1);
|
CreateTooltip(GetDlgItem(hDlg, IDC_HASH), lmprintf(MSG_272), -1);
|
||||||
CreateTooltip(GetDlgItem(hDlg, IDC_SAVE), lmprintf(MSG_312), -1);
|
CreateTooltip(GetDlgItem(hDlg, IDC_SAVE), lmprintf(MSG_312), -1);
|
||||||
|
|
||||||
|
@ -2697,9 +2650,8 @@ static BOOL CheckDriveAccess(DWORD dwTimeOut)
|
||||||
if ((DeviceNum < 0x80) || (DeviceNum == (DWORD)-1))
|
if ((DeviceNum < 0x80) || (DeviceNum == (DWORD)-1))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// TODO: "Checking for conflicting processes..." would be better but
|
// "Checking for conflicting processes..."
|
||||||
// but "Requesting disk access..." will have to do for now.
|
PrintInfo(0, MSG_278);
|
||||||
PrintInfo(0, MSG_225);
|
|
||||||
|
|
||||||
// Search for any blocking processes against the physical drive
|
// Search for any blocking processes against the physical drive
|
||||||
PhysicalPath = GetPhysicalName(DeviceNum);
|
PhysicalPath = GetPhysicalName(DeviceNum);
|
||||||
|
@ -3216,6 +3168,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
||||||
GetDevices((DWORD)ComboBox_GetItemData(hDeviceList, ComboBox_GetCurSel(hDeviceList)));
|
GetDevices((DWORD)ComboBox_GetItemData(hDeviceList, ComboBox_GetCurSel(hDeviceList)));
|
||||||
user_changed_label = FALSE;
|
user_changed_label = FALSE;
|
||||||
EnableControls(TRUE);
|
EnableControls(TRUE);
|
||||||
|
if (ComboBox_GetCurSel(hDeviceList) < 0) {
|
||||||
|
SetPartitionSchemeAndTargetSystem(FALSE);
|
||||||
|
SetFileSystemAndClusterSize(NULL);
|
||||||
|
ShowWindow(GetDlgItem(hDlg, IDS_CSM_HELP_TXT), SW_HIDE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
queued_hotplug_event = TRUE;
|
queued_hotplug_event = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -3901,9 +3858,8 @@ relaunch:
|
||||||
// Alt-C => Cycle USB port for currently selected device
|
// Alt-C => Cycle USB port for currently selected device
|
||||||
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'C')) {
|
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'C')) {
|
||||||
int index = ComboBox_GetCurSel(hDeviceList);
|
int index = ComboBox_GetCurSel(hDeviceList);
|
||||||
if (index < 0)
|
if (index >= 0)
|
||||||
break;
|
ResetDevice(index);
|
||||||
ResetDevice(index);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Alt-D => Delete the 'rufus_files' subdirectory
|
// Alt-D => Delete the 'rufus_files' subdirectory
|
||||||
|
@ -3919,7 +3875,6 @@ relaunch:
|
||||||
WriteSettingBool(SETTING_ENABLE_WIN_DUAL_EFI_BIOS, allow_dual_uefi_bios);
|
WriteSettingBool(SETTING_ENABLE_WIN_DUAL_EFI_BIOS, allow_dual_uefi_bios);
|
||||||
PrintStatusTimeout(lmprintf(MSG_266), allow_dual_uefi_bios);
|
PrintStatusTimeout(lmprintf(MSG_266), allow_dual_uefi_bios);
|
||||||
SetPartitionSchemeAndTargetSystem(FALSE);
|
SetPartitionSchemeAndTargetSystem(FALSE);
|
||||||
// SetMBRForUEFI(TRUE);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Alt-F => Toggle detection of USB HDDs
|
// Alt-F => Toggle detection of USB HDDs
|
||||||
|
|
12
src/rufus.rc
12
src/rufus.rc
|
@ -38,12 +38,12 @@ 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
|
||||||
LTEXT "Device",IDS_DEVICE_TXT,8,22,216,8
|
LTEXT "Device",IDS_DEVICE_TXT,8,22,216,8
|
||||||
COMBOBOX IDC_DEVICE,8,31,197,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX IDC_DEVICE,8,31,196,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
PUSHBUTTON "...",IDC_SAVE,210,31,14,10,BS_ICON
|
PUSHBUTTON "...",IDC_SAVE,210,31,14,10,BS_ICON
|
||||||
LTEXT "Boot selection",IDS_BOOT_TYPE_TXT,8,44,216,8
|
LTEXT "Boot selection",IDS_BOOT_TYPE_TXT,8,44,216,8
|
||||||
COMBOBOX IDC_BOOT_TYPE,8,53,152,10,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
|
COMBOBOX IDC_BOOT_TYPE,8,53,148,10,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
|
||||||
PUSHBUTTON "#",IDC_HASH,165,53,9,10,BS_ICON
|
PUSHBUTTON "#",IDC_HASH,162,53,10,10,BS_ICON
|
||||||
PUSHBUTTON "SELECT",IDC_SELECT,178,53,46,10
|
PUSHBUTTON "SELECT",IDC_SELECT,180,53,45,10
|
||||||
LTEXT "Image option",IDS_IMAGE_OPTION_TXT,8,66,216,8
|
LTEXT "Image option",IDS_IMAGE_OPTION_TXT,8,66,216,8
|
||||||
COMBOBOX IDC_IMAGE_OPTION,8,75,216,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX IDC_IMAGE_OPTION,8,75,216,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
LTEXT "Partition scheme",IDS_PARTITION_TYPE_TXT,8,88,96,8
|
LTEXT "Partition scheme",IDS_PARTITION_TYPE_TXT,8,88,96,8
|
||||||
|
@ -76,8 +76,8 @@ BEGIN
|
||||||
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,272,216,9
|
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,272,216,9
|
||||||
PUSHBUTTON "Multi Toolbar",IDC_ABOUT,8,294,74,10,NOT WS_VISIBLE
|
PUSHBUTTON "Multi Toolbar",IDC_ABOUT,8,294,74,10,NOT WS_VISIBLE
|
||||||
PUSHBUTTON "T",IDC_TEST,90,294,12,10,NOT WS_VISIBLE
|
PUSHBUTTON "T",IDC_TEST,90,294,12,10,NOT WS_VISIBLE
|
||||||
DEFPUSHBUTTON "START",IDC_START,128,294,45,10
|
DEFPUSHBUTTON "START",IDC_START,124,294,45,10
|
||||||
PUSHBUTTON "CLOSE",IDCANCEL,181,294,43,10
|
PUSHBUTTON "CLOSE",IDCANCEL,178,294,45,10
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_ABOUTBOX DIALOGEX 0, 0, 319, 237
|
IDD_ABOUTBOX DIALOGEX 0, 0, 319, 237
|
||||||
|
|
|
@ -0,0 +1,167 @@
|
||||||
|
/*
|
||||||
|
* Rufus: The Reliable USB Formatting Utility
|
||||||
|
* UI element lists
|
||||||
|
* Copyright © 2018 Pete Batard <pete@akeo.ie>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
static int image_option_move_ids[] = {
|
||||||
|
IDS_PARTITION_TYPE_TXT,
|
||||||
|
IDC_PARTITION_TYPE,
|
||||||
|
IDS_TARGET_SYSTEM_TXT,
|
||||||
|
IDC_TARGET_SYSTEM,
|
||||||
|
IDS_CSM_HELP_TXT,
|
||||||
|
IDC_ADVANCED_DEVICE_TOOLBAR,
|
||||||
|
IDC_LIST_USB_HDD,
|
||||||
|
IDC_OLD_BIOS_FIXES,
|
||||||
|
IDC_RUFUS_MBR,
|
||||||
|
IDC_DISK_ID,
|
||||||
|
IDS_FORMAT_OPTIONS_TXT,
|
||||||
|
IDS_LABEL_TXT,
|
||||||
|
IDC_LABEL,
|
||||||
|
IDS_FILESYSTEM_TXT,
|
||||||
|
IDC_FILESYSTEM,
|
||||||
|
IDS_CLUSTERSIZE_TXT,
|
||||||
|
IDC_CLUSTERSIZE,
|
||||||
|
IDC_ADVANCED_FORMAT_TOOLBAR,
|
||||||
|
IDC_QUICKFORMAT,
|
||||||
|
IDC_BADBLOCKS,
|
||||||
|
IDC_NBPASSES,
|
||||||
|
IDC_EXTENDED_LABEL,
|
||||||
|
IDS_STATUS_TXT,
|
||||||
|
IDC_PROGRESS,
|
||||||
|
IDC_ABOUT,
|
||||||
|
IDC_LOG,
|
||||||
|
IDC_MULTI_TOOLBAR,
|
||||||
|
IDC_TEST,
|
||||||
|
IDC_START,
|
||||||
|
IDCANCEL,
|
||||||
|
IDC_STATUS,
|
||||||
|
IDC_STATUS_TOOLBAR,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int image_option_toggle_ids[] = {
|
||||||
|
IDS_IMAGE_OPTION_TXT,
|
||||||
|
IDC_IMAGE_OPTION,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int advanced_device_move_ids[] = {
|
||||||
|
IDC_LIST_USB_HDD,
|
||||||
|
IDC_OLD_BIOS_FIXES,
|
||||||
|
IDC_RUFUS_MBR,
|
||||||
|
IDS_FORMAT_OPTIONS_TXT,
|
||||||
|
IDS_LABEL_TXT,
|
||||||
|
IDC_LABEL,
|
||||||
|
IDS_FILESYSTEM_TXT,
|
||||||
|
IDC_FILESYSTEM,
|
||||||
|
IDS_CLUSTERSIZE_TXT,
|
||||||
|
IDC_CLUSTERSIZE,
|
||||||
|
IDC_ADVANCED_FORMAT_TOOLBAR,
|
||||||
|
IDC_QUICKFORMAT,
|
||||||
|
IDC_BADBLOCKS,
|
||||||
|
IDC_NBPASSES,
|
||||||
|
IDC_EXTENDED_LABEL,
|
||||||
|
IDS_STATUS_TXT,
|
||||||
|
IDC_PROGRESS,
|
||||||
|
IDC_ABOUT,
|
||||||
|
IDC_LOG,
|
||||||
|
IDC_MULTI_TOOLBAR,
|
||||||
|
IDC_TEST,
|
||||||
|
IDC_START,
|
||||||
|
IDCANCEL,
|
||||||
|
IDC_STATUS,
|
||||||
|
IDC_STATUS_TOOLBAR,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int advanced_device_toggle_ids[] = {
|
||||||
|
IDC_SAVE,
|
||||||
|
IDC_LIST_USB_HDD,
|
||||||
|
IDC_OLD_BIOS_FIXES,
|
||||||
|
IDC_RUFUS_MBR,
|
||||||
|
IDC_DISK_ID,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int advanced_format_move_ids[] = {
|
||||||
|
IDS_STATUS_TXT,
|
||||||
|
IDC_PROGRESS,
|
||||||
|
IDC_ABOUT,
|
||||||
|
IDC_LOG,
|
||||||
|
IDC_MULTI_TOOLBAR,
|
||||||
|
IDC_TEST,
|
||||||
|
IDC_START,
|
||||||
|
IDCANCEL,
|
||||||
|
IDC_STATUS,
|
||||||
|
IDC_STATUS_TOOLBAR,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int advanced_format_toggle_ids[] = {
|
||||||
|
IDC_QUICKFORMAT,
|
||||||
|
IDC_BADBLOCKS,
|
||||||
|
IDC_NBPASSES,
|
||||||
|
IDC_EXTENDED_LABEL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int dd_image_toggle_ids[] = {
|
||||||
|
IDC_QUICKFORMAT,
|
||||||
|
IDC_PARTITION_TYPE,
|
||||||
|
IDC_TARGET_SYSTEM,
|
||||||
|
IDC_IMAGE_OPTION,
|
||||||
|
IDC_FILESYSTEM,
|
||||||
|
IDC_CLUSTERSIZE,
|
||||||
|
IDC_LABEL,
|
||||||
|
IDC_QUICKFORMAT,
|
||||||
|
IDC_EXTENDED_LABEL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int main_button_ids[] = {
|
||||||
|
IDC_SELECT,
|
||||||
|
IDC_START,
|
||||||
|
IDCANCEL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int full_width_controls[] = {
|
||||||
|
IDS_DEVICE_TXT,
|
||||||
|
IDS_BOOT_TYPE_TXT,
|
||||||
|
IDS_IMAGE_OPTION_TXT,
|
||||||
|
IDC_IMAGE_OPTION,
|
||||||
|
IDS_LABEL_TXT,
|
||||||
|
IDC_LABEL,
|
||||||
|
IDC_ADVANCED_DRIVE_PROPERTIES,
|
||||||
|
IDC_LIST_USB_HDD,
|
||||||
|
IDC_OLD_BIOS_FIXES,
|
||||||
|
IDC_ADVANCED_FORMAT_OPTIONS,
|
||||||
|
IDC_QUICKFORMAT,
|
||||||
|
IDC_EXTENDED_LABEL,
|
||||||
|
IDC_PROGRESS,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int half_width_ids[] = {
|
||||||
|
IDC_BADBLOCKS,
|
||||||
|
IDC_RUFUS_MBR,
|
||||||
|
IDS_PARTITION_TYPE_TXT,
|
||||||
|
IDC_PARTITION_TYPE,
|
||||||
|
IDC_FILESYSTEM,
|
||||||
|
IDS_TARGET_SYSTEM_TXT,
|
||||||
|
IDC_TARGET_SYSTEM,
|
||||||
|
IDC_DISK_ID,
|
||||||
|
IDS_CLUSTERSIZE_TXT,
|
||||||
|
IDC_CLUSTERSIZE,
|
||||||
|
IDC_NBPASSES,
|
||||||
|
};
|
Loading…
Reference in New Issue