Commit 877d12f8 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

uxtheme: Support more HiDPI properties.

parent 4b2777db
......@@ -144,6 +144,24 @@ HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId,
return DrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, &opts);
}
/* Map integer 1..7 to TMT_MINDPI1..TMT_MINDPI7 */
static int mindpi_index_to_property(int index)
{
return index <= 5 ? TMT_MINDPI1 + index - 1 : TMT_MINDPI6 + index - 6;
}
/* Map integer 1..7 to TMT_MINSIZE1..TMT_MINSIZE7 */
static int minsize_index_to_property(int index)
{
return index <= 5 ? TMT_MINSIZE1 + index - 1 : TMT_MINSIZE6 + index - 6;
}
/* Map integer 1..7 to TMT_IMAGEFILE1..TMT_IMAGEFILE7 */
static int imagefile_index_to_property(int index)
{
return index <= 5 ? TMT_IMAGEFILE1 + index - 1 : TMT_IMAGEFILE6 + index - 6;
}
/***********************************************************************
* UXTHEME_SelectImage
*
......@@ -171,16 +189,20 @@ static PTHEME_PROPERTY UXTHEME_SelectImage(HTHEME hTheme, HDC hdc, int iPartId,
if(imageselecttype == IST_DPI) {
int reqdpi = 0;
int screendpi = GetDeviceCaps(hdc, LOGPIXELSX);
for(i=4; i>=0; i--) {
for (i = 7; i >= 1; i--)
{
reqdpi = 0;
if(SUCCEEDED(GetThemeInt(hTheme, iPartId, iStateId, i + TMT_MINDPI1, &reqdpi))) {
if (SUCCEEDED(GetThemeInt(hTheme, iPartId, iStateId, mindpi_index_to_property(i),
&reqdpi)))
{
if(reqdpi != 0 && screendpi >= reqdpi) {
TRACE("Using %d DPI, image %d\n", reqdpi, i + TMT_IMAGEFILE1);
TRACE("Using %d DPI, image %d\n", reqdpi, imagefile_index_to_property(i));
if (imageDpi)
*imageDpi = reqdpi;
return MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, i + TMT_IMAGEFILE1);
return MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME,
imagefile_index_to_property(i));
}
}
}
......@@ -190,11 +212,16 @@ static PTHEME_PROPERTY UXTHEME_SelectImage(HTHEME hTheme, HDC hdc, int iPartId,
else if(imageselecttype == IST_SIZE) {
POINT size = {pRect->right-pRect->left, pRect->bottom-pRect->top};
POINT reqsize;
for(i=4; i>=0; i--) {
PTHEME_PROPERTY fileProp =
MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, i + TMT_IMAGEFILE1);
for (i = 7; i >= 1; i--)
{
PTHEME_PROPERTY fileProp;
fileProp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME,
imagefile_index_to_property(i));
if (!fileProp) continue;
if(FAILED(GetThemePosition(hTheme, iPartId, iStateId, i + TMT_MINSIZE1, &reqsize))) {
if (FAILED(GetThemePosition(hTheme, iPartId, iStateId, minsize_index_to_property(i),
&reqsize)))
{
/* fall back to size of Nth image */
WCHAR szPath[MAX_PATH];
int imagelayout = IL_HORIZONTAL;
......@@ -221,7 +248,8 @@ static PTHEME_PROPERTY UXTHEME_SelectImage(HTHEME hTheme, HDC hdc, int iPartId,
}
}
if(reqsize.x <= size.x && reqsize.y <= size.y) {
TRACE("Using image size %dx%d, image %d\n", reqsize.x, reqsize.y, i + TMT_IMAGEFILE1);
TRACE("Using image size %dx%d, image %d\n", reqsize.x, reqsize.y,
imagefile_index_to_property(i));
return fileProp;
}
}
......
......@@ -187,6 +187,8 @@ static const MSSTYLES_PROPERTY_MAP mapProperty[] = {
{TMT_INT, TMT_MINDPI3, L"MINDPI3"},
{TMT_INT, TMT_MINDPI4, L"MINDPI4"},
{TMT_INT, TMT_MINDPI5, L"MINDPI5"},
{TMT_INT, TMT_MINDPI6, L"MINDPI6"},
{TMT_INT, TMT_MINDPI7, L"MINDPI7"},
{TMT_FONT, TMT_GLYPHFONT, L"GLYPHFONT"},
{TMT_FILENAME, TMT_IMAGEFILE, L"IMAGEFILE"},
{TMT_FILENAME, TMT_IMAGEFILE1, L"IMAGEFILE1"},
......@@ -194,6 +196,8 @@ static const MSSTYLES_PROPERTY_MAP mapProperty[] = {
{TMT_FILENAME, TMT_IMAGEFILE3, L"IMAGEFILE3"},
{TMT_FILENAME, TMT_IMAGEFILE4, L"IMAGEFILE4"},
{TMT_FILENAME, TMT_IMAGEFILE5, L"IMAGEFILE5"},
{TMT_FILENAME, TMT_IMAGEFILE6, L"IMAGEFILE6"},
{TMT_FILENAME, TMT_IMAGEFILE7, L"IMAGEFILE7"},
{TMT_FILENAME, TMT_STOCKIMAGEFILE, L"STOCKIMAGEFILE"},
{TMT_FILENAME, TMT_GLYPHIMAGEFILE, L"GLYPHIMAGEFILE"},
{TMT_STRING, TMT_TEXT, L"TEXT"},
......@@ -206,6 +210,8 @@ static const MSSTYLES_PROPERTY_MAP mapProperty[] = {
{TMT_POSITION, TMT_MINSIZE4, L"MINSIZE4"},
{TMT_POSITION, TMT_MINSIZE5, L"MINSIZE5"},
{TMT_POSITION, TMT_NORMALSIZE, L"NORMALSIZE"},
{TMT_POSITION, TMT_MINSIZE6, L"MINSIZE6"},
{TMT_POSITION, TMT_MINSIZE7, L"MINSIZE7"},
{TMT_MARGINS, TMT_SIZINGMARGINS, L"SIZINGMARGINS"},
{TMT_MARGINS, TMT_CONTENTMARGINS, L"CONTENTMARGINS"},
{TMT_MARGINS, TMT_CAPTIONMARGINS, L"CAPTIONMARGINS"},
......
......@@ -322,6 +322,8 @@ BEGIN_TM_PROPS()
TM_PROP(2422, TMT, MINDPI3, INT)
TM_PROP(2423, TMT, MINDPI4, INT)
TM_PROP(2424, TMT, MINDPI5, INT)
TM_PROP(2433, TMT, MINDPI6, INT)
TM_PROP(2434, TMT, MINDPI7, INT)
/* Font rendering properties */
TM_PROP(2601, TMT, GLYPHFONT, FONT)
......@@ -335,6 +337,8 @@ BEGIN_TM_PROPS()
TM_PROP(3006, TMT, IMAGEFILE5, FILENAME)
TM_PROP(3007, TMT, STOCKIMAGEFILE, FILENAME)
TM_PROP(3008, TMT, GLYPHIMAGEFILE, FILENAME)
TM_PROP(3009, TMT, IMAGEFILE6, FILENAME)
TM_PROP(3010, TMT, IMAGEFILE7, FILENAME)
/* String rendering properties */
TM_PROP(3201, TMT, TEXT, STRING)
......@@ -349,6 +353,8 @@ BEGIN_TM_PROPS()
TM_PROP(3407, TMT, MINSIZE4, POSITION)
TM_PROP(3408, TMT, MINSIZE5, POSITION)
TM_PROP(3409, TMT, NORMALSIZE, POSITION)
TM_PROP(3410, TMT, MINSIZE6, POSITION)
TM_PROP(3411, TMT, MINSIZE7, POSITION)
/* Margin rendering properties */
TM_PROP(3601, TMT, SIZINGMARGINS, MARGINS)
......
......@@ -301,6 +301,8 @@ enum GLYPHFONTSIZINGTYPE {
#define TMT_OPACITY 2430
#define TMT_COLORIZATIONCOLOR 2431
#define TMT_COLORIZATIONOPACITY 2432
#define TMT_MINDPI6 2433
#define TMT_MINDPI7 2434
#define TMT_GLYPHFONT 2601
#define TMT_IMAGEFILE 3001
#define TMT_IMAGEFILE1 3002
......@@ -309,6 +311,8 @@ enum GLYPHFONTSIZINGTYPE {
#define TMT_IMAGEFILE4 3005
#define TMT_IMAGEFILE5 3006
#define TMT_GLYPHIMAGEFILE 3008
#define TMT_IMAGEFILE6 3009
#define TMT_IMAGEFILE7 3010
#define TMT_TEXT 3201
#define TMT_CLASSICVALUE 3202
#define TMT_OFFSET 3401
......@@ -320,6 +324,8 @@ enum GLYPHFONTSIZINGTYPE {
#define TMT_MINSIZE4 3407
#define TMT_MINSIZE5 3408
#define TMT_NORMALSIZE 3409
#define TMT_MINSIZE6 3410
#define TMT_MINSIZE7 3411
#define TMT_SIZINGMARGINS 3601
#define TMT_CONTENTMARGINS 3602
#define TMT_CAPTIONMARGINS 3603
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment