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
c4e45d7f
Commit
c4e45d7f
authored
Oct 25, 2002
by
Dimitrie O. Paun
Committed by
Alexandre Julliard
Oct 25, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite the UpdateScroll function: simpler, faster.
Add debugging helper for SCROLLINFO. Fix potential bug in debugging helpers.
parent
9faec8a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
92 deletions
+82
-92
listview.c
dlls/comctl32/listview.c
+82
-92
No files found.
dlls/comctl32/listview.c
View file @
c4e45d7f
...
...
@@ -549,6 +549,38 @@ static inline char* debugrect(const RECT* rect)
}
else
return
"(null)"
;
}
static
char
*
debugscrollinfo
(
const
SCROLLINFO
*
pScrollInfo
)
{
char
*
buf
=
debug_getbuf
(),
*
text
=
buf
;
int
len
,
size
=
DEBUG_BUFFER_SIZE
;
if
(
pScrollInfo
==
NULL
)
return
"(null)"
;
len
=
snprintf
(
buf
,
size
,
"{cbSize=%d, "
,
pScrollInfo
->
cbSize
);
if
(
len
==
-
1
)
goto
end
;
buf
+=
len
;
size
-=
len
;
if
(
pScrollInfo
->
fMask
&
SIF_RANGE
)
len
=
snprintf
(
buf
,
size
,
"nMin=%d, nMax=%d, "
,
pScrollInfo
->
nMin
,
pScrollInfo
->
nMax
);
else
len
=
0
;
if
(
len
==
-
1
)
goto
end
;
buf
+=
len
;
size
-=
len
;
if
(
pScrollInfo
->
fMask
&
SIF_PAGE
)
len
=
snprintf
(
buf
,
size
,
"nPage=%u, "
,
pScrollInfo
->
nPage
);
else
len
=
0
;
if
(
len
==
-
1
)
goto
end
;
buf
+=
len
;
size
-=
len
;
if
(
pScrollInfo
->
fMask
&
SIF_POS
)
len
=
snprintf
(
buf
,
size
,
"nPos=%d, "
,
pScrollInfo
->
nPos
);
else
len
=
0
;
if
(
len
==
-
1
)
goto
end
;
buf
+=
len
;
size
-=
len
;
if
(
pScrollInfo
->
fMask
&
SIF_TRACKPOS
)
len
=
snprintf
(
buf
,
size
,
"nTrackPos=%d, "
,
pScrollInfo
->
nTrackPos
);
else
len
=
0
;
if
(
len
==
-
1
)
goto
end
;
buf
+=
len
;
size
-=
len
;
goto
undo
;
end:
buf
=
text
+
strlen
(
text
);
undo:
if
(
buf
-
text
>
2
)
{
buf
[
-
2
]
=
'}'
;
buf
[
-
1
]
=
0
;
}
return
text
;
}
static
char
*
debugnmlistview
(
LPNMLISTVIEW
plvnm
)
{
if
(
plvnm
)
...
...
@@ -594,7 +626,7 @@ static char* debuglvitem_t(LPLVITEMW lpLVItem, BOOL isW)
end:
buf
=
text
+
strlen
(
text
);
undo:
if
(
buf
-
text
>
2
)
buf
[
-
2
]
=
'}'
;
buf
[
-
1
]
=
0
;
if
(
buf
-
text
>
2
)
{
buf
[
-
2
]
=
'}'
;
buf
[
-
1
]
=
0
;
}
return
text
;
}
...
...
@@ -634,7 +666,7 @@ static char* debuglvcolumn_t(LPLVCOLUMNW lpColumn, BOOL isW)
end:
buf
=
text
+
strlen
(
text
);
undo:
if
(
buf
-
text
>
2
)
buf
[
-
2
]
=
'}'
;
buf
[
-
1
]
=
0
;
if
(
buf
-
text
>
2
)
{
buf
[
-
2
]
=
'}'
;
buf
[
-
1
]
=
0
;
}
return
text
;
}
...
...
@@ -1423,103 +1455,61 @@ static void LISTVIEW_UpdateHeaderSize(LISTVIEW_INFO *infoPtr, INT nNewScrollPos)
*/
static
void
LISTVIEW_UpdateScroll
(
LISTVIEW_INFO
*
infoPtr
)
{
UINT
uView
=
infoPtr
->
dwStyle
&
LVS_TYPEMASK
;
INT
nListHeight
=
infoPtr
->
rcList
.
bottom
-
infoPtr
->
rcList
.
top
;
INT
nListWidth
=
infoPtr
->
rcList
.
right
-
infoPtr
->
rcList
.
left
;
SCROLLINFO
scrollInfo
;
UINT
uView
=
infoPtr
->
dwStyle
&
LVS_TYPEMASK
;
SCROLLINFO
horzInfo
,
vertInfo
;
if
(
infoPtr
->
dwStyle
&
LVS_NOSCROLL
)
return
;
/*if (!is_redrawing(infoPtr)) return;*/
if
(
infoPtr
->
dwStyle
&
LVS_NOSCROLL
)
return
;
/*if (!is_redrawing(infoPtr)) return;*/
scrollInfo
.
cbSize
=
sizeof
(
SCROLLINFO
);
ZeroMemory
(
&
horzInfo
,
sizeof
(
SCROLLINFO
));
horzInfo
.
cbSize
=
sizeof
(
SCROLLINFO
);
horzInfo
.
nPage
=
infoPtr
->
rcList
.
right
-
infoPtr
->
rcList
.
left
;
if
(
uView
==
LVS_LIST
)
{
/* update horizontal scrollbar */
INT
nCountPerColumn
=
LISTVIEW_GetCountPerColumn
(
infoPtr
);
INT
nCountPerRow
=
LISTVIEW_GetCountPerRow
(
infoPtr
);
ZeroMemory
(
&
vertInfo
,
sizeof
(
SCROLLINFO
));
vertInfo
.
cbSize
=
sizeof
(
SCROLLINFO
);
vertInfo
.
nPage
=
infoPtr
->
rcList
.
bottom
-
infoPtr
->
rcList
.
top
;
TRACE
(
"items=%d, perColumn=%d, perRow=%d
\n
"
,
infoPtr
->
nItemCount
,
nCountPerColumn
,
nCountPerRow
);
scrollInfo
.
nMin
=
0
;
scrollInfo
.
nMax
=
infoPtr
->
nItemCount
/
nCountPerColumn
;
if
((
infoPtr
->
nItemCount
%
nCountPerColumn
)
==
0
)
scrollInfo
.
nMax
--
;
if
(
scrollInfo
.
nMax
<
0
)
scrollInfo
.
nMax
=
0
;
scrollInfo
.
nPos
=
ListView_GetTopIndex
(
infoPtr
->
hwndSelf
)
/
nCountPerColumn
;
scrollInfo
.
nPage
=
nCountPerRow
;
scrollInfo
.
fMask
=
SIF_RANGE
|
SIF_POS
|
SIF_PAGE
;
SetScrollInfo
(
infoPtr
->
hwndSelf
,
SB_HORZ
,
&
scrollInfo
,
TRUE
);
ShowScrollBar
(
infoPtr
->
hwndSelf
,
SB_VERT
,
FALSE
);
}
else
if
(
uView
==
LVS_REPORT
)
{
BOOL
test
;
/* update vertical scrollbar */
scrollInfo
.
nMin
=
0
;
scrollInfo
.
nMax
=
infoPtr
->
nItemCount
-
1
;
scrollInfo
.
nPos
=
ListView_GetTopIndex
(
infoPtr
->
hwndSelf
);
scrollInfo
.
nPage
=
LISTVIEW_GetCountPerColumn
(
infoPtr
);
scrollInfo
.
fMask
=
SIF_RANGE
|
SIF_POS
|
SIF_PAGE
;
test
=
(
scrollInfo
.
nMin
>=
scrollInfo
.
nMax
-
max
((
INT
)
scrollInfo
.
nPage
-
1
,
0
));
TRACE
(
"LVS_REPORT Vert. nMax=%d, nPage=%d, test=%d
\n
"
,
scrollInfo
.
nMax
,
scrollInfo
.
nPage
,
test
);
SetScrollInfo
(
infoPtr
->
hwndSelf
,
SB_VERT
,
&
scrollInfo
,
TRUE
);
ShowScrollBar
(
infoPtr
->
hwndSelf
,
SB_VERT
,
(
test
)
?
FALSE
:
TRUE
);
/* update horizontal scrollbar */
scrollInfo
.
fMask
=
SIF_POS
;
if
(
!
GetScrollInfo
(
infoPtr
->
hwndSelf
,
SB_HORZ
,
&
scrollInfo
))
scrollInfo
.
nPos
=
0
;
scrollInfo
.
nMin
=
0
;
scrollInfo
.
nMax
=
max
(
infoPtr
->
nItemWidth
,
0
)
-
1
;
scrollInfo
.
nPage
=
nListWidth
;
scrollInfo
.
fMask
=
SIF_RANGE
|
SIF_POS
|
SIF_PAGE
;
test
=
(
scrollInfo
.
nMin
>=
scrollInfo
.
nMax
-
max
((
INT
)
scrollInfo
.
nPage
-
1
,
0
));
TRACE
(
"LVS_REPORT Horz. nMax=%d, nPage=%d, test=%d
\n
"
,
scrollInfo
.
nMax
,
scrollInfo
.
nPage
,
test
);
SetScrollInfo
(
infoPtr
->
hwndSelf
,
SB_HORZ
,
&
scrollInfo
,
TRUE
);
ShowScrollBar
(
infoPtr
->
hwndSelf
,
SB_HORZ
,
(
test
)
?
FALSE
:
TRUE
);
/* for now, we'll set info.nMax to the _count_, and adjust it later */
if
(
uView
==
LVS_LIST
)
{
INT
nPerCol
=
LISTVIEW_GetCountPerColumn
(
infoPtr
);
horzInfo
.
nMax
=
(
infoPtr
->
nItemCount
+
nPerCol
-
1
)
/
nPerCol
;
horzInfo
.
nPage
/=
infoPtr
->
nItemWidth
;
}
else
if
(
uView
==
LVS_REPORT
)
{
horzInfo
.
nMax
=
infoPtr
->
nItemWidth
;
vertInfo
.
nMax
=
infoPtr
->
nItemCount
;
vertInfo
.
nPage
/=
infoPtr
->
nItemHeight
;
}
else
/* LVS_ICON, or LVS_SMALLICON */
{
RECT
rcView
;
/* Update the Header Control */
scrollInfo
.
fMask
=
SIF_POS
;
GetScrollInfo
(
infoPtr
->
hwndSelf
,
SB_HORZ
,
&
scrollInfo
);
LISTVIEW_UpdateHeaderSize
(
infoPtr
,
scrollInfo
.
nPos
);
if
(
LISTVIEW_GetViewRect
(
infoPtr
,
&
rcView
))
{
horzInfo
.
nMax
=
rcView
.
right
-
rcView
.
left
;
vertInfo
.
nMax
=
rcView
.
bottom
-
rcView
.
top
;
}
}
horzInfo
.
fMask
=
SIF_RANGE
|
SIF_PAGE
;
horzInfo
.
nMax
=
max
(
horzInfo
.
nMax
-
1
,
0
);
SetScrollInfo
(
infoPtr
->
hwndSelf
,
SB_HORZ
,
&
horzInfo
,
TRUE
);
TRACE
(
"horzInfo=%s
\n
"
,
debugscrollinfo
(
&
horzInfo
));
}
else
{
RECT
rcView
;
if
(
LISTVIEW_GetViewRect
(
infoPtr
,
&
rcView
))
{
TRACE
(
"rcView=%s, rcList=%s
\n
"
,
debugrect
(
&
rcView
),
debugrect
(
&
infoPtr
->
rcList
));
/* Update Horizontal Scrollbar */
scrollInfo
.
fMask
=
SIF_POS
;
if
(
!
GetScrollInfo
(
infoPtr
->
hwndSelf
,
SB_HORZ
,
&
scrollInfo
))
scrollInfo
.
nPos
=
0
;
scrollInfo
.
nMin
=
0
;
scrollInfo
.
nMax
=
max
(
rcView
.
right
-
rcView
.
left
-
1
,
0
);
scrollInfo
.
nPage
=
nListWidth
;
scrollInfo
.
fMask
=
SIF_RANGE
|
SIF_POS
|
SIF_PAGE
;
TRACE
(
"LVS_ICON/SMALLICON Horz.
\n
"
);
SetScrollInfo
(
infoPtr
->
hwndSelf
,
SB_HORZ
,
&
scrollInfo
,
TRUE
);
/* Update Vertical Scrollbar */
scrollInfo
.
fMask
=
SIF_POS
;
if
(
!
GetScrollInfo
(
infoPtr
->
hwndSelf
,
SB_VERT
,
&
scrollInfo
))
scrollInfo
.
nPos
=
0
;
scrollInfo
.
nMin
=
0
;
scrollInfo
.
nMax
=
max
(
rcView
.
bottom
-
rcView
.
top
-
1
,
0
);
scrollInfo
.
nPage
=
nListHeight
;
scrollInfo
.
fMask
=
SIF_RANGE
|
SIF_POS
|
SIF_PAGE
;
TRACE
(
"LVS_ICON/SMALLICON Vert.
\n
"
);
SetScrollInfo
(
infoPtr
->
hwndSelf
,
SB_VERT
,
&
scrollInfo
,
TRUE
);
vertInfo
.
fMask
=
SIF_RANGE
|
SIF_PAGE
;
vertInfo
.
nMax
=
max
(
vertInfo
.
nMax
-
1
,
0
);
SetScrollInfo
(
infoPtr
->
hwndSelf
,
SB_VERT
,
&
vertInfo
,
TRUE
);
TRACE
(
"vertInfo=%s
\n
"
,
debugscrollinfo
(
&
vertInfo
));
/* Update the Header Control */
if
(
uView
==
LVS_REPORT
)
{
horzInfo
.
fMask
=
SIF_POS
;
GetScrollInfo
(
infoPtr
->
hwndSelf
,
SB_HORZ
,
&
horzInfo
);
LISTVIEW_UpdateHeaderSize
(
infoPtr
,
horzInfo
.
nPos
);
}
}
}
...
...
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