Close button moonlights as Abort
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7298 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
7fce1681df
commit
2c79d33b56
7 changed files with 29 additions and 20 deletions
|
@ -216,6 +216,7 @@ Version History
|
||||||
- Use Consolas font if it exists
|
- Use Consolas font if it exists
|
||||||
|
|
||||||
2.4.1
|
2.4.1
|
||||||
|
- Close button transforms to Abort when appropriate
|
||||||
- Prevent user from modifying the log
|
- Prevent user from modifying the log
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -626,6 +626,17 @@ INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
|
||||||
EnableUICommand(IDM_BROWSESCR, !!g_sdata.input_script);
|
EnableUICommand(IDM_BROWSESCR, !!g_sdata.input_script);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case WM_TIMER:
|
||||||
|
{
|
||||||
|
HWND hCtl;
|
||||||
|
switch(wParam) {
|
||||||
|
case TID_CONFIGURECLOSEORABORT:
|
||||||
|
SendMessage(hCtl = GetDlgItem(hwndDlg, IDCANCEL), WM_SETTEXT, 0, (LPARAM) (g_sdata.thread ? _T("&Abort") : _T("&Close")));
|
||||||
|
EnableWindow(hCtl, true);
|
||||||
|
return KillTimer(hwndDlg, wParam);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
|
@ -750,6 +761,8 @@ INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
|
if (g_sdata.thread)
|
||||||
|
return PostMessage(hwndDlg, WM_COMMAND, IDM_CANCEL, 0);
|
||||||
case IDM_EXIT:
|
case IDM_EXIT:
|
||||||
wParam = 0;
|
wParam = 0;
|
||||||
goto tryquitapp;
|
goto tryquitapp;
|
||||||
|
|
|
@ -94,6 +94,7 @@ static inline bool IsWin95() { return SupportsW95() && (GetVersion() & (0x8000FF
|
||||||
#define WM_MAKENSIS_LOADSYMBOLSET (WM_USER+1002)
|
#define WM_MAKENSIS_LOADSYMBOLSET (WM_USER+1002)
|
||||||
#define WM_MAKENSIS_SAVESYMBOLSET (WM_USER+1003)
|
#define WM_MAKENSIS_SAVESYMBOLSET (WM_USER+1003)
|
||||||
#define WM_MAKENSIS_UPDATEUISTATE (WM_USER+1004)
|
#define WM_MAKENSIS_UPDATEUISTATE (WM_USER+1004)
|
||||||
|
#define TID_CONFIGURECLOSEORABORT 1
|
||||||
|
|
||||||
namespace MakensisAPI {
|
namespace MakensisAPI {
|
||||||
extern const TCHAR* SigintEventNameFmt;
|
extern const TCHAR* SigintEventNameFmt;
|
||||||
|
|
|
@ -14,10 +14,6 @@
|
||||||
#define IDS_EDITSCRIPT 10
|
#define IDS_EDITSCRIPT 10
|
||||||
#define IDS_BROWSESCR 11
|
#define IDS_BROWSESCR 11
|
||||||
#define IDS_CLEARLOG 12
|
#define IDS_CLEARLOG 12
|
||||||
#define IDS_NSISHOME 13
|
|
||||||
#define IDS_FORUM 15
|
|
||||||
#define IDS_NSISUPDATE 16
|
|
||||||
#define IDS_DOCS 17
|
|
||||||
#define IDS_SCRIPT 18
|
#define IDS_SCRIPT 18
|
||||||
#define IDS_ZLIB 19
|
#define IDS_ZLIB 19
|
||||||
#define IDS_ZLIB_SOLID 20
|
#define IDS_ZLIB_SOLID 20
|
||||||
|
|
|
@ -380,14 +380,10 @@ BEGIN
|
||||||
IDS_EDITSCRIPT "Edit Script"
|
IDS_EDITSCRIPT "Edit Script"
|
||||||
IDS_BROWSESCR "Open Script Folder"
|
IDS_BROWSESCR "Open Script Folder"
|
||||||
IDS_CLEARLOG "Clear Log Window"
|
IDS_CLEARLOG "Clear Log Window"
|
||||||
IDS_NSISHOME "NSIS Homepage"
|
|
||||||
IDS_FORUM "NSIS Forum"
|
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_NSISUPDATE "NSIS Update"
|
|
||||||
IDS_DOCS "NSIS Users Manual"
|
|
||||||
IDS_SCRIPT "Defined in Script/Compiler Default"
|
IDS_SCRIPT "Defined in Script/Compiler Default"
|
||||||
IDS_ZLIB "ZLIB"
|
IDS_ZLIB "ZLIB"
|
||||||
IDS_ZLIB_SOLID "ZLIB (solid)"
|
IDS_ZLIB_SOLID "ZLIB (solid)"
|
||||||
|
|
|
@ -307,10 +307,11 @@ HWND GetComboEdit(HWND hCB)
|
||||||
return FindWindowEx(hCB, hList, 0, 0);
|
return FindWindowEx(hCB, hList, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnableDisableItems(HWND hwnd, int on)
|
void EnableDisableItems(int on)
|
||||||
{
|
{
|
||||||
const HWND hCloseBtn = GetDlgItem(hwnd, IDCANCEL);
|
HWND hwndDlg = g_sdata.hwnd;
|
||||||
const HWND hTestBtn = GetDlgItem(hwnd, IDC_TEST);
|
const HWND hCloseBtn = GetDlgItem(hwndDlg, IDCANCEL);
|
||||||
|
const HWND hTestBtn = GetDlgItem(hwndDlg, IDC_TEST);
|
||||||
const HMENU hMenu = g_sdata.menu;
|
const HMENU hMenu = g_sdata.menu;
|
||||||
const UINT mf = (!on ? MF_GRAYED : MF_ENABLED);
|
const UINT mf = (!on ? MF_GRAYED : MF_ENABLED);
|
||||||
const UINT nmf = (!on ? MF_ENABLED : MF_GRAYED);
|
const UINT nmf = (!on ? MF_ENABLED : MF_GRAYED);
|
||||||
|
@ -324,7 +325,7 @@ void EnableDisableItems(HWND hwnd, int on)
|
||||||
EnableMenuItem(hMenu, IDM_TEST, mf);
|
EnableMenuItem(hMenu, IDM_TEST, mf);
|
||||||
}
|
}
|
||||||
EnableMenuItem(hMenu, IDM_CANCEL, nmf);
|
EnableMenuItem(hMenu, IDM_CANCEL, nmf);
|
||||||
EnableWindow(hCloseBtn, on);
|
EnableWindow(hCloseBtn, false);
|
||||||
|
|
||||||
static const PACKEDCMDID_T cmds [] = {
|
static const PACKEDCMDID_T cmds [] = {
|
||||||
PACKCMDID(IDM_EXIT), PACKCMDID(IDM_LOADSCRIPT), PACKCMDID(IDM_EDITSCRIPT),
|
PACKCMDID(IDM_EXIT), PACKCMDID(IDM_LOADSCRIPT), PACKCMDID(IDM_EDITSCRIPT),
|
||||||
|
@ -339,15 +340,16 @@ void EnableDisableItems(HWND hwnd, int on)
|
||||||
EnableToolBarButton(id, on);
|
EnableToolBarButton(id, on);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(g_sdata.hwnd, WM_MAKENSIS_UPDATEUISTATE, 0 ,0);
|
SendMessage(hwndDlg, WM_MAKENSIS_UPDATEUISTATE, 0 ,0);
|
||||||
EnableMenuItem(hMenu, IDM_FILE, mf); // Disable the whole File menu because of the MRU list
|
EnableMenuItem(hMenu, IDM_FILE, mf); // Disable the whole File menu because of the MRU list
|
||||||
DrawMenuBar(g_sdata.hwnd);
|
DrawMenuBar(hwndDlg);
|
||||||
|
|
||||||
HWND hFocus = g_sdata.focused_hwnd, hOptimal = hTestBtn;
|
HWND hFocus = g_sdata.focused_hwnd, hOptimal = hTestBtn;
|
||||||
if (on && hCloseBtn == hFocus) hFocus = hOptimal;
|
if (on && hCloseBtn == hFocus) hFocus = hOptimal;
|
||||||
if (!IsWindowEnabled(hFocus)) hFocus = GetDlgItem(hwnd, IDC_LOGWIN);
|
if (!IsWindowEnabled(hFocus)) hFocus = GetDlgItem(hwndDlg, IDC_LOGWIN);
|
||||||
SetDialogFocus(hwnd, hOptimal);
|
SetDialogFocus(hwndDlg, hOptimal);
|
||||||
SetDialogFocus(hwnd, hFocus);
|
SetDialogFocus(hwndDlg, hFocus);
|
||||||
|
SetTimer(hwndDlg, TID_CONFIGURECLOSEORABORT, 1000, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCompressorStats()
|
void SetCompressorStats()
|
||||||
|
|
|
@ -76,9 +76,9 @@ void CenterOnParent(HWND hwnd);
|
||||||
void SetDialogFocus(HWND hDlg, HWND hCtl); // Use this and not SetFocus()!
|
void SetDialogFocus(HWND hDlg, HWND hCtl); // Use this and not SetFocus()!
|
||||||
#define DlgRet(hDlg, val) ( SetWindowLongPtr((hDlg), DWLP_MSGRESULT, (val)) | TRUE )
|
#define DlgRet(hDlg, val) ( SetWindowLongPtr((hDlg), DWLP_MSGRESULT, (val)) | TRUE )
|
||||||
HWND GetComboEdit(HWND hCB);
|
HWND GetComboEdit(HWND hCB);
|
||||||
#define DisableItems(hwnd) EnableDisableItems(hwnd, 0)
|
#define DisableItems(hwnd) EnableDisableItems(((hwnd), 0))
|
||||||
#define EnableItems(hwnd) EnableDisableItems(hwnd, 1)
|
#define EnableItems(hwnd) EnableDisableItems(((hwnd), 1))
|
||||||
void EnableDisableItems(HWND hwnd, int on);
|
void EnableDisableItems(int on);
|
||||||
bool OpenRegSettingsKey(HKEY &hKey, bool create = false);
|
bool OpenRegSettingsKey(HKEY &hKey, bool create = false);
|
||||||
#define CreateRegSettingsKey(refhkey) OpenRegSettingsKey((refhkey), true)
|
#define CreateRegSettingsKey(refhkey) OpenRegSettingsKey((refhkey), true)
|
||||||
DWORD ReadRegSettingDW(LPCTSTR name, const DWORD defval);
|
DWORD ReadRegSettingDW(LPCTSTR name, const DWORD defval);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue