Author: cwittich
Date: Fri Apr 28 19:34:58 2006
New Revision: 21751
URL:
http://svn.reactos.ru/svn/reactos?rev=21751&view=rev
Log:
added a PopupMenu with Add and Delete functions in screensaver.c
Modified:
trunk/reactos/dll/cpl/desk/de.rc
trunk/reactos/dll/cpl/desk/en.rc
trunk/reactos/dll/cpl/desk/resource.h
trunk/reactos/dll/cpl/desk/screensaver.c
Modified: trunk/reactos/dll/cpl/desk/de.rc
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/desk/de.rc?rev=2175…
==============================================================================
--- trunk/reactos/dll/cpl/desk/de.rc (original)
+++ trunk/reactos/dll/cpl/desk/de.rc Fri Apr 28 19:34:58 2006
@@ -55,6 +55,18 @@
90,112,8
END
+IDR_POPUP_MENU MENU DISCARDABLE
+BEGIN
+ POPUP ""
+ BEGIN
+ MENUITEM "&Konfigurieren", ID_MENU_CONFIG
+ MENUITEM "&Vorschau", ID_MENU_PREVIEW
+ MENUITEM SEPARATOR
+ MENUITEM "&Hinzufügen", ID_MENU_ADD
+ MENUITEM "&Löschen\tDel", ID_MENU_DELETE
+ END
+END
+
IDD_SETTINGS DIALOGEX DISCARDABLE 0, 0, 246, 188
STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Einstellungen"
Modified: trunk/reactos/dll/cpl/desk/en.rc
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/desk/en.rc?rev=2175…
==============================================================================
--- trunk/reactos/dll/cpl/desk/en.rc (original)
+++ trunk/reactos/dll/cpl/desk/en.rc Fri Apr 28 19:34:58 2006
@@ -76,6 +76,18 @@
PUSHBUTTON "Ad&vanced...",IDC_SETTINGS_ADVANCED,306,165,56,14
END
+IDR_POPUP_MENU MENU DISCARDABLE
+BEGIN
+ POPUP ""
+ BEGIN
+ MENUITEM "&Configure", ID_MENU_CONFIG
+ MENUITEM "&Preview", ID_MENU_PREVIEW
+ MENUITEM SEPARATOR
+ MENUITEM "&Add", ID_MENU_ADD
+ MENUITEM "&Delete\tDel", ID_MENU_DELETE
+ END
+END
+
STRINGTABLE
BEGIN
IDS_CPLNAME "Display"
Modified: trunk/reactos/dll/cpl/desk/resource.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/desk/resource.h?rev…
==============================================================================
--- trunk/reactos/dll/cpl/desk/resource.h (original)
+++ trunk/reactos/dll/cpl/desk/resource.h Fri Apr 28 19:34:58 2006
@@ -62,6 +62,13 @@
#define IDC_SETTINGS_RESOLUTION_TEXT 204
#define IDC_SETTINGS_ADVANCED 205
+#define IDR_POPUP_MENU 2010
+#define ID_MENU_CONFIG 2011
+#define ID_MENU_PREVIEW 2012
+#define ID_MENU_ADD 2013
+#define ID_MENU_DELETE 2014
+
+
/* Settings Page */
#define IDS_PIXEL 2301
Modified: trunk/reactos/dll/cpl/desk/screensaver.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/desk/screensaver.c?…
==============================================================================
--- trunk/reactos/dll/cpl/desk/screensaver.c (original)
+++ trunk/reactos/dll/cpl/desk/screensaver.c Fri Apr 28 19:34:58 2006
@@ -27,6 +27,7 @@
HWND g_hScreenBackgroundPage = NULL;
HWND g_hScreengroundList = NULL;
HWND ControlScreenSaverIsSecure = NULL;
+HMENU g_hPopupMenu = NULL;
void ListViewItemAreChanged(int itemIndex)
{
@@ -37,6 +38,57 @@
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 ()
+{
+ /*
+ /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
/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 );
+ }
+ }
INT_PTR
CALLBACK
@@ -48,13 +100,23 @@
g_hScreenBackgroundPage = hwndDlg;
switch(uMsg) {
+ case WM_DESTROY:
+ {
+ DestroyMenu(g_hPopupMenu);
+ break;
+ }
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();
+
+ g_hPopupMenu = LoadMenu(hApplet, MAKEINTRESOURCE(IDR_POPUP_MENU));
+ g_hPopupMenu = GetSubMenu(g_hPopupMenu, 0);
+
CheckRegScreenSaverIsSecure();
} break;
+
case WM_COMMAND:
{
DWORD controlId = LOWORD(wParam);
@@ -69,65 +131,40 @@
case IDC_SCREENS_TESTSC: // Screensaver Preview
{
if(command == BN_CLICKED)
- {
- /*
- /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
/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 );
- }
+ ScreensaverPreview();
+ break;
+ }
+ case ID_MENU_PREVIEW:
+ {
+ ScreensaverPreview();
+ break;
+ }
+ case ID_MENU_CONFIG:
+ {
+ ScreensaverConfig();
+ break;
+ }
+ case ID_MENU_DELETE: // Delete Screensaver
+ {
+ LPSHFILEOPSTRUCT fos;
+
+ 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);
}
-
- } break;
- /* case IDC_SCREENS_DELETE: // Delete Screensaver
- {
- if(command == BN_CLICKED) {
- if (ImageListSelection == 0) // Can NOT delete None sry:-)
- return FALSE;
- DeleteFileW(g_ScreenSaverItems[ImageListSelection].szFilename);
- }
- } break; */
+ } break;
case IDC_SCREENS_SETTINGS: // Screensaver Settings
{
if(command == BN_CLICKED)
- {
- /*
- /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 );
- }
- }
- } break;
+ ScreensaverConfig();
+ break;
+ }
case IDC_SCREENS_USEPASSCHK: // Screensaver Is Secure
{
if(command == BN_CLICKED)
@@ -143,12 +180,21 @@
case WM_NOTIFY:
{
LPNMHDR lpnm = (LPNMHDR)lParam;
-
+ LPNMITEMACTIVATE nmia = (LPNMITEMACTIVATE) lParam;
+ RECT rc;
+
switch(lpnm->code) {
case PSN_APPLY:
{
return TRUE;
} break;
+ case NM_RCLICK:
+ {
+ GetWindowRect(g_hScreengroundList, &rc);
+ TrackPopupMenuEx(g_hPopupMenu, TPM_RIGHTBUTTON,
+ rc.left + nmia->ptAction.x, rc.top +
nmia->ptAction.y, hwndDlg, NULL);
+ break;
+ }
case LVN_ITEMCHANGED:
{
LPNMLISTVIEW nm = (LPNMLISTVIEW)lParam;