mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +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;
|
SETTINGS_INFO NewSettingsInfo;
|
||||||
|
|
||||||
#define IS_CHECKED(a, b) \
|
BOOL ChooseFolder(HWND hwnd)
|
||||||
a = (SendDlgItemMessageW(hDlg, b, BM_GETCHECK, 0, 0) == BST_CHECKED) ? TRUE : FALSE
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
ChooseFolder(HWND hwnd)
|
|
||||||
{
|
{
|
||||||
BOOL bRet = FALSE;
|
BOOL bRet = FALSE;
|
||||||
BROWSEINFOW bi;
|
BROWSEINFOW bi;
|
||||||
ATL::CStringW szBuf;
|
ATL::CStringW szChooseFolderText;
|
||||||
|
|
||||||
szBuf.LoadStringW(IDS_CHOOSE_FOLDER_TEXT);
|
szChooseFolderText.LoadStringW(IDS_CHOOSE_FOLDER_TEXT);
|
||||||
|
|
||||||
ZeroMemory(&bi, sizeof(bi));
|
ZeroMemory(&bi, sizeof(bi));
|
||||||
bi.hwndOwner = hwnd;
|
bi.hwndOwner = hwnd;
|
||||||
bi.pidlRoot = NULL;
|
bi.pidlRoot = NULL;
|
||||||
bi.lpszTitle = szBuf.GetString();
|
bi.lpszTitle = szChooseFolderText.GetString();
|
||||||
bi.ulFlags = BIF_USENEWUI | BIF_DONTGOBELOWDOMAIN | BIF_RETURNONLYFSDIRS | /* BIF_BROWSEFILEJUNCTIONS | */ BIF_VALIDATE;
|
bi.ulFlags = BIF_USENEWUI | BIF_DONTGOBELOWDOMAIN | BIF_RETURNONLYFSDIRS | /* BIF_BROWSEFILEJUNCTIONS | */ BIF_VALIDATE;
|
||||||
|
|
||||||
szBuf.Empty();
|
|
||||||
if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
|
if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
|
||||||
{
|
{
|
||||||
|
ATL::CStringW szBuf;
|
||||||
|
|
||||||
LPITEMIDLIST lpItemList = SHBrowseForFolderW(&bi);
|
LPITEMIDLIST lpItemList = SHBrowseForFolderW(&bi);
|
||||||
if (lpItemList && SHGetPathFromIDListW(lpItemList, szBuf.GetBuffer(MAX_PATH)))
|
if (lpItemList && SHGetPathFromIDListW(lpItemList, szBuf.GetBuffer(MAX_PATH)))
|
||||||
{
|
{
|
||||||
szBuf.ReleaseBuffer();
|
szBuf.ReleaseBuffer();
|
||||||
if (!szBuf.IsEmpty())
|
if (!szBuf.IsEmpty())
|
||||||
{
|
{
|
||||||
SetDlgItemTextW(hwnd, IDC_DOWNLOAD_DIR_EDIT, szBuf);
|
SetDlgItemTextW(hwnd, IDC_DOWNLOAD_DIR_EDIT, szBuf.GetString());
|
||||||
bRet = TRUE;
|
bRet = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
szBuf.ReleaseBuffer();
|
szBuf.ReleaseBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
CoTaskMemFree(lpItemList);
|
CoTaskMemFree(lpItemList);
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
@ -53,7 +52,14 @@ ChooseFolder(HWND hwnd)
|
||||||
return bRet;
|
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_SAVE_WINDOW_POS, BM_SETCHECK, Info->bSaveWndPos, 0);
|
||||||
SendDlgItemMessageW(hDlg, IDC_UPDATE_AVLIST, BM_SETCHECK, Info->bUpdateAtStart, 0);
|
SendDlgItemMessageW(hDlg, IDC_UPDATE_AVLIST, BM_SETCHECK, Info->bUpdateAtStart, 0);
|
||||||
|
@ -75,7 +81,7 @@ static VOID InitSettingsControls(HWND hDlg, PSETTINGS_INFO Info)
|
||||||
SetWindowTextW(GetDlgItem(hDlg, IDC_NO_PROXY_FOR), Info->szNoProxyFor);
|
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)
|
switch (Msg)
|
||||||
{
|
{
|
||||||
|
@ -95,19 +101,19 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPAR
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_SAVE_WINDOW_POS:
|
case IDC_SAVE_WINDOW_POS:
|
||||||
IS_CHECKED(NewSettingsInfo.bSaveWndPos, IDC_SAVE_WINDOW_POS);
|
NewSettingsInfo.bSaveWndPos = IsCheckedDlgItem(hDlg, IDC_SAVE_WINDOW_POS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_UPDATE_AVLIST:
|
case IDC_UPDATE_AVLIST:
|
||||||
IS_CHECKED(NewSettingsInfo.bUpdateAtStart, IDC_UPDATE_AVLIST);
|
NewSettingsInfo.bUpdateAtStart = IsCheckedDlgItem(hDlg, IDC_UPDATE_AVLIST);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_LOG_ENABLED:
|
case IDC_LOG_ENABLED:
|
||||||
IS_CHECKED(NewSettingsInfo.bLogEnabled, IDC_LOG_ENABLED);
|
NewSettingsInfo.bLogEnabled = IsCheckedDlgItem(hDlg, IDC_LOG_ENABLED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_DEL_AFTER_INSTALL:
|
case IDC_DEL_AFTER_INSTALL:
|
||||||
IS_CHECKED(NewSettingsInfo.bDelInstaller, IDC_DEL_AFTER_INSTALL);
|
NewSettingsInfo.bDelInstaller = IsCheckedDlgItem(hDlg, IDC_DEL_AFTER_INSTALL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_PROXY_DEFAULT:
|
case IDC_PROXY_DEFAULT:
|
||||||
|
@ -204,6 +210,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPAR
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VOID CreateSettingsDlg(HWND hwnd)
|
VOID CreateSettingsDlg(HWND hwnd)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue