CancelConfirmIcon becomes CancelConfirmFlags with extra options

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1239 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
eccles 2002-09-30 22:22:16 +00:00
parent b2dad77f69
commit 7c94be4df3
3 changed files with 44 additions and 12 deletions

View file

@ -70,9 +70,9 @@ following values:
<TD vAlign=top bgColor=#cccccc><I>(optional)</I></TD>
<TD vAlign=top bgColor=#eeeeee>If specified, replaces the default "Question" caption by a user specified value.</TD></TR>
<TR>
<TD vAlign=top bgColor=#cccccc><B>CancelConfirmIcon</B></TD>
<TD vAlign=top bgColor=#cccccc><B>CancelConfirmFlags</B></TD>
<TD vAlign=top bgColor=#cccccc><I>(optional)</I></TD>
<TD vAlign=top bgColor=#eeeeee>If specified, adds an icon to the cancel confirmation message box (MB_ICONEXCLAMATION, MB_ICONWARNING, MB_ICONINFORMATION, MB_ICONASTERISK, MB_ICONQUESTION, MB_ICONSTOP, MB_ICONERROR, or MB_ICONHAND).</TD></TR>
<TD vAlign=top bgColor=#eeeeee>If specified, can add an icon to the cancel confirmation message box (MB_ICONEXCLAMATION, MB_ICONINFORMATION, MB_ICONQUESTION, MB_ICONSTOP) or effect the behaviour of it in other ways (MB_TOPMOST, MB_SETFOREGROUND, MB_RIGHT, MB_DEFBUTTON1, MB_DEFBUTTON2). To specify multiple flags, separate using the pipe '|' symbol.</TD></TR>
<TR>
<TD vAlign=top bgColor=#cccccc><B>CancelEnabled</B></TD>
<TD vAlign=top bgColor=#cccccc><I>(optional)</I></TD>
@ -272,6 +272,10 @@ numbers from 1 to NumFields. Each Field section contains the following values:
<A name=history><A name=top><B>History:</B>
<P>
<UL>
<LI><a name=DLL1.4>DLL version 1.6 beta (9/30/2002)
<UL>
<li>CancelConfirmIcon becomes CancelConfirmFlags and can now take the other common MessageBox flags
</UL>
<LI><a name=DLL1.4>DLL version 1.5 beta (9/26/2002)
<UL>
<li>Made close [x] button behave like Cancel (thanks brainsucker)

View file

@ -122,6 +122,7 @@ struct TableEntry {
};
int LookupToken(TableEntry*, char*);
int LookupTokens(TableEntry*, char*);
struct FieldType {
char *pszText;
@ -164,7 +165,7 @@ char *pszCancelQuestionCaption = NULL;
char *pszCancelButtonText = NULL;
char *pszNextButtonText = NULL;
char *pszBackButtonText = NULL;
unsigned int nCancelQuestionIcon = 0;
unsigned int nCancelConfirmFlags=0;
BOOL bBackEnabled=FALSE;
BOOL bCancelEnabled=TRUE; // by ORTIM: 13-August-2002
@ -449,16 +450,23 @@ char * WINAPI myGetProfileStringDup(LPCTSTR lpAppName, LPCTSTR lpKeyName)
bool ReadSettings(void) {
static char szField[25];
int nIdx;
// Messagebox icon types
static TableEntry IconTable[] = {
// Messagebox flags
static TableEntry MBFlagTable[] = {
{ "MB_ICONEXCLAMATION", MB_ICONEXCLAMATION },
{ "MB_ICONWARNING", MB_ICONWARNING },
// { "MB_ICONWARNING", MB_ICONWARNING }, // same as above
{ "MB_ICONINFORMATION", MB_ICONINFORMATION },
{ "MB_ICONASTERISK", MB_ICONASTERISK },
// { "MB_ICONASTERISK", MB_ICONASTERISK }, // same as above
{ "MB_ICONQUESTION", MB_ICONQUESTION },
{ "MB_ICONSTOP", MB_ICONSTOP },
{ "MB_ICONERROR", MB_ICONERROR },
{ "MB_ICONHAND", MB_ICONHAND },
// { "MB_ICONERROR", MB_ICONERROR }, // same as above
// { "MB_ICONHAND", MB_ICONHAND }, // same as above
{ "MB_TOPMOST", MB_TOPMOST },
{ "MB_SETFOREGROUND", MB_SETFOREGROUND },
{ "MB_RIGHT", MB_RIGHT },
{ "MB_DEFBUTTON1", MB_DEFBUTTON1 },
{ "MB_DEFBUTTON2", MB_DEFBUTTON2 },
// { "MB_DEFBUTTON3", MB_DEFBUTTON3 }, // useless, as there are only two buttons
// { "MB_DEFBUTTON4", MB_DEFBUTTON4 }, // useless, as there are only two buttons
{ NULL, 0 }
};
@ -469,8 +477,8 @@ bool ReadSettings(void) {
pszNextButtonText = myGetProfileStringDup("Settings", "NextButtonText");
pszBackButtonText = myGetProfileStringDup("Settings", "BackButtonText");
myGetProfileString("Settings", "CancelConfirmIcon");
nCancelQuestionIcon = LookupToken(IconTable, szResult);
myGetProfileString("Settings", "CancelConfirmFlags");
nCancelConfirmFlags = LookupTokens(MBFlagTable, szResult);
nNumFields = GetPrivateProfileInt("Settings", "NumFields", 0, pszFilename);
bBackEnabled = GetPrivateProfileInt("Settings", "BackEnabled", 0, pszFilename);
@ -684,7 +692,7 @@ BOOL CALLBACK cfgDlgProc(HWND hwndDlg,
HANDLE_MSG(hwndDlg, WM_COMMAND, WMCommandProc);
return 0;
case WM_USER+666:
if (lParam != IDCANCEL || !pszCancelQuestion || MessageBox(hwndDlg,pszCancelQuestion,pszCancelQuestionCaption?pszCancelQuestionCaption:"Question",MB_YESNO|nCancelQuestionIcon)==IDYES)
if (lParam != IDCANCEL || !pszCancelQuestion || MessageBox(hwndDlg,pszCancelQuestion,pszCancelQuestionCaption?pszCancelQuestionCaption:"Question",MB_YESNO|nCancelConfirmFlags)==IDYES)
{
if (lParam == IDCANCEL || lParam == 3 || ValidateFields()) {
if (lParam == 3) g_is_back++;
@ -1040,3 +1048,23 @@ int LookupToken(TableEntry* psTable_, char* pszToken_)
return 0;
}
int LookupTokens(TableEntry* psTable_, char* pszTokens_)
{
int n = 0;
char *pszStart = pszTokens_;
char *pszEnd = pszTokens_;
for (;;) {
if (*pszEnd == '\0') {
n |= LookupToken(psTable_, pszStart);
break;
}
if (*pszEnd == '|') {
*pszEnd = '\0';
n |= LookupToken(psTable_, pszStart);
*pszEnd = '|';
pszStart = pszEnd + 1;
}
pszEnd++;
}
return n;
}

Binary file not shown.