wine/objects/pen.c
Alexandre Julliard da0cfb3610 Release 961201
Sat Nov 30 19:21:17 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [configure]
	Re-generated with autoconf 2.11. Let me know if you have
	problems.

	* [controls/listbox.c] [controls/oldlbox.c]
	Listboxes rewritten from scratch. Moved old code still used by
	comboboxes to oldlbox.c

	* [misc/registry.c]
	Use temporary file when saving registry.

	* [windows/dialog.c]
	Implemented Win32 version of DlgDirList() and DlgDirListComboBox().

	* [windows/winproc.c]
	Added translation for listbox Win32 messages.

Sat Nov 30 21:00:00 Alex Korobka <alex@trantor.pharm.sunysb.edu>

	* [controls/widgets.c] [controls/button.c]
	Fixed some incompatibilities with CTL3D DLL.

	* [windows/dialog.c]
	Made dialog windows fit into the desktop.

	* [misc/winsock.c] [misc/winsock_async.c]
	New Winsock engine.

	* [windows/message.c]
	GetMessage() fixes.

	* [windows/queue.c] [windows/hook.c] [windows/win.c]
	SetMessageQueue() fixes.

Fri Nov 29 10:25:12 1996  Slaven Rezic  <eserte@cs.tu-berlin.de>

	* [objects/text.c]
	DrawText16(): Fixed return value.

Tue Nov 26 14:47:09 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [files/profile.c] [*/*]
	Added Win32 profile functions, updated to new naming standard.

	* [objects/font.c] [if1632/thunk.c] [include/windows.h]
	Added EnumFonts32*, EnumFontFamiliesEx*, changed prototypes and
	structures.

	* [misc/ole2nls.c] [if1632/thunk.c]
	Added EnumSystemLocales() (winhelp.exe).

	* [misc/registry.c]
	Added Windows 3.1 registry loader supplied by Tor Sjxwall, tor@sn.no

	* [win32/file.c]
	Partially fixed CreateFileMapping(), added UnmapViewOfFile().

Sat Nov 23 23:36:05 1996  Ronan Waide  <waider@waider.ie>

	* [misc/shell.c]
	Fixed some FIXMEs relating to ShellExec() and FindExecutable().

	* [misc/main.c]
	Implemented a few more of the SystemParametersInfo() cases.

Tue Nov 19 01:24:34 1996  Philippe De Muyter  <phdm@info.ucl.ac.be>

	* [include/keyboard.h]
	New file, new macro WINE_VKEY_MAPPINGS (using code taken from event.c).

	* [include/windows.h]
	New [VK_A, VK_Z] and [VK_0, VK9] macros.

	* [misc/keyboard.c]
	Fixes in KeyTable and ToAscii.

	* [objects/font.c]
	FONT_init : Give default value for MSWIN "system" font.
	FONT_MatchFont : Do not try every size of a font family if the
	family does not exist.

	* [windows/event.c]
	lastEventChar hack removed.
	KeyStateTable replaced by InputKeyStateTable (maintained in event.c)
	and QueueKeyStateTable (maintained in message.c).
	EVENT_key : Corrections to the extended bit setting.

	* [windows/message.c] [windows/keyboard.c]
	Implementation of a new QueueKeyStateTable : table of key states
	valid when messages are retrieved by GetMessage or PeekMessage,
	and valid for TranslateMessage.
	TranslateMessage : Convert WM*KEY messages using QueueKeyStateTable
	and ToAscii.
	
Mon Nov 18 16:59:01 1996  Robert Pouliot <krynos@clic.net>

	* [graphics/Makefile.in] [graphics/wing.c]
	  [if1632/wing.spec]
	Some functions for WinG support, mostly empty stubs.

	* [misc/crtdll.c] [if1632/crtdll.spec]
	Many functions added to CRTDLL, mostly calls to Unix C library.
1996-12-01 17:17:47 +00:00

153 lines
4.5 KiB
C

/*
* GDI pen objects
*
* Copyright 1993 Alexandre Julliard
*/
#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include "pen.h"
#include "metafile.h"
#include "color.h"
#include "stddebug.h"
#include "debug.h"
static const char PEN_dash[] = { 5,3 }; /* ----- ----- ----- */
static const char PEN_dot[] = { 1,1 }; /* -- -- -- -- -- -- */
static const char PEN_dashdot[] = { 4,3,2,3 }; /* ---- -- ---- -- */
static const char PEN_dashdotdot[] = { 4,2,2,2,2,2 }; /* ---- -- -- ---- */
/***********************************************************************
* CreatePen16 (GDI.61)
*/
HPEN16 CreatePen16( INT16 style, INT16 width, COLORREF color )
{
LOGPEN32 logpen = { style, { width, 0 }, color };
dprintf_gdi(stddeb, "CreatePen16: %d %d %06lx\n", style, width, color );
return CreatePenIndirect32( &logpen );
}
/***********************************************************************
* CreatePen32 (GDI32.55)
*/
HPEN32 CreatePen32( INT32 style, INT32 width, COLORREF color )
{
LOGPEN32 logpen = { style, { width, 0 }, color };
dprintf_gdi(stddeb, "CreatePen32: %d %d %06lx\n", style, width, color );
return CreatePenIndirect32( &logpen );
}
/***********************************************************************
* CreatePenIndirect16 (GDI.62)
*/
HPEN16 CreatePenIndirect16( const LOGPEN16 * pen )
{
PENOBJ * penPtr;
HPEN16 hpen;
if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
hpen = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC );
if (!hpen) return 0;
penPtr = (PENOBJ *)GDI_HEAP_LIN_ADDR( hpen );
penPtr->logpen.lopnStyle = pen->lopnStyle;
penPtr->logpen.lopnColor = pen->lopnColor;
CONV_POINT16TO32( &pen->lopnWidth, &penPtr->logpen.lopnWidth );
return hpen;
}
/***********************************************************************
* CreatePenIndirect32 (GDI32.56)
*/
HPEN32 CreatePenIndirect32( const LOGPEN32 * pen )
{
PENOBJ * penPtr;
HPEN32 hpen;
if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
hpen = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC );
if (!hpen) return 0;
penPtr = (PENOBJ *)GDI_HEAP_LIN_ADDR( hpen );
penPtr->logpen.lopnStyle = pen->lopnStyle;
penPtr->logpen.lopnWidth = pen->lopnWidth;
penPtr->logpen.lopnColor = pen->lopnColor;
return hpen;
}
/***********************************************************************
* PEN_GetObject16
*/
INT16 PEN_GetObject16( PENOBJ * pen, INT16 count, LPSTR buffer )
{
LOGPEN16 logpen;
logpen.lopnStyle = pen->logpen.lopnStyle;
logpen.lopnColor = pen->logpen.lopnColor;
CONV_POINT32TO16( &pen->logpen.lopnWidth, &logpen.lopnWidth );
if (count > sizeof(logpen)) count = sizeof(logpen);
memcpy( buffer, &logpen, count );
return count;
}
/***********************************************************************
* PEN_GetObject32
*/
INT32 PEN_GetObject32( PENOBJ * pen, INT32 count, LPSTR buffer )
{
if (count > sizeof(pen->logpen)) count = sizeof(pen->logpen);
memcpy( buffer, &pen->logpen, count );
return count;
}
/***********************************************************************
* PEN_SelectObject
*/
HPEN32 PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
{
HPEN32 prevHandle = dc->w.hPen;
if (dc->header.wMagic == METAFILE_DC_MAGIC)
{
LOGPEN16 logpen = { pen->logpen.lopnStyle,
{ pen->logpen.lopnWidth.x,
pen->logpen.lopnWidth.y },
pen->logpen.lopnColor };
if (MF_CreatePenIndirect( dc, hpen, &logpen )) return prevHandle;
else return 0;
}
dc->w.hPen = hpen;
dc->u.x.pen.style = pen->logpen.lopnStyle;
dc->u.x.pen.width = pen->logpen.lopnWidth.x * dc->w.VportExtX
/ dc->w.WndExtX;
if (dc->u.x.pen.width < 0) dc->u.x.pen.width = -dc->u.x.pen.width;
if (dc->u.x.pen.width == 1) dc->u.x.pen.width = 0; /* Faster */
dc->u.x.pen.pixel = COLOR_ToPhysical( dc, pen->logpen.lopnColor );
switch(pen->logpen.lopnStyle)
{
case PS_DASH:
dc->u.x.pen.dashes = (char *)PEN_dash;
dc->u.x.pen.dash_len = 2;
break;
case PS_DOT:
dc->u.x.pen.dashes = (char *)PEN_dot;
dc->u.x.pen.dash_len = 2;
break;
case PS_DASHDOT:
dc->u.x.pen.dashes = (char *)PEN_dashdot;
dc->u.x.pen.dash_len = 4;
break;
case PS_DASHDOTDOT:
dc->u.x.pen.dashes = (char *)PEN_dashdotdot;
dc->u.x.pen.dash_len = 6;
break;
}
return prevHandle;
}