Release 940614
Tue Jun 14 08:09:14 1994 Bob Amstadt (bob@pooh)
* loader/selector.c (GetCurrentPDB):
Added trivial function GetCurrentPDB() which returns the program
segment prefix selector.
* memory/heap.c (HEAP_Free):
If free list is empty, make the freed block the free list.
Fri Jun 10 07:56:49 1994 Bob Amstadt (bob@pooh)
* controls/edit.c (EDIT_SetTextMsg):
Do not append a newline at the end of the last line.
* windows/event.c (SetCapture):
Set winHasCursor if mouse capture succeeds.
Jun 13, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [controls/listbox.c]
Fix bug in listbox : InsertString should call AddString if -1.
* [controls/menu.c]
New function GetMenuState().
* [controls/scroll.c] [windows/nonclient.c]
Try to make ShowScrollBar() recalc NC_ regions. Not finished !
* [objects/text.c]
Add Stub for TabbedTextOut(), which temporarely call Textout().
* [windows/keyboard.c] [windows/event.c]
New function GetKeyBoardState() with an KeyStateTable array
& associated handling in function EVENT_key().
Mon Jun 13 16:45:24 MET DST 1994 (erik@hacktic.nl)
* [controls/menu.c]
IsMenu() added.
* [loader/library.c]
ModuleFirst(), ModuleNext(), ModuleFindName(), ModuleFindHandle()
added.
* [object/gdiobj.c]
IsGDIObject() added.
* [miscemu/int2[56].c]
bugfix: both didn't leave flags pushed on 16bit-stack.
(winfile gets a bit further)
* [miscemu/int16.c]
Added (empty).
Sat Jun 11 22:56:48 1994 Jon Tombs (jon@esix2.us.es)
* windows/event.c:
Added code to drop redundant motion Events in the XEvent queue.
Thu Jun 9 10:55:55 MET DST 1994 Jochen Hein ( Hein@Student.TU-Clausthal.de )
* [misc/main.c misc/message.c include/texts.h]
Removed the text-constants from message.c into variables
which may be changed from X-resources.
* [misc/main.c misc/message.c]
added <locale.h> and setlocale() to main.c, used toupper() in message.c
Mon, 13 Jun 94 09:41:16 -0500 Paul Bramel <paulbr@comm.mot.com>
* controls/button.c ( [CR]B_LButton* )
left rc.right at full window width so click on label also
activates the control (MSWin behavior)
Sat Jun 11 19:05:40 1994 Olaf Flebbe (flebbe@tat.physik.uni-tuebingen.de)
* include/windows.h:
functions pointers can not be packed.
(annoying warnings with forthcomming gcc-2.6.x)
* loader/main.c (InitDLL):
Fixed a printf statement. (for control.exe)
(InitializeLoadedDLLs):
deleted shadow definition of *wpnt.
(Breaks many programs, because now COMMDLG will be
initialized :-(
* windows/win.c (SetWindowText):
added missing breaks; (PENSATE starts)
* windows/graphics.c (FloodFill):
Proper boundarys. (BANGBANG starts) FloodFile_rec should
be rewritten.
* objects/font.c (FONT_GetMetrics):
TYPO: use font->perchar only if it is defined. (WRITE starts)
Sun June 12, Peter Broadhurst (pbr@ua.nwl.ac.uk)
controls/scroll.c:
Fixes for improved behaviour when dragging thumb;
Added SB_THUMBPOSITION message when thumb is released.
diff --git a/controls/scroll.c b/controls/scroll.c
index af1d12d..e962e8c 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -1,8 +1,10 @@
-/*
+/*
* Interface code to SCROLLBAR widget
*
* Copyright Martin Ayotte, 1993
*
+ * Small fixes and implemented SB_THUMBPOSITION
+ * by Peter Broadhurst, 940611
*/
/*
@@ -58,6 +60,8 @@
RECT rect, rect2;
LPCREATESTRUCT lpCreat;
static RECT rectsel;
+ POINT *pt;
+ pt=(POINT*)&lParam;
switch(message) {
case WM_CREATE:
lpCreat = (LPCREATESTRUCT)lParam;
@@ -95,15 +99,15 @@
case WM_LBUTTONDOWN:
SetCapture(hWnd);
- ScrollBarButtonDown(hWnd, SB_CTL, LOWORD(lParam), HIWORD(lParam));
+ ScrollBarButtonDown(hWnd, SB_CTL, pt->x,pt->y);
break;
case WM_LBUTTONUP:
ReleaseCapture();
- ScrollBarButtonUp(hWnd, SB_CTL, LOWORD(lParam), HIWORD(lParam));
+ ScrollBarButtonUp(hWnd, SB_CTL, pt->x,pt->y);
break;
case WM_MOUSEMOVE:
- ScrollBarMouseMove(hWnd, SB_CTL, wParam, LOWORD(lParam), HIWORD(lParam));
+ ScrollBarMouseMove(hWnd, SB_CTL, wParam, pt->x,pt->y);
break;
case WM_KEYDOWN:
case WM_KEYUP:
@@ -297,7 +301,24 @@
printf("ScrollBarButtonUp // x=%d y=%d\n", x, y);
#endif
lphs = GetScrollObjectStruct(hWnd, nBar);
- lphs->ThumbActive = FALSE;
+ if(lphs->ThumbActive)
+ {
+ HWND hWndOwner,hWndParent;
+ if (nBar == SB_CTL) {
+ hWndParent = GetParent(hWnd);
+ hWndOwner = lphs->hWndOwner;
+ }
+ else {
+ hWndParent = hWnd;
+ hWndOwner = 0;
+ }
+
+
+ SendMessage(hWndParent, lphs->Direction,
+ SB_THUMBPOSITION, MAKELONG(lphs->ThumbVal, hWndOwner));
+ lphs->ThumbActive = FALSE;
+ }
+
if (lphs->ButtonDown != 0) {
lphs->ButtonDown = 0;
if (nBar == SB_CTL) {
@@ -337,21 +358,38 @@
printf("ScrollBarButtonMove SB_?SCROLL // x=%d y=%d\n", x, y);
#endif
}
- if (lphs->Direction == WM_VSCROLL) {
- int butsiz = lphs->rect.right - lphs->rect.left;
- y = y - butsiz - (butsiz >> 1);
- }
- else {
- int butsiz = lphs->rect.bottom - lphs->rect.top;
- y = x - butsiz - (butsiz >> 1);
- }
- x = (y * (lphs->MaxVal - lphs->MinVal) /
- lphs->MaxPix) + lphs->MinVal;
+
+ if(x<lphs->rect.left||x>lphs->rect.right||
+ y<lphs->rect.top||y>lphs->rect.bottom)
+ {
+
#ifdef DEBUG_SCROLL
- printf("Scroll WM_MOUSEMOVE val=%d pix=%d\n", x, y);
+ printf("Rejecting thumb position !\n");
+#endif
+ lphs->ThumbVal=lphs->CurVal;/*revert to last set position*/
+ }
+ else
+ {
+
+ if (lphs->Direction == WM_VSCROLL) {
+ int butsiz = lphs->rect.right - lphs->rect.left;
+ y = y - butsiz - (butsiz >> 1);
+ }
+ else {
+ int butsiz = lphs->rect.bottom - lphs->rect.top;
+ y = x - butsiz - (butsiz >> 1);
+ }
+ if(y<0)y=0;
+ if(y>lphs->MaxPix)y=lphs->MaxPix;
+ lphs->ThumbVal = (y * (lphs->MaxVal - lphs->MinVal) /
+ lphs->MaxPix) + lphs->MinVal;
+ }
+
+#ifdef DEBUG_SCROLL
+ printf("Scroll WM_MOUSEMOVE val=%d pix=%d\n", lphs->ThumbVal, y);
#endif
SendMessage(hWndParent, lphs->Direction,
- SB_THUMBTRACK, MAKELONG(x, hWndOwner));
+ SB_THUMBTRACK, MAKELONG(lphs->ThumbVal, hWndOwner));
}
@@ -442,9 +480,11 @@
lphs->rectDown.left = rect.right - w2;
}
if (lphs->MaxVal != lphs->MinVal)
- lphs->CurPix = lphs->MaxPix * (abs((short)lphs->CurVal) - abs(lphs->MinVal)) /
- (abs(lphs->MaxVal) - abs(lphs->MinVal));
+ lphs->CurPix = lphs->MaxPix * (lphs->CurVal - lphs->MinVal) /
+ (lphs->MaxVal - lphs->MinVal);
+ if(lphs->CurPix <0)lphs->CurPix=0;
if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix;
+
hMemDC = CreateCompatibleDC(hDC);
if (lphs->Direction == WM_VSCROLL) {
GetObject(hUpArrow, sizeof(BITMAP), (LPSTR)&bm);
@@ -597,6 +637,7 @@
lphs->rect.right = width;
lphs->hWndOwner = hWnd;
wndPtr->VScroll = lphs;
+ wndPtr->scroll_flags |= 0x0001;
if (wndPtr->dwStyle & WS_HSCROLL) height += SYSMETRICS_CYHSCROLL;
}
if (wndPtr->dwStyle & WS_HSCROLL) {
@@ -609,6 +650,7 @@
lphs->rect.bottom = height;
lphs->hWndOwner = hWnd;
wndPtr->HScroll = lphs;
+ wndPtr->scroll_flags |= 0x0002;
}
}
@@ -642,8 +684,10 @@
nRet = lphs->CurVal;
lphs->CurVal = (short)nPos;
if (lphs->MaxVal != lphs->MinVal)
- lphs->CurPix = lphs->MaxPix * (abs((short)nPos) - abs(lphs->MinVal)) /
- (abs(lphs->MaxVal) - abs(lphs->MinVal));
+ lphs->CurPix = lphs->MaxPix * (lphs->CurVal - lphs->MinVal) /
+ (lphs->MaxVal - lphs->MinVal);
+ if(lphs->CurPix <0)lphs->CurPix=0;
+
if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix;
#ifdef DEBUG_SCROLL
printf("SetScrollPos val=%d pixval=%d pixmax%d\n",
@@ -691,12 +735,15 @@
HDC hDC;
lphs = GetScrollObjectStruct(hWnd, nBar);
if (lphs == NULL) return;
+
+/* should a bad range be rejected here?
+ */
lphs->MinVal = (short)MinPos;
lphs->MaxVal = (short)MaxPos;
if (lphs->MaxVal != lphs->MinVal)
- lphs->CurPix = abs(lphs->MaxVal) *
- (abs(lphs->CurVal) - abs(lphs->MinVal)) /
- (abs(lphs->MaxVal) - abs(lphs->MinVal));
+ lphs->CurPix = lphs->MaxPix * (lphs->CurVal - lphs->MinVal) /
+ (lphs->MaxVal - lphs->MinVal);
+ if(lphs->CurPix <0)lphs->CurPix=0;
if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix;
#ifdef DEBUG_SCROLL
printf("SetScrollRange min=%d max=%d\n", lphs->MinVal, lphs->MaxVal);
@@ -737,32 +784,32 @@
*/
void ShowScrollBar(HWND hWnd, WORD wBar, BOOL bFlag)
{
- WND *wndPtr;
+ WND *wndPtr;
+ printf("ShowScrollBar hWnd=%04X wBar=%d bFlag=%d\n", hWnd, wBar, bFlag);
#ifdef DEBUG_SCROLL
- printf("ShowScrollBar hWnd=%04X wBar=%d bFlag=%d\n", hWnd, wBar, bFlag);
+ printf("ShowScrollBar hWnd=%04X wBar=%d bFlag=%d\n", hWnd, wBar, bFlag);
#endif
- if (wBar == SB_CTL) {
- if (bFlag)
- ShowWindow(hWnd, SW_SHOW);
- else
- ShowWindow(hWnd, SW_HIDE);
- return;
- }
- wndPtr = WIN_FindWndPtr(hWnd);
-/*
- if ((wBar == SB_VERT) || (wBar == SB_BOTH)) {
- if (bFlag)
- wndPtr->dwStyle |= WS_VSCROLL;
- else
- wndPtr->dwStyle &= 0xFFFFFFFFL ^ WS_VSCROLL;
- }
- if ((wBar == SB_HORZ) || (wBar == SB_BOTH)) {
- if (bFlag)
- wndPtr->dwStyle |= WS_HSCROLL;
- else
- wndPtr->dwStyle &= 0xFFFFFFFFL ^ WS_HSCROLL;
- }
-*/
+ if (wBar == SB_CTL) {
+ if (bFlag)
+ ShowWindow(hWnd, SW_SHOW);
+ else
+ ShowWindow(hWnd, SW_HIDE);
+ return;
+ }
+ wndPtr = WIN_FindWndPtr(hWnd);
+ if ((wBar == SB_VERT) || (wBar == SB_BOTH)) {
+ if (bFlag)
+ wndPtr->scroll_flags != 0x0001;
+ else
+ wndPtr->scroll_flags &= 0xFFFE;
+ }
+ if ((wBar == SB_HORZ) || (wBar == SB_BOTH)) {
+ if (bFlag)
+ wndPtr->scroll_flags != 0x0002;
+ else
+ wndPtr->scroll_flags &= 0xFFFD;
+ }
+ SetWindowPos(hWnd, 0, 0, 0, 0, 0,
+ SWP_NOZORDER | SWP_NOMOVE |
+ SWP_NOSIZE | SWP_FRAMECHANGED);
}
-
-