Added regedit unit test, a couple minor changes to regedit.
[wine] / dlls / gdi / win16drv / objects.c
1 /*
2  * GDI objects
3  *
4  * Copyright 1993 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include "config.h"
22
23 #include <stdlib.h>
24 #include <stdio.h>
25
26 #include "win16drv/win16drv.h"
27
28 #include "wine/debug.h"
29
30 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
31
32
33 /***********************************************************************
34  *           WIN16DRV_SelectBitmap
35  */
36 HBITMAP WIN16DRV_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
37 {
38     FIXME("BITMAP not implemented\n");
39     return 1;
40 }
41
42
43 /***********************************************************************
44  *           WIN16DRV_SelectBrush
45  */
46 HBRUSH WIN16DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush )
47 {
48     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
49     int          nSize;
50     LOGBRUSH16 lBrush16;
51
52     if (!GetObject16( hbrush, sizeof(lBrush16), &lBrush16 )) return 0;
53
54     if ( physDev->BrushInfo )
55     {
56         TRACE("UnRealizing BrushInfo\n");
57         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_BRUSH,
58                                       physDev->BrushInfo,
59                                       physDev->BrushInfo, 0);
60     }
61     else
62     {
63         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_BRUSH, &lBrush16, 0, 0);
64         physDev->BrushInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
65     }
66
67     nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_BRUSH,
68                                  &lBrush16, physDev->BrushInfo, win16drv_SegPtr_TextXForm);
69     return hbrush;
70 }
71
72
73 /***********************************************************************
74  *           WIN16DRV_SelectPen
75  */
76 HPEN WIN16DRV_SelectPen( PHYSDEV dev, HPEN hpen )
77 {
78     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
79     int          nSize;
80     LOGPEN16     lPen16;
81
82     if (!GetObject16( hpen, sizeof(lPen16), &lPen16 )) return 0;
83
84     if ( physDev->PenInfo )
85     {
86         TRACE("UnRealizing PenInfo\n");
87         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_PEN,
88                                       physDev->PenInfo,
89                                       physDev->PenInfo, 0);
90     }
91     else
92     {
93         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_PEN, &lPen16, 0, 0);
94         physDev->PenInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
95     }
96
97     nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_PEN,
98                                  &lPen16, physDev->PenInfo, 0);
99     return hpen;
100 }