Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
9685d5d6
Commit
9685d5d6
authored
Mar 19, 2021
by
Huw Davies
Committed by
Alexandre Julliard
Mar 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Keep track of the current scrollbar state.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
39f5c438
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
46 deletions
+27
-46
editor.c
dlls/riched20/editor.c
+2
-0
editstr.h
dlls/riched20/editstr.h
+2
-0
paint.c
dlls/riched20/paint.c
+23
-46
No files found.
dlls/riched20/editor.c
View file @
9685d5d6
...
...
@@ -3012,12 +3012,14 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
ed
->
vert_si
.
nMax
=
0
;
ed
->
vert_si
.
nPage
=
0
;
ed
->
vert_si
.
nPos
=
0
;
ed
->
vert_sb_enabled
=
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
;
ed
->
horz_sb_enabled
=
0
;
if
(
ed
->
scrollbars
&
ES_DISABLENOSCROLL
)
{
...
...
dlls/riched20/editstr.h
View file @
9685d5d6
...
...
@@ -428,6 +428,8 @@ typedef struct tagME_TextEditor
/* Cache previously set scrollbar info */
SCROLLINFO
vert_si
,
horz_si
;
unsigned
int
vert_sb_enabled
:
1
;
unsigned
int
horz_sb_enabled
:
1
;
int
caret_height
;
BOOL
caret_hidden
;
...
...
dlls/riched20/paint.c
View file @
9685d5d6
...
...
@@ -1073,15 +1073,14 @@ void ME_ScrollAbs(ME_TextEditor *editor, int x, int y)
if
(
editor
->
scrollbars
&
WS_HSCROLL
)
{
old_vis
=
winStyle
&
WS_HSCROLL
;
new_vis
=
editor
->
nTotalWidth
>
editor
->
sizeWindow
.
cx
||
editor
->
scrollbars
&
ES_DISABLENOSCROLL
;
new_vis
=
editor
->
horz_sb_enabled
||
editor
->
scrollbars
&
ES_DISABLENOSCROLL
;
if
(
!
old_vis
^
!
new_vis
)
ITextHost_TxShowScrollBar
(
editor
->
texthost
,
SB_HORZ
,
new_vis
);
}
if
(
editor
->
scrollbars
&
WS_VSCROLL
)
{
old_vis
=
winStyle
&
WS_VSCROLL
;
new_vis
=
(
editor
->
nTotalLength
>
editor
->
sizeWindow
.
cy
&&
editor
->
props
&
TXTBIT_MULTILINE
)
||
editor
->
scrollbars
&
ES_DISABLENOSCROLL
;
new_vis
=
editor
->
vert_sb_enabled
||
editor
->
scrollbars
&
ES_DISABLENOSCROLL
;
if
(
!
old_vis
^
!
new_vis
)
ITextHost_TxShowScrollBar
(
editor
->
texthost
,
SB_VERT
,
new_vis
);
}
}
...
...
@@ -1118,25 +1117,13 @@ void ME_ScrollRight(ME_TextEditor *editor, int cx)
ME_HScrollAbs
(
editor
,
editor
->
horz_si
.
nPos
+
cx
);
}
/* Calculates the visibility after a call to SetScrollRange or
* SetScrollInfo with SIF_RANGE. */
static
BOOL
ME_PostSetScrollRangeVisibility
(
SCROLLINFO
*
si
)
{
if
(
si
->
fMask
&
SIF_DISABLENOSCROLL
)
return
TRUE
;
/* This must match the check in SetScrollInfo to determine whether
* to show or hide the scrollbars. */
return
si
->
nMin
<
si
->
nMax
-
max
(
si
->
nPage
-
1
,
0
);
}
void
ME_UpdateScrollBar
(
ME_TextEditor
*
editor
)
{
/* Note that this is the only function that should ever call
* SetScrollInfo with SIF_PAGE or SIF_RANGE. */
SCROLLINFO
si
;
BOOL
bScrollBarWasVisible
,
bScrollBarWillBeVisi
ble
;
BOOL
ena
ble
;
if
(
ME_WrapMarkedParagraphs
(
editor
))
FIXME
(
"ME_UpdateScrollBar had to call ME_WrapMarkedParagraphs
\n
"
);
...
...
@@ -1148,13 +1135,11 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
si
.
fMask
|=
SIF_DISABLENOSCROLL
;
/* Update horizontal scrollbar */
bScrollBarWasVisible
=
editor
->
horz_si
.
nMax
>
editor
->
horz_si
.
nPage
;
bScrollBarWillBeVisible
=
editor
->
nTotalWidth
>
editor
->
sizeWindow
.
cx
;
if
(
editor
->
horz_si
.
nPos
&&
!
bScrollBarWillBeVisible
)
enable
=
editor
->
nTotalWidth
>
editor
->
sizeWindow
.
cx
;
if
(
editor
->
horz_si
.
nPos
&&
!
enable
)
{
ME_HScrollAbs
(
editor
,
0
);
/* ME_HScrollAbs will call this function,
* so nothing else needs to be done here. */
/* ME_HScrollAbs will call this function, so nothing else needs to be done here. */
return
;
}
...
...
@@ -1168,8 +1153,7 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
TRACE
(
"min=%d max=%d page=%d
\n
"
,
si
.
nMin
,
si
.
nMax
,
si
.
nPage
);
editor
->
horz_si
.
nMax
=
si
.
nMax
;
editor
->
horz_si
.
nPage
=
si
.
nPage
;
if
((
bScrollBarWillBeVisible
||
bScrollBarWasVisible
)
&&
editor
->
scrollbars
&
WS_HSCROLL
)
if
((
enable
||
editor
->
horz_sb_enabled
)
&&
editor
->
scrollbars
&
WS_HSCROLL
)
{
if
(
si
.
nMax
>
0xFFFF
)
{
...
...
@@ -1183,29 +1167,25 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
ITextHost_TxSetScrollRange
(
editor
->
texthost
,
SB_HORZ
,
si
.
nMin
,
si
.
nMax
,
FALSE
);
ITextHost_TxSetScrollPos
(
editor
->
texthost
,
SB_HORZ
,
si
.
nPos
,
TRUE
);
}
/* SetScrollInfo or SetScrollRange change scrollbar visibility. */
bScrollBarWasVisible
=
ME_PostSetScrollRangeVisibility
(
&
si
);
}
}
if
(
editor
->
scrollbars
&
WS_HSCROLL
)
if
(
editor
->
scrollbars
&
WS_HSCROLL
&&
!
enable
^
!
editor
->
horz_sb_enabled
)
{
if
(
si
.
fMask
&
SIF_DISABLENOSCROLL
)
bScrollBarWillBeVisible
=
TRUE
;
if
(
bScrollBarWasVisible
!=
bScrollBarWillBeVisible
)
ITextHost_TxShowScrollBar
(
editor
->
texthost
,
SB_HORZ
,
bScrollBarWillBeVisible
);
if
(
enable
||
editor
->
scrollbars
&
ES_DISABLENOSCROLL
)
ITextHost_TxEnableScrollBar
(
editor
->
texthost
,
SB_HORZ
,
enable
?
0
:
ESB_DISABLE_BOTH
);
if
(
!
(
editor
->
scrollbars
&
ES_DISABLENOSCROLL
))
ITextHost_TxShowScrollBar
(
editor
->
texthost
,
SB_HORZ
,
enable
);
editor
->
horz_sb_enabled
=
enable
;
}
/* Update vertical scrollbar */
bScrollBarWasVisible
=
editor
->
vert_si
.
nMax
>
editor
->
vert_si
.
nPage
;
bScrollBarWillBeVisible
=
editor
->
nTotalLength
>
editor
->
sizeWindow
.
cy
&&
(
editor
->
props
&
TXTBIT_MULTILINE
);
enable
=
editor
->
nTotalLength
>
editor
->
sizeWindow
.
cy
&&
(
editor
->
props
&
TXTBIT_MULTILINE
);
if
(
editor
->
vert_si
.
nPos
&&
!
bScrollBarWillBeVisi
ble
)
if
(
editor
->
vert_si
.
nPos
&&
!
ena
ble
)
{
ME_VScrollAbs
(
editor
,
0
);
/* ME_VScrollAbs will call this function,
* so nothing else needs to be done here. */
/* ME_VScrollAbs will call this function, so nothing else needs to be done here. */
return
;
}
...
...
@@ -1219,8 +1199,7 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
TRACE
(
"min=%d max=%d page=%d
\n
"
,
si
.
nMin
,
si
.
nMax
,
si
.
nPage
);
editor
->
vert_si
.
nMax
=
si
.
nMax
;
editor
->
vert_si
.
nPage
=
si
.
nPage
;
if
((
bScrollBarWillBeVisible
||
bScrollBarWasVisible
)
&&
editor
->
scrollbars
&
WS_VSCROLL
)
if
((
enable
||
editor
->
vert_sb_enabled
)
&&
editor
->
scrollbars
&
WS_VSCROLL
)
{
if
(
si
.
nMax
>
0xFFFF
)
{
...
...
@@ -1234,18 +1213,16 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
ITextHost_TxSetScrollRange
(
editor
->
texthost
,
SB_VERT
,
si
.
nMin
,
si
.
nMax
,
FALSE
);
ITextHost_TxSetScrollPos
(
editor
->
texthost
,
SB_VERT
,
si
.
nPos
,
TRUE
);
}
/* SetScrollInfo or SetScrollRange change scrollbar visibility. */
bScrollBarWasVisible
=
ME_PostSetScrollRangeVisibility
(
&
si
);
}
}
if
(
editor
->
scrollbars
&
WS_VSCROLL
)
if
(
editor
->
scrollbars
&
WS_VSCROLL
&&
!
enable
^
!
editor
->
vert_sb_enabled
)
{
if
(
si
.
fMask
&
SIF_DISABLENOSCROLL
)
bScrollBarWillBeVisible
=
TRUE
;
if
(
bScrollBarWasVisible
!=
bScrollBarWillBeVisible
)
ITextHost_TxShowScrollBar
(
editor
->
texthost
,
SB_VERT
,
bScrollBarWillBeVisible
)
;
if
(
enable
||
editor
->
scrollbars
&
ES_DISABLENOSCROLL
)
ITextHost_TxEnableScrollBar
(
editor
->
texthost
,
SB_VERT
,
enable
?
0
:
ESB_DISABLE_BOTH
);
if
(
!
(
editor
->
scrollbars
&
ES_DISABLENOSCROLL
)
)
ITextHost_TxShowScrollBar
(
editor
->
texthost
,
SB_VERT
,
enable
);
editor
->
vert_sb_enabled
=
enable
;
}
}
...
...
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