diff --git a/reactos/dll/win32/console/console.c b/reactos/dll/win32/console/console.c index 3bf5de193ed..1b23bf5cac3 100644 --- a/reactos/dll/win32/console/console.c +++ b/reactos/dll/win32/console/console.c @@ -85,7 +85,7 @@ InitConsoleDefaults(PConsoleInfo pConInfo) pConInfo->ScreenBuffer = MAKELONG(80, 300); pConInfo->UseRasterFonts = TRUE; pConInfo->FontSize = (DWORD)MAKELONG(8, 12); - pConInfo->FontWeight = FALSE; + pConInfo->FontWeight = FW_NORMAL; memcpy(pConInfo->Colors, s_Colors, sizeof(s_Colors)); } @@ -162,19 +162,20 @@ ApplyConsoleInfo(HWND hwndDlg, PConsoleInfo pConInfo) /* First Applet */ LONG APIENTRY -InitApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam) +InitApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) { PROPSHEETPAGE psp[4]; PROPSHEETHEADER psh; INT i=0; PConsoleInfo pConInfo; + PConsoleInfo pSharedInfo = (PConsoleInfo)wParam; UNREFERENCED_PARAMETER(uMsg); /* * 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 */ @@ -191,9 +192,6 @@ InitApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam) } else { - /* use current info */ - PConsoleInfo pSharedInfo = (PConsoleInfo)wParam; - if (IsBadReadPtr((const void *)pSharedInfo, sizeof(ConsoleInfo))) { /* use defaults */ @@ -275,7 +273,7 @@ CPlApplet( } case CPL_DBLCLK: { - Applets[0].AppletProc(hwndCPl, uMsg, lParam1, lParam2); + InitApplet(hwndCPl, uMsg, lParam1, lParam2); break; } } diff --git a/reactos/dll/win32/console/console.h b/reactos/dll/win32/console/console.h index 5f01b939bc0..1a07871a65f 100644 --- a/reactos/dll/win32/console/console.h +++ b/reactos/dll/win32/console/console.h @@ -21,9 +21,8 @@ typedef struct typedef struct TAGConsoleInfo { - HANDLE hFile; HWND hConsoleWindow; - TCHAR szProcessName[MAX_PATH]; + WCHAR szProcessName[MAX_PATH]; BOOLEAN AppliedConfig; DWORD UseRasterFonts; DWORD FontSize; diff --git a/reactos/dll/win32/console/layout.c b/reactos/dll/win32/console/layout.c index 88aecb7b2dc..8a9127e8d67 100644 --- a/reactos/dll/win32/console/layout.c +++ b/reactos/dll/win32/console/layout.c @@ -131,6 +131,8 @@ LayoutProc( LPARAM lParam ) { + LPNMUPDOWN lpnmud; + LPPSHNOTIFY lppsn; PConsoleInfo pConInfo = (PConsoleInfo)GetWindowLongPtr(hwndDlg, DWLP_USER); UNREFERENCED_PARAMETER(hwndDlg); @@ -148,10 +150,10 @@ LayoutProc( 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_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_WIDTH), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 0)); - SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_SIZE_HEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 0)); - SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_SIZE_WIDTH), 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, 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)); hDC = GetDC(NULL); xres = GetDeviceCaps(hDC, HORZRES); @@ -183,6 +185,112 @@ LayoutProc( PaintConsole((LPDRAWITEMSTRUCT)lParam, pConInfo); 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: { switch(LOWORD(wParam)) @@ -205,7 +313,7 @@ LayoutProc( } else if (res == BST_UNCHECKED) { - pConInfo->WindowPosition = -1; + pConInfo->WindowPosition = UINT_MAX; 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); diff --git a/reactos/dll/win32/console/options.c b/reactos/dll/win32/console/options.c index cc0ae4a472e..522839c0150 100644 --- a/reactos/dll/win32/console/options.c +++ b/reactos/dll/win32/console/options.c @@ -176,7 +176,7 @@ UpdateDialogElements(HWND hwndDlg, PConsoleInfo pConInfo) TCHAR szBuffer[MAX_PATH]; /* update cursor size */ - if ( pConInfo->CursorSize == 0 ) + if ( pConInfo->CursorSize == 0) { /* small cursor */ hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR);