mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 01:52:06 +00:00
[RAPPS] Settings Dialog changes
- replaced `static` with unnamed namespace (static in this context was deprecated in C++03) - fixed `Choose Folder` dialog text not loading the first time (trivial) svn path=/branches/GSoC_2017/rapps/; revision=75810
This commit is contained in:
parent
94e82f5f37
commit
840044411f
1 changed files with 151 additions and 144 deletions
|
@ -12,39 +12,38 @@
|
|||
|
||||
SETTINGS_INFO NewSettingsInfo;
|
||||
|
||||
#define IS_CHECKED(a, b) \
|
||||
a = (SendDlgItemMessageW(hDlg, b, BM_GETCHECK, 0, 0) == BST_CHECKED) ? TRUE : FALSE
|
||||
|
||||
BOOL
|
||||
ChooseFolder(HWND hwnd)
|
||||
BOOL ChooseFolder(HWND hwnd)
|
||||
{
|
||||
BOOL bRet = FALSE;
|
||||
BROWSEINFOW bi;
|
||||
ATL::CStringW szBuf;
|
||||
ATL::CStringW szChooseFolderText;
|
||||
|
||||
szBuf.LoadStringW(IDS_CHOOSE_FOLDER_TEXT);
|
||||
szChooseFolderText.LoadStringW(IDS_CHOOSE_FOLDER_TEXT);
|
||||
|
||||
ZeroMemory(&bi, sizeof(bi));
|
||||
bi.hwndOwner = hwnd;
|
||||
bi.pidlRoot = NULL;
|
||||
bi.lpszTitle = szBuf.GetString();
|
||||
bi.lpszTitle = szChooseFolderText.GetString();
|
||||
bi.ulFlags = BIF_USENEWUI | BIF_DONTGOBELOWDOMAIN | BIF_RETURNONLYFSDIRS | /* BIF_BROWSEFILEJUNCTIONS | */ BIF_VALIDATE;
|
||||
|
||||
szBuf.Empty();
|
||||
if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
|
||||
{
|
||||
ATL::CStringW szBuf;
|
||||
|
||||
LPITEMIDLIST lpItemList = SHBrowseForFolderW(&bi);
|
||||
if (lpItemList && SHGetPathFromIDListW(lpItemList, szBuf.GetBuffer(MAX_PATH)))
|
||||
{
|
||||
szBuf.ReleaseBuffer();
|
||||
if (!szBuf.IsEmpty())
|
||||
{
|
||||
SetDlgItemTextW(hwnd, IDC_DOWNLOAD_DIR_EDIT, szBuf);
|
||||
SetDlgItemTextW(hwnd, IDC_DOWNLOAD_DIR_EDIT, szBuf.GetString());
|
||||
bRet = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
szBuf.ReleaseBuffer();
|
||||
}
|
||||
|
||||
CoTaskMemFree(lpItemList);
|
||||
CoUninitialize();
|
||||
|
@ -53,8 +52,15 @@ ChooseFolder(HWND hwnd)
|
|||
return bRet;
|
||||
}
|
||||
|
||||
static VOID InitSettingsControls(HWND hDlg, PSETTINGS_INFO Info)
|
||||
namespace
|
||||
{
|
||||
inline BOOL IsCheckedDlgItem(HWND hDlg, INT nIDDlgItem)
|
||||
{
|
||||
return (SendDlgItemMessageW(hDlg, nIDDlgItem, BM_GETCHECK, 0, 0) == BST_CHECKED) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
VOID InitSettingsControls(HWND hDlg, PSETTINGS_INFO Info)
|
||||
{
|
||||
SendDlgItemMessageW(hDlg, IDC_SAVE_WINDOW_POS, BM_SETCHECK, Info->bSaveWndPos, 0);
|
||||
SendDlgItemMessageW(hDlg, IDC_UPDATE_AVLIST, BM_SETCHECK, Info->bUpdateAtStart, 0);
|
||||
SendDlgItemMessageW(hDlg, IDC_LOG_ENABLED, BM_SETCHECK, Info->bLogEnabled, 0);
|
||||
|
@ -73,10 +79,10 @@ static VOID InitSettingsControls(HWND hDlg, PSETTINGS_INFO Info)
|
|||
|
||||
SetWindowTextW(GetDlgItem(hDlg, IDC_PROXY_SERVER), Info->szProxyServer);
|
||||
SetWindowTextW(GetDlgItem(hDlg, IDC_NO_PROXY_FOR), Info->szNoProxyFor);
|
||||
}
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
INT_PTR CALLBACK SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (Msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
|
@ -95,19 +101,19 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPAR
|
|||
break;
|
||||
|
||||
case IDC_SAVE_WINDOW_POS:
|
||||
IS_CHECKED(NewSettingsInfo.bSaveWndPos, IDC_SAVE_WINDOW_POS);
|
||||
NewSettingsInfo.bSaveWndPos = IsCheckedDlgItem(hDlg, IDC_SAVE_WINDOW_POS);
|
||||
break;
|
||||
|
||||
case IDC_UPDATE_AVLIST:
|
||||
IS_CHECKED(NewSettingsInfo.bUpdateAtStart, IDC_UPDATE_AVLIST);
|
||||
NewSettingsInfo.bUpdateAtStart = IsCheckedDlgItem(hDlg, IDC_UPDATE_AVLIST);
|
||||
break;
|
||||
|
||||
case IDC_LOG_ENABLED:
|
||||
IS_CHECKED(NewSettingsInfo.bLogEnabled, IDC_LOG_ENABLED);
|
||||
NewSettingsInfo.bLogEnabled = IsCheckedDlgItem(hDlg, IDC_LOG_ENABLED);
|
||||
break;
|
||||
|
||||
case IDC_DEL_AFTER_INSTALL:
|
||||
IS_CHECKED(NewSettingsInfo.bDelInstaller, IDC_DEL_AFTER_INSTALL);
|
||||
NewSettingsInfo.bDelInstaller = IsCheckedDlgItem(hDlg, IDC_DEL_AFTER_INSTALL);
|
||||
break;
|
||||
|
||||
case IDC_PROXY_DEFAULT:
|
||||
|
@ -203,6 +209,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPAR
|
|||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
VOID CreateSettingsDlg(HWND hwnd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue