Author: ekohl
Date: Mon Nov 20 00:06:30 2006
New Revision: 24789
URL:
http://svn.reactos.org/svn/reactos?rev=24789&view=rev
Log:
- Remove some global variables.
- Clean up the source code.
- Display the names of the screen savers.
- Sort the screen saver list by the screen saver names.
- Disable setting controls when 'None' screen saver is selected.
Modified:
trunk/reactos/dll/cpl/desk/Fr.rc
trunk/reactos/dll/cpl/desk/It.rc
trunk/reactos/dll/cpl/desk/Ja.rc
trunk/reactos/dll/cpl/desk/Ru.rc
trunk/reactos/dll/cpl/desk/Uk.rc
trunk/reactos/dll/cpl/desk/cz.rc
trunk/reactos/dll/cpl/desk/de.rc
trunk/reactos/dll/cpl/desk/en.rc
trunk/reactos/dll/cpl/desk/es.rc
trunk/reactos/dll/cpl/desk/gr.rc
trunk/reactos/dll/cpl/desk/hu.rc
trunk/reactos/dll/cpl/desk/nl.rc
trunk/reactos/dll/cpl/desk/pl.rc
trunk/reactos/dll/cpl/desk/screensaver.c
trunk/reactos/dll/cpl/desk/sv.rc
Modified: trunk/reactos/dll/cpl/desk/Fr.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/Fr.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/Fr.rc (original)
+++ trunk/reactos/dll/cpl/desk/Fr.rc Mon Nov 20 00:06:30 2006
@@ -31,7 +31,7 @@
LTEXT "Liste des écrans de veille:",IDC_STATIC,13, 24, 150, 9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "Paramè&tres...",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "&Aperçu",IDC_SCREENS_TESTSC,188, 52, 50, 15
Modified: trunk/reactos/dll/cpl/desk/It.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/It.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/It.rc (original)
+++ trunk/reactos/dll/cpl/desk/It.rc Mon Nov 20 00:06:30 2006
@@ -23,9 +23,9 @@
GROUPBOX "&Screen saver",IDC_SCREENS_DUMMY, 5, 7, 238, 136
LTEXT "Screen saver installati:",IDC_STATIC,13, 24, 150, 9
- CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
+ CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "&Impostazioni",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "&Prova",IDC_SCREENS_TESTSC,188, 52, 50, 15
Modified: trunk/reactos/dll/cpl/desk/Ja.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/Ja.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/Ja.rc (original)
+++ trunk/reactos/dll/cpl/desk/Ja.rc Mon Nov 20 00:06:30 2006
@@ -29,7 +29,7 @@
LTEXT "XN[ Z[o[Ìê:",IDC_STATIC,13, 24, 150, 9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "Ýè(&T)...",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "vr
[(&V)",IDC_SCREENS_TESTSC,188, 52, 50, 15
Modified: trunk/reactos/dll/cpl/desk/Ru.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/Ru.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/Ru.rc (original)
+++ trunk/reactos/dll/cpl/desk/Ru.rc Mon Nov 20 00:06:30 2006
@@ -28,7 +28,7 @@
LTEXT "Ñïèñîê çàñòàâîê:",IDC_STATIC,13,24,150,9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER |
- WS_BORDER | WS_TABSTOP,13,34,170,69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13,34,170,69
PUSHBUTTON "&Íàñòðîéêà...",IDC_SCREENS_SETTINGS,188,34,50,15,
WS_GROUP
PUSHBUTTON "Ïðî&ñìîòð",IDC_SCREENS_TESTSC,188,52,50,15
Modified: trunk/reactos/dll/cpl/desk/Uk.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/Uk.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/Uk.rc (original)
+++ trunk/reactos/dll/cpl/desk/Uk.rc Mon Nov 20 00:06:30 2006
@@ -33,7 +33,7 @@
LTEXT "Ñïèñîê çáåð³ãà÷³â åêðàíà:",IDC_STATIC,13, 24, 150, 9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "&Íàñòðîéêè",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "Ïåðå&ãëÿä",IDC_SCREENS_TESTSC,188, 52, 50, 15
Modified: trunk/reactos/dll/cpl/desk/cz.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/cz.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/cz.rc (original)
+++ trunk/reactos/dll/cpl/desk/cz.rc Mon Nov 20 00:06:30 2006
@@ -29,7 +29,7 @@
LTEXT "Seznam spoøièù:",IDC_STATIC,13, 24, 150, 9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "&Nastavení...",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "&Ukázka",IDC_SCREENS_TESTSC,188, 52, 50, 15
Modified: trunk/reactos/dll/cpl/desk/de.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/de.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/de.rc (original)
+++ trunk/reactos/dll/cpl/desk/de.rc Mon Nov 20 00:06:30 2006
@@ -21,11 +21,11 @@
FONT 8, "MS Shell Dlg"
BEGIN
GROUPBOX "&Bildschrimschoner",IDC_SCREENS_DUMMY, 5, 7, 238, 136
-
+
LTEXT "Installierte Bildschrimschoner:",IDC_STATIC,13, 24, 150,
9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "&Einstellungen",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "&Vorschau",IDC_SCREENS_TESTSC,188, 52, 50, 15
Modified: trunk/reactos/dll/cpl/desk/en.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/en.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/en.rc (original)
+++ trunk/reactos/dll/cpl/desk/en.rc Mon Nov 20 00:06:30 2006
@@ -21,11 +21,11 @@
FONT 8, "MS Shell Dlg"
BEGIN
GROUPBOX "&Screensaver",IDC_SCREENS_DUMMY, 5, 7, 238, 136
-
+
LTEXT "Installed screensavers:",IDC_STATIC,13, 24, 150, 9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "Se&ttings",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "Pre&view",IDC_SCREENS_TESTSC,188, 52, 50, 15
Modified: trunk/reactos/dll/cpl/desk/es.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/es.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/es.rc (original)
+++ trunk/reactos/dll/cpl/desk/es.rc Mon Nov 20 00:06:30 2006
@@ -36,7 +36,7 @@
LTEXT "Lista de protectores de pantalla:",IDC_STATIC,13, 24, 150,
9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "Configuración...",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "&Vista previa",IDC_SCREENS_TESTSC,188, 52, 50, 15
Modified: trunk/reactos/dll/cpl/desk/gr.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/gr.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/gr.rc (original)
+++ trunk/reactos/dll/cpl/desk/gr.rc Mon Nov 20 00:06:30 2006
@@ -29,7 +29,7 @@
LTEXT "Ëßóôá ðñïöõëÜîåùí ïèüíçò:",IDC_STATIC,13, 24, 150, 9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "Åðéëï&ãÝò...",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "Ðñï&âïëÞ",IDC_SCREENS_TESTSC,188, 52, 50, 15
Modified: trunk/reactos/dll/cpl/desk/hu.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/hu.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/hu.rc (original)
+++ trunk/reactos/dll/cpl/desk/hu.rc Mon Nov 20 00:06:30 2006
@@ -23,8 +23,9 @@
GROUPBOX "&Képernyõvédõ",IDC_SCREENS_DUMMY, 5, 7, 238, 136
LTEXT "Képernyõvédõk listája:",IDC_STATIC,13, 24, 150, 9
- CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
| LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
+ LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "&Beállítások...",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "E&lõzetes nézet",IDC_SCREENS_TESTSC,188, 52, 50, 15
@@ -33,7 +34,7 @@
LTEXT "&Várakozási idõ:",IDC_STATIC,13, 110, 20, 9
EDITTEXT IDC_SCREENS_TIMEDELAY,33, 109, 31, 12,ES_RIGHT | WS_GROUP
- CONTROL "",IDC_SCREENS_TIME ,UPDOWN_CLASS,UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP,52, 109, 12, 12
+ CONTROL "",IDC_SCREENS_TIME ,UPDOWN_CLASS,UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP,52, 109, 12, 12
LTEXT "A képernyõvédõ elindítása ennyi perc
múlva.",IDC_STATIC,70, 111, 147, 9
GROUPBOX "A képernyõ energiaellátási
lehetõségei",IDC_SCREENS_DUMMY2,5, 146, 238, 50
Modified: trunk/reactos/dll/cpl/desk/nl.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/nl.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/nl.rc (original)
+++ trunk/reactos/dll/cpl/desk/nl.rc Mon Nov 20 00:06:30 2006
@@ -29,7 +29,7 @@
LTEXT "Lijst van de schermbeveiligingen:",IDC_STATIC,13, 24, 150,
9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "&Instellingen...",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "V&oorbeeld",IDC_SCREENS_TESTSC,188, 52, 50, 15
Modified: trunk/reactos/dll/cpl/desk/pl.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/pl.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/pl.rc (original)
+++ trunk/reactos/dll/cpl/desk/pl.rc Mon Nov 20 00:06:30 2006
@@ -30,7 +30,7 @@
LTEXT "Lista wygaszaczy ekranu:",IDC_STATIC,13, 24, 150, 9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "&Ustawienia...",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "&Podgl¹d",IDC_SCREENS_TESTSC,188, 52, 50, 15
Modified: trunk/reactos/dll/cpl/desk/screensaver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/screensaver.c…
==============================================================================
--- trunk/reactos/dll/cpl/desk/screensaver.c (original)
+++ trunk/reactos/dll/cpl/desk/screensaver.c Mon Nov 20 00:06:30 2006
@@ -9,65 +9,51 @@
*/
#include "desk.h"
-void SetScreenSaver();
+
#define MAX_SCREENSAVERS 100
-void AddListViewItems2();
-void CheckRegScreenSaverIsSecure();
-
-typedef struct {
+static VOID SetScreenSaver(VOID);
+static VOID AddListViewItems(HWND);
+static VOID CheckRegScreenSaverIsSecure(HWND);
+
+typedef struct
+{
BOOL bIsScreenSaver; /* Is this background a wallpaper */
TCHAR szFilename[MAX_PATH];
TCHAR szDisplayName[256];
} ScreenSaverItem;
-int ImageListSelection = 0;
+int ImageListSelection = -1;
ScreenSaverItem g_ScreenSaverItems[MAX_SCREENSAVERS];
-HWND g_hScreenBackgroundPage = NULL;
-HWND g_hScreengroundList = NULL;
-HWND ControlScreenSaverIsSecure = NULL;
HMENU g_hPopupMenu = NULL;
-void ListViewItemAreChanged(int itemIndex)
-{
- ScreenSaverItem *ScreenSaverItem = NULL;
-
- ImageListSelection = itemIndex;
- ScreenSaverItem = &g_ScreenSaverItems[ImageListSelection];
-
- PropSheet_Changed(GetParent(g_hScreenBackgroundPage), g_hScreenBackgroundPage);
-}
-
-void
-ScreensaverConfig ()
-{
- /*
- /p:<hwnd> Run in preview
- /s Run normal
- /c:<hwnd> Run configuration, hwnd is handle of calling window
- /a Run change password
-
- */
-
- WCHAR szCmdline[2048];
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
- swprintf(szCmdline, L"%s
/c",g_ScreenSaverItems[ImageListSelection].szFilename);
-
- ZeroMemory( &si, sizeof(si) );
- si.cb = sizeof(si);
- ZeroMemory( &pi, sizeof(pi) );
- if(CreateProcess( NULL, szCmdline, NULL, NULL, FALSE, 0, NULL,NULL,&si, &pi
))
- {
- CloseHandle( pi.hProcess );
- CloseHandle( pi.hThread );
- }
-}
-
-void
-ScreensaverPreview ()
+VOID ListViewItemAreChanged(HWND hwndDlg, int itemIndex)
+{
+ BOOL bEnable;
+ LV_ITEM lvItem;
+
+ lvItem.mask = LVIF_PARAM;
+ lvItem.iItem = itemIndex;
+ lvItem.iSubItem = 0;
+
+ if (!ListView_GetItem(GetDlgItem(hwndDlg, IDC_SCREENS_CHOICES), &lvItem))
+ return;
+
+ ImageListSelection = lvItem.lParam;
+
+ bEnable = (lvItem.lParam != 0);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SCREENS_SETTINGS), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SCREENS_TESTSC), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SCREENS_USEPASSCHK), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SCREENS_TIMEDELAY), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SCREENS_TIME), bEnable);
+}
+
+VOID
+ScreensaverConfig(HWND hwndDlg)
{
/*
/p:<hwnd> Run in preview
@@ -76,20 +62,71 @@
/a Run change password
*/
- WCHAR szCmdline[2048];
+ WCHAR szCmdline[2048];
STARTUPINFO si;
- PROCESS_INFORMATION pi;
- swprintf(szCmdline, L"%s
/p",g_ScreenSaverItems[ImageListSelection].szFilename);
+ PROCESS_INFORMATION pi;
+
+ if (ImageListSelection < 1)
+ return;
+
+ swprintf(szCmdline, L"%s /c:%u",
+ g_ScreenSaverItems[ImageListSelection].szFilename,
+ hwndDlg);
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
- ZeroMemory( &pi, sizeof(pi) );
- if(CreateProcess( NULL, szCmdline, NULL, NULL, FALSE, 0, NULL,NULL,&si, &pi
))
- {
- CloseHandle( pi.hProcess );
- CloseHandle( pi.hThread );
- }
- }
+ ZeroMemory( &pi, sizeof(pi) );
+ if(CreateProcess( NULL, szCmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si,
&pi ))
+ {
+ CloseHandle( pi.hProcess );
+ CloseHandle( pi.hThread );
+ }
+}
+
+VOID
+ScreensaverPreview(HWND hwndDlg)
+{
+ /*
+ /p:<hwnd> Run in preview
+ /s Run normal
+ /c:<hwnd> Run configuration, hwnd is handle of calling window
+ /a Run change password
+ */
+
+ WCHAR szCmdline[2048];
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+
+ if (ImageListSelection < 1)
+ return;
+
+ swprintf(szCmdline, L"%s /p",
g_ScreenSaverItems[ImageListSelection].szFilename);
+
+ ZeroMemory( &si, sizeof(si) );
+ si.cb = sizeof(si);
+ ZeroMemory( &pi, sizeof(pi) );
+ if(CreateProcess( NULL, szCmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi
))
+ {
+ CloseHandle( pi.hProcess );
+ CloseHandle( pi.hThread );
+ }
+}
+
+VOID
+ScreensaverDelete(HWND hwndDlg)
+{
+ SHFILEOPSTRUCT fos;
+
+ if (ImageListSelection < 1) // Can NOT delete anything :-)
+ return;
+
+ fos.hwnd = hwndDlg;
+ fos.wFunc = FO_DELETE;
+ fos.fFlags = 0;
+ fos.pFrom = g_ScreenSaverItems[ImageListSelection].szFilename;
+
+ SHFileOperationW(&fos);
+}
INT_PTR
CALLBACK
@@ -98,9 +135,8 @@
WPARAM wParam,
LPARAM lParam)
{
- g_hScreenBackgroundPage = hwndDlg;
-
- switch(uMsg) {
+ switch (uMsg)
+ {
case WM_DESTROY:
{
DestroyMenu(g_hPopupMenu);
@@ -108,62 +144,52 @@
}
case WM_INITDIALOG:
{
- g_hScreengroundList = GetDlgItem(g_hScreenBackgroundPage,
IDC_SCREENS_CHOICES);
- SendMessage(GetDlgItem(g_hScreenBackgroundPage, IDC_SCREENS_TIME),
UDM_SETRANGE, 0, MAKELONG ((short) 240, (short) 0));
- AddListViewItems2();
+ SendDlgItemMessage(hwndDlg, IDC_SCREENS_TIME, UDM_SETRANGE, 0, MAKELONG
((short) 240, (short) 0));
+ AddListViewItems(hwndDlg);
g_hPopupMenu = LoadMenu(hApplet, MAKEINTRESOURCE(IDR_POPUP_MENU));
g_hPopupMenu = GetSubMenu(g_hPopupMenu, 0);
- CheckRegScreenSaverIsSecure();
+ CheckRegScreenSaverIsSecure(hwndDlg);
} break;
case WM_COMMAND:
{
DWORD controlId = LOWORD(wParam);
DWORD command = HIWORD(wParam);
-
+
switch(controlId) {
case IDC_SCREENS_POWER_BUTTON: // Start Powercfg.Cpl
{
- if(command == BN_CLICKED)
+ if (command == BN_CLICKED)
WinExec("rundll32 shell32.dll,Control_RunDLL
powercfg.cpl,,",SW_SHOWNORMAL);
} break;
case IDC_SCREENS_TESTSC: // Screensaver Preview
{
if(command == BN_CLICKED)
- ScreensaverPreview();
+ ScreensaverPreview(hwndDlg);
break;
}
case ID_MENU_PREVIEW:
{
- ScreensaverPreview();
+ ScreensaverPreview(hwndDlg);
break;
}
case ID_MENU_CONFIG:
{
- ScreensaverConfig();
+ ScreensaverConfig(hwndDlg);
break;
}
case ID_MENU_DELETE: // Delete Screensaver
{
- LPSHFILEOPSTRUCT fos = NULL;
-
if(command == BN_CLICKED) {
- if (ImageListSelection == 0) // Can NOT delete anything :-)
- return FALSE;
-
- fos->hwnd = hwndDlg;
- fos->wFunc = FO_DELETE;
- fos->fFlags = 0;
- fos->pFrom =
g_ScreenSaverItems[ImageListSelection].szFilename;
- SHFileOperationW(fos);
+ ScreensaverDelete(hwndDlg);
}
- } break;
+ } break;
case IDC_SCREENS_SETTINGS: // Screensaver Settings
{
if(command == BN_CLICKED)
- ScreensaverConfig();
+ ScreensaverConfig(hwndDlg);
break;
}
case IDC_SCREENS_USEPASSCHK: // Screensaver Is Secure
@@ -173,7 +199,7 @@
} break;
case IDC_SCREENS_TIME: // Delay before show screensaver
{
- } break;
+ }
default:
break;
} break;
@@ -184,15 +210,16 @@
LPNMITEMACTIVATE nmia = (LPNMITEMACTIVATE) lParam;
RECT rc;
- switch(lpnm->code) {
+ switch(lpnm->code)
+ {
case PSN_APPLY:
{
- SetScreenSaver();
+ SetScreenSaver();
return TRUE;
} break;
case NM_RCLICK:
{
- GetWindowRect(g_hScreengroundList, &rc);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_SCREENS_CHOICES), &rc);
TrackPopupMenuEx(g_hPopupMenu, TPM_RIGHTBUTTON,
rc.left + nmia->ptAction.x, rc.top +
nmia->ptAction.y, hwndDlg, NULL);
break;
@@ -200,45 +227,48 @@
case LVN_ITEMCHANGED:
{
LPNMLISTVIEW nm = (LPNMLISTVIEW)lParam;
- if((nm->uNewState & LVIS_SELECTED) == 0)
+ if ((nm->uNewState & LVIS_SELECTED) == 0)
return FALSE;
- ListViewItemAreChanged(nm->iItem);
+ ListViewItemAreChanged(hwndDlg, nm->iItem);
break;
- } break;
+ }
default:
break;
}
} break;
}
-
+
return FALSE;
}
-void CheckRegScreenSaverIsSecure()
+VOID CheckRegScreenSaverIsSecure(HWND hwndDlg)
{
HKEY hKey;
TCHAR szBuffer[2];
DWORD bufferSize = sizeof(szBuffer);
DWORD varType = REG_SZ;
LONG result;
-
- ControlScreenSaverIsSecure = GetDlgItem(g_hScreenBackgroundPage,
IDC_SCREENS_USEPASSCHK);
RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0,
KEY_ALL_ACCESS, &hKey);
result = RegQueryValueEx(hKey, TEXT("ScreenSaverIsSecure"), 0,
&varType, (LPBYTE)szBuffer, &bufferSize);
- if(result == ERROR_SUCCESS)
- if(_ttoi(szBuffer) == 1) {
- SendMessage(ControlScreenSaverIsSecure, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
- goto End;
+ RegCloseKey(hKey);
+
+ if (result == ERROR_SUCCESS)
+ {
+ if(_ttoi(szBuffer) == 1)
+ {
+ SendDlgItemMessage(hwndDlg, IDC_SCREENS_USEPASSCHK, BM_SETCHECK,
(WPARAM)BST_CHECKED, 0);
+ return;
}
- SendMessage(ControlScreenSaverIsSecure, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
-End:
- RegCloseKey(hKey);
-}
-
-/* Add the bitmaps in the C:\ReactOS directory and the current wallpaper if any */
-void AddListViewItems2()
-{
+ }
+
+ SendDlgItemMessage(hwndDlg, IDC_SCREENS_USEPASSCHK, BM_SETCHECK,
(WPARAM)BST_UNCHECKED, 0);
+}
+
+
+VOID AddListViewItems(HWND hwndDlg)
+{
+ HWND hwndScreenSaverList = GetDlgItem(hwndDlg, IDC_SCREENS_CHOICES);
WIN32_FIND_DATA fd;
HANDLE hFind;
TCHAR szSearchPath[MAX_PATH];
@@ -248,53 +278,54 @@
//HKEY regKey;
SHFILEINFO sfi;
HIMAGELIST himl;
- HIMAGELIST g_hScreenShellImageList = NULL;
+ HIMAGELIST hScreenShellImageList = NULL;
//TCHAR wallpaperFilename[MAX_PATH];
//DWORD bufferSize = sizeof(wallpaperFilename);
//DWORD varType = REG_SZ;
//LONG result;
UINT i = 0;
- int g_ScreenlistViewItemCount = 0;
+ int ScreenlistViewItemCount = 0;
ScreenSaverItem *ScreenSaverItem = NULL;
-
- GetClientRect(g_hScreengroundList, &clientRect);
-
+ HANDLE hModule = NULL;
+
+ GetClientRect(hwndScreenSaverList, &clientRect);
+
ZeroMemory(&dummy, sizeof(LV_COLUMN));
dummy.mask = LVCF_SUBITEM | LVCF_WIDTH;
dummy.iSubItem = 0;
dummy.cx = (clientRect.right - clientRect.left) -
GetSystemMetrics(SM_CXVSCROLL);
-
- (void)ListView_InsertColumn(g_hScreengroundList, 0, &dummy);
+
+ (void)ListView_InsertColumn(hwndScreenSaverList, 0, &dummy);
/* Add the "None" item */
- ScreenSaverItem = &g_ScreenSaverItems[g_ScreenlistViewItemCount];
-
+ ScreenSaverItem = &g_ScreenSaverItems[ScreenlistViewItemCount];
+
ScreenSaverItem->bIsScreenSaver = FALSE;
LoadString(hApplet,
IDS_NONE,
ScreenSaverItem->szDisplayName,
sizeof(ScreenSaverItem->szDisplayName) / sizeof(TCHAR));
-
+
ZeroMemory(&listItem, sizeof(LV_ITEM));
listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
listItem.state = LVIS_SELECTED;
listItem.pszText = ScreenSaverItem->szDisplayName;
listItem.iImage = -1;
- listItem.iItem = g_ScreenlistViewItemCount;
- listItem.lParam = g_ScreenlistViewItemCount;
-
- (void)ListView_InsertItem(g_hScreengroundList, &listItem);
- ListView_SetItemState(g_hScreengroundList, g_ScreenlistViewItemCount, LVIS_SELECTED,
LVIS_SELECTED);
-
- g_ScreenlistViewItemCount++;
+ listItem.iItem = ScreenlistViewItemCount;
+ listItem.lParam = ScreenlistViewItemCount;
+
+ (void)ListView_InsertItem(hwndScreenSaverList, &listItem);
+ ListView_SetItemState(hwndScreenSaverList, ScreenlistViewItemCount, LVIS_SELECTED,
LVIS_SELECTED);
+
+ ScreenlistViewItemCount++;
/* Add current screensaver if any */
- /*
+/*
RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0,
KEY_ALL_ACCESS, ®Key);
-
+
result = RegQueryValueEx(regKey, TEXT("SCRNSAVE.EXE"), 0, &varType,
(LPBYTE)wallpaperFilename, &bufferSize);
-
+
if((result == ERROR_SUCCESS) && (_tcslen(wallpaperFilename) > 0))
{
himl = (HIMAGELIST)SHGetFileInfo(wallpaperFilename,
@@ -332,31 +363,31 @@
g_ScreenlistViewItemCount++;
}
- }
-
-
-
+ }
+
+
+
RegCloseKey(regKey);
- */
+*/
/* Add all the screensavers in the C:\ReactOS\System32 directory. */
GetSystemDirectory(szSearchPath, MAX_PATH);
_tcscat(szSearchPath, TEXT("\\*.scr"));
-
+
hFind = FindFirstFile(szSearchPath, &fd);
- while(hFind != INVALID_HANDLE_VALUE)
+ while (hFind != INVALID_HANDLE_VALUE)
{
/* Don't add any hidden screensavers */
- if((fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) == 0)
+ if ((fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) == 0)
{
TCHAR filename[MAX_PATH];
-
+
GetSystemDirectory(filename, MAX_PATH);
_tcscat(filename, TEXT("\\"));
_tcscat(filename, fd.cFileName);
-
+
himl = (HIMAGELIST)SHGetFileInfo(filename,
0,
&sfi,
@@ -364,22 +395,36 @@
SHGFI_SYSICONINDEX | SHGFI_SMALLICON |
SHGFI_DISPLAYNAME);
- if(himl == NULL)
+ if (himl == NULL)
{
break;
}
-
- if(i++ == 0)
+
+ if (i++ == 0)
{
- g_hScreenShellImageList = himl;
- (void)ListView_SetImageList(g_hScreengroundList, himl, LVSIL_SMALL);
+ hScreenShellImageList = himl;
+ (VOID)ListView_SetImageList(hwndScreenSaverList, himl, LVSIL_SMALL);
}
- ScreenSaverItem = &g_ScreenSaverItems[g_ScreenlistViewItemCount];
+ ScreenSaverItem = &g_ScreenSaverItems[ScreenlistViewItemCount];
ScreenSaverItem->bIsScreenSaver = TRUE;
-
- _tcscpy(ScreenSaverItem->szDisplayName, sfi.szDisplayName);
+
+ hModule = LoadLibraryEx(filename, NULL, DONT_RESOLVE_DLL_REFERENCES);
+ if (hModule)
+ {
+ LoadString(hModule,
+ 1,
+ ScreenSaverItem->szDisplayName,
+ sizeof(ScreenSaverItem->szDisplayName) / sizeof(TCHAR));
+ FreeLibrary(hModule);
+ }
+ else
+ {
+ _tcscpy(ScreenSaverItem->szDisplayName, sfi.szDisplayName);
+ }
+
+
_tcscpy(ScreenSaverItem->szFilename, filename);
ZeroMemory(&listItem, sizeof(LV_ITEM));
@@ -387,30 +432,30 @@
listItem.pszText = ScreenSaverItem->szDisplayName;
listItem.state = 0;
listItem.iImage = sfi.iIcon;
- listItem.iItem = g_ScreenlistViewItemCount;
- listItem.lParam = g_ScreenlistViewItemCount;
-
- (void)ListView_InsertItem(g_hScreengroundList, &listItem);
-
- g_ScreenlistViewItemCount++;
+ listItem.iItem = ScreenlistViewItemCount;
+ listItem.lParam = ScreenlistViewItemCount;
+
+ (VOID)ListView_InsertItem(hwndScreenSaverList, &listItem);
+
+ ScreenlistViewItemCount++;
}
-
- if(!FindNextFile(hFind, &fd))
+
+ if (!FindNextFile(hFind, &fd))
hFind = INVALID_HANDLE_VALUE;
}
}
-void SetScreenSaver()
+VOID SetScreenSaver(VOID)
{
HKEY regKey;
-
+
RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0,
KEY_ALL_ACCESS, ®Key);
RegSetValueEx(regKey, TEXT("SCRNSAVE.EXE"), 0, REG_SZ, (BYTE
*)g_ScreenSaverItems[ImageListSelection].szFilename,
_tcslen(g_ScreenSaverItems[ImageListSelection].szFilename)*sizeof(TCHAR));
- // RegSetValueEx(regKey, TEXT("SCRNSAVE.EXE"), 0, REG_SZ,
g_ScreenSaverItems[ImageListSelection].szFilename, sizeof(TCHAR) * 2);
-
-
- RegCloseKey(regKey);
-
+ // RegSetValueEx(regKey, TEXT("SCRNSAVE.EXE"), 0, REG_SZ,
g_ScreenSaverItems[ImageListSelection].szFilename, sizeof(TCHAR) * 2);
+
+
+ RegCloseKey(regKey);
+
//if(g_backgroundItems[g_backgroundSelection].bWallpaper == TRUE)
//{
// SystemParametersInfo(SPI_SETDESKWALLPAPER,
@@ -419,8 +464,7 @@
// SPIF_UPDATEINIFILE);
//}
//else
- //{
+ //{
// SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, TEXT(""),
SPIF_UPDATEINIFILE);
//}
}
-
Modified: trunk/reactos/dll/cpl/desk/sv.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/sv.rc?rev=247…
==============================================================================
--- trunk/reactos/dll/cpl/desk/sv.rc (original)
+++ trunk/reactos/dll/cpl/desk/sv.rc Mon Nov 20 00:06:30 2006
@@ -32,7 +32,7 @@
LTEXT "Skärmsläckare:",IDC_STATIC,13, 24, 150, 9
CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT
|
LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS |
- WS_BORDER | WS_TABSTOP,13, 34, 170, 69
+ LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,13, 34, 170, 69
PUSHBUTTON "&Inställningar",IDC_SCREENS_SETTINGS,188, 34, 50,
15,WS_GROUP
PUSHBUTTON "&Förhandsvisa",IDC_SCREENS_TESTSC,188, 52, 50, 15