- Initial keyboard focus set to first (tab-able) field.
- Multi-line text boxes now wrap long lines unless horizontal scroll bar is enabled. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2979 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
5849d6b1b0
commit
75adac3e89
2 changed files with 47 additions and 35 deletions
|
@ -161,6 +161,7 @@ HWND hMainWindow = NULL;
|
|||
HWND hCancelButton = NULL;
|
||||
HWND hNextButton = NULL;
|
||||
HWND hBackButton = NULL;
|
||||
HWND hInitialFocus = NULL;
|
||||
|
||||
HINSTANCE m_hInstance = NULL;
|
||||
|
||||
|
@ -466,6 +467,11 @@ char * WINAPI myGetProfileStringDup(LPCTSTR lpAppName, LPCTSTR lpKeyName)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
UINT WINAPI myGetProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, INT nDefault)
|
||||
{
|
||||
return GetPrivateProfileInt(lpAppName, lpKeyName, nDefault, pszFilename);
|
||||
}
|
||||
|
||||
int ReadSettings(void) {
|
||||
static char szField[25];
|
||||
int nIdx, nCtrlIdx;
|
||||
|
@ -475,16 +481,16 @@ int ReadSettings(void) {
|
|||
pszNextButtonText = myGetProfileStringDup("Settings", "NextButtonText");
|
||||
pszBackButtonText = myGetProfileStringDup("Settings", "BackButtonText");
|
||||
|
||||
nNumFields = GetPrivateProfileInt("Settings", "NumFields", 0, pszFilename);
|
||||
nNumFields = myGetProfileInt("Settings", "NumFields", 0);
|
||||
|
||||
nRectId = GetPrivateProfileInt("Settings", "Rect", DEFAULT_RECT, pszFilename);
|
||||
nRectId = myGetProfileInt("Settings", "Rect", DEFAULT_RECT);
|
||||
|
||||
bBackEnabled = GetPrivateProfileInt("Settings", "BackEnabled", 0xFFFF0000, pszFilename);
|
||||
bBackEnabled = myGetProfileInt("Settings", "BackEnabled", -1);
|
||||
// by ORTIM: 13-August-2002
|
||||
bCancelEnabled = GetPrivateProfileInt("Settings", "CancelEnabled", 0xFFFF0000, pszFilename);
|
||||
bCancelShow = GetPrivateProfileInt("Settings", "CancelShow", 0xFFFF0000, pszFilename);
|
||||
bCancelEnabled = myGetProfileInt("Settings", "CancelEnabled", -1);
|
||||
bCancelShow = myGetProfileInt("Settings", "CancelShow", -1);
|
||||
|
||||
bRTL = GetPrivateProfileInt("Settings", "RTL", 0, pszFilename);
|
||||
bRTL = myGetProfileInt("Settings", "RTL", 0);
|
||||
|
||||
if (nNumFields > 0) {
|
||||
// make this twice as large for the worst case that every control is a browse button.
|
||||
|
@ -577,8 +583,8 @@ int ReadSettings(void) {
|
|||
pFields[nIdx].pszListItems[nResult + 1] = '\0';
|
||||
}
|
||||
}
|
||||
pFields[nIdx].nMaxLength = GetPrivateProfileInt(szField, "MaxLen", 0, pszFilename);
|
||||
pFields[nIdx].nMinLength = GetPrivateProfileInt(szField, "MinLen", 0, pszFilename);
|
||||
pFields[nIdx].nMaxLength = myGetProfileInt(szField, "MaxLen", 0);
|
||||
pFields[nIdx].nMinLength = myGetProfileInt(szField, "MinLen", 0);
|
||||
|
||||
pFields[nIdx].pszValidateText = myGetProfileStringDup(szField, "ValidateText");
|
||||
|
||||
|
@ -602,10 +608,10 @@ int ReadSettings(void) {
|
|||
}
|
||||
}
|
||||
|
||||
pFields[nIdx].rect.left = GetPrivateProfileInt(szField, "LEFT", 0, pszFilename);
|
||||
pFields[nIdx].rect.right = GetPrivateProfileInt(szField, "RIGHT", 0, pszFilename);
|
||||
pFields[nIdx].rect.top = GetPrivateProfileInt(szField, "TOP", 0, pszFilename);
|
||||
pFields[nIdx].rect.bottom = GetPrivateProfileInt(szField, "BOTTOM", 0, pszFilename);
|
||||
pFields[nIdx].rect.left = myGetProfileInt(szField, "LEFT", 0);
|
||||
pFields[nIdx].rect.right = myGetProfileInt(szField, "RIGHT", 0);
|
||||
pFields[nIdx].rect.top = myGetProfileInt(szField, "TOP", 0);
|
||||
pFields[nIdx].rect.bottom = myGetProfileInt(szField, "BOTTOM", 0);
|
||||
|
||||
if (myGetProfileString(szField, "Flags")) {
|
||||
// append the | to make parsing a bit easier
|
||||
|
@ -636,7 +642,7 @@ int ReadSettings(void) {
|
|||
|
||||
// Text color for LINK control, default is pure blue
|
||||
//if (pFields[nIdx].nType == FIELD_LINK)
|
||||
pFields[nIdx].hImage = (HANDLE)GetPrivateProfileInt(szField, "TxtColor", RGB(0,0,255), pszFilename);
|
||||
pFields[nIdx].hImage = (HANDLE)myGetProfileInt(szField, "TxtColor", RGB(0,0,255));
|
||||
|
||||
pFields[nIdx].nControlID = 1200 + nIdx;
|
||||
if (pFields[nIdx].nType == FIELD_FILEREQUEST || pFields[nIdx].nType == FIELD_DIRREQUEST)
|
||||
|
@ -861,16 +867,16 @@ int createCfgDlg()
|
|||
}
|
||||
|
||||
hCancelButton = GetDlgItem(hMainWindow,IDCANCEL);
|
||||
hNextButton = GetDlgItem(hMainWindow,IDOK);
|
||||
hInitialFocus = hNextButton = GetDlgItem(hMainWindow,IDOK);
|
||||
hBackButton = GetDlgItem(hMainWindow,3);
|
||||
|
||||
if (pszCancelButtonText) SetWindowText(hCancelButton,pszCancelButtonText);
|
||||
if (pszNextButtonText) SetWindowText(hNextButton,pszNextButtonText);
|
||||
if (pszBackButtonText) SetWindowText(hBackButton,pszBackButtonText);
|
||||
|
||||
if (bBackEnabled!=0xFFFF0000) EnableWindow(hBackButton,bBackEnabled);
|
||||
if (bCancelEnabled!=0xFFFF0000) EnableWindow(hCancelButton,bCancelEnabled);
|
||||
if (bCancelShow!=0xFFFF0000) old_cancel_visible=ShowWindow(hCancelButton,bCancelShow?SW_SHOWNA:SW_HIDE);
|
||||
if (bBackEnabled!=-1) EnableWindow(hBackButton,bBackEnabled);
|
||||
if (bCancelEnabled!=-1) EnableWindow(hCancelButton,bCancelEnabled);
|
||||
if (bCancelShow!=-1) old_cancel_visible=ShowWindow(hCancelButton,bCancelShow?SW_SHOWNA:SW_HIDE);
|
||||
|
||||
HFONT hFont = (HFONT)SendMessage(hMainWindow, WM_GETFONT, 0, 0);
|
||||
|
||||
|
@ -1051,10 +1057,13 @@ int createCfgDlg()
|
|||
dwStyle |= ES_NUMBER;
|
||||
if (pFields[nIdx].nFlags & FLAG_MULTILINE)
|
||||
{
|
||||
dwStyle |= ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL;
|
||||
dwStyle |= ES_MULTILINE | ES_AUTOVSCROLL;
|
||||
// Enable word-wrap unless we have a horizontal scroll bar
|
||||
if (!(pFields[nIdx].nFlags & FLAG_HSCROLL))
|
||||
dwStyle &= ~ES_AUTOHSCROLL;
|
||||
ConvertNewLines(pFields[nIdx].pszState);
|
||||
}
|
||||
if ( pFields[nIdx].nFlags & FLAG_WANTRETURN )
|
||||
if (pFields[nIdx].nFlags & FLAG_WANTRETURN)
|
||||
dwStyle |= ES_WANTRETURN;
|
||||
if (pFields[nIdx].nFlags & FLAG_VSCROLL)
|
||||
dwStyle |= WS_VSCROLL;
|
||||
|
@ -1098,6 +1107,9 @@ int createCfgDlg()
|
|||
if (hwCtrl) {
|
||||
// Sets the font of IO window to be the same as the main window
|
||||
SendMessage(hwCtrl, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
// Set initial focus to the first appropriate field
|
||||
if ((hInitialFocus == hNextButton) && (dwStyle & WS_TABSTOP))
|
||||
hInitialFocus = hwCtrl;
|
||||
// make sure we created the window, then set additional attributes
|
||||
//if (pFields[nIdx].nMaxLength > 0) {
|
||||
switch (nType) {
|
||||
|
@ -1219,7 +1231,7 @@ void showCfgDlg()
|
|||
// Tell NSIS to remove old inner dialog and pass handle of the new inner dialog
|
||||
SendMessage(hMainWindow, WM_NOTIFY_CUSTOM_READY, (WPARAM)hConfigWindow, 0);
|
||||
ShowWindow(hConfigWindow, SW_SHOWNA);
|
||||
SetFocus(hNextButton);
|
||||
SetFocus(hInitialFocus);
|
||||
|
||||
g_done=0;
|
||||
|
||||
|
@ -1239,7 +1251,7 @@ void showCfgDlg()
|
|||
DestroyWindow(hConfigWindow);
|
||||
|
||||
// by ORTIM: 13-August-2002
|
||||
if (bCancelShow!=0xFFFF0000) ShowWindow(hCancelButton,old_cancel_visible?SW_SHOWNA:SW_HIDE);
|
||||
if (bCancelShow!=-1) ShowWindow(hCancelButton,old_cancel_visible?SW_SHOWNA:SW_HIDE);
|
||||
|
||||
FREE(pFilenameStackEntry);
|
||||
FREE(pszTitle);
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue