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

[internal] UI redesign, part 5

* Mistakes were made...
This commit is contained in:
Pete Batard 2018-02-11 19:32:58 +00:00
parent 4f6dbbbdd4
commit c27ad743d5
7 changed files with 194 additions and 123 deletions

View file

@ -100,7 +100,7 @@ g IDD_DIALOG
t IDS_DEVICE_SETTINGS_TXT "Device Settings"
t IDS_DEVICE_TXT "Device"
# TODO: use MSG_278 for translations
t IDS_BOOT_TYPE_TXT "Boot type"
t IDS_BOOT_TYPE_TXT "Boot selection"
t IDC_SELECT_IMAGE "SELECT"
t IDS_IMAGE_OPTION_TXT "Image Option"
t IDS_PARTITION_TYPE_TXT "Partition scheme"
@ -123,8 +123,6 @@ t IDC_QUICKFORMAT "Quick format"
t IDC_BADBLOCKS "Check device for bad blocks"
t IDC_EXTENDED_LABEL "Create extended label and icon files"
t IDS_STATUS_TXT "Status"
t IDC_ABOUT "About..."
t IDC_LOG "Log"
t IDCANCEL "CLOSE"
t IDC_START "START"
t IDS_ADVANCED_OPTIONS_GRP "Advanced Options"
@ -133,7 +131,6 @@ t IDS_ADVANCED_OPTIONS_GRP "Advanced Options"
g IDD_ABOUTBOX
t IDD_ABOUTBOX "About Rufus"
t IDC_ABOUT_LICENSE "License"
t IDC_ABOUT_UPDATES "Updates"
t IDOK "OK"
# About -> License dialog
@ -579,6 +576,12 @@ t MSG_301 "Standard Windows installation"
t MSG_302 "Windows To Go"
t MSG_303 "Disk or ISO image"
t MSG_304 "%s (Please select)"
t MSG_305 "Settings"
# Was 'IDC_ABOUT'
t MSG_306 "About"
# Was 'IDC_LOG'
t MSG_307 "Log"
################################################################################
@ -5295,8 +5298,8 @@ t MSG_003 "ATTENTION : TOUTES LES DONNEES DU VOLUME '%s' VONT ETRE EFFACEES.\n"
"Pour continuer cette opération, cliquez sur OK.\nPour quitter cliquez sur ANNULER."
t MSG_004 "Mises à jour"
t MSG_005 "Voulez-vous autoriser Rufus à chercher des mises à jour en ligne?"
t MSG_006 "Fermer"
t MSG_007 "Annuler"
t MSG_006 "FERMER"
t MSG_007 "ANNULER"
t MSG_008 "Oui"
t MSG_009 "Non"
t MSG_010 "Blocs défectueux détectés"
@ -5328,7 +5331,7 @@ t MSG_034 "%d passe"
t MSG_035 "%d passes"
t MSG_036 "Image ISO"
t MSG_037 "Application"
t MSG_038 "ANNULER"
t MSG_038 "Annuler"
t MSG_039 "Lancer"
t MSG_040 "Télécharger"
t MSG_041 "Opération annulée par l'utilisateur"

View file

@ -68,7 +68,6 @@ const loc_control_id control_id[] = {
LOC_CTRL(IDC_IMAGE_OPTION),
LOC_CTRL(IDC_ABOUT_LICENSE),
LOC_CTRL(IDC_ABOUT_ICON),
LOC_CTRL(IDC_ABOUT_UPDATES),
LOC_CTRL(IDC_ABOUT_COPYRIGHTS),
LOC_CTRL(IDC_ABOUT_BLURB),
LOC_CTRL(IDC_LICENSE_TEXT),

View file

@ -104,7 +104,6 @@
#define IDC_IMAGE_OPTION 1029
#define IDC_ABOUT_LICENSE 1030
#define IDC_ABOUT_ICON 1031
#define IDC_ABOUT_UPDATES 1032
#define IDC_ABOUT_COPYRIGHTS 1033
#define IDC_ABOUT_BLURB 1034
#define IDC_LICENSE_TEXT 1035

View file

@ -166,7 +166,7 @@ static int64_t last_iso_blocking_status;
// 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 device_vpos, format_vpos, status_vpos;
static int cb_width, dd_width, sep_width, margin_width, half_width, full_width;
static int cb_width, dd_width, sep_width, margin_width, half_width, full_width, hash_button_width, small_button_width, small_sep_width;
static UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU;
static RECT relaunch_rc = { -65536, -65536, 0, 0};
static UINT uQFChecked = BST_CHECKED, uMBRChecked = BST_UNCHECKED;
@ -1250,34 +1250,35 @@ static void SetPassesTooltip(void)
static void ResizeDialogs(int shift)
{
RECT rect;
RECT rc;
POINT point;
// Resize the main dialog
GetWindowRect(hMainDialog, &rect);
point.x = (rect.right - rect.left);
point.y = (rect.bottom - rect.top);
MoveWindow(hMainDialog, rect.left, rect.top, point.x, point.y + shift, TRUE);
GetWindowRect(hMainDialog, &rc);
point.x = (rc.right - rc.left);
point.y = (rc.bottom - rc.top);
MoveWindow(hMainDialog, rc.left, rc.top, point.x, point.y + shift, TRUE);
// Resize the log
GetWindowRect(hLogDlg, &rect);
point.x = (rect.right - rect.left);
point.y = (rect.bottom - rect.top);
MoveWindow(hLogDlg, rect.left, rect.top, point.x, point.y + shift, TRUE);
GetWindowRect(hLogDlg, &rc);
point.x = (rc.right - rc.left);
point.y = (rc.bottom - rc.top);
MoveWindow(hLogDlg, rc.left, rc.top, point.x, point.y + shift, TRUE);
MoveCtrlY(hLogDlg, IDC_LOG_CLEAR, shift);
MoveCtrlY(hLogDlg, IDC_LOG_SAVE, shift);
MoveCtrlY(hLogDlg, IDCANCEL, shift);
GetWindowRect(hLog, &rect);
point.x = (rect.right - rect.left);
point.y = (rect.bottom - rect.top) + shift;
GetWindowRect(hLog, &rc);
point.x = (rc.right - rc.left);
point.y = (rc.bottom - rc.top) + shift;
SetWindowPos(hLog, NULL, 0, 0, point.x, point.y, SWP_NOZORDER);
// Don't forget to scroll the edit to the bottom after resize
Edit_Scroll(hLog, 0, Edit_GetLineCount(hLog));
}
// Toggle "advanced" mode
static void ToggleAdvancedDevice(BOOL enable)
static void ToggleAdvancedDeviceOptions(BOOL enable)
{
RECT rc;
int i, shift = advanced_device_section_height;
if (!enable)
@ -1295,6 +1296,11 @@ static void ToggleAdvancedDevice(BOOL enable)
for (i = 0; i<ARRAYSIZE(advanced_device_toggle_ids); i++)
ShowWindow(GetDlgItem(hMainDialog, advanced_device_toggle_ids[i]), enable ? SW_SHOW : SW_HIDE);
GetWindowRect(hDeviceList, &rc);
MapWindowPoints(NULL, hMainDialog, (POINT*)&rc, 2);
SetWindowPos(hDeviceList, HWND_TOP, rc.left, rc.top,
enable ? full_width - small_sep_width - small_button_width : full_width, rc.bottom - rc.top, 0);
// Resize the main dialog and log window
ResizeDialogs(shift);
@ -1302,7 +1308,7 @@ static void ToggleAdvancedDevice(BOOL enable)
InvalidateRect(hMainDialog, NULL, TRUE);
}
static void ToggleAdvancedFormat(BOOL enable)
static void ToggleAdvancedFormatOptions(BOOL enable)
{
int i, shift = advanced_format_section_height; // -show_advanced_height;
@ -1386,27 +1392,15 @@ static __inline void ToggleHash(void)
EnableWindow(GetDlgItem(hMainDialog, IDC_HASH), (bt == BT_IMAGE) && (image_path != NULL));
}
// Insert the image name into the Boot selection dropdown
static void UpdateImage(void)
static void SetBootTypeDropdownWidth()
{
int index;
HDC hDC;
HFONT hFont;
SIZE sz;
RECT rc;
for (index = 0; index < ComboBox_GetCount(hBootType); index++) {
if (ComboBox_GetItemData(hBootType, index) == BT_IMAGE) {
break;
}
}
// TODO: ultimately we may want to keep a list of most recent images
if (image_path != NULL) {
ComboBox_DeleteString(hBootType, index);
ComboBox_InsertStringU(hBootType, index, short_image_path);
ComboBox_SetItemData(hBootType, index, BT_IMAGE);
if (image_path == NULL)
return;
// Set the maximum width of the dropdown according to the image selected
GetWindowRect(hBootType, &rc);
MapWindowPoints(NULL, hMainDialog, (POINT*)&rc, 2);
@ -1415,9 +1409,27 @@ static void UpdateImage(void)
SelectObject(hDC, hFont);
GetTextExtentPointU(hDC, short_image_path, &sz);
safe_release_dc(hBootType, hDC);
SendMessage(hBootType, CB_SETDROPPEDWIDTH, (WPARAM)max(sz.cx + 10, rc.right - rc.left), (LPARAM)0);
}
// Insert the image name into the Boot selection dropdown
static void UpdateImage(void)
{
int index;
for (index = 0; index < ComboBox_GetCount(hBootType); index++) {
if (ComboBox_GetItemData(hBootType, index) == BT_IMAGE) {
break;
}
}
// TODO: Ultimately we may want to keep a list of most recent images
if (image_path != NULL) {
ComboBox_DeleteString(hBootType, index);
ComboBox_InsertStringU(hBootType, index, short_image_path);
ComboBox_SetItemData(hBootType, index, BT_IMAGE);
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, index));
SetBootTypeDropdownWidth();
}
}
@ -1474,7 +1486,7 @@ DWORD WINAPI ISOScanThread(LPVOID param)
SetMBRProps();
} else {
// Set Target and FS accordingly
// TODO
// TODO - Doesn't seem to work for Windows ISOs
if (img_report.is_iso) {
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, image_index));
SetPartitionSchemeAndTargetSystem(FALSE);
@ -1886,6 +1898,7 @@ static void CreateAdditionalControls(HWND hDlg)
HINSTANCE hDll;
HIMAGELIST hToolbarImageList;
RECT rc;
SIZE sz;
static wchar_t wtbtext[2][128];
int i16, s16, toolbar_fudge = -6;
TBBUTTON tbToolbarButtons[7];
@ -1935,7 +1948,8 @@ static void CreateAdditionalControls(HWND hDlg)
memset(wtbtext, 0, sizeof(wtbtext));
GetWindowTextW(GetDlgItem(hDlg, IDC_ADVANCED_DEVICE_SETTINGS), wtbtext[0], ARRAYSIZE(wtbtext[0]));
hAdvancedDeviceToolBar = CreateWindowExW(0, TOOLBARCLASSNAME, NULL,
WS_CHILD | WS_TABSTOP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NOPARENTALIGN | CCS_NODIVIDER | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE,
WS_CHILD | WS_TABSTOP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NOPARENTALIGN |
CCS_NODIVIDER | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE,
0, 0, 0, 0, hMainDialog, (HMENU)IDC_ADVANCED_DEVICE_TOOLBAR, hMainInstance, NULL);
SendMessage(hAdvancedDeviceToolBar, CCM_SETVERSION, (WPARAM)6, 0);
memset(tbToolbarButtons, 0, sizeof(TBBUTTON));
@ -1949,11 +1963,13 @@ static void CreateAdditionalControls(HWND hDlg)
SendMessage(hAdvancedDeviceToolBar, TB_ADDBUTTONS, 1, (LPARAM)&tbToolbarButtons);
GetWindowRect(GetDlgItem(hDlg, IDC_ADVANCED_DEVICE_SETTINGS), &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
SetWindowPos(hAdvancedDeviceToolBar, HWND_TOP, rc.left + toolbar_fudge, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0);
SendMessage(hAdvancedDeviceToolBar, TB_GETIDEALSIZE, (WPARAM)FALSE, (LPARAM)&sz);
SetWindowPos(hAdvancedDeviceToolBar, HWND_TOP, rc.left + toolbar_fudge, rc.top, sz.cx, rc.bottom - rc.top, 0);
GetWindowTextW(GetDlgItem(hDlg, IDC_ADVANCED_FORMAT_OPTIONS), wtbtext[1], ARRAYSIZE(wtbtext[1]));
hAdvancedFormatToolBar = CreateWindowExW(0, TOOLBARCLASSNAME, NULL,
WS_CHILD | WS_TABSTOP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NOPARENTALIGN | CCS_NODIVIDER | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE,
WS_CHILD | WS_TABSTOP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NOPARENTALIGN |
CCS_NODIVIDER | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE,
0, 0, 0, 0, hMainDialog, (HMENU)IDC_ADVANCED_FORMAT_TOOLBAR, hMainInstance, NULL);
SendMessage(hAdvancedFormatToolBar, CCM_SETVERSION, (WPARAM)6, 0);
memset(tbToolbarButtons, 0, sizeof(TBBUTTON));
@ -1967,12 +1983,13 @@ static void CreateAdditionalControls(HWND hDlg)
SendMessage(hAdvancedFormatToolBar, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&tbToolbarButtons);
GetWindowRect(GetDlgItem(hDlg, IDC_ADVANCED_FORMAT_OPTIONS), &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
SetWindowPos(hAdvancedFormatToolBar, HWND_TOP, rc.left + toolbar_fudge, rc.top, rc.right, rc.bottom, 0);
SendMessage(hAdvancedFormatToolBar, TB_GETIDEALSIZE, (WPARAM)FALSE, (LPARAM)&sz);
SetWindowPos(hAdvancedFormatToolBar, HWND_TOP, rc.left + toolbar_fudge, rc.top, sz.cx, rc.bottom - rc.top, 0);
// Create the language toolbar
hMultiToolbar = CreateWindowExW(0, TOOLBARCLASSNAME, NULL,
WS_CHILD | WS_TABSTOP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NOPARENTALIGN | CCS_NODIVIDER | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE,
// WS_CHILD | WS_TABSTOP | TBSTYLE_TRANSPARENT | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_NODIVIDER,
WS_CHILD | WS_TABSTOP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NOPARENTALIGN |
CCS_NODIVIDER | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE,
0, 0, 0, 0, hMainDialog, (HMENU)IDC_MULTI_TOOLBAR, hMainInstance, NULL);
hToolbarImageList = ImageList_Create(i16, i16, ILC_COLOR32, 4, 0);
ImageList_AddIcon(hToolbarImageList, hIconAbout);
@ -2035,28 +2052,6 @@ static inline int GetTextWidth(HWND hDlg, int id)
return GetTextSize(GetDlgItem(hDlg, id), NULL).cx;
}
// TODO: START and right half-dropdowns should be aligned which means
// half dropdown size should set to 2 x button size + spacing
static void SetButtonWidth(HWND hDlg)
{
RECT rc;
// TODO: width should be set according to DPI
int i, width = 00, control[3] = { IDC_SELECT_IMAGE, IDC_START, IDCANCEL };
for (i = 0; i < ARRAYSIZE(control); i++)
width = max(GetTextWidth(hDlg, control[i]), width);
// The 'CLOSE' button is also be used to display 'CANCEL' => measure that too
width = max(width, GetTextSize(GetDlgItem(hDlg, IDCANCEL), lmprintf(MSG_007)).cx);
// Use cb_width for how much border we should add
width += cb_width;
uprintf("MAX BUTTON = %d", width);
for (i = 0; i < ARRAYSIZE(control); i++) {
GetWindowRect(GetDlgItem(hDlg, control[i]), &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
SetWindowPos(GetDlgItem(hDlg, control[i]), HWND_TOP, rc.left, rc.top, width, rc.bottom - rc.top, 0);
}
}
// 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)
// to figure out the minimum width we should allocate.
@ -2155,7 +2150,7 @@ static void GetFullWidth(HWND hDlg)
// https://stackoverflow.com/a/20926332/1069307
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb226818.aspx
static void GetEmptyControlsWidth(HWND hDlg)
static void GetBasicControlsWidth(HWND hDlg)
{
int checkbox_internal_spacing = 12;
// const int dluCheckboxHeight = 10; // 10 vertical dlus
@ -2207,6 +2202,19 @@ static void GetEmptyControlsWidth(HWND hDlg)
margin_width = rc.left;
uprintf("SEP WIDTH = %d, MARGIN WIDTH = %d", sep_width, rc.left);
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;
uprintf("SMALL BUTTON WIDTH = %d, SMALL SEP WIDTH = %d", small_button_width, small_sep_width);
GetWindowRect(GetDlgItem(hDlg, IDC_HASH), &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
hash_button_width = rc.right - rc.left;
uprintf("HASH BUTTON WIDTH = %d", hash_button_width);
}
static void SetSectionHeaders(HWND hDlg)
@ -2243,9 +2251,8 @@ static void PositionControls(HWND hDlg)
SIZE sz;
// TODO: dynamicize button_fudge
int dropdown_height, button_fudge = 2;
GetHalfDropwdownWidth(hDlg);
GetFullWidth(hDlg);
// 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_IMAGE, IDC_START, IDCANCEL };
// Resize the height of the label and progress bar to the height of standard dropdowns
hCtrl = GetDlgItem(hDlg, IDC_DEVICE);
@ -2332,7 +2339,36 @@ static void PositionControls(HWND hDlg)
SetWindowPos(hCtrl, NULL, rc.left, rc.top,
rc.right - rc.left, dropdown_height + button_fudge, SWP_NOZORDER);
// TODO: Reposition
// Reposition the main buttons
for (i = 0; i < ARRAYSIZE(control); i++)
width = max(GetTextWidth(hDlg, control[i]) + cb_width, width);
// 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);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
if (i % 2 == 0)
x = margin_width + full_width - width;
else
x = rc.left;
SetWindowPos(hCtrl, HWND_TOP, x, rc.top, width, rc.bottom - rc.top, 0);
}
// Reposition the Hash button
hCtrl = GetDlgItem(hDlg, IDC_HASH);
GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
x -= small_sep_width + hash_button_width;
SetWindowPos(hCtrl, HWND_TOP, x, rc.top, hash_button_width, rc.bottom - rc.top, 0);
// Resize the boot selection button
hCtrl = GetDlgItem(hDlg, IDC_BOOTTYPE);
GetWindowRect(hCtrl, &rc);
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);
hCtrl = GetDlgItem(hDlg, IDC_DEVICE);
GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
@ -2358,12 +2394,12 @@ void OnPaint(HDC hdc)
{
HPEN hp = CreatePen(0, 3, RGB(0, 0, 0));
SelectObject(hdc, hp);
MoveToEx(hdc, 50, device_vpos, NULL);
LineTo(hdc, 700, device_vpos);
MoveToEx(hdc, 50, format_vpos, NULL);
LineTo(hdc, 700, format_vpos);
MoveToEx(hdc, 50, status_vpos, NULL);
LineTo(hdc, 700, status_vpos);
MoveToEx(hdc, margin_width + 10, device_vpos, NULL);
LineTo(hdc, margin_width + full_width, device_vpos);
MoveToEx(hdc, margin_width + 10, format_vpos, NULL);
LineTo(hdc, margin_width + full_width, format_vpos);
MoveToEx(hdc, margin_width + 10, status_vpos, NULL);
LineTo(hdc, margin_width + full_width, status_vpos);
}
static void InitDialog(HWND hDlg)
@ -2398,7 +2434,9 @@ static void InitDialog(HWND hDlg)
hDiskID = GetDlgItem(hDlg, IDC_DISK_ID);
hStart = GetDlgItem(hDlg, IDC_START);
GetEmptyControlsWidth(hDlg);
GetBasicControlsWidth(hDlg);
GetHalfDropwdownWidth(hDlg);
GetFullWidth(hDlg);
// TODO: Don't think this is used
// Create the font and brush for the Info edit box
@ -2495,7 +2533,6 @@ static void InitDialog(HWND hDlg)
CreateAdditionalControls(hDlg);
SetSectionHeaders(hDlg);
SetButtonWidth(hDlg);
PositionControls(hDlg);
// Subclass the progress bar so that we can write on it
@ -2521,15 +2558,14 @@ static void InitDialog(HWND hDlg)
// 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(hMultiToolbar, lmprintf(MSG_273), -1);
// Set a label for the Advanced Mode and Select Image button for screen readers
// SetWindowTextU(GetDlgItem(hDlg, IDC_ADVANCED), lmprintf(MSG_160));
if (!advanced_mode_device) // Hide as needed, since we display the advanced controls by default
ToggleAdvancedDevice(FALSE);
ToggleAdvancedDeviceOptions(FALSE);
if (!advanced_mode_format)
ToggleAdvancedFormat(FALSE);
ToggleAdvancedFormatOptions(FALSE);
// ShowImageSettings(NULL);
ToggleImageOption();
ToggleHash();
@ -2539,6 +2575,7 @@ static void InitDialog(HWND hDlg)
// Simulate a button click for image selection
PostMessage(hDlg, WM_COMMAND, IDC_SELECT_IMAGE, 0);
}
SetBootTypeDropdownWidth();
PrintInfo(0, MSG_210);
}
@ -2790,6 +2827,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
static SHChangeNotifyEntry NotifyEntry;
static DWORD_PTR thread_affinity[4];
DRAWITEMSTRUCT* pDI;
LPTOOLTIPTEXT lpttt;
HDROP droppedFileInfo;
POINT Point;
RECT rc, DialogRect, DesktopRect;
@ -2800,6 +2838,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
char tmp[128];
wchar_t* wbuffer = NULL;
loc_cmd* lcmd = NULL;
wchar_t wtooltip[128];
switch (message) {
@ -2912,15 +2951,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
break;
case IDC_ADVANCED_DEVICE_SETTINGS:
advanced_mode_device = !advanced_mode_device;
WriteSettingBool(SETTING_ADVANCED_MODE, advanced_mode_device);
ToggleAdvancedDevice(advanced_mode_device);
WriteSettingBool(SETTING_ADVANCED_MODE_DEVICE, advanced_mode_device);
ToggleAdvancedDeviceOptions(advanced_mode_device);
SetBootOptions();
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE << 16) | IDC_FILESYSTEM,
ComboBox_GetCurSel(hFileSystem));
break;
case IDC_ADVANCED_FORMAT_OPTIONS:
advanced_mode_format = !advanced_mode_format;
ToggleAdvancedFormat(advanced_mode_format);
WriteSettingBool(SETTING_ADVANCED_MODE_FORMAT, advanced_mode_format);
ToggleAdvancedFormatOptions(advanced_mode_format);
break;
case IDC_LABEL:
if (HIWORD(wParam) == EN_CHANGE) {
@ -3032,16 +3072,23 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
uprintf("\r\nImage provided: '%s'", image_path);
iso_provided = FALSE; // One off thing...
} else {
char* old_image_path = image_path;
// If declared globaly, lmprintf(MSG_036) would be called on each message...
EXT_DECL(img_ext, NULL, __VA_GROUP__("*.iso;*.img;*.vhd;*.gz;*.bzip2;*.bz2;*.xz;*.lzma;*.Z;*.zip"),
__VA_GROUP__(lmprintf(MSG_036)));
safe_free(image_path);
EnableWindow(hStatusToolbar, FALSE);
image_path = FileDialog(FALSE, NULL, &img_ext, 0);
if (image_path == NULL) {
if (old_image_path != NULL) {
// Reselect previous image
image_path = old_image_path;
} else {
CreateTooltip(hSelectImage, lmprintf(MSG_173), -1);
PrintStatus(0, MSG_086);
}
break;
} else {
free(old_image_path);
}
}
FormatStatus = 0;
@ -3177,8 +3224,13 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
// by using the the next button (LOG) as our starting point.
SendMessage(hMultiToolbar, TB_GETRECT, (WPARAM)IDC_LOG, (LPARAM)&rc);
MapWindowPoints(hDlg, NULL, (POINT*)&rc, 2);
// TODO: add a proper fudge
rc.left += 10;
ShowLanguageMenu(rc);
break;
case IDC_SETTINGS:
MyDialogBox(hMainInstance, IDD_UPDATE_POLICY, hDlg, UpdateCallback);
break;
case IDC_HASH:
if ((format_thid == NULL) && (image_path != NULL)) {
FormatStatus = 0;
@ -3208,6 +3260,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
}
}
break;
case IDC_SAVE:
SaveVHD();
break;
default:
return (INT_PTR)FALSE;
}
@ -3336,6 +3391,32 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
}
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case TTN_GETDISPINFO:
lpttt = (LPTOOLTIPTEXT)lParam;
switch (lpttt->hdr.idFrom) {
case IDC_ABOUT:
utf8_to_wchar_no_alloc(lmprintf(MSG_306), wtooltip, ARRAYSIZE(wtooltip));
lpttt->lpszText = wtooltip;
break;
case IDC_SETTINGS:
utf8_to_wchar_no_alloc(lmprintf(MSG_305), wtooltip, ARRAYSIZE(wtooltip));
lpttt->lpszText = wtooltip;
break;
case IDC_LANG:
utf8_to_wchar_no_alloc(lmprintf(MSG_273), wtooltip, ARRAYSIZE(wtooltip));
lpttt->lpszText = wtooltip;
break;
case IDC_LOG:
utf8_to_wchar_no_alloc(lmprintf(MSG_307), wtooltip, ARRAYSIZE(wtooltip));
lpttt->lpszText = wtooltip;
break;
}
break;
}
break;
case WM_DROPFILES:
droppedFileInfo = (HDROP)wParam;
wbuffer = calloc(MAX_PATH, sizeof(wchar_t));
@ -3699,8 +3780,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
}
// Restore user-saved settings
advanced_mode_device = ReadSettingBool(SETTING_ADVANCED_MODE);
advanced_mode_format = FALSE;
advanced_mode_device = ReadSettingBool(SETTING_ADVANCED_MODE_DEVICE);
advanced_mode_format = ReadSettingBool(SETTING_ADVANCED_MODE_FORMAT);
preserve_timestamps = ReadSettingBool(SETTING_PRESERVE_TIMESTAMPS);
use_fake_units = !ReadSettingBool(SETTING_USE_PROPER_SIZE_UNITS);
usb_debug = ReadSettingBool(SETTING_ENABLE_USB_DEBUG);
@ -3865,7 +3946,7 @@ relaunch:
// Do our own event processing and process "magic" commands
while(GetMessage(&msg, NULL, 0, 0)) {
// ** ***** **** ** **********
// ** ***** **** ** ***** ****
// .,ABCDEFGHIJKLMNOPQRSTUVWXYZ
// Ctrl-A => Select the log data
@ -4020,11 +4101,6 @@ relaunch:
GetDevices(0);
continue;
}
// Alt-V => Save selected device to *UNCOMPRESSED* VHD
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'V')) {
SaveVHD();
continue;
}
// Alt-W => Enable VMWare disk detection
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'W')) {
enable_vmdk = !enable_vmdk;

View file

@ -37,51 +37,51 @@ CAPTION "Rufus 3.0.1220"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device Settings",IDS_DEVICE_SETTINGS_TXT,8,6,53,12,NOT WS_GROUP
LTEXT "Device",IDS_DEVICE_TXT,8,22,101,8
COMBOBOX IDC_DEVICE,8,31,195,33,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_SAVE,206,31,21,10,BS_ICON
LTEXT "Boot type",IDS_BOOT_TYPE_TXT,8,44,165,8
COMBOBOX IDC_BOOTTYPE,8,53,159,30,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
PUSHBUTTON "#",IDC_HASH,170,53,11,10,BS_ICON
PUSHBUTTON "SELECT",IDC_SELECT_IMAGE,183,53,44,10
LTEXT "Image option",IDS_IMAGE_OPTION_TXT,8,66,201,8
LTEXT "Device",IDS_DEVICE_TXT,8,22,216,8
COMBOBOX IDC_DEVICE,8,31,197,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_SAVE,210,31,14,10,BS_ICON
LTEXT "Boot selection",IDS_BOOT_TYPE_TXT,8,44,216,8
COMBOBOX IDC_BOOTTYPE,8,53,152,10,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
PUSHBUTTON "#",IDC_HASH,165,53,9,10,BS_ICON
PUSHBUTTON "SELECT",IDC_SELECT_IMAGE,178,53,46,10
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
LTEXT "Partition scheme",IDS_PARTITION_TYPE_TXT,8,88,96,8
COMBOBOX IDC_PARTITION_TYPE,8,97,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Target system",IDS_TARGET_SYSTEM_TXT,128,88,96,8
COMBOBOX IDC_TARGET_SYSTEM,128,97,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Advanced Device Settings",IDC_ADVANCED_DEVICE_SETTINGS,
"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,8,110,221,10
"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,8,110,216,10
CONTROL "List USB Hard Drives",IDC_LIST_USB_HDD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,120,216,10
CONTROL "Add fixes for old BIOSes (extra partition, align, etc.)",IDC_OLD_BIOS_FIXES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,130,216,10
CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,140,110,10
COMBOBOX IDC_DISK_ID,128,140,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Format Options",IDS_FORMAT_OPTIONS_TXT,8,152,57,12,NOT WS_GROUP
LTEXT "Volume label",IDS_LABEL_TXT,8,166,222,8
LTEXT "Volume label",IDS_LABEL_TXT,8,166,216,8
EDITTEXT IDC_LABEL,8,175,216,12,ES_AUTOHSCROLL
LTEXT "File system",IDS_FILESYSTEM_TXT,8,188,96,8
COMBOBOX IDC_FILESYSTEM,8,197,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Cluster size",IDS_CLUSTERSIZE_TXT,128,188,96,8
COMBOBOX IDC_CLUSTERSIZE,128,197,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Advanced Format Options",IDC_ADVANCED_FORMAT_OPTIONS,
"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,8,210,221,10
CONTROL "Quick format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,220,121,10
"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,8,210,216,10
CONTROL "Quick format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,220,216,10
CONTROL "Check device for bad blocks",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,230,112,10
COMBOBOX IDC_NBPASSES,128,230,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Create extended label and icon files",IDC_EXTENDED_LABEL,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,240,146,10
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,240,216,10
LTEXT "Status",IDS_STATUS_TXT,8,252,23,9,NOT WS_GROUP
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,272,216,9
PUSHBUTTON "About...",IDC_ABOUT,8,294,50,10,NOT WS_VISIBLE
PUSHBUTTON "Log",IDC_LOG,63,294,21,10,NOT WS_VISIBLE
PUSHBUTTON "T",IDC_TEST,90,294,12,10,NOT WS_VISIBLE
DEFPUSHBUTTON "START",IDC_START,128,294,40,10
PUSHBUTTON "CLOSE",IDCANCEL,185,294,39,10
DEFPUSHBUTTON "START",IDC_START,128,294,45,10
PUSHBUTTON "CLOSE",IDCANCEL,181,294,43,10
END
IDD_ABOUTBOX DIALOGEX 0, 0, 319, 237
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Rufus"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
@ -89,7 +89,6 @@ BEGIN
CONTROL "",IDC_ABOUT_BLURB,"RichEdit20W",0x884,45,7,268,107
CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",WS_VSCROLL | WS_TABSTOP | 0x804,46,115,267,91,WS_EX_STATICEDGE
PUSHBUTTON "License",IDC_ABOUT_LICENSE,46,215,50,14,WS_GROUP
PUSHBUTTON "Updates",IDC_ABOUT_UPDATES,100,215,50,14,NOT WS_VISIBLE | WS_GROUP
DEFPUSHBUTTON "OK",IDOK,251,215,50,14,WS_GROUP
END

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Settings access, through either registry or INI file
* Copyright © 2015-2016 Pete Batard <pete@akeo.ie>
* Copyright © 2015-2016 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
@ -36,6 +36,8 @@ extern char* ini_file;
#define SETTING_DISABLE_LGP "DisableLGP"
#define SETTING_ADVANCED_MODE "AdvancedMode"
#define SETTING_ADVANCED_MODE_DEVICE "ShowAdvancedDeviceOptions"
#define SETTING_ADVANCED_MODE_FORMAT "ShowAdvancedFormatOptions"
#define SETTING_PRESERVE_TIMESTAMPS "PreserveTimestamps"
#define SETTING_USE_PROPER_SIZE_UNITS "UseProperSizeUnits"
#define SETTING_ENABLE_USB_DEBUG "EnableUsbDebug"

View file

@ -54,7 +54,6 @@ 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;
static BOOL settings_commcheck = FALSE;
static WNDPROC update_original_proc = NULL;
static HWINEVENTHOOK fp_weh = NULL;
static char *fp_title_str = "Microsoft Windows", *fp_button_str = "Format disk";
@ -526,8 +525,6 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
apply_localization(IDD_ABOUTBOX, hDlg);
SetTitleBarIcon(hDlg);
CenterDialog(hDlg);
if (settings_commcheck)
ShowWindow(GetDlgItem(hDlg, IDC_ABOUT_UPDATES), SW_SHOW);
static_sprintf(about_blurb, about_blurb_format, lmprintf(MSG_174|MSG_RTF),
lmprintf(MSG_175|MSG_RTF, rufus_version[0], rufus_version[1], rufus_version[2]),
right_to_left_mode?"Akeo \\\\ Pete Batard 2011-2018 © Copyright":"Copyright © 2011-2018 Pete Batard / Akeo",
@ -584,9 +581,6 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
case IDC_ABOUT_LICENSE:
MyDialogBox(hMainInstance, IDD_LICENSE, hDlg, LicenseCallback);
break;
case IDC_ABOUT_UPDATES:
MyDialogBox(hMainInstance, IDD_UPDATE_POLICY, hDlg, UpdateCallback);
break;
}
break;
}
@ -1323,7 +1317,6 @@ BOOL SetUpdateCheck(void)
WriteSetting64(SETTING_COMM_CHECK, commcheck);
if (ReadSetting64(SETTING_COMM_CHECK) != commcheck)
return FALSE;
settings_commcheck = TRUE;
// If the update interval is not set, this is the first time we run so prompt the user
if (ReadSetting32(SETTING_UPDATE_INTERVAL) == 0) {