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
79433e1b
Commit
79433e1b
authored
Oct 11, 2006
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
Oct 12, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: toolbar: Merge TOOLBAR_InsertButtonA and TOOLBAR_InsertButtonW.
parent
c95aa822
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
98 deletions
+13
-98
toolbar.c
dlls/comctl32/toolbar.c
+13
-98
No files found.
dlls/comctl32/toolbar.c
View file @
79433e1b
...
...
@@ -3808,12 +3808,11 @@ TOOLBAR_Indeterminate (HWND hwnd, WPARAM wParam, LPARAM lParam)
static
LRESULT
TOOLBAR_InsertButton
A
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
TOOLBAR_InsertButton
T
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
,
BOOL
fUnicode
)
{
TOOLBAR_INFO
*
infoPtr
=
TOOLBAR_GetInfoPtr
(
hwnd
);
LPTBBUTTON
lpTbb
=
(
LPTBBUTTON
)
lParam
;
INT
nIndex
=
(
INT
)
wParam
;
TBUTTON_INFO
*
oldButtons
;
if
(
lpTbb
==
NULL
)
return
FALSE
;
...
...
@@ -3823,7 +3822,6 @@ TOOLBAR_InsertButtonA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if
(
nIndex
==
-
1
)
{
/* EPP: this seems to be an undocumented call (from my IE4)
* I assume in that case that:
* - lpTbb->iString is a string pointer (not a string index in strings[] table
* - index of insertion is at the end of existing buttons
* I only see this happen with nIndex == -1, but it could have a special
* meaning (like -nIndex (or ~nIndex) to get the real position of insertion).
...
...
@@ -3839,87 +3837,10 @@ TOOLBAR_InsertButtonA (HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE
(
"adjust index=%d
\n
"
,
nIndex
);
}
oldButtons
=
infoPtr
->
buttons
;
infoPtr
->
nNumButtons
++
;
infoPtr
->
buttons
=
Alloc
(
sizeof
(
TBUTTON_INFO
)
*
infoPtr
->
nNumButtons
);
/* pre insert copy */
if
(
nIndex
>
0
)
{
memcpy
(
&
infoPtr
->
buttons
[
0
],
&
oldButtons
[
0
],
nIndex
*
sizeof
(
TBUTTON_INFO
));
}
/* insert new button */
infoPtr
->
buttons
[
nIndex
].
iBitmap
=
lpTbb
->
iBitmap
;
infoPtr
->
buttons
[
nIndex
].
idCommand
=
lpTbb
->
idCommand
;
infoPtr
->
buttons
[
nIndex
].
fsState
=
lpTbb
->
fsState
;
infoPtr
->
buttons
[
nIndex
].
fsStyle
=
lpTbb
->
fsStyle
;
infoPtr
->
buttons
[
nIndex
].
dwData
=
lpTbb
->
dwData
;
/* if passed string and not index, then add string */
if
(
HIWORD
(
lpTbb
->
iString
)
&&
lpTbb
->
iString
!=-
1
)
{
Str_SetPtrAtoW
((
LPWSTR
*
)
&
infoPtr
->
buttons
[
nIndex
].
iString
,
(
LPCSTR
)
lpTbb
->
iString
);
}
else
infoPtr
->
buttons
[
nIndex
].
iString
=
lpTbb
->
iString
;
TOOLBAR_TooltipAddTool
(
infoPtr
,
&
infoPtr
->
buttons
[
nIndex
]);
/* post insert copy */
if
(
nIndex
<
infoPtr
->
nNumButtons
-
1
)
{
memcpy
(
&
infoPtr
->
buttons
[
nIndex
+
1
],
&
oldButtons
[
nIndex
],
(
infoPtr
->
nNumButtons
-
nIndex
-
1
)
*
sizeof
(
TBUTTON_INFO
));
}
Free
(
oldButtons
);
TOOLBAR_CalcToolbar
(
hwnd
);
TOOLBAR_AutoSize
(
hwnd
);
InvalidateRect
(
hwnd
,
NULL
,
TRUE
);
return
TRUE
;
}
static
LRESULT
TOOLBAR_InsertButtonW
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
TOOLBAR_INFO
*
infoPtr
=
TOOLBAR_GetInfoPtr
(
hwnd
);
LPTBBUTTON
lpTbb
=
(
LPTBBUTTON
)
lParam
;
INT
nIndex
=
(
INT
)
wParam
;
TBUTTON_INFO
*
oldButtons
;
if
(
lpTbb
==
NULL
)
return
FALSE
;
TOOLBAR_DumpButton
(
infoPtr
,
(
TBUTTON_INFO
*
)
lpTbb
,
nIndex
,
FALSE
);
if
(
nIndex
==
-
1
)
{
/* EPP: this seems to be an undocumented call (from my IE4)
* I assume in that case that:
* - lpTbb->iString is a string pointer (not a string index in strings[] table
* - index of insertion is at the end of existing buttons
* I only see this happen with nIndex == -1, but it could have a special
* meaning (like -nIndex (or ~nIndex) to get the real position of insertion).
*/
nIndex
=
infoPtr
->
nNumButtons
;
}
else
if
(
nIndex
<
0
)
return
FALSE
;
TRACE
(
"inserting button index=%d
\n
"
,
nIndex
);
if
(
nIndex
>
infoPtr
->
nNumButtons
)
{
nIndex
=
infoPtr
->
nNumButtons
;
TRACE
(
"adjust index=%d
\n
"
,
nIndex
);
}
oldButtons
=
infoPtr
->
buttons
;
infoPtr
->
nNumButtons
++
;
infoPtr
->
buttons
=
Alloc
(
sizeof
(
TBUTTON_INFO
)
*
infoPtr
->
nNumButtons
);
/* pre insert copy */
if
(
nIndex
>
0
)
{
memcpy
(
&
infoPtr
->
buttons
[
0
],
&
oldButtons
[
0
],
nIndex
*
sizeof
(
TBUTTON_INFO
));
}
infoPtr
->
buttons
=
ReAlloc
(
infoPtr
->
buttons
,
sizeof
(
TBUTTON_INFO
)
*
infoPtr
->
nNumButtons
);
memmove
(
&
infoPtr
->
buttons
[
nIndex
+
1
],
&
infoPtr
->
buttons
[
nIndex
],
(
infoPtr
->
nNumButtons
-
nIndex
-
1
)
*
sizeof
(
TBUTTON_INFO
));
/* insert new button */
infoPtr
->
buttons
[
nIndex
].
iBitmap
=
lpTbb
->
iBitmap
;
...
...
@@ -3929,21 +3850,16 @@ TOOLBAR_InsertButtonW (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr
->
buttons
[
nIndex
].
dwData
=
lpTbb
->
dwData
;
/* if passed string and not index, then add string */
if
(
HIWORD
(
lpTbb
->
iString
)
&&
lpTbb
->
iString
!=-
1
)
{
Str_SetPtrW
((
LPWSTR
*
)
&
infoPtr
->
buttons
[
nIndex
].
iString
,
(
LPWSTR
)
lpTbb
->
iString
);
if
(
fUnicode
)
Str_SetPtrW
((
LPWSTR
*
)
&
infoPtr
->
buttons
[
nIndex
].
iString
,
(
LPWSTR
)
lpTbb
->
iString
);
else
Str_SetPtrAtoW
((
LPWSTR
*
)
&
infoPtr
->
buttons
[
nIndex
].
iString
,
(
LPCSTR
)
lpTbb
->
iString
);
}
else
infoPtr
->
buttons
[
nIndex
].
iString
=
lpTbb
->
iString
;
TOOLBAR_TooltipAddTool
(
infoPtr
,
&
infoPtr
->
buttons
[
nIndex
]);
/* post insert copy */
if
(
nIndex
<
infoPtr
->
nNumButtons
-
1
)
{
memcpy
(
&
infoPtr
->
buttons
[
nIndex
+
1
],
&
oldButtons
[
nIndex
],
(
infoPtr
->
nNumButtons
-
nIndex
-
1
)
*
sizeof
(
TBUTTON_INFO
));
}
Free
(
oldButtons
);
TOOLBAR_CalcToolbar
(
hwnd
);
TOOLBAR_AutoSize
(
hwnd
);
...
...
@@ -3952,7 +3868,6 @@ TOOLBAR_InsertButtonW (HWND hwnd, WPARAM wParam, LPARAM lParam)
return
TRUE
;
}
/* << TOOLBAR_InsertMarkHitTest >> */
...
...
@@ -4441,8 +4356,8 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, LPTBSAVEPARAMSW lpSave)
if
(
HIWORD
(
nmtbr
.
tbButton
.
iString
))
nmtbr
.
tbButton
.
iString
=
0
;
TOOLBAR_InsertButton
W
(
infoPtr
->
hwndSelf
,
-
1
,
(
LPARAM
)
&
nmtbr
.
tbButton
);
TOOLBAR_InsertButton
T
(
infoPtr
->
hwndSelf
,
-
1
,
(
LPARAM
)
&
nmtbr
.
tbButton
,
TRUE
);
}
/* do legacy notifications */
...
...
@@ -5885,7 +5800,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
memset
(
&
tbb
,
0
,
sizeof
(
tbb
));
tbb
.
fsStyle
=
BTNS_SEP
;
tbb
.
iString
=
-
1
;
TOOLBAR_InsertButton
W
(
hwnd
,
nButton
,
(
LPARAM
)
&
tbb
);
TOOLBAR_InsertButton
T
(
hwnd
,
nButton
,
(
LPARAM
)
&
tbb
,
TRUE
);
}
}
else
...
...
@@ -6824,10 +6739,10 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return
TOOLBAR_Indeterminate
(
hwnd
,
wParam
,
lParam
);
case
TB_INSERTBUTTONA
:
return
TOOLBAR_InsertButton
A
(
hwnd
,
wParam
,
lParam
);
return
TOOLBAR_InsertButton
T
(
hwnd
,
wParam
,
lParam
,
FALSE
);
case
TB_INSERTBUTTONW
:
return
TOOLBAR_InsertButton
W
(
hwnd
,
wParam
,
lParam
);
return
TOOLBAR_InsertButton
T
(
hwnd
,
wParam
,
lParam
,
TRUE
);
/* case TB_INSERTMARKHITTEST: */
/* 4.71 */
...
...
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