diff --git a/reactos/lib/user32/Makefile b/reactos/lib/user32/Makefile index eb1613df249..fbb382f5a6a 100644 --- a/reactos/lib/user32/Makefile +++ b/reactos/lib/user32/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.25 2003/08/15 10:51:51 rcampbell Exp $ +# $Id: Makefile,v 1.26 2003/08/22 07:51:32 gvg Exp $ PATH_TO_TOP = ../.. @@ -22,6 +22,8 @@ TARGET_CFLAGS += -D_DISABLE_TIDENTS TARGET_LFLAGS = -nostartfiles -nostdlib +TARGET_RCFLAGS = --include-dir ./include + CONTROLS_OBJECTS = \ controls/combo.o \ controls/edit.o \ diff --git a/reactos/lib/user32/include/resource.h b/reactos/lib/user32/include/resource.h new file mode 100644 index 00000000000..cb70605987b --- /dev/null +++ b/reactos/lib/user32/include/resource.h @@ -0,0 +1,8 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS user32.dll + * FILE: include/resource.h + * PURPOSE: Definition of resource ids + */ + +#define DF_HATCH 30000 diff --git a/reactos/lib/user32/include/user32.h b/reactos/lib/user32/include/user32.h index 5050d6abdf2..de948e4d863 100644 --- a/reactos/lib/user32/include/user32.h +++ b/reactos/lib/user32/include/user32.h @@ -12,7 +12,6 @@ typedef struct _USER32_THREAD_DATA MSG LastMessage; } USER32_THREAD_DATA, *PUSER32_THREAD_DATA; -PUSER32_THREAD_DATA -User32GetThreadData(); -extern HBRUSH FrameBrushes[13]; -#define DF_HATCH (30000) +PUSER32_THREAD_DATA User32GetThreadData(); + +VOID DeleteFrameBrushes(VOID); diff --git a/reactos/lib/user32/misc/dllmain.c b/reactos/lib/user32/misc/dllmain.c index 653d26b4cca..9e83ee01539 100644 --- a/reactos/lib/user32/misc/dllmain.c +++ b/reactos/lib/user32/misc/dllmain.c @@ -20,8 +20,6 @@ static ULONG User32TlsIndex; VOID STDCALL KeBugCheck (ULONG BugCheckCode) {} HWINSTA ProcessWindowStation; -HBRUSH FrameBrushes[13]; -HBITMAP hHatch; PUSER32_THREAD_DATA User32GetThreadData() @@ -48,42 +46,6 @@ CleanupThread(VOID) HeapFree(GetProcessHeap(), HEAP_ZERO_MEMORY, ThreadData); TlsSetValue(User32TlsIndex, 0); } -VOID -CreateFrameBrushes(HINSTANCE hInstance) -{ - FrameBrushes[0] = CreateSolidBrush(RGB(0,0,0)); - FrameBrushes[1] = CreateSolidBrush(RGB(0,0,128)); - FrameBrushes[2] = CreateSolidBrush(RGB(10,36,106)); - FrameBrushes[3] = CreateSolidBrush(RGB(128,128,128)); - FrameBrushes[4] = CreateSolidBrush(RGB(181,181,181)); - FrameBrushes[5] = CreateSolidBrush(RGB(212,208,200)); - FrameBrushes[6] = CreateSolidBrush(RGB(236,233,216)); - FrameBrushes[7] = CreateSolidBrush(RGB(255,255,255)); - FrameBrushes[8] = CreateSolidBrush(RGB(49,106,197)); - FrameBrushes[9] = CreateSolidBrush(RGB(58,110,165)); - FrameBrushes[10] = CreateSolidBrush(RGB(64,64,64)); - FrameBrushes[11] = CreateSolidBrush(RGB(255,255,225)); - hHatch = LoadBitmapW(hInstance,MAKEINTRESOURCEW(DF_HATCH)); - FrameBrushes[12] = CreatePatternBrush(hHatch); -} -VOID -DeleteFrameBrushes(VOID) -{ - DeleteObject(FrameBrushes[0]); - DeleteObject(FrameBrushes[1]); - DeleteObject(FrameBrushes[2]); - DeleteObject(FrameBrushes[3]); - DeleteObject(FrameBrushes[4]); - DeleteObject(FrameBrushes[5]); - DeleteObject(FrameBrushes[6]); - DeleteObject(FrameBrushes[7]); - DeleteObject(FrameBrushes[8]); - DeleteObject(FrameBrushes[9]); - DeleteObject(FrameBrushes[10]); - DeleteObject(FrameBrushes[11]); - DeleteObject(FrameBrushes[12]); - DeleteObject(hHatch); -} DWORD Init(VOID) @@ -156,7 +118,6 @@ DllMain( hProcessHeap = RtlGetProcessHeap(); Init(); InitThread(); - CreateFrameBrushes(hinstDll); break; case DLL_THREAD_ATTACH: InitThread(); @@ -165,7 +126,7 @@ DllMain( CleanupThread(); break; case DLL_PROCESS_DETACH: - DeleteFrameBrushes(); + DeleteFrameBrushes(); CleanupThread(); Cleanup(); break; diff --git a/reactos/lib/user32/user32.rc b/reactos/lib/user32/user32.rc index 761f5f279af..b4e037f70e1 100644 --- a/reactos/lib/user32/user32.rc +++ b/reactos/lib/user32/user32.rc @@ -1,6 +1,7 @@ #include #include #include +#include LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US diff --git a/reactos/lib/user32/windows/paint.c b/reactos/lib/user32/windows/paint.c index b81d7717850..de1635c7f72 100644 --- a/reactos/lib/user32/windows/paint.c +++ b/reactos/lib/user32/windows/paint.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: paint.c,v 1.17 2003/08/18 09:59:29 silverblade Exp $ +/* $Id: paint.c,v 1.18 2003/08/22 07:51:32 gvg Exp $ * * PROJECT: ReactOS user32.dll * FILE: lib/user32/windows/input.c @@ -29,12 +29,55 @@ /* INCLUDES ******************************************************************/ #include +#include #include #define NDEBUG #include +static HBRUSH FrameBrushes[13]; +static HBITMAP hHatch; + /* FUNCTIONS *****************************************************************/ +static VOID +CreateFrameBrushes() +{ + FrameBrushes[0] = CreateSolidBrush(RGB(0,0,0)); + FrameBrushes[1] = CreateSolidBrush(RGB(0,0,128)); + FrameBrushes[2] = CreateSolidBrush(RGB(10,36,106)); + FrameBrushes[3] = CreateSolidBrush(RGB(128,128,128)); + FrameBrushes[4] = CreateSolidBrush(RGB(181,181,181)); + FrameBrushes[5] = CreateSolidBrush(RGB(212,208,200)); + FrameBrushes[6] = CreateSolidBrush(RGB(236,233,216)); + FrameBrushes[7] = CreateSolidBrush(RGB(255,255,255)); + FrameBrushes[8] = CreateSolidBrush(RGB(49,106,197)); + FrameBrushes[9] = CreateSolidBrush(RGB(58,110,165)); + FrameBrushes[10] = CreateSolidBrush(RGB(64,64,64)); + FrameBrushes[11] = CreateSolidBrush(RGB(255,255,225)); + hHatch = LoadBitmapW(NULL,MAKEINTRESOURCEW(DF_HATCH)); + FrameBrushes[12] = CreatePatternBrush(hHatch); +} + +VOID +DeleteFrameBrushes(VOID) +{ + unsigned Brush; + + for (Brush = 0; Brush < sizeof(FrameBrushes) / sizeof(HBRUSH); Brush++) + { + if (NULL != FrameBrushes[Brush]) + { + DeleteObject(FrameBrushes[Brush]); + FrameBrushes[Brush] = NULL; + } + } + if (NULL != hHatch) + { + DeleteObject(hHatch); + hHatch = NULL; + } +} + /* * @implemented */ @@ -252,6 +295,10 @@ DrawFrame( DWORD brush; HBRUSH hbrFrame; PATRECT p[4]; + if (NULL == FrameBrushes[0]) + { + CreateFrameBrushes(); + } if (type & 4) { rop = PATINVERT;