Release 941107

Sun Nov  6 18:52:04 1994  Alexandre Julliard  (julliard@lamisun.epfl.ch)

	* [objects/oembitmap.c]  (New file)
	Added possibility to use .xpm files for OEM bitmaps.

	* [include/bitmaps/obm*]  (New files)
	Redrawn all OEM bitmaps in xpm format.

	* [objects/font.c]
	Add space for internal leading when using a negative font height.
	Stubs for AddFontResource() and RemoveFontResource().
	Fix in FONT_Init() for uninitialised default font.

	* [windows/dialog.c]
	Make font height negative as it is really a point size and not a
	pixel size; dialogs using 8-point fonts look better now.

	* [windows/graphics.c]
	Fixed the fix :-) for Pie() to make it work for Arc() and Chord() also.

	* [windows/nonclient.c]
	A few changes for new OEM bitmaps.

Sun Nov  6 18:22:18 1994  Michael Patra  <micky@marie.physik.tu-berlin.de>

	* [windows/class.c]
	The names of local classes have to be stored using GlobalAtom*.
	Otherwise they couldn't be accessed from other modules (e.g. BWCC) 

	* [if1632/call.S]
	CallTo16(cx): It's possible to set the contents of the cx-register.

	* [loader/ne_image.c]
	InitNEDLL(): The size of the local heap is now passed in the cx-
	register when initializing a DLL.

	* [memory/heap.c]
	LocalInit(): The case start==0 is now handled in the way it should.

	* [windows/win.c]
	GetWindowLong(): If the adress of the windows function is requested
	it's no longer returned if it's within the Wine code (and therefore
	unreachable by a windows program). This makes Borland's OWL happy.

	* [controls/edit.c]
	EDIT_GetStr(): Added handling for off<0.

Sun Nov  6 17:37:14 1994  Chris Jones  <chrisj@ichips.intel.com>

	* [loader/library.c]
	Fixed infinite loop bug when two DLLs refer to each other (fixes
	hangup of Quicken during loading).

Thu Nov 04 12:00:00 1994  Jan Willamowius  (jan@janhh.sh.sub.de)

	* [misc/dos_fs.c]
	Bug fix: The size of a disk an the available space
	is now returned in bytes instead of (incorrectly)
	KBytes.

Thu Nov 03 12:00:00 1994  Jan Willamowius  (jan@janhh.sh.sub.de)

	* [windows/graphics.c]
	Bug fix: Pie segments are now filled with correct brush.

Thu Nov  3 10:40:09 1994  Martin von Loewis  (martin@cs.csufresno.edu)

        * [Imakefile]
        generate rc.o before loader.o

        * [controls/menu.c]
        CopySysMenu: generate SYSMENU on the fly, eliminate hSysMenu

        * [include/resource.h]
        Add struct ResourceTable

        * [loader/bitmap.h]
        Load system bitmaps from sysresbmTable

        * [misc/clipboard.c]
          [windows/event.c]
        IsClipboardFormatAvailable,EVENT_SelectionRequest: bug fixes
        
        * [rc/Imakefile]
        generate rc.o from sysres.o and sysresbm.o. Added -lfl

        * [rc/rc.y]
        change style handling to allow ( S1 | S2 ) | S3

        * [rc/sysres.rc]
          [rc/sysresbm.rc]
        Put bitmaps and icons to sysresbm, everything else to sysres

        * [rc/winerc.c]
          [rc/winerc.h]
        Added -o, -c flags. New function set_out_file. Output to files.

        * [windows/dialog.c]
        DialogBoxIndirectPtr, DialogBoxIndirectParamPtr: New functions 

        * [windows/nonclient.c]
        Create AboutWine dialog from template pointer
diff --git a/objects/Imakefile b/objects/Imakefile
index 81e345a..d4d24f7 100644
--- a/objects/Imakefile
+++ b/objects/Imakefile
@@ -16,6 +16,7 @@
 	gdiobj.c \
 	linedda.c \
 	metafile.c \
+	oembitmap.c \
 	palette.c \
 	pen.c \
 	region.c \
diff --git a/objects/bitblt.c b/objects/bitblt.c
index 0aa4e9a..05f17df 100644
--- a/objects/bitblt.c
+++ b/objects/bitblt.c
@@ -380,9 +380,9 @@
 	__asm__(
 		"imull %%edx\n\t"
 		"idivl %3\n\t"
-		: "=a" (result)			/* out */
-		: "a" (m1), "d" (m2), "g" (d)	/* in */
-		: "ax", "dx"			/* mod */
+		: "=&a" (result)		/* out */
+		: "0" (m1), "d" (m2), "g" (d)	/* in */
+		: "%edx"			/* mod */
 	);
 	return result;
 #else
diff --git a/objects/bitmap.c b/objects/bitmap.c
index 2b540e6..b4054fc 100644
--- a/objects/bitmap.c
+++ b/objects/bitmap.c
@@ -19,11 +19,6 @@
 /* #define DEBUG_BITMAP /* */
 #include "debug.h"
 
-  /* Include OEM bitmaps */
-#include "bitmaps/check_boxes"
-#include "bitmaps/check_mark"
-#include "bitmaps/menu_arrow"
-
   /* GCs used for B&W and color bitmap operations */
 GC BITMAP_monoGC = 0, BITMAP_colorGC = 0;
 
@@ -82,65 +77,6 @@
 
 
 /***********************************************************************
- *           BITMAP_LoadOEMBitmap
- */
-HBITMAP BITMAP_LoadOEMBitmap( WORD id )
-{
-    BITMAPOBJ * bmpObjPtr;
-    HBITMAP hbitmap;
-    WORD width, height;
-    char *data;
-
-    switch(id)
-    {
-    case OBM_MNARROW:
-	width  = menu_arrow_width;
-	height = menu_arrow_height;
-	data   = menu_arrow_bits;
-	break;
-
-    case OBM_CHECKBOXES:
-	width  = check_boxes_width;
-	height = check_boxes_height;
-	data   = check_boxes_bits;
-	break;
-	
-    case OBM_CHECK:
-	width  = check_mark_width;
-	height = check_mark_height;
-	data   = check_mark_bits;
-	break;
-
-    default:
-	return 0;
-    }
-    
-      /* Create the BITMAPOBJ */
-    if (!(hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC )))
-	return 0;
-    bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_ADDR( hbitmap );
-    bmpObjPtr->size.cx = 0;
-    bmpObjPtr->size.cy = 0;
-    bmpObjPtr->bitmap.bmType       = 0;
-    bmpObjPtr->bitmap.bmWidth      = width;
-    bmpObjPtr->bitmap.bmHeight     = height;
-    bmpObjPtr->bitmap.bmWidthBytes = (width + 15) / 16 * 2;
-    bmpObjPtr->bitmap.bmPlanes     = 1;
-    bmpObjPtr->bitmap.bmBitsPixel  = 1;
-    bmpObjPtr->bitmap.bmBits       = NULL;
-
-      /* Create the pixmap */
-    if (!(bmpObjPtr->pixmap = XCreateBitmapFromData( display, rootWindow,
-						     data, width, height )))
-    {
-	GDI_HEAP_FREE( hbitmap );
-	return 0;
-    }
-    return hbitmap;
-}
-
-
-/***********************************************************************
  *           CreateBitmap    (GDI.48)
  */
 HBITMAP CreateBitmap( short width, short height, 
diff --git a/objects/brush.c b/objects/brush.c
index 6555d6c..cc3797a 100644
--- a/objects/brush.c
+++ b/objects/brush.c
@@ -50,7 +50,7 @@
 HBRUSH CreateHatchBrush( short style, COLORREF color )
 {
     LOGBRUSH logbrush = { BS_HATCHED, color, style };
-    dprintf_gdi(stddeb, "CreateHatchBrush: %d %06x\n", style, color );
+    dprintf_gdi(stddeb, "CreateHatchBrush: %d %06lx\n", style, color );
     if ((style < 0) || (style >= NB_HATCH_STYLES)) return 0;
     return CreateBrushIndirect( &logbrush );
 }
@@ -119,7 +119,7 @@
 HBRUSH CreateSolidBrush( COLORREF color )
 {
     LOGBRUSH logbrush = { BS_SOLID, color, 0 };
-    dprintf_gdi(stddeb, "CreateSolidBrush: %06x\n", color );
+    dprintf_gdi(stddeb, "CreateSolidBrush: %06lx\n", color );
     return CreateBrushIndirect( &logbrush );
 }
 
diff --git a/objects/font.c b/objects/font.c
index 111984d..2e6480b 100644
--- a/objects/font.c
+++ b/objects/font.c
@@ -65,9 +65,9 @@
   int i;
 
   if( GetPrivateProfileString("fonts", NULL, "*", temp, sizeof(temp), WINE_INI) > 2 ) {
-    for( ptr = temp, i = 1; strlen(ptr) != 0; ptr += strlen(ptr) + 1, i++ )
+    for( ptr = temp, i = 1; strlen(ptr) != 0; ptr += strlen(ptr) + 1 )
       if( strcmp( ptr, "default" ) )
-	FontNames[i].window = strdup( ptr );
+	FontNames[i++].window = strdup( ptr );
     FontSize = i;
 
     for( i = 1; i < FontSize; i++ ) {
@@ -75,8 +75,7 @@
       FontNames[i].x11 = strdup( temp );
     }
     GetPrivateProfileString("fonts", "default", "*", temp, sizeof(temp), WINE_INI);
-    if( *temp == '*' )
-      FontNames[0].x11 = strdup( temp );
+    FontNames[0].x11 = strdup( temp );
 
   } else {
     FontNames[0].window = NULL; FontNames[0].x11 = "bitstream-courier";
@@ -114,7 +113,7 @@
  *
  * Find a X font matching the logical font.
  */
-static XFontStruct * FONT_MatchFont( LOGFONT * font )
+static XFontStruct * FONT_MatchFont( LOGFONT * font, DC * dc )
 {
     char pattern[100];
     const char *family, *weight, *charset;
@@ -125,8 +124,17 @@
     
     weight = (font->lfWeight > 550) ? "bold" : "medium";
     slant = font->lfItalic ? 'i' : 'r';
-    height = abs(font->lfHeight * 10);
-    width = font->lfWidth * 10;
+    height = font->lfHeight * dc->w.VportExtX / dc->w.WndExtX;
+    if (height == 0) height = 120;  /* Default height = 12 */
+    else if (height < 0)
+    {
+          /* If height is negative, it means the height of the characters */
+          /* *without* the internal leading. So we adjust it a bit to     */
+          /* compensate. 5/4 seems to give good results for small fonts.  */
+        height = 10 * (-height * 5 / 4);
+    }
+    else height *= 10;
+    width  = 10 * (font->lfWidth * dc->w.VportExtY / dc->w.WndExtY);
     spacing = (font->lfPitchAndFamily & FIXED_PITCH) ? 'm' :
 	      (font->lfPitchAndFamily & VARIABLE_PITCH) ? 'p' : '*';
     charset = (font->lfCharSet == ANSI_CHARSET) ? "iso8859-1" : "*-*";
@@ -304,7 +312,7 @@
     
     if (!stockPtr || !stockPtr->fstruct)
     {
-	fontStruct = FONT_MatchFont( &font->logfont );
+	fontStruct = FONT_MatchFont( &font->logfont, dc );
     }
     else
     {
@@ -521,6 +529,27 @@
     return TRUE;
 }
 
+
+/***********************************************************************
+ *           AddFontResource    (GDI.119)
+ */
+int AddFontResource( LPSTR str )
+{
+    fprintf( stdnimp, "STUB: AddFontResource('%s')\n", str );
+    return 1;
+}
+
+
+/***********************************************************************
+ *           RemoveFontResource    (GDI.136)
+ */
+BOOL RemoveFontResource( LPSTR str )
+{
+    fprintf( stdnimp, "STUB: RemoveFontResource('%s')\n", str );
+    return TRUE;
+}
+
+
 /*************************************************************************
  *				ParseFontParms		[internal]
  */
diff --git a/objects/oembitmap.c b/objects/oembitmap.c
new file mode 100644
index 0000000..f33d60b
--- /dev/null
+++ b/objects/oembitmap.c
@@ -0,0 +1,238 @@
+/*
+ * GDI OEM bitmap objects
+ *
+ * Copyright 1994 Alexandre Julliard
+ */
+
+static char Copyright[] = "Copyright  Alexandre Julliard, 1994";
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#ifdef USE_XPM
+#include <X11/xpm.h>
+#endif
+#include "gdi.h"
+#include "bitmap.h"
+#include "stddebug.h"
+/* #define DEBUG_BITMAP */
+#include "debug.h"
+
+#define OBM_FIRST  OBM_LFARROWI    /* First OEM bitmap */
+#define OBM_LAST   OBM_OLD_CLOSE   /* Last OEM bitmap */
+
+#ifdef USE_XPM
+
+  /* Known symbolic names for colors. Use these whenever possible. */
+struct sys_colors_symbols
+{
+    char *symbol;
+    WORD  syscolor;
+};
+
+static const struct sys_colors_symbols OBM_Color_Symbols[] =
+{
+    { "button_face", COLOR_BTNFACE },
+    { "button_shadow", COLOR_BTNSHADOW },
+    { "button_highlight", COLOR_BTNHIGHLIGHT }
+};
+
+  /* Include OEM pixmaps */
+#include "bitmaps/obm_lfarrowi"
+#include "bitmaps/obm_rgarrowi"
+#include "bitmaps/obm_dnarrowi"
+#include "bitmaps/obm_uparrowi"
+#include "bitmaps/obm_combo"
+#include "bitmaps/obm_mnarrow"
+#include "bitmaps/obm_lfarrowd"
+#include "bitmaps/obm_rgarrowd"
+#include "bitmaps/obm_dnarrowd"
+#include "bitmaps/obm_uparrowd"
+#include "bitmaps/obm_restored"
+#include "bitmaps/obm_zoomd"
+#include "bitmaps/obm_reduced"
+#include "bitmaps/obm_restore"
+#include "bitmaps/obm_zoom"
+#include "bitmaps/obm_reduce"
+#include "bitmaps/obm_lfarrow"
+#include "bitmaps/obm_rgarrow"
+#include "bitmaps/obm_dnarrow"
+#include "bitmaps/obm_uparrow"
+#include "bitmaps/obm_close"
+#include "bitmaps/obm_old_restore"
+#include "bitmaps/obm_old_zoom"
+#include "bitmaps/obm_old_reduce"
+#include "bitmaps/obm_btncorners"
+#include "bitmaps/obm_checkboxes"
+#include "bitmaps/obm_check"
+#include "bitmaps/obm_btsize"
+#include "bitmaps/obm_old_lfarrow"
+#include "bitmaps/obm_old_rgarrow"
+#include "bitmaps/obm_old_dnarrow"
+#include "bitmaps/obm_old_uparrow"
+#include "bitmaps/obm_size"
+#include "bitmaps/obm_old_close"
+
+static const struct
+{
+    char** data;   /* Pointer to bitmap data */
+    BOOL   color;  /* Is it a color bitmap?  */
+} OBM_Pixmaps_Data[OBM_LAST-OBM_FIRST+1] = {
+    { obm_lfarrowi, TRUE },     /* OBM_LFARROWI */
+    { obm_rgarrowi, TRUE },     /* OBM_RGARROWI */
+    { obm_dnarrowi, TRUE },     /* OBM_DNARROWI */
+    { obm_uparrowi, TRUE },     /* OBM_UPARROWI */
+    { obm_combo, FALSE },       /* OBM_COMBO */
+    { obm_mnarrow, FALSE },     /* OBM_MNARROW */
+    { obm_lfarrowd, TRUE },     /* OBM_LFARROWD */
+    { obm_rgarrowd, TRUE },     /* OBM_RGARROWD */
+    { obm_dnarrowd, TRUE },     /* OBM_DNARROWD */
+    { obm_uparrowd, TRUE },     /* OBM_UPARROWD */
+    { obm_restored, TRUE },     /* OBM_RESTORED */
+    { obm_zoomd, TRUE },        /* OBM_ZOOMD */
+    { obm_reduced, TRUE },      /* OBM_REDUCED */
+    { obm_restore, TRUE },      /* OBM_RESTORE */
+    { obm_zoom, TRUE },         /* OBM_ZOOM */
+    { obm_reduce, TRUE },       /* OBM_REDUCE */
+    { obm_lfarrow, TRUE },      /* OBM_LFARROW */
+    { obm_rgarrow, TRUE },      /* OBM_RGARROW */
+    { obm_dnarrow, TRUE },      /* OBM_DNARROW */
+    { obm_uparrow, TRUE },      /* OBM_UPARROW */
+    { obm_close, TRUE },        /* OBM_CLOSE */
+    { obm_old_restore, FALSE }, /* OBM_OLD_RESTORE */
+    { obm_old_zoom, FALSE },    /* OBM_OLD_ZOOM */
+    { obm_old_reduce, FALSE },  /* OBM_OLD_REDUCE */
+    { obm_btncorners, FALSE },  /* OBM_BTNCORNERS */
+    { obm_checkboxes, FALSE },  /* OBM_CHECKBOXES */
+    { obm_check, FALSE },       /* OBM_CHECK */
+    { obm_btsize, FALSE },      /* OBM_BTSIZE */
+    { obm_old_lfarrow, FALSE }, /* OBM_OLD_LFARROW */
+    { obm_old_rgarrow, FALSE }, /* OBM_OLD_RGARROW */
+    { obm_old_dnarrow, FALSE }, /* OBM_OLD_DNARROW */
+    { obm_old_uparrow, FALSE }, /* OBM_OLD_UPARROW */
+    { obm_size, FALSE },        /* OBM_SIZE */
+    { obm_old_close, FALSE },   /* OBM_OLD_CLOSE */
+};
+
+#else  /* USE_XPM */
+
+  /* Include OEM bitmaps */
+#include "bitmaps/check_boxes"
+#include "bitmaps/check_mark"
+#include "bitmaps/menu_arrow"
+
+static const struct
+{
+    WORD width, height;
+    char *data;
+} OBM_Bitmaps_Data[OBM_LAST-OBM_FIRST+1] =
+{
+    { 0, 0, NULL },  /* OBM_LFARROWI */
+    { 0, 0, NULL },  /* OBM_RGARROWI */
+    { 0, 0, NULL },  /* OBM_DNARROWI */
+    { 0, 0, NULL },  /* OBM_UPARROWI */
+    { 0, 0, NULL },  /* OBM_COMBO */
+    { menu_arrow_width, menu_arrow_height, menu_arrow_bits }, /* OBM_MNARROW */
+    { 0, 0, NULL },  /* OBM_LFARROWD */
+    { 0, 0, NULL },  /* OBM_RGARROWD */
+    { 0, 0, NULL },  /* OBM_DNARROWD */
+    { 0, 0, NULL },  /* OBM_UPARROWD */
+    { 0, 0, NULL },  /* OBM_RESTORED */
+    { 0, 0, NULL },  /* OBM_ZOOMD */
+    { 0, 0, NULL },  /* OBM_REDUCED */
+    { 0, 0, NULL },  /* OBM_RESTORE */
+    { 0, 0, NULL },  /* OBM_ZOOM */
+    { 0, 0, NULL },  /* OBM_REDUCE */
+    { 0, 0, NULL },  /* OBM_LFARROW */
+    { 0, 0, NULL },  /* OBM_RGARROW */
+    { 0, 0, NULL },  /* OBM_DNARROW */
+    { 0, 0, NULL },  /* OBM_UPARROW */
+    { 0, 0, NULL },  /* OBM_CLOSE */
+    { 0, 0, NULL },  /* OBM_OLD_RESTORE */
+    { 0, 0, NULL },  /* OBM_OLD_ZOOM */
+    { 0, 0, NULL },  /* OBM_OLD_REDUCE */
+    { 0, 0, NULL },  /* OBM_BTNCORNERS */
+    { check_boxes_width, check_boxes_height,
+          check_boxes_bits },  /* OBM_CHECKBOXES */
+    { check_mark_width, check_mark_height, check_mark_bits },  /* OBM_CHECK */
+    { 0, 0, NULL },  /* OBM_BTSIZE */
+    { 0, 0, NULL },  /* OBM_OLD_LFARROW */
+    { 0, 0, NULL },  /* OBM_OLD_RGARROW */
+    { 0, 0, NULL },  /* OBM_OLD_DNARROW */
+    { 0, 0, NULL },  /* OBM_OLD_UPARROW */
+    { 0, 0, NULL },  /* OBM_SIZE */
+    { 0, 0, NULL },  /* OBM_OLD_CLOSE */
+};
+
+#endif /* USE_XPM */
+
+
+extern Colormap COLOR_WinColormap;
+
+
+/***********************************************************************
+ *           OBM_LoadOEMBitmap
+ */
+HBITMAP OBM_LoadOEMBitmap( WORD id )
+{
+    BITMAPOBJ * bmpObjPtr;
+    HBITMAP hbitmap;
+    WORD width, height, bpp;
+    Pixmap pixmap;
+
+    if ((id < OBM_FIRST) || (id > OBM_LAST)) return 0;
+    id -= OBM_FIRST;
+#ifdef USE_XPM
+    if (!OBM_Pixmaps_Data[id].data) return 0;
+    {
+        XpmAttributes attrs;
+
+        attrs.valuemask = XpmColormap | XpmDepth;
+        attrs.colormap = COLOR_WinColormap;
+        if (OBM_Pixmaps_Data[id].color) attrs.depth = bpp = screenDepth;
+        else attrs.depth = bpp = 1;
+        
+        if (XpmCreatePixmapFromData( display, rootWindow,
+                                     OBM_Pixmaps_Data[id].data,
+                                     &pixmap, NULL, &attrs ) != XpmSuccess)
+        {
+            fprintf( stderr, "Error creating pixmap\n" );
+            pixmap = 0;
+        }
+        else
+        {
+            width = attrs.width;
+            height = attrs.height;
+        }
+    }
+#else
+    if (!OBM_Bitmaps_Data[id].data) return 0;
+    bpp = 1;
+    width  = OBM_Bitmaps_Data[id].width;
+    height = OBM_Bitmaps_Data[id].height;
+    pixmap = XCreateBitmapFromData( display, rootWindow, 
+                                    OBM_Bitmaps_Data[id].data, width, height );
+#endif  /* USE_XPM */
+
+    if (!pixmap) return 0;
+
+      /* Create the BITMAPOBJ */
+    if (!(hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC )))
+    {
+        XFreePixmap( display, pixmap );
+	return 0;
+    }
+    bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_ADDR( hbitmap );
+    bmpObjPtr->size.cx = 0;
+    bmpObjPtr->size.cy = 0;
+    bmpObjPtr->pixmap  = pixmap;
+    bmpObjPtr->bitmap.bmType       = 0;
+    bmpObjPtr->bitmap.bmWidth      = width;
+    bmpObjPtr->bitmap.bmHeight     = height;
+    bmpObjPtr->bitmap.bmWidthBytes = (width + 15) / 16 * 2;
+    bmpObjPtr->bitmap.bmPlanes     = 1;
+    bmpObjPtr->bitmap.bmBitsPixel  = bpp;
+    bmpObjPtr->bitmap.bmBits       = NULL;
+    return hbitmap;
+}
+
+