2008-08-07 20:43:05 +00:00
|
|
|
/*
|
2008-05-04 09:04:14 +00:00
|
|
|
* PROJECT: ReactOS Console Configuration DLL
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
2015-09-22 17:04:32 +00:00
|
|
|
* FILE: dll/cpl/console/options.c
|
2014-04-13 01:03:08 +00:00
|
|
|
* PURPOSE: Options dialog
|
2013-09-15 13:06:05 +00:00
|
|
|
* PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
|
2017-04-24 00:24:34 +00:00
|
|
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
2008-05-04 09:04:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "console.h"
|
|
|
|
|
2013-03-24 17:08:10 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2017-04-24 00:24:34 +00:00
|
|
|
#define MAX_VALUE_NAME 16383
|
|
|
|
|
|
|
|
|
2017-05-03 20:35:12 +00:00
|
|
|
static INT
|
|
|
|
List_GetCount(IN PLIST_CTL ListCtl)
|
2017-04-24 00:24:34 +00:00
|
|
|
{
|
2017-05-03 20:35:12 +00:00
|
|
|
return (INT)SendMessageW(ListCtl->hWndList, CB_GETCOUNT, 0, 0);
|
2017-04-24 00:24:34 +00:00
|
|
|
}
|
|
|
|
|
2017-05-03 20:35:12 +00:00
|
|
|
static ULONG_PTR
|
|
|
|
List_GetData(IN PLIST_CTL ListCtl, IN INT Index)
|
2017-04-24 00:24:34 +00:00
|
|
|
{
|
2017-05-03 20:35:12 +00:00
|
|
|
return (ULONG_PTR)SendMessageW(ListCtl->hWndList, CB_GETITEMDATA, (WPARAM)Index, 0);
|
2017-04-24 00:24:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static VOID
|
|
|
|
AddCodePage(
|
2017-05-03 20:35:12 +00:00
|
|
|
IN PLIST_CTL ListCtl,
|
2017-04-24 00:24:34 +00:00
|
|
|
IN UINT CodePage)
|
|
|
|
{
|
|
|
|
UINT iItem, iDupItem;
|
|
|
|
CPINFOEXW CPInfo;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Add only valid code pages, that is:
|
|
|
|
* - If the CodePage is one of the reserved (alias) values:
|
|
|
|
* CP_ACP == 0 ; CP_OEMCP == 1 ; CP_MACCP == 2 ; CP_THREAD_ACP == 3 ;
|
|
|
|
* or the deprecated CP_SYMBOL == 42 (see http://archives.miloush.net/michkap/archive/2005/11/08/490495.html)
|
|
|
|
* it is considered invalid.
|
|
|
|
* - If IsValidCodePage() fails because the code page is listed but
|
|
|
|
* not installed on the system, it is also considered invalid.
|
|
|
|
*/
|
|
|
|
if (CodePage == CP_ACP || CodePage == CP_OEMCP || CodePage == CP_MACCP ||
|
|
|
|
CodePage == CP_THREAD_ACP || CodePage == CP_SYMBOL || !IsValidCodePage(CodePage))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Retrieve the code page display name */
|
|
|
|
if (!GetCPInfoExW(CodePage, 0, &CPInfo))
|
|
|
|
{
|
|
|
|
/* We failed, just use the code page value as its name */
|
|
|
|
// _ultow(CodePage, CPInfo.CodePageName, 10);
|
2017-05-03 20:35:12 +00:00
|
|
|
StringCchPrintfW(CPInfo.CodePageName, ARRAYSIZE(CPInfo.CodePageName), L"%lu", CodePage);
|
2017-04-24 00:24:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Add the code page into the list, sorted by code page value. Avoid any duplicates. */
|
|
|
|
iDupItem = CB_ERR;
|
2017-05-03 20:35:12 +00:00
|
|
|
iItem = BisectListSortedByValue(ListCtl, CodePage, &iDupItem, TRUE);
|
2017-04-24 00:24:34 +00:00
|
|
|
if (iItem == CB_ERR)
|
|
|
|
iItem = 0;
|
|
|
|
if (iDupItem != CB_ERR)
|
|
|
|
return;
|
2017-05-03 20:35:12 +00:00
|
|
|
iItem = (UINT)SendMessageW(ListCtl->hWndList, CB_INSERTSTRING, iItem, (LPARAM)CPInfo.CodePageName);
|
2017-04-24 00:24:34 +00:00
|
|
|
if (iItem != CB_ERR && iItem != CB_ERRSPACE)
|
2017-05-03 20:35:12 +00:00
|
|
|
iItem = SendMessageW(ListCtl->hWndList, CB_SETITEMDATA, iItem, CodePage);
|
2017-04-24 00:24:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static VOID
|
2017-05-03 20:35:12 +00:00
|
|
|
BuildCodePageList(
|
2019-05-19 20:55:14 +00:00
|
|
|
IN HWND hDlg,
|
|
|
|
IN UINT CurrentCodePage)
|
2017-04-24 00:24:34 +00:00
|
|
|
{
|
2017-05-03 20:35:12 +00:00
|
|
|
LIST_CTL ListCtl;
|
2022-01-29 17:42:23 +00:00
|
|
|
LRESULT lResult;
|
2017-04-24 00:24:34 +00:00
|
|
|
HKEY hKey;
|
2022-01-29 17:42:23 +00:00
|
|
|
DWORD dwIndex, dwType;
|
|
|
|
DWORD cchValueName;
|
2017-04-24 00:24:34 +00:00
|
|
|
UINT CodePage;
|
|
|
|
|
2022-01-29 17:42:23 +00:00
|
|
|
/* Valid code page value names are string representations
|
|
|
|
* of their corresponding decimal values, that are not larger
|
|
|
|
* than MAXUSHORT == 65535. */
|
|
|
|
WCHAR szValueName[sizeof("65535")];
|
|
|
|
|
2017-04-24 00:24:34 +00:00
|
|
|
/* Open the Nls\CodePage key */
|
2022-01-29 17:42:23 +00:00
|
|
|
// #define REGSTR_PATH_CODEPAGE TEXT("System\\CurrentControlSet\\Control\\Nls\\CodePage")
|
2017-04-24 00:24:34 +00:00
|
|
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
|
|
|
L"System\\CurrentControlSet\\Control\\Nls\\CodePage",
|
|
|
|
0,
|
2022-01-29 17:42:23 +00:00
|
|
|
KEY_QUERY_VALUE,
|
2017-04-24 00:24:34 +00:00
|
|
|
&hKey) != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-05-03 20:35:12 +00:00
|
|
|
ListCtl.hWndList = GetDlgItem(hDlg, IDL_CODEPAGE);
|
|
|
|
ListCtl.GetCount = List_GetCount;
|
|
|
|
ListCtl.GetData = List_GetData;
|
2017-04-24 00:24:34 +00:00
|
|
|
|
|
|
|
/* Enumerate all the available code pages on the system */
|
2022-01-29 17:42:23 +00:00
|
|
|
for (dwIndex = 0, cchValueName = ARRAYSIZE(szValueName);
|
|
|
|
(lResult = RegEnumValueW(hKey, dwIndex,
|
|
|
|
szValueName, &cchValueName,
|
|
|
|
NULL, &dwType,
|
|
|
|
NULL, NULL)) != ERROR_NO_MORE_ITEMS;
|
|
|
|
++dwIndex, cchValueName = ARRAYSIZE(szValueName))
|
2017-04-24 00:24:34 +00:00
|
|
|
{
|
2022-01-29 17:42:23 +00:00
|
|
|
/* Ignore if we failed for another reason, e.g. because
|
|
|
|
* the value name is too long (and thus, invalid). */
|
|
|
|
if (lResult != ERROR_SUCCESS)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* Validate the value name (exclude the unnamed value) */
|
|
|
|
if (!cchValueName || (*szValueName == UNICODE_NULL))
|
|
|
|
continue;
|
|
|
|
/* Too large value names have already been handled with ERROR_MORE_DATA */
|
|
|
|
ASSERT((cchValueName < ARRAYSIZE(szValueName)) &&
|
|
|
|
(szValueName[cchValueName] == UNICODE_NULL));
|
2017-04-24 00:24:34 +00:00
|
|
|
|
2022-01-29 17:42:23 +00:00
|
|
|
/* Validate the value type */
|
2017-04-24 00:24:34 +00:00
|
|
|
if (dwType != REG_SZ)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Add the code page into the list.
|
|
|
|
* If _wtol fails and returns 0, the code page is considered invalid
|
|
|
|
* (and indeed this value corresponds to the CP_ACP alias too).
|
|
|
|
*/
|
|
|
|
CodePage = (UINT)_wtol(szValueName);
|
|
|
|
if (CodePage == 0) continue;
|
2017-05-03 20:35:12 +00:00
|
|
|
AddCodePage(&ListCtl, CodePage);
|
2017-04-24 00:24:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
|
|
|
/* Add the special UTF-7 (CP_UTF7 65000) and UTF-8 (CP_UTF8 65001) code pages */
|
2017-05-03 20:35:12 +00:00
|
|
|
AddCodePage(&ListCtl, CP_UTF7);
|
|
|
|
AddCodePage(&ListCtl, CP_UTF8);
|
2017-04-24 00:24:34 +00:00
|
|
|
|
|
|
|
/* Find and select the current code page in the sorted list */
|
2019-05-19 20:55:14 +00:00
|
|
|
if (BisectListSortedByValue(&ListCtl, CurrentCodePage, &CodePage, FALSE) == CB_ERR ||
|
2017-04-24 00:24:34 +00:00
|
|
|
CodePage == CB_ERR)
|
|
|
|
{
|
|
|
|
/* Not found, select the first element */
|
|
|
|
CodePage = 0;
|
|
|
|
}
|
2017-05-03 20:35:12 +00:00
|
|
|
SendMessageW(ListCtl.hWndList, CB_SETCURSEL, (WPARAM)CodePage, 0);
|
2017-04-24 00:24:34 +00:00
|
|
|
}
|
|
|
|
|
2015-03-24 23:58:44 +00:00
|
|
|
static VOID
|
2017-05-03 23:05:25 +00:00
|
|
|
UpdateDialogElements(
|
|
|
|
IN HWND hDlg,
|
|
|
|
IN PCONSOLE_STATE_INFO pConInfo)
|
2014-04-12 14:23:36 +00:00
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
/* Update the cursor size */
|
2015-03-24 23:58:44 +00:00
|
|
|
if (pConInfo->CursorSize <= 25)
|
2014-04-12 14:23:36 +00:00
|
|
|
{
|
|
|
|
/* Small cursor */
|
2017-05-03 23:05:25 +00:00
|
|
|
CheckRadioButton(hDlg, IDC_RADIO_SMALL_CURSOR, IDC_RADIO_LARGE_CURSOR, IDC_RADIO_SMALL_CURSOR);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_SMALL_CURSOR , BST_CHECKED);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_MEDIUM_CURSOR, BST_UNCHECKED);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_LARGE_CURSOR , BST_UNCHECKED);
|
2014-04-12 14:23:36 +00:00
|
|
|
}
|
2015-03-24 23:58:44 +00:00
|
|
|
else if (pConInfo->CursorSize <= 50)
|
2014-04-12 14:23:36 +00:00
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
/* Medium cursor */
|
|
|
|
CheckRadioButton(hDlg, IDC_RADIO_SMALL_CURSOR, IDC_RADIO_LARGE_CURSOR, IDC_RADIO_MEDIUM_CURSOR);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_SMALL_CURSOR , BST_UNCHECKED);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_MEDIUM_CURSOR, BST_CHECKED);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_LARGE_CURSOR , BST_UNCHECKED);
|
2014-04-12 14:23:36 +00:00
|
|
|
}
|
2015-03-24 23:58:44 +00:00
|
|
|
else /* if (pConInfo->CursorSize <= 100) */
|
2014-04-12 14:23:36 +00:00
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
/* Large cursor */
|
|
|
|
CheckRadioButton(hDlg, IDC_RADIO_SMALL_CURSOR, IDC_RADIO_LARGE_CURSOR, IDC_RADIO_LARGE_CURSOR);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_SMALL_CURSOR , BST_UNCHECKED);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_MEDIUM_CURSOR, BST_UNCHECKED);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_LARGE_CURSOR , BST_CHECKED);
|
2014-04-12 14:23:36 +00:00
|
|
|
}
|
|
|
|
|
2017-05-03 23:05:25 +00:00
|
|
|
/* Update the number of history buffers */
|
|
|
|
SendDlgItemMessageW(hDlg, IDC_UPDOWN_NUM_BUFFER, UDM_SETRANGE, 0, MAKELONG(999, 1));
|
|
|
|
SetDlgItemInt(hDlg, IDC_EDIT_NUM_BUFFER, pConInfo->NumberOfHistoryBuffers, FALSE);
|
2014-04-12 14:23:36 +00:00
|
|
|
|
2017-05-03 23:05:25 +00:00
|
|
|
/* Update the history buffer size */
|
|
|
|
SendDlgItemMessageW(hDlg, IDC_UPDOWN_BUFFER_SIZE, UDM_SETRANGE, 0, MAKELONG(999, 1));
|
|
|
|
SetDlgItemInt(hDlg, IDC_EDIT_BUFFER_SIZE, pConInfo->HistoryBufferSize, FALSE);
|
2014-04-12 14:23:36 +00:00
|
|
|
|
|
|
|
/* Update discard duplicates */
|
2017-05-03 23:05:25 +00:00
|
|
|
CheckDlgButton(hDlg, IDC_CHECK_DISCARD_DUPLICATES,
|
2015-03-24 23:58:44 +00:00
|
|
|
pConInfo->HistoryNoDup ? BST_CHECKED : BST_UNCHECKED);
|
2014-04-12 14:23:36 +00:00
|
|
|
|
2017-05-03 23:05:25 +00:00
|
|
|
/* Update full/window screen state */
|
2015-03-24 23:58:44 +00:00
|
|
|
if (pConInfo->FullScreen)
|
2014-04-12 14:23:36 +00:00
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
CheckRadioButton(hDlg, IDC_RADIO_DISPLAY_WINDOW, IDC_RADIO_DISPLAY_FULL, IDC_RADIO_DISPLAY_FULL);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_DISPLAY_WINDOW, BST_UNCHECKED);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_DISPLAY_FULL , BST_CHECKED);
|
2014-04-12 14:23:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
CheckRadioButton(hDlg, IDC_RADIO_DISPLAY_WINDOW, IDC_RADIO_DISPLAY_FULL, IDC_RADIO_DISPLAY_WINDOW);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_DISPLAY_WINDOW, BST_CHECKED);
|
|
|
|
// CheckDlgButton(hDlg, IDC_RADIO_DISPLAY_FULL , BST_UNCHECKED);
|
2014-04-12 14:23:36 +00:00
|
|
|
}
|
|
|
|
|
2017-05-03 23:05:25 +00:00
|
|
|
/* Update "Quick-edit" state */
|
|
|
|
CheckDlgButton(hDlg, IDC_CHECK_QUICK_EDIT,
|
2015-03-24 23:58:44 +00:00
|
|
|
pConInfo->QuickEdit ? BST_CHECKED : BST_UNCHECKED);
|
2014-04-12 14:23:36 +00:00
|
|
|
|
2017-05-03 23:05:25 +00:00
|
|
|
/* Update "Insert mode" state */
|
|
|
|
CheckDlgButton(hDlg, IDC_CHECK_INSERT_MODE,
|
2015-03-24 23:58:44 +00:00
|
|
|
pConInfo->InsertMode ? BST_CHECKED : BST_UNCHECKED);
|
2014-04-12 14:23:36 +00:00
|
|
|
}
|
2008-05-04 09:04:14 +00:00
|
|
|
|
|
|
|
INT_PTR
|
|
|
|
CALLBACK
|
2017-05-03 23:05:25 +00:00
|
|
|
OptionsProc(HWND hDlg,
|
[CONSOLE.DLL-KERNEL32-CONSRV]
Fix the console properties dialog, when launching and transmitting console properties. Before, the properties dialog was directly launched by the console server (consrv), running with CSRSS (System) privileges, what constituted a security hole. Now, I create a remote thread in the running process owning the console for launching the properties dialog (thus it has only user privileges, and not System ones anymore). For that purpose, I basically took the technique described in the following paper (Cesar Cerrudo, "Story of a dumb patch", http://www.argeniss.com/research/MSBugPaper.pdf or http://www.scn.rain.com/~neighorn/PDF/MSBugPaper.pdf), where basically the console server shares the console properties via a shared memory section with the console properties dialog dll. The address of the thread which launches the dialog in the context of the console app is given to the console server the same way as we do for the control handler (called e.g. when you press Ctrl-C, etc...)
Of course this is quite hackish, because you have the GUI interface split between the console server and the console properties dialog dll. Something far more elegant would be to put all the GUI thingie into a dedicated dll or exe, running with the same privileges as the console program itself (a kind of console -- or terminal -- emulator).
[CONSOLE.DLL]
Fix retriving / setting colors.c and other things.
[CONSRV.DLL]
- Fix retrieving / setting console properties from the registry (via the HKCU\Console\* keys), via the shell shortcuts (not totally done at the moment, because somebody has to implement properly that thing : http://msdn.microsoft.com/en-us/library/windows/desktop/bb773359(v=vs.85).aspx (NT_CONSOLE_PROPS structure stored as a shortcut data block) (at application launching time), and via the console properties dialog.
- Few DPRINTs removed.
svn path=/branches/ros-csrss/; revision=58415
2013-03-03 15:35:12 +00:00
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
2008-05-04 09:04:14 +00:00
|
|
|
{
|
2013-03-03 15:47:52 +00:00
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
{
|
2019-05-19 20:55:14 +00:00
|
|
|
BuildCodePageList(hDlg, ConInfo->CodePage);
|
2017-05-03 23:05:25 +00:00
|
|
|
UpdateDialogElements(hDlg, ConInfo);
|
2013-03-03 15:47:52 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2014-04-12 14:23:36 +00:00
|
|
|
|
2013-03-03 15:47:52 +00:00
|
|
|
case WM_NOTIFY:
|
|
|
|
{
|
2017-04-17 23:26:07 +00:00
|
|
|
LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
|
2014-04-12 14:23:36 +00:00
|
|
|
|
2008-05-04 09:04:14 +00:00
|
|
|
if (lppsn->hdr.code == UDN_DELTAPOS)
|
|
|
|
{
|
2017-04-17 23:26:07 +00:00
|
|
|
LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam;
|
|
|
|
|
2014-04-12 14:23:36 +00:00
|
|
|
if (lppsn->hdr.idFrom == IDC_UPDOWN_BUFFER_SIZE)
|
|
|
|
{
|
|
|
|
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 1), 999);
|
2015-03-24 23:58:44 +00:00
|
|
|
ConInfo->HistoryBufferSize = lpnmud->iPos;
|
2017-05-03 23:05:25 +00:00
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2014-04-12 14:23:36 +00:00
|
|
|
}
|
|
|
|
else if (lppsn->hdr.idFrom == IDC_UPDOWN_NUM_BUFFER)
|
|
|
|
{
|
|
|
|
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 1), 999);
|
2015-03-24 23:58:44 +00:00
|
|
|
ConInfo->NumberOfHistoryBuffers = lpnmud->iPos;
|
2017-05-03 23:05:25 +00:00
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2014-04-12 14:23:36 +00:00
|
|
|
}
|
2013-03-03 15:47:52 +00:00
|
|
|
}
|
|
|
|
else if (lppsn->hdr.code == PSN_APPLY)
|
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
ApplyConsoleInfo(hDlg);
|
2015-04-05 23:04:42 +00:00
|
|
|
return TRUE;
|
2013-03-03 15:47:52 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2014-04-12 14:23:36 +00:00
|
|
|
|
2013-03-03 15:47:52 +00:00
|
|
|
case WM_COMMAND:
|
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
if (HIWORD(wParam) == BN_CLICKED)
|
2013-03-03 15:47:52 +00:00
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
2013-03-03 15:47:52 +00:00
|
|
|
case IDC_RADIO_SMALL_CURSOR:
|
|
|
|
{
|
2015-03-24 23:58:44 +00:00
|
|
|
ConInfo->CursorSize = 25;
|
2017-05-03 23:05:25 +00:00
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2013-03-03 15:47:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case IDC_RADIO_MEDIUM_CURSOR:
|
|
|
|
{
|
2015-03-24 23:58:44 +00:00
|
|
|
ConInfo->CursorSize = 50;
|
2017-05-03 23:05:25 +00:00
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2013-03-03 15:47:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case IDC_RADIO_LARGE_CURSOR:
|
|
|
|
{
|
2015-03-24 23:58:44 +00:00
|
|
|
ConInfo->CursorSize = 100;
|
2017-05-03 23:05:25 +00:00
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2013-03-03 15:47:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case IDC_RADIO_DISPLAY_WINDOW:
|
|
|
|
{
|
2015-03-24 23:58:44 +00:00
|
|
|
ConInfo->FullScreen = FALSE;
|
2017-05-03 23:05:25 +00:00
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2013-03-03 15:47:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case IDC_RADIO_DISPLAY_FULL:
|
|
|
|
{
|
2015-03-24 23:58:44 +00:00
|
|
|
ConInfo->FullScreen = TRUE;
|
2017-05-03 23:05:25 +00:00
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2013-03-03 15:47:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case IDC_CHECK_QUICK_EDIT:
|
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
ConInfo->QuickEdit = (IsDlgButtonChecked(hDlg, IDC_CHECK_QUICK_EDIT) == BST_CHECKED); // BST_UNCHECKED or BST_INDETERMINATE => FALSE
|
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2013-03-03 15:47:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case IDC_CHECK_INSERT_MODE:
|
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
ConInfo->InsertMode = (IsDlgButtonChecked(hDlg, IDC_CHECK_INSERT_MODE) == BST_CHECKED); // BST_UNCHECKED or BST_INDETERMINATE => FALSE
|
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2013-03-03 15:47:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case IDC_CHECK_DISCARD_DUPLICATES:
|
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
ConInfo->HistoryNoDup = (IsDlgButtonChecked(hDlg, IDC_CHECK_DISCARD_DUPLICATES) == BST_CHECKED); // BST_UNCHECKED or BST_INDETERMINATE => FALSE
|
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2013-03-03 15:47:52 +00:00
|
|
|
break;
|
|
|
|
}
|
2017-05-03 23:05:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (HIWORD(wParam) == EN_KILLFOCUS)
|
|
|
|
{
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
2014-04-12 14:23:36 +00:00
|
|
|
case IDC_EDIT_BUFFER_SIZE:
|
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
DWORD sizeBuff;
|
2014-04-12 14:23:36 +00:00
|
|
|
|
2017-05-03 23:05:25 +00:00
|
|
|
sizeBuff = GetDlgItemInt(hDlg, IDC_EDIT_BUFFER_SIZE, NULL, FALSE);
|
|
|
|
sizeBuff = min(max(sizeBuff, 1), 999);
|
2014-04-12 14:23:36 +00:00
|
|
|
|
2017-05-03 23:05:25 +00:00
|
|
|
ConInfo->HistoryBufferSize = sizeBuff;
|
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2014-04-12 14:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case IDC_EDIT_NUM_BUFFER:
|
|
|
|
{
|
2017-05-03 23:05:25 +00:00
|
|
|
DWORD numBuff;
|
2014-04-12 14:23:36 +00:00
|
|
|
|
2017-05-03 23:05:25 +00:00
|
|
|
numBuff = GetDlgItemInt(hDlg, IDC_EDIT_NUM_BUFFER, NULL, FALSE);
|
|
|
|
numBuff = min(max(numBuff, 1), 999);
|
2014-04-12 14:23:36 +00:00
|
|
|
|
2017-05-03 23:05:25 +00:00
|
|
|
ConInfo->NumberOfHistoryBuffers = numBuff;
|
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2014-04-12 14:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
2017-04-24 00:24:34 +00:00
|
|
|
}
|
2017-05-03 23:05:25 +00:00
|
|
|
}
|
|
|
|
else
|
2019-05-19 20:55:14 +00:00
|
|
|
// (HIWORD(wParam) == CBN_KILLFOCUS)
|
2017-05-03 23:05:25 +00:00
|
|
|
if ((HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_SELENDOK) &&
|
|
|
|
(LOWORD(wParam) == IDL_CODEPAGE))
|
|
|
|
{
|
|
|
|
HWND hWndList = GetDlgItem(hDlg, IDL_CODEPAGE);
|
|
|
|
INT iItem;
|
|
|
|
UINT CodePage;
|
|
|
|
|
|
|
|
iItem = (INT)SendMessageW(hWndList, CB_GETCURSEL, 0, 0);
|
|
|
|
if (iItem == CB_ERR)
|
2013-03-03 15:47:52 +00:00
|
|
|
break;
|
2017-05-03 23:05:25 +00:00
|
|
|
|
|
|
|
CodePage = (UINT)SendMessageW(hWndList, CB_GETITEMDATA, iItem, 0);
|
|
|
|
if (CodePage == CB_ERR)
|
|
|
|
break;
|
|
|
|
|
2022-01-28 02:00:31 +00:00
|
|
|
/* If the user has selected a different code page... */
|
2019-05-19 20:55:14 +00:00
|
|
|
if ((HIWORD(wParam) == CBN_SELENDOK) && (CodePage != ConInfo->CodePage))
|
|
|
|
{
|
2022-01-28 02:00:31 +00:00
|
|
|
/* ... update the code page and change the property sheet state */
|
2019-05-19 20:55:14 +00:00
|
|
|
ConInfo->CodePage = CodePage;
|
|
|
|
ResetFontPreview(&FontPreview);
|
2017-05-03 23:05:25 +00:00
|
|
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
2019-05-19 20:55:14 +00:00
|
|
|
}
|
2013-03-03 15:47:52 +00:00
|
|
|
}
|
2017-05-03 23:05:25 +00:00
|
|
|
|
2013-03-03 15:47:52 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-04-12 14:23:36 +00:00
|
|
|
|
2013-03-03 15:47:52 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2008-05-04 09:04:14 +00:00
|
|
|
|
2013-03-03 15:47:52 +00:00
|
|
|
return FALSE;
|
2008-05-04 09:04:14 +00:00
|
|
|
}
|