mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[CONSOLE.CPL]
Fix various things: - values update when edit controls lose focus, - improve (still WIP) console window preview, - fix screen color preview (now with font!) - use Unicode functions. What remains: - really fix the console window preview, - fully implement the console font selector. CORE-6629 #resolve #comment Fixed in revision 62718. svn path=/trunk/; revision=62718
This commit is contained in:
parent
77ef29ad79
commit
85b40a6ccc
6 changed files with 554 additions and 315 deletions
|
@ -18,7 +18,8 @@ add_library(console SHARED
|
|||
console.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/console.def)
|
||||
|
||||
set_module_type(console win32dll UNICODE)
|
||||
set_module_type(console cpl UNICODE)
|
||||
set_target_properties(console PROPERTIES SUFFIX ".dll")
|
||||
|
||||
add_importlibs(console
|
||||
msvcrt
|
||||
|
|
|
@ -22,10 +22,7 @@ PaintStaticControls(HWND hwndDlg,
|
|||
index = min(drawItem->CtlID - IDC_STATIC_COLOR1,
|
||||
sizeof(pConInfo->ci.Colors) / sizeof(pConInfo->ci.Colors[0]) - 1);
|
||||
hBrush = CreateSolidBrush(pConInfo->ci.Colors[index]);
|
||||
if (!hBrush)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (!hBrush) return FALSE;
|
||||
|
||||
FillRect(drawItem->hDC, &drawItem->rcItem, hBrush);
|
||||
DeleteObject((HGDIOBJ)hBrush);
|
||||
|
@ -44,7 +41,6 @@ ColorsProc(HWND hwndDlg,
|
|||
LPARAM lParam)
|
||||
{
|
||||
PCONSOLE_PROPS pConInfo;
|
||||
LPDRAWITEMSTRUCT drawItem;
|
||||
DWORD colorIndex;
|
||||
COLORREF color;
|
||||
|
||||
|
@ -58,9 +54,9 @@ ColorsProc(HWND hwndDlg,
|
|||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo);
|
||||
|
||||
/* Set the valid range of the colour indicators */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_RED), UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_GREEN), UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_BLUE), UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0));
|
||||
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));
|
||||
|
||||
/* Select by default the screen background option */
|
||||
CheckRadioButton(hwndDlg, IDC_RADIO_SCREEN_TEXT, IDC_RADIO_POPUP_BACKGROUND, IDC_RADIO_SCREEN_BACKGROUND);
|
||||
|
@ -71,16 +67,15 @@ ColorsProc(HWND hwndDlg,
|
|||
|
||||
case WM_DRAWITEM:
|
||||
{
|
||||
drawItem = (LPDRAWITEMSTRUCT)lParam;
|
||||
LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam;
|
||||
|
||||
if (drawItem->CtlID >= IDC_STATIC_COLOR1 && drawItem->CtlID <= IDC_STATIC_COLOR16)
|
||||
{
|
||||
return PaintStaticControls(hwndDlg, pConInfo, drawItem);
|
||||
}
|
||||
else if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR || drawItem->CtlID == IDC_STATIC_POPUP_COLOR)
|
||||
{
|
||||
PaintText(drawItem, pConInfo);
|
||||
return TRUE;
|
||||
}
|
||||
else if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR)
|
||||
return PaintText(drawItem, pConInfo, Screen);
|
||||
else if (drawItem->CtlID == IDC_STATIC_POPUP_COLOR)
|
||||
return PaintText(drawItem, pConInfo, Popup);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -90,7 +85,6 @@ ColorsProc(HWND hwndDlg,
|
|||
{
|
||||
case PSN_APPLY:
|
||||
{
|
||||
// LPPSHNOTIFY lppsn;
|
||||
if (!pConInfo->AppliedConfig)
|
||||
{
|
||||
return ApplyConsoleInfo(hwndDlg, pConInfo);
|
||||
|
@ -114,23 +108,17 @@ ColorsProc(HWND hwndDlg,
|
|||
|
||||
if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_RED)
|
||||
{
|
||||
if (lpnmud->iPos < 0) lpnmud->iPos = 0;
|
||||
else if (lpnmud->iPos > 255) lpnmud->iPos = 255;
|
||||
|
||||
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
|
||||
color = RGB(lpnmud->iPos, GetGValue(color), GetBValue(color));
|
||||
}
|
||||
else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_GREEN)
|
||||
{
|
||||
if (lpnmud->iPos < 0) lpnmud->iPos = 0;
|
||||
else if (lpnmud->iPos > 255) lpnmud->iPos = 255;
|
||||
|
||||
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
|
||||
color = RGB(GetRValue(color), lpnmud->iPos, GetBValue(color));
|
||||
}
|
||||
else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_BLUE)
|
||||
{
|
||||
if (lpnmud->iPos < 0) lpnmud->iPos = 0;
|
||||
else if (lpnmud->iPos > 255) lpnmud->iPos = 255;
|
||||
|
||||
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
|
||||
color = RGB(GetRValue(color), GetGValue(color), lpnmud->iPos);
|
||||
}
|
||||
else
|
||||
|
@ -141,7 +129,7 @@ ColorsProc(HWND hwndDlg,
|
|||
pConInfo->ci.Colors[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);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
|
@ -162,15 +150,15 @@ ColorsProc(HWND hwndDlg,
|
|||
color = pConInfo->ci.Colors[colorIndex];
|
||||
|
||||
/* Set the values of the colour indicators */
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(color), FALSE);
|
||||
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(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
||||
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
|
||||
pConInfo->ActiveStaticControl = colorIndex;
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -181,15 +169,15 @@ ColorsProc(HWND hwndDlg,
|
|||
color = pConInfo->ci.Colors[colorIndex];
|
||||
|
||||
/* Set the values of the colour indicators */
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(color), FALSE);
|
||||
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(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
||||
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
|
||||
pConInfo->ActiveStaticControl = colorIndex;
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -200,15 +188,15 @@ ColorsProc(HWND hwndDlg,
|
|||
color = pConInfo->ci.Colors[colorIndex];
|
||||
|
||||
/* Set the values of the colour indicators */
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(color), FALSE);
|
||||
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(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
||||
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
|
||||
pConInfo->ActiveStaticControl = colorIndex;
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -219,17 +207,93 @@ ColorsProc(HWND hwndDlg,
|
|||
color = pConInfo->ci.Colors[colorIndex];
|
||||
|
||||
/* Set the values of the colour indicators */
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(color), FALSE);
|
||||
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(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
||||
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
|
||||
pConInfo->ActiveStaticControl = colorIndex;
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
case IDC_EDIT_COLOR_RED:
|
||||
{
|
||||
if (HIWORD(wParam) == EN_KILLFOCUS)
|
||||
{
|
||||
DWORD red;
|
||||
|
||||
/* Get the current color */
|
||||
colorIndex = pConInfo->ActiveStaticControl;
|
||||
color = pConInfo->ci.Colors[colorIndex];
|
||||
|
||||
red = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, NULL, FALSE);
|
||||
red = min(max(red, 0), 255);
|
||||
|
||||
color = RGB(red, GetGValue(color), GetBValue(color));
|
||||
|
||||
pConInfo->ci.Colors[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;
|
||||
}
|
||||
|
||||
case IDC_EDIT_COLOR_GREEN:
|
||||
{
|
||||
if (HIWORD(wParam) == EN_KILLFOCUS)
|
||||
{
|
||||
DWORD green;
|
||||
|
||||
/* Get the current color */
|
||||
colorIndex = pConInfo->ActiveStaticControl;
|
||||
color = pConInfo->ci.Colors[colorIndex];
|
||||
|
||||
green = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, NULL, FALSE);
|
||||
green = min(max(green, 0), 255);
|
||||
|
||||
color = RGB(GetRValue(color), green, GetBValue(color));
|
||||
|
||||
pConInfo->ci.Colors[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;
|
||||
}
|
||||
|
||||
case IDC_EDIT_COLOR_BLUE:
|
||||
{
|
||||
if (HIWORD(wParam) == EN_KILLFOCUS)
|
||||
{
|
||||
DWORD blue;
|
||||
|
||||
/* Get the current color */
|
||||
colorIndex = pConInfo->ActiveStaticControl;
|
||||
color = pConInfo->ci.Colors[colorIndex];
|
||||
|
||||
blue = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, NULL, FALSE);
|
||||
blue = min(max(blue, 0), 255);
|
||||
|
||||
color = RGB(GetRValue(color), GetGValue(color), blue);
|
||||
|
||||
pConInfo->ci.Colors[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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( HIWORD(wParam) == STN_CLICKED &&
|
||||
|
@ -245,9 +309,9 @@ ColorsProc(HWND hwndDlg,
|
|||
|
||||
color = pConInfo->ci.Colors[colorIndex];
|
||||
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(color), FALSE);
|
||||
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(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE);
|
||||
|
||||
/* Update global struct */
|
||||
if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_SCREEN_TEXT))
|
||||
|
@ -271,7 +335,7 @@ ColorsProc(HWND hwndDlg,
|
|||
pConInfo->ActiveStaticControl = colorIndex;
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE);
|
||||
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
|
|
|
@ -59,16 +59,16 @@ const COLORREF s_Colors[16] =
|
|||
#define CSR_DEFAULT_CURSOR_SIZE 25
|
||||
|
||||
static VOID
|
||||
InitPropSheetPage(PROPSHEETPAGE *psp,
|
||||
InitPropSheetPage(PROPSHEETPAGEW *psp,
|
||||
WORD idDlg,
|
||||
DLGPROC DlgProc,
|
||||
LPARAM lParam)
|
||||
{
|
||||
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
|
||||
psp->dwSize = sizeof(PROPSHEETPAGE);
|
||||
ZeroMemory(psp, sizeof(PROPSHEETPAGEW));
|
||||
psp->dwSize = sizeof(PROPSHEETPAGEW);
|
||||
psp->dwFlags = PSP_DEFAULT;
|
||||
psp->hInstance = hApplet;
|
||||
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
|
||||
psp->pszTemplate = MAKEINTRESOURCEW(idDlg);
|
||||
psp->pfnDlgProc = DlgProc;
|
||||
psp->lParam = lParam;
|
||||
}
|
||||
|
@ -134,24 +134,20 @@ ApplyProc(HWND hwndDlg,
|
|||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
HWND hDlgCtrl;
|
||||
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_APPLY_CURRENT);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, BST_CHECKED, 0);
|
||||
CheckDlgButton(hwndDlg, IDC_RADIO_APPLY_CURRENT, BST_CHECKED);
|
||||
return TRUE;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
{
|
||||
if (LOWORD(wParam) == IDOK)
|
||||
{
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_APPLY_CURRENT);
|
||||
if (SendMessage(hDlgCtrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_APPLY_CURRENT) == BST_CHECKED)
|
||||
EndDialog(hwndDlg, IDC_RADIO_APPLY_CURRENT);
|
||||
else
|
||||
EndDialog(hwndDlg, IDC_RADIO_APPLY_ALL);
|
||||
|
@ -187,7 +183,7 @@ ApplyConsoleInfo(HWND hwndDlg,
|
|||
}
|
||||
else
|
||||
{
|
||||
INT_PTR res = DialogBox(hApplet, MAKEINTRESOURCE(IDD_APPLYOPTIONS), hwndDlg, ApplyProc);
|
||||
INT_PTR res = DialogBoxW(hApplet, MAKEINTRESOURCEW(IDD_APPLYOPTIONS), hwndDlg, ApplyProc);
|
||||
|
||||
SetParams = (res != IDCANCEL);
|
||||
SaveParams = (res == IDC_RADIO_APPLY_ALL);
|
||||
|
@ -209,12 +205,12 @@ ApplyConsoleInfo(HWND hwndDlg,
|
|||
* Create a memory section to share with the server, and map it.
|
||||
*/
|
||||
/* Holds data for console.dll + console info + terminal-specific info */
|
||||
hSection = CreateFileMapping(INVALID_HANDLE_VALUE,
|
||||
NULL,
|
||||
PAGE_READWRITE,
|
||||
0,
|
||||
sizeof(CONSOLE_PROPS) + sizeof(GUI_CONSOLE_INFO),
|
||||
NULL);
|
||||
hSection = CreateFileMappingW(INVALID_HANDLE_VALUE,
|
||||
NULL,
|
||||
PAGE_READWRITE,
|
||||
0,
|
||||
sizeof(CONSOLE_PROPS) + sizeof(GUI_CONSOLE_INFO),
|
||||
NULL);
|
||||
if (!hSection)
|
||||
{
|
||||
DPRINT1("Error when creating file mapping, error = %d\n", GetLastError());
|
||||
|
@ -264,12 +260,11 @@ LONG APIENTRY
|
|||
InitApplet(HWND hWnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HANDLE hSection = (HANDLE)wParam;
|
||||
BOOL GuiTermInfo = FALSE;
|
||||
PCONSOLE_PROPS pSharedInfo;
|
||||
PCONSOLE_PROPS pSharedInfo = NULL;
|
||||
PCONSOLE_PROPS pConInfo;
|
||||
WCHAR szTitle[MAX_PATH + 1];
|
||||
PROPSHEETPAGE psp[4];
|
||||
PROPSHEETHEADER psh;
|
||||
PROPSHEETPAGEW psp[4];
|
||||
PROPSHEETHEADERW psh;
|
||||
INT i = 0;
|
||||
|
||||
UNREFERENCED_PARAMETER(uMsg);
|
||||
|
@ -285,28 +280,54 @@ InitApplet(HWND hWnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
|||
pConInfo = AllocConsoleInfo();
|
||||
if (!pConInfo) return 0;
|
||||
|
||||
/* Map the shared section */
|
||||
pSharedInfo = MapViewOfFile(hSection, FILE_MAP_READ, 0, 0, 0);
|
||||
if (pSharedInfo == NULL)
|
||||
/* Check whether we were launched from the terminal... */
|
||||
if (hSection != NULL)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pConInfo);
|
||||
return 0;
|
||||
/* ... yes, map the shared section */
|
||||
pSharedInfo = MapViewOfFile(hSection, FILE_MAP_READ, 0, 0, 0);
|
||||
if (pSharedInfo == NULL)
|
||||
{
|
||||
/* Cleanup */
|
||||
HeapFree(GetProcessHeap(), 0, pConInfo);
|
||||
|
||||
/* Close the section */
|
||||
CloseHandle(hSection);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check that we are really going to modify GUI terminal information... */
|
||||
if (pSharedInfo->TerminalInfo.Size != sizeof(GUI_CONSOLE_INFO) ||
|
||||
pSharedInfo->TerminalInfo.TermInfo == 0)
|
||||
{
|
||||
/* ... it's not the case, bail out */
|
||||
|
||||
/* Cleanup */
|
||||
HeapFree(GetProcessHeap(), 0, pConInfo);
|
||||
|
||||
/* Close the section */
|
||||
UnmapViewOfFile(pSharedInfo);
|
||||
CloseHandle(hSection);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find the console window and whether we set the default parameters */
|
||||
pConInfo->hConsoleWindow = pSharedInfo->hConsoleWindow;
|
||||
pConInfo->ShowDefaultParams = pSharedInfo->ShowDefaultParams;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ... no, we were launched as a CPL. Display the default settings. */
|
||||
pConInfo->ShowDefaultParams = TRUE;
|
||||
}
|
||||
|
||||
/* Find the console window and whether we must use default parameters */
|
||||
pConInfo->hConsoleWindow = pSharedInfo->hConsoleWindow;
|
||||
pConInfo->ShowDefaultParams = pSharedInfo->ShowDefaultParams;
|
||||
|
||||
/* Check that we are going to modify GUI terminal information */
|
||||
GuiTermInfo = ( pSharedInfo->TerminalInfo.Size == sizeof(GUI_CONSOLE_INFO) &&
|
||||
pSharedInfo->TerminalInfo.TermInfo != 0 );
|
||||
|
||||
if (pConInfo->ShowDefaultParams || !GuiTermInfo)
|
||||
if (pConInfo->ShowDefaultParams)
|
||||
{
|
||||
/* Use defaults */
|
||||
InitConsoleDefaults(pConInfo);
|
||||
}
|
||||
else
|
||||
else if (hSection && pSharedInfo)
|
||||
{
|
||||
/*
|
||||
* Copy the shared data into our allocated buffer, and
|
||||
|
@ -316,13 +337,16 @@ InitApplet(HWND hWnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
|||
pConInfo->TerminalInfo.TermInfo = (PVOID)((ULONG_PTR)pConInfo + (ULONG_PTR)pConInfo->TerminalInfo.TermInfo);
|
||||
}
|
||||
|
||||
/* Close the section */
|
||||
UnmapViewOfFile(pSharedInfo);
|
||||
CloseHandle(hSection);
|
||||
if (hSection && pSharedInfo)
|
||||
{
|
||||
/* Close the section */
|
||||
UnmapViewOfFile(pSharedInfo);
|
||||
CloseHandle(hSection);
|
||||
}
|
||||
|
||||
/* Initialize the property sheet structure */
|
||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADERW));
|
||||
psh.dwSize = sizeof(PROPSHEETHEADERW);
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | /* PSH_USEHICON */ PSH_USEICONID | PSH_NOAPPLYNOW;
|
||||
|
||||
if (pConInfo->ci.ConsoleTitle[0] != L'\0')
|
||||
|
@ -339,18 +363,18 @@ InitApplet(HWND hWnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
|||
|
||||
psh.hwndParent = pConInfo->hConsoleWindow;
|
||||
psh.hInstance = hApplet;
|
||||
// psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
|
||||
psh.pszIcon = MAKEINTRESOURCE(IDC_CPLICON);
|
||||
// psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCEW(IDC_CPLICON));
|
||||
psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON);
|
||||
psh.nPages = 4;
|
||||
psh.nStartPage = 0;
|
||||
psh.ppsp = psp;
|
||||
|
||||
InitPropSheetPage(&psp[i++], IDD_PROPPAGEOPTIONS, (DLGPROC) OptionsProc, (LPARAM)pConInfo);
|
||||
InitPropSheetPage(&psp[i++], IDD_PROPPAGEFONT, (DLGPROC) FontProc, (LPARAM)pConInfo);
|
||||
InitPropSheetPage(&psp[i++], IDD_PROPPAGELAYOUT, (DLGPROC) LayoutProc, (LPARAM)pConInfo);
|
||||
InitPropSheetPage(&psp[i++], IDD_PROPPAGECOLORS, (DLGPROC) ColorsProc, (LPARAM)pConInfo);
|
||||
InitPropSheetPage(&psp[i++], IDD_PROPPAGEFONT , (DLGPROC) FontProc , (LPARAM)pConInfo);
|
||||
InitPropSheetPage(&psp[i++], IDD_PROPPAGELAYOUT , (DLGPROC) LayoutProc , (LPARAM)pConInfo);
|
||||
InitPropSheetPage(&psp[i++], IDD_PROPPAGECOLORS , (DLGPROC) ColorsProc , (LPARAM)pConInfo);
|
||||
|
||||
return (PropertySheet(&psh) != -1);
|
||||
return (PropertySheetW(&psh) != -1);
|
||||
}
|
||||
|
||||
/* Control Panel Callback */
|
||||
|
@ -375,9 +399,9 @@ CPlApplet(HWND hwndCPl,
|
|||
case CPL_INQUIRE:
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->idIcon = Applets[0].idIcon;
|
||||
CPlInfo->idName = Applets[0].idName;
|
||||
CPlInfo->idInfo = Applets[0].idDescription;
|
||||
CPlInfo->idIcon = Applets[0].idIcon;
|
||||
CPlInfo->idName = Applets[0].idName;
|
||||
CPlInfo->idInfo = Applets[0].idDescription;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#ifndef CONSOLE_H__
|
||||
#define CONSOLE_H__
|
||||
|
||||
#include <limits.h> // just for UINT_MAX in layout.c
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
|
||||
|
@ -16,6 +15,9 @@
|
|||
|
||||
#include "resource.h"
|
||||
|
||||
#define EnableDlgItem(hDlg, nID, bEnable) \
|
||||
EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))
|
||||
|
||||
/* Shared header with the GUI Terminal Front-End from consrv.dll */
|
||||
#include "consolecpl.h"
|
||||
|
||||
|
@ -27,9 +29,15 @@ typedef struct
|
|||
APPLET_PROC AppletProc;
|
||||
} APPLET, *PAPPLET;
|
||||
|
||||
typedef enum _TEXT_TYPE
|
||||
{
|
||||
Screen,
|
||||
Popup
|
||||
} TEXT_TYPE;
|
||||
|
||||
BOOL ApplyConsoleInfo(HWND hwndDlg, PCONSOLE_PROPS pConInfo);
|
||||
VOID PaintConsole(LPDRAWITEMSTRUCT drawItem, PCONSOLE_PROPS pConInfo);
|
||||
VOID PaintText(LPDRAWITEMSTRUCT drawItem, PCONSOLE_PROPS pConInfo);
|
||||
BOOL PaintText(LPDRAWITEMSTRUCT drawItem, PCONSOLE_PROPS pConInfo, TEXT_TYPE TextMode);
|
||||
|
||||
// Globals
|
||||
extern HINSTANCE hApplet;
|
||||
|
|
|
@ -11,15 +11,15 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
const TCHAR szPreviewText[] =
|
||||
_T("C:\\ReactOS> dir \n") \
|
||||
_T("SYSTEM <DIR> 13-04-15 5:00a\n") \
|
||||
_T("SYSTEM32 <DIR> 13-04-15 5:00a\n") \
|
||||
_T("readme txt 1739 13-04-15 5:00a\n") \
|
||||
_T("explorer exe 3329536 13-04-15 5:00a\n") \
|
||||
_T("vgafonts cab 18736 13-04-15 5:00a\n") \
|
||||
_T("setuplog txt 313 13-04-15 5:00a\n") \
|
||||
_T("win ini 7005 13-04-15 5:00a\n");
|
||||
const WCHAR szPreviewText[] =
|
||||
L"C:\\ReactOS> dir \n" \
|
||||
L"SYSTEM <DIR> 13-04-15 5:00a\n" \
|
||||
L"SYSTEM32 <DIR> 13-04-15 5:00a\n" \
|
||||
L"readme txt 1739 13-04-15 5:00a\n" \
|
||||
L"explorer exe 3329536 13-04-15 5:00a\n" \
|
||||
L"vgafonts cab 18736 13-04-15 5:00a\n" \
|
||||
L"setuplog txt 313 13-04-15 5:00a\n" \
|
||||
L"win ini 7005 13-04-15 5:00a\n" ;
|
||||
|
||||
|
||||
VOID
|
||||
|
@ -35,8 +35,10 @@ PaintConsole(LPDRAWITEMSTRUCT drawItem,
|
|||
|
||||
FillRect(drawItem->hDC, &drawItem->rcItem, GetSysColorBrush(COLOR_BACKGROUND));
|
||||
|
||||
sizex = drawItem->rcItem.right - drawItem->rcItem.left;
|
||||
sizey = drawItem->rcItem.bottom - drawItem->rcItem.top;
|
||||
// FIXME: Use: SM_CXSIZE, SM_CYSIZE, SM_CXVSCROLL, SM_CYHSCROLL, SM_CXMIN, SM_CYMIN, SM_CXFRAME, SM_CYFRAME
|
||||
/* Use it for scaling */
|
||||
sizex = drawItem->rcItem.right - drawItem->rcItem.left;
|
||||
sizey = drawItem->rcItem.bottom - drawItem->rcItem.top ;
|
||||
|
||||
if ( GuiInfo->WindowOrigin.x == MAXDWORD &&
|
||||
GuiInfo->WindowOrigin.y == MAXDWORD )
|
||||
|
@ -48,14 +50,14 @@ PaintConsole(LPDRAWITEMSTRUCT drawItem,
|
|||
{
|
||||
// TODO:
|
||||
// Calculate pos correctly when console centered
|
||||
startx = sizex / 3;
|
||||
starty = sizey / 3;
|
||||
startx = GuiInfo->WindowOrigin.x;
|
||||
starty = GuiInfo->WindowOrigin.y;
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// Strech console when bold fonts are selected
|
||||
endx = drawItem->rcItem.right - startx + 15;
|
||||
endy = starty + sizey / 3;
|
||||
// Stretch console when bold fonts are selected
|
||||
endx = startx + pConInfo->ci.ConsoleSize.X; // drawItem->rcItem.right - startx + 15;
|
||||
endy = starty + pConInfo->ci.ConsoleSize.Y; // starty + sizey / 3;
|
||||
|
||||
/* Draw console size */
|
||||
SetRect(&cRect, startx, starty, endx, endy);
|
||||
|
@ -92,39 +94,71 @@ PaintConsole(LPDRAWITEMSTRUCT drawItem,
|
|||
DeleteObject((HGDIOBJ)hBrush);
|
||||
}
|
||||
|
||||
VOID PaintText(LPDRAWITEMSTRUCT drawItem,
|
||||
PCONSOLE_PROPS pConInfo)
|
||||
BOOL
|
||||
PaintText(LPDRAWITEMSTRUCT drawItem,
|
||||
PCONSOLE_PROPS pConInfo,
|
||||
TEXT_TYPE TextMode)
|
||||
{
|
||||
PGUI_CONSOLE_INFO GuiInfo = pConInfo->TerminalInfo.TermInfo;
|
||||
USHORT CurrentAttrib;
|
||||
COLORREF pbkColor, ptColor;
|
||||
COLORREF nbkColor, ntColor;
|
||||
HBRUSH hBrush = NULL;
|
||||
HBRUSH hBrush;
|
||||
HFONT Font, OldFont;
|
||||
|
||||
if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR)
|
||||
if (TextMode == Screen)
|
||||
CurrentAttrib = pConInfo->ci.ScreenAttrib;
|
||||
else if (TextMode == Popup)
|
||||
CurrentAttrib = pConInfo->ci.PopupAttrib;
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
nbkColor = pConInfo->ci.Colors[BkgdAttribFromAttrib(CurrentAttrib)];
|
||||
ntColor = pConInfo->ci.Colors[TextAttribFromAttrib(CurrentAttrib)];
|
||||
|
||||
hBrush = CreateSolidBrush(nbkColor);
|
||||
if (!hBrush) return FALSE;
|
||||
|
||||
Font = CreateFontW(LOWORD(GuiInfo->FontSize),
|
||||
0, // HIWORD(GuiInfo->FontSize),
|
||||
0,
|
||||
TA_BASELINE,
|
||||
GuiInfo->FontWeight,
|
||||
FALSE,
|
||||
FALSE,
|
||||
FALSE,
|
||||
OEM_CHARSET,
|
||||
OUT_DEFAULT_PRECIS,
|
||||
CLIP_DEFAULT_PRECIS,
|
||||
NONANTIALIASED_QUALITY,
|
||||
FIXED_PITCH | GuiInfo->FontFamily /* FF_DONTCARE */,
|
||||
GuiInfo->FaceName);
|
||||
if (Font == NULL)
|
||||
{
|
||||
nbkColor = pConInfo->ci.Colors[BkgdAttribFromAttrib(pConInfo->ci.ScreenAttrib)];
|
||||
hBrush = CreateSolidBrush(nbkColor);
|
||||
ntColor = pConInfo->ci.Colors[TextAttribFromAttrib(pConInfo->ci.ScreenAttrib)];
|
||||
}
|
||||
else if (drawItem->CtlID == IDC_STATIC_POPUP_COLOR)
|
||||
{
|
||||
nbkColor = pConInfo->ci.Colors[BkgdAttribFromAttrib(pConInfo->ci.PopupAttrib)];
|
||||
hBrush = CreateSolidBrush(nbkColor);
|
||||
ntColor = pConInfo->ci.Colors[TextAttribFromAttrib(pConInfo->ci.PopupAttrib)];
|
||||
DPRINT1("PaintText: CreateFont failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!hBrush)
|
||||
OldFont = SelectObject(drawItem->hDC, Font);
|
||||
if (OldFont == NULL)
|
||||
{
|
||||
return;
|
||||
DeleteObject(Font);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
FillRect(drawItem->hDC, &drawItem->rcItem, hBrush);
|
||||
|
||||
ptColor = SetTextColor(drawItem->hDC, ntColor);
|
||||
pbkColor = SetBkColor(drawItem->hDC, nbkColor);
|
||||
DrawText(drawItem->hDC, szPreviewText, _tcslen(szPreviewText), &drawItem->rcItem, 0);
|
||||
DrawTextW(drawItem->hDC, szPreviewText, wcslen(szPreviewText), &drawItem->rcItem, 0);
|
||||
SetTextColor(drawItem->hDC, ptColor);
|
||||
SetBkColor(drawItem->hDC, pbkColor);
|
||||
DeleteObject((HGDIOBJ)hBrush);
|
||||
|
||||
SelectObject(drawItem->hDC, OldFont);
|
||||
DeleteObject(Font);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
INT_PTR
|
||||
|
@ -134,8 +168,6 @@ LayoutProc(HWND hwndDlg,
|
|||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
LPNMUPDOWN lpnmud;
|
||||
LPPSHNOTIFY lppsn;
|
||||
PCONSOLE_PROPS pConInfo = (PCONSOLE_PROPS)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||
PGUI_CONSOLE_INFO GuiInfo = (pConInfo ? pConInfo->TerminalInfo.TermInfo : NULL);
|
||||
|
||||
|
@ -146,57 +178,64 @@ LayoutProc(HWND hwndDlg,
|
|||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
DWORD xres, yres;
|
||||
HDC hDC;
|
||||
/* Multi-monitor support */
|
||||
LONG xVirtScr, yVirtScr; // Coordinates of the top-left virtual screen
|
||||
LONG cxVirtScr, cyVirtScr; // Width and Height of the virtual screen
|
||||
LONG cxFrame , cyFrame ; // Thickness of the window frame
|
||||
|
||||
pConInfo = (PCONSOLE_PROPS)((LPPROPSHEETPAGE)lParam)->lParam;
|
||||
GuiInfo = pConInfo->TerminalInfo.TermInfo;
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo);
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_SCREEN_BUFFER_HEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_SCREEN_BUFFER_WIDTH), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_SIZE_HEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_SIZE_WIDTH), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1));
|
||||
/* Multi-monitor support */
|
||||
xVirtScr = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
||||
yVirtScr = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||
cxVirtScr = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
||||
cyVirtScr = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||
cxFrame = GetSystemMetrics(SM_CXFRAME);
|
||||
cyFrame = GetSystemMetrics(SM_CYFRAME);
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_SCREEN_BUFFER_WIDTH , UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_WINDOW_SIZE_WIDTH , UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1));
|
||||
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, pConInfo->ci.ScreenBufferSize.Y, FALSE);
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, pConInfo->ci.ScreenBufferSize.X, FALSE);
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH , pConInfo->ci.ScreenBufferSize.X, FALSE);
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, pConInfo->ci.ConsoleSize.Y, FALSE);
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, pConInfo->ci.ConsoleSize.X, FALSE);
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH , pConInfo->ci.ConsoleSize.X, FALSE);
|
||||
|
||||
hDC = GetDC(NULL);
|
||||
xres = GetDeviceCaps(hDC, HORZRES);
|
||||
yres = GetDeviceCaps(hDC, VERTRES);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(xres, 0));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), UDM_SETRANGE, 0, (LPARAM)MAKELONG(yres, 0));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT, UDM_SETRANGE, 0,
|
||||
(LPARAM)MAKELONG(xVirtScr + cxVirtScr - cxFrame, xVirtScr - cxFrame));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP , UDM_SETRANGE, 0,
|
||||
(LPARAM)MAKELONG(yVirtScr + cyVirtScr - cyFrame, yVirtScr - cyFrame));
|
||||
|
||||
if ( GuiInfo->WindowOrigin.x != MAXDWORD &&
|
||||
GuiInfo->WindowOrigin.y != MAXDWORD )
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, GuiInfo->WindowOrigin.x, TRUE);
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP , GuiInfo->WindowOrigin.y, TRUE);
|
||||
|
||||
if (GuiInfo->AutoPosition)
|
||||
{
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, GuiInfo->WindowOrigin.x, FALSE);
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, GuiInfo->WindowOrigin.y, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME: Calculate window pos from xres, yres
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, 88, FALSE);
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, 88, FALSE);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT), FALSE);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP), FALSE);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), FALSE);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), FALSE);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_SYSTEM_POS_WINDOW), 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);
|
||||
}
|
||||
CheckDlgButton(hwndDlg, IDC_CHECK_SYSTEM_POS_WINDOW,
|
||||
GuiInfo->AutoPosition ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_DRAWITEM:
|
||||
{
|
||||
PaintConsole((LPDRAWITEMSTRUCT)lParam, pConInfo);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
lpnmud = (LPNMUPDOWN) lParam;
|
||||
lppsn = (LPPSHNOTIFY) lParam;
|
||||
LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam;
|
||||
LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
|
||||
|
||||
if (lppsn->hdr.code == UDN_DELTAPOS)
|
||||
{
|
||||
|
@ -246,7 +285,7 @@ LayoutProc(HWND hwndDlg,
|
|||
}
|
||||
else
|
||||
{
|
||||
left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, FALSE);
|
||||
left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, TRUE);
|
||||
}
|
||||
|
||||
if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_POS_TOP)
|
||||
|
@ -255,7 +294,7 @@ LayoutProc(HWND hwndDlg,
|
|||
}
|
||||
else
|
||||
{
|
||||
top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, FALSE);
|
||||
top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, TRUE);
|
||||
}
|
||||
|
||||
if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_WIDTH || lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_HEIGHT)
|
||||
|
@ -266,13 +305,14 @@ LayoutProc(HWND hwndDlg,
|
|||
SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, wwidth, TRUE);
|
||||
swidth = wwidth;
|
||||
}
|
||||
|
||||
if (wheight >= sheight)
|
||||
{
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, wheight, TRUE);
|
||||
sheight = wheight;
|
||||
}
|
||||
}
|
||||
|
||||
/* Be sure that the (new) screen buffer sizes are in the correct range */
|
||||
swidth = min(max(swidth , 1), 0xFFFF);
|
||||
sheight = min(max(sheight, 1), 0xFFFF);
|
||||
|
||||
|
@ -284,7 +324,6 @@ LayoutProc(HWND hwndDlg,
|
|||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, swidth, TRUE);
|
||||
wwidth = swidth;
|
||||
}
|
||||
|
||||
if (wheight > sheight)
|
||||
{
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, sheight, TRUE);
|
||||
|
@ -302,50 +341,127 @@ LayoutProc(HWND hwndDlg,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_EDIT_SCREEN_BUFFER_WIDTH:
|
||||
case IDC_EDIT_SCREEN_BUFFER_HEIGHT:
|
||||
{
|
||||
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)
|
||||
{
|
||||
wwidth = swidth;
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, wwidth, TRUE);
|
||||
}
|
||||
|
||||
pConInfo->ci.ScreenBufferSize.X = (SHORT)swidth;
|
||||
pConInfo->ci.ConsoleSize.X = (SHORT)wwidth;
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IDC_EDIT_WINDOW_SIZE_WIDTH:
|
||||
case IDC_UPDOWN_WINDOW_SIZE_HEIGHT:
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
pConInfo->ci.ScreenBufferSize.X = (SHORT)swidth;
|
||||
pConInfo->ci.ConsoleSize.X = (SHORT)wwidth;
|
||||
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);
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
pConInfo->ci.ScreenBufferSize.Y = (SHORT)sheight;
|
||||
pConInfo->ci.ConsoleSize.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);
|
||||
}
|
||||
|
||||
pConInfo->ci.ScreenBufferSize.Y = (SHORT)sheight;
|
||||
pConInfo->ci.ConsoleSize.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 wheight, wwidth;
|
||||
DWORD sheight, swidth;
|
||||
DWORD left, top;
|
||||
|
||||
wwidth = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, NULL, FALSE);
|
||||
wheight = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, NULL, FALSE);
|
||||
swidth = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL, FALSE);
|
||||
sheight = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL, FALSE);
|
||||
left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, FALSE);
|
||||
top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, FALSE);
|
||||
left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, TRUE);
|
||||
top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP , NULL, TRUE);
|
||||
|
||||
swidth = min(max(swidth , 1), 0xFFFF);
|
||||
sheight = min(max(sheight, 1), 0xFFFF);
|
||||
|
||||
/* Automatically adjust window size when screen buffer decreases */
|
||||
if (wwidth > swidth)
|
||||
{
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, swidth, TRUE);
|
||||
wwidth = swidth;
|
||||
}
|
||||
|
||||
if (wheight > sheight)
|
||||
{
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, sheight, TRUE);
|
||||
wheight = sheight;
|
||||
}
|
||||
|
||||
pConInfo->ci.ScreenBufferSize.X = (SHORT)swidth;
|
||||
pConInfo->ci.ScreenBufferSize.Y = (SHORT)sheight;
|
||||
pConInfo->ci.ConsoleSize.X = (SHORT)wwidth;
|
||||
pConInfo->ci.ConsoleSize.Y = (SHORT)wheight;
|
||||
GuiInfo->WindowOrigin.x = left;
|
||||
GuiInfo->WindowOrigin.y = top;
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
|
@ -360,29 +476,36 @@ LayoutProc(HWND hwndDlg,
|
|||
{
|
||||
ULONG left, top;
|
||||
|
||||
left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, FALSE);
|
||||
top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, FALSE);
|
||||
left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, TRUE);
|
||||
top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP , NULL, TRUE);
|
||||
|
||||
GuiInfo->AutoPosition = FALSE;
|
||||
GuiInfo->WindowOrigin.x = left;
|
||||
GuiInfo->WindowOrigin.y = top;
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
|
||||
SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT), TRUE);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP), TRUE);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), TRUE);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), 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);
|
||||
}
|
||||
else if (res == BST_UNCHECKED)
|
||||
{
|
||||
GuiInfo->WindowOrigin.x = UINT_MAX;
|
||||
GuiInfo->WindowOrigin.y = UINT_MAX;
|
||||
GuiInfo->AutoPosition = TRUE;
|
||||
// Do not touch GuiInfo->WindowOrigin !!
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
|
||||
SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT), FALSE);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP), FALSE);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), FALSE);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), FALSE);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -11,9 +11,85 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
static
|
||||
void
|
||||
UpdateDialogElements(HWND hwndDlg, PCONSOLE_PROPS pConInfo);
|
||||
static void
|
||||
UpdateDialogElements(HWND hwndDlg, PCONSOLE_PROPS pConInfo)
|
||||
{
|
||||
PGUI_CONSOLE_INFO GuiInfo = pConInfo->TerminalInfo.TermInfo;
|
||||
HWND hDlgCtrl;
|
||||
|
||||
/* Update cursor size */
|
||||
if (pConInfo->ci.CursorSize <= 25)
|
||||
{
|
||||
/* Small cursor */
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
}
|
||||
else if (pConInfo->ci.CursorSize <= 50)
|
||||
{
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
}
|
||||
else /* if (pConInfo->ci.CursorSize <= 100) */
|
||||
{
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
}
|
||||
|
||||
/* Update num buffers */
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_NUM_BUFFER);
|
||||
SendMessage(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG(999, 1));
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_NUM_BUFFER, pConInfo->ci.NumberOfHistoryBuffers, FALSE);
|
||||
|
||||
/* Update buffer size */
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_BUFFER_SIZE);
|
||||
SendMessage(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG(999, 1));
|
||||
SetDlgItemInt(hwndDlg, IDC_EDIT_BUFFER_SIZE, pConInfo->ci.HistoryBufferSize, FALSE);
|
||||
|
||||
/* Update discard duplicates */
|
||||
CheckDlgButton(hwndDlg, IDC_CHECK_DISCARD_DUPLICATES,
|
||||
pConInfo->ci.HistoryNoDup ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
/* Update full/window screen */
|
||||
if (GuiInfo->FullScreen)
|
||||
{
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
}
|
||||
|
||||
/* Update quick edit */
|
||||
CheckDlgButton(hwndDlg, IDC_CHECK_QUICK_EDIT,
|
||||
pConInfo->ci.QuickEdit ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
/* Update insert mode */
|
||||
CheckDlgButton(hwndDlg, IDC_CHECK_INSERT_MODE,
|
||||
pConInfo->ci.InsertMode ? BST_CHECKED : BST_UNCHECKED);
|
||||
}
|
||||
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
|
@ -24,9 +100,6 @@ OptionsProc(HWND hwndDlg,
|
|||
{
|
||||
PCONSOLE_PROPS pConInfo;
|
||||
PGUI_CONSOLE_INFO GuiInfo;
|
||||
LRESULT lResult;
|
||||
HWND hDlgCtrl;
|
||||
LPPSHNOTIFY lppsn;
|
||||
|
||||
pConInfo = (PCONSOLE_PROPS)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||
|
||||
|
@ -39,19 +112,28 @@ OptionsProc(HWND hwndDlg,
|
|||
UpdateDialogElements(hwndDlg, pConInfo);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
if (!pConInfo) break;
|
||||
LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam;
|
||||
LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
|
||||
|
||||
// if (!pConInfo) break;
|
||||
|
||||
lppsn = (LPPSHNOTIFY) lParam;
|
||||
if (lppsn->hdr.code == UDN_DELTAPOS)
|
||||
{
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_BUFFER_SIZE);
|
||||
pConInfo->ci.HistoryBufferSize = LOWORD(SendMessage(hDlgCtrl, UDM_GETPOS, 0, 0));
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_NUM_BUFFER);
|
||||
pConInfo->ci.NumberOfHistoryBuffers = LOWORD(SendMessage(hDlgCtrl, UDM_GETPOS, 0, 0));
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
if (lppsn->hdr.idFrom == IDC_UPDOWN_BUFFER_SIZE)
|
||||
{
|
||||
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 1), 999);
|
||||
pConInfo->ci.HistoryBufferSize = lpnmud->iPos;
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
else if (lppsn->hdr.idFrom == IDC_UPDOWN_NUM_BUFFER)
|
||||
{
|
||||
lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 1), 999);
|
||||
pConInfo->ci.NumberOfHistoryBuffers = lpnmud->iPos;
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
}
|
||||
else if (lppsn->hdr.code == PSN_APPLY)
|
||||
{
|
||||
|
@ -68,8 +150,11 @@ OptionsProc(HWND hwndDlg,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
LRESULT lResult;
|
||||
|
||||
if (!pConInfo) break;
|
||||
GuiInfo = pConInfo->TerminalInfo.TermInfo;
|
||||
|
||||
|
@ -153,109 +238,43 @@ OptionsProc(HWND hwndDlg,
|
|||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
}
|
||||
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);
|
||||
|
||||
pConInfo->ci.HistoryBufferSize = sizeBuff;
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
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);
|
||||
|
||||
pConInfo->ci.NumberOfHistoryBuffers = numBuff;
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
UpdateDialogElements(HWND hwndDlg, PCONSOLE_PROPS pConInfo)
|
||||
{
|
||||
PGUI_CONSOLE_INFO GuiInfo = pConInfo->TerminalInfo.TermInfo;
|
||||
HWND hDlgCtrl;
|
||||
TCHAR szBuffer[MAX_PATH];
|
||||
|
||||
/* Update cursor size */
|
||||
if (pConInfo->ci.CursorSize <= 25)
|
||||
{
|
||||
/* Small cursor */
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
}
|
||||
else if (pConInfo->ci.CursorSize <= 50)
|
||||
{
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
}
|
||||
else /* if (pConInfo->ci.CursorSize <= 100) */
|
||||
{
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
|
||||
}
|
||||
|
||||
/* Update num buffers */
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_NUM_BUFFER);
|
||||
SendMessage(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG((short)999, (short)1));
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_NUM_BUFFER);
|
||||
_stprintf(szBuffer, _T("%d"), pConInfo->ci.NumberOfHistoryBuffers);
|
||||
SendMessage(hDlgCtrl, WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
|
||||
/* Update buffer size */
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_BUFFER_SIZE);
|
||||
SendMessage(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG((short)999, (short)1));
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_BUFFER_SIZE);
|
||||
_stprintf(szBuffer, _T("%d"), pConInfo->ci.HistoryBufferSize);
|
||||
SendMessage(hDlgCtrl, WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
|
||||
/* Update discard duplicates */
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_CHECK_DISCARD_DUPLICATES);
|
||||
if (pConInfo->ci.HistoryNoDup)
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
else
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0);
|
||||
|
||||
/* Update full/window screen */
|
||||
if (GuiInfo->FullScreen)
|
||||
{
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL);
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0);
|
||||
}
|
||||
|
||||
/* Update quick edit */
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_CHECK_QUICK_EDIT);
|
||||
if (pConInfo->ci.QuickEdit)
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
else
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0);
|
||||
|
||||
/* Update insert mode */
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_CHECK_INSERT_MODE);
|
||||
if (pConInfo->ci.InsertMode)
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
||||
else
|
||||
SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue