Release 941122

Sun Nov 20 18:30:06 1994  Alexandre Julliard  (julliard@lamisun.epfl.ch)

	* [controls/scroll.c] [include/scroll.h]
	Rewritten most of scroll-bar code for better Windows look & feel.
	Implemented EnableScrollBar().
	Preliminary keyboard support.

	* [objects/bitblt.c]
	Fixed BadMatch error for BitBlt() and StretchBlt() when reading
	bits from outside the visible region.

	* [objects/oembitmap.c] [include/bitmaps/obm_*]
	Use XPM symbolic colors to load bitmaps. This allows the colors
	of the bitmaps to depend on the system colors.

	* [tools/make_debug]
	Made the make_debug script more robust.

	* [windows/dialog.c]
	Fixed CheckRadioButton().

	* [windows/nonclient.c]
	A few changes to scroll-bar drawing and tracking.

	* [windows/winpos.c]
	Renamed NextWindowFromPoint() to WINPOS_NextWindowFromPoint() to
	avoid confusion, and optimized it somewhat.

Nov 19, 94 Martin Ayotte (wine@trgcorp.mksinfo.qc.ca)

	* [misc/audio.c]
	* [misc/mcianim.c]
	more coding but nothing spectacular.

	* [misc/mmaux.c]
	some coding to access '/dev/mixer'.

	* [misc/midi.c]
	some coding to read .MID files, but it's not playing yet.

Sun Nov 13 19:31:03 1994    James Youngman (mbcstjy@afs.man.ac.uk)

	* [objects/dib.c]
	Reimplemented DIB_SetImageBits_RLE8() so that it would cope with
	bitmaps which don't end 0x00, 0x02 (previously it blew up).  This
	includes some bitmaps output by Paint Shop Pro.  Implementation is
	possibly now too lax.  Please see the notes on the function about
	why.

	* [controls/desktop.c]
	The desktop pattern should be painted if the wallpaper doesn't
	cover the whole screen width OR the whole screen height.

Sun Nov 13 00:07:11 MET 1994	Erik Bos	<erik@xs4all.nl>

	* [objects/dib.c]
	Small bug in DIB_SetImageBits() fixed, bitmaps in 16,24 bpp
	now work.

	* [loader/ne_resource.c] [include/resource.h]
	Some cleanup.

Thu Nov 10 20:44:58 1994  Martin von Loewis  (martin@cs.csufresno.edu)

	* [Configure]
	  [rc/sysres.rc]
	Primitive compile-time support for multiple languages

	* [rc/sysres_De.rc]
	New file

	* [loader/resource.c]
	LoadBitmap: Recognize end of sysresbm properly

	* [rc/Imakefile]
	Rules to compile resources simplified, dependencies changed

	* [rc/sysresbm.rc]
	Don't use sysresbm if using XPM

	* [windows/dialog.c]
	CreateDialogIndirectParam: Reverse Z-order of controls

	* [windows/message.c]
	MSG_TranslateMouseMsg: Fix HTTRANSPARENT handling

	* [windows/winpos.c]
	NextWindowFromPoint: New function

	* [controls/button.c]
	WM_NCHITTEST: Group Box is HTTRANSPARENT
	BUTTON_CheckAutoRadioButton: New function
	BM_SETCHECK: Added call to BUTTON_CheckAutoRadioButton

Mon Nov  7 11:20:26 1994  Paul Falstad  (pf@zoof.cts.com)

	* [objects/text.c]
	Fix hang when using DrawText(..., DT_WORDBREAK) with a word that
	is too long to break.

	* [objects/font.c]
	Don't assume helvetica if there is no font family; let the other
	font attributes decide what font to use.

	* [controls/widgets.c]
	Listboxes and combo boxes need to be notified of double-clicks.

	* [controls/listbox.c]
	  [include/listbox.h]

	scrolling to bottom of list box should display last item at the
	bottom, not at the top.
	
	list boxes need to allocate a separate heap for their item data,
	rather than using the user heap.  Otherwise, it's very easy to run
	out of memory for list box items.

	removed redundant code in ListBoxAddString().  Implemented simple
	version of LBS_SORT.

	Don't put [.] in the list box when using DDL_DIRECTORY.

	* [controls/combo.c]
	Combos should pass CBS_SORT onto their list box.

	* [windows/win.c]
	If window creation is aborted, remove the window from the
	linked lists.

	* [controls/static.c]
	static controls with SS_ICON were always returning 0 from
	WM_NCCREATE.

	Make sure static controls have text to draw before drawing it.
diff --git a/windows/nonclient.c b/windows/nonclient.c
index 77eda75..929c1f1 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -9,12 +9,13 @@
 #include "win.h"
 #include "class.h"
 #include "message.h"
+#include "scroll.h"
 #include "sysmetrics.h"
 #include "user.h"
 #include "syscolor.h"
 #include "stddebug.h"
-/* #define DEBUG_NONCLIENT /* */
-/* #undef  DEBUG_NONCLIENT /* */
+/* #define DEBUG_NONCLIENT */
+/* #undef  DEBUG_NONCLIENT */
 #include "debug.h"
 
 
@@ -40,7 +41,9 @@
 extern void MENU_TrackMouseMenuBar( HWND hwnd, POINT pt );       /* menu.c */
 extern void MENU_TrackKbdMenuBar( HWND hwnd, WORD wParam );      /* menu.c */
 extern WORD MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
-			      HWND hwnd, BOOL suppress_draw ); /* menu.c */
+			      HWND hwnd, BOOL suppress_draw );   /* menu.c */
+extern void SCROLL_HandleScrollEvent( HWND hwnd, int nBar,
+                                      WORD msg, POINT pt);       /* scroll.c */
 
 
   /* Some useful macros */
@@ -545,7 +548,7 @@
 void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint )
 {
     HDC hdc;
-    RECT rect, rect2;
+    RECT rect;
 
     WND *wndPtr = WIN_FindWndPtr( hwnd );
 
@@ -631,33 +634,19 @@
 	rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint );
     }
 
-    if (wndPtr->dwStyle & (WS_VSCROLL | WS_HSCROLL)) {
- 	if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->VScroll != NULL) &&
-	    (wndPtr->scroll_flags & 0x0001)) {
- 	    int bottom = rect.bottom;
- 	    if ((wndPtr->dwStyle & WS_HSCROLL) && (wndPtr->scroll_flags & 0x0001))
-			bottom -= SYSMETRICS_CYHSCROLL;
-	    SetRect(&rect2, rect.right - SYSMETRICS_CXVSCROLL, 
-	    	rect.top, rect.right+1, bottom+1); 
- 	    StdDrawScrollBar(hwnd, hdc, SB_VERT, &rect2, wndPtr->VScroll);
- 	    }
- 	if ((wndPtr->dwStyle & WS_HSCROLL) && wndPtr->HScroll != NULL &&
-	    (wndPtr->scroll_flags & 0x0002)) {
-	    int right = rect.right;
-	    if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->scroll_flags & 0x0001))
-			right -= SYSMETRICS_CYVSCROLL;
-	    SetRect(&rect2, rect.left-1, rect.bottom - SYSMETRICS_CYHSCROLL,
-		    right+1, rect.bottom+1);
-	    StdDrawScrollBar(hwnd, hdc, SB_HORZ, &rect2, wndPtr->HScroll);
-	    }
+      /* Draw the scroll-bars */
 
-	if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->dwStyle & WS_HSCROLL) &&
-	    (wndPtr->scroll_flags & 0x0003) == 0x0003) {
-		RECT r = rect;
-		r.left = r.right - SYSMETRICS_CXVSCROLL + 1;
-		r.top  = r.bottom - SYSMETRICS_CYHSCROLL + 1;
-		FillRect( hdc, &r, sysColorObjects.hbrushScrollbar );
-		}
+    if (wndPtr->dwStyle & WS_VSCROLL) SCROLL_DrawScrollBar(hwnd, hdc, SB_VERT);
+    if (wndPtr->dwStyle & WS_HSCROLL) SCROLL_DrawScrollBar(hwnd, hdc, SB_HORZ);
+
+      /* Draw the "size-box" */
+
+    if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->dwStyle & WS_HSCROLL))
+    {
+        RECT r = rect;
+        r.left = r.right - SYSMETRICS_CXVSCROLL + 1;
+        r.top  = r.bottom - SYSMETRICS_CYHSCROLL + 1;
+        FillRect( hdc, &r, sysColorObjects.hbrushScrollbar );
     }    
 
     ReleaseDC( hwnd, hdc );
@@ -1041,8 +1030,10 @@
  */
 static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt )
 {
-    MSG 	msg;
-    WORD 	scrollbar;
+    MSG msg;
+    WORD scrollbar;
+    WND *wndPtr = WIN_FindWndPtr( hwnd );
+
     if ((wParam & 0xfff0) == SC_HSCROLL)
     {
 	if ((wParam & 0x0f) != HTHSCROLL) return;
@@ -1054,25 +1045,35 @@
 	scrollbar = SB_VERT;
     }
 
-    ScreenToClient( hwnd, &pt );
-    ScrollBarButtonDown( hwnd, scrollbar, pt.x, pt.y );
+    pt.x -= wndPtr->rectWindow.left;
+    pt.y -= wndPtr->rectWindow.top;
     SetCapture( hwnd );
+    SCROLL_HandleScrollEvent( hwnd, scrollbar, WM_LBUTTONDOWN, pt );
 
     do
     {
-	MSG_GetHardwareMessage( &msg );
-	ScreenToClient( hwnd, &msg.pt );
+        GetMessage( &msg, 0, 0, 0 );
 	switch(msg.message)
 	{
 	case WM_LBUTTONUP:
-	    ScrollBarButtonUp( hwnd, scrollbar, msg.pt.x, msg.pt.y );
-	    break;
 	case WM_MOUSEMOVE:
-	    ScrollBarMouseMove(hwnd, scrollbar, msg.wParam, msg.pt.x,msg.pt.y);
+        case WM_SYSTIMER:
+            pt = MAKEPOINT(msg.lParam);
+            pt.x += wndPtr->rectClient.left - wndPtr->rectWindow.left;
+            pt.y += wndPtr->rectClient.top - wndPtr->rectWindow.top;
+            SCROLL_HandleScrollEvent( hwnd, scrollbar, msg.message, pt );
 	    break;
+        default:
+            TranslateMessage( &msg );
+            DispatchMessage( &msg );
+            break;
 	}
+        if (!IsWindow( hwnd ))
+        {
+            ReleaseCapture();
+            break;
+        }
     } while (msg.message != WM_LBUTTONUP);
-    ReleaseCapture();
 }
 
 /***********************************************************************
@@ -1234,7 +1235,6 @@
 
     case SC_VSCROLL:
     case SC_HSCROLL:
-    if (wndPtr->dwStyle & WS_CHILD) ClientToScreen(wndPtr->hwndParent, &pt);
 	NC_TrackScrollBar( hwnd, wParam, pt );
 	break;