Author: hbelusca
Date: Wed May 3 23:05:25 2017
New Revision: 74468
URL:
http://svn.reactos.org/svn/reactos?rev=74468&view=rev
Log:
[CONSOLE.CPL]: Minor code refactoring (cont.):
- Use 'hDlg' for the dialog window handle variable (instead of hwndDlg), as
already done in other parts of the code;
- Use our regular formatting for function prototypes;
- Use explicit unicode functions;
In addition:
- Correctly check for the dialog controls notifications (within WM_COMMAND message);
- Update the current code page when the code page combobox selection changes, but only
notify the property sheet of the change when the combobox contents is validated (either
the user pressed ENTER in some way, or the combobox lost its focus).
Modified:
trunk/reactos/dll/cpl/console/colors.c
trunk/reactos/dll/cpl/console/layout.c
trunk/reactos/dll/cpl/console/options.c
Modified: trunk/reactos/dll/cpl/console/colors.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/console/colors.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/console/colors.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/console/colors.c [iso-8859-1] Wed May 3 23:05:25 2017
@@ -4,6 +4,7 @@
* FILE: dll/cpl/console/colors.c
* PURPOSE: Colors dialog
* PROGRAMMERS: Johannes Anderwald (johannes.anderwald(a)reactos.org)
+ * Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
#include "console.h"
@@ -14,30 +15,31 @@
static DWORD ActiveStaticControl = 0;
static BOOL
-PaintStaticControls(HWND hwndDlg,
- PCONSOLE_STATE_INFO pConInfo,
- LPDRAWITEMSTRUCT drawItem)
+PaintStaticControls(
+ IN HWND hDlg,
+ IN PCONSOLE_STATE_INFO pConInfo,
+ IN LPDRAWITEMSTRUCT drawItem)
{
HBRUSH hBrush;
DWORD index;
index = min(drawItem->CtlID - IDC_STATIC_COLOR1,
ARRAYSIZE(pConInfo->ColorTable) - 1);
+
hBrush = CreateSolidBrush(pConInfo->ColorTable[index]);
if (!hBrush) return FALSE;
FillRect(drawItem->hDC, &drawItem->rcItem, hBrush);
- DeleteObject((HGDIOBJ)hBrush);
+ DeleteObject(hBrush);
+
if (ActiveStaticControl == index)
- {
DrawFocusRect(drawItem->hDC, &drawItem->rcItem);
- }
return TRUE;
}
INT_PTR CALLBACK
-ColorsProc(HWND hwndDlg,
+ColorsProc(HWND hDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
@@ -50,13 +52,13 @@
case WM_INITDIALOG:
{
/* Set the valid range of the colour indicators */
- SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_COLOR_RED , UDM_SETRANGE, 0,
(LPARAM)MAKELONG(255, 0));
- SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_COLOR_GREEN, UDM_SETRANGE, 0,
(LPARAM)MAKELONG(255, 0));
- SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_COLOR_BLUE , UDM_SETRANGE, 0,
(LPARAM)MAKELONG(255, 0));
+ SendDlgItemMessageW(hDlg, IDC_UPDOWN_COLOR_RED , UDM_SETRANGE, 0,
(LPARAM)MAKELONG(255, 0));
+ SendDlgItemMessageW(hDlg, IDC_UPDOWN_COLOR_GREEN, UDM_SETRANGE, 0,
(LPARAM)MAKELONG(255, 0));
+ SendDlgItemMessageW(hDlg, IDC_UPDOWN_COLOR_BLUE , UDM_SETRANGE, 0,
(LPARAM)MAKELONG(255, 0));
/* Select by default the screen background option */
- CheckRadioButton(hwndDlg, IDC_RADIO_SCREEN_TEXT, IDC_RADIO_POPUP_BACKGROUND,
IDC_RADIO_SCREEN_BACKGROUND);
- SendMessage(hwndDlg, WM_COMMAND, IDC_RADIO_SCREEN_BACKGROUND, 0);
+ CheckRadioButton(hDlg, IDC_RADIO_SCREEN_TEXT, IDC_RADIO_POPUP_BACKGROUND,
IDC_RADIO_SCREEN_BACKGROUND);
+ SendMessageW(hDlg, WM_COMMAND, IDC_RADIO_SCREEN_BACKGROUND, 0);
return TRUE;
}
@@ -66,7 +68,7 @@
LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam;
if (drawItem->CtlID >= IDC_STATIC_COLOR1 && drawItem->CtlID
<= IDC_STATIC_COLOR16)
- return PaintStaticControls(hwndDlg, ConInfo, drawItem);
+ return PaintStaticControls(hDlg, ConInfo, drawItem);
else if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR)
return PaintText(drawItem, ConInfo, Screen);
else if (drawItem->CtlID == IDC_STATIC_POPUP_COLOR)
@@ -81,7 +83,7 @@
{
case PSN_APPLY:
{
- ApplyConsoleInfo(hwndDlg);
+ ApplyConsoleInfo(hDlg);
return TRUE;
}
@@ -114,11 +116,11 @@
}
ConInfo->ColorTable[colorIndex] = color;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex),
NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
-
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex),
NULL, TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
+
+ PropSheet_Changed(GetParent(hDlg), hDlg);
break;
}
}
@@ -128,8 +130,10 @@
case WM_COMMAND:
{
- switch (LOWORD(wParam))
+ if (HIWORD(wParam) == BN_CLICKED)
{
+ switch (LOWORD(wParam))
+ {
case IDC_RADIO_SCREEN_TEXT:
{
/* Get the color of the screen foreground */
@@ -137,15 +141,15 @@
color = ConInfo->ColorTable[colorIndex];
/* Set the values of the colour indicators */
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color),
FALSE);
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color),
FALSE);
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color),
FALSE);
-
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
+
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
ActiveStaticControl = colorIndex;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
break;
}
@@ -156,15 +160,15 @@
color = ConInfo->ColorTable[colorIndex];
/* Set the values of the colour indicators */
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color),
FALSE);
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color),
FALSE);
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color),
FALSE);
-
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
+
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
ActiveStaticControl = colorIndex;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
break;
}
@@ -175,15 +179,15 @@
color = ConInfo->ColorTable[colorIndex];
/* Set the values of the colour indicators */
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color),
FALSE);
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color),
FALSE);
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color),
FALSE);
-
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
+
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
ActiveStaticControl = colorIndex;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
break;
}
@@ -194,95 +198,92 @@
color = ConInfo->ColorTable[colorIndex];
/* Set the values of the colour indicators */
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color),
FALSE);
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color),
FALSE);
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color),
FALSE);
-
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
+
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
ActiveStaticControl = colorIndex;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
- break;
- }
-
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
+ break;
+ }
+ }
+ }
+ else
+ if (HIWORD(wParam) == EN_KILLFOCUS)
+ {
+ switch (LOWORD(wParam))
+ {
case IDC_EDIT_COLOR_RED:
{
- if (HIWORD(wParam) == EN_KILLFOCUS)
- {
- DWORD red;
-
- /* Get the current color */
- colorIndex = ActiveStaticControl;
- color = ConInfo->ColorTable[colorIndex];
-
- red = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, NULL, FALSE);
- red = min(max(red, 0), 255);
-
- color = RGB(red, GetGValue(color), GetBValue(color));
-
- ConInfo->ColorTable[colorIndex] = color;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
colorIndex), NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR),
NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) ,
NULL, TRUE);
-
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
+ DWORD red;
+
+ /* Get the current color */
+ colorIndex = ActiveStaticControl;
+ color = ConInfo->ColorTable[colorIndex];
+
+ red = GetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED, NULL, FALSE);
+ red = min(max(red, 0), 255);
+
+ color = RGB(red, GetGValue(color), GetBValue(color));
+
+ ConInfo->ColorTable[colorIndex] = color;
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex),
NULL, TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
+
+ PropSheet_Changed(GetParent(hDlg), hDlg);
break;
}
case IDC_EDIT_COLOR_GREEN:
{
- if (HIWORD(wParam) == EN_KILLFOCUS)
- {
- DWORD green;
-
- /* Get the current color */
- colorIndex = ActiveStaticControl;
- color = ConInfo->ColorTable[colorIndex];
-
- green = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, NULL,
FALSE);
- green = min(max(green, 0), 255);
-
- color = RGB(GetRValue(color), green, GetBValue(color));
-
- ConInfo->ColorTable[colorIndex] = color;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
colorIndex), NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR),
NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) ,
NULL, TRUE);
-
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
+ DWORD green;
+
+ /* Get the current color */
+ colorIndex = ActiveStaticControl;
+ color = ConInfo->ColorTable[colorIndex];
+
+ green = GetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, NULL, FALSE);
+ green = min(max(green, 0), 255);
+
+ color = RGB(GetRValue(color), green, GetBValue(color));
+
+ ConInfo->ColorTable[colorIndex] = color;
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex),
NULL, TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
+
+ PropSheet_Changed(GetParent(hDlg), hDlg);
break;
}
case IDC_EDIT_COLOR_BLUE:
{
- if (HIWORD(wParam) == EN_KILLFOCUS)
- {
- DWORD blue;
-
- /* Get the current color */
- colorIndex = ActiveStaticControl;
- color = ConInfo->ColorTable[colorIndex];
-
- blue = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, NULL, FALSE);
- blue = min(max(blue, 0), 255);
-
- color = RGB(GetRValue(color), GetGValue(color), blue);
-
- ConInfo->ColorTable[colorIndex] = color;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
colorIndex), NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR),
NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) ,
NULL, TRUE);
-
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
- break;
- }
-
+ DWORD blue;
+
+ /* Get the current color */
+ colorIndex = ActiveStaticControl;
+ color = ConInfo->ColorTable[colorIndex];
+
+ blue = GetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE, NULL, FALSE);
+ blue = min(max(blue, 0), 255);
+
+ color = RGB(GetRValue(color), GetGValue(color), blue);
+
+ ConInfo->ColorTable[colorIndex] = color;
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex),
NULL, TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
+
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+ break;
+ }
+ }
}
-
+ else
if ( HIWORD(wParam) == STN_CLICKED &&
IDC_STATIC_COLOR1 <= LOWORD(wParam) && LOWORD(wParam) <=
IDC_STATIC_COLOR16 )
{
@@ -290,43 +291,45 @@
if (colorIndex == ActiveStaticControl)
{
- /* Same static control was re-clicked */
+ /* The same static control was re-clicked */
break;
}
color = ConInfo->ColorTable[colorIndex];
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
- SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
+ SetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
/* Update global struct */
- if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_SCREEN_TEXT))
+ if (IsDlgButtonChecked(hDlg, IDC_RADIO_SCREEN_TEXT))
{
ConInfo->ScreenAttributes = MakeAttrib(colorIndex,
BkgdAttribFromAttrib(ConInfo->ScreenAttributes));
}
- else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_SCREEN_BACKGROUND))
+ else if (IsDlgButtonChecked(hDlg, IDC_RADIO_SCREEN_BACKGROUND))
{
ConInfo->ScreenAttributes =
MakeAttrib(TextAttribFromAttrib(ConInfo->ScreenAttributes), colorIndex);
}
- else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_POPUP_TEXT))
+ else if (IsDlgButtonChecked(hDlg, IDC_RADIO_POPUP_TEXT))
{
ConInfo->PopupAttributes = MakeAttrib(colorIndex,
BkgdAttribFromAttrib(ConInfo->PopupAttributes));
}
- else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_POPUP_BACKGROUND))
+ else if (IsDlgButtonChecked(hDlg, IDC_RADIO_POPUP_BACKGROUND))
{
ConInfo->PopupAttributes =
MakeAttrib(TextAttribFromAttrib(ConInfo->PopupAttributes), colorIndex);
}
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl),
NULL, TRUE);
ActiveStaticControl = colorIndex;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 +
ActiveStaticControl), NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL,
TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL,
TRUE);
-
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl),
NULL, TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
+
+ PropSheet_Changed(GetParent(hDlg), hDlg);
break;
}
+
+ break;
}
default:
Modified: trunk/reactos/dll/cpl/console/layout.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/console/layout.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/console/layout.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/console/layout.c [iso-8859-1] Wed May 3 23:05:25 2017
@@ -24,8 +24,9 @@
VOID
-PaintConsole(LPDRAWITEMSTRUCT drawItem,
- PCONSOLE_STATE_INFO pConInfo)
+PaintConsole(
+ IN LPDRAWITEMSTRUCT drawItem,
+ IN PCONSOLE_STATE_INFO pConInfo)
{
HBRUSH hBrush;
RECT cRect, fRect;
@@ -91,13 +92,14 @@
hBrush =
CreateSolidBrush(pConInfo->ColorTable[BkgdAttribFromAttrib(pConInfo->ScreenAttributes)]);
SetRect(&fRect, startx + 3, starty + 6, cRect.right - 6, cRect.bottom - 3);
FillRect(drawItem->hDC, &fRect, hBrush);
- DeleteObject((HGDIOBJ)hBrush);
+ DeleteObject(hBrush);
}
BOOL
-PaintText(LPDRAWITEMSTRUCT drawItem,
- PCONSOLE_STATE_INFO pConInfo,
- TEXT_TYPE TextMode)
+PaintText(
+ IN LPDRAWITEMSTRUCT drawItem,
+ IN PCONSOLE_STATE_INFO pConInfo,
+ IN TEXT_TYPE TextMode)
{
USHORT CurrentAttrib;
COLORREF pbkColor, ptColor;
@@ -174,9 +176,6 @@
WPARAM wParam,
LPARAM lParam)
{
- UNREFERENCED_PARAMETER(hwndDlg);
- UNREFERENCED_PARAMETER(wParam);
-
switch (uMsg)
{
case WM_INITDIALOG:
@@ -343,166 +342,149 @@
case WM_COMMAND:
{
- switch (LOWORD(wParam))
+ if (HIWORD(wParam) == EN_KILLFOCUS)
{
+ switch (LOWORD(wParam))
+ {
case IDC_EDIT_SCREEN_BUFFER_WIDTH:
{
- if (HIWORD(wParam) == EN_KILLFOCUS)
- {
- DWORD swidth, wwidth;
-
- swidth = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH,
NULL, FALSE);
- wwidth = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH ,
NULL, FALSE);
+ DWORD swidth, wwidth;
+
+ swidth = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL,
FALSE);
+ wwidth = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH , NULL,
FALSE);
+
+ /* Be sure that the (new) screen buffer width is in the correct range
*/
+ swidth = min(max(swidth, 1), 0xFFFF);
+
+ /* Automatically adjust window size when screen buffer decreases */
+ if (wwidth > swidth)
+ {
+ wwidth = swidth;
+ SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, wwidth,
TRUE);
+ }
+
+ ConInfo->ScreenBufferSize.X = (SHORT)swidth;
+ ConInfo->WindowSize.X = (SHORT)wwidth;
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ break;
+ }
+
+ case IDC_EDIT_WINDOW_SIZE_WIDTH:
+ {
+ DWORD swidth, wwidth;
+
+ swidth = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL,
FALSE);
+ wwidth = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH , NULL,
FALSE);
+
+ /* Automatically adjust screen buffer size when window size enlarges
*/
+ if (wwidth >= swidth)
+ {
+ swidth = wwidth;
/* Be sure that the (new) screen buffer width is in the correct
range */
swidth = min(max(swidth, 1), 0xFFFF);
- /* Automatically adjust window size when screen buffer decreases
*/
- if (wwidth > swidth)
- {
- wwidth = swidth;
- SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, wwidth,
TRUE);
- }
-
- ConInfo->ScreenBufferSize.X = (SHORT)swidth;
- ConInfo->WindowSize.X = (SHORT)wwidth;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
+ SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, swidth,
TRUE);
+ }
+
+ ConInfo->ScreenBufferSize.X = (SHORT)swidth;
+ ConInfo->WindowSize.X = (SHORT)wwidth;
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
}
- case IDC_EDIT_WINDOW_SIZE_WIDTH:
- {
- if (HIWORD(wParam) == EN_KILLFOCUS)
- {
- DWORD swidth, wwidth;
-
- swidth = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH,
NULL, FALSE);
- wwidth = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH ,
NULL, FALSE);
-
- /* Automatically adjust screen buffer size when window size
enlarges */
- if (wwidth >= swidth)
- {
- swidth = wwidth;
-
- /* Be sure that the (new) screen buffer width is in the
correct range */
- swidth = min(max(swidth, 1), 0xFFFF);
-
- SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, swidth,
TRUE);
- }
-
- ConInfo->ScreenBufferSize.X = (SHORT)swidth;
- ConInfo->WindowSize.X = (SHORT)wwidth;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
+ case IDC_EDIT_SCREEN_BUFFER_HEIGHT:
+ {
+ DWORD sheight, wheight;
+
+ sheight = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL,
FALSE);
+ wheight = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT , NULL,
FALSE);
+
+ /* Be sure that the (new) screen buffer width is in the correct range
*/
+ sheight = min(max(sheight, 1), 0xFFFF);
+
+ /* Automatically adjust window size when screen buffer decreases */
+ if (wheight > sheight)
+ {
+ wheight = sheight;
+ SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, wheight,
TRUE);
+ }
+
+ ConInfo->ScreenBufferSize.Y = (SHORT)sheight;
+ ConInfo->WindowSize.Y = (SHORT)wheight;
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
}
- case IDC_EDIT_SCREEN_BUFFER_HEIGHT:
- {
- if (HIWORD(wParam) == EN_KILLFOCUS)
- {
- DWORD sheight, wheight;
-
- sheight = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT,
NULL, FALSE);
- wheight = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT ,
NULL, FALSE);
+ case IDC_EDIT_WINDOW_SIZE_HEIGHT:
+ {
+ DWORD sheight, wheight;
+
+ sheight = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL,
FALSE);
+ wheight = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT , NULL,
FALSE);
+
+ /* Automatically adjust screen buffer size when window size enlarges
*/
+ if (wheight >= sheight)
+ {
+ sheight = wheight;
/* Be sure that the (new) screen buffer width is in the correct
range */
sheight = min(max(sheight, 1), 0xFFFF);
- /* Automatically adjust window size when screen buffer decreases
*/
- if (wheight > sheight)
- {
- wheight = sheight;
- SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, wheight,
TRUE);
- }
-
- ConInfo->ScreenBufferSize.Y = (SHORT)sheight;
- ConInfo->WindowSize.Y = (SHORT)wheight;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
- break;
- }
-
- case IDC_EDIT_WINDOW_SIZE_HEIGHT:
- {
- if (HIWORD(wParam) == EN_KILLFOCUS)
- {
- DWORD sheight, wheight;
-
- sheight = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT,
NULL, FALSE);
- wheight = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT ,
NULL, FALSE);
-
- /* Automatically adjust screen buffer size when window size
enlarges */
- if (wheight >= sheight)
- {
- sheight = wheight;
-
- /* Be sure that the (new) screen buffer width is in the
correct range */
- sheight = min(max(sheight, 1), 0xFFFF);
-
- SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT,
sheight, TRUE);
- }
-
- ConInfo->ScreenBufferSize.Y = (SHORT)sheight;
- ConInfo->WindowSize.Y = (SHORT)wheight;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
+ SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, sheight,
TRUE);
+ }
+
+ ConInfo->ScreenBufferSize.Y = (SHORT)sheight;
+ ConInfo->WindowSize.Y = (SHORT)wheight;
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
}
case IDC_EDIT_WINDOW_POS_LEFT:
case IDC_EDIT_WINDOW_POS_TOP:
{
- if (HIWORD(wParam) == EN_KILLFOCUS)
- {
- DWORD left, top;
-
- left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL,
TRUE);
- top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP , NULL,
TRUE);
-
- ConInfo->WindowPosition.x = left;
- ConInfo->WindowPosition.y = top;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
+ ConInfo->WindowPosition.x = GetDlgItemInt(hwndDlg,
IDC_EDIT_WINDOW_POS_LEFT, NULL, TRUE);
+ ConInfo->WindowPosition.y = GetDlgItemInt(hwndDlg,
IDC_EDIT_WINDOW_POS_TOP , NULL, TRUE);
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
}
-
- case IDC_CHECK_SYSTEM_POS_WINDOW:
- {
- LONG res = SendMessage((HWND)lParam, BM_GETCHECK, 0, 0);
- if (res == BST_CHECKED)
- {
- ULONG left, top;
-
- left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL,
TRUE);
- top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP , NULL,
TRUE);
-
- ConInfo->AutoPosition = FALSE;
- ConInfo->WindowPosition.x = left;
- ConInfo->WindowPosition.y = top;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
-
- SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED,
0);
- EnableDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, TRUE);
- EnableDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP , TRUE);
- EnableDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT, TRUE);
- EnableDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP , TRUE);
- }
- else if (res == BST_UNCHECKED)
- {
- ConInfo->AutoPosition = TRUE;
- // Do not touch ConInfo->WindowPosition !!
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
-
- SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
- EnableDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, FALSE);
- EnableDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP , FALSE);
- EnableDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT, FALSE);
- EnableDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP , FALSE);
- }
}
}
+ else
+ if (HIWORD(wParam) == BN_CLICKED &&
+ LOWORD(wParam) == IDC_CHECK_SYSTEM_POS_WINDOW)
+ {
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_SYSTEM_POS_WINDOW) ==
BST_CHECKED)
+ {
+ EnableDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, FALSE);
+ EnableDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP , FALSE);
+ EnableDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT, FALSE);
+ EnableDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP , FALSE);
+
+ ConInfo->AutoPosition = TRUE;
+ // Do not touch ConInfo->WindowPosition !!
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ }
+ else
+ {
+ ULONG left, top;
+
+ left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, TRUE);
+ top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP , NULL, TRUE);
+
+ EnableDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, TRUE);
+ EnableDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP , TRUE);
+ EnableDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT, TRUE);
+ EnableDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP , TRUE);
+
+ ConInfo->AutoPosition = FALSE;
+ ConInfo->WindowPosition.x = left;
+ ConInfo->WindowPosition.y = top;
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ }
+ }
+
+ break;
}
default:
Modified: trunk/reactos/dll/cpl/console/options.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/console/options.c?…
==============================================================================
--- trunk/reactos/dll/cpl/console/options.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/console/options.c [iso-8859-1] Wed May 3 23:05:25 2017
@@ -136,87 +136,74 @@
}
static VOID
-UpdateDialogElements(HWND hwndDlg, PCONSOLE_STATE_INFO pConInfo)
-{
- HWND hDlgCtrl;
-
- /* Update cursor size */
+UpdateDialogElements(
+ IN HWND hDlg,
+ IN PCONSOLE_STATE_INFO pConInfo)
+{
+ /* Update the cursor size */
if (pConInfo->CursorSize <= 25)
{
/* Small cursor */
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
-
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
+ 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);
}
else if (pConInfo->CursorSize <= 50)
{
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
-
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
+ /* 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);
}
else /* if (pConInfo->CursorSize <= 100) */
{
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
-
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
- }
-
- /* Update num buffers */
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_NUM_BUFFER);
- SendMessageW(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG(999, 1));
- SetDlgItemInt(hwndDlg, IDC_EDIT_NUM_BUFFER, pConInfo->NumberOfHistoryBuffers,
FALSE);
-
- /* Update buffer size */
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_BUFFER_SIZE);
- SendMessageW(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG(999, 1));
- SetDlgItemInt(hwndDlg, IDC_EDIT_BUFFER_SIZE, pConInfo->HistoryBufferSize, FALSE);
+ /* 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);
+ }
+
+ /* 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);
+
+ /* 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);
/* Update discard duplicates */
- CheckDlgButton(hwndDlg, IDC_CHECK_DISCARD_DUPLICATES,
+ CheckDlgButton(hDlg, IDC_CHECK_DISCARD_DUPLICATES,
pConInfo->HistoryNoDup ? BST_CHECKED : BST_UNCHECKED);
- /* Update full/window screen */
+ /* Update full/window screen state */
if (pConInfo->FullScreen)
{
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
-
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
+ 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);
}
else
{
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
-
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL);
- SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
- }
-
- /* Update quick edit */
- CheckDlgButton(hwndDlg, IDC_CHECK_QUICK_EDIT,
+ 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);
+ }
+
+ /* Update "Quick-edit" state */
+ CheckDlgButton(hDlg, IDC_CHECK_QUICK_EDIT,
pConInfo->QuickEdit ? BST_CHECKED : BST_UNCHECKED);
- /* Update insert mode */
- CheckDlgButton(hwndDlg, IDC_CHECK_INSERT_MODE,
+ /* Update "Insert mode" state */
+ CheckDlgButton(hDlg, IDC_CHECK_INSERT_MODE,
pConInfo->InsertMode ? BST_CHECKED : BST_UNCHECKED);
}
INT_PTR
CALLBACK
-OptionsProc(HWND hwndDlg,
+OptionsProc(HWND hDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
@@ -225,8 +212,8 @@
{
case WM_INITDIALOG:
{
- BuildCodePageList(hwndDlg);
- UpdateDialogElements(hwndDlg, ConInfo);
+ BuildCodePageList(hDlg);
+ UpdateDialogElements(hDlg, ConInfo);
return TRUE;
}
@@ -242,18 +229,18 @@
{
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 1),
999);
ConInfo->HistoryBufferSize = lpnmud->iPos;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ PropSheet_Changed(GetParent(hDlg), hDlg);
}
else if (lppsn->hdr.idFrom == IDC_UPDOWN_NUM_BUFFER)
{
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 1),
999);
ConInfo->NumberOfHistoryBuffers = lpnmud->iPos;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ PropSheet_Changed(GetParent(hDlg), hDlg);
}
}
else if (lppsn->hdr.code == PSN_APPLY)
{
- ApplyConsoleInfo(hwndDlg);
+ ApplyConsoleInfo(hDlg);
return TRUE;
}
break;
@@ -261,139 +248,112 @@
case WM_COMMAND:
{
- LRESULT lResult;
-
- switch (LOWORD(wParam))
- {
+ if (HIWORD(wParam) == BN_CLICKED)
+ {
+ switch (LOWORD(wParam))
+ {
case IDC_RADIO_SMALL_CURSOR:
{
ConInfo->CursorSize = 25;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ PropSheet_Changed(GetParent(hDlg), hDlg);
break;
}
case IDC_RADIO_MEDIUM_CURSOR:
{
ConInfo->CursorSize = 50;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ PropSheet_Changed(GetParent(hDlg), hDlg);
break;
}
case IDC_RADIO_LARGE_CURSOR:
{
ConInfo->CursorSize = 100;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ PropSheet_Changed(GetParent(hDlg), hDlg);
break;
}
case IDC_RADIO_DISPLAY_WINDOW:
{
ConInfo->FullScreen = FALSE;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ PropSheet_Changed(GetParent(hDlg), hDlg);
break;
}
case IDC_RADIO_DISPLAY_FULL:
{
ConInfo->FullScreen = TRUE;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ PropSheet_Changed(GetParent(hDlg), hDlg);
break;
}
case IDC_CHECK_QUICK_EDIT:
{
- lResult = SendMessageW((HWND)lParam, BM_GETCHECK, 0, 0);
- if (lResult == BST_CHECKED)
- {
- ConInfo->QuickEdit = FALSE;
- SendMessageW((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED,
0);
- }
- else if (lResult == BST_UNCHECKED)
- {
- ConInfo->QuickEdit = TRUE;
- SendMessageW((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
- }
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ ConInfo->QuickEdit = (IsDlgButtonChecked(hDlg,
IDC_CHECK_QUICK_EDIT) == BST_CHECKED); // BST_UNCHECKED or BST_INDETERMINATE => FALSE
+ PropSheet_Changed(GetParent(hDlg), hDlg);
break;
}
case IDC_CHECK_INSERT_MODE:
{
- lResult = SendMessageW((HWND)lParam, BM_GETCHECK, 0, 0);
- if (lResult == BST_CHECKED)
- {
- ConInfo->InsertMode = FALSE;
- SendMessageW((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED,
0);
- }
- else if (lResult == BST_UNCHECKED)
- {
- ConInfo->InsertMode = TRUE;
- SendMessageW((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
- }
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ ConInfo->InsertMode = (IsDlgButtonChecked(hDlg,
IDC_CHECK_INSERT_MODE) == BST_CHECKED); // BST_UNCHECKED or BST_INDETERMINATE => FALSE
+ PropSheet_Changed(GetParent(hDlg), hDlg);
break;
}
case IDC_CHECK_DISCARD_DUPLICATES:
{
- lResult = SendMessageW((HWND)lParam, BM_GETCHECK, 0, 0);
- if (lResult == BST_CHECKED)
- {
- ConInfo->HistoryNoDup = FALSE;
- SendMessageW((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED,
0);
- }
- else if (lResult == BST_UNCHECKED)
- {
- ConInfo->HistoryNoDup = TRUE;
- SendMessageW((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
- }
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- break;
- }
+ ConInfo->HistoryNoDup = (IsDlgButtonChecked(hDlg,
IDC_CHECK_DISCARD_DUPLICATES) == BST_CHECKED); // BST_UNCHECKED or BST_INDETERMINATE =>
FALSE
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+ break;
+ }
+ }
+ }
+ else
+ if (HIWORD(wParam) == EN_KILLFOCUS)
+ {
+ switch (LOWORD(wParam))
+ {
case IDC_EDIT_BUFFER_SIZE:
{
- if (HIWORD(wParam) == EN_KILLFOCUS)
- {
- DWORD sizeBuff;
-
- sizeBuff = GetDlgItemInt(hwndDlg, IDC_EDIT_BUFFER_SIZE, NULL,
FALSE);
- sizeBuff = min(max(sizeBuff, 1), 999);
-
- ConInfo->HistoryBufferSize = sizeBuff;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
+ DWORD sizeBuff;
+
+ sizeBuff = GetDlgItemInt(hDlg, IDC_EDIT_BUFFER_SIZE, NULL, FALSE);
+ sizeBuff = min(max(sizeBuff, 1), 999);
+
+ ConInfo->HistoryBufferSize = sizeBuff;
+ PropSheet_Changed(GetParent(hDlg), hDlg);
break;
}
case IDC_EDIT_NUM_BUFFER:
{
- if (HIWORD(wParam) == EN_KILLFOCUS)
- {
- DWORD numBuff;
-
- numBuff = GetDlgItemInt(hwndDlg, IDC_EDIT_NUM_BUFFER, NULL,
FALSE);
- numBuff = min(max(numBuff, 1), 999);
-
- ConInfo->NumberOfHistoryBuffers = numBuff;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
- break;
- }
- case IDL_CODEPAGE:
- {
- if (HIWORD(wParam) == CBN_SELENDOK)
- {
- INT iItem;
- UINT CodePage;
-
- iItem = (INT)SendMessageW((HWND)lParam, CB_GETCURSEL, 0, 0);
- if (iItem != CB_ERR)
- {
- CodePage = (UINT)SendMessageW((HWND)lParam, CB_GETITEMDATA,
iItem, 0);
- if (CodePage != CB_ERR)
- {
- ConInfo->CodePage = CodePage;
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
- }
- }
- break;
- }
- default:
- break;
- }
+ DWORD numBuff;
+
+ numBuff = GetDlgItemInt(hDlg, IDC_EDIT_NUM_BUFFER, NULL, FALSE);
+ numBuff = min(max(numBuff, 1), 999);
+
+ ConInfo->NumberOfHistoryBuffers = numBuff;
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+ break;
+ }
+ }
+ }
+ else
+ 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)
+ break;
+
+ CodePage = (UINT)SendMessageW(hWndList, CB_GETITEMDATA, iItem, 0);
+ if (CodePage == CB_ERR)
+ break;
+
+ ConInfo->CodePage = CodePage;
+
+ /* Change the property sheet state only if the user validated */
+ if (HIWORD(wParam) == CBN_SELENDOK)
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+ }
+
break;
}