Author: janderwald
Date: Mon Aug 21 14:57:14 2006
New Revision: 23641
URL:
http://svn.reactos.org/svn/reactos?rev=23641&view=rev
Log:
* colors.c: add error checking
* console.c: add defaults
* layout: halfplement layout dialog
Modified:
trunk/reactos/dll/win32/console/colors.c
trunk/reactos/dll/win32/console/console.c
trunk/reactos/dll/win32/console/console.h
trunk/reactos/dll/win32/console/en.rc
trunk/reactos/dll/win32/console/layout.c
Modified: trunk/reactos/dll/win32/console/colors.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/colors.c…
==============================================================================
--- trunk/reactos/dll/win32/console/colors.c (original)
+++ trunk/reactos/dll/win32/console/colors.c Mon Aug 21 14:57:14 2006
@@ -57,6 +57,12 @@
hBrush = CreateSolidBrush(nbkColor);
ntColor = pConInfo->PopupText;
}
+
+ if (!hBrush)
+ {
+ return FALSE;
+ }
+
FillRect(drawItem->hDC, &drawItem->rcItem, hBrush);
DeleteObject((HGDIOBJ)hBrush);
ptColor = SetTextColor(drawItem->hDC, ntColor);
Modified: trunk/reactos/dll/win32/console/console.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/console.…
==============================================================================
--- trunk/reactos/dll/win32/console/console.c (original)
+++ trunk/reactos/dll/win32/console/console.c Mon Aug 21 14:57:14 2006
@@ -59,7 +59,9 @@
pConInfo->ScreenBackground = RGB(0, 0, 0);
pConInfo->PopupText = RGB(128, 0, 128);
pConInfo->PopupBackground = RGB(255, 255, 255);
-
+ pConInfo->WindowSize = (DWORD)MAKELONG(80, 25);
+ pConInfo->WindowPosition = -1;
+ pConInfo->ScreenBuffer = MAKELONG(80, 300);
GetModuleFileName(NULL, pConInfo->szProcessName, MAX_PATH);
//MessageBox(hwnd, pConInfo->szProcessName, _T("GetModuleFileName"),
MB_OK);
Modified: trunk/reactos/dll/win32/console/console.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/console.…
==============================================================================
--- trunk/reactos/dll/win32/console/console.h (original)
+++ trunk/reactos/dll/win32/console/console.h Mon Aug 21 14:57:14 2006
@@ -29,6 +29,12 @@
DWORD QuickEdit;
DWORD InsertMode;
+ DWORD ScreenBuffer;
+ DWORD WindowSize;
+ DWORD WindowPosition;
+
+
+
DWORD ActiveStaticControl;
COLORREF ScreenText;
COLORREF ScreenBackground;
Modified: trunk/reactos/dll/win32/console/en.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/en.rc?re…
==============================================================================
--- trunk/reactos/dll/win32/console/en.rc (original)
+++ trunk/reactos/dll/win32/console/en.rc Mon Aug 21 14:57:14 2006
@@ -64,21 +64,21 @@
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Window Preview", -1, 10, 10, 65, 10
-CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_BLACKRECT
| SS_SUNKEN, 10, 20, 100, 70
+CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN |
SS_OWNERDRAW, 10, 20, 100, 70
GROUPBOX "Screen Buffer Size", -1, 115, 15, 115, 40
LTEXT "&Width:", -1, 120, 30, 25, 10
LTEXT "&Height:", -1, 120, 40, 25, 10
-EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 30, 10, ES_RIGHT | WS_GROUP
-CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS,UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 170, 30, 30, 10
-EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 30, 10, ES_RIGHT | WS_GROUP
-CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS,UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 170, 30, 30, 10
+EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 35, 10, ES_RIGHT | WS_GROUP
+CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS,UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10
+EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 35, 10, ES_RIGHT | WS_GROUP
+CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS,UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10
GROUPBOX "Window Size", -1, 115, 60, 115, 40
LTEXT "&W&idth:", -1, 120, 70, 25, 10
LTEXT "&H&eight:", -1, 120, 80, 25, 10
EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 165, 70, 30, 10, ES_RIGHT | WS_GROUP
-CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS,UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 170, 30, 30, 10
+CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS,UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10
EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 165, 80, 30, 10, ES_RIGHT | WS_GROUP
-CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS,UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 170, 30, 30, 10
+CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS,UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10
GROUPBOX "Window Position", -1, 115, 105, 115, 55
LTEXT "&Left:", -1, 120, 120, 25, 10
LTEXT "&Top:", -1, 120, 130, 25, 10
@@ -146,5 +146,5 @@
IDS_CPLNAME "Console"
IDS_CPLDESCRIPTION "Configures console properties."
IDS_APPLY_SHORTCUT_ALL "Modify &shortcut that started this window"
- IDS_SCREEN_TEXT "C:\ReactOS> dir\nSYSTEM <DIR> 10-01-99
5:00\nSYSTEM32 <DIR> 10-01-99 5:00"
+ IDS_SCREEN_TEXT "C:\ReactOS> dir\nSYSTEM <DIR> 10-01-99
5:00\nSYSTEM32 <DIR> 10-01-99 5:00"
END
Modified: trunk/reactos/dll/win32/console/layout.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/layout.c…
==============================================================================
--- trunk/reactos/dll/win32/console/layout.c (original)
+++ trunk/reactos/dll/win32/console/layout.c Mon Aug 21 14:57:14 2006
@@ -27,9 +27,95 @@
{
case WM_INITDIALOG:
{
+ DWORD xres, yres;
+ HDC hDC;
pConInfo = (PConsoleInfo) ((LPPROPSHEETPAGE)lParam)->lParam;
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT,
HIWORD(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_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));
+
+ 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));
+
+ if (pConInfo->WindowPosition != -1)
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, LOWORD(pConInfo->WindowPosition),
FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, HIWORD(pConInfo->WindowPosition),
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);
+ }
+
return TRUE;
+ }
+ case WM_DRAWITEM:
+ {
+ COLORREF bkColor;
+ HBRUSH hBrush;
+ LPDRAWITEMSTRUCT drawItem;
+
+ bkColor = GetSysColor(COLOR_BACKGROUND);
+ hBrush = CreateSolidBrush(bkColor);
+ drawItem = (LPDRAWITEMSTRUCT) lParam;
+
+ FillRect(drawItem->hDC, &drawItem->rcItem, hBrush);
+ //TODO draw console image
+// MoveToEx(drawItem->hDC, 0, 0, NULL);
+// LineTo(drawItem->hDC, 10, 10);
+// MoveToEx(drawItem->hDC, 30, 30, NULL);
+// LineTo(drawItem->hDC, 40, 40);
+
+ DeleteObject((HGDIOBJ)hBrush);
+ return TRUE;
+ }
+ case WM_COMMAND:
+ {
+ switch(LOWORD(wParam))
+ {
+ 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, FALSE);
+ top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, FALSE);
+ pConInfo->WindowPosition = MAKELONG(left, top);
+ 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);
+ }
+ else if (res == BST_UNCHECKED)
+ {
+ pConInfo->WindowPosition = -1;
+ 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);
+ }
+ }
+ }
}
default:
break;