Author: ekohl
Date: Tue Sep 18 02:29:35 2007
New Revision: 29088
URL:
http://svn.reactos.org/svn/reactos?rev=29088&view=rev
Log:
Merge all settings in a single struct. This is required to implement the administrative
options.
Modified:
trunk/reactos/dll/cpl/access/access.c
trunk/reactos/dll/cpl/access/access.h
trunk/reactos/dll/cpl/access/display.c
trunk/reactos/dll/cpl/access/general.c
trunk/reactos/dll/cpl/access/keyboard.c
trunk/reactos/dll/cpl/access/mouse.c
trunk/reactos/dll/cpl/access/sound.c
Modified: trunk/reactos/dll/cpl/access/access.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/access/access.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/access/access.c (original)
+++ trunk/reactos/dll/cpl/access/access.c Tue Sep 18 02:29:35 2007
@@ -26,8 +26,9 @@
{IDI_CPLACCESS, IDS_CPLSYSTEMNAME, IDS_CPLSYSTEMDESCRIPTION, SystemApplet}
};
+
static VOID
-InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
+InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, PGLOBAL_DATA
pGlobalData)
{
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
psp->dwSize = sizeof(PROPSHEETPAGE);
@@ -35,6 +36,7 @@
psp->hInstance = hApplet;
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
psp->pfnDlgProc = DlgProc;
+ psp->lParam = (LPARAM)pGlobalData;
}
@@ -43,11 +45,17 @@
LONG CALLBACK
SystemApplet(VOID)
{
+ PGLOBAL_DATA pGlobalData;
PROPSHEETPAGE psp[5];
PROPSHEETHEADER psh;
TCHAR Caption[1024];
+ INT ret;
LoadString(hApplet, IDS_CPLSYSTEMNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
+
+ pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBAL_DATA));
+ if (pGlobalData == NULL)
+ return 0;
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
@@ -60,13 +68,17 @@
psh.nStartPage = 0;
psh.ppsp = psp;
- InitPropSheetPage(&psp[0], IDD_PROPPAGEKEYBOARD, (DLGPROC)KeyboardPageProc);
- InitPropSheetPage(&psp[1], IDD_PROPPAGESOUND, (DLGPROC)SoundPageProc);
- InitPropSheetPage(&psp[2], IDD_PROPPAGEDISPLAY, (DLGPROC)DisplayPageProc);
- InitPropSheetPage(&psp[3], IDD_PROPPAGEMOUSE, (DLGPROC)MousePageProc);
- InitPropSheetPage(&psp[4], IDD_PROPPAGEGENERAL, (DLGPROC)GeneralPageProc);
+ InitPropSheetPage(&psp[0], IDD_PROPPAGEKEYBOARD, (DLGPROC)KeyboardPageProc,
pGlobalData);
+ InitPropSheetPage(&psp[1], IDD_PROPPAGESOUND, (DLGPROC)SoundPageProc,
pGlobalData);
+ InitPropSheetPage(&psp[2], IDD_PROPPAGEDISPLAY, (DLGPROC)DisplayPageProc,
pGlobalData);
+ InitPropSheetPage(&psp[3], IDD_PROPPAGEMOUSE, (DLGPROC)MousePageProc,
pGlobalData);
+ InitPropSheetPage(&psp[4], IDD_PROPPAGEGENERAL, (DLGPROC)GeneralPageProc,
pGlobalData);
- return (LONG)(PropertySheet(&psh) != -1);
+ ret = PropertySheet(&psh);
+
+ HeapFree(GetProcessHeap(), 0, pGlobalData);
+
+ return (LONG)(ret != -1);
}
/* Control Panel Callback */
Modified: trunk/reactos/dll/cpl/access/access.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/access/access.h?re…
==============================================================================
--- trunk/reactos/dll/cpl/access/access.h (original)
+++ trunk/reactos/dll/cpl/access/access.h Tue Sep 18 02:29:35 2007
@@ -10,6 +10,44 @@
INT idDescription;
APPLET_INITPROC AppletProc;
} APPLET, *PAPPLET;
+
+
+typedef struct _GLOBAL_DATA
+{
+ /* keyboard page */
+ STICKYKEYS stickyKeys;
+ STICKYKEYS oldStickyKeys;
+ FILTERKEYS filterKeys;
+ FILTERKEYS oldFilterKeys;
+ TOGGLEKEYS toggleKeys;
+ TOGGLEKEYS oldToggleKeys;
+ BOOL bKeyboardPref;
+
+ /* sound page */
+ SOUNDSENTRY ssSoundSentry;
+ BOOL bShowSounds;
+
+ /* display page */
+ HIGHCONTRAST highContrast;
+ UINT uCaretBlinkTime;
+ UINT uCaretWidth;
+ BOOL fShowCaret;
+ RECT rcCaret;
+ RECT rcOldCaret;
+
+ /* mouse page */
+ MOUSEKEYS mouseKeys;
+
+ /* general page */
+ ACCESSTIMEOUT accessTimeout;
+ SERIALKEYS serialKeys;
+ TCHAR szActivePort[MAX_PATH];
+ TCHAR szPort[MAX_PATH];
+ BOOL bWarningSounds;
+ BOOL bSoundOnActivation;
+
+} GLOBAL_DATA, *PGLOBAL_DATA;
+
extern HINSTANCE hApplet;
Modified: trunk/reactos/dll/cpl/access/display.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/access/display.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/access/display.c (original)
+++ trunk/reactos/dll/cpl/access/display.c Tue Sep 18 02:29:35 2007
@@ -16,15 +16,6 @@
#include "resource.h"
#include "access.h"
-typedef struct _GLOBAL_DATA
-{
- HIGHCONTRAST highContrast;
- UINT uCaretBlinkTime;
- UINT uCaretWidth;
- BOOL fShowCaret;
- RECT rcCaret;
- RECT rcOldCaret;
-} GLOBAL_DATA, *PGLOBAL_DATA;
#define ID_BLINK_TIMER 346
@@ -154,7 +145,7 @@
switch (uMsg)
{
case WM_INITDIALOG:
- pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(GLOBAL_DATA));
+ pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
if (pGlobalData == NULL)
return FALSE;
@@ -290,7 +281,6 @@
case WM_DESTROY:
KillTimer(hwndDlg, ID_BLINK_TIMER);
- HeapFree(GetProcessHeap(), 0, pGlobalData);
break;
}
Modified: trunk/reactos/dll/cpl/access/general.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/access/general.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/access/general.c (original)
+++ trunk/reactos/dll/cpl/access/general.c Tue Sep 18 02:29:35 2007
@@ -16,17 +16,6 @@
#include <tchar.h>
#include "resource.h"
#include "access.h"
-
-
-typedef struct _GLOBAL_DATA
-{
- ACCESSTIMEOUT accessTimeout;
- SERIALKEYS serialKeys;
- TCHAR szActivePort[MAX_PATH];
- TCHAR szPort[MAX_PATH];
- BOOL bWarningSounds;
- BOOL bSoundOnActivation;
-} GLOBAL_DATA, *PGLOBAL_DATA;
#define BAUDTICKS 6
@@ -267,7 +256,7 @@
switch (uMsg)
{
case WM_INITDIALOG:
- pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(GLOBAL_DATA));
+ pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
if (pGlobalData == NULL)
return FALSE;
@@ -367,10 +356,7 @@
return TRUE;
}
break;
-
- case WM_DESTROY:
- HeapFree(GetProcessHeap(), 0, pGlobalData);
- break; }
+ }
return FALSE;
}
Modified: trunk/reactos/dll/cpl/access/keyboard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/access/keyboard.c?…
==============================================================================
--- trunk/reactos/dll/cpl/access/keyboard.c (original)
+++ trunk/reactos/dll/cpl/access/keyboard.c Tue Sep 18 02:29:35 2007
@@ -17,17 +17,6 @@
#include "resource.h"
#include "access.h"
-typedef struct _GLOBAL_DATA
-{
- STICKYKEYS stickyKeys;
- STICKYKEYS oldStickyKeys;
- FILTERKEYS filterKeys;
- FILTERKEYS oldFilterKeys;
- TOGGLEKEYS toggleKeys;
- TOGGLEKEYS oldToggleKeys;
- BOOL bKeyboardPref;
-} GLOBAL_DATA, *PGLOBAL_DATA;
-
#define BOUNCETICKS 5
static INT nBounceArray[BOUNCETICKS] = {500, 700, 1000, 1500, 2000};
@@ -666,7 +655,7 @@
switch (uMsg)
{
case WM_INITDIALOG:
- pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(GLOBAL_DATA));
+ pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
if (pGlobalData == NULL)
return FALSE;
@@ -756,10 +745,6 @@
return TRUE;
}
break;
-
- case WM_DESTROY:
- HeapFree(GetProcessHeap(), 0, pGlobalData);
- break;
}
return FALSE;
Modified: trunk/reactos/dll/cpl/access/mouse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/access/mouse.c?rev…
==============================================================================
--- trunk/reactos/dll/cpl/access/mouse.c (original)
+++ trunk/reactos/dll/cpl/access/mouse.c Tue Sep 18 02:29:35 2007
@@ -16,11 +16,6 @@
#include "resource.h"
#include "access.h"
-typedef struct _GLOBAL_DATA
-{
- MOUSEKEYS mouseKeys;
-} GLOBAL_DATA, *PGLOBAL_DATA;
-
#define SPEEDTICKS 9
#define ACCELTICKS 9
@@ -165,7 +160,7 @@
switch (uMsg)
{
case WM_INITDIALOG:
- pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(GLOBAL_DATA));
+ pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
if (pGlobalData == NULL)
return FALSE;
@@ -218,10 +213,6 @@
return TRUE;
}
break;
-
- case WM_DESTROY:
- HeapFree(GetProcessHeap(), 0, pGlobalData);
- break;
}
return FALSE;
Modified: trunk/reactos/dll/cpl/access/sound.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/access/sound.c?rev…
==============================================================================
--- trunk/reactos/dll/cpl/access/sound.c (original)
+++ trunk/reactos/dll/cpl/access/sound.c Tue Sep 18 02:29:35 2007
@@ -16,28 +16,21 @@
#include "access.h"
-typedef struct _SOUNDDATA
-{
- SOUNDSENTRY ssSoundSentry;
- BOOL bShowSounds;
-} SOUNDDATA, *PSOUNDDATA;
-
-
static VOID
-OnInitDialog(HWND hwndDlg, PSOUNDDATA pSoundData)
+OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
{
TCHAR szBuffer[256];
UINT i;
- pSoundData->ssSoundSentry.cbSize = sizeof(SOUNDSENTRY);
+ pGlobalData->ssSoundSentry.cbSize = sizeof(SOUNDSENTRY);
SystemParametersInfo(SPI_GETSOUNDSENTRY,
sizeof(SOUNDSENTRY),
- &pSoundData->ssSoundSentry,
+ &pGlobalData->ssSoundSentry,
0);
SystemParametersInfo(SPI_GETSHOWSOUNDS,
0,
- &pSoundData->bShowSounds,
+ &pGlobalData->bShowSounds,
0);
/* Add strings to the combo-box */
@@ -48,10 +41,10 @@
}
/* Select a combo-box item */
- SendDlgItemMessage(hwndDlg, IDC_SENTRY_COMBO, CB_SETCURSEL,
pSoundData->ssSoundSentry.iWindowsEffect, 0);
+ SendDlgItemMessage(hwndDlg, IDC_SENTRY_COMBO, CB_SETCURSEL,
pGlobalData->ssSoundSentry.iWindowsEffect, 0);
/* Initialize SoundSentry settings */
- if (!(pSoundData->ssSoundSentry.dwFlags & SSF_AVAILABLE))
+ if (!(pGlobalData->ssSoundSentry.dwFlags & SSF_AVAILABLE))
{
EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_BOX), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_TEXT), FALSE);
@@ -59,7 +52,7 @@
}
else
{
- if (pSoundData->ssSoundSentry.dwFlags & SSF_SOUNDSENTRYON)
+ if (pGlobalData->ssSoundSentry.dwFlags & SSF_SOUNDSENTRYON)
{
CheckDlgButton(hwndDlg, IDC_SENTRY_BOX, BST_CHECKED);
}
@@ -71,7 +64,7 @@
}
/* Initialize ShowSounds settings */
- if (pSoundData->bShowSounds)
+ if (pGlobalData->bShowSounds)
CheckDlgButton(hwndDlg, IDC_SSHOW_BOX, BST_CHECKED);
}
@@ -83,40 +76,41 @@
WPARAM wParam,
LPARAM lParam)
{
- PSOUNDDATA pSoundData;
+ PGLOBAL_DATA pGlobalData;
- pSoundData = (PSOUNDDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
+ pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
switch (uMsg)
{
case WM_INITDIALOG:
- pSoundData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(SOUNDDATA));
- SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSoundData);
+ pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
- OnInitDialog(hwndDlg, pSoundData);
+ SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
+
+ OnInitDialog(hwndDlg, pGlobalData);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_SENTRY_BOX:
- pSoundData->ssSoundSentry.dwFlags ^= SSF_SOUNDSENTRYON;
- EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_TEXT),
(pSoundData->ssSoundSentry.dwFlags & SSF_SOUNDSENTRYON)?TRUE:FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_COMBO),
(pSoundData->ssSoundSentry.dwFlags & SSF_SOUNDSENTRYON)?TRUE:FALSE);
+ pGlobalData->ssSoundSentry.dwFlags ^= SSF_SOUNDSENTRYON;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_TEXT),
(pGlobalData->ssSoundSentry.dwFlags & SSF_SOUNDSENTRYON)?TRUE:FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_COMBO),
(pGlobalData->ssSoundSentry.dwFlags & SSF_SOUNDSENTRYON)?TRUE:FALSE);
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
case IDC_SENTRY_COMBO:
if (HIWORD(wParam) == CBN_SELENDOK)
{
- pSoundData->ssSoundSentry.iWindowsEffect =
+ pGlobalData->ssSoundSentry.iWindowsEffect =
(DWORD)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0);
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
case IDC_SSHOW_BOX:
- pSoundData->bShowSounds = !pSoundData->bShowSounds;
+ pGlobalData->bShowSounds = !pGlobalData->bShowSounds;
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
@@ -131,10 +125,10 @@
case PSN_APPLY:
SystemParametersInfo(SPI_SETSOUNDSENTRY,
sizeof(SOUNDSENTRY),
- &pSoundData->ssSoundSentry,
+ &pGlobalData->ssSoundSentry,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETSHOWSOUNDS,
- pSoundData->bShowSounds,
+ pGlobalData->bShowSounds,
0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
return TRUE;
@@ -143,10 +137,6 @@
break;
}
break;
-
- case WM_DESTROY:
- HeapFree(GetProcessHeap(), 0, pSoundData);
- break;
}
return FALSE;