Modified: trunk/reactos/include/defines.h
Modified: trunk/reactos/lib/cpl/desk/Makefile
Added: trunk/reactos/lib/cpl/desk/appearance.c
Added: trunk/reactos/lib/cpl/desk/background.c
Modified: trunk/reactos/lib/cpl/desk/desk.c
Deleted: trunk/reactos/lib/cpl/desk/desk.dsp
Deleted: trunk/reactos/lib/cpl/desk/desk.dsw
Modified: trunk/reactos/lib/cpl/desk/desk.h
Modified: trunk/reactos/lib/cpl/desk/desk.rc
Added: trunk/reactos/lib/cpl/desk/dibitmap.c
Added: trunk/reactos/lib/cpl/desk/dibitmap.h
Added: trunk/reactos/lib/cpl/desk/en.rc
Modified: trunk/reactos/lib/cpl/desk/resource.h
Added: trunk/reactos/lib/cpl/desk/screensaver.c
Added: trunk/reactos/lib/cpl/desk/settings.c
--- trunk/reactos/include/defines.h 2005-02-04 16:51:11 UTC (rev 13405)
+++ trunk/reactos/include/defines.h 2005-02-04 20:39:10 UTC (rev 13406)
@@ -771,6 +771,7 @@
#define DS_SETFONT (0x40L)
#define DS_SETFOREGROUND (0x200L)
#define DS_SYSMODAL (0x2L)
+#define DS_SHELLFONT (DS_SETFONT | DS_FIXEDSYS)
/* CreateWindowEx */
#define WS_EX_ACCEPTFILES (0x10L)
--- trunk/reactos/lib/cpl/desk/Makefile 2005-02-04 16:51:11 UTC (rev 13405)
+++ trunk/reactos/lib/cpl/desk/Makefile 2005-02-04 20:39:10 UTC (rev 13406)
@@ -13,20 +13,20 @@
TARGET_BASE = $(TARGET_BASE_LIB_CPL_DESK)
TARGET_CFLAGS = \
- -I./include \
+ -I./include \
-D_WIN32_IE=0x0600 \
-D_WIN32_WINNT=0x0501 \
-D__USE_W32API \
-DUNICODE \
-D_UNICODE \
- -D__REACTOS__ \
+ -D__USE_W32API \
-Wall \
-Werror \
-fno-builtin
TARGET_LFLAGS = -nostartfiles
-TARGET_SDKLIBS = kernel32.a user32.a comctl32.a
+TARGET_SDKLIBS = kernel32.a user32.a comctl32.a comdlg32.a advapi32.a gdi32.a
TARGET_GCCLIBS = gcc
@@ -34,7 +34,12 @@
TARGET_CLEAN =
-TARGET_OBJECTS = desk.o
+TARGET_OBJECTS = desk.o \
+ background.o \
+ screensaver.o \
+ appearance.o \
+ settings.o \
+ dibitmap.o
DEP_OBJECTS = $(TARGET_OBJECTS)
--- trunk/reactos/lib/cpl/desk/appearance.c 2005-02-04 16:51:11 UTC (rev 13405)
+++ trunk/reactos/lib/cpl/desk/appearance.c 2005-02-04 20:39:10 UTC (rev 13406)
@@ -0,0 +1,34 @@
+/* $Id$
+ *
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Display Control Panel
+ * FILE: lib/cpl/desk/appearance.c
+ * PURPOSE: Appearance property page
+ *
+ * PROGRAMMERS: Trevor McCort (lycan359@gmail.com)
+ */
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "resource.h"
+
+INT_PTR CALLBACK AppearancePageProc(HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ } break;
+
+ case WM_COMMAND:
+ {
+ } break;
+ }
+
+ return FALSE;
+}
+
Property changes on: trunk/reactos/lib/cpl/desk/appearance.c
___________________________________________________________________
Name: svn:keywords
+ author date id revision
Name: svn:eol-style
+ native
--- trunk/reactos/lib/cpl/desk/background.c 2005-02-04 16:51:11 UTC (rev 13405)
+++ trunk/reactos/lib/cpl/desk/background.c 2005-02-04 20:39:10 UTC (rev 13406)
@@ -0,0 +1,597 @@
+/* $Id$
+ *
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Display Control Panel
+ * FILE: lib/cpl/desk/background.c
+ * PURPOSE: Background property page
+ *
+ * PROGRAMMERS: Trevor McCort (lycan359@gmail.com)
+ */
+
+#include <windows.h>
+#include <commctrl.h>
+#include <commdlg.h>
+#include <cpl.h>
+#include <tchar.h>
+
+#include "resource.h"
+
+#include "desk.h"
+#include "dibitmap.h"
+
+#define MAX_WALLPAPERS 100
+
+#define PLACEMENT_CENTER 0
+#define PLACEMENT_STRETCH 1
+#define PLACEMENT_TILE 2
+
+DIBitmap *g_pWallpaperBitmap = NULL;
+
+int g_placementSelection = 0;
+int g_wallpaperSelection = -1;
+
+int g_wallpaperCount = 0;
+int g_listViewItemCount = 0;
+
+int g_currentWallpaperItemId = 0;
+
+HWND g_hBackgroundTab = NULL;
+
+HWND g_hWallpaperList = NULL;
+HWND g_hWallpaperPreview = NULL;
+HIMAGELIST g_hShellImageList = NULL;
+
+HWND g_hPlacementCombo = NULL;
+
+TCHAR g_wallpapers[MAX_WALLPAPERS][MAX_PATH];
+
+/* Add the bitmaps in the C:\ReactOS directory and the current wallpaper if any */
+void AddListViewItems()
+{
+ WIN32_FIND_DATA fd;
+ HANDLE hFind;
+ TCHAR szBuffer[256];
+ TCHAR szSearchPath[MAX_PATH];
+ LV_ITEM listItem;
+ LV_COLUMN dummy;
+ RECT clientRect;
+ HKEY regKey;
+ SHFILEINFO sfi;
+ HIMAGELIST himl;
+ TCHAR wallpaperFilename[MAX_PATH];
+ DWORD bufferSize = sizeof(wallpaperFilename);
+ DWORD varType = REG_SZ;
+ LONG result;
+ UINT i = 0;
+
+ GetClientRect(g_hWallpaperList, &clientRect);
+
+ ZeroMemory(&dummy, sizeof(LV_COLUMN));
+ dummy.mask = LVCF_SUBITEM | LVCF_WIDTH;
+ dummy.iSubItem = 0;
+ dummy.cx = (clientRect.right - clientRect.left) - GetSystemMetrics(SM_CXVSCROLL);
+
+ ListView_InsertColumn(g_hWallpaperList, 0, &dummy);
+
+ /* Add the "None" item */
+
+ LoadString(hApplet, IDS_NONE, szBuffer, sizeof(szBuffer) / sizeof(TCHAR));
+
+ ZeroMemory(&listItem, sizeof(LV_ITEM));
+ listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
+ listItem.pszText = szBuffer;
+ listItem.iItem = g_listViewItemCount;
+ listItem.iImage = -1;
+ listItem.state = LVIS_SELECTED;
+ listItem.lParam = -1;
+
+ ListView_InsertItem(g_hWallpaperList, &listItem);
+ ListView_SetItemState(g_hWallpaperList, g_listViewItemCount, LVIS_SELECTED, LVIS_SELECTED);
+
+ g_listViewItemCount++;
+
+ /* Add current wallpaper if any */
+
+ RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_ALL_ACCESS, ®Key);
+
+ result = RegQueryValueEx(regKey, TEXT("Wallpaper"), 0, &varType, (LPBYTE)wallpaperFilename, &bufferSize);
+
+ if((result == ERROR_SUCCESS) && (_tcslen(wallpaperFilename) > 0))
+ {
+ himl = (HIMAGELIST)SHGetFileInfo(wallpaperFilename,
+ 0,
+ &sfi,
+ sizeof(sfi),
+ SHGFI_SYSICONINDEX | SHGFI_SMALLICON |
+ SHGFI_DISPLAYNAME);
+
+ if(himl != NULL)
+ {
+ if(i++ == 0)
+ {
+ g_hShellImageList = himl;
+ ListView_SetImageList(g_hWallpaperList, himl, LVSIL_SMALL);
+ }
+
+ ZeroMemory(&listItem, sizeof(LV_ITEM));
+ listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
+ listItem.pszText = sfi.szDisplayName;
+ listItem.state = LVIS_SELECTED;
+ listItem.iItem = g_listViewItemCount;
+ listItem.iImage = sfi.iIcon;
+ listItem.lParam = g_wallpaperCount;
+
+ ListView_InsertItem(g_hWallpaperList, &listItem);
+ _tcscpy(g_wallpapers[g_wallpaperCount], wallpaperFilename);
+
+ ListView_SetItemState(g_hWallpaperList, g_listViewItemCount, LVIS_SELECTED, LVIS_SELECTED);
+
+ g_currentWallpaperItemId = g_listViewItemCount;
+
+ g_listViewItemCount++;
+ g_wallpaperCount++;
+ }
+ }
+
+ RegCloseKey(regKey);
+
+ /* Add all the bitmaps in the C:\ReactOS directory. */
+
+ GetWindowsDirectory(szSearchPath, MAX_PATH);
+ _tcscat(szSearchPath, TEXT("\\*.bmp"));
+
+ hFind = FindFirstFile(szSearchPath, &fd);
+ while(hFind != INVALID_HANDLE_VALUE)
+ {
+ /* Don't add any hidden bitmaps */
+ if((fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) == 0)
+ {
+ TCHAR filename[MAX_PATH];
+
+ GetWindowsDirectory(filename, MAX_PATH);
+
+ _tcscat(filename, TEXT("\\"));
+ _tcscat(filename, fd.cFileName);
+
+ himl = (HIMAGELIST)SHGetFileInfo(filename,
+ 0,
+ &sfi,
+ sizeof(sfi),
+ SHGFI_SYSICONINDEX | SHGFI_SMALLICON |
+ SHGFI_DISPLAYNAME);
+
+ if(himl == NULL)
+ {
+ break;
+ }
+
+ if(i++ == 0)
+ {
+ g_hShellImageList = himl;
+ ListView_SetImageList(g_hWallpaperList, himl, LVSIL_SMALL);
+ }
+
+ ZeroMemory(&listItem, sizeof(LV_ITEM));
+ listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
+ listItem.pszText = sfi.szDisplayName;
+ listItem.state = 0;
+ listItem.iItem = g_listViewItemCount++;
+ listItem.iImage = sfi.iIcon;
+ listItem.lParam = g_wallpaperCount;
+
+ ListView_InsertItem(g_hWallpaperList, &listItem);
+
+ _tcscpy(g_wallpapers[g_wallpaperCount], filename);
+
+ g_wallpaperCount++;
+ }
+
+ if(!FindNextFile(hFind, &fd))
+ hFind = INVALID_HANDLE_VALUE;
+ }
+}
+
+void InitBackgroundDialog()
+{
+ g_hWallpaperList = GetDlgItem(g_hBackgroundTab, IDC_WALLPAPER_LIST);
+ g_hWallpaperPreview = GetDlgItem(g_hBackgroundTab, IDC_WALLPAPER_PREVIEW);
+ g_hPlacementCombo = GetDlgItem(g_hBackgroundTab, IDC_PLACEMENT_COMBO);
+
+ AddListViewItems();
+
+ TCHAR szString[256];
+
+ LoadString(hApplet, IDS_CENTER, szString, sizeof(szString) / sizeof(TCHAR));
+ SendMessage(g_hPlacementCombo, CB_INSERTSTRING, PLACEMENT_CENTER, (LPARAM)szString);
+
+ LoadString(hApplet, IDS_STRETCH, szString, sizeof(szString) / sizeof(TCHAR));
+ SendMessage(g_hPlacementCombo, CB_INSERTSTRING, PLACEMENT_STRETCH, (LPARAM)szString);
+
+ LoadString(hApplet, IDS_TILE, szString, sizeof(szString) / sizeof(TCHAR));
+ SendMessage(g_hPlacementCombo, CB_INSERTSTRING, PLACEMENT_TILE, (LPARAM)szString);
+
+ /* Load the default settings from the registry */
+ HKEY regKey;
+
+ TCHAR szBuffer[2];
+ DWORD bufferSize = sizeof(szBuffer);
+ DWORD varType = REG_SZ;
+ LONG result;
+
+ RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_ALL_ACCESS, ®Key);
+
+ result = RegQueryValueEx(regKey, TEXT("WallpaperStyle"), 0, &varType, (LPBYTE)szBuffer, &bufferSize);
+
+ if(result == ERROR_SUCCESS)
+ {
+ if(_ttoi(szBuffer) == 0)
+ {
+ SendMessage(g_hPlacementCombo, CB_SETCURSEL, PLACEMENT_CENTER, 0);
+ g_placementSelection = PLACEMENT_CENTER;
+ }
+
+ if(_ttoi(szBuffer) == 2)
+ {
+ SendMessage(g_hPlacementCombo, CB_SETCURSEL, PLACEMENT_STRETCH, 0);
+ g_placementSelection = PLACEMENT_STRETCH;
+ }
+ }
+ else
+ {
+ SendMessage(g_hPlacementCombo, CB_SETCURSEL, PLACEMENT_CENTER, 0);
+ g_placementSelection = PLACEMENT_CENTER;
+ }
+
+ result = RegQueryValueEx(regKey, TEXT("TileWallpaper"), 0, &varType, (LPBYTE)szBuffer, &bufferSize);
+
+ if(result == ERROR_SUCCESS)
+ {
+ if(_ttoi(szBuffer) == 1)
+ {
+ SendMessage(g_hPlacementCombo, CB_SETCURSEL, PLACEMENT_TILE, 0);
+ g_placementSelection = PLACEMENT_TILE;
+ }
+ }
+
+ RegCloseKey(regKey);
+}
+
+void OnPatternButton()
+{
+ MessageBox(NULL, TEXT("That button doesn't do anything yet"), TEXT("Whoops"), MB_OK);
+}
+
+BOOL CheckListBoxFilename(HWND list, TCHAR *filename)
+{
+ return FALSE;
+}
+
+void OnBrowseButton()
+{
+ OPENFILENAME ofn;
+ TCHAR filename[MAX_PATH];
+ TCHAR fileTitle[256];
+
+ ZeroMemory(&ofn, sizeof(OPENFILENAME));
+
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner = g_hBackgroundTab;
+ ofn.lpstrFile = filename;
+
+ /* Set lpstrFile[0] to '\0' so that GetOpenFileName does not
+ * use the contents of szFile to initialize itself */
+ ofn.lpstrFile[0] = TEXT('\0');
+ ofn.nMaxFile = MAX_PATH;
+ ofn.lpstrFilter = TEXT("Bitmap Files (*.bmp)\0*.bmp\0");
+ ofn.nFilterIndex = 0;
+ ofn.lpstrFileTitle = fileTitle;
+ ofn.nMaxFileTitle = 256;
+ ofn.lpstrInitialDir = NULL;
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
+
+ if(GetOpenFileName(&ofn) == TRUE)
+ {
+ /* Check if there is already a entry that holds this filename */
+ if(CheckListBoxFilename(g_hWallpaperList, filename) == FALSE)
+ {
+ SHFILEINFO sfi;
+ LV_ITEM listItem;
+
+ if(g_wallpaperCount > (MAX_WALLPAPERS - 1))
+ return;
+
+ _tcscpy(g_wallpapers[g_wallpaperCount], filename);
+
+ SHGetFileInfo(filename,
+ 0,
+ &sfi,
+ sizeof(sfi),
+ SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_DISPLAYNAME);
+
+ ZeroMemory(&listItem, sizeof(LV_ITEM));
+ listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
+ listItem.pszText = sfi.szDisplayName;
+ listItem.state = 0;
+ listItem.iItem = g_listViewItemCount++;
+ listItem.iImage = sfi.iIcon;
+ listItem.lParam = g_wallpaperCount;
+
+ ListView_InsertItem(g_hWallpaperList, &listItem);
+
+ g_wallpaperCount++;
+ }
+ }
+}
+
+void ListViewItemChanged(int itemIndex)
+{
+ if(g_pWallpaperBitmap != NULL)
+ {
+ DibFreeImage(g_pWallpaperBitmap);
+ g_pWallpaperBitmap = NULL;
+ }
+
+ LV_ITEM listItem;
+
+ listItem.iItem = itemIndex;
+ listItem.mask = LVIF_PARAM;
+ ListView_GetItem(g_hWallpaperList, &listItem);
+
+ if(listItem.lParam == -1)
+ {
+ g_wallpaperSelection = -1;
+ InvalidateRect(g_hWallpaperPreview, NULL, TRUE);
+ }
+ else
+ {
+ g_wallpaperSelection = listItem.lParam;
+
+ g_pWallpaperBitmap = DibLoadImage(g_wallpapers[g_wallpaperSelection]);
+
+ if(g_pWallpaperBitmap == NULL)
+ {
+ }
+
+ InvalidateRect(g_hWallpaperPreview, NULL, TRUE);
+ }
+
+ EnableWindow(g_hPlacementCombo, (listItem.lParam != -1 ? TRUE : FALSE));
+
+ PropSheet_Changed(GetParent(g_hBackgroundTab), g_hBackgroundTab);
+}
+
+void DrawWallpaperPreview(LPDRAWITEMSTRUCT draw)
+{
+ if(g_wallpaperSelection == -1)
+ {
+ FillRect(draw->hDC, &draw->rcItem, GetSysColorBrush(COLOR_BACKGROUND));
+ return;
+ }
+
+ if(g_pWallpaperBitmap == NULL)
+ return;
+
+ float scaleX = ((float)GetSystemMetrics(SM_CXSCREEN) - 1) / (float)draw->rcItem.right;
+ float scaleY = ((float)GetSystemMetrics(SM_CYSCREEN) - 1) / (float)draw->rcItem.bottom;
+
+ int scaledWidth = g_pWallpaperBitmap->width / scaleX;
+ int scaledHeight = g_pWallpaperBitmap->height / scaleY;
+
+ int posX = (draw->rcItem.right / 2) - (scaledWidth / 2);
+ int posY = (draw->rcItem.bottom / 2) - (scaledHeight / 2);
+
+ FillRect(draw->hDC, &draw->rcItem, GetSysColorBrush(COLOR_BACKGROUND));
+
+ SetStretchBltMode(draw->hDC, COLORONCOLOR);
+
+ if(g_placementSelection == PLACEMENT_CENTER)
+ {
+ StretchDIBits(draw->hDC,
+ posX,
+ posY,
+ scaledWidth,
+ scaledHeight,
+ 0,
+ 0,
+ g_pWallpaperBitmap->width,
+ g_pWallpaperBitmap->height,
+ g_pWallpaperBitmap->bits,
+ g_pWallpaperBitmap->info,
+ DIB_RGB_COLORS,
+ SRCCOPY);
+ }
+
+ if(g_placementSelection == PLACEMENT_STRETCH)
+ {
+ StretchDIBits(draw->hDC,
+ 0,
+ 0,
+ draw->rcItem.right,
+ draw->rcItem.bottom,
+ 0,
+ 0,
+ g_pWallpaperBitmap->width,
+ g_pWallpaperBitmap->height,
+ g_pWallpaperBitmap->bits,
+ g_pWallpaperBitmap->info,
+ DIB_RGB_COLORS,
+ SRCCOPY);
+ }
+
+ if(g_placementSelection == PLACEMENT_TILE)
+ {
+ int x;
+ int y;
+
+ for(y = 0; y < draw->rcItem.bottom; y += scaledHeight)
+ {
+ for(x = 0; x < draw->rcItem.right; x += scaledWidth)
+ {
+ StretchDIBits(draw->hDC,
+ x,
+ y,
+ scaledWidth,
+ scaledHeight,
+ 0,
+ 0,
+ g_pWallpaperBitmap->width,
+ g_pWallpaperBitmap->height,
+ g_pWallpaperBitmap->bits,
+ g_pWallpaperBitmap->info,
+ DIB_RGB_COLORS,
+ SRCCOPY);
+ }
+ }
+ }
+}
+
+void SetWallpaper()
+{
+ HKEY regKey;
+
+ RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_ALL_ACCESS, ®Key);
+
+ if(g_placementSelection == PLACEMENT_TILE)
+ {
+ RegSetValueEx(regKey, TEXT("TileWallpaper"), 0, REG_SZ, (BYTE *)TEXT("1"), sizeof(TCHAR) * 2);
+ RegSetValueEx(regKey, TEXT("WallpaperStyle"), 0, REG_SZ, (BYTE *)TEXT("0"), sizeof(TCHAR) * 2);
+ }
+
+ if(g_placementSelection == PLACEMENT_CENTER)
+ {
+ RegSetValueEx(regKey, TEXT("TileWallpaper"), 0, REG_SZ, (BYTE *)TEXT("0"), sizeof(TCHAR) * 2);
+ RegSetValueEx(regKey, TEXT("WallpaperStyle"), 0, REG_SZ, (BYTE *)TEXT("0"), sizeof(TCHAR) * 2);
+ }
+
+ if(g_placementSelection == PLACEMENT_STRETCH)
+ {
+ RegSetValueEx(regKey, TEXT("TileWallpaper"), 0, REG_SZ, (BYTE *)TEXT("0"), sizeof(TCHAR) * 2);
+ RegSetValueEx(regKey, TEXT("WallpaperStyle"), 0, REG_SZ, (BYTE *)TEXT("2"), sizeof(TCHAR) * 2);
+ }
+
+ RegCloseKey(regKey);
+
+ if(g_wallpaperSelection == -1)
+ {
+ SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, TEXT(""), SPIF_UPDATEINIFILE);
+ }
+ else
+ {
+ SystemParametersInfo(SPI_SETDESKWALLPAPER,
+ 0,
+ g_wallpapers[g_wallpaperSelection],
+ SPIF_UPDATEINIFILE);
+ }
+}
+
+INT_PTR CALLBACK BackgroundPageProc(HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ g_hBackgroundTab = hwndDlg;
+
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ InitBackgroundDialog();
+ } break;
+
+ case WM_COMMAND:
+ {
+ DWORD controlId = LOWORD(wParam);
+ DWORD command = HIWORD(wParam);
+
+ switch(controlId)
+ {
+ case IDC_PATTERN:
+ {
+ if(command == BN_CLICKED)
+ OnPatternButton();
+ } break;
+
+ case IDC_BROWSE:
+ {
+ if(command == BN_CLICKED)
+ OnBrowseButton();
+ } break;
+
+ case IDC_PLACEMENT_COMBO:
+ {
+ if(command == CBN_SELCHANGE)
+ {
+ g_placementSelection = SendMessage(g_hPlacementCombo, CB_GETCURSEL, 0, 0);
+
+ InvalidateRect(g_hWallpaperPreview, NULL, TRUE);
+
+ PropSheet_Changed(GetParent(g_hBackgroundTab), g_hBackgroundTab);
+ }
+
+ } break;
+ }
+ } break;
+
+ case WM_DRAWITEM:
+ {
+ LPDRAWITEMSTRUCT drawItem;
+ drawItem = (LPDRAWITEMSTRUCT)lParam;
+
+ if(drawItem->CtlID == IDC_WALLPAPER_PREVIEW)
+ {
+ DrawWallpaperPreview(drawItem);
+ }
+
+ } break;
+
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnm = (LPNMHDR)lParam;
+
+ switch(lpnm->code)
+ {
+ case PSN_APPLY:
+ {
+ SetWallpaper();
+
+ /* Update the current wallapaper list item to the
+ * currently selected wallpaper */
+ LV_ITEM listItem;
+ listItem.mask = LVIF_PARAM;
+ listItem.iSubItem = 0;
+ listItem.iItem = g_currentWallpaperItemId;
+ listItem.lParam = g_wallpaperSelection;
+
+ ListView_SetItem(g_hWallpaperList, &listItem);
+
+ return TRUE;
+ } break;
+
+ case LVN_ITEMCHANGED:
+ {
+ LPNMLISTVIEW nm = (LPNMLISTVIEW)lParam;
+
+ if((nm->uNewState & LVIS_SELECTED) == 0)
+ return FALSE;
+
+ ListViewItemChanged(nm->iItem);
+
+ } break;
+
+ default:
+ break;
+ }
+
+ } break;
+
+ case WM_DESTROY:
+ {
+ if(g_pWallpaperBitmap != NULL)
+ DibFreeImage(g_pWallpaperBitmap);
+
+ } break;
+ }
+
+ return FALSE;
+}
+
Property changes on: trunk/reactos/lib/cpl/desk/background.c
___________________________________________________________________
Name: svn:keywords
+ author date id revision
Name: svn:eol-style
+ native
--- trunk/reactos/lib/cpl/desk/desk.c 2005-02-04 16:51:11 UTC (rev 13405)
+++ trunk/reactos/lib/cpl/desk/desk.c 2005-02-04 20:39:10 UTC (rev 13406)
@@ -1,214 +1,128 @@
-/*
- * ReactOS
- * Copyright (C) 2004 ReactOS Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
/* $Id$
*
+ * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Display Control Panel
* FILE: lib/cpl/desk/desk.c
* PURPOSE: ReactOS Display Control Panel
- * PROGRAMMER: Gero Kuehn (reactos.filter@gkware.com)
- * UPDATE HISTORY:
- * 06-17-2004 Created
- * 08-07-2004 Initial Checkin
+ *
+ * PROGRAMMERS: Trevor McCort (lycan359@gmail.com)
*/
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <tchar.h>
#include <windows.h>
-
#include <commctrl.h>
#include <cpl.h>
-#include <process.h>
-
#include "resource.h"
#include "desk.h"
#define NUM_APPLETS (1)
-LONG CALLBACK DisplayApplet(VOID);
-INT_PTR CALLBACK BackgroundPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK ScreenSaverPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK SettingsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+LONG APIENTRY DisplayApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
+extern INT_PTR CALLBACK BackgroundPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+extern INT_PTR CALLBACK ScreenSaverPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+extern INT_PTR CALLBACK AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+extern INT_PTR CALLBACK SettingsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
HINSTANCE hApplet = 0;
/* Applets */
APPLET Applets[NUM_APPLETS] =
{
- {IDI_CPLSYSTEM, IDS_CPLSYSTEMNAME, IDS_CPLSYSTEMDESCRIPTION, DisplayApplet}
+ {
+ IDC_DESK_ICON,
+ IDS_CPLNAME,
+ IDS_CPLDESCRIPTION,
+ DisplayApplet
+ }
};
-
-
-/* Property page dialog callback */
-INT_PTR CALLBACK
-BackgroundPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+static VOID InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
{
- switch(uMsg)
- {
- case WM_INITDIALOG:
- break;
- case WM_COMMAND:
- break;
- }
- return FALSE;
+ ZeroMemory(psp, sizeof(PROPSHEETPAGE));
+ psp->dwSize = sizeof(PROPSHEETPAGE);
+ psp->dwFlags = PSP_DEFAULT;
+ psp->hInstance = hApplet;
+ psp->pszTemplate = MAKEINTRESOURCE(idDlg);
+ psp->pfnDlgProc = DlgProc;
}
-
-/* Property page dialog callback */
-INT_PTR CALLBACK
-ScreenSaverPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+/* Display Applet */
+LONG APIENTRY DisplayApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
{
- switch(uMsg)
- {
- case WM_INITDIALOG:
- break;
- case WM_COMMAND:
- break;
- }
- return FALSE;
+ PROPSHEETPAGE psp[4];
+ PROPSHEETHEADER psh;
+ TCHAR Caption[1024];
+
+ LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
+
+ ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
+ psh.dwSize = sizeof(PROPSHEETHEADER);
+ psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK | PSH_PROPTITLE;
+ psh.hwndParent = NULL;
+ psh.hInstance = hApplet;
+ psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_DESK_ICON));
+ psh.pszCaption = Caption;
+ psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
+ psh.nStartPage = 0;
+ psh.ppsp = psp;
+
+ InitPropSheetPage(&psp[0], IDD_BACKGROUND, BackgroundPageProc);
+ InitPropSheetPage(&psp[1], IDD_SCREENSAVER, ScreenSaverPageProc);
+ InitPropSheetPage(&psp[2], IDD_APPEARANCE, AppearancePageProc);
+ InitPropSheetPage(&psp[3], IDD_SETTINGS, SettingsPageProc);
+
+ return (LONG)(PropertySheet(&psh) != -1);
}
-/* Property page dialog callback */
-INT_PTR CALLBACK
-AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch(uMsg)
- {
- case WM_INITDIALOG:
- break;
- case WM_COMMAND:
- break;
- }
- return FALSE;
-}
-
-
-/* Property page dialog callback */
-INT_PTR CALLBACK
-SettingsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch(uMsg)
- {
- case WM_INITDIALOG:
- break;
- case WM_COMMAND:
- break;
- }
- return FALSE;
-}
-
-
-static VOID
-InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
-{
- ZeroMemory(psp, sizeof(PROPSHEETPAGE));
- psp->dwSize = sizeof(PROPSHEETPAGE);
- psp->dwFlags = PSP_DEFAULT;
- psp->hInstance = hApplet;
- psp->pszTemplate = MAKEINTRESOURCE(idDlg);
- psp->pfnDlgProc = DlgProc;
-}
-
-
-/* First Applet */
-
-LONG CALLBACK
-DisplayApplet(VOID)
-{
- PROPSHEETPAGE psp[4];
- PROPSHEETHEADER psh;
- TCHAR Caption[1024];
-
- LoadString(hApplet, IDS_CPLSYSTEMNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
-
- ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
- psh.dwSize = sizeof(PROPSHEETHEADER);
- psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
- psh.hwndParent = NULL;
- psh.hInstance = hApplet;
- psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
- psh.pszCaption = Caption;
- psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
- psh.nStartPage = 0;
- psh.ppsp = psp;
- psh.pfnCallback = NULL;
-
- InitPropSheetPage(&psp[0], IDD_PROPPAGEBACKGROUND, BackgroundPageProc);
- InitPropSheetPage(&psp[1], IDD_PROPPAGESCREENSAVER, ScreenSaverPageProc);
- InitPropSheetPage(&psp[2], IDD_PROPPAGEAPPEARANCE, AppearancePageProc);
- InitPropSheetPage(&psp[3], IDD_PROPPAGESETTINGS, SettingsPageProc);
-
- return (LONG)(PropertySheet(&psh) != -1);
-}
-
-
/* Control Panel Callback */
-LONG CALLBACK
-CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
+LONG CALLBACK CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
{
- int i = (int)lParam1;
-
- switch(uMsg)
- {
- case CPL_INIT:
- {
- return TRUE;
- }
- case CPL_GETCOUNT:
- {
- return NUM_APPLETS;
- }
- case CPL_INQUIRE:
- {
- CPLINFO *CPlInfo = (CPLINFO*)lParam2;
- CPlInfo->lData = 0;
- CPlInfo->idIcon = Applets[i].idIcon;
- CPlInfo->idName = Applets[i].idName;
- CPlInfo->idInfo = Applets[i].idDescription;
- break;
- }
- case CPL_DBLCLK:
- {
- Applets[i].AppletProc();
- break;
- }
- }
- return FALSE;
+ int i = (int)lParam1;
+
+ switch(uMsg)
+ {
+ case CPL_INIT:
+ {
+ return TRUE;
+ }
+
+ case CPL_GETCOUNT:
+ {
+ return NUM_APPLETS;
+ }
+
+ case CPL_INQUIRE:
+ {
+ CPLINFO *CPlInfo = (CPLINFO*)lParam2;
+ CPlInfo->lData = 0;
+ CPlInfo->idIcon = Applets[i].idIcon;
+ CPlInfo->idName = Applets[i].idName;
+ CPlInfo->idInfo = Applets[i].idDescription;
+ } break;
+
+ case CPL_DBLCLK:
+ {
+ Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
+ } break;
+ }
+
+ return FALSE;
}
-BOOL WINAPI
-DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
{
- switch(dwReason)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- hApplet = hinstDLL;
- break;
[truncated at 1000 lines; 704 more skipped]