mirror of
https://github.com/reactos/reactos.git
synced 2024-08-15 08:03:55 +00:00
* handle PSN_APPLY effectively
* remove no longer used callback * reenable PropSheet_Changed macros * fix styles for dialog svn path=/trunk/; revision=23693
This commit is contained in:
parent
fe2d752e93
commit
52f5a2cccc
|
@ -100,6 +100,10 @@ ColorsProc(
|
|||
{
|
||||
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 @@ ColorsProc(
|
|||
}
|
||||
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)
|
||||
{
|
||||
|
@ -142,6 +158,10 @@ ColorsProc(
|
|||
{
|
||||
blue = lpnmud->iPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (red == -1)
|
||||
{
|
||||
|
|
|
@ -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 @@ InitConsoleInfo()
|
|||
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 @@ ApplyProc(
|
|||
}
|
||||
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 @@ ApplyProc(
|
|||
else
|
||||
EndDialog(hwndDlg, IDC_RADIO_APPLY_ALL);
|
||||
}
|
||||
else if (LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
EndDialog(hwndDlg, IDCANCEL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -154,67 +158,33 @@ ApplyProc(
|
|||
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
|
||||
*/
|
||||
pConInfo->AppliedConfig = TRUE;
|
||||
SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* First Applet */
|
||||
LONG APIENTRY
|
||||
InitApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
|
||||
|
@ -233,7 +203,7 @@ InitApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
|
|||
|
||||
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 @@ InitApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
|
|||
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);
|
||||
|
|
|
@ -21,6 +21,7 @@ typedef struct
|
|||
typedef struct TAGConsoleInfo
|
||||
{
|
||||
TCHAR szProcessName[MAX_PATH];
|
||||
BOOLEAN AppliedConfig;
|
||||
DWORD CursorSize;
|
||||
DWORD NumberOfHistoryBuffers;
|
||||
DWORD HistoryBufferSize;
|
||||
|
@ -28,22 +29,19 @@ typedef struct TAGConsoleInfo
|
|||
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;
|
||||
|
|
|
@ -131,7 +131,7 @@ CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165,
|
|||
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
|
||||
|
|
|
@ -57,7 +57,26 @@ OptionsProc(
|
|||
|
||||
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 @@ OptionsProc(
|
|||
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 @@ OptionsProc(
|
|||
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 @@ OptionsProc(
|
|||
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 @@ OptionsProc(
|
|||
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:
|
||||
|
|
Loading…
Reference in a new issue