[1/2] comctl32: Implement highlighting (marquee) selection support in listview

Nikolay Sivov bunglehead at gmail.com
Mon Sep 14 14:33:19 CDT 2009


Owen Rudge wrote:
> These patches add support for selecting multiple items in a 
> multi-selection listview using the mouse (by dragging and highlighting).
>
> ---
>  dlls/comctl32/listview.c |  172 
> ++++++++++++++++++++++++++++++++++++++++++----
>  1 files changed, 157 insertions(+), 15 deletions(-)
Hi, Owen.

Some comments.

---

@@ -201,6 +201,7 @@ typedef struct tagITEM_INFO
   LPARAM lParam;
   INT iIndent;
   ITEM_ID *id;
+  UINT orig_state; /* state before highlighting operation begins */
 } ITEM_INFO;

---
Why do you need this restoring code?

If you're starting selection box with some items selected they should be 
deselected if not Shift pressed and
leaved untouched if Shift used. I don't see a reason to restore it - 
when you want to toggle selected state
moving rectangle with Ctrl pressed you could just:

LISTVIEW_GetItemState() and place inverted state with following 
LISTVIEW_SetItemState().

Also such large cycles shouldn't be used if you could manage not to use 
them.
Currently we're not doing right sometimes with ownerdata lists which 
leads to huge response times
(see http://bugs.winehq.org/show_bug.cgi?id=14303).

Anyway this part:
---
+ /* Take a snapshot of all the item states */

+                        for (i = 0; i < infoPtr->nItemCount; i++)
+                        {
+                            hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, i);
+                            lpItem = DPA_GetPtr(hdpaSubItems, 0);
+
+                            if (lpItem)
+                                lpItem->orig_state = lpItem->state;
+                        }
---

is wrong. You can't do it that way cause selected state could also be cached at
parent side with corresponding callback bit set (look at LISTVIEW_GetItemT()).

P.S. No need to split in two patches here, fist is useless if we can't see rectangle.




More information about the wine-devel mailing list