mirror of
https://github.com/reactos/reactos.git
synced 2024-09-11 05:12:43 +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;
|
PConsoleInfo pConInfo;
|
||||||
LPNMUPDOWN lpnmud;
|
LPNMUPDOWN lpnmud;
|
||||||
|
LPPSHNOTIFY lppsn;
|
||||||
|
DWORD red = -1;
|
||||||
|
DWORD green = -1;
|
||||||
|
DWORD blue = -1;
|
||||||
|
|
||||||
pConInfo = (PConsoleInfo) GetWindowLongPtr(hwndDlg, DWLP_USER);
|
pConInfo = (PConsoleInfo) GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||||
|
|
||||||
|
@ -124,11 +128,23 @@ ColorsProc(
|
||||||
}
|
}
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
DWORD red = -1;
|
|
||||||
DWORD green = -1;
|
|
||||||
DWORD blue = -1;
|
|
||||||
|
|
||||||
lpnmud = (LPNMUPDOWN) lParam;
|
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)
|
if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_RED)
|
||||||
{
|
{
|
||||||
|
@ -142,6 +158,10 @@ ColorsProc(
|
||||||
{
|
{
|
||||||
blue = lpnmud->iPos;
|
blue = lpnmud->iPos;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (red == -1)
|
if (red == -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
|
||||||
#define NUM_APPLETS (1)
|
#define NUM_APPLETS (1)
|
||||||
|
#define WM_SETCONSOLE (WM_USER+10)
|
||||||
|
|
||||||
|
|
||||||
LONG APIENTRY InitApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
|
LONG APIENTRY InitApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
|
||||||
INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
@ -64,8 +66,6 @@ InitConsoleInfo()
|
||||||
pConInfo->ScreenBuffer = MAKELONG(80, 300);
|
pConInfo->ScreenBuffer = MAKELONG(80, 300);
|
||||||
|
|
||||||
GetModuleFileName(NULL, pConInfo->szProcessName, MAX_PATH);
|
GetModuleFileName(NULL, pConInfo->szProcessName, MAX_PATH);
|
||||||
//MessageBox(hwnd, pConInfo->szProcessName, _T("GetModuleFileName"), MB_OK);
|
|
||||||
|
|
||||||
GetStartupInfo(&StartupInfo);
|
GetStartupInfo(&StartupInfo);
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ ApplyProc(
|
||||||
}
|
}
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
if (LOWORD(wParam) == IDOK)
|
||||||
{
|
{
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_APPLY_CURRENT);
|
hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_APPLY_CURRENT);
|
||||||
if ( SendMessage(hDlgCtrl, BM_GETCHECK, 0, 0) == BST_CHECKED )
|
if ( SendMessage(hDlgCtrl, BM_GETCHECK, 0, 0) == BST_CHECKED )
|
||||||
|
@ -142,6 +142,10 @@ ApplyProc(
|
||||||
else
|
else
|
||||||
EndDialog(hwndDlg, IDC_RADIO_APPLY_ALL);
|
EndDialog(hwndDlg, IDC_RADIO_APPLY_ALL);
|
||||||
}
|
}
|
||||||
|
else if (LOWORD(wParam) == IDCANCEL)
|
||||||
|
{
|
||||||
|
EndDialog(hwndDlg, IDCANCEL);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -154,67 +158,33 @@ ApplyProc(
|
||||||
void
|
void
|
||||||
ApplyConsoleInfo(HWND hwndDlg, PConsoleInfo pConInfo)
|
ApplyConsoleInfo(HWND hwndDlg, PConsoleInfo pConInfo)
|
||||||
{
|
{
|
||||||
INT_PTR res;
|
INT_PTR res = 0;
|
||||||
|
|
||||||
res = DialogBox(hApplet, MAKEINTRESOURCE(IDD_APPLYOPTIONS), hwndDlg, ApplyProc);
|
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);
|
WriteConsoleOptions(pConInfo);
|
||||||
|
pConInfo->AppliedConfig = TRUE;
|
||||||
|
SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR);
|
||||||
}
|
}
|
||||||
else if ( res == IDC_RADIO_APPLY_CURRENT )
|
else if ( res == IDC_RADIO_APPLY_CURRENT )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* TODO: check if szProcessName != _T("Console")
|
* TODO:
|
||||||
* in that case notify win32csr that the changes are local
|
* 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 */
|
/* First Applet */
|
||||||
LONG APIENTRY
|
LONG APIENTRY
|
||||||
InitApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
|
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));
|
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||||
psh.dwSize = 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.hwndParent = NULL;
|
||||||
psh.hInstance = hApplet;
|
psh.hInstance = hApplet;
|
||||||
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
|
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
|
||||||
|
@ -241,7 +211,7 @@ InitApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
|
||||||
psh.nPages = 4;
|
psh.nPages = 4;
|
||||||
psh.nStartPage = 0;
|
psh.nStartPage = 0;
|
||||||
psh.ppsp = psp;
|
psh.ppsp = psp;
|
||||||
psh.pfnCallback = PropSheetProc;
|
psh.pszCaption = pConInfo->szProcessName;
|
||||||
|
|
||||||
InitPropSheetPage(&psp[i++], IDD_PROPPAGEOPTIONS, (DLGPROC) OptionsProc, (LPARAM)pConInfo);
|
InitPropSheetPage(&psp[i++], IDD_PROPPAGEOPTIONS, (DLGPROC) OptionsProc, (LPARAM)pConInfo);
|
||||||
InitPropSheetPage(&psp[i++], IDD_PROPPAGEFONT, (DLGPROC) FontProc, (LPARAM)pConInfo);
|
InitPropSheetPage(&psp[i++], IDD_PROPPAGEFONT, (DLGPROC) FontProc, (LPARAM)pConInfo);
|
||||||
|
|
|
@ -21,6 +21,7 @@ typedef struct
|
||||||
typedef struct TAGConsoleInfo
|
typedef struct TAGConsoleInfo
|
||||||
{
|
{
|
||||||
TCHAR szProcessName[MAX_PATH];
|
TCHAR szProcessName[MAX_PATH];
|
||||||
|
BOOLEAN AppliedConfig;
|
||||||
DWORD CursorSize;
|
DWORD CursorSize;
|
||||||
DWORD NumberOfHistoryBuffers;
|
DWORD NumberOfHistoryBuffers;
|
||||||
DWORD HistoryBufferSize;
|
DWORD HistoryBufferSize;
|
||||||
|
@ -28,22 +29,19 @@ typedef struct TAGConsoleInfo
|
||||||
DWORD FullScreen;
|
DWORD FullScreen;
|
||||||
DWORD QuickEdit;
|
DWORD QuickEdit;
|
||||||
DWORD InsertMode;
|
DWORD InsertMode;
|
||||||
|
|
||||||
DWORD ScreenBuffer;
|
DWORD ScreenBuffer;
|
||||||
DWORD WindowSize;
|
DWORD WindowSize;
|
||||||
DWORD WindowPosition;
|
DWORD WindowPosition;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DWORD ActiveStaticControl;
|
DWORD ActiveStaticControl;
|
||||||
COLORREF ScreenText;
|
COLORREF ScreenText;
|
||||||
COLORREF ScreenBackground;
|
COLORREF ScreenBackground;
|
||||||
COLORREF PopupText;
|
COLORREF PopupText;
|
||||||
COLORREF PopupBackground;
|
COLORREF PopupBackground;
|
||||||
|
|
||||||
} ConsoleInfo, *PConsoleInfo;
|
} ConsoleInfo, *PConsoleInfo;
|
||||||
|
|
||||||
BOOL WriteConsoleOptions(PConsoleInfo pConInfo);
|
BOOL WriteConsoleOptions(PConsoleInfo pConInfo);
|
||||||
|
void ApplyConsoleInfo(HWND hwndDlg, PConsoleInfo pConInfo);
|
||||||
|
|
||||||
|
|
||||||
//globals
|
//globals
|
||||||
extern HINSTANCE hApplet;
|
extern HINSTANCE hApplet;
|
||||||
|
|
|
@ -131,7 +131,7 @@ CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165,
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 100
|
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"
|
CAPTION "Apply Properties"
|
||||||
FONT 8, "MS Shell Dlg"
|
FONT 8, "MS Shell Dlg"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -57,7 +57,26 @@ OptionsProc(
|
||||||
|
|
||||||
hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_NUM_BUFFER);
|
hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_NUM_BUFFER);
|
||||||
pConInfo->NumberOfHistoryBuffers = LOWORD(SendMessage(hDlgCtrl, UDM_GETPOS, 0, 0));
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -72,31 +91,31 @@ OptionsProc(
|
||||||
case IDC_RADIO_SMALL_CURSOR:
|
case IDC_RADIO_SMALL_CURSOR:
|
||||||
{
|
{
|
||||||
pConInfo->CursorSize = 0x0;
|
pConInfo->CursorSize = 0x0;
|
||||||
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_RADIO_MEDIUM_CURSOR:
|
case IDC_RADIO_MEDIUM_CURSOR:
|
||||||
{
|
{
|
||||||
pConInfo->CursorSize = 0x32;
|
pConInfo->CursorSize = 0x32;
|
||||||
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_RADIO_LARGE_CURSOR:
|
case IDC_RADIO_LARGE_CURSOR:
|
||||||
{
|
{
|
||||||
pConInfo->CursorSize = 0x64;
|
pConInfo->CursorSize = 0x64;
|
||||||
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_RADIO_DISPLAY_WINDOW:
|
case IDC_RADIO_DISPLAY_WINDOW:
|
||||||
{
|
{
|
||||||
pConInfo->FullScreen = FALSE;
|
pConInfo->FullScreen = FALSE;
|
||||||
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_RADIO_DISPLAY_FULL:
|
case IDC_RADIO_DISPLAY_FULL:
|
||||||
{
|
{
|
||||||
pConInfo->FullScreen = TRUE;
|
pConInfo->FullScreen = TRUE;
|
||||||
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_CHECK_QUICK_EDIT:
|
case IDC_CHECK_QUICK_EDIT:
|
||||||
|
@ -112,7 +131,7 @@ OptionsProc(
|
||||||
pConInfo->QuickEdit = TRUE;
|
pConInfo->QuickEdit = TRUE;
|
||||||
SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0);
|
SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0);
|
||||||
}
|
}
|
||||||
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_CHECK_INSERT_MODE:
|
case IDC_CHECK_INSERT_MODE:
|
||||||
|
@ -128,7 +147,7 @@ OptionsProc(
|
||||||
pConInfo->InsertMode = TRUE;
|
pConInfo->InsertMode = TRUE;
|
||||||
SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0);
|
SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0);
|
||||||
}
|
}
|
||||||
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDC_CHECK_DISCARD_DUPLICATES:
|
case IDC_CHECK_DISCARD_DUPLICATES:
|
||||||
|
@ -144,7 +163,7 @@ OptionsProc(
|
||||||
pConInfo->HistoryNoDup = TRUE;
|
pConInfo->HistoryNoDup = TRUE;
|
||||||
SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0);
|
SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0);
|
||||||
}
|
}
|
||||||
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue