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
c9e01333
Commit
c9e01333
authored
Oct 21, 2002
by
Dimitrie O. Paun
Committed by
Alexandre Julliard
Oct 21, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split ranges_destroy in ranges_clear, and ranges_destroy.
Rewrite DeleteAllItems, for cleaner, faster, more correct code.
parent
62f4c61d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
57 deletions
+33
-57
listview.c
dlls/comctl32/listview.c
+33
-57
No files found.
dlls/comctl32/listview.c
View file @
c9e01333
...
@@ -2320,17 +2320,20 @@ static RANGES ranges_create(int count)
...
@@ -2320,17 +2320,20 @@ static RANGES ranges_create(int count)
return
NULL
;
return
NULL
;
}
}
static
void
ranges_
destroy
(
RANGES
ranges
)
static
void
ranges_
clear
(
RANGES
ranges
)
{
{
if
(
ranges
&&
ranges
->
hdpa
)
{
INT
i
;
INT
i
;
for
(
i
=
0
;
i
<
ranges
->
hdpa
->
nItemCount
;
i
++
)
for
(
i
=
0
;
i
<
ranges
->
hdpa
->
nItemCount
;
i
++
)
COMCTL32_Free
(
DPA_GetPtr
(
ranges
->
hdpa
,
i
));
COMCTL32_Free
(
DPA_GetPtr
(
ranges
->
hdpa
,
i
));
DPA_DeleteAllPtrs
(
ranges
->
hdpa
);
}
static
void
ranges_destroy
(
RANGES
ranges
)
{
ranges_clear
(
ranges
);
DPA_Destroy
(
ranges
->
hdpa
);
DPA_Destroy
(
ranges
->
hdpa
);
ranges
->
hdpa
=
NULL
;
}
COMCTL32_Free
(
ranges
);
COMCTL32_Free
(
ranges
);
}
}
...
@@ -3825,84 +3828,57 @@ static BOOL LISTVIEW_Arrange(LISTVIEW_INFO *infoPtr, INT nAlignCode)
...
@@ -3825,84 +3828,57 @@ static BOOL LISTVIEW_Arrange(LISTVIEW_INFO *infoPtr, INT nAlignCode)
*/
*/
static
BOOL
LISTVIEW_DeleteAllItems
(
LISTVIEW_INFO
*
infoPtr
)
static
BOOL
LISTVIEW_DeleteAllItems
(
LISTVIEW_INFO
*
infoPtr
)
{
{
LISTVIEW_ITEM
*
lpItem
;
LISTVIEW_SUBITEM
*
lpSubItem
;
NMLISTVIEW
nmlv
;
NMLISTVIEW
nmlv
;
HDPA
hdpaSubItems
=
NULL
;
BOOL
bSuppress
;
BOOL
bSuppress
;
BOOL
bResult
=
FALSE
;
ITEMHDR
*
hdrItem
;
HDPA
hdpaSubItems
;
INT
i
,
j
;
TRACE
(
"()
\n
"
);
TRACE
(
"()
\n
"
);
LISTVIEW_DeselectAll
(
infoPtr
);
/* we do it directly, to avoid notifications */
infoPtr
->
nSelectionMark
=-
1
;
ranges_clear
(
infoPtr
->
selectionRanges
);
infoPtr
->
nFocusedItem
=-
1
;
infoPtr
->
nSelectionMark
=
-
1
;
infoPtr
->
nFocusedItem
=
-
1
;
SetRectEmpty
(
&
infoPtr
->
rcFocus
);
SetRectEmpty
(
&
infoPtr
->
rcFocus
);
/* But we are supposed to leave nHotItem as is! */
/* But we are supposed to leave nHotItem as is! */
if
(
infoPtr
->
dwStyle
&
LVS_OWNERDATA
)
{
infoPtr
->
nItemCount
=
0
;
LISTVIEW_InvalidateList
(
infoPtr
);
return
TRUE
;
}
if
(
infoPtr
->
nItemCount
>
0
)
{
INT
i
,
j
;
/* send LVN_DELETEALLITEMS notification */
/* send LVN_DELETEALLITEMS notification */
/* verify if subsequent LVN_DELETEITEM notifications should be
suppressed */
ZeroMemory
(
&
nmlv
,
sizeof
(
NMLISTVIEW
));
ZeroMemory
(
&
nmlv
,
sizeof
(
NMLISTVIEW
));
nmlv
.
iItem
=
-
1
;
nmlv
.
iItem
=
-
1
;
bSuppress
=
notify_listview
(
infoPtr
,
LVN_DELETEALLITEMS
,
&
nmlv
);
bSuppress
=
notify_listview
(
infoPtr
,
LVN_DELETEALLITEMS
,
&
nmlv
);
for
(
i
=
0
;
i
<
infoPtr
->
nItemCount
;
i
++
)
for
(
i
=
infoPtr
->
nItemCount
-
1
;
i
>=
0
;
i
--
)
{
hdpaSubItems
=
(
HDPA
)
DPA_GetPtr
(
infoPtr
->
hdpaItems
,
i
);
for
(
j
=
1
;
j
<
hdpaSubItems
->
nItemCount
;
j
++
)
{
{
lpSubItem
=
(
LISTVIEW_SUBITEM
*
)
DPA_GetPtr
(
hdpaSubItems
,
j
);
/* send LVN_DELETEITEM notification, if not supressed */
/* free subitem string */
if
(
is_textW
(
lpSubItem
->
hdr
.
pszText
))
COMCTL32_Free
(
lpSubItem
->
hdr
.
pszText
);
/* free subitem */
COMCTL32_Free
(
lpSubItem
);
}
lpItem
=
(
LISTVIEW_ITEM
*
)
DPA_GetPtr
(
hdpaSubItems
,
0
);
if
(
!
bSuppress
)
if
(
!
bSuppress
)
{
{
/* send LVN_DELETEITEM notification */
nmlv
.
iItem
=
i
;
nmlv
.
iItem
=
i
;
nmlv
.
lParam
=
lpItem
->
lParam
;
notify_listview
(
infoPtr
,
LVN_DELETEITEM
,
&
nmlv
);
notify_listview
(
infoPtr
,
LVN_DELETEITEM
,
&
nmlv
);
}
}
if
(
infoPtr
->
dwStyle
&
LVS_OWNERDATA
)
/* free item string */
{
if
(
is_textW
(
lpItem
->
hdr
.
pszText
))
hdpaSubItems
=
(
HDPA
)
DPA_GetPtr
(
infoPtr
->
hdpaItems
,
i
);
COMCTL32_Free
(
lpItem
->
hdr
.
pszText
);
for
(
j
=
0
;
j
<
hdpaSubItems
->
nItemCount
;
j
++
)
{
/* free item */
hdrItem
=
(
ITEMHDR
*
)
DPA_GetPtr
(
hdpaSubItems
,
j
);
COMCTL32_Free
(
lpItem
);
if
(
is_textW
(
hdrItem
->
pszText
))
COMCTL32_Free
(
hdrItem
->
pszText
);
COMCTL32_Free
(
hdrItem
);
}
DPA_Destroy
(
hdpaSubItems
);
DPA_Destroy
(
hdpaSubItems
);
DPA_DeletePtr
(
infoPtr
->
hdpaItems
,
i
);
}
DPA_DeletePtr
(
infoPtr
->
hdpaPosX
,
i
);
DPA_DeletePtr
(
infoPtr
->
hdpaPosY
,
i
);
infoPtr
->
nItemCount
--
;
}
}
/* reinitialize listview memory */
bResult
=
DPA_DeleteAllPtrs
(
infoPtr
->
hdpaItems
);
infoPtr
->
nItemCount
=
0
;
DPA_DeleteAllPtrs
(
infoPtr
->
hdpaPosX
);
DPA_DeleteAllPtrs
(
infoPtr
->
hdpaPosY
);
LISTVIEW_UpdateScroll
(
infoPtr
);
LISTVIEW_UpdateScroll
(
infoPtr
);
LISTVIEW_InvalidateList
(
infoPtr
);
LISTVIEW_InvalidateList
(
infoPtr
);
}
return
bResult
;
return
TRUE
;
}
}
/***
/***
...
@@ -7591,7 +7567,7 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr)
...
@@ -7591,7 +7567,7 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr)
/* destroy data structure */
/* destroy data structure */
DPA_Destroy
(
infoPtr
->
hdpaItems
);
DPA_Destroy
(
infoPtr
->
hdpaItems
);
ranges_destroy
(
infoPtr
->
selectionRanges
);
if
(
infoPtr
->
selectionRanges
)
ranges_destroy
(
infoPtr
->
selectionRanges
);
/* destroy image lists */
/* destroy image lists */
if
(
!
(
infoPtr
->
dwStyle
&
LVS_SHAREIMAGELISTS
))
if
(
!
(
infoPtr
->
dwStyle
&
LVS_SHAREIMAGELISTS
))
...
...
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