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
6cfbf895
Commit
6cfbf895
authored
Nov 27, 2003
by
Huw Davies
Committed by
Alexandre Julliard
Nov 27, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge {Set,Insert}Item[AW] to {Set,Insert}ItemT.
parent
46321f4c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
126 deletions
+33
-126
treeview.c
dlls/comctl32/treeview.c
+33
-126
No files found.
dlls/comctl32/treeview.c
View file @
6cfbf895
...
...
@@ -1058,8 +1058,8 @@ TREEVIEW_InsertAfter(TREEVIEW_ITEM *newItem, TREEVIEW_ITEM *sibling,
}
static
BOOL
TREEVIEW_DoSetItem
(
TREEVIEW_INFO
*
infoPtr
,
TREEVIEW_ITEM
*
wineItem
,
const
TVITEMEXW
*
tvItem
)
TREEVIEW_DoSetItem
T
(
TREEVIEW_INFO
*
infoPtr
,
TREEVIEW_ITEM
*
wineItem
,
const
TVITEMEXW
*
tvItem
,
BOOL
isW
)
{
UINT
callbackClear
=
0
;
UINT
callbackSet
=
0
;
...
...
@@ -1069,31 +1069,39 @@ TREEVIEW_DoSetItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
if
(
tvItem
->
mask
&
TVIF_TEXT
)
{
wineItem
->
textWidth
=
0
;
/* force width recalculation */
if
(
tvItem
->
pszText
!=
LPSTR_TEXTCALLBACKW
)
if
(
tvItem
->
pszText
!=
LPSTR_TEXTCALLBACKW
)
/* covers != TEXTCALLBACKA too */
{
int
len
=
lstrlenW
(
tvItem
->
pszText
)
+
1
;
LPWSTR
newText
=
ReAlloc
(
wineItem
->
pszText
,
len
*
sizeof
(
WCHAR
));
int
len
;
LPWSTR
newText
;
if
(
isW
)
len
=
lstrlenW
(
tvItem
->
pszText
)
+
1
;
else
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
(
LPSTR
)
tvItem
->
pszText
,
-
1
,
NULL
,
0
);
newText
=
ReAlloc
(
wineItem
->
pszText
,
len
*
sizeof
(
WCHAR
));
if
(
newText
==
NULL
)
return
FALSE
;
if
(
newText
==
NULL
)
return
FALSE
;
callbackClear
|=
TVIF_TEXT
;
callbackClear
|=
TVIF_TEXT
;
wineItem
->
pszText
=
newText
;
wineItem
->
cchTextMax
=
len
;
lstrcpynW
(
wineItem
->
pszText
,
tvItem
->
pszText
,
len
);
TRACE
(
"setting text %s, item %p
\n
"
,
debugstr_w
(
wineItem
->
pszText
),
wineItem
);
}
wineItem
->
pszText
=
newText
;
wineItem
->
cchTextMax
=
len
;
if
(
isW
)
lstrcpynW
(
wineItem
->
pszText
,
tvItem
->
pszText
,
len
);
else
MultiByteToWideChar
(
CP_ACP
,
0
,
(
LPSTR
)
tvItem
->
pszText
,
-
1
,
wineItem
->
pszText
,
len
);
TRACE
(
"setting text %s, item %p
\n
"
,
debugstr_w
(
wineItem
->
pszText
),
wineItem
);
}
else
{
callbackSet
|=
TVIF_TEXT
;
wineItem
->
pszText
=
ReAlloc
(
wineItem
->
pszText
,
TEXT_CALLBACK_SIZE
*
sizeof
(
WCHAR
));
TEXT_CALLBACK_SIZE
*
sizeof
(
WCHAR
));
wineItem
->
cchTextMax
=
TEXT_CALLBACK_SIZE
;
TRACE
(
"setting callback, item %p
\n
"
,
wineItem
);
TRACE
(
"setting callback, item %p
\n
"
,
wineItem
);
}
}
...
...
@@ -1151,9 +1159,8 @@ TREEVIEW_DoSetItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
/* Note that the new item is pre-zeroed. */
static
LRESULT
TREEVIEW_InsertItem
W
(
TREEVIEW_INFO
*
infoPtr
,
LPARAM
lParam
)
TREEVIEW_InsertItem
T
(
TREEVIEW_INFO
*
infoPtr
,
const
TVINSERTSTRUCTW
*
ptdi
,
BOOL
isW
)
{
const
TVINSERTSTRUCTW
*
ptdi
=
(
LPTVINSERTSTRUCTW
)
lParam
;
const
TVITEMEXW
*
tvItem
=
&
ptdi
->
DUMMYUNIONNAME
.
itemex
;
HTREEITEM
insertAfter
;
TREEVIEW_ITEM
*
newItem
,
*
parentItem
;
...
...
@@ -1206,7 +1213,7 @@ TREEVIEW_InsertItemW(TREEVIEW_INFO *infoPtr, LPARAM lParam)
newItem
->
parent
=
parentItem
;
newItem
->
iIntegral
=
1
;
if
(
!
TREEVIEW_DoSetItem
(
infoPtr
,
newItem
,
tvItem
))
if
(
!
TREEVIEW_DoSetItem
T
(
infoPtr
,
newItem
,
tvItem
,
isW
))
return
(
LRESULT
)(
HTREEITEM
)
NULL
;
/* After this point, nothing can fail. (Except for TVI_SORT.) */
...
...
@@ -1351,62 +1358,6 @@ TREEVIEW_InsertItemW(TREEVIEW_INFO *infoPtr, LPARAM lParam)
return
(
LRESULT
)
newItem
;
}
static
LRESULT
TREEVIEW_InsertItemA
(
TREEVIEW_INFO
*
infoPtr
,
LPARAM
lParam
)
{
TVINSERTSTRUCTW
tvisW
;
TVINSERTSTRUCTA
*
tvisA
;
LRESULT
lRes
;
tvisA
=
(
LPTVINSERTSTRUCTA
)
lParam
;
tvisW
.
hParent
=
tvisA
->
hParent
;
tvisW
.
hInsertAfter
=
tvisA
->
hInsertAfter
;
tvisW
.
DUMMYUNIONNAME
.
item
.
mask
=
tvisA
->
DUMMYUNIONNAME
.
item
.
mask
;
tvisW
.
DUMMYUNIONNAME
.
item
.
hItem
=
tvisA
->
DUMMYUNIONNAME
.
item
.
hItem
;
tvisW
.
DUMMYUNIONNAME
.
item
.
state
=
tvisA
->
DUMMYUNIONNAME
.
item
.
state
;
tvisW
.
DUMMYUNIONNAME
.
item
.
stateMask
=
tvisA
->
DUMMYUNIONNAME
.
item
.
stateMask
;
tvisW
.
DUMMYUNIONNAME
.
item
.
cchTextMax
=
tvisA
->
DUMMYUNIONNAME
.
item
.
cchTextMax
;
if
((
tvisA
->
DUMMYUNIONNAME
.
item
.
pszText
)
&&
(
tvisA
->
DUMMYUNIONNAME
.
item
.
mask
&
TVIF_TEXT
))
{
if
(
tvisA
->
DUMMYUNIONNAME
.
item
.
pszText
!=
LPSTR_TEXTCALLBACKA
)
{
int
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
tvisA
->
DUMMYUNIONNAME
.
item
.
pszText
,
-
1
,
NULL
,
0
);
tvisW
.
DUMMYUNIONNAME
.
item
.
pszText
=
Alloc
(
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
tvisA
->
DUMMYUNIONNAME
.
item
.
pszText
,
-
1
,
tvisW
.
DUMMYUNIONNAME
.
item
.
pszText
,
len
);
}
else
{
tvisW
.
DUMMYUNIONNAME
.
item
.
pszText
=
LPSTR_TEXTCALLBACKW
;
tvisW
.
DUMMYUNIONNAME
.
item
.
cchTextMax
=
0
;
}
}
tvisW
.
DUMMYUNIONNAME
.
item
.
iImage
=
tvisA
->
DUMMYUNIONNAME
.
item
.
iImage
;
tvisW
.
DUMMYUNIONNAME
.
item
.
iSelectedImage
=
tvisA
->
DUMMYUNIONNAME
.
item
.
iSelectedImage
;
tvisW
.
DUMMYUNIONNAME
.
item
.
cChildren
=
tvisA
->
DUMMYUNIONNAME
.
item
.
cChildren
;
tvisW
.
DUMMYUNIONNAME
.
item
.
lParam
=
tvisA
->
DUMMYUNIONNAME
.
item
.
lParam
;
lRes
=
TREEVIEW_InsertItemW
(
infoPtr
,
(
LPARAM
)
&
tvisW
);
if
(
tvisW
.
DUMMYUNIONNAME
.
item
.
pszText
&&
tvisW
.
DUMMYUNIONNAME
.
item
.
pszText
!=
LPSTR_TEXTCALLBACKW
)
{
Free
(
tvisW
.
DUMMYUNIONNAME
.
item
.
pszText
);
}
return
lRes
;
}
/* Item Deletion ************************************************************/
static
void
TREEVIEW_RemoveItem
(
TREEVIEW_INFO
*
infoPtr
,
TREEVIEW_ITEM
*
wineItem
);
...
...
@@ -2081,7 +2032,7 @@ TREEVIEW_GetItemT(TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW)
/* Beware MSDN Library Visual Studio 6.0. It says -1 on failure, 0 on success,
* which is wrong. */
static
LRESULT
TREEVIEW_SetItem
W
(
TREEVIEW_INFO
*
infoPtr
,
LPTVITEMEXW
tvItem
)
TREEVIEW_SetItem
T
(
TREEVIEW_INFO
*
infoPtr
,
LPTVITEMEXW
tvItem
,
BOOL
isW
)
{
TREEVIEW_ITEM
*
wineItem
;
TREEVIEW_ITEM
originalItem
;
...
...
@@ -2097,7 +2048,7 @@ TREEVIEW_SetItemW(TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem)
/* store the orignal item values */
originalItem
=
*
wineItem
;
if
(
!
TREEVIEW_DoSetItem
(
infoPtr
,
wineItem
,
tvItem
))
if
(
!
TREEVIEW_DoSetItem
T
(
infoPtr
,
wineItem
,
tvItem
,
isW
))
return
FALSE
;
/* If the text or TVIS_BOLD was changed, and it is visible, recalculate. */
...
...
@@ -2137,50 +2088,6 @@ TREEVIEW_SetItemW(TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem)
}
static
LRESULT
TREEVIEW_SetItemA
(
TREEVIEW_INFO
*
infoPtr
,
LPTVITEMEXA
tvItem
)
{
TVITEMEXW
tvItemW
;
INT
len
;
LRESULT
rc
;
tvItemW
.
mask
=
tvItem
->
mask
;
tvItemW
.
hItem
=
tvItem
->
hItem
;
tvItemW
.
state
=
tvItem
->
state
;
tvItemW
.
stateMask
=
tvItem
->
stateMask
;
tvItemW
.
cchTextMax
=
0
;
tvItemW
.
pszText
=
0
;
if
(
tvItem
->
mask
&
TVIF_TEXT
)
{
if
(
tvItem
->
pszText
&&
tvItem
->
pszText
!=
LPSTR_TEXTCALLBACKA
)
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
tvItem
->
pszText
,
-
1
,
NULL
,
0
);
if
(
len
)
{
tvItemW
.
pszText
=
Alloc
(
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
tvItem
->
pszText
,
-
1
,
tvItemW
.
pszText
,
len
);
tvItemW
.
cchTextMax
=
len
;
}
}
else
if
(
tvItem
->
pszText
==
LPSTR_TEXTCALLBACKA
)
tvItemW
.
pszText
=
LPSTR_TEXTCALLBACKW
;
}
tvItemW
.
iImage
=
tvItem
->
iImage
;
tvItemW
.
iSelectedImage
=
tvItem
->
iSelectedImage
;
tvItemW
.
cChildren
=
tvItem
->
cChildren
;
tvItemW
.
lParam
=
tvItem
->
lParam
;
tvItemW
.
iIntegral
=
tvItem
->
iIntegral
;
rc
=
TREEVIEW_SetItemW
(
infoPtr
,
&
tvItemW
);
if
(
tvItemW
.
pszText
&&
tvItemW
.
pszText
!=
LPSTR_TEXTCALLBACKW
)
Free
(
tvItemW
.
pszText
);
return
rc
;
}
static
LRESULT
TREEVIEW_GetItemState
(
TREEVIEW_INFO
*
infoPtr
,
HTREEITEM
wineItem
,
UINT
mask
)
{
TRACE
(
"
\n
"
);
...
...
@@ -5280,10 +5187,10 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return
TREEVIEW_HitTest
(
infoPtr
,
(
LPTVHITTESTINFO
)
lParam
);
case
TVM_INSERTITEMA
:
return
TREEVIEW_InsertItem
A
(
infoPtr
,
lParam
);
return
TREEVIEW_InsertItem
T
(
infoPtr
,
(
LPTVINSERTSTRUCTW
)
lParam
,
FALSE
);
case
TVM_INSERTITEMW
:
return
TREEVIEW_InsertItem
W
(
infoPtr
,
lParam
);
return
TREEVIEW_InsertItem
T
(
infoPtr
,
(
LPTVINSERTSTRUCTW
)
lParam
,
TRUE
);
case
TVM_SELECTITEM
:
return
TREEVIEW_SelectItem
(
infoPtr
,
(
INT
)
wParam
,
(
HTREEITEM
)
lParam
);
...
...
@@ -5304,10 +5211,10 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return
TREEVIEW_SetInsertMarkColor
(
infoPtr
,
(
COLORREF
)
lParam
);
case
TVM_SETITEMA
:
return
TREEVIEW_SetItem
A
(
infoPtr
,
(
LPTVITEMEXA
)
lParam
);
return
TREEVIEW_SetItem
T
(
infoPtr
,
(
LPTVITEMEXW
)
lParam
,
FALSE
);
case
TVM_SETITEMW
:
return
TREEVIEW_SetItem
W
(
infoPtr
,
(
LPTVITEMEXW
)
lParam
);
return
TREEVIEW_SetItem
T
(
infoPtr
,
(
LPTVITEMEXW
)
lParam
,
TRUE
);
case
TVM_SETLINECOLOR
:
return
TREEVIEW_SetLineColor
(
infoPtr
,
(
COLORREF
)
lParam
);
...
...
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