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
3e4bdad4
Commit
3e4bdad4
authored
Aug 14, 2006
by
Frank Richter
Committed by
Alexandre Julliard
Aug 14, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uxtheme: Split color handling out of MSSTYLES_ParseThemeIni into smaller helper functions.
parent
f34412b9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
35 deletions
+63
-35
msstyles.c
dlls/uxtheme/msstyles.c
+63
-35
No files found.
dlls/uxtheme/msstyles.c
View file @
3e4bdad4
...
...
@@ -664,6 +664,61 @@ static PTHEME_PROPERTY MSSTYLES_AddMetric(PTHEME_FILE tf, int iPropertyPrimitive
return
cur
;
}
/* Color-related state for theme ini parsing */
struct
PARSECOLORSTATE
{
int
colorCount
;
int
colorElements
[
TMT_LASTCOLOR
-
TMT_FIRSTCOLOR
];
COLORREF
colorRgb
[
TMT_LASTCOLOR
-
TMT_FIRSTCOLOR
];
int
captionColors
;
};
inline
void
parse_init_color
(
struct
PARSECOLORSTATE
*
state
)
{
memset
(
state
,
0
,
sizeof
(
*
state
));
}
static
BOOL
parse_handle_color_property
(
struct
PARSECOLORSTATE
*
state
,
int
iPropertyId
,
LPCWSTR
lpValue
,
DWORD
dwValueLen
)
{
int
r
,
g
,
b
;
LPCWSTR
lpValueEnd
=
lpValue
+
dwValueLen
;
MSSTYLES_GetNextInteger
(
lpValue
,
lpValueEnd
,
&
lpValue
,
&
r
);
MSSTYLES_GetNextInteger
(
lpValue
,
lpValueEnd
,
&
lpValue
,
&
g
);
if
(
MSSTYLES_GetNextInteger
(
lpValue
,
lpValueEnd
,
&
lpValue
,
&
b
))
{
state
->
colorElements
[
state
->
colorCount
]
=
iPropertyId
-
TMT_FIRSTCOLOR
;
state
->
colorRgb
[
state
->
colorCount
++
]
=
RGB
(
r
,
g
,
b
);
switch
(
iPropertyId
)
{
case
TMT_ACTIVECAPTION
:
state
->
captionColors
|=
0x1
;
break
;
case
TMT_INACTIVECAPTION
:
state
->
captionColors
|=
0x2
;
break
;
case
TMT_GRADIENTACTIVECAPTION
:
state
->
captionColors
|=
0x4
;
break
;
case
TMT_GRADIENTINACTIVECAPTION
:
state
->
captionColors
|=
0x8
;
break
;
}
return
TRUE
;
}
else
{
return
FALSE
;
}
}
static
void
parse_apply_color
(
struct
PARSECOLORSTATE
*
state
)
{
if
(
state
->
colorCount
>
0
)
SetSysColors
(
state
->
colorCount
,
state
->
colorElements
,
state
->
colorRgb
);
if
(
state
->
captionColors
==
0xf
)
SystemParametersInfoW
(
SPI_SETGRADIENTCAPTIONS
,
0
,
(
PVOID
)
TRUE
,
0
);
}
/***********************************************************************
* MSSTYLES_ParseThemeIni
*
...
...
@@ -696,42 +751,18 @@ void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics)
while
((
lpName
=
UXINI_GetNextSection
(
ini
,
&
dwLen
)))
{
if
(
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
lpName
,
dwLen
,
szSysMetrics
,
-
1
)
==
CSTR_EQUAL
)
{
int
colorCount
=
0
;
int
colorElements
[
TMT_LASTCOLOR
-
TMT_FIRSTCOLOR
];
COLORREF
colorRgb
[
TMT_LASTCOLOR
-
TMT_FIRSTCOLOR
];
LPCWSTR
lpValueEnd
;
int
captionColors
=
0
;
struct
PARSECOLORSTATE
colorState
;
parse_init_color
(
&
colorState
);
while
((
lpName
=
UXINI_GetNextValue
(
ini
,
&
dwLen
,
&
lpValue
,
&
dwValueLen
)))
{
lstrcpynW
(
szPropertyName
,
lpName
,
min
(
dwLen
+
1
,
sizeof
(
szPropertyName
)
/
sizeof
(
szPropertyName
[
0
])));
if
(
MSSTYLES_LookupProperty
(
szPropertyName
,
&
iPropertyPrimitive
,
&
iPropertyId
))
{
if
(
iPropertyId
>=
TMT_FIRSTCOLOR
&&
iPropertyId
<=
TMT_LASTCOLOR
)
{
int
r
,
g
,
b
;
lpValueEnd
=
lpValue
+
dwValueLen
;
MSSTYLES_GetNextInteger
(
lpValue
,
lpValueEnd
,
&
lpValue
,
&
r
);
MSSTYLES_GetNextInteger
(
lpValue
,
lpValueEnd
,
&
lpValue
,
&
g
);
if
(
MSSTYLES_GetNextInteger
(
lpValue
,
lpValueEnd
,
&
lpValue
,
&
b
))
{
colorElements
[
colorCount
]
=
iPropertyId
-
TMT_FIRSTCOLOR
;
colorRgb
[
colorCount
++
]
=
RGB
(
r
,
g
,
b
);
switch
(
iPropertyId
)
{
case
TMT_ACTIVECAPTION
:
captionColors
|=
0x1
;
break
;
case
TMT_INACTIVECAPTION
:
captionColors
|=
0x2
;
break
;
case
TMT_GRADIENTACTIVECAPTION
:
captionColors
|=
0x4
;
break
;
case
TMT_GRADIENTINACTIVECAPTION
:
captionColors
|=
0x8
;
break
;
}
}
else
{
FIXME
(
"Invalid color value for %s
\n
"
,
debugstr_w
(
szPropertyName
));
}
if
(
!
parse_handle_color_property
(
&
colorState
,
iPropertyId
,
lpValue
,
dwValueLen
))
FIXME
(
"Invalid color value for %s
\n
"
,
debugstr_w
(
szPropertyName
));
}
else
if
(
setMetrics
&&
(
iPropertyId
==
TMT_FLATMENUS
))
{
BOOL
flatMenus
=
(
*
lpValue
==
'T'
)
||
(
*
lpValue
==
't'
);
...
...
@@ -744,10 +775,7 @@ void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics)
TRACE
(
"Unknown system metric %s
\n
"
,
debugstr_w
(
szPropertyName
));
}
}
if
(
setMetrics
&&
(
colorCount
>
0
))
SetSysColors
(
colorCount
,
colorElements
,
colorRgb
);
if
(
setMetrics
&&
(
captionColors
==
0xf
))
SystemParametersInfoW
(
SPI_SETGRADIENTCAPTIONS
,
0
,
(
PVOID
)
TRUE
,
0
);
if
(
setMetrics
)
parse_apply_color
(
&
colorState
);
continue
;
}
if
(
MSSTYLES_ParseIniSectionName
(
lpName
,
dwLen
,
szAppName
,
szClassName
,
&
iPartId
,
&
iStateId
))
{
...
...
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