Release 980628
Sun Jun 28 18:37:02 1998 Alexandre Julliard <julliard@lrc.epfl.ch>
* [if1632/signal.c] [miscemu/instr.c] [memory/virtual.c]
Moved page-fault handling to INSTR_EmulateInstruction.
* [scheduler/thread.c]
Added locking and check for own thread in Suspend/ResumeThread.
Sat Jun 27 21:25:21 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de>
* [objects/dib.c] [objects/bitmap.c] [objects/oembitmap.c]
[graphics/x11drv/bitblt.c] [include/bitmap.h]
Improved DIB section handling using page fault handlers.
(Note: This patch includes code contributed by Matthew J. Francis.)
* [memory/virtual.c] [if1632/signal.c] [include/global.h]
Page Fault handler support added.
* [if1632/signal.c] [loader/signal.c] [tools/build.c] [misc/system.c]
[misc/winsock_dns.c] [include/sig_context.h] [include/thread.h]
16-bit %fs handling improved: Always preserve 16-bit %fs value,
always restore 32-bit %fs value for signal handlers.
* [if1632/thunk.c] [loader/module.c] [misc/callback.c] [windows/user.c]
[loader/ne/resource.c] [include/callback.h] [include/module.h]
[if1632/kernel.spec] [if1632/wprocs.spec]
Resource Handler function pointer stored as 16-bit SEGPTR.
* [loader/task.c] [windows/win.c] [windows/winpos.c] [if1632/user.spec]
[if1632/kernel.spec] [loader/ne/module.c]
Some minor incompatibilities fixed (Win32s relies on those):
GetExePtr, IsWindow16 should set ES on return; WINPOS_SendNCCalcSize
should cope with having the WINDOWPOS structure trashed;
the OFSTRUCT in the NE module image should be placed *last*.
* [include/windows.h]
Missing prototype for FlushViewOfFile.
* [loader/task.c]
Bugfix: Command line should *not* start with a blank.
* [loader/ne/segment.c]
Bugfix: Fixups to offset 0 were never applied.
* [misc/lstr.c]
Use debugstr_a in OutputDebugString16.
* [msdos/dpmi.c]
Stub for int 31 BL=2f AX=7a20 (NetWare: Get VLM Call Address) added.
* [msdos/int21.c]
Stub for int 21 AX=440d CL=6f (get drive map information) added.
Fri Jun 26 18:08:30 1998 Rein Klazes <rklazes@casema.net>
* [windows/winpos.c]
Fix small buglet that mixed up maximized and minimized windows.
* [include/x11drv.h] [objects/dc.c] [graphics/x11drv/pen.c]
[graphics/x11drv/graphics.c]
Fix some bugs with lines joining styles. Draws rectangles
with thick pens now correctly.
Fri Jun 26 16:22:23 1998 James Juran <jrj120@psu.edu>
* [misc/shell.c]
Fixed bug I introduced last release in InternalExtractIcon.
* [win32/file.c]
Added documentation for CreateFile32A.
* [documentation/wine.man]
Updated manpage.
* [ChangeLog]
Added my entry from last release.
Fri Jun 26 13:33:30 1998 Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>
* [graphics/psdrv/*] [if1632/wineps.spec] [include/psdrv.h]
[include/print.h] [objects/gdiobj.c]
First stages of an internal Postscript driver. See
graphics/psdrv/README . Should print text (badly) from win3.1 notepad,
write and winword6.
* [documentation/printing]
Some notes on printing.
* [controls/edit.c]
Strip off WS_BORDER in WM_NCREATE, edit draws its own rectangle.
EC_USEFONTINFO seems to be used as a left/right value for EM_SETMARGINS
and not as an action as the docs say. This actually makes more sense.
Scroll the caret back to zero after a WM_SETTEXT.
Fri Jun 26 10:56:25 1998 Marcus Meissner <marcus@jet.franken.de>
* [if1632/snoop.c]
Added win16 inter-dll snooping.
* [win32/ordinals.c]
KERNEL_485 is GetProcessDword.
* [include/xmalloc.h][include/bitmap.h][misc/xmalloc.c]
Added xcalloc so we 0 initialize XImages.
Fixes/Hides the 'junk around MOPYFish'.
* [misc/ntdll.c]
Some stubs added.
Thu Jun 25 15:22:43 1998 Adrian Harvey <adrian@select.com.au>
* [scheduler/thread.c]
Implemented SuspendThread and ResumeThread.
Thu Jun 25 00:55:03 1998 Peter Hunnisett <hunnise@nortel.ca>
* [include/debug.h,dplay.h,dsound.h][multimedia/dsound.c,dplay.c]
[relay32/dplayx.spec,dplay.spec][multimedia/Makefile.in]
[documentation/status/directplay]
Added preliminary support for DirectPlay & DirectPlayLobby. Moved the
preliminary stubs put in the dsound files into two new files
dplay.h and dplay.c.
Added new debug channel (dplay) for this.
Created new document to keep track of implementation.
* [include/winioctl.h][win32/device.c]
Added some framework in DeviceIoControl to, in the future, support
the "builtin" windows dwIoControlCodes. Added new header file
winioctl.h .
* [multimedia/mmsystem.c]
Added slightly improved debugging information for PlaySound.
Wed Jun 24 12:00:00 1998 Juergen Schmied <juergen.schmied@metronet.de>
* [files/profile.c][graphics/x11drv/xfont.c][loader/module.c]
Changed lstrcmpi32A to strcasecmp, lstrncmpi32A to strncasecmp,
lstrcpy32A to strcpy, lstrlen32A to strlen, lstrcmp32A to strcmp
because it's not necessary to support locale on such places.
It causes a huge overhead and even fails sometimes
* [include/oleauto.h][include/winerror.h]
Added some ole-related constants.
* [misc/shell.c]
SHELL32_DllGetClassObject, SHGetSpecialFolderLocation,
SHGetPathFromIDList improved the stubs
* [ole/folders.c]
IShellFolder* functions rewrote the stubs so don't crash and give
something sensible back, started implementation of.
* [ole/typelib.c][relay32/oleaut32.spec]
LoadTypeLib32, RegisterTypeLib stub.
* [ole/ole2nls.c]
Fixed a buffer overrun in CompareString32A.
Test for a bad pointer in LCMapString32A (happens
in winhlp32 while building a index for searching).
* [relay32/oleaut32.spec] [ole/typelib.c]
Added stub for LoadTypeLib (ole32) to make excel95 happy.
Tue Jun 23 22:47:09 1998 Alex Priem <alexp@sci.kun.nl>
* [files/profile.c] [relay32/kernel32.spec]
Added WritePrivateProfileStructA, GetPrivateProfileStructA,
GetPrivateProfileSectionNames16.
Tue Jun 23 01:34:43 1998 Pascal Cuoq <pcuoq@ens-lyon.fr>
* [ole/ole2nls.c]
GetStringTypeEx32A: Implemented CT_CTYPE2 and CT_CTYPE3 cases.
LCMapString32A: Map final '\0' for '\0'-terminated strings.
* [misc/shellord.c] [files/profile.c] [graphics/driver.c]
[loader/module.c] [msdos/int21.c] [windows/driver.c] [files/drive.c]
Changed lstrcmpi32A -> strcasecmp. Should be OK in these places.
Sat Jun 20 23:40:00 1998 Bertho Stultiens <bertho@akhphd.au.dk>
* [tools/wrc/]
Wrc version 1.0.2 (20-Jun-1998). Please revert to
the file tools/wrc/CHANGES for details.
Sat Jun 20 14:58:00 1998 Marcel Baur <mbaur@g26.ethz.ch>
* [ole/ole2nls.c] [ole/nls/*]
Added the first 57 nls files, most are not yet complete.
Wed Jun 17 11:16:54 1998 David Luyer <luyer@ucs.uwa.edu.au>
* [relay32/relay386.c] [if1632/relay.c]
Move debug_relay_(include|exclude)_list handling into
seperate function RELAY_ShowDebugmsgsRelay(). Include
checking of this for 16 bit calls (originally only
32-bit calls).
* [relay32/snoop.c] [misc/main.c]
Add debug_snoop_(include|exclude)_list as per the relay stuff.
Fix typo and add information on -debugmsg +/-relay=... in
help on -debugmsg. Refer to availability of snoop too.
Tue Jun 10 22:00:18 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de>
* [controls/header.c][include/header.h][include/commctrl.h]
Added owner draw support.
* [windows/nonclient.c][windows/sysmetics.c]
Fixed menu bar height for Win95 look.
Split NC_AdjustRect95() into NC_AdjustRectOuter95() and
NC_AdjustRectInner95 to fix a menu bar bug.
Improved Win95 look.
* [controls/progress.c]
Improved drawing code. Borders will be drawn by non-client code.
* [controls/updown.c]
Changed memory allocation and fixed some bugs.
* [controls/toolbar.c]
Fixed TB_BUTTONSTRUCTSIZE bug in MFC programs.
Several improvements.
* [misc/shell.c]
Added stub for BrowseForFoldersA().
* [misc/shellord.c]
Added stub for SHELL32_147().
* [controls/comctl32undoc.c]
Minor changes.
* [documentation/common_controls]
New File: Documentation about development status, undocumented
features and functions of the common controls.
diff --git a/controls/edit.c b/controls/edit.c
index d8407bc..acfef57 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -19,6 +19,7 @@
#include "resource.h"
#include "debug.h"
#include "callback.h"
+#include "tweak.h"
#define BUFLIMIT_MULTI 65534 /* maximum buffer size (not including '\0')
FIXME: BTW, new specs say 65535 (do you dare ???) */
@@ -177,6 +178,7 @@
static void EDIT_MoveWordForward(WND *wnd, EDITSTATE *es, BOOL32 extend);
static void EDIT_PaintLine(WND *wnd, EDITSTATE *es, HDC32 hdc, INT32 line, BOOL32 rev);
static INT32 EDIT_PaintText(WND *wnd, EDITSTATE *es, HDC32 hdc, INT32 x, INT32 y, INT32 line, INT32 col, INT32 count, BOOL32 rev);
+static void EDIT_SetCaretPos(WND *wnd, EDITSTATE *es, INT32 pos, BOOL32 after_wrap);
static void EDIT_SetRectNP(WND *wnd, EDITSTATE *es, LPRECT32 lprc);
static void EDIT_UnlockBuffer(WND *wnd, EDITSTATE *es, BOOL32 force);
static INT32 EDIT_WordBreakProc(LPSTR s, INT32 index, INT32 count, INT32 action);
@@ -216,7 +218,7 @@
static void EDIT_WM_Command(WND *wnd, EDITSTATE *es, INT32 code, INT32 id, HWND32 conrtol);
static void EDIT_WM_ContextMenu(WND *wnd, EDITSTATE *es, HWND32 hwnd, INT32 x, INT32 y);
static void EDIT_WM_Copy(WND *wnd, EDITSTATE *es);
-static LRESULT EDIT_WM_Create(WND *wnd, LPCREATESTRUCT32A cs);
+static LRESULT EDIT_WM_Create(WND *wnd, EDITSTATE *es, LPCREATESTRUCT32A cs);
static void EDIT_WM_Destroy(WND *wnd, EDITSTATE *es);
static LRESULT EDIT_WM_EraseBkGnd(WND *wnd, EDITSTATE *es, HDC32 dc);
static INT32 EDIT_WM_GetText(WND *wnd, EDITSTATE *es, INT32 count, LPSTR text);
@@ -227,6 +229,7 @@
static LRESULT EDIT_WM_LButtonDown(WND *wnd, EDITSTATE *es, DWORD keys, INT32 x, INT32 y);
static LRESULT EDIT_WM_LButtonUp(WND *wnd, EDITSTATE *es, DWORD keys, INT32 x, INT32 y);
static LRESULT EDIT_WM_MouseMove(WND *wnd, EDITSTATE *es, DWORD keys, INT32 x, INT32 y);
+static LRESULT EDIT_WM_NCCreate(WND *wnd, LPCREATESTRUCT32A cs);
static void EDIT_WM_Paint(WND *wnd, EDITSTATE *es);
static void EDIT_WM_Paste(WND *wnd, EDITSTATE *es);
static void EDIT_WM_SetFocus(WND *wnd, EDITSTATE *es, HWND32 window_losing_focus);
@@ -305,14 +308,14 @@
LRESULT result = 0;
switch (msg) {
- case WM_CREATE:
- DPRINTF_EDIT_MSG32("WM_CREATE");
- return EDIT_WM_Create(wnd, (LPCREATESTRUCT32A)lParam);
-
case WM_DESTROY:
DPRINTF_EDIT_MSG32("WM_DESTROY");
EDIT_WM_Destroy(wnd, es);
return 0;
+
+ case WM_NCCREATE:
+ DPRINTF_EDIT_MSG32("WM_NCCREATE");
+ return EDIT_WM_NCCreate(wnd, (LPCREATESTRUCT32A)lParam);
}
if (!es)
@@ -718,6 +721,11 @@
EDIT_WM_Copy(wnd, es);
break;
+ case WM_CREATE:
+ DPRINTF_EDIT_MSG32("WM_CREATE");
+ result = EDIT_WM_Create(wnd, es, (LPCREATESTRUCT32A)lParam);
+ break;
+
case WM_CUT:
DPRINTF_EDIT_MSG32("WM_CUT");
EDIT_WM_Cut(wnd, es);
@@ -1721,67 +1729,26 @@
/*********************************************************************
*
- * EM_SCROLLCARET
+ * EDIT_SetCaretPos
*
*/
-static void EDIT_EM_ScrollCaret(WND *wnd, EDITSTATE *es)
+static void EDIT_SetCaretPos(WND *wnd, EDITSTATE *es, INT32 pos,
+ BOOL32 after_wrap)
{
- if (es->style & ES_MULTILINE) {
- INT32 l;
- INT32 li;
- INT32 vlc;
- INT32 ww;
- INT32 cw = es->char_width;
- INT32 x;
- INT32 dy = 0;
- INT32 dx = 0;
+ LRESULT res = EDIT_EM_PosFromChar(wnd, es, pos, after_wrap);
+ INT32 x = SLOWORD(res);
+ INT32 y = SHIWORD(res);
- l = EDIT_EM_LineFromChar(wnd, es, es->selection_end);
- li = EDIT_EM_LineIndex(wnd, es, l);
- x = SLOWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP));
- vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
- if (l >= es->y_offset + vlc)
- dy = l - vlc + 1 - es->y_offset;
- if (l < es->y_offset)
- dy = l - es->y_offset;
- ww = es->format_rect.right - es->format_rect.left;
- if (x < es->format_rect.left)
- dx = x - es->format_rect.left - ww / HSCROLL_FRACTION / cw * cw;
- if (x > es->format_rect.right)
- dx = x - es->format_rect.left - (HSCROLL_FRACTION - 1) * ww / HSCROLL_FRACTION / cw * cw;
- if (dy || dx)
- EDIT_EM_LineScroll(wnd, es, dx, dy);
- } else {
- INT32 x;
- INT32 goal;
- INT32 format_width;
-
- if (!(es->style & ES_AUTOHSCROLL))
- return;
-
- x = SLOWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, FALSE));
- format_width = es->format_rect.right - es->format_rect.left;
- if (x < es->format_rect.left) {
- goal = es->format_rect.left + format_width / HSCROLL_FRACTION;
- do {
- es->x_offset--;
- x = SLOWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, FALSE));
- } while ((x < goal) && es->x_offset);
- /* FIXME: use ScrollWindow() somehow to improve performance */
- InvalidateRect32(wnd->hwndSelf, NULL, TRUE);
- } else if (x > es->format_rect.right) {
- INT32 x_last;
- INT32 len = lstrlen32A(es->text);
- goal = es->format_rect.right - format_width / HSCROLL_FRACTION;
- do {
- es->x_offset++;
- x = SLOWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, FALSE));
- x_last = SLOWORD(EDIT_EM_PosFromChar(wnd, es, len, FALSE));
- } while ((x > goal) && (x_last > es->format_rect.right));
- /* FIXME: use ScrollWindow() somehow to improve performance */
- InvalidateRect32(wnd->hwndSelf, NULL, TRUE);
- }
- }
+ if(x < es->format_rect.left)
+ x = es->format_rect.left;
+ if(x > es->format_rect.right - 2)
+ x = es->format_rect.right - 2;
+ if(y > es->format_rect.bottom)
+ y = es->format_rect.bottom;
+ if(y < es->format_rect.top)
+ y = es->format_rect.top;
+ SetCaretPos32(x, y);
+ return;
}
@@ -1798,6 +1765,8 @@
CopyRect32(&es->format_rect, rc);
if (es->style & WS_BORDER) {
INT32 bw = GetSystemMetrics32(SM_CXBORDER) + 1;
+ if(!TWEAK_Win95Look)
+ bw += 2;
es->format_rect.left += bw;
es->format_rect.top += bw;
es->format_rect.right -= bw;
@@ -2496,6 +2465,72 @@
/*********************************************************************
*
+ * EM_SCROLLCARET
+ *
+ */
+static void EDIT_EM_ScrollCaret(WND *wnd, EDITSTATE *es)
+{
+ if (es->style & ES_MULTILINE) {
+ INT32 l;
+ INT32 li;
+ INT32 vlc;
+ INT32 ww;
+ INT32 cw = es->char_width;
+ INT32 x;
+ INT32 dy = 0;
+ INT32 dx = 0;
+
+ l = EDIT_EM_LineFromChar(wnd, es, es->selection_end);
+ li = EDIT_EM_LineIndex(wnd, es, l);
+ x = SLOWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP));
+ vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
+ if (l >= es->y_offset + vlc)
+ dy = l - vlc + 1 - es->y_offset;
+ if (l < es->y_offset)
+ dy = l - es->y_offset;
+ ww = es->format_rect.right - es->format_rect.left;
+ if (x < es->format_rect.left)
+ dx = x - es->format_rect.left - ww / HSCROLL_FRACTION / cw * cw;
+ if (x > es->format_rect.right)
+ dx = x - es->format_rect.left - (HSCROLL_FRACTION - 1) * ww / HSCROLL_FRACTION / cw * cw;
+ if (dy || dx)
+ EDIT_EM_LineScroll(wnd, es, dx, dy);
+ } else {
+ INT32 x;
+ INT32 goal;
+ INT32 format_width;
+
+ if (!(es->style & ES_AUTOHSCROLL))
+ return;
+
+ x = SLOWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, FALSE));
+ format_width = es->format_rect.right - es->format_rect.left;
+ if (x < es->format_rect.left) {
+ goal = es->format_rect.left + format_width / HSCROLL_FRACTION;
+ do {
+ es->x_offset--;
+ x = SLOWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, FALSE));
+ } while ((x < goal) && es->x_offset);
+ /* FIXME: use ScrollWindow() somehow to improve performance */
+ InvalidateRect32(wnd->hwndSelf, NULL, TRUE);
+ } else if (x > es->format_rect.right) {
+ INT32 x_last;
+ INT32 len = lstrlen32A(es->text);
+ goal = es->format_rect.right - format_width / HSCROLL_FRACTION;
+ do {
+ es->x_offset++;
+ x = SLOWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, FALSE));
+ x_last = SLOWORD(EDIT_EM_PosFromChar(wnd, es, len, FALSE));
+ } while ((x > goal) && (x_last > es->format_rect.right));
+ /* FIXME: use ScrollWindow() somehow to improve performance */
+ InvalidateRect32(wnd->hwndSelf, NULL, TRUE);
+ }
+ }
+}
+
+
+/*********************************************************************
+ *
* EM_SETHANDLE
*
* FIXME: ES_LOWERCASE, ES_UPPERCASE, ES_OEMCONVERT, ES_NUMBER ???
@@ -2607,24 +2642,33 @@
/*********************************************************************
*
* EM_SETMARGINS
+ *
+ * EC_USEFONTINFO is used as a left or right value i.e. lParam and not as an
+ * action wParam despite what the docs say. It also appears not to affect
+ * multiline controls??
*
*/
-static void EDIT_EM_SetMargins(WND *wnd, EDITSTATE *es, INT32 action, INT32 left, INT32 right)
+static void EDIT_EM_SetMargins(WND *wnd, EDITSTATE *es, INT32 action,
+ INT32 left, INT32 right)
{
- if (action & EC_USEFONTINFO) {
- if (es->style & ES_MULTILINE) {
- /*
- * FIXME: do some GetABCCharWidth, or so
- * This is just preliminary
- */
- es->left_margin = es->right_margin = es->char_width/4;
- } else
- es->left_margin = es->right_margin = es->char_width/4;
- } else {
- if (action & EC_LEFTMARGIN)
+ if (action & EC_LEFTMARGIN) {
+ if (left != EC_USEFONTINFO)
es->left_margin = left;
- if (action & EC_RIGHTMARGIN)
- es->right_margin = right;
+ else
+ if (es->style & ES_MULTILINE)
+ es->left_margin = 0; /* ?? */
+ else
+ es->left_margin = es->char_width;
+ }
+
+ if (action & EC_RIGHTMARGIN) {
+ if (right != EC_USEFONTINFO)
+ es->right_margin = right;
+ else
+ if (es->style & ES_MULTILINE)
+ es->right_margin = 0; /* ?? */
+ else
+ es->right_margin = es->char_width;
}
TRACE(edit, "left=%d, right=%d\n", es->left_margin, es->right_margin);
}
@@ -2683,10 +2727,8 @@
es->flags |= EF_AFTER_WRAP;
else
es->flags &= ~EF_AFTER_WRAP;
- if (es->flags & EF_FOCUSED) {
- LRESULT pos = EDIT_EM_PosFromChar(wnd, es, end, after_wrap);
- SetCaretPos32(SLOWORD(pos), SHIWORD(pos));
- }
+ if (es->flags & EF_FOCUSED)
+ EDIT_SetCaretPos(wnd, es, end, after_wrap);
/* This is little bit more efficient than before, not sure if it can be improved. FIXME? */
ORDER_UINT32(start, end);
ORDER_UINT32(end, old_end);
@@ -2976,70 +3018,8 @@
* WM_CREATE
*
*/
-static LRESULT EDIT_WM_Create(WND *wnd, LPCREATESTRUCT32A cs)
+static LRESULT EDIT_WM_Create(WND *wnd, EDITSTATE *es, LPCREATESTRUCT32A cs)
{
- EDITSTATE *es;
-
- if (!(es = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*es))))
- return -1;
- *(EDITSTATE **)wnd->wExtra = es;
- if (!(es->heap = HeapCreate(0, 0x10000, 0)))
- return -1;
- es->style = cs->style;
-
- /* remove the WS_CAPTION style if it has been set - this is really a */
- /* pseudo option made from a combination of WS_BORDER and WS_DLGFRAME */
- if ((es->style & WS_BORDER) && (es->style & WS_DLGFRAME))
- es->style ^= WS_DLGFRAME;
-
- if (es->style & ES_MULTILINE) {
- es->buffer_size = BUFSTART_MULTI;
- es->buffer_limit = BUFLIMIT_MULTI;
- if (es->style & WS_VSCROLL)
- es->style |= ES_AUTOVSCROLL;
- if (es->style & WS_HSCROLL)
- es->style |= ES_AUTOHSCROLL;
- es->style &= ~ES_PASSWORD;
- if ((es->style & ES_CENTER) || (es->style & ES_RIGHT)) {
- if (es->style & ES_RIGHT)
- es->style &= ~ES_CENTER;
- es->style &= ~WS_HSCROLL;
- es->style &= ~ES_AUTOHSCROLL;
- }
-
- /* FIXME: for now, all multi line controls are AUTOVSCROLL */
- es->style |= ES_AUTOVSCROLL;
- } else {
- es->buffer_size = BUFSTART_SINGLE;
- es->buffer_limit = BUFLIMIT_SINGLE;
- es->style &= ~ES_CENTER;
- es->style &= ~ES_RIGHT;
- es->style &= ~WS_HSCROLL;
- es->style &= ~WS_VSCROLL;
- es->style &= ~ES_AUTOVSCROLL;
- es->style &= ~ES_WANTRETURN;
- if (es->style & ES_UPPERCASE) {
- es->style &= ~ES_LOWERCASE;
- es->style &= ~ES_NUMBER;
- } else if (es->style & ES_LOWERCASE)
- es->style &= ~ES_NUMBER;
- if (es->style & ES_PASSWORD)
- es->password_char = '*';
-
- /* FIXME: for now, all single line controls are AUTOHSCROLL */
- es->style |= ES_AUTOHSCROLL;
- }
- if (!(es->text = HeapAlloc(es->heap, 0, es->buffer_size + 1)))
- return -1;
- es->buffer_size = HeapSize(es->heap, 0, es->text) - 1;
- if (!(es->undo_text = HeapAlloc(es->heap, 0, es->buffer_size + 1)))
- return -1;
- es->undo_buffer_size = HeapSize(es->heap, 0, es->undo_text) - 1;
- *es->text = '\0';
- if (es->style & ES_MULTILINE)
- if (!(es->first_line_def = HeapAlloc(es->heap, HEAP_ZERO_MEMORY, sizeof(LINEDEF))))
- return -1;
- es->line_count = 1;
/*
* To initialize some final structure members, we call some helper
* functions. However, since the EDITSTATE is not consistent (i.e.
@@ -3547,6 +3527,78 @@
/*********************************************************************
*
+ * WM_NCCREATE
+ *
+ */
+static LRESULT EDIT_WM_NCCreate(WND *wnd, LPCREATESTRUCT32A cs)
+{
+ EDITSTATE *es;
+
+ if (!(es = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*es))))
+ return FALSE;
+ *(EDITSTATE **)wnd->wExtra = es;
+ if (!(es->heap = HeapCreate(0, 0x10000, 0)))
+ return FALSE;
+ es->style = cs->style;
+
+ if ((es->style & WS_BORDER) && !(es->style & WS_DLGFRAME))
+ SetWindowLong32A(wnd->hwndSelf, GWL_STYLE,
+ es->style & ~WS_BORDER);
+
+ if (es->style & ES_MULTILINE) {
+ es->buffer_size = BUFSTART_MULTI;
+ es->buffer_limit = BUFLIMIT_MULTI;
+ if (es->style & WS_VSCROLL)
+ es->style |= ES_AUTOVSCROLL;
+ if (es->style & WS_HSCROLL)
+ es->style |= ES_AUTOHSCROLL;
+ es->style &= ~ES_PASSWORD;
+ if ((es->style & ES_CENTER) || (es->style & ES_RIGHT)) {
+ if (es->style & ES_RIGHT)
+ es->style &= ~ES_CENTER;
+ es->style &= ~WS_HSCROLL;
+ es->style &= ~ES_AUTOHSCROLL;
+ }
+
+ /* FIXME: for now, all multi line controls are AUTOVSCROLL */
+ es->style |= ES_AUTOVSCROLL;
+ } else {
+ es->buffer_size = BUFSTART_SINGLE;
+ es->buffer_limit = BUFLIMIT_SINGLE;
+ es->style &= ~ES_CENTER;
+ es->style &= ~ES_RIGHT;
+ es->style &= ~WS_HSCROLL;
+ es->style &= ~WS_VSCROLL;
+ es->style &= ~ES_AUTOVSCROLL;
+ es->style &= ~ES_WANTRETURN;
+ if (es->style & ES_UPPERCASE) {
+ es->style &= ~ES_LOWERCASE;
+ es->style &= ~ES_NUMBER;
+ } else if (es->style & ES_LOWERCASE)
+ es->style &= ~ES_NUMBER;
+ if (es->style & ES_PASSWORD)
+ es->password_char = '*';
+
+ /* FIXME: for now, all single line controls are AUTOHSCROLL */
+ es->style |= ES_AUTOHSCROLL;
+ }
+ if (!(es->text = HeapAlloc(es->heap, 0, es->buffer_size + 1)))
+ return FALSE;
+ es->buffer_size = HeapSize(es->heap, 0, es->text) - 1;
+ if (!(es->undo_text = HeapAlloc(es->heap, 0, es->buffer_size + 1)))
+ return FALSE;
+ es->undo_buffer_size = HeapSize(es->heap, 0, es->undo_text) - 1;
+ *es->text = '\0';
+ if (es->style & ES_MULTILINE)
+ if (!(es->first_line_def = HeapAlloc(es->heap, HEAP_ZERO_MEMORY, sizeof(LINEDEF))))
+ return FALSE;
+ es->line_count = 1;
+
+ return TRUE;
+}
+
+/*********************************************************************
+ *
* WM_PAINT
*
*/
@@ -3559,7 +3611,6 @@
RECT32 rc;
RECT32 rcLine;
RECT32 rcRgn;
- LRESULT pos;
BOOL32 rev = IsWindowEnabled32(wnd->hwndSelf) &&
((es->flags & EF_FOCUSED) ||
(es->style & ES_NOHIDESEL));
@@ -3568,6 +3619,14 @@
EDIT_NOTIFY_PARENT(wnd, EN_UPDATE, "EN_UPDATE");
dc = BeginPaint32(wnd->hwndSelf, &ps);
+ if(es->style & WS_BORDER) {
+ GetClientRect32(wnd->hwndSelf, &rc);
+ if(es->style & ES_MULTILINE) {
+ if(es->style & WS_HSCROLL) rc.bottom++;
+ if(es->style & WS_VSCROLL) rc.right++;
+ }
+ Rectangle32(dc, rc.left, rc.top, rc.right, rc.bottom);
+ }
IntersectClipRect32(dc, es->format_rect.left,
es->format_rect.top,
es->format_rect.right,
@@ -3596,10 +3655,9 @@
}
if (es->font)
SelectObject32(dc, old_font);
- if (es->flags & EF_FOCUSED) {
- pos = EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP);
- SetCaretPos32(SLOWORD(pos), SHIWORD(pos));
- }
+ if (es->flags & EF_FOCUSED)
+ EDIT_SetCaretPos(wnd, es, es->selection_end,
+ es->flags & EF_AFTER_WRAP);
EndPaint32(wnd->hwndSelf, &ps);
if ((es->style & WS_VSCROLL) && !(es->flags & EF_VSCROLL_TRACK)) {
INT32 vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
@@ -3661,12 +3719,10 @@
*/
static void EDIT_WM_SetFocus(WND *wnd, EDITSTATE *es, HWND32 window_losing_focus)
{
- LRESULT pos;
-
es->flags |= EF_FOCUSED;
CreateCaret32(wnd->hwndSelf, 0, 2, es->line_height);
- pos = EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP);
- SetCaretPos32(SLOWORD(pos), SHIWORD(pos));
+ EDIT_SetCaretPos(wnd, es, es->selection_end,
+ es->flags & EF_AFTER_WRAP);
if(!(es->style & ES_NOHIDESEL))
EDIT_InvalidateText(wnd, es, es->selection_start, es->selection_end);
ShowCaret32(wnd->hwndSelf);
@@ -3678,6 +3734,10 @@
*
* WM_SETFONT
*
+ * With Win95 look the margins are set to default font value unless
+ * the system font (font == 0) is being set, in which case they are left
+ * unchanged.
+ *
*/
static void EDIT_WM_SetFont(WND *wnd, EDITSTATE *es, HFONT32 font, BOOL32 redraw)
{
@@ -3695,18 +3755,23 @@
if (font)
SelectObject32(dc, old_font);
ReleaseDC32(wnd->hwndSelf, dc);
- if (wnd->flags & WIN_ISWIN32)
- EDIT_EM_SetMargins(wnd, es, EC_USEFONTINFO, 0, 0);
+ if (font & TWEAK_Win95Look)
+ EDIT_EM_SetMargins(wnd, es, EC_LEFTMARGIN | EC_RIGHTMARGIN,
+ EC_USEFONTINFO, EC_USEFONTINFO);
if (es->style & ES_MULTILINE)
EDIT_BuildLineDefs_ML(wnd, es);
+ else {
+ RECT32 r;
+ GetClientRect32(wnd->hwndSelf, &r);
+ EDIT_SetRectNP(wnd, es, &r);
+ }
if (redraw)
InvalidateRect32(wnd->hwndSelf, NULL, TRUE);
if (es->flags & EF_FOCUSED) {
- LRESULT pos;
DestroyCaret32();
CreateCaret32(wnd->hwndSelf, 0, 2, es->line_height);
- pos = EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP);
- SetCaretPos32(SLOWORD(pos), SHIWORD(pos));
+ EDIT_SetCaretPos(wnd, es, es->selection_end,
+ es->flags & EF_AFTER_WRAP);
ShowCaret32(wnd->hwndSelf);
}
}
@@ -3723,10 +3788,14 @@
if (text) {
TRACE(edit, "\t'%s'\n", text);
EDIT_EM_ReplaceSel(wnd, es, FALSE, text);
- es->x_offset = 0;
+ } else {
+ TRACE(edit, "\t<NULL>\n");
+ EDIT_EM_ReplaceSel(wnd, es, FALSE, "");
}
+ es->x_offset = 0;
es->flags |= EF_MODIFIED;
es->flags |= EF_UPDATE;
+ EDIT_EM_SetSel(wnd, es, 0, 0, FALSE);
EDIT_EM_ScrollCaret(wnd, es);
}