mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 09:11:42 +00:00
[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). svn path=/trunk/; revision=74468
This commit is contained in:
parent
ec320d1e33
commit
2dfccd0635
3 changed files with 318 additions and 373 deletions
|
@ -4,6 +4,7 @@
|
||||||
* FILE: dll/cpl/console/colors.c
|
* FILE: dll/cpl/console/colors.c
|
||||||
* PURPOSE: Colors dialog
|
* PURPOSE: Colors dialog
|
||||||
* PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
|
* PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
|
||||||
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
@ -14,30 +15,31 @@
|
||||||
static DWORD ActiveStaticControl = 0;
|
static DWORD ActiveStaticControl = 0;
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
PaintStaticControls(HWND hwndDlg,
|
PaintStaticControls(
|
||||||
PCONSOLE_STATE_INFO pConInfo,
|
IN HWND hDlg,
|
||||||
LPDRAWITEMSTRUCT drawItem)
|
IN PCONSOLE_STATE_INFO pConInfo,
|
||||||
|
IN LPDRAWITEMSTRUCT drawItem)
|
||||||
{
|
{
|
||||||
HBRUSH hBrush;
|
HBRUSH hBrush;
|
||||||
DWORD index;
|
DWORD index;
|
||||||
|
|
||||||
index = min(drawItem->CtlID - IDC_STATIC_COLOR1,
|
index = min(drawItem->CtlID - IDC_STATIC_COLOR1,
|
||||||
ARRAYSIZE(pConInfo->ColorTable) - 1);
|
ARRAYSIZE(pConInfo->ColorTable) - 1);
|
||||||
|
|
||||||
hBrush = CreateSolidBrush(pConInfo->ColorTable[index]);
|
hBrush = CreateSolidBrush(pConInfo->ColorTable[index]);
|
||||||
if (!hBrush) return FALSE;
|
if (!hBrush) return FALSE;
|
||||||
|
|
||||||
FillRect(drawItem->hDC, &drawItem->rcItem, hBrush);
|
FillRect(drawItem->hDC, &drawItem->rcItem, hBrush);
|
||||||
DeleteObject((HGDIOBJ)hBrush);
|
DeleteObject(hBrush);
|
||||||
|
|
||||||
if (ActiveStaticControl == index)
|
if (ActiveStaticControl == index)
|
||||||
{
|
|
||||||
DrawFocusRect(drawItem->hDC, &drawItem->rcItem);
|
DrawFocusRect(drawItem->hDC, &drawItem->rcItem);
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
ColorsProc(HWND hwndDlg,
|
ColorsProc(HWND hDlg,
|
||||||
UINT uMsg,
|
UINT uMsg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
|
@ -50,13 +52,13 @@ ColorsProc(HWND hwndDlg,
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
/* Set the valid range of the colour indicators */
|
/* Set the valid range of the colour indicators */
|
||||||
SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_COLOR_RED , UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0));
|
SendDlgItemMessageW(hDlg, 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(hDlg, 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_BLUE , UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0));
|
||||||
|
|
||||||
/* Select by default the screen background option */
|
/* Select by default the screen background option */
|
||||||
CheckRadioButton(hwndDlg, IDC_RADIO_SCREEN_TEXT, IDC_RADIO_POPUP_BACKGROUND, IDC_RADIO_SCREEN_BACKGROUND);
|
CheckRadioButton(hDlg, IDC_RADIO_SCREEN_TEXT, IDC_RADIO_POPUP_BACKGROUND, IDC_RADIO_SCREEN_BACKGROUND);
|
||||||
SendMessage(hwndDlg, WM_COMMAND, IDC_RADIO_SCREEN_BACKGROUND, 0);
|
SendMessageW(hDlg, WM_COMMAND, IDC_RADIO_SCREEN_BACKGROUND, 0);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +68,7 @@ ColorsProc(HWND hwndDlg,
|
||||||
LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam;
|
LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam;
|
||||||
|
|
||||||
if (drawItem->CtlID >= IDC_STATIC_COLOR1 && drawItem->CtlID <= IDC_STATIC_COLOR16)
|
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)
|
else if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR)
|
||||||
return PaintText(drawItem, ConInfo, Screen);
|
return PaintText(drawItem, ConInfo, Screen);
|
||||||
else if (drawItem->CtlID == IDC_STATIC_POPUP_COLOR)
|
else if (drawItem->CtlID == IDC_STATIC_POPUP_COLOR)
|
||||||
|
@ -81,7 +83,7 @@ ColorsProc(HWND hwndDlg,
|
||||||
{
|
{
|
||||||
case PSN_APPLY:
|
case PSN_APPLY:
|
||||||
{
|
{
|
||||||
ApplyConsoleInfo(hwndDlg);
|
ApplyConsoleInfo(hDlg);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,11 +116,11 @@ ColorsProc(HWND hwndDlg,
|
||||||
}
|
}
|
||||||
|
|
||||||
ConInfo->ColorTable[colorIndex] = color;
|
ConInfo->ColorTable[colorIndex] = color;
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||||
|
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,8 +130,10 @@ ColorsProc(HWND hwndDlg,
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
if (HIWORD(wParam) == BN_CLICKED)
|
||||||
{
|
{
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
case IDC_RADIO_SCREEN_TEXT:
|
case IDC_RADIO_SCREEN_TEXT:
|
||||||
{
|
{
|
||||||
/* Get the color of the screen foreground */
|
/* Get the color of the screen foreground */
|
||||||
|
@ -137,15 +141,15 @@ ColorsProc(HWND hwndDlg,
|
||||||
color = ConInfo->ColorTable[colorIndex];
|
color = ConInfo->ColorTable[colorIndex];
|
||||||
|
|
||||||
/* Set the values of the colour indicators */
|
/* Set the values of the colour indicators */
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
||||||
|
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
||||||
ActiveStaticControl = colorIndex;
|
ActiveStaticControl = colorIndex;
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,15 +160,15 @@ ColorsProc(HWND hwndDlg,
|
||||||
color = ConInfo->ColorTable[colorIndex];
|
color = ConInfo->ColorTable[colorIndex];
|
||||||
|
|
||||||
/* Set the values of the colour indicators */
|
/* Set the values of the colour indicators */
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
||||||
|
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
||||||
ActiveStaticControl = colorIndex;
|
ActiveStaticControl = colorIndex;
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,15 +179,15 @@ ColorsProc(HWND hwndDlg,
|
||||||
color = ConInfo->ColorTable[colorIndex];
|
color = ConInfo->ColorTable[colorIndex];
|
||||||
|
|
||||||
/* Set the values of the colour indicators */
|
/* Set the values of the colour indicators */
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
||||||
|
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
||||||
ActiveStaticControl = colorIndex;
|
ActiveStaticControl = colorIndex;
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,95 +198,92 @@ ColorsProc(HWND hwndDlg,
|
||||||
color = ConInfo->ColorTable[colorIndex];
|
color = ConInfo->ColorTable[colorIndex];
|
||||||
|
|
||||||
/* Set the values of the colour indicators */
|
/* Set the values of the colour indicators */
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
||||||
|
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
||||||
ActiveStaticControl = colorIndex;
|
ActiveStaticControl = colorIndex;
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (HIWORD(wParam) == EN_KILLFOCUS)
|
||||||
|
{
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
case IDC_EDIT_COLOR_RED:
|
case IDC_EDIT_COLOR_RED:
|
||||||
{
|
{
|
||||||
if (HIWORD(wParam) == EN_KILLFOCUS)
|
DWORD red;
|
||||||
{
|
|
||||||
DWORD red;
|
|
||||||
|
|
||||||
/* Get the current color */
|
/* Get the current color */
|
||||||
colorIndex = ActiveStaticControl;
|
colorIndex = ActiveStaticControl;
|
||||||
color = ConInfo->ColorTable[colorIndex];
|
color = ConInfo->ColorTable[colorIndex];
|
||||||
|
|
||||||
red = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, NULL, FALSE);
|
red = GetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED, NULL, FALSE);
|
||||||
red = min(max(red, 0), 255);
|
red = min(max(red, 0), 255);
|
||||||
|
|
||||||
color = RGB(red, GetGValue(color), GetBValue(color));
|
color = RGB(red, GetGValue(color), GetBValue(color));
|
||||||
|
|
||||||
ConInfo->ColorTable[colorIndex] = color;
|
ConInfo->ColorTable[colorIndex] = color;
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||||
|
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDC_EDIT_COLOR_GREEN:
|
case IDC_EDIT_COLOR_GREEN:
|
||||||
{
|
{
|
||||||
if (HIWORD(wParam) == EN_KILLFOCUS)
|
DWORD green;
|
||||||
{
|
|
||||||
DWORD green;
|
|
||||||
|
|
||||||
/* Get the current color */
|
/* Get the current color */
|
||||||
colorIndex = ActiveStaticControl;
|
colorIndex = ActiveStaticControl;
|
||||||
color = ConInfo->ColorTable[colorIndex];
|
color = ConInfo->ColorTable[colorIndex];
|
||||||
|
|
||||||
green = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, NULL, FALSE);
|
green = GetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, NULL, FALSE);
|
||||||
green = min(max(green, 0), 255);
|
green = min(max(green, 0), 255);
|
||||||
|
|
||||||
color = RGB(GetRValue(color), green, GetBValue(color));
|
color = RGB(GetRValue(color), green, GetBValue(color));
|
||||||
|
|
||||||
ConInfo->ColorTable[colorIndex] = color;
|
ConInfo->ColorTable[colorIndex] = color;
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||||
|
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDC_EDIT_COLOR_BLUE:
|
case IDC_EDIT_COLOR_BLUE:
|
||||||
{
|
{
|
||||||
if (HIWORD(wParam) == EN_KILLFOCUS)
|
DWORD blue;
|
||||||
{
|
|
||||||
DWORD blue;
|
|
||||||
|
|
||||||
/* Get the current color */
|
/* Get the current color */
|
||||||
colorIndex = ActiveStaticControl;
|
colorIndex = ActiveStaticControl;
|
||||||
color = ConInfo->ColorTable[colorIndex];
|
color = ConInfo->ColorTable[colorIndex];
|
||||||
|
|
||||||
blue = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, NULL, FALSE);
|
blue = GetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE, NULL, FALSE);
|
||||||
blue = min(max(blue, 0), 255);
|
blue = min(max(blue, 0), 255);
|
||||||
|
|
||||||
color = RGB(GetRValue(color), GetGValue(color), blue);
|
color = RGB(GetRValue(color), GetGValue(color), blue);
|
||||||
|
|
||||||
ConInfo->ColorTable[colorIndex] = color;
|
ConInfo->ColorTable[colorIndex] = color;
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||||
|
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if ( HIWORD(wParam) == STN_CLICKED &&
|
if ( HIWORD(wParam) == STN_CLICKED &&
|
||||||
IDC_STATIC_COLOR1 <= LOWORD(wParam) && LOWORD(wParam) <= IDC_STATIC_COLOR16 )
|
IDC_STATIC_COLOR1 <= LOWORD(wParam) && LOWORD(wParam) <= IDC_STATIC_COLOR16 )
|
||||||
{
|
{
|
||||||
|
@ -290,43 +291,45 @@ ColorsProc(HWND hwndDlg,
|
||||||
|
|
||||||
if (colorIndex == ActiveStaticControl)
|
if (colorIndex == ActiveStaticControl)
|
||||||
{
|
{
|
||||||
/* Same static control was re-clicked */
|
/* The same static control was re-clicked */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
color = ConInfo->ColorTable[colorIndex];
|
color = ConInfo->ColorTable[colorIndex];
|
||||||
|
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
SetDlgItemInt(hDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
||||||
|
|
||||||
/* Update global struct */
|
/* Update global struct */
|
||||||
if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_SCREEN_TEXT))
|
if (IsDlgButtonChecked(hDlg, IDC_RADIO_SCREEN_TEXT))
|
||||||
{
|
{
|
||||||
ConInfo->ScreenAttributes = MakeAttrib(colorIndex, BkgdAttribFromAttrib(ConInfo->ScreenAttributes));
|
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);
|
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));
|
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);
|
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;
|
ActiveStaticControl = colorIndex;
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + ActiveStaticControl), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||||
|
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -24,8 +24,9 @@ const WCHAR szPreviewText[] =
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
PaintConsole(LPDRAWITEMSTRUCT drawItem,
|
PaintConsole(
|
||||||
PCONSOLE_STATE_INFO pConInfo)
|
IN LPDRAWITEMSTRUCT drawItem,
|
||||||
|
IN PCONSOLE_STATE_INFO pConInfo)
|
||||||
{
|
{
|
||||||
HBRUSH hBrush;
|
HBRUSH hBrush;
|
||||||
RECT cRect, fRect;
|
RECT cRect, fRect;
|
||||||
|
@ -91,13 +92,14 @@ PaintConsole(LPDRAWITEMSTRUCT drawItem,
|
||||||
hBrush = CreateSolidBrush(pConInfo->ColorTable[BkgdAttribFromAttrib(pConInfo->ScreenAttributes)]);
|
hBrush = CreateSolidBrush(pConInfo->ColorTable[BkgdAttribFromAttrib(pConInfo->ScreenAttributes)]);
|
||||||
SetRect(&fRect, startx + 3, starty + 6, cRect.right - 6, cRect.bottom - 3);
|
SetRect(&fRect, startx + 3, starty + 6, cRect.right - 6, cRect.bottom - 3);
|
||||||
FillRect(drawItem->hDC, &fRect, hBrush);
|
FillRect(drawItem->hDC, &fRect, hBrush);
|
||||||
DeleteObject((HGDIOBJ)hBrush);
|
DeleteObject(hBrush);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
PaintText(LPDRAWITEMSTRUCT drawItem,
|
PaintText(
|
||||||
PCONSOLE_STATE_INFO pConInfo,
|
IN LPDRAWITEMSTRUCT drawItem,
|
||||||
TEXT_TYPE TextMode)
|
IN PCONSOLE_STATE_INFO pConInfo,
|
||||||
|
IN TEXT_TYPE TextMode)
|
||||||
{
|
{
|
||||||
USHORT CurrentAttrib;
|
USHORT CurrentAttrib;
|
||||||
COLORREF pbkColor, ptColor;
|
COLORREF pbkColor, ptColor;
|
||||||
|
@ -174,9 +176,6 @@ LayoutProc(HWND hwndDlg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(hwndDlg);
|
|
||||||
UNREFERENCED_PARAMETER(wParam);
|
|
||||||
|
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
|
@ -343,166 +342,149 @@ LayoutProc(HWND hwndDlg,
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
if (HIWORD(wParam) == EN_KILLFOCUS)
|
||||||
{
|
{
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
case IDC_EDIT_SCREEN_BUFFER_WIDTH:
|
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);
|
||||||
|
|
||||||
|
/* 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)
|
||||||
{
|
{
|
||||||
DWORD swidth, wwidth;
|
wwidth = swidth;
|
||||||
|
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, wwidth, TRUE);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConInfo->ScreenBufferSize.X = (SHORT)swidth;
|
||||||
|
ConInfo->WindowSize.X = (SHORT)wwidth;
|
||||||
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDC_EDIT_WINDOW_SIZE_WIDTH:
|
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)
|
||||||
{
|
{
|
||||||
DWORD swidth, wwidth;
|
swidth = wwidth;
|
||||||
|
|
||||||
swidth = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL, FALSE);
|
/* Be sure that the (new) screen buffer width is in the correct range */
|
||||||
wwidth = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH , NULL, FALSE);
|
swidth = min(max(swidth, 1), 0xFFFF);
|
||||||
|
|
||||||
/* Automatically adjust screen buffer size when window size enlarges */
|
SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, swidth, TRUE);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConInfo->ScreenBufferSize.X = (SHORT)swidth;
|
||||||
|
ConInfo->WindowSize.X = (SHORT)wwidth;
|
||||||
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDC_EDIT_SCREEN_BUFFER_HEIGHT:
|
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);
|
||||||
|
|
||||||
|
/* 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)
|
||||||
{
|
{
|
||||||
DWORD sheight, wheight;
|
wheight = sheight;
|
||||||
|
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, wheight, TRUE);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConInfo->ScreenBufferSize.Y = (SHORT)sheight;
|
||||||
|
ConInfo->WindowSize.Y = (SHORT)wheight;
|
||||||
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDC_EDIT_WINDOW_SIZE_HEIGHT:
|
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)
|
||||||
{
|
{
|
||||||
DWORD sheight, wheight;
|
sheight = wheight;
|
||||||
|
|
||||||
sheight = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL, FALSE);
|
/* Be sure that the (new) screen buffer width is in the correct range */
|
||||||
wheight = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT , NULL, FALSE);
|
sheight = min(max(sheight, 1), 0xFFFF);
|
||||||
|
|
||||||
/* Automatically adjust screen buffer size when window size enlarges */
|
SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, sheight, TRUE);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConInfo->ScreenBufferSize.Y = (SHORT)sheight;
|
||||||
|
ConInfo->WindowSize.Y = (SHORT)wheight;
|
||||||
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDC_EDIT_WINDOW_POS_LEFT:
|
case IDC_EDIT_WINDOW_POS_LEFT:
|
||||||
case IDC_EDIT_WINDOW_POS_TOP:
|
case IDC_EDIT_WINDOW_POS_TOP:
|
||||||
{
|
{
|
||||||
if (HIWORD(wParam) == EN_KILLFOCUS)
|
ConInfo->WindowPosition.x = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, TRUE);
|
||||||
{
|
ConInfo->WindowPosition.y = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP , NULL, TRUE);
|
||||||
DWORD left, top;
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
break;
|
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:
|
default:
|
||||||
|
|
|
@ -136,87 +136,74 @@ BuildCodePageList(
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
UpdateDialogElements(HWND hwndDlg, PCONSOLE_STATE_INFO pConInfo)
|
UpdateDialogElements(
|
||||||
|
IN HWND hDlg,
|
||||||
|
IN PCONSOLE_STATE_INFO pConInfo)
|
||||||
{
|
{
|
||||||
HWND hDlgCtrl;
|
/* Update the cursor size */
|
||||||
|
|
||||||
/* Update cursor size */
|
|
||||||
if (pConInfo->CursorSize <= 25)
|
if (pConInfo->CursorSize <= 25)
|
||||||
{
|
{
|
||||||
/* Small cursor */
|
/* Small cursor */
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
|
CheckRadioButton(hDlg, IDC_RADIO_SMALL_CURSOR, IDC_RADIO_LARGE_CURSOR, IDC_RADIO_SMALL_CURSOR);
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
// CheckDlgButton(hDlg, IDC_RADIO_SMALL_CURSOR , BST_CHECKED);
|
||||||
|
// CheckDlgButton(hDlg, IDC_RADIO_MEDIUM_CURSOR, BST_UNCHECKED);
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR);
|
// CheckDlgButton(hDlg, IDC_RADIO_LARGE_CURSOR , BST_UNCHECKED);
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR);
|
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
|
||||||
}
|
}
|
||||||
else if (pConInfo->CursorSize <= 50)
|
else if (pConInfo->CursorSize <= 50)
|
||||||
{
|
{
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR);
|
/* Medium cursor */
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
CheckRadioButton(hDlg, IDC_RADIO_SMALL_CURSOR, IDC_RADIO_LARGE_CURSOR, IDC_RADIO_MEDIUM_CURSOR);
|
||||||
|
// CheckDlgButton(hDlg, IDC_RADIO_SMALL_CURSOR , BST_UNCHECKED);
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
|
// CheckDlgButton(hDlg, IDC_RADIO_MEDIUM_CURSOR, BST_CHECKED);
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
// CheckDlgButton(hDlg, IDC_RADIO_LARGE_CURSOR , BST_UNCHECKED);
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR);
|
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
|
||||||
}
|
}
|
||||||
else /* if (pConInfo->CursorSize <= 100) */
|
else /* if (pConInfo->CursorSize <= 100) */
|
||||||
{
|
{
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR);
|
/* Large cursor */
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
CheckRadioButton(hDlg, IDC_RADIO_SMALL_CURSOR, IDC_RADIO_LARGE_CURSOR, IDC_RADIO_LARGE_CURSOR);
|
||||||
|
// CheckDlgButton(hDlg, IDC_RADIO_SMALL_CURSOR , BST_UNCHECKED);
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
|
// CheckDlgButton(hDlg, IDC_RADIO_MEDIUM_CURSOR, BST_UNCHECKED);
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
// CheckDlgButton(hDlg, IDC_RADIO_LARGE_CURSOR , BST_CHECKED);
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR);
|
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update num buffers */
|
/* Update the number of history buffers */
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_NUM_BUFFER);
|
SendDlgItemMessageW(hDlg, IDC_UPDOWN_NUM_BUFFER, UDM_SETRANGE, 0, MAKELONG(999, 1));
|
||||||
SendMessageW(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG(999, 1));
|
SetDlgItemInt(hDlg, IDC_EDIT_NUM_BUFFER, pConInfo->NumberOfHistoryBuffers, FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_NUM_BUFFER, pConInfo->NumberOfHistoryBuffers, FALSE);
|
|
||||||
|
|
||||||
/* Update buffer size */
|
/* Update the history buffer size */
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_BUFFER_SIZE);
|
SendDlgItemMessageW(hDlg, IDC_UPDOWN_BUFFER_SIZE, UDM_SETRANGE, 0, MAKELONG(999, 1));
|
||||||
SendMessageW(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG(999, 1));
|
SetDlgItemInt(hDlg, IDC_EDIT_BUFFER_SIZE, pConInfo->HistoryBufferSize, FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_BUFFER_SIZE, pConInfo->HistoryBufferSize, FALSE);
|
|
||||||
|
|
||||||
/* Update discard duplicates */
|
/* Update discard duplicates */
|
||||||
CheckDlgButton(hwndDlg, IDC_CHECK_DISCARD_DUPLICATES,
|
CheckDlgButton(hDlg, IDC_CHECK_DISCARD_DUPLICATES,
|
||||||
pConInfo->HistoryNoDup ? BST_CHECKED : BST_UNCHECKED);
|
pConInfo->HistoryNoDup ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
|
||||||
/* Update full/window screen */
|
/* Update full/window screen state */
|
||||||
if (pConInfo->FullScreen)
|
if (pConInfo->FullScreen)
|
||||||
{
|
{
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL);
|
CheckRadioButton(hDlg, IDC_RADIO_DISPLAY_WINDOW, IDC_RADIO_DISPLAY_FULL, IDC_RADIO_DISPLAY_FULL);
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
// CheckDlgButton(hDlg, IDC_RADIO_DISPLAY_WINDOW, BST_UNCHECKED);
|
||||||
|
// CheckDlgButton(hDlg, IDC_RADIO_DISPLAY_FULL , BST_CHECKED);
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW);
|
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW);
|
CheckRadioButton(hDlg, IDC_RADIO_DISPLAY_WINDOW, IDC_RADIO_DISPLAY_FULL, IDC_RADIO_DISPLAY_WINDOW);
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
// CheckDlgButton(hDlg, IDC_RADIO_DISPLAY_WINDOW, BST_CHECKED);
|
||||||
|
// CheckDlgButton(hDlg, IDC_RADIO_DISPLAY_FULL , BST_UNCHECKED);
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL);
|
|
||||||
SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update quick edit */
|
/* Update "Quick-edit" state */
|
||||||
CheckDlgButton(hwndDlg, IDC_CHECK_QUICK_EDIT,
|
CheckDlgButton(hDlg, IDC_CHECK_QUICK_EDIT,
|
||||||
pConInfo->QuickEdit ? BST_CHECKED : BST_UNCHECKED);
|
pConInfo->QuickEdit ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
|
||||||
/* Update insert mode */
|
/* Update "Insert mode" state */
|
||||||
CheckDlgButton(hwndDlg, IDC_CHECK_INSERT_MODE,
|
CheckDlgButton(hDlg, IDC_CHECK_INSERT_MODE,
|
||||||
pConInfo->InsertMode ? BST_CHECKED : BST_UNCHECKED);
|
pConInfo->InsertMode ? BST_CHECKED : BST_UNCHECKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR
|
INT_PTR
|
||||||
CALLBACK
|
CALLBACK
|
||||||
OptionsProc(HWND hwndDlg,
|
OptionsProc(HWND hDlg,
|
||||||
UINT uMsg,
|
UINT uMsg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
|
@ -225,8 +212,8 @@ OptionsProc(HWND hwndDlg,
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
BuildCodePageList(hwndDlg);
|
BuildCodePageList(hDlg);
|
||||||
UpdateDialogElements(hwndDlg, ConInfo);
|
UpdateDialogElements(hDlg, ConInfo);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,18 +229,18 @@ OptionsProc(HWND hwndDlg,
|
||||||
{
|
{
|
||||||
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 1), 999);
|
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 1), 999);
|
||||||
ConInfo->HistoryBufferSize = lpnmud->iPos;
|
ConInfo->HistoryBufferSize = lpnmud->iPos;
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
}
|
}
|
||||||
else if (lppsn->hdr.idFrom == IDC_UPDOWN_NUM_BUFFER)
|
else if (lppsn->hdr.idFrom == IDC_UPDOWN_NUM_BUFFER)
|
||||||
{
|
{
|
||||||
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 1), 999);
|
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 1), 999);
|
||||||
ConInfo->NumberOfHistoryBuffers = lpnmud->iPos;
|
ConInfo->NumberOfHistoryBuffers = lpnmud->iPos;
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (lppsn->hdr.code == PSN_APPLY)
|
else if (lppsn->hdr.code == PSN_APPLY)
|
||||||
{
|
{
|
||||||
ApplyConsoleInfo(hwndDlg);
|
ApplyConsoleInfo(hDlg);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -261,139 +248,112 @@ OptionsProc(HWND hwndDlg,
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
LRESULT lResult;
|
if (HIWORD(wParam) == BN_CLICKED)
|
||||||
|
|
||||||
switch (LOWORD(wParam))
|
|
||||||
{
|
{
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
case IDC_RADIO_SMALL_CURSOR:
|
case IDC_RADIO_SMALL_CURSOR:
|
||||||
{
|
{
|
||||||
ConInfo->CursorSize = 25;
|
ConInfo->CursorSize = 25;
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_RADIO_MEDIUM_CURSOR:
|
case IDC_RADIO_MEDIUM_CURSOR:
|
||||||
{
|
{
|
||||||
ConInfo->CursorSize = 50;
|
ConInfo->CursorSize = 50;
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_RADIO_LARGE_CURSOR:
|
case IDC_RADIO_LARGE_CURSOR:
|
||||||
{
|
{
|
||||||
ConInfo->CursorSize = 100;
|
ConInfo->CursorSize = 100;
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_RADIO_DISPLAY_WINDOW:
|
case IDC_RADIO_DISPLAY_WINDOW:
|
||||||
{
|
{
|
||||||
ConInfo->FullScreen = FALSE;
|
ConInfo->FullScreen = FALSE;
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_RADIO_DISPLAY_FULL:
|
case IDC_RADIO_DISPLAY_FULL:
|
||||||
{
|
{
|
||||||
ConInfo->FullScreen = TRUE;
|
ConInfo->FullScreen = TRUE;
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_CHECK_QUICK_EDIT:
|
case IDC_CHECK_QUICK_EDIT:
|
||||||
{
|
{
|
||||||
lResult = SendMessageW((HWND)lParam, BM_GETCHECK, 0, 0);
|
ConInfo->QuickEdit = (IsDlgButtonChecked(hDlg, IDC_CHECK_QUICK_EDIT) == BST_CHECKED); // BST_UNCHECKED or BST_INDETERMINATE => FALSE
|
||||||
if (lResult == BST_CHECKED)
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
{
|
|
||||||
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);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_CHECK_INSERT_MODE:
|
case IDC_CHECK_INSERT_MODE:
|
||||||
{
|
{
|
||||||
lResult = SendMessageW((HWND)lParam, BM_GETCHECK, 0, 0);
|
ConInfo->InsertMode = (IsDlgButtonChecked(hDlg, IDC_CHECK_INSERT_MODE) == BST_CHECKED); // BST_UNCHECKED or BST_INDETERMINATE => FALSE
|
||||||
if (lResult == BST_CHECKED)
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
{
|
|
||||||
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);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_CHECK_DISCARD_DUPLICATES:
|
case IDC_CHECK_DISCARD_DUPLICATES:
|
||||||
{
|
{
|
||||||
lResult = SendMessageW((HWND)lParam, BM_GETCHECK, 0, 0);
|
ConInfo->HistoryNoDup = (IsDlgButtonChecked(hDlg, IDC_CHECK_DISCARD_DUPLICATES) == BST_CHECKED); // BST_UNCHECKED or BST_INDETERMINATE => FALSE
|
||||||
if (lResult == BST_CHECKED)
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
{
|
|
||||||
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;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (HIWORD(wParam) == EN_KILLFOCUS)
|
||||||
|
{
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
case IDC_EDIT_BUFFER_SIZE:
|
case IDC_EDIT_BUFFER_SIZE:
|
||||||
{
|
{
|
||||||
if (HIWORD(wParam) == EN_KILLFOCUS)
|
DWORD sizeBuff;
|
||||||
{
|
|
||||||
DWORD sizeBuff;
|
|
||||||
|
|
||||||
sizeBuff = GetDlgItemInt(hwndDlg, IDC_EDIT_BUFFER_SIZE, NULL, FALSE);
|
sizeBuff = GetDlgItemInt(hDlg, IDC_EDIT_BUFFER_SIZE, NULL, FALSE);
|
||||||
sizeBuff = min(max(sizeBuff, 1), 999);
|
sizeBuff = min(max(sizeBuff, 1), 999);
|
||||||
|
|
||||||
ConInfo->HistoryBufferSize = sizeBuff;
|
ConInfo->HistoryBufferSize = sizeBuff;
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_EDIT_NUM_BUFFER:
|
case IDC_EDIT_NUM_BUFFER:
|
||||||
{
|
{
|
||||||
if (HIWORD(wParam) == EN_KILLFOCUS)
|
DWORD numBuff;
|
||||||
{
|
|
||||||
DWORD numBuff;
|
|
||||||
|
|
||||||
numBuff = GetDlgItemInt(hwndDlg, IDC_EDIT_NUM_BUFFER, NULL, FALSE);
|
numBuff = GetDlgItemInt(hDlg, IDC_EDIT_NUM_BUFFER, NULL, FALSE);
|
||||||
numBuff = min(max(numBuff, 1), 999);
|
numBuff = min(max(numBuff, 1), 999);
|
||||||
|
|
||||||
ConInfo->NumberOfHistoryBuffers = numBuff;
|
ConInfo->NumberOfHistoryBuffers = numBuff;
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hDlg), hDlg);
|
||||||
}
|
|
||||||
break;
|
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;
|
|
||||||
}
|
}
|
||||||
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue