diff -u gs/src/dwimg.h ../ghostpcl_1.38/gs/src/dwimg.h --- gs/src/dwimg.h Fri Aug 03 03:31:36 2001 +++ ../ghostpcl_1.38/gs/src/dwimg.h Wed Jan 15 10:08:19 2003 @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1998, Russell Lang. +/* Copyright (C) 1996, 2001, Ghostgum Software Pty Ltd. All rights reserved. Portions Copyright (C) 2001 artofcode LLC. Portions Copyright (C) 1996, 2001 Artifex Software Inc. Portions Copyright (C) 1988, 2000 Aladdin Enterprises. @@ -11,14 +11,18 @@ contact Artifex Software, Inc., 101 Lucas Valley Road #110, San Rafael, CA 94903, (415)492-9861, for further information. */ -// $RCSfile: dwimg.h,v $ $Revision: 1.10 $ +/* $Id:$ */ -// Image Window class +#ifndef dwimg_INCLUDED +# define dwimg_INCLUDED -class ImageWindow { - static ImageWindow *first; - ImageWindow *next; +/* Windows Image Window structure */ + +typedef struct IMAGE_S IMAGE; +struct IMAGE_S { + void *handle; + void *device; HWND hwnd; HBRUSH hBrush; /* background */ int raster; @@ -67,3 +71,5 @@ unsigned int new_format); void image_poll(IMAGE *img); + +#endif /* dwimg_INCLUDED */ diff -u gs/src/dwmain.h ../ghostpcl_1.38/gs/src/dwmain.h --- gs/src/dwmain.h Fri Aug 03 03:31:36 2001 +++ ../ghostpcl_1.38/gs/src/dwmain.h Wed Jan 15 10:13:43 2003 @@ -11,9 +11,16 @@ contact Artifex Software, Inc., 101 Lucas Valley Road #110, San Rafael, CA 94903, (415)492-9861, for further information. */ -// $RCSfile: dwmain.h,v $ $Revision: 1.10 $ +/* $Id:$ */ +#ifndef dwmain_INCLUDED +# define dwmain_INCLUDED + /* Icon index definitions - needed by resources */ -#define GSTEXT_ICON 50 -#define GSIMAGE_ICON 51 +#define GSTEXT_ICON 50 +#define GSIMAGE_ICON 51 + +extern HWND hwndtext; + +#endif /* dwmain_INCLUDED */ diff -u gs/src/dwreg.c ../ghostpcl_1.38/gs/src/dwreg.c --- gs/src/dwreg.c Wed Jan 15 10:25:36 2003 +++ ../ghostpcl_1.38/gs/src/dwreg.c Thu Feb 28 21:50:37 2002 @@ -0,0 +1,107 @@ +/* Copyright (C) 2001, Ghostgum Software Pty Ltd. All rights reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, + modified or distributed except as expressly authorized under the terms + of the license contained in the file LICENSE in this distribution. + + For more information about licensing, please refer to + http://www.ghostscript.com/licensing/. For information on + commercial licensing, go to http://www.artifex.com/licensing/ or + contact Artifex Software, Inc., 101 Lucas Valley Road #110, + San Rafael, CA 94903, U.S.A., +1(415)492-9861. +*/ + +/* $Id: dwreg.c,v 1.3 2002/02/21 22:24:51 giles Exp $ */ +/* MS Windows registry values */ + +#include +#include +#include /* for getenv */ +#include +#include "gscdefs.h" /* for gs_productfamily and gs_revision */ + +/* We store registry named values under the key + * "Software\\AFPL Ghostscript" + * where "AFPL Ghostscript" is actually gs_productfamily. + * Either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER will be used. + */ +int +win_registry_key(char *buf, int len) +{ + const char *software = "Software"; + if (strlen(software) + 1 + strlen(gs_productfamily) >= len) + return -1; + + strcpy(buf, software); + strcat(buf, "\\"); + strcat(buf, gs_productfamily); + return 0; +} + +/* + * Get a named registry value from HKCU. + * name, ptr, plen and return values are the same as in gp_getenv(); + */ +int +win_get_reg_value(const char *name, char *ptr, int *plen) +{ + HKEY hkey; + DWORD cbData, keytype; + BYTE b; + LONG rc; + BYTE *bptr = (BYTE *)ptr; + char key[256]; + + win_registry_key(key, sizeof(key)); + if (RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_READ, &hkey) + == ERROR_SUCCESS) { + keytype = REG_SZ; + cbData = *plen; + if (bptr == (char *)NULL) + bptr = &b; /* Registry API won't return ERROR_MORE_DATA */ + /* if ptr is NULL */ + rc = RegQueryValueEx(hkey, (char *)name, 0, &keytype, bptr, &cbData); + RegCloseKey(hkey); + if (rc == ERROR_SUCCESS) { + *plen = cbData; + return 0; /* found environment variable and copied it */ + } else if (rc == ERROR_MORE_DATA) { + /* buffer wasn't large enough */ + *plen = cbData; + return -1; + } + } + return 1; /* not found */ +} + +/* + * Set a named registry value under HKCU. + * name = name of named value + * str = value of named value + * Returns 0 on success. + */ +int +win_set_reg_value(const char *name, const char *value) +{ + HKEY hkey; + LONG rc; + char key[256]; + DWORD dwDisposition; + + win_registry_key(key, sizeof(key)); + rc = RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_WRITE, &hkey); + if (rc != ERROR_SUCCESS) + rc = RegCreateKeyEx(HKEY_CURRENT_USER, key, 0, "", 0, + KEY_ALL_ACCESS, NULL, &hkey, &dwDisposition); + if (rc == ERROR_SUCCESS) { + rc = RegSetValueEx(hkey, name, 0, REG_SZ, + (CONST BYTE *)value, strlen(value)+1); + RegCloseKey(hkey); + } + + return rc == ERROR_SUCCESS ? 0 : -1; +} + diff -u gs/src/dwreg.h ../ghostpcl_1.38/gs/src/dwreg.h --- gs/src/dwreg.h Wed Jan 15 10:25:33 2003 +++ ../ghostpcl_1.38/gs/src/dwreg.h Thu Feb 28 21:50:37 2002 @@ -0,0 +1,26 @@ +/* Copyright (C) 2001, Ghostgum Software Pty Ltd. All rights reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, + modified or distributed except as expressly authorized under the terms + of the license contained in the file LICENSE in this distribution. + + For more information about licensing, please refer to + http://www.ghostscript.com/licensing/. For information on + commercial licensing, go to http://www.artifex.com/licensing/ or + contact Artifex Software, Inc., 101 Lucas Valley Road #110, + San Rafael, CA 94903, U.S.A., +1(415)492-9861. +*/ + +/* $Id: dwreg.h,v 1.4 2002/02/21 22:24:51 giles Exp $ */ + +#ifndef dwreg_INCLUDED +# define dwreg_INCLUDED + +/* Get and set named registry values for Ghostscript application. */ +int win_get_reg_value(const char *name, char *ptr, int *plen); +int win_set_reg_value(const char *name, const char *value); + +#endif /* dwreg_INCLUDED */ diff -u gs/src/gdevdsp.c ../ghostpcl_1.38/gs/src/gdevdsp.c --- gs/src/gdevdsp.c Fri Aug 03 04:13:20 2001 +++ ../ghostpcl_1.38/gs/src/gdevdsp.c Fri Jan 17 22:08:27 2003 @@ -864,7 +864,7 @@ } if (ddev->mdev) { dev_proc(ddev->mdev, close_device)((gx_device *)ddev->mdev); - gx_device_retain(ddev->mdev, false); + gx_device_retain((gx_device *)ddev->mdev, false); ddev->mdev = NULL; } } @@ -886,18 +886,18 @@ if (mdproto == 0) return_error(gs_error_rangecheck); - ccode = gs_copydevice((gx_device **)&(ddev->mdev), - (const gx_device *)mdproto, - gs_memory_stable(ddev->memory)); - if (ccode < 0) - return ccode; + ddev->mdev = gs_alloc_struct(gs_memory_stable(ddev->memory), + gx_device_memory, &st_device_memory, "display_memory_device"); + if (ddev->mdev == 0) + return_error(gs_error_VMerror); + gs_make_mem_device(ddev->mdev, mdproto, gs_memory_stable(ddev->memory), 0, (gx_device *) NULL); gx_device_fill_in_procs((gx_device *)(ddev->mdev)); /* Mark the memory device as retained. When the bitmap is closed, * we will clear this and the memory device will be then be freed. */ - gx_device_retain(ddev->mdev, true); + gx_device_retain((gx_device *)ddev->mdev, true); ddev->mdev->width = param_dev->width; ddev->mdev->height = param_dev->height;