Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
e6fedf87
Commit
e6fedf87
authored
Jan 14, 2009
by
Dylan Smith
Committed by
Alexandre Julliard
Jan 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: Implemented the horizontal scrollbar.
parent
01ee55a8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
139 additions
and
72 deletions
+139
-72
caret.c
dlls/riched20/caret.c
+36
-31
editor.c
dlls/riched20/editor.c
+83
-30
editor.h
dlls/riched20/editor.h
+6
-3
editstr.h
dlls/riched20/editstr.h
+4
-3
paint.c
dlls/riched20/paint.c
+0
-0
editor.c
dlls/riched20/tests/editor.c
+0
-3
wrap.c
dlls/riched20/wrap.c
+10
-2
No files found.
dlls/riched20/caret.c
View file @
e6fedf87
...
...
@@ -168,7 +168,7 @@ ME_GetCursorCoordinates(ME_TextEditor *editor, ME_Cursor *pCursor,
assert
(
!
(
ME_GetParagraph
(
pCursorRun
)
->
member
.
para
.
nFlags
&
MEPF_REWRAP
));
assert
(
pCursor
->
pRun
);
assert
(
pCursor
->
pRun
->
type
==
diRun
);
if
(
pCursorRun
->
type
==
diRun
)
{
ME_DisplayItem
*
row
=
ME_FindItemBack
(
pCursorRun
,
diStartRowOrParagraph
);
...
...
@@ -178,9 +178,9 @@ ME_GetCursorCoordinates(ME_TextEditor *editor, ME_Cursor *pCursor,
ME_DisplayItem
*
run
=
pCursorRun
;
ME_DisplayItem
*
para
=
NULL
;
SIZE
sz
=
{
0
,
0
};
ME_InitContext
(
&
c
,
editor
,
hDC
);
if
(
!
pCursor
->
nOffset
)
{
ME_DisplayItem
*
prev
=
ME_FindItemBack
(
pCursorRun
,
diRunOrParagraph
);
...
...
@@ -192,7 +192,7 @@ ME_GetCursorCoordinates(ME_TextEditor *editor, ME_Cursor *pCursor,
para
=
ME_FindItemBack
(
row
,
diParagraph
);
assert
(
para
);
assert
(
para
->
type
==
diParagraph
);
if
(
editor
->
bCaretAtEnd
&&
!
pCursor
->
nOffset
&&
if
(
editor
->
bCaretAtEnd
&&
!
pCursor
->
nOffset
&&
run
==
ME_FindItemFwd
(
row
,
diRun
))
{
ME_DisplayItem
*
tmp
=
ME_FindItemBack
(
row
,
diRunOrParagraph
);
...
...
@@ -214,9 +214,9 @@ ME_GetCursorCoordinates(ME_TextEditor *editor, ME_Cursor *pCursor,
}
*
height
=
pSizeRun
->
member
.
run
.
nAscent
+
pSizeRun
->
member
.
run
.
nDescent
;
*
x
=
c
.
rcView
.
left
+
run
->
member
.
run
.
pt
.
x
+
sz
.
cx
;
*
x
=
c
.
rcView
.
left
+
run
->
member
.
run
.
pt
.
x
+
sz
.
cx
-
editor
->
horz_si
.
nPos
;
*
y
=
c
.
rcView
.
top
+
para
->
member
.
para
.
pt
.
y
+
row
->
member
.
row
.
nBaseline
+
run
->
member
.
run
.
pt
.
y
-
pSizeRun
->
member
.
run
.
nAscent
-
ME_GetYScrollPos
(
editor
)
;
+
run
->
member
.
run
.
pt
.
y
-
pSizeRun
->
member
.
run
.
nAscent
-
editor
->
vert_si
.
nPos
;
ME_DestroyContext
(
&
c
,
editor
->
hWnd
);
return
;
}
...
...
@@ -1025,7 +1025,8 @@ int ME_CharFromPos(ME_TextEditor *editor, int x, int y, BOOL *isExact)
if
(
isExact
)
*
isExact
=
FALSE
;
return
-
1
;
}
y
+=
ME_GetYScrollPos
(
editor
);
x
+=
editor
->
horz_si
.
nPos
;
y
+=
editor
->
vert_si
.
nPos
;
bResult
=
ME_FindPixelPos
(
editor
,
x
,
y
,
&
cursor
,
NULL
);
if
(
isExact
)
*
isExact
=
bResult
;
return
(
ME_GetParagraph
(
cursor
.
pRun
)
->
member
.
para
.
nCharOfs
...
...
@@ -1099,10 +1100,11 @@ void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum)
ME_Cursor
tmp_cursor
;
int
is_selection
=
0
;
BOOL
is_shift
;
editor
->
nUDArrowX
=
-
1
;
y
+=
ME_GetYScrollPos
(
editor
);
x
+=
editor
->
horz_si
.
nPos
;
y
+=
editor
->
vert_si
.
nPos
;
tmp_cursor
=
editor
->
pCursors
[
0
];
is_selection
=
ME_IsSelection
(
editor
);
...
...
@@ -1161,10 +1163,11 @@ void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum)
void
ME_MouseMove
(
ME_TextEditor
*
editor
,
int
x
,
int
y
)
{
ME_Cursor
tmp_cursor
;
if
(
editor
->
nSelectionType
==
stDocument
)
return
;
y
+=
ME_GetYScrollPos
(
editor
);
x
+=
editor
->
horz_si
.
nPos
;
y
+=
editor
->
vert_si
.
nPos
;
tmp_cursor
=
editor
->
pCursors
[
0
];
/* FIXME: do something with the return value of ME_FindPixelPos */
...
...
@@ -1179,9 +1182,9 @@ void ME_MouseMove(ME_TextEditor *editor, int x, int y)
{
/* The scroll the cursor towards the other end, since it was the one
* extended by ME_ExtendAnchorSelection */
ME_EnsureVisible
(
editor
,
editor
->
pCursors
[
1
].
pRun
);
ME_EnsureVisible
(
editor
,
&
editor
->
pCursors
[
1
]
);
}
else
{
ME_EnsureVisible
(
editor
,
editor
->
pCursors
[
0
].
pRun
);
ME_EnsureVisible
(
editor
,
&
editor
->
pCursors
[
0
]
);
}
ME_InvalidateSelection
(
editor
);
...
...
@@ -1367,18 +1370,18 @@ static void ME_ArrowPageUp(ME_TextEditor *editor, ME_Cursor *pCursor)
ME_DisplayItem
*
pLast
,
*
p
;
int
x
,
y
,
ys
,
yd
,
yp
,
yprev
;
ME_Cursor
tmp_curs
=
*
pCursor
;
x
=
ME_GetXForArrow
(
editor
,
pCursor
);
if
(
!
pCursor
->
nOffset
&&
editor
->
bCaretAtEnd
)
pRun
=
ME_FindItemBack
(
pRun
,
diRun
);
p
=
ME_FindItemBack
(
pRun
,
diStartRowOrParagraph
);
assert
(
p
->
type
==
diStartRow
);
yp
=
ME_FindItemBack
(
p
,
diParagraph
)
->
member
.
para
.
pt
.
y
;
yprev
=
ys
=
y
=
yp
+
p
->
member
.
row
.
pt
.
y
;
yd
=
y
-
editor
->
sizeWindow
.
cy
;
pLast
=
p
;
do
{
p
=
ME_FindItemBack
(
p
,
diStartRowOrParagraph
);
if
(
!
p
)
...
...
@@ -1395,15 +1398,16 @@ static void ME_ArrowPageUp(ME_TextEditor *editor, ME_Cursor *pCursor)
pLast
=
p
;
yprev
=
y
;
}
while
(
1
);
pCursor
->
pRun
=
ME_FindRunInRow
(
editor
,
pLast
,
x
,
&
pCursor
->
nOffset
,
&
editor
->
bCaretAtEnd
);
ME_UpdateSelection
(
editor
,
&
tmp_curs
);
if
(
yprev
<
editor
->
sizeWindow
.
cy
)
{
ME_EnsureVisible
(
editor
,
ME_FindItemFwd
(
editor
->
pBuffer
->
pFirst
,
diRun
));
ME_Cursor
startCursor
=
{
ME_FindItemFwd
(
editor
->
pBuffer
->
pFirst
,
diRun
),
0
};
ME_EnsureVisible
(
editor
,
&
startCursor
);
ME_Repaint
(
editor
);
}
else
else
{
ME_ScrollUp
(
editor
,
ys
-
yprev
);
}
...
...
@@ -1422,18 +1426,18 @@ static void ME_ArrowPageDown(ME_TextEditor *editor, ME_Cursor *pCursor)
ME_DisplayItem
*
pLast
,
*
p
;
int
x
,
y
,
ys
,
yd
,
yp
,
yprev
;
ME_Cursor
tmp_curs
=
*
pCursor
;
x
=
ME_GetXForArrow
(
editor
,
pCursor
);
if
(
!
pCursor
->
nOffset
&&
editor
->
bCaretAtEnd
)
pRun
=
ME_FindItemBack
(
pRun
,
diRun
);
p
=
ME_FindItemBack
(
pRun
,
diStartRowOrParagraph
);
assert
(
p
->
type
==
diStartRow
);
yp
=
ME_FindItemBack
(
p
,
diParagraph
)
->
member
.
para
.
pt
.
y
;
yprev
=
ys
=
y
=
yp
+
p
->
member
.
row
.
pt
.
y
;
yd
=
y
+
editor
->
sizeWindow
.
cy
;
pLast
=
p
;
do
{
p
=
ME_FindItemFwd
(
p
,
diStartRowOrParagraph
);
if
(
!
p
)
...
...
@@ -1448,15 +1452,16 @@ static void ME_ArrowPageDown(ME_TextEditor *editor, ME_Cursor *pCursor)
pLast
=
p
;
yprev
=
y
;
}
while
(
1
);
pCursor
->
pRun
=
ME_FindRunInRow
(
editor
,
pLast
,
x
,
&
pCursor
->
nOffset
,
&
editor
->
bCaretAtEnd
);
ME_UpdateSelection
(
editor
,
&
tmp_curs
);
if
(
yprev
>=
editor
->
nTotalLength
-
editor
->
sizeWindow
.
cy
)
{
ME_EnsureVisible
(
editor
,
ME_FindItemBack
(
editor
->
pBuffer
->
pLast
,
diRun
));
ME_Cursor
endCursor
=
{
ME_FindItemBack
(
editor
->
pBuffer
->
pLast
,
diRun
),
0
};
ME_EnsureVisible
(
editor
,
&
endCursor
);
ME_Repaint
(
editor
);
}
else
else
{
ME_ScrollUp
(
editor
,
ys
-
yprev
);
}
...
...
@@ -1593,7 +1598,7 @@ ME_ArrowKey(ME_TextEditor *editor, int nVKey, BOOL extend, BOOL ctrl)
ME_Cursor
*
p
=
&
editor
->
pCursors
[
nCursor
];
ME_Cursor
tmp_curs
=
*
p
;
BOOL
success
=
FALSE
;
ME_CheckCharOffsets
(
editor
);
switch
(
nVKey
)
{
case
VK_LEFT
:
...
...
@@ -1630,22 +1635,22 @@ ME_ArrowKey(ME_TextEditor *editor, int nVKey, BOOL extend, BOOL ctrl)
editor
->
bCaretAtEnd
=
0
;
break
;
}
case
VK_END
:
case
VK_END
:
if
(
ctrl
)
ME_ArrowCtrlEnd
(
editor
,
&
tmp_curs
);
else
ME_ArrowEnd
(
editor
,
&
tmp_curs
);
break
;
}
if
(
!
extend
)
editor
->
pCursors
[
1
]
=
tmp_curs
;
*
p
=
tmp_curs
;
ME_InvalidateSelection
(
editor
);
ME_Repaint
(
editor
);
HideCaret
(
editor
->
hWnd
);
ME_EnsureVisible
(
editor
,
tmp_curs
.
pRun
);
ME_EnsureVisible
(
editor
,
&
tmp_curs
);
ME_ShowCaret
(
editor
);
ME_SendSelChange
(
editor
);
return
success
;
...
...
dlls/riched20/editor.c
View file @
e6fedf87
...
...
@@ -65,7 +65,7 @@
- EM_GETREDONAME 2.0
+ EM_GETSEL
+ EM_GETSELTEXT (ANSI&Unicode)
+ EM_GETSCROLLPOS 3.0
(only Y value valid)
+ EM_GETSCROLLPOS 3.0
! - EM_GETTHUMB
+ EM_GETTEXTEX 2.0
+ EM_GETTEXTLENGTHEX (GTL_PRECISE unimplemented)
...
...
@@ -137,12 +137,14 @@
+ WM_GETDLGCODE (the current implementation is incomplete)
+ WM_GETTEXT (ANSI&Unicode)
+ WM_GETTEXTLENGTH (ANSI version sucks)
+ WM_HSCROLL
+ WM_PASTE
+ WM_SETFONT
+ WM_SETTEXT (resets undo stack !) (proper style?) ANSI&Unicode
- WM_STYLECHANGING
- WM_STYLECHANGED (things like read-only flag)
+ WM_UNICHAR
+ WM_VSCROLL
Notifications
...
...
@@ -184,7 +186,7 @@
- ES_VERTICAL
- ES_WANTRETURN (don't know how to do WM_GETDLGCODE part)
- WS_SETFONT
-
WS_HSCROLL
+
WS_HSCROLL
+ WS_VSCROLL
*/
...
...
@@ -197,7 +199,6 @@
* - pictures/OLE objects (not just smiling faces that lack API support ;-) )
* - COM interface (looks like a major pain in the TODO list)
* - calculate heights of pictures (half-done)
* - horizontal scrolling (not even started)
* - hysteresis during wrapping (related to scrollbars appearing/disappearing)
* - find/replace
* - how to implement EM_FORMATRANGE and EM_DISPLAYBAND ? (Mission Impossible)
...
...
@@ -2681,6 +2682,7 @@ static ME_TextEditor *ME_MakeEditor(HWND hWnd, BOOL bEmulateVersion10)
ed
->
pCursors
[
2
]
=
ed
->
pCursors
[
0
];
ed
->
pCursors
[
3
]
=
ed
->
pCursors
[
1
];
ed
->
nLastTotalLength
=
ed
->
nTotalLength
=
0
;
ed
->
nLastTotalWidth
=
ed
->
nTotalWidth
=
0
;
ed
->
nUDArrowX
=
-
1
;
ed
->
nSequence
=
0
;
ed
->
rgbBackColor
=
-
1
;
...
...
@@ -2730,13 +2732,19 @@ static ME_TextEditor *ME_MakeEditor(HWND hWnd, BOOL bEmulateVersion10)
ed
->
notified_cr
.
cpMin
=
ed
->
notified_cr
.
cpMax
=
0
;
/* Default
vertical
scrollbar information */
/* Default scrollbar information */
ed
->
vert_si
.
cbSize
=
sizeof
(
SCROLLINFO
);
ed
->
vert_si
.
nMin
=
0
;
ed
->
vert_si
.
nMax
=
0
;
ed
->
vert_si
.
nPage
=
0
;
ed
->
vert_si
.
nPos
=
0
;
ed
->
horz_si
.
cbSize
=
sizeof
(
SCROLLINFO
);
ed
->
horz_si
.
nMin
=
0
;
ed
->
horz_si
.
nMax
=
0
;
ed
->
horz_si
.
nPage
=
0
;
ed
->
horz_si
.
nPos
=
0
;
OleInitialize
(
NULL
);
return
ed
;
...
...
@@ -3156,12 +3164,12 @@ static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
case
EM_SETSCROLLPOS
:
{
POINT
*
point
=
(
POINT
*
)
lParam
;
ME_ScrollAbs
(
editor
,
point
->
y
);
ME_ScrollAbs
(
editor
,
point
->
x
,
point
->
y
);
return
0
;
}
case
EM_AUTOURLDETECT
:
{
if
(
wParam
==
1
||
wParam
==
0
)
if
(
wParam
==
1
||
wParam
==
0
)
{
editor
->
AutoURLDetect_bEnable
=
(
BOOL
)
wParam
;
return
0
;
...
...
@@ -3363,7 +3371,7 @@ static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
case
EM_GETFIRSTVISIBLELINE
:
{
ME_DisplayItem
*
p
=
editor
->
pBuffer
->
pFirst
;
int
y
=
ME_GetYScrollPos
(
editor
)
;
int
y
=
editor
->
vert_si
.
nPos
;
int
ypara
=
0
;
int
count
=
0
;
int
ystart
,
yend
;
...
...
@@ -3433,7 +3441,7 @@ static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return
len
;
}
case
EM_SCROLLCARET
:
ME_EnsureVisible
(
editor
,
editor
->
pCursors
[
0
].
pRun
);
ME_EnsureVisible
(
editor
,
&
editor
->
pCursors
[
0
]
);
return
0
;
case
WM_SETFONT
:
{
...
...
@@ -3587,10 +3595,10 @@ static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
case
EM_GETSCROLLPOS
:
{
POINT
*
point
=
(
POINT
*
)
lParam
;
point
->
x
=
0
;
/* FIXME side scrolling not implemented */
point
->
y
=
ME_GetYScrollPos
(
editor
)
;
return
1
;
POINT
*
point
=
(
POINT
*
)
lParam
;
point
->
x
=
editor
->
horz_si
.
nPos
;
point
->
y
=
editor
->
vert_si
.
nPos
;
return
1
;
}
case
EM_GETTEXTRANGE
:
{
...
...
@@ -3837,9 +3845,8 @@ static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
ME_DisplayItem
*
pRun
;
int
nCharOfs
,
nOffset
,
nLength
;
POINTL
pt
=
{
0
,
0
};
SCROLLINFO
si
;
nCharOfs
=
wParam
;
nCharOfs
=
wParam
;
/* detect which API version we're dealing with */
if
(
wParam
>=
0x40000
)
nCharOfs
=
lParam
;
...
...
@@ -3854,10 +3861,8 @@ static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
pt
.
y
+=
ME_GetParagraph
(
pRun
)
->
member
.
para
.
pt
.
y
+
editor
->
rcFormat
.
top
;
pt
.
x
+=
editor
->
rcFormat
.
left
;
pt
.
x
-=
editor
->
horz_si
.
nPos
;
pt
.
y
-=
editor
->
vert_si
.
nPos
;
si
.
cbSize
=
sizeof
(
si
);
si
.
fMask
=
SIF_POS
;
if
(
GetScrollInfo
(
editor
->
hWnd
,
SB_HORZ
,
&
si
))
pt
.
x
-=
si
.
nPos
;
if
(
wParam
>=
0x40000
)
{
*
(
POINTL
*
)
wParam
=
pt
;
...
...
@@ -3869,10 +3874,6 @@ static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
SCROLLINFO
si
;
ME_SetDefaultFormatRect
(
editor
);
if
(
GetWindowLongW
(
editor
->
hWnd
,
GWL_STYLE
)
&
WS_HSCROLL
)
{
/* Squelch the default horizontal scrollbar it would make */
ShowScrollBar
(
editor
->
hWnd
,
SB_HORZ
,
FALSE
);
}
si
.
cbSize
=
sizeof
(
si
);
si
.
fMask
=
SIF_PAGE
|
SIF_RANGE
;
...
...
@@ -3882,6 +3883,7 @@ static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
si
.
nMin
=
0
;
si
.
nPage
=
0
;
SetScrollInfo
(
editor
->
hWnd
,
SB_VERT
,
&
si
,
TRUE
);
SetScrollInfo
(
editor
->
hWnd
,
SB_HORZ
,
&
si
,
TRUE
);
ME_CommitUndo
(
editor
);
ME_WrapMarkedParagraphs
(
editor
);
...
...
@@ -4046,21 +4048,72 @@ static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
case
EM_STOPGROUPTYPING
:
ME_CommitUndo
(
editor
);
/* End coalesced undos for typed characters */
return
0
;
case
WM_HSCROLL
:
{
const
int
scrollUnit
=
7
;
switch
(
LOWORD
(
wParam
))
{
case
SB_LEFT
:
ME_ScrollAbs
(
editor
,
0
,
0
);
break
;
case
SB_RIGHT
:
ME_ScrollAbs
(
editor
,
editor
->
horz_si
.
nMax
-
(
int
)
editor
->
horz_si
.
nPage
,
editor
->
vert_si
.
nMax
-
(
int
)
editor
->
vert_si
.
nPage
);
break
;
case
SB_LINELEFT
:
ME_ScrollLeft
(
editor
,
scrollUnit
);
break
;
case
SB_LINERIGHT
:
ME_ScrollRight
(
editor
,
scrollUnit
);
break
;
case
SB_PAGELEFT
:
ME_ScrollLeft
(
editor
,
editor
->
sizeWindow
.
cx
);
break
;
case
SB_PAGERIGHT
:
ME_ScrollRight
(
editor
,
editor
->
sizeWindow
.
cx
);
break
;
case
SB_THUMBTRACK
:
case
SB_THUMBPOSITION
:
{
SCROLLINFO
sbi
;
sbi
.
cbSize
=
sizeof
(
sbi
);
sbi
.
fMask
=
SIF_TRACKPOS
;
/* Try to get 32-bit track position value. */
if
(
!
GetScrollInfo
(
editor
->
hWnd
,
SB_HORZ
,
&
sbi
))
/* GetScrollInfo failed, settle for 16-bit value in wParam. */
sbi
.
nTrackPos
=
HIWORD
(
wParam
);
ME_HScrollAbs
(
editor
,
sbi
.
nTrackPos
);
break
;
}
}
break
;
}
case
EM_SCROLL
:
/* fall through */
case
WM_VSCROLL
:
case
WM_VSCROLL
:
{
int
origNPos
;
int
lineHeight
;
origNPos
=
ME_GetYScrollPos
(
editor
)
;
origNPos
=
editor
->
vert_si
.
nPos
;
lineHeight
=
24
;
if
(
editor
&&
editor
->
pBuffer
&&
editor
->
pBuffer
->
pDefaultStyle
)
lineHeight
=
editor
->
pBuffer
->
pDefaultStyle
->
tm
.
tmHeight
;
if
(
lineHeight
<=
0
)
lineHeight
=
24
;
switch
(
LOWORD
(
wParam
))
switch
(
LOWORD
(
wParam
))
{
case
SB_TOP
:
ME_ScrollAbs
(
editor
,
0
,
0
);
break
;
case
SB_BOTTOM
:
ME_ScrollAbs
(
editor
,
editor
->
horz_si
.
nMax
-
(
int
)
editor
->
horz_si
.
nPage
,
editor
->
vert_si
.
nMax
-
(
int
)
editor
->
vert_si
.
nPage
);
break
;
case
SB_LINEUP
:
ME_ScrollUp
(
editor
,
lineHeight
);
break
;
...
...
@@ -4084,12 +4137,12 @@ static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
/* GetScrollInfo failed, settle for 16-bit value in wParam. */
sbi
.
nTrackPos
=
HIWORD
(
wParam
);
ME_ScrollAbs
(
editor
,
sbi
.
nTrackPos
);
ME_
V
ScrollAbs
(
editor
,
sbi
.
nTrackPos
);
break
;
}
}
if
(
msg
==
EM_SCROLL
)
return
0x00010000
|
(((
ME_GetYScrollPos
(
editor
)
-
origNPos
)
/
lineHeight
)
&
0xffff
);
return
0x00010000
|
(((
editor
->
vert_si
.
nPos
-
origNPos
)
/
lineHeight
)
&
0xffff
);
break
;
}
case
WM_MOUSEWHEEL
:
...
...
dlls/riched20/editor.h
View file @
e6fedf87
...
...
@@ -233,7 +233,7 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *
void
ME_Repaint
(
ME_TextEditor
*
editor
);
void
ME_RewrapRepaint
(
ME_TextEditor
*
editor
);
void
ME_UpdateRepaint
(
ME_TextEditor
*
editor
);
void
ME_EnsureVisible
(
ME_TextEditor
*
editor
,
ME_
DisplayItem
*
pRun
);
void
ME_EnsureVisible
(
ME_TextEditor
*
editor
,
ME_
Cursor
*
pCursor
);
void
ME_InvalidateSelection
(
ME_TextEditor
*
editor
);
void
ME_QueueInvalidateFromCursor
(
ME_TextEditor
*
editor
,
int
nCursor
);
BOOL
ME_SetZoom
(
ME_TextEditor
*
editor
,
int
numerator
,
int
denominator
);
...
...
@@ -242,11 +242,14 @@ int ME_twips2pointsY(ME_Context *c, int y);
/* scroll functions in paint.c */
void
ME_ScrollAbs
(
ME_TextEditor
*
editor
,
int
absY
);
void
ME_ScrollAbs
(
ME_TextEditor
*
editor
,
int
x
,
int
y
);
void
ME_HScrollAbs
(
ME_TextEditor
*
editor
,
int
x
);
void
ME_VScrollAbs
(
ME_TextEditor
*
editor
,
int
y
);
void
ME_ScrollUp
(
ME_TextEditor
*
editor
,
int
cy
);
void
ME_ScrollDown
(
ME_TextEditor
*
editor
,
int
cy
);
void
ME_ScrollLeft
(
ME_TextEditor
*
editor
,
int
cx
);
void
ME_ScrollRight
(
ME_TextEditor
*
editor
,
int
cx
);
void
ME_UpdateScrollBar
(
ME_TextEditor
*
editor
);
int
ME_GetYScrollPos
(
ME_TextEditor
*
editor
);
/* other functions in paint.c */
int
ME_GetParaBorderWidth
(
ME_TextEditor
*
editor
,
int
);
...
...
dlls/riched20/editstr.h
View file @
e6fedf87
...
...
@@ -189,7 +189,7 @@ typedef struct tagME_Paragraph
int
nCharOfs
;
int
nFlags
;
POINT
pt
;
int
nHeight
;
int
nHeight
,
nWidth
;
int
nLastPaintYPos
,
nLastPaintHeight
;
int
nRows
;
struct
tagME_DisplayItem
*
prev_para
,
*
next_para
,
*
document
;
...
...
@@ -333,6 +333,7 @@ typedef struct tagME_TextEditor
int
nCursors
;
SIZE
sizeWindow
;
int
nTotalLength
,
nLastTotalLength
;
int
nTotalWidth
,
nLastTotalWidth
;
int
nUDArrowX
;
int
nSequence
;
COLORREF
rgbBackColor
;
...
...
@@ -374,8 +375,8 @@ typedef struct tagME_TextEditor
/* Track previous notified selection */
CHARRANGE
notified_cr
;
/* Cache previously set
vertical
scrollbar info */
SCROLLINFO
vert_si
;
/* Cache previously set scrollbar info */
SCROLLINFO
vert_si
,
horz_si
;
BOOL
bMouseCaptured
;
}
ME_TextEditor
;
...
...
dlls/riched20/paint.c
View file @
e6fedf87
This diff is collapsed.
Click to expand it.
dlls/riched20/tests/editor.c
View file @
e6fedf87
...
...
@@ -621,12 +621,9 @@ static void test_EM_POSFROMCHAR(void)
SendMessage
(
hwndRichEdit
,
WM_HSCROLL
,
SB_LINERIGHT
,
0
);
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
0
,
0
);
ok
(
HIWORD
(
result
)
==
0
,
"EM_POSFROMCHAR reports y=%d, expected 0
\n
"
,
HIWORD
(
result
));
todo_wine
{
/* Fails on builtin because horizontal scrollbar is not being shown */
ok
((
signed
short
)(
LOWORD
(
result
))
<
xpos
,
"EM_POSFROMCHAR reports x=%hd, expected value less than %d
\n
"
,
(
signed
short
)(
LOWORD
(
result
)),
xpos
);
}
SendMessage
(
hwndRichEdit
,
WM_HSCROLL
,
SB_LINELEFT
,
0
);
/* Test around end of text that doesn't end in a newline. */
...
...
dlls/riched20/wrap.c
View file @
e6fedf87
...
...
@@ -133,6 +133,7 @@ static void ME_InsertRowStart(ME_WrapContext *wc, const ME_DisplayItem *pEnd)
}
}
para
->
member
.
para
.
nWidth
=
max
(
para
->
member
.
para
.
nWidth
,
width
);
row
=
ME_MakeRow
(
ascent
+
descent
,
ascent
,
width
);
if
(
wc
->
context
->
editor
->
bEmulateVersion10
&&
/* v1.0 - 3.0 */
pFmt
->
dwMask
&
PFM_TABLE
&&
pFmt
->
wEffects
&
PFE_TABLE
)
...
...
@@ -536,6 +537,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
static
void
ME_PrepareParagraphForWrapping
(
ME_Context
*
c
,
ME_DisplayItem
*
tp
)
{
ME_DisplayItem
*
p
,
*
pRow
;
tp
->
member
.
para
.
nWidth
=
0
;
/* remove all items that will be reinserted by paragraph wrapper anyway */
tp
->
member
.
para
.
nRows
=
0
;
for
(
p
=
tp
->
next
;
p
!=
tp
->
member
.
para
.
next_para
;
p
=
p
->
next
)
{
...
...
@@ -578,6 +580,7 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
ME_Context
c
;
BOOL
bModified
=
FALSE
;
int
yStart
=
-
1
;
int
totalWidth
=
0
;
ME_InitContext
(
&
c
,
editor
,
GetDC
(
editor
->
hWnd
));
c
.
pt
.
x
=
0
;
...
...
@@ -638,6 +641,7 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
ME_DisplayItem
*
startRowPara
;
int
prevHeight
,
nHeight
,
bottomBorder
=
0
;
ME_DisplayItem
*
cell
=
ME_FindItemBack
(
item
,
diCell
);
item
->
member
.
para
.
nWidth
=
cell
->
member
.
cell
.
pt
.
x
+
cell
->
member
.
cell
.
nWidth
;
if
(
!
(
item
->
member
.
para
.
next_para
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
))
{
/* Last row, the bottom border is added to the height. */
...
...
@@ -707,12 +711,15 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
}
c
.
pt
.
y
+=
item
->
member
.
para
.
nHeight
;
}
totalWidth
=
max
(
totalWidth
,
item
->
member
.
para
.
nWidth
);
item
=
item
->
member
.
para
.
next_para
;
}
editor
->
sizeWindow
.
cx
=
c
.
rcView
.
right
-
c
.
rcView
.
left
;
editor
->
sizeWindow
.
cy
=
c
.
rcView
.
bottom
-
c
.
rcView
.
top
;
editor
->
nTotalLength
=
c
.
pt
.
y
;
editor
->
nTotalWidth
=
totalWidth
;
editor
->
pBuffer
->
pLast
->
member
.
para
.
pt
.
x
=
0
;
editor
->
pBuffer
->
pLast
->
member
.
para
.
pt
.
y
=
c
.
pt
.
y
;
...
...
@@ -732,7 +739,7 @@ void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor)
ME_InitContext
(
&
c
,
editor
,
GetDC
(
editor
->
hWnd
));
rc
=
c
.
rcView
;
ofs
=
ME_GetYScrollPos
(
editor
)
;
ofs
=
editor
->
vert_si
.
nPos
;
item
=
editor
->
pBuffer
->
pFirst
;
while
(
item
!=
editor
->
pBuffer
->
pLast
)
{
...
...
@@ -772,6 +779,7 @@ ME_SendRequestResize(ME_TextEditor *editor, BOOL force)
info
.
nmhdr
.
idFrom
=
GetWindowLongW
(
editor
->
hWnd
,
GWLP_ID
);
info
.
nmhdr
.
code
=
EN_REQUESTRESIZE
;
info
.
rc
=
rc
;
info
.
rc
.
right
=
editor
->
nTotalWidth
;
info
.
rc
.
bottom
=
editor
->
nTotalLength
;
editor
->
nEventMask
&=
~
ENM_REQUESTRESIZE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment