mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 05:32:55 +00:00
* update comments
* remove unused members in ConsoleInfo struct * update global struct on UDN_DELTAPOS events * update WindowSize ScreenBuffer member when bigger / smaller on scroll events svn path=/trunk/; revision=24151
This commit is contained in:
parent
5ed7c7746e
commit
5d0d792e67
4 changed files with 120 additions and 15 deletions
|
@ -85,7 +85,7 @@ InitConsoleDefaults(PConsoleInfo pConInfo)
|
||||||
pConInfo->ScreenBuffer = MAKELONG(80, 300);
|
pConInfo->ScreenBuffer = MAKELONG(80, 300);
|
||||||
pConInfo->UseRasterFonts = TRUE;
|
pConInfo->UseRasterFonts = TRUE;
|
||||||
pConInfo->FontSize = (DWORD)MAKELONG(8, 12);
|
pConInfo->FontSize = (DWORD)MAKELONG(8, 12);
|
||||||
pConInfo->FontWeight = FALSE;
|
pConInfo->FontWeight = FW_NORMAL;
|
||||||
memcpy(pConInfo->Colors, s_Colors, sizeof(s_Colors));
|
memcpy(pConInfo->Colors, s_Colors, sizeof(s_Colors));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,19 +162,20 @@ ApplyConsoleInfo(HWND hwndDlg, PConsoleInfo pConInfo)
|
||||||
|
|
||||||
/* First Applet */
|
/* First Applet */
|
||||||
LONG APIENTRY
|
LONG APIENTRY
|
||||||
InitApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
|
InitApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
PROPSHEETPAGE psp[4];
|
PROPSHEETPAGE psp[4];
|
||||||
PROPSHEETHEADER psh;
|
PROPSHEETHEADER psh;
|
||||||
INT i=0;
|
INT i=0;
|
||||||
PConsoleInfo pConInfo;
|
PConsoleInfo pConInfo;
|
||||||
|
PConsoleInfo pSharedInfo = (PConsoleInfo)wParam;
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(uMsg);
|
UNREFERENCED_PARAMETER(uMsg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* console.dll shares information with win32csr with wParam, lParam
|
* console.dll shares information with win32csr with wParam, lParam
|
||||||
*
|
*
|
||||||
* wParam is a file handle to an unamed file object which contains the ConsoleInfo struct
|
* wParam is a pointer to an ConsoleInfo struct
|
||||||
* lParam is a boolean parameter which specifies wheter defaults should be shown
|
* lParam is a boolean parameter which specifies wheter defaults should be shown
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -191,9 +192,6 @@ InitApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* use current info */
|
|
||||||
PConsoleInfo pSharedInfo = (PConsoleInfo)wParam;
|
|
||||||
|
|
||||||
if (IsBadReadPtr((const void *)pSharedInfo, sizeof(ConsoleInfo)))
|
if (IsBadReadPtr((const void *)pSharedInfo, sizeof(ConsoleInfo)))
|
||||||
{
|
{
|
||||||
/* use defaults */
|
/* use defaults */
|
||||||
|
@ -275,7 +273,7 @@ CPlApplet(
|
||||||
}
|
}
|
||||||
case CPL_DBLCLK:
|
case CPL_DBLCLK:
|
||||||
{
|
{
|
||||||
Applets[0].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
InitApplet(hwndCPl, uMsg, lParam1, lParam2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,8 @@ typedef struct
|
||||||
|
|
||||||
typedef struct TAGConsoleInfo
|
typedef struct TAGConsoleInfo
|
||||||
{
|
{
|
||||||
HANDLE hFile;
|
|
||||||
HWND hConsoleWindow;
|
HWND hConsoleWindow;
|
||||||
TCHAR szProcessName[MAX_PATH];
|
WCHAR szProcessName[MAX_PATH];
|
||||||
BOOLEAN AppliedConfig;
|
BOOLEAN AppliedConfig;
|
||||||
DWORD UseRasterFonts;
|
DWORD UseRasterFonts;
|
||||||
DWORD FontSize;
|
DWORD FontSize;
|
||||||
|
|
|
@ -131,6 +131,8 @@ LayoutProc(
|
||||||
LPARAM lParam
|
LPARAM lParam
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
LPNMUPDOWN lpnmud;
|
||||||
|
LPPSHNOTIFY lppsn;
|
||||||
PConsoleInfo pConInfo = (PConsoleInfo)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
PConsoleInfo pConInfo = (PConsoleInfo)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(hwndDlg);
|
UNREFERENCED_PARAMETER(hwndDlg);
|
||||||
|
@ -148,10 +150,10 @@ LayoutProc(
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, LOWORD(pConInfo->ScreenBuffer), FALSE);
|
SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, LOWORD(pConInfo->ScreenBuffer), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, HIWORD(pConInfo->WindowSize), FALSE);
|
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, HIWORD(pConInfo->WindowSize), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, LOWORD(pConInfo->WindowSize), FALSE);
|
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, LOWORD(pConInfo->WindowSize), FALSE);
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_SCREEN_BUFFER_HEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 0));
|
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, 0));
|
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, 0));
|
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, 0));
|
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_SIZE_WIDTH), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1));
|
||||||
|
|
||||||
hDC = GetDC(NULL);
|
hDC = GetDC(NULL);
|
||||||
xres = GetDeviceCaps(hDC, HORZRES);
|
xres = GetDeviceCaps(hDC, HORZRES);
|
||||||
|
@ -183,6 +185,112 @@ LayoutProc(
|
||||||
PaintConsole((LPDRAWITEMSTRUCT)lParam, pConInfo);
|
PaintConsole((LPDRAWITEMSTRUCT)lParam, pConInfo);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
|
lpnmud = (LPNMUPDOWN) lParam;
|
||||||
|
lppsn = (LPPSHNOTIFY) lParam;
|
||||||
|
|
||||||
|
if (lppsn->hdr.code == UDN_DELTAPOS)
|
||||||
|
{
|
||||||
|
DWORD wheight, wwidth;
|
||||||
|
DWORD sheight, swidth;
|
||||||
|
DWORD left, top;
|
||||||
|
|
||||||
|
if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_WIDTH)
|
||||||
|
{
|
||||||
|
wwidth = lpnmud->iPos + lpnmud->iDelta;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wwidth = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, NULL, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_HEIGHT)
|
||||||
|
{
|
||||||
|
wheight = lpnmud->iPos + lpnmud->iDelta;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wheight = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, NULL, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_WIDTH)
|
||||||
|
{
|
||||||
|
swidth = lpnmud->iPos + lpnmud->iDelta;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
swidth = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_HEIGHT)
|
||||||
|
{
|
||||||
|
sheight = lpnmud->iPos + lpnmud->iDelta;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sheight = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_POS_LEFT)
|
||||||
|
{
|
||||||
|
left = lpnmud->iPos + lpnmud->iDelta;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_POS_TOP)
|
||||||
|
{
|
||||||
|
top = lpnmud->iPos + lpnmud->iDelta;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_WIDTH || lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_HEIGHT)
|
||||||
|
{
|
||||||
|
/* automatically adjust screen buffer size when window size enlarges */
|
||||||
|
if (wwidth >= swidth)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
swidth = max(swidth, 1);
|
||||||
|
sheight = max(sheight, 1);
|
||||||
|
|
||||||
|
if (lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_WIDTH || lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_HEIGHT)
|
||||||
|
{
|
||||||
|
/* 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->ScreenBuffer = MAKELONG(swidth, sheight);
|
||||||
|
pConInfo->WindowSize = MAKELONG(wwidth, wheight);
|
||||||
|
pConInfo->WindowPosition = MAKELONG(left, top);
|
||||||
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
switch(LOWORD(wParam))
|
switch(LOWORD(wParam))
|
||||||
|
@ -205,7 +313,7 @@ LayoutProc(
|
||||||
}
|
}
|
||||||
else if (res == BST_UNCHECKED)
|
else if (res == BST_UNCHECKED)
|
||||||
{
|
{
|
||||||
pConInfo->WindowPosition = -1;
|
pConInfo->WindowPosition = UINT_MAX;
|
||||||
SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
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_LEFT), FALSE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_WINDOW_POS_TOP), FALSE);
|
||||||
|
|
|
@ -176,7 +176,7 @@ UpdateDialogElements(HWND hwndDlg, PConsoleInfo pConInfo)
|
||||||
TCHAR szBuffer[MAX_PATH];
|
TCHAR szBuffer[MAX_PATH];
|
||||||
|
|
||||||
/* update cursor size */
|
/* update cursor size */
|
||||||
if ( pConInfo->CursorSize == 0 )
|
if ( pConInfo->CursorSize == 0)
|
||||||
{
|
{
|
||||||
/* small cursor */
|
/* small cursor */
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
|
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue