Author: janderwald
Date: Mon Aug 21 03:55:08 2006
New Revision: 23629
URL:
http://svn.reactos.org/svn/reactos?rev=23629&view=rev
Log:
* colors.c: implement color dialog (reading from registry is not yet supported)
* font.c/layout.c/console.c/options.c: add UNREFERENCED_PARAMETER macros, fix sharing of
global struct
* console.def: fix building with MSVC
Modified:
trunk/reactos/dll/win32/console/colors.c
trunk/reactos/dll/win32/console/console.c
trunk/reactos/dll/win32/console/console.def
trunk/reactos/dll/win32/console/console.h
trunk/reactos/dll/win32/console/en.rc
trunk/reactos/dll/win32/console/font.c
trunk/reactos/dll/win32/console/layout.c
trunk/reactos/dll/win32/console/options.c
trunk/reactos/dll/win32/console/resource.h
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 03:55:08 2006
@@ -8,6 +8,80 @@
*/
#include "console.h"
+
+
+static COLORREF s_Colors[] =
+{
+ RGB(0, 0, 0),
+ RGB(0, 0, 128),
+ RGB(0, 128, 0),
+ RGB(0, 128, 128),
+ RGB(128, 0, 0),
+ RGB(128, 0, 128),
+ RGB(128, 128, 0),
+ RGB(192, 192, 192),
+ RGB(128, 128, 128),
+ RGB(0, 0, 255),
+ RGB(0, 255, 0),
+ RGB(0, 255, 255),
+ RGB(255, 0, 0),
+ RGB(255, 0, 255),
+ RGB(255, 255, 0),
+ RGB(255, 255, 255)
+};
+
+static TCHAR szText[1024];
+
+
+static
+BOOL
+PaintStaticControls(HWND hwndDlg, PConsoleInfo pConInfo, LPDRAWITEMSTRUCT drawItem)
+{
+ HBRUSH hBrush;
+ DWORD index;
+
+ if (drawItem->CtlID < IDC_STATIC_COLOR1 || drawItem->CtlID >
IDC_STATIC_COLOR16)
+ {
+ COLORREF pbkColor, ptColor;
+ COLORREF nbkColor, ntColor;
+ /* draw static controls */
+ if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR)
+ {
+ nbkColor = pConInfo->ScreenBackground;
+ hBrush = CreateSolidBrush(nbkColor);
+ ntColor = pConInfo->ScreenText;
+ }
+ else
+ {
+ nbkColor = pConInfo->PopupBackground;
+ hBrush = CreateSolidBrush(nbkColor);
+ ntColor = pConInfo->PopupText;
+ }
+ FillRect(drawItem->hDC, &drawItem->rcItem, hBrush);
+ DeleteObject((HGDIOBJ)hBrush);
+ ptColor = SetTextColor(drawItem->hDC, ntColor);
+ pbkColor = SetBkColor(drawItem->hDC, nbkColor);
+ if (ntColor != nbkColor)
+ {
+ /* hide text when it has same background color as text color */
+ DrawText(drawItem->hDC, szText, _tcslen(szText), &drawItem->rcItem, 0);
+ }
+ SetTextColor(drawItem->hDC, ptColor);
+ SetBkColor(drawItem->hDC, pbkColor);
+ return TRUE;
+ }
+
+ index = drawItem->CtlID - IDC_STATIC_COLOR1;
+ hBrush = CreateSolidBrush(s_Colors[index]);
+ if (!hBrush)
+ {
+ return FALSE;
+ }
+
+ FillRect(drawItem->hDC, &drawItem->rcItem, hBrush);
+ DeleteObject((HGDIOBJ)hBrush);
+ return TRUE;
+}
INT_PTR
CALLBACK
@@ -18,14 +92,160 @@
LPARAM lParam
)
{
- UNREFERENCED_PARAMETER(hwndDlg)
- UNREFERENCED_PARAMETER(wParam)
- UNREFERENCED_PARAMETER(lParam)
+ PConsoleInfo pConInfo;
+ LPNMUPDOWN lpnmud;
+
+ pConInfo = (PConsoleInfo) GetWindowLongPtr(hwndDlg, DWLP_USER);
switch(uMsg)
{
case WM_INITDIALOG:
+ {
+ pConInfo = (PConsoleInfo) ((LPPROPSHEETPAGE)lParam)->lParam;
+ SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo);
+ ZeroMemory(szText, sizeof(szText));
+ LoadString(hApplet, IDS_SCREEN_TEXT, szText, sizeof(szText) / sizeof(TCHAR));
+ SendMessage(GetDlgItem(hwndDlg, IDC_RADIO_SCREEN_BACKGROUND), BM_SETCHECK,
BST_CHECKED, 0);
+ 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));
+ InvalidateRect(hwndDlg, NULL, TRUE);
return TRUE;
+ }
+ case WM_DRAWITEM:
+ {
+ return PaintStaticControls(hwndDlg, pConInfo, (LPDRAWITEMSTRUCT) lParam);
+ }
+ case WM_NOTIFY:
+ {
+ DWORD red = -1;
+ DWORD green = -1;
+ DWORD blue = -1;
+
+ lpnmud = (LPNMUPDOWN) lParam;
+
+ if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_RED)
+ {
+ red = lpnmud->iPos;
+ }
+ else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_GREEN)
+ {
+ green = lpnmud->iPos;
+ }
+ else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_BLUE)
+ {
+ blue = lpnmud->iPos;
+ }
+
+ if (red == -1)
+ {
+ red = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_RED), UDM_GETPOS, 0, 0);
+ if (HIWORD(red))
+ {
+ //TODO: handle error
+ break;
+ }
+ red = LOBYTE(red);
+ }
+
+ if (green == -1)
+ {
+ green = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_GREEN), UDM_GETPOS, 0, 0);
+ if (HIWORD(green))
+ {
+ //TODO: handle error
+ break;
+ }
+ green = LOBYTE(green);
+ }
+
+ if (blue == -1)
+ {
+ blue = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_BLUE), UDM_GETPOS, 0, 0);
+ if (HIWORD(blue))
+ {
+ //TODO: handle error
+ break;
+ }
+ blue = LOBYTE(blue);
+ }
+ s_Colors[pConInfo->ActiveStaticControl] = RGB(red, green, blue);
+ InvalidateRect(hwndDlg, NULL, TRUE); //FIXME
+ break;
+ }
+ case WM_COMMAND:
+ {
+ switch(LOWORD(wParam))
+ {
+ case IDC_RADIO_SCREEN_TEXT:
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(pConInfo->ScreenText),
FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(pConInfo->ScreenText),
FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(pConInfo->ScreenText),
FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE);
+ break;
+ }
+ case IDC_RADIO_SCREEN_BACKGROUND:
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(pConInfo->ScreenBackground),
FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN,
GetGValue(pConInfo->ScreenBackground), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE,
GetBValue(pConInfo->ScreenBackground), FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE);
+ break;
+ }
+ case IDC_RADIO_POPUP_TEXT:
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(pConInfo->PopupText),
FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(pConInfo->PopupText),
FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(pConInfo->PopupText),
FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE);
+ break;
+ }
+ case IDC_RADIO_POPUP_BACKGROUND:
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(pConInfo->PopupBackground),
FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN,
GetGValue(pConInfo->PopupBackground), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(pConInfo->PopupBackground),
FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE);
+ break;
+ }
+ }
+ if (HIWORD(wParam) == STN_CLICKED && LOWORD(wParam) >= IDC_STATIC_COLOR1
&& LOWORD(wParam) <= IDC_STATIC_COLOR16)
+ {
+ DWORD index = LOWORD(wParam) - IDC_STATIC_COLOR1;
+
+ pConInfo->ActiveStaticControl = index;
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, GetRValue(s_Colors[index]), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(s_Colors[index]), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, GetBValue(s_Colors[index]), FALSE);
+
+ /* update global struct */
+ if (SendMessage(GetDlgItem(hwndDlg, IDC_RADIO_SCREEN_TEXT), BM_GETCHECK, 0, 0) &
BST_CHECKED)
+ {
+ pConInfo->ScreenText = s_Colors[index];
+ }
+ else if (SendMessage(GetDlgItem(hwndDlg, IDC_RADIO_SCREEN_BACKGROUND), BM_GETCHECK,
0, 0) & BST_CHECKED)
+ {
+ pConInfo->ScreenBackground = s_Colors[index];
+ }
+ else if (SendMessage(GetDlgItem(hwndDlg, IDC_RADIO_POPUP_TEXT), BM_GETCHECK, 0, 0)
& BST_CHECKED)
+ {
+ pConInfo->PopupText = s_Colors[index];
+ }
+ else if (SendMessage(GetDlgItem(hwndDlg, IDC_RADIO_POPUP_BACKGROUND), BM_GETCHECK, 0,
0) & BST_CHECKED)
+ {
+ pConInfo->PopupBackground = s_Colors[index];
+ }
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE);
+ break;
+ }
+ }
+
default:
break;
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 03:55:08 2006
@@ -26,7 +26,7 @@
};
static void
-InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
+InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, LPARAM lParam)
{
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
psp->dwSize = sizeof(PROPSHEETPAGE);
@@ -34,10 +34,11 @@
psp->hInstance = hApplet;
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
psp->pfnDlgProc = DlgProc;
-}
-
-BOOL
-InitConsoleInfo(HWND hwnd)
+ psp->lParam = lParam;
+}
+
+PConsoleInfo
+InitConsoleInfo()
{
PConsoleInfo pConInfo;
STARTUPINFO StartupInfo;
@@ -46,14 +47,26 @@
pConInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ConsoleInfo));
if (!pConInfo)
- return FALSE;
+ {
+ return NULL;
+ }
/* initialize struct */
pConInfo->InsertMode = TRUE;
pConInfo->HistoryBufferSize = 50;
pConInfo->NumberOfHistoryBuffers = 5;
+ pConInfo->ScreenText = RGB(192, 192, 192);
+ pConInfo->ScreenBackground = RGB(0, 0, 0);
+ pConInfo->PopupText = RGB(128, 0, 128);
+ pConInfo->PopupBackground = RGB(255, 255, 255);
+
+
+ GetModuleFileName(NULL, pConInfo->szProcessName, MAX_PATH);
+ //MessageBox(hwnd, pConInfo->szProcessName, _T("GetModuleFileName"),
MB_OK);
GetStartupInfo(&StartupInfo);
+
+
if ( StartupInfo.lpTitle )
{
@@ -89,11 +102,7 @@
{
_tcscpy(pConInfo->szProcessName, _T("Console"));
}
-
- SetWindowText(hwnd, pConInfo->szProcessName);
- SetWindowLongPtr(hwnd, DWLP_USER , (LONG)pConInfo);
-
- return TRUE;
+ return pConInfo;
}
INT_PTR
@@ -107,7 +116,7 @@
{
HWND hDlgCtrl;
- UNREFERENCED_PARAMETER(lParam)
+ UNREFERENCED_PARAMETER(lParam);
switch(uMsg)
{
@@ -168,7 +177,7 @@
LPARAM lParam
)
{
- PConsoleInfo pConInfo = (PConsoleInfo) GetWindowLongPtr(hwndDlg, DWLP_USER);
+ PConsoleInfo pConInfo = (PConsoleInfo) GetWindowLongPtr(GetParent(hwndDlg), DWLP_USER);
switch(uMsg)
{
@@ -197,10 +206,7 @@
}
break;
}
- case PSCB_INITIALIZED:
- {
- break;
- }
+
default:
break;
}
@@ -214,13 +220,14 @@
PROPSHEETPAGE psp[4];
PROPSHEETHEADER psh;
INT i=0;
-
- UNREFERENCED_PARAMETER(hwnd)
- UNREFERENCED_PARAMETER(uMsg)
- UNREFERENCED_PARAMETER(wParam)
- UNREFERENCED_PARAMETER(lParam)
-
-
+ PConsoleInfo pConInfo;
+
+ UNREFERENCED_PARAMETER(hwnd);
+ UNREFERENCED_PARAMETER(uMsg);
+ UNREFERENCED_PARAMETER(wParam);
+ UNREFERENCED_PARAMETER(lParam);
+
+ pConInfo = InitConsoleInfo();
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
@@ -234,10 +241,10 @@
psh.ppsp = psp;
psh.pfnCallback = PropSheetProc;
- InitPropSheetPage(&psp[i++], IDD_PROPPAGEOPTIONS, (DLGPROC) OptionsProc);
- InitPropSheetPage(&psp[i++], IDD_PROPPAGEFONT, (DLGPROC) FontProc);
- InitPropSheetPage(&psp[i++], IDD_PROPPAGELAYOUT, (DLGPROC) LayoutProc);
- InitPropSheetPage(&psp[i++], IDD_PROPPAGECOLORS, (DLGPROC) ColorsProc);
+ 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);
return (PropertySheet(&psh) != -1);
}
@@ -287,7 +294,7 @@
DWORD dwReason,
LPVOID lpvReserved)
{
- UNREFERENCED_PARAMETER(lpvReserved)
+ UNREFERENCED_PARAMETER(lpvReserved);
switch(dwReason)
{
Modified: trunk/reactos/dll/win32/console/console.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/console.…
==============================================================================
--- trunk/reactos/dll/win32/console/console.def (original)
+++ trunk/reactos/dll/win32/console/console.def Mon Aug 21 03:55:08 2006
@@ -1,6 +1,6 @@
LIBRARY console.dll
EXPORTS
-CPlApplet@16
+CPlApplet
; EOF
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 03:55:08 2006
@@ -29,9 +29,17 @@
DWORD QuickEdit;
DWORD InsertMode;
+ DWORD ActiveStaticControl;
+ COLORREF ScreenText;
+ COLORREF ScreenBackground;
+ COLORREF PopupText;
+ COLORREF PopupBackground;
+
} ConsoleInfo, *PConsoleInfo;
BOOL WriteConsoleOptions(PConsoleInfo pConInfo);
-BOOL InitConsoleInfo(HWND hwnd);
+
+//globals
+extern HINSTANCE hApplet;
#endif /* CONSOLE_H__ */
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 03:55:08 2006
@@ -6,6 +6,8 @@
* PURPOSE: English resource file
* PROGRAMMERS: Johannes Anderwald (johannes.anderwald(a)student.tugraz.at)
*/
+
+#include <commctrl.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@@ -24,10 +26,10 @@
GROUPBOX "Command History:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE |
WS_GROUP
LTEXT "&Buffer Size", -1, 25, 100, 60, 15
EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 100, 30, 15, ES_RIGHT | WS_GROUP
-CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS,UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 100, 12, 12
+CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 100, 12, 12
LTEXT "&Number of Buffers:", -1, 25, 120, 80, 15
EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP
-CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS,UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 120, 12, 12
+CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 120, 12, 12
CHECKBOX "&Discard Old Duplicates", IDC_CHECK_DISCARD_DUPLICATES, 25, 140,
100, 15
@@ -101,31 +103,31 @@
EDITTEXT IDC_EDIT_COLOR_RED, 150, 25, 30, 10, ES_RIGHT | WS_GROUP
CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 25, 30, 10
LTEXT "&Green:", -1, 125, 35, 30, 10
-EDITTEXT IDC_EDIT_COLOR_BLUE, 150, 35, 30, 10, ES_RIGHT | WS_GROUP
+EDITTEXT IDC_EDIT_COLOR_GREEN, 150, 35, 30, 10, ES_RIGHT | WS_GROUP
CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 35, 30, 10
LTEXT "&Blue:", -1, 125, 45, 30, 10
EDITTEXT IDC_EDIT_COLOR_BLUE, 150, 45, 30, 10, ES_RIGHT | WS_GROUP
CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 45, 30, 10
-CONTROL "", IDC_STATIC_COLOR1, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 15, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR2, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 27, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR3, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 39, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR4, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 51, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR5, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 63, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR6, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 75, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR7, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 87, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR8, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 99, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR9, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 111, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR10, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 123, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR11, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 135, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR12, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 147, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR13, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 159, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR14, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 171, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR15, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 183, 90, 10, 10
-CONTROL "", IDC_STATIC_COLOR16, "Static", SS_BLACKRECT | SS_NOTIFY |
SS_SUNKEN, 195, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 15, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR2, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 27, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR3, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 39, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR4, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 51, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR5, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 63, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR6, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 75, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR7, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 87, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR8, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 99, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR9, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 111, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR10, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 123, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR11, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 135, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR12, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 147, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR13, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 159, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 171, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 183, 90, 10, 10
+CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN |
SS_OWNERDRAW, 195, 90, 10, 10
GROUPBOX "Selected Screen Colors", -1, 10, 110, 200, 40
-CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_BLACKRECT |
SS_SUNKEN, 15, 120, 180, 20
+CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW |
SS_SUNKEN, 15, 120, 180, 20
GROUPBOX "Selected Popup Colors", -1, 10, 155, 200, 40
-CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_BLACKRECT |
SS_SUNKEN, 15, 165, 180, 20
+CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW |
SS_SUNKEN, 15, 165, 180, 20
END
IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 100
@@ -144,4 +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"
END
Modified: trunk/reactos/dll/win32/console/font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/font.c?r…
==============================================================================
--- trunk/reactos/dll/win32/console/font.c (original)
+++ trunk/reactos/dll/win32/console/font.c Mon Aug 21 03:55:08 2006
@@ -19,9 +19,9 @@
LPARAM lParam
)
{
- UNREFERENCED_PARAMETER(hwndDlg)
- UNREFERENCED_PARAMETER(wParam)
- UNREFERENCED_PARAMETER(lParam)
+ UNREFERENCED_PARAMETER(hwndDlg);
+ UNREFERENCED_PARAMETER(wParam);
+
switch(uMsg)
{
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 03:55:08 2006
@@ -18,15 +18,19 @@
LPARAM lParam
)
{
- UNREFERENCED_PARAMETER(hwndDlg)
- UNREFERENCED_PARAMETER(wParam)
- UNREFERENCED_PARAMETER(lParam)
+ PConsoleInfo pConInfo = (PConsoleInfo)GetWindowLongPtr(hwndDlg, DWLP_USER);
+
+ UNREFERENCED_PARAMETER(hwndDlg);
+ UNREFERENCED_PARAMETER(wParam);
switch(uMsg)
{
case WM_INITDIALOG:
+ {
+ pConInfo = (PConsoleInfo) ((LPPROPSHEETPAGE)lParam)->lParam;
+ SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo);
return TRUE;
-
+ }
default:
break;
}
Modified: trunk/reactos/dll/win32/console/options.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/options.…
==============================================================================
--- trunk/reactos/dll/win32/console/options.c (original)
+++ trunk/reactos/dll/win32/console/options.c Mon Aug 21 03:55:08 2006
@@ -9,7 +9,13 @@
#include "console.h"
-BOOLEAN InitializeOptionsDialog();
+static
+void
+UpdateDialogElements(HWND hwndDlg, PConsoleInfo pConInfo);
+
+static
+BOOL
+InitializeOptionsFromReg(TCHAR * Path, PConsoleInfo pConInfo);
INT_PTR
CALLBACK
@@ -25,13 +31,17 @@
HWND hDlgCtrl;
LPPSHNOTIFY lppsn;
- pConInfo = (PConsoleInfo) GetWindowLongPtr(GetParent(hwndDlg), DWLP_USER);
+ pConInfo = (PConsoleInfo) GetWindowLongPtr(hwndDlg, DWLP_USER);
switch(uMsg)
{
case WM_INITDIALOG:
{
- return InitializeOptionsDialog(hwndDlg);
+ pConInfo = (PConsoleInfo) ((LPPROPSHEETPAGE)lParam)->lParam;
+ SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo);
+ InitializeOptionsFromReg(pConInfo->szProcessName, pConInfo);
+ UpdateDialogElements(hwndDlg, pConInfo);
+ return TRUE;
}
case WM_NOTIFY:
{
@@ -149,6 +159,7 @@
return FALSE;
}
+static
BOOL InitializeOptionsFromReg(TCHAR * Path, PConsoleInfo pConInfo)
{
HKEY hKey;
@@ -157,7 +168,9 @@
DWORD dwIndex;
DWORD dwValueName;
DWORD dwValue;
+ DWORD dwType;
TCHAR szValueName[MAX_PATH];
+ TCHAR szValue[MAX_PATH];
DWORD Value;
if ( RegOpenCurrentUser(KEY_READ, &hKey) != ERROR_SUCCESS )
@@ -170,26 +183,39 @@
return FALSE;
}
- RegQueryInfoKey(hKey, NULL, NULL, NULL, &dwNumSubKeys, NULL, NULL, NULL, NULL,
NULL, NULL, NULL );
+ RegQueryInfoKey(hSubKey, NULL, NULL, NULL, &dwNumSubKeys, NULL, NULL, NULL, NULL,
NULL, NULL, NULL );
for (dwIndex = 0; dwIndex < dwNumSubKeys; dwIndex++)
{
dwValue = sizeof(Value);
dwValueName = MAX_PATH;
- if ( RegEnumValue(hSubKey, dwIndex, szValueName, &dwValueName, NULL, NULL,
(BYTE*)&Value, &dwValue) != ERROR_SUCCESS)
- break;
-
- if ( !_tcscmp(szValueName, _T("CursorSize")) )
- {
- if ( Value == 0x32)
- pConInfo->CursorSize = Value;
- else if ( Value == 0x64 )
- pConInfo->CursorSize = Value;
- }
- else if ( !_tcscmp(szValueName, _T("NumberOfHistoryBuffers")) )
- {
- pConInfo->NumberOfHistoryBuffers = Value;
+ if ( RegEnumValue(hSubKey, dwIndex, szValueName, &dwValueName, NULL,
&dwType, (BYTE*)&Value, &dwValue) != ERROR_SUCCESS)
+ {
+ if (dwType == REG_SZ)
+ {
+ /*
+ * retry in case of string value
+ */
+ dwValue = sizeof(szValue);
+ dwValueName = MAX_PATH;
+ if (RegEnumValue(hSubKey, dwIndex, szValueName, &dwValueName, NULL,
NULL, (BYTE*)szValue, &dwValue) != ERROR_SUCCESS)
+ break;
+ }
+ else
+ break;
+ }
+
+ if ( !_tcscmp(szValueName, _T("CursorSize")) )
+ {
+ if ( Value == 0x32)
+ pConInfo->CursorSize = Value;
+ else if ( Value == 0x64 )
+ pConInfo->CursorSize = Value;
+ }
+ else if ( !_tcscmp(szValueName, _T("NumberOfHistoryBuffers")) )
+ {
+ pConInfo->NumberOfHistoryBuffers = Value;
}
else if ( !_tcscmp(szValueName, _T("HistoryBufferSize")) )
{
@@ -218,6 +244,7 @@
return TRUE;
}
+static
void
UpdateDialogElements(HWND hwndDlg, PConsoleInfo pConInfo)
{
@@ -321,8 +348,7 @@
if (!pConInfo)
return FALSE;
- InitializeOptionsFromReg(pConInfo->szProcessName, pConInfo);
- UpdateDialogElements(hwndDlg, pConInfo);
+
return TRUE;
}
Modified: trunk/reactos/dll/win32/console/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/resource…
==============================================================================
--- trunk/reactos/dll/win32/console/resource.h (original)
+++ trunk/reactos/dll/win32/console/resource.h Mon Aug 21 03:55:08 2006
@@ -88,4 +88,8 @@
#define IDC_STATIC_COLOR15 626
#define IDC_STATIC_COLOR16 627
+
+//string ids
+#define IDS_SCREEN_TEXT 700
+
#endif