Author: bfreisen Date: Fri May 29 23:36:35 2009 New Revision: 41200
URL: http://svn.reactos.org/svn/reactos?rev=41200&view=rev Log: Paint: Added cropping via attributes dialog and setting desktop wallpaper (both not yet working)
Added: trunk/reactos/base/applications/paint/registry.c (with props) trunk/reactos/base/applications/paint/registry.h (with props) Modified: trunk/reactos/base/applications/paint/dialogs.c trunk/reactos/base/applications/paint/history.c trunk/reactos/base/applications/paint/paint.rbuild trunk/reactos/base/applications/paint/winproc.c
Modified: trunk/reactos/base/applications/paint/dialogs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/dia... ============================================================================== --- trunk/reactos/base/applications/paint/dialogs.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/paint/dialogs.c [iso-8859-1] Fri May 29 23:36:35 2009 @@ -84,10 +84,16 @@ switch (LOWORD(wParam)) { case IDOK: - EndDialog(hwnd, 1); + EndDialog(hwnd, GetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, NULL, FALSE) | (GetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, NULL, FALSE)<<16)); break; case IDCANCEL: EndDialog(hwnd, 0); + break; + case IDD_ATTRIBUTESSTANDARD: + CheckDlgButton(hwnd, IDD_ATTRIBUTESRB3, BST_CHECKED); + CheckDlgButton(hwnd, IDD_ATTRIBUTESRB5, BST_CHECKED); + SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, imgXRes, FALSE); + SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, imgYRes, FALSE); break; } break;
Modified: trunk/reactos/base/applications/paint/history.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/his... ============================================================================== --- trunk/reactos/base/applications/paint/history.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/paint/history.c [iso-8859-1] Fri May 29 23:36:35 2009 @@ -91,7 +91,7 @@ setImgXYRes(GetDIBWidth(hBms[currInd]), GetDIBHeight(hBms[currInd])); }
-void cropReversible(int x, int y) +void cropReversible(int x, int y)//FIXME: This function is broken { SelectObject(hDrawingDC, hBms[currInd]); DeleteObject(hBms[(currInd+1)%4]);
Modified: trunk/reactos/base/applications/paint/paint.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/pai... ============================================================================== --- trunk/reactos/base/applications/paint/paint.rbuild [iso-8859-1] (original) +++ trunk/reactos/base/applications/paint/paint.rbuild [iso-8859-1] Fri May 29 23:36:35 2009 @@ -16,6 +16,7 @@ <file>main.c</file> <file>mouse.c</file> <file>palette.c</file> + <file>registry.c</file> <file>selection.c</file> <file>toolsettings.c</file> <file>winproc.c</file>
Added: trunk/reactos/base/applications/paint/registry.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/reg... ============================================================================== --- trunk/reactos/base/applications/paint/registry.c (added) +++ trunk/reactos/base/applications/paint/registry.c [iso-8859-1] Fri May 29 23:36:35 2009 @@ -1,0 +1,39 @@ +/* + * PROJECT: PAINT for ReactOS + * LICENSE: LGPL + * FILE: registry.c + * PURPOSE: Offering functions dealing with registry values + * PROGRAMMERS: Benedikt Freisen + */ + +/* INCLUDES *********************************************************/ + +#include <windows.h> + +/* FUNCTIONS ********************************************************/ + +void setWallpaper(char fname[], int style) +{ + HKEY hkeycontrolpanel; + HKEY hkeydesktop; + RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel", 0, 0, hkeycontrolpanel); + RegOpenKeyEx(hkeycontrolpanel, "Desktop", 0, KEY_SET_VALUE, hkeydesktop); + RegSetValueEx(hkeydesktop, "Wallpaper", 0, REG_SZ, fname, sizeof(fname)); + switch (style) + { + case 0: + RegSetValueEx(hkeydesktop, "WallpaperStyle", 0, REG_SZ, "2", 2); + RegSetValueEx(hkeydesktop, "TileWallpaper", 0, REG_SZ, "0", 2); + break; + case 1: + RegSetValueEx(hkeydesktop, "WallpaperStyle", 0, REG_SZ, "1", 2); + RegSetValueEx(hkeydesktop, "TileWallpaper", 0, REG_SZ, "0", 2); + break; + case 2: + RegSetValueEx(hkeydesktop, "WallpaperStyle", 0, REG_SZ, "1", 2); + RegSetValueEx(hkeydesktop, "TileWallpaper", 0, REG_SZ, "1", 2); + break; + } + RegCloseKey(hkeydesktop); + RegCloseKey(hkeycontrolpanel); +}
Propchange: trunk/reactos/base/applications/paint/registry.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/base/applications/paint/registry.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/reg... ============================================================================== --- trunk/reactos/base/applications/paint/registry.h (added) +++ trunk/reactos/base/applications/paint/registry.h [iso-8859-1] Fri May 29 23:36:35 2009 @@ -1,0 +1,9 @@ +/* + * PROJECT: PAINT for ReactOS + * LICENSE: LGPL + * FILE: registry.h + * PURPOSE: Offering functions dealing with registry values + * PROGRAMMERS: Benedikt Freisen + */ + +void setWallpaper(char fname[], int style);
Propchange: trunk/reactos/base/applications/paint/registry.h ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/reactos/base/applications/paint/winproc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/win... ============================================================================== --- trunk/reactos/base/applications/paint/winproc.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/paint/winproc.c [iso-8859-1] Fri May 29 23:36:35 2009 @@ -21,6 +21,7 @@ #include "drawing.h" #include "history.h" #include "mouse.h" +#include "registry.h"
/* FUNCTIONS ********************************************************/
@@ -87,7 +88,7 @@ switch (lParam) { case 0: - if (FALSE) + if (isAFile) { EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERPLANE, MF_ENABLED | MF_BYCOMMAND); EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERCENTERED, MF_ENABLED | MF_BYCOMMAND); @@ -421,6 +422,15 @@ isAFile = TRUE; } break; + case IDM_FILEASWALLPAPERPLANE: + setWallpaper(filepathname, 2); + break; + case IDM_FILEASWALLPAPERCENTERED: + setWallpaper(filepathname, 1); + break; + case IDM_FILEASWALLPAPERSTRETCHED: + setWallpaper(filepathname, 0); + break; case IDM_EDITUNDO: undo(); SendMessage(hImageArea, WM_PAINT, 0, 0); @@ -507,10 +517,14 @@ break; case IDM_IMAGEATTRIBUTES: { - //int attrdata[8] = {0, 0, 0, 0, 0, 0, 0, 0}; - attributesDlg(); - //cropReversible(640, 200); - //ZoomTo(zoom); + int retVal = attributesDlg(); + if ((LOWORD(retVal)!=0)&&(HIWORD(retVal)!=0)) + { + // cropReversible broken, dirty hack: + // insertReversible(CopyImage(hBms[currInd], IMAGE_BITMAP, LOWORD(retVal), HIWORD(retVal), 0)); + cropReversible(LOWORD(retVal), HIWORD(retVal)); + updateCanvasAndScrollbars(); + } } break; case IDM_IMAGECHANGESIZE: