[ui] remember last selected device

* Closes #35
* Also update syslinux resources
This commit is contained in:
Pete Batard 2012-02-16 23:40:31 +00:00
parent a851d66e7c
commit ce499c95d7
6 changed files with 33 additions and 20 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
diff --git a/core/fs/lib/loadconfig.c b/core/fs/lib/loadconfig.c
index c9652b6..4dfe1b9 100644
index c9652b6..8ed301e 100644
--- a/core/fs/lib/loadconfig.c
+++ b/core/fs/lib/loadconfig.c
@@ -10,6 +10,8 @@
@ -11,13 +11,12 @@ index c9652b6..4dfe1b9 100644
*/
int generic_load_config(void)
{
@@ -17,12 +19,15 @@ int generic_load_config(void)
NULL, /* CurrentDirName */
@@ -18,11 +20,14 @@ int generic_load_config(void)
"/boot/syslinux",
"/syslinux",
"/",
+ "/boot/isolinux",
+ "/isolinux",
"/",
NULL
};
static const char *filenames[] = {

View File

@ -397,7 +397,7 @@ try_iso:
goto out;
}
i_joliet_level = iso9660_ifs_get_joliet_level(p_iso);
uprintf("Disc image is an ISO9660 image (Joliet = %d)\n", i_joliet_level);
uprintf("Disc image is an ISO9660 image\n");
if (scan_only) {
if (iso9660_ifs_get_volume_id(p_iso, &vol_id)) {
safe_strcpy(iso_report.label, sizeof(iso_report.label), vol_id);

View File

@ -392,7 +392,7 @@ static void SetFSFromISO(void)
return;
for (i=ComboBox_GetCount(hFileSystem)-1; i>=0; i--) {
fs = ComboBox_GetItemData(hFileSystem, i);
fs = (int)ComboBox_GetItemData(hFileSystem, i);
if ( ((iso_report.has_bootmgr) && (fs == FS_NTFS))
|| ((iso_report.has_isolinux) && ((fs == FS_FAT32) || (fs == FS_FAT16))) ) {
IGNORE_RETVAL(ComboBox_SetCurSel(hFileSystem, i));
@ -521,9 +521,9 @@ BOOL CreatePartition(HANDLE hDrive)
/*
* Refresh the list of USB devices
*/
static BOOL GetUSBDevices(void)
static BOOL GetUSBDevices(DWORD devnum)
{
BOOL r;
BOOL r, found = FALSE;
HDEVINFO dev_info = NULL;
SP_DEVINFO_DATA dev_info_data;
SP_DEVICE_INTERFACE_DATA devint_data;
@ -626,7 +626,18 @@ static BOOL GetUSBDevices(void)
}
}
SetupDiDestroyDeviceInfoList(dev_info);
IGNORE_RETVAL(ComboBox_SetCurSel(hDeviceList, 0));
if (devnum >= DRIVE_INDEX_MIN) {
for (i=0; i<ComboBox_GetCount(hDeviceList); i++) {
if ((DWORD)ComboBox_GetItemData(hDeviceList, i) == devnum) {
found = TRUE;
break;
}
}
}
if (!found)
i = 0;
IGNORE_RETVAL(ComboBox_SetCurSel(hDeviceList, i));
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_DEVICE, 0);
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM,
ComboBox_GetCurSel(hFileSystem));
@ -1136,7 +1147,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
{
DRAWITEMSTRUCT* pDI;
int nDeviceIndex, fs, dt;
DWORD DeviceNum;
static DWORD DeviceNum = 0;
char str[MAX_PATH], tmp[128];
static UINT uDOSChecked = BST_CHECKED;
@ -1145,14 +1156,14 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
case WM_DEVICECHANGE:
if ( (format_thid == NULL) &&
((wParam == DBT_DEVICEARRIVAL) || (wParam == DBT_DEVICEREMOVECOMPLETE)) ) {
GetUSBDevices();
GetUSBDevices((DWORD)ComboBox_GetItemData(hDeviceList, ComboBox_GetCurSel(hDeviceList)));
return (INT_PTR)TRUE;
}
break;
case WM_INITDIALOG:
InitDialog(hDlg);
GetUSBDevices();
GetUSBDevices(0);
return (INT_PTR)TRUE;
// The things one must do to get an ellipsis on the status bar...
@ -1289,6 +1300,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
dt = (int)ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType));
if ((dt == DT_ISO_NTFS) || (dt == DT_ISO_FAT)) {
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)hSelectISO, TRUE);
} else {
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0);
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDC_START), TRUE);
}
return (INT_PTR)TRUE;
case IDC_SELECT_ISO:
@ -1352,7 +1366,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
if (MessageBoxA(hMainDialog, str, "Rufus", MB_OKCANCEL|MB_ICONWARNING) == IDOK) {
// Disable all controls except cancel
EnableControls(FALSE);
DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, nDeviceIndex);
DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, nDeviceIndex);
FormatStatus = 0;
InitProgress();
if (!IsWindow(hISOProgressDlg)) {
@ -1397,7 +1411,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
EnableWindow(GetDlgItem(hISOProgressDlg, IDC_ISO_ABORT), TRUE);
EnableWindow(GetDlgItem(hMainDialog, IDCANCEL), TRUE);
EnableControls(TRUE);
GetUSBDevices();
GetUSBDevices(DeviceNum);
if (!IS_ERROR(FormatStatus)) {
PrintStatus(0, FALSE, "DONE");
} else if (SCODE_CODE(FormatStatus) == ERROR_CANCELLED) {

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 278
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.1.1.137"
CAPTION "Rufus v1.1.1.138"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,236,50,14
@ -71,7 +71,7 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP
CONTROL "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL,
"SysLink",WS_TABSTOP,46,47,114,9
LTEXT "Version 1.1.1 (Build 137)",IDC_STATIC,46,19,78,8
LTEXT "Version 1.1.1 (Build 138)",IDC_STATIC,46,19,78,8
PUSHBUTTON "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP
EDITTEXT IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL
LTEXT "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8
@ -222,8 +222,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,1,1,137
PRODUCTVERSION 1,1,1,137
FILEVERSION 1,1,1,138
PRODUCTVERSION 1,1,1,138
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -240,13 +240,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.1.1.137"
VALUE "FileVersion", "1.1.1.138"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.1.1.137"
VALUE "ProductVersion", "1.1.1.138"
END
END
BLOCK "VarFileInfo"