Clear the state image bits only if LVS_EX_CHECKBOXES is set.

Fix obvious logical error in focus handling.
Indentation and formatting fixes.
(based on a patch by Krishna Murthy).
This commit is contained in:
Dimitrie O. Paun 2004-06-04 17:58:29 +00:00 committed by Alexandre Julliard
parent 7bd78fe59a
commit 4b6ed4ed84

View File

@ -3317,7 +3317,7 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
ranges_delitem(infoPtr->selectionRanges, lpLVItem->iItem); ranges_delitem(infoPtr->selectionRanges, lpLVItem->iItem);
/* if we are asked to change focus, and we manage it, do it */ /* if we are asked to change focus, and we manage it, do it */
if (lpLVItem->state & lpLVItem->stateMask & ~infoPtr->uCallbackMask & LVIS_FOCUSED) if (lpLVItem->stateMask & ~infoPtr->uCallbackMask & LVIS_FOCUSED)
{ {
if (lpLVItem->state & LVIS_FOCUSED) if (lpLVItem->state & LVIS_FOCUSED)
{ {
@ -6041,7 +6041,7 @@ static INT WINAPI LISTVIEW_InsertCompare( LPVOID first, LPVOID second, LPARAM
} }
/*** /***
* nESCRIPTION: * DESCRIPTION:
* Inserts a new item in the listview control. * Inserts a new item in the listview control.
* *
* PARAMETER(S): * PARAMETER(S):
@ -6072,8 +6072,7 @@ static INT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
if (!is_assignable_item(lpLVItem, infoPtr->dwStyle)) return -1; if (!is_assignable_item(lpLVItem, infoPtr->dwStyle)) return -1;
if ( !(lpItem = (ITEM_INFO *)Alloc(sizeof(ITEM_INFO))) ) if (!(lpItem = (ITEM_INFO *)Alloc(sizeof(ITEM_INFO)))) return -1;
return -1;
/* insert item in listview control data structure */ /* insert item in listview control data structure */
if ( !(hdpaSubItems = DPA_Create(8)) ) goto fail; if ( !(hdpaSubItems = DPA_Create(8)) ) goto fail;
@ -6094,21 +6093,21 @@ static INT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
/* set the item attributes */ /* set the item attributes */
if (lpLVItem->mask & (LVIF_GROUPID|LVIF_COLUMNS)) if (lpLVItem->mask & (LVIF_GROUPID|LVIF_COLUMNS))
{ {
/* full size structure expected - _WIN32IE >= 0x560 */ /* full size structure expected - _WIN32IE >= 0x560 */
item = *lpLVItem; item = *lpLVItem;
} }
else if (lpLVItem->mask & LVIF_INDENT) else if (lpLVItem->mask & LVIF_INDENT)
{ {
/* indent member expected - _WIN32IE >= 0x300 */ /* indent member expected - _WIN32IE >= 0x300 */
memcpy(&item, lpLVItem, offsetof( LVITEMW, iGroupId )); memcpy(&item, lpLVItem, offsetof( LVITEMW, iGroupId ));
} }
else else
{ {
/* minimal structure expected */ /* minimal structure expected */
memcpy(&item, lpLVItem, offsetof( LVITEMW, iIndent )); memcpy(&item, lpLVItem, offsetof( LVITEMW, iIndent ));
} }
item.iItem = nItem; item.iItem = nItem;
item.state &= ~LVIS_STATEIMAGEMASK; if (infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES) item.state &= ~LVIS_STATEIMAGEMASK;
if (!set_main_item(infoPtr, &item, TRUE, isW, &has_changed)) goto undo; if (!set_main_item(infoPtr, &item, TRUE, isW, &has_changed)) goto undo;
/* if we're sorted, sort the list, and update the index */ /* if we're sorted, sort the list, and update the index */