mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[loc] add language selection menu
This commit is contained in:
parent
92abacad62
commit
df44b26342
10 changed files with 215 additions and 136 deletions
|
@ -1,6 +1,9 @@
|
|||
# This file should be saved as UTF-8, no-BOM
|
||||
|
||||
######################## HOW TO ADD A NEW TRANSLATION ###########################
|
||||
# For a more comprehensive set of instructions, please see the *FULL* Localization guide at:
|
||||
# https://github.com/pbatard/rufus/wiki/Localization
|
||||
#
|
||||
# 1. Rename this file as 'rufus.loc' and save it in the same directory where you have the Rufus executable.
|
||||
# 2. Start Rufus, and check the log a line starting with 'LCID' (eg. LCID 0x1809).
|
||||
# 3. Edit the 'l' line below and:
|
||||
|
@ -275,7 +278,7 @@ t MSG_109 "0x%02X (Disk %d)"
|
|||
# Tootips
|
||||
# Partition Scheme and Target Type
|
||||
t MSG_150 "Usually the safest choice. If you have an UEFI computer and want to install "
|
||||
"an OS in EFI mode however, you should select one of the options below"
|
||||
"an OS in EFI mode however, you should select one of the other options"
|
||||
t MSG_151 "Use this if you want to install an OS in EFI mode, but need to access "
|
||||
"the USB content from Windows XP"
|
||||
t MSG_152 "The preferred option to install an OS in EFI mode and when "
|
||||
|
|
|
@ -155,7 +155,7 @@ t MSG_109 "0x%02X (Disk %d)"
|
|||
# Tootips
|
||||
# Partition Scheme and Target Type
|
||||
t MSG_150 "Usually the safest choice. If you have an UEFI computer and want to install "
|
||||
"an OS in EFI mode however, you should select one of the options below"
|
||||
"an OS in EFI mode however, you should select one of the other options"
|
||||
t MSG_151 "Use this if you want to install an OS in EFI mode, but need to access "
|
||||
"the USB content from Windows XP"
|
||||
t MSG_152 "The preferred option to install an OS in EFI mode and when "
|
||||
|
@ -273,9 +273,91 @@ t MSG_257 "Joliet support"
|
|||
t MSG_258 "Rock Ridge support"
|
||||
t MSG_259 "Force update"
|
||||
|
||||
################################################################################
|
||||
l "zh-CN" "Chinese Simplified (简体中文)" 0x0404, 0x0804, 0x0c04, 0x1004, 0x1404
|
||||
b "en-US"
|
||||
|
||||
g IDD_DIALOG
|
||||
t IDS_DEVICE_TXT "设备"
|
||||
t IDS_PARTITION_TYPE_TXT "分区计划和目标系统类型"
|
||||
t IDS_FILESYSTEM_TXT "文件系统"
|
||||
t IDS_CLUSTERSIZE_TXT "簇的大小"
|
||||
t IDS_LABEL_TXT "新卷标"
|
||||
t IDS_FORMAT_OPTIONS_GRP "格式选项 "
|
||||
t IDC_BADBLOCKS "检查设备的坏块:"
|
||||
t IDC_QUICKFORMAT "快速格式化"
|
||||
t IDC_BOOT "创建一个可启动的磁盘使用:"
|
||||
s IDC_BOOT +10,0
|
||||
t IDC_SET_ICON "创建扩展标签和图标文件"
|
||||
m IDC_ADVANCED -24,0
|
||||
m IDC_NBPASSES 8,0
|
||||
m IDC_BOOTTYPE 8,0
|
||||
m IDC_SELECT_ISO 6,0
|
||||
t IDC_ABOUT "关于..."
|
||||
t IDC_LOG "日志"
|
||||
m IDC_LOG -5,0
|
||||
s IDC_LOG +5,0
|
||||
t IDCANCEL "关闭"
|
||||
t IDC_START "开始"
|
||||
t IDS_ADVANCED_OPTIONS_GRP "高级选项"
|
||||
t IDC_ENABLE_FIXED_DISKS "列表固定(非flash)或USB磁盘分区"
|
||||
t IDC_EXTRA_PARTITION "添加修复旧的BIOS(额外的分区,校准等等)"
|
||||
t IDC_RUFUS_MBR "使用 Rufus MBR BIOS ID:"
|
||||
|
||||
g IDD_ABOUTBOX
|
||||
t IDD_ABOUTBOX "关于 Rufus"
|
||||
t IDC_ABOUT_LICENSE "许可证"
|
||||
t IDC_ABOUT_UPDATES "更新"
|
||||
t IDOK "确定"
|
||||
|
||||
g IDD_LICENSE
|
||||
t IDD_LICENSE "Rufus 许可证"
|
||||
t IDCANCEL "取消"
|
||||
|
||||
g IDD_NOTIFICATION
|
||||
t IDD_NOTIFICATION "更新方案和设置"
|
||||
t IDC_MORE_INFO "更多信息"
|
||||
t IDYES "是"
|
||||
t IDNO "否"
|
||||
|
||||
g IDD_LOG
|
||||
t IDD_LOG "日志"
|
||||
t IDC_LOG_CLEAR "清除日志"
|
||||
t IDC_LOG_SAVE "保存日志"
|
||||
t IDCANCEL "关闭日志"
|
||||
|
||||
g IDD_UPDATE_POLICY
|
||||
t IDD_UPDATE_POLICY "更新方案和设置"
|
||||
t IDS_UPDATE_SETTINGS_GRP "设置"
|
||||
t IDS_UPDATE_FREQUENCY_TXT "检查更新:"
|
||||
t IDS_INCLUDE_BETAS_TXT "包括测试版本:"
|
||||
t IDC_CHECK_NOW "立即检查"
|
||||
t IDCANCEL "取消"
|
||||
|
||||
g IDD_NEW_VERSION
|
||||
t IDD_NEW_VERSION "检查更新 - Rufus"
|
||||
t IDS_NEW_VERSION_AVAIL_TXT "更新的版本可用。请下载最新版本!"
|
||||
t IDC_WEBSITE "点击这里进入网站"
|
||||
t IDS_NEW_VERSION_NOTES_GRP "发行说明"
|
||||
t IDS_NEW_VERSION_DOWNLOAD_GRP "下载"
|
||||
t IDC_DOWNLOAD "下载"
|
||||
t IDCANCEL "取消"
|
||||
|
||||
g IDD_ISO_EXTRACT
|
||||
t IDD_ISO_EXTRACT "复制ISO文件..."
|
||||
t IDC_ISO_FILENAME "打开ISO映像 - 请稍候..."
|
||||
t IDC_ISO_ABORT "取消"
|
||||
|
||||
g IDD_MESSAGES
|
||||
t MSG_004 "更新方案和设置"
|
||||
t MSG_005 "你要允許此應用程序檢查更新?"
|
||||
t MSG_006 "关闭"
|
||||
t MSG_007 "撤消"
|
||||
|
||||
################################################################################
|
||||
l "fr-FR" "French (Français)" 0x040c, 0x080c, 0x0c0c, 0x100c, 0x140c, 0x180c, 0x1c0c, 0x200c, 0x240c, 0x280c, 0x2c0c, 0x300c, 0x340c, 0x380c, 0xe40c
|
||||
b "en-US"
|
||||
|
||||
g IDD_DIALOG
|
||||
t IDS_DEVICE_TXT "Periphérique"
|
||||
t IDS_PARTITION_TYPE_TXT "Type de partition et système de destination"
|
||||
|
@ -502,7 +584,7 @@ t MSG_109 "0x%02X (disque %d)"
|
|||
|
||||
# Tootips
|
||||
t MSG_150 "Ce choix est le plus sûr. Mais si vous possédez un ordinateur à base de UEFI et voulez installer "
|
||||
"un Système d’exploitation en mode EFI, essayez plutôt de sélectionner l’une des options ci-dessous"
|
||||
"un Système d’exploitation en mode EFI, essayez plutôt de sélectionner l’une des autres options"
|
||||
t MSG_151 "Utilisez cette options si vous comptez installer un Système d’exploitation en mode EFI "
|
||||
"et avez aussi besoin d’accéder au contenu du média sous Windows XP"
|
||||
t MSG_152 "Option préférée pour installer un Système d’exploitation en mode EFI, "
|
||||
|
@ -535,7 +617,7 @@ t MSG_172 "Licence d’utilisation et remerciements"
|
|||
t MSG_173 "Cliquez pour sélectionner..."
|
||||
t MSG_174 "Rufus - The Reliable USB Formatting Utility"
|
||||
t MSG_175 "Version %d.%d.%d (Build %d)"
|
||||
t MSG_176 "Traduction Française: Pete Batard"
|
||||
t MSG_176 "Traduction Française: Pete Batard <mailto:pete@akeo.ie>"
|
||||
t MSG_177 "Soumettre un bug ou une demande d'amélioration à:"
|
||||
t MSG_178 "Copyrights supplémentaires:"
|
||||
t MSG_179 "Politique de mises à jour:"
|
||||
|
@ -611,87 +693,6 @@ t MSG_257 "Support Joliet"
|
|||
t MSG_258 "Support Rock Ridge"
|
||||
t MSG_259 "Forçage de mise à jour"
|
||||
|
||||
################################################################################
|
||||
l "zh-CN" "Chinese Simplified (简体中文)" 0x0404, 0x0804, 0x0c04, 0x1004, 0x1404
|
||||
b "en-US"
|
||||
|
||||
g IDD_DIALOG
|
||||
t IDS_DEVICE_TXT "设备"
|
||||
t IDS_PARTITION_TYPE_TXT "分区计划和目标系统类型"
|
||||
t IDS_FILESYSTEM_TXT "文件系统"
|
||||
t IDS_CLUSTERSIZE_TXT "簇的大小"
|
||||
t IDS_LABEL_TXT "新卷标"
|
||||
t IDS_FORMAT_OPTIONS_GRP "格式选项 "
|
||||
t IDC_BADBLOCKS "检查设备的坏块:"
|
||||
t IDC_QUICKFORMAT "快速格式化"
|
||||
t IDC_BOOT "创建一个可启动的磁盘使用:"
|
||||
s IDC_BOOT +10,0
|
||||
t IDC_SET_ICON "创建扩展标签和图标文件"
|
||||
m IDC_ADVANCED -24,0
|
||||
m IDC_NBPASSES 8,0
|
||||
m IDC_BOOTTYPE 8,0
|
||||
m IDC_SELECT_ISO 6,0
|
||||
t IDC_ABOUT "关于..."
|
||||
t IDC_LOG "日志"
|
||||
m IDC_LOG -5,0
|
||||
s IDC_LOG +5,0
|
||||
t IDCANCEL "关闭"
|
||||
t IDC_START "开始"
|
||||
t IDS_ADVANCED_OPTIONS_GRP "高级选项"
|
||||
t IDC_ENABLE_FIXED_DISKS "列表固定(非flash)或USB磁盘分区"
|
||||
t IDC_EXTRA_PARTITION "添加修复旧的BIOS(额外的分区,校准等等)"
|
||||
t IDC_RUFUS_MBR "使用 Rufus MBR BIOS ID:"
|
||||
|
||||
g IDD_ABOUTBOX
|
||||
t IDD_ABOUTBOX "关于 Rufus"
|
||||
t IDC_ABOUT_LICENSE "许可证"
|
||||
t IDC_ABOUT_UPDATES "更新"
|
||||
t IDOK "确定"
|
||||
|
||||
g IDD_LICENSE
|
||||
t IDD_LICENSE "Rufus 许可证"
|
||||
t IDCANCEL "取消"
|
||||
|
||||
g IDD_NOTIFICATION
|
||||
t IDD_NOTIFICATION "更新方案和设置"
|
||||
t IDC_MORE_INFO "更多信息"
|
||||
t IDYES "是"
|
||||
t IDNO "否"
|
||||
|
||||
g IDD_LOG
|
||||
t IDD_LOG "日志"
|
||||
t IDC_LOG_CLEAR "清除日志"
|
||||
t IDC_LOG_SAVE "保存日志"
|
||||
t IDCANCEL "关闭日志"
|
||||
|
||||
g IDD_UPDATE_POLICY
|
||||
t IDD_UPDATE_POLICY "更新方案和设置"
|
||||
t IDS_UPDATE_SETTINGS_GRP "设置"
|
||||
t IDS_UPDATE_FREQUENCY_TXT "检查更新:"
|
||||
t IDS_INCLUDE_BETAS_TXT "包括测试版本:"
|
||||
t IDC_CHECK_NOW "立即检查"
|
||||
t IDCANCEL "取消"
|
||||
|
||||
g IDD_NEW_VERSION
|
||||
t IDD_NEW_VERSION "检查更新 - Rufus"
|
||||
t IDS_NEW_VERSION_AVAIL_TXT "更新的版本可用。请下载最新版本!"
|
||||
t IDC_WEBSITE "点击这里进入网站"
|
||||
t IDS_NEW_VERSION_NOTES_GRP "发行说明"
|
||||
t IDS_NEW_VERSION_DOWNLOAD_GRP "下载"
|
||||
t IDC_DOWNLOAD "下载"
|
||||
t IDCANCEL "取消"
|
||||
|
||||
g IDD_ISO_EXTRACT
|
||||
t IDD_ISO_EXTRACT "复制ISO文件..."
|
||||
t IDC_ISO_FILENAME "打开ISO映像 - 请稍候..."
|
||||
t IDC_ISO_ABORT "取消"
|
||||
|
||||
g IDD_MESSAGES
|
||||
t MSG_004 "更新方案和设置"
|
||||
t MSG_005 "你要允許此應用程序檢查更新?"
|
||||
t MSG_006 "关闭"
|
||||
t MSG_007 "撤消"
|
||||
|
||||
################################################################################
|
||||
l "it-IT" "Italian (Italiano)" 0x0410, 0x0810
|
||||
b "en-US"
|
||||
|
|
|
@ -308,21 +308,25 @@ void free_locale_list(void)
|
|||
|
||||
/*
|
||||
* Init/destroy our various localization lists
|
||||
* keep the locale list and filename on reinit
|
||||
*/
|
||||
void init_localization(void) {
|
||||
void _init_localization(BOOL reinit) {
|
||||
size_t i;
|
||||
for (i=0; i<ARRAYSIZE(loc_dlg); i++)
|
||||
list_init(&loc_dlg[i].list);
|
||||
list_init(&locale_list);
|
||||
if (!reinit)
|
||||
list_init(&locale_list);
|
||||
htab_create(LOC_HTAB_SIZE);
|
||||
}
|
||||
|
||||
void exit_localization(void) {
|
||||
void _exit_localization(BOOL reinit) {
|
||||
if (!reinit) {
|
||||
free_locale_list();
|
||||
if (loc_filename != embedded_loc_filename)
|
||||
safe_free(loc_filename);
|
||||
}
|
||||
free_dialog_list();
|
||||
free_locale_list();
|
||||
htab_destroy();
|
||||
if (loc_filename != embedded_loc_filename)
|
||||
safe_free(loc_filename);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -146,8 +146,11 @@ char *loc_filename, *embedded_loc_filename;
|
|||
|
||||
void free_loc_cmd(loc_cmd* lcmd);
|
||||
BOOL dispatch_loc_cmd(loc_cmd* lcmd);
|
||||
void init_localization(void);
|
||||
void exit_localization(void);
|
||||
void _init_localization(BOOL reinit);
|
||||
void _exit_localization(BOOL reinit);
|
||||
#define init_localization() _init_localization(FALSE)
|
||||
#define exit_localization() _exit_localization(FALSE)
|
||||
#define reinit_localization() do {_exit_localization(TRUE); _init_localization(TRUE);} while(0)
|
||||
void apply_localization(int dlg_id, HWND hDlg);
|
||||
void reset_localization(int dlg_id);
|
||||
void free_dialog_list(void);
|
||||
|
|
|
@ -291,6 +291,18 @@ static __inline BOOL SetDlgItemTextU(HWND hDlg, int nIDDlgItem, const char* lpSt
|
|||
return ret;
|
||||
}
|
||||
|
||||
static __inline BOOL InsertMenuU(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, const char* lpNewItem)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
DWORD err = ERROR_INVALID_DATA;
|
||||
wconvert(lpNewItem);
|
||||
ret = InsertMenuW(hMenu, uPosition, uFlags, uIDNewItem, wlpNewItem);
|
||||
err = GetLastError();
|
||||
wfree(lpNewItem);
|
||||
SetLastError(err);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static __inline int ComboBox_GetLBTextU(HWND hCtrl, int index, char* lpString)
|
||||
{
|
||||
int size;
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
#define IDC_ADVANCED 1043
|
||||
#define IDS_ADVANCED_OPTIONS_GRP 1044
|
||||
#define IDC_LOG 1045
|
||||
#define IDC_LANG 1046
|
||||
#define IDC_LOG_EDIT 1050
|
||||
#define IDC_LOG_SAVE 1051
|
||||
#define IDC_LOG_CLEAR 1052
|
||||
|
|
72
src/rufus.c
72
src/rufus.c
|
@ -84,7 +84,7 @@ struct {
|
|||
HIMAGELIST himl;
|
||||
RECT margin;
|
||||
UINT uAlign;
|
||||
} bi_iso = {0}, bi_up = {0}, bi_down = {0}; // BUTTON_IMAGELIST
|
||||
} bi_iso = {0}, bi_up = {0}, bi_down = {0}, bi_lang = {0}; // BUTTON_IMAGELIST
|
||||
|
||||
const char* FileSystemLabel[FS_MAX] = { "FAT", "FAT32", "NTFS", "UDF", "exFAT" };
|
||||
// Number of steps for each FS for FCC_STRUCTURE_PROGRESS
|
||||
|
@ -94,9 +94,12 @@ static BOOL existing_key = FALSE; // For LGP set/restore
|
|||
static BOOL size_check = TRUE;
|
||||
static BOOL log_displayed = FALSE;
|
||||
static BOOL iso_provided = FALSE;
|
||||
static BOOL relaunch = FALSE;
|
||||
extern BOOL force_large_fat32, enable_joliet, enable_rockridge;
|
||||
static int selection_default;
|
||||
static loc_cmd* selected_locale = NULL;
|
||||
static UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU;
|
||||
static RECT relaunch_rc = { -65536, -65536, 0, 0};
|
||||
char ClusterSizeLabel[MAX_CLUSTER_SIZES][64];
|
||||
char msgbox[1024], msgbox_title[32];
|
||||
|
||||
|
@ -121,7 +124,7 @@ extern char szStatusMessage[256];
|
|||
|
||||
static HANDLE format_thid = NULL;
|
||||
static HWND hProgress = NULL, hBoot = NULL, hSelectISO = NULL;
|
||||
static HICON hIconDisc, hIconDown, hIconUp;
|
||||
static HICON hIconDisc, hIconDown, hIconUp, hIconLang;
|
||||
static StrArray DriveID, DriveLabel;
|
||||
static char szTimer[12] = "00:00:00";
|
||||
static unsigned int timer;
|
||||
|
@ -875,6 +878,7 @@ static void EnableControls(BOOL bEnable)
|
|||
EnableWindow(GetDlgItem(hMainDialog, IDC_SET_ICON), bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_ADVANCED), bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_ENABLE_FIXED_DISKS), bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_LANG), bEnable);
|
||||
SetDlgItemTextU(hMainDialog, IDCANCEL, lmprintf(bEnable?MSG_006:MSG_007));
|
||||
}
|
||||
|
||||
|
@ -1351,6 +1355,7 @@ void InitDialog(HWND hDlg)
|
|||
// Load system icons (NB: Use the excellent http://www.nirsoft.net/utils/iconsext.html to find icon IDs)
|
||||
hDllInst = LoadLibraryA("shell32.dll");
|
||||
hIconDisc = (HICON)LoadImage(hDllInst, MAKEINTRESOURCE(12), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR|LR_SHARED);
|
||||
hIconLang = (HICON)LoadImage(hDllInst, MAKEINTRESOURCE(244), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR|LR_SHARED);
|
||||
if (nWindowsVersion >= WINDOWS_VISTA) {
|
||||
hIconDown = (HICON)LoadImage(hDllInst, MAKEINTRESOURCE(16750), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR|LR_SHARED);
|
||||
hIconUp = (HICON)LoadImage(hDllInst, MAKEINTRESOURCE(16749), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR|LR_SHARED);
|
||||
|
@ -1367,6 +1372,10 @@ void InitDialog(HWND hDlg)
|
|||
pImageList_ReplaceIcon(bi_iso.himl, -1, hIconDisc);
|
||||
SetRect(&bi_iso.margin, 0, 1, 0, 0);
|
||||
bi_iso.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER;
|
||||
bi_lang.himl = pImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0);
|
||||
pImageList_ReplaceIcon(bi_lang.himl, -1, hIconLang);
|
||||
SetRect(&bi_lang.margin, 0, 1, 0, 0);
|
||||
bi_lang.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER;
|
||||
bi_down.himl = pImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0);
|
||||
pImageList_ReplaceIcon(bi_down.himl, -1, hIconDown);
|
||||
SetRect(&bi_down.margin, 0, 0, 0, 0);
|
||||
|
@ -1377,6 +1386,7 @@ void InitDialog(HWND hDlg)
|
|||
bi_up.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER;
|
||||
|
||||
SendMessage(hSelectISO, BCM_SETIMAGELIST, 0, (LPARAM)&bi_iso);
|
||||
SendMessage(GetDlgItem(hDlg, IDC_LANG), BCM_SETIMAGELIST, 0, (LPARAM)&bi_lang);
|
||||
SendMessage(GetDlgItem(hDlg, IDC_ADVANCED), BCM_SETIMAGELIST, 0, (LPARAM)&bi_down);
|
||||
|
||||
// Set the various tooltips
|
||||
|
@ -1412,6 +1422,23 @@ static void PrintStatus2000(const char* str, BOOL val)
|
|||
PrintStatus(2000, FALSE, (lmprintf((val)?MSG_250:MSG_251, str)));
|
||||
}
|
||||
|
||||
void ShowLanguageMenu(HWND hDlg)
|
||||
{
|
||||
POINT pt;
|
||||
HMENU menu;
|
||||
loc_cmd* lcmd = NULL;
|
||||
UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU;
|
||||
|
||||
menu = CreatePopupMenu();
|
||||
list_for_each_entry(lcmd, &locale_list, loc_cmd, list) {
|
||||
InsertMenuU(menu, -1, MF_BYPOSITION|((selected_locale == lcmd)?MF_CHECKED:0), UM_LANGUAGE_MENU_MAX++, lcmd->txt[1]);
|
||||
}
|
||||
|
||||
SetForegroundWindow(hDlg);
|
||||
GetCursorPos(&pt);
|
||||
TrackPopupMenu(menu, TPM_TOPALIGN|TPM_RIGHTALIGN, pt.x, pt.y, 0, hMainDialog, NULL);
|
||||
DestroyMenu(menu);
|
||||
}
|
||||
|
||||
/*
|
||||
* Main dialog callback
|
||||
|
@ -1421,11 +1448,12 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
DRAWITEMSTRUCT* pDI;
|
||||
POINT Point;
|
||||
RECT DialogRect, DesktopRect;
|
||||
int nDeviceIndex, fs, bt, i, nWidth, nHeight, nb_devices;
|
||||
int nDeviceIndex, fs, bt, i, nWidth, nHeight, nb_devices, selected_language;
|
||||
static DWORD DeviceNum = 0, LastRefresh = 0;
|
||||
char tmp[128];
|
||||
static UINT uBootChecked = BST_CHECKED, uQFChecked;
|
||||
static BOOL first_log_display = TRUE, user_changed_label = FALSE;
|
||||
loc_cmd* lcmd = NULL;
|
||||
|
||||
switch (message) {
|
||||
|
||||
|
@ -1464,7 +1492,10 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
case WM_INITDIALOG:
|
||||
apply_localization(IDD_DIALOG, hDlg);
|
||||
SetUpdateCheck();
|
||||
advanced_mode = TRUE;
|
||||
// Create the log window (hidden)
|
||||
first_log_display = TRUE;
|
||||
log_displayed = FALSE;
|
||||
hLogDlg = CreateDialogW(hMainInstance, MAKEINTRESOURCEW(IDD_LOG), hDlg, (DLGPROC)LogProc);
|
||||
InitDialog(hDlg);
|
||||
GetUSBDevices(0);
|
||||
|
@ -1493,6 +1524,22 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
if ((LOWORD(wParam) >= UM_LANGUAGE_MENU) && (LOWORD(wParam) < UM_LANGUAGE_MENU_MAX)) {
|
||||
selected_language = LOWORD(wParam) - UM_LANGUAGE_MENU;
|
||||
uprintf("Got language %d\n", selected_language);
|
||||
|
||||
i = 0;
|
||||
list_for_each_entry(lcmd, &locale_list, loc_cmd, list) {
|
||||
if (i++ == selected_language) {
|
||||
if (selected_locale != lcmd) {
|
||||
selected_locale = lcmd;
|
||||
relaunch = TRUE;
|
||||
PostMessage(hDlg, WM_COMMAND, IDCANCEL, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDOK: // close application
|
||||
case IDCANCEL:
|
||||
|
@ -1522,6 +1569,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
StrArrayDestroy(&DriveID);
|
||||
StrArrayDestroy(&DriveLabel);
|
||||
DestroyAllTooltips();
|
||||
DestroyWindow(hLogDlg);
|
||||
GetWindowRect(hDlg, &relaunch_rc);
|
||||
EndDialog(hDlg, 0);
|
||||
break;
|
||||
case IDC_ABOUT:
|
||||
|
@ -1559,6 +1608,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
case IDC_TEST:
|
||||
break;
|
||||
#endif
|
||||
case IDC_LANG:
|
||||
ShowLanguageMenu(GetDlgItem(hDlg, IDC_LANG));
|
||||
break;
|
||||
case IDC_ADVANCED:
|
||||
ToggleAdvanced();
|
||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM,
|
||||
|
@ -1985,9 +2037,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
"Fatal error", MB_ICONSTOP);
|
||||
goto out;
|
||||
}
|
||||
uprintf("localization: using locale '%s'\n", selected_locale->txt[0]);
|
||||
get_loc_data_file(loc_file, (long)selected_locale->num[0], (long)selected_locale->num[1], selected_locale->line_nr);
|
||||
|
||||
|
||||
// Prevent 2 applications from running at the same time, unless "/W" is passed as an option
|
||||
// in which case we wait for the mutex to be relinquished
|
||||
|
@ -2022,12 +2071,18 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
// 0x9e disables removable and fixed drive notifications
|
||||
SetLGP(FALSE, &existing_key, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", "NoDriveTypeAutorun", 0x9e);
|
||||
|
||||
relaunch:
|
||||
uprintf("localization: using locale '%s'\n", selected_locale->txt[0]);
|
||||
get_loc_data_file(loc_file, (long)selected_locale->num[0], (long)selected_locale->num[1], selected_locale->line_nr);
|
||||
|
||||
// Create the main Window
|
||||
hDlg = CreateDialogW(hInstance, MAKEINTRESOURCEW(IDD_DIALOG), NULL, MainCallback);
|
||||
if (hDlg == NULL) {
|
||||
MessageBoxU(NULL, "Could not create Window", "DialogBox failure", MB_ICONSTOP);
|
||||
goto out;
|
||||
}
|
||||
if ((relaunch_rc.left > -65536) && (relaunch_rc.top > -65536))
|
||||
SetWindowPos(hDlg, HWND_TOP, relaunch_rc.left, relaunch_rc.top, 0, 0, SWP_NOSIZE);
|
||||
ShowWindow(hDlg, SW_SHOWNORMAL);
|
||||
UpdateWindow(hDlg);
|
||||
|
||||
|
@ -2111,6 +2166,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
if (relaunch) {
|
||||
relaunch = FALSE;
|
||||
reinit_localization();
|
||||
goto relaunch;
|
||||
}
|
||||
|
||||
out:
|
||||
if ((!external_loc_file) && (loc_file[0] != 0))
|
||||
|
|
|
@ -110,7 +110,9 @@ enum user_message_type {
|
|||
// TODO: relabel "ISO" to a more generic "progress"
|
||||
UM_ISO_CREATE,
|
||||
UM_ISO_INIT,
|
||||
UM_ISO_EXIT
|
||||
UM_ISO_EXIT,
|
||||
// Start of the WM IDs for the language menu items
|
||||
UM_LANGUAGE_MENU = WM_APP + 0x100
|
||||
};
|
||||
|
||||
/* Custom notifications */
|
||||
|
|
13
src/rufus.rc
13
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 206, 329
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
CAPTION "Rufus v1.4.0.293"
|
||||
CAPTION "Rufus v1.4.0.294"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
|
||||
|
@ -42,7 +42,7 @@ BEGIN
|
|||
PUSHBUTTON "Log",IDC_LOG,62,291,18,14
|
||||
PUSHBUTTON "T",IDC_TEST,80,291,12,14,NOT WS_VISIBLE
|
||||
COMBOBOX IDC_DEVICE,8,17,190,33,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,186,8
|
||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,171,8
|
||||
COMBOBOX IDC_FILESYSTEM,8,75,190,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "File system",IDS_FILESYSTEM_TXT,9,64,186,10
|
||||
COMBOBOX IDC_PARTITION_TYPE,8,46,190,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
|
@ -69,6 +69,7 @@ BEGIN
|
|||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,235,181,10
|
||||
CONTROL "List non removable or unpartitioned USB disks",IDC_ENABLE_FIXED_DISKS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,222,181,10
|
||||
PUSHBUTTON "",IDC_LANG,183,2,15,13,BS_TOP | BS_FLAT
|
||||
END
|
||||
|
||||
IDD_ABOUTBOX DIALOGEX 0, 0, 287, 204
|
||||
|
@ -284,8 +285,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,4,0,293
|
||||
PRODUCTVERSION 1,4,0,293
|
||||
FILEVERSION 1,4,0,294
|
||||
PRODUCTVERSION 1,4,0,294
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -302,13 +303,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "1.4.0.293"
|
||||
VALUE "FileVersion", "1.4.0.294"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "1.4.0.293"
|
||||
VALUE "ProductVersion", "1.4.0.294"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
52
src/stdlg.c
52
src/stdlg.c
|
@ -404,41 +404,29 @@ void CreateStatusBar(void)
|
|||
|
||||
/*
|
||||
* Center a dialog with regards to the main application Window or the desktop
|
||||
* See http://msdn.microsoft.com/en-us/library/windows/desktop/ms644996.aspx#init_box
|
||||
*/
|
||||
void CenterDialog(HWND hDlg)
|
||||
{
|
||||
POINT Point;
|
||||
HWND hParent;
|
||||
RECT DialogRect;
|
||||
RECT ParentRect;
|
||||
int nWidth;
|
||||
int nHeight;
|
||||
RECT rc, rcDlg, rcParent;
|
||||
|
||||
// Get the size of the dialog box.
|
||||
GetWindowRect(hDlg, &DialogRect);
|
||||
|
||||
// Get the parent
|
||||
hParent = GetParent(hDlg);
|
||||
if (hParent == NULL) {
|
||||
if ((hParent = GetParent(hDlg)) == NULL) {
|
||||
hParent = GetDesktopWindow();
|
||||
}
|
||||
GetClientRect(hParent, &ParentRect);
|
||||
|
||||
// Calculate the height and width of the current dialog
|
||||
nWidth = DialogRect.right - DialogRect.left;
|
||||
nHeight = DialogRect.bottom - DialogRect.top;
|
||||
GetWindowRect(hParent, &rcParent);
|
||||
GetWindowRect(hDlg, &rcDlg);
|
||||
CopyRect(&rc, &rcParent);
|
||||
|
||||
// Find the center point and convert to screen coordinates.
|
||||
Point.x = (ParentRect.right - ParentRect.left) / 2;
|
||||
Point.y = (ParentRect.bottom - ParentRect.top) / 2;
|
||||
ClientToScreen(hParent, &Point);
|
||||
// Offset the parent and dialog box rectangles so that right and bottom
|
||||
// values represent the width and height, and then offset the parent again
|
||||
// to discard space taken up by the dialog box.
|
||||
OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
|
||||
OffsetRect(&rc, -rc.left, -rc.top);
|
||||
OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
|
||||
|
||||
// Calculate the new x, y starting point.
|
||||
Point.x -= nWidth / 2;
|
||||
Point.y -= nHeight / 2 + 35;
|
||||
|
||||
// Move the window.
|
||||
MoveWindow(hDlg, Point.x, Point.y, nWidth, nHeight, FALSE);
|
||||
SetWindowPos(hDlg, HWND_TOP, rcParent.left + (rc.right / 2), rcParent.top + (rc.bottom / 2) - 25, 0, 0, SWP_NOSIZE);
|
||||
}
|
||||
|
||||
// http://stackoverflow.com/questions/431470/window-border-width-and-height-in-win32-how-do-i-get-it
|
||||
|
@ -755,8 +743,8 @@ BOOL CreateTooltip(HWND hControl, const char* message, int duration)
|
|||
for (i=0; i<MAX_TOOLTIPS; i++) {
|
||||
if (ttlist[i].hTip == NULL) break;
|
||||
}
|
||||
if (i == MAX_TOOLTIPS) {
|
||||
uprintf("Maximum number of tooltips reached\n");
|
||||
if (i >= MAX_TOOLTIPS) {
|
||||
uprintf("Maximum number of tooltips reached (%d)\n", MAX_TOOLTIPS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -799,7 +787,7 @@ void DestroyTooltip(HWND hControl)
|
|||
for (i=0; i<MAX_TOOLTIPS; i++) {
|
||||
if (ttlist[i].hCtrl == hControl) break;
|
||||
}
|
||||
if (i == MAX_TOOLTIPS) return;
|
||||
if (i >= MAX_TOOLTIPS) return;
|
||||
DestroyWindow(ttlist[i].hTip);
|
||||
safe_free(ttlist[i].wstring);
|
||||
ttlist[i].original_proc = NULL;
|
||||
|
@ -809,12 +797,16 @@ void DestroyTooltip(HWND hControl)
|
|||
|
||||
void DestroyAllTooltips(void)
|
||||
{
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
for (i=0; i<MAX_TOOLTIPS; i++) {
|
||||
for (i=0, j=0; i<MAX_TOOLTIPS; i++) {
|
||||
if (ttlist[i].hTip == NULL) continue;
|
||||
j++;
|
||||
DestroyWindow(ttlist[i].hTip);
|
||||
safe_free(ttlist[i].wstring);
|
||||
ttlist[i].original_proc = NULL;
|
||||
ttlist[i].hTip = NULL;
|
||||
ttlist[i].hCtrl = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue