Author: janderwald Date: Fri Aug 25 00:55:13 2006 New Revision: 23693
URL: http://svn.reactos.org/svn/reactos?rev=23693&view=rev Log: * handle PSN_APPLY effectively * remove no longer used callback * reenable PropSheet_Changed macros * fix styles for 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/options.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 Fri Aug 25 00:55:13 2006 @@ -100,6 +100,10 @@ { PConsoleInfo pConInfo; LPNMUPDOWN lpnmud; + LPPSHNOTIFY lppsn; + DWORD red = -1; + DWORD green = -1; + DWORD blue = -1;
pConInfo = (PConsoleInfo) GetWindowLongPtr(hwndDlg, DWLP_USER);
@@ -124,11 +128,23 @@ } case WM_NOTIFY: { - DWORD red = -1; - DWORD green = -1; - DWORD blue = -1; - lpnmud = (LPNMUPDOWN) lParam; + lppsn = (LPPSHNOTIFY) lParam; + + if (lppsn->hdr.code == PSN_APPLY) + { + if (!pConInfo->AppliedConfig) + { + ApplyConsoleInfo(hwndDlg, pConInfo); + } + else + { + /* options have already been applied */ + SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR); + return TRUE; + } + return TRUE; + }
if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_RED) { @@ -141,6 +157,10 @@ else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_BLUE) { blue = lpnmud->iPos; + } + else + { + break; }
if (red == -1)
Modified: trunk/reactos/dll/win32/console/console.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/console.c... ============================================================================== --- trunk/reactos/dll/win32/console/console.c (original) +++ trunk/reactos/dll/win32/console/console.c Fri Aug 25 00:55:13 2006 @@ -10,6 +10,8 @@ #include "console.h"
#define NUM_APPLETS (1) +#define WM_SETCONSOLE (WM_USER+10) +
LONG APIENTRY InitApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam); INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -64,8 +66,6 @@ pConInfo->ScreenBuffer = MAKELONG(80, 300);
GetModuleFileName(NULL, pConInfo->szProcessName, MAX_PATH); - //MessageBox(hwnd, pConInfo->szProcessName, _T("GetModuleFileName"), MB_OK); - GetStartupInfo(&StartupInfo);
@@ -134,7 +134,7 @@ } case WM_COMMAND: { - if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + if (LOWORD(wParam) == IDOK) { hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_APPLY_CURRENT); if ( SendMessage(hDlgCtrl, BM_GETCHECK, 0, 0) == BST_CHECKED ) @@ -142,6 +142,10 @@ else EndDialog(hwndDlg, IDC_RADIO_APPLY_ALL); } + else if (LOWORD(wParam) == IDCANCEL) + { + EndDialog(hwndDlg, IDCANCEL); + } break; } default: @@ -154,65 +158,31 @@ void ApplyConsoleInfo(HWND hwndDlg, PConsoleInfo pConInfo) { - INT_PTR res; + INT_PTR res = 0;
res = DialogBox(hApplet, MAKEINTRESOURCE(IDD_APPLYOPTIONS), hwndDlg, ApplyProc);
- if ( res == IDC_RADIO_APPLY_ALL ) - { + if (res == IDCANCEL) + { + /* dont destroy when user presses cancel */ + SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE); + } + else if ( res == IDC_RADIO_APPLY_ALL ) + { + /* apply options */ WriteConsoleOptions(pConInfo); + pConInfo->AppliedConfig = TRUE; + SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR); } else if ( res == IDC_RADIO_APPLY_CURRENT ) { /* - * TODO: check if szProcessName != _T("Console") - * in that case notify win32csr that the changes are local + * TODO: + * exchange info in some private way with win32csr */ - } -} - -/* Property Sheet Callback */ -int CALLBACK -PropSheetProc( - HWND hwndDlg, - UINT uMsg, - LPARAM lParam -) -{ - PConsoleInfo pConInfo = (PConsoleInfo) GetWindowLongPtr(GetParent(hwndDlg), DWLP_USER); - - switch(uMsg) - { - case PSCB_BUTTONPRESSED: - { - switch(lParam) - { - case PSBTN_OK: /* OK */ - { - if ( pConInfo ) - { - ApplyConsoleInfo(hwndDlg, pConInfo); - } - break; - } - case PSBTN_CANCEL: /* Cancel */ - { - break; - } - case PSBTN_FINISH: /* Close */ - { - break; - } - default: - return FALSE; - } - break; - } - - default: - break; - } - return TRUE; + pConInfo->AppliedConfig = TRUE; + SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR); + } }
/* First Applet */ @@ -233,7 +203,7 @@
ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_PROPTITLE | PSH_USECALLBACK; + psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_NOAPPLYNOW; psh.hwndParent = NULL; psh.hInstance = hApplet; psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON)); @@ -241,7 +211,7 @@ psh.nPages = 4; psh.nStartPage = 0; psh.ppsp = psp; - psh.pfnCallback = PropSheetProc; + psh.pszCaption = pConInfo->szProcessName;
InitPropSheetPage(&psp[i++], IDD_PROPPAGEOPTIONS, (DLGPROC) OptionsProc, (LPARAM)pConInfo); InitPropSheetPage(&psp[i++], IDD_PROPPAGEFONT, (DLGPROC) FontProc, (LPARAM)pConInfo);
Modified: trunk/reactos/dll/win32/console/console.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/console.h... ============================================================================== --- trunk/reactos/dll/win32/console/console.h (original) +++ trunk/reactos/dll/win32/console/console.h Fri Aug 25 00:55:13 2006 @@ -21,6 +21,7 @@ typedef struct TAGConsoleInfo { TCHAR szProcessName[MAX_PATH]; + BOOLEAN AppliedConfig; DWORD CursorSize; DWORD NumberOfHistoryBuffers; DWORD HistoryBufferSize; @@ -28,22 +29,19 @@ DWORD FullScreen; DWORD QuickEdit; DWORD InsertMode; - DWORD ScreenBuffer; DWORD WindowSize; DWORD WindowPosition; - - - DWORD ActiveStaticControl; COLORREF ScreenText; COLORREF ScreenBackground; COLORREF PopupText; COLORREF PopupBackground; - } ConsoleInfo, *PConsoleInfo;
BOOL WriteConsoleOptions(PConsoleInfo pConInfo); +void ApplyConsoleInfo(HWND hwndDlg, PConsoleInfo pConInfo); +
//globals extern HINSTANCE hApplet;
Modified: trunk/reactos/dll/win32/console/en.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/en.rc?rev... ============================================================================== --- trunk/reactos/dll/win32/console/en.rc (original) +++ trunk/reactos/dll/win32/console/en.rc Fri Aug 25 00:55:13 2006 @@ -131,7 +131,7 @@ END
IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 100 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CAPTION +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION CAPTION "Apply Properties" FONT 8, "MS Shell Dlg" BEGIN
Modified: trunk/reactos/dll/win32/console/options.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/options.c... ============================================================================== --- trunk/reactos/dll/win32/console/options.c (original) +++ trunk/reactos/dll/win32/console/options.c Fri Aug 25 00:55:13 2006 @@ -57,7 +57,26 @@
hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_NUM_BUFFER); pConInfo->NumberOfHistoryBuffers = LOWORD(SendMessage(hDlgCtrl, UDM_GETPOS, 0, 0)); - //PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + //else if (lppsn->hdr.code == PSN_KILLACTIVE) + //{ + // SetWindowLong(hwndDlg, DWL_MSGRESULT, FALSE); + // return FALSE; + //} + else if (lppsn->hdr.code == PSN_APPLY) + { + if (!pConInfo->AppliedConfig) + { + ApplyConsoleInfo(hwndDlg, pConInfo); + } + else + { + /* options have already been applied */ + SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR); + return TRUE; + } + return TRUE; } break; } @@ -72,31 +91,31 @@ case IDC_RADIO_SMALL_CURSOR: { pConInfo->CursorSize = 0x0; - //PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } case IDC_RADIO_MEDIUM_CURSOR: { pConInfo->CursorSize = 0x32; - //PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } case IDC_RADIO_LARGE_CURSOR: { pConInfo->CursorSize = 0x64; - //PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } case IDC_RADIO_DISPLAY_WINDOW: { pConInfo->FullScreen = FALSE; - //PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } case IDC_RADIO_DISPLAY_FULL: { pConInfo->FullScreen = TRUE; - //PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } case IDC_CHECK_QUICK_EDIT: @@ -112,7 +131,7 @@ pConInfo->QuickEdit = TRUE; SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0); } - //PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } case IDC_CHECK_INSERT_MODE: @@ -128,7 +147,7 @@ pConInfo->InsertMode = TRUE; SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0); } - //PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } case IDC_CHECK_DISCARD_DUPLICATES: @@ -144,7 +163,7 @@ pConInfo->HistoryNoDup = TRUE; SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0); } - //PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } default: