user32: Optimize the storage of default color values.
This commit is contained in:
parent
9de9cbb324
commit
ed69ddb37e
|
@ -92,39 +92,43 @@ enum spi_index
|
||||||
SPI_INDEX_COUNT
|
SPI_INDEX_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const DefSysColors[] =
|
static const struct
|
||||||
{
|
{
|
||||||
"Scrollbar", "212 208 200", /* COLOR_SCROLLBAR */
|
const char *name;
|
||||||
"Background", "58 110 165", /* COLOR_BACKGROUND */
|
COLORREF rgb;
|
||||||
"ActiveTitle", "10 36 106", /* COLOR_ACTIVECAPTION */
|
} DefSysColors[] =
|
||||||
"InactiveTitle", "128 128 128", /* COLOR_INACTIVECAPTION */
|
{
|
||||||
"Menu", "212 208 200", /* COLOR_MENU */
|
{"Scrollbar", RGB(212, 208, 200)}, /* COLOR_SCROLLBAR */
|
||||||
"Window", "255 255 255", /* COLOR_WINDOW */
|
{"Background", RGB(58, 110, 165)}, /* COLOR_BACKGROUND */
|
||||||
"WindowFrame", "0 0 0", /* COLOR_WINDOWFRAME */
|
{"ActiveTitle", RGB(10, 36, 106)}, /* COLOR_ACTIVECAPTION */
|
||||||
"MenuText", "0 0 0", /* COLOR_MENUTEXT */
|
{"InactiveTitle", RGB(128, 128, 128)}, /* COLOR_INACTIVECAPTION */
|
||||||
"WindowText", "0 0 0", /* COLOR_WINDOWTEXT */
|
{"Menu", RGB(212, 208, 200)}, /* COLOR_MENU */
|
||||||
"TitleText", "255 255 255", /* COLOR_CAPTIONTEXT */
|
{"Window", RGB(255, 255, 255)}, /* COLOR_WINDOW */
|
||||||
"ActiveBorder", "212 208 200", /* COLOR_ACTIVEBORDER */
|
{"WindowFrame", RGB(0, 0, 0)}, /* COLOR_WINDOWFRAME */
|
||||||
"InactiveBorder", "212 208 200", /* COLOR_INACTIVEBORDER */
|
{"MenuText", RGB(0, 0, 0)}, /* COLOR_MENUTEXT */
|
||||||
"AppWorkSpace", "128 128 128", /* COLOR_APPWORKSPACE */
|
{"WindowText", RGB(0, 0, 0)}, /* COLOR_WINDOWTEXT */
|
||||||
"Hilight", "10 36 106", /* COLOR_HIGHLIGHT */
|
{"TitleText", RGB(255, 255, 255)}, /* COLOR_CAPTIONTEXT */
|
||||||
"HilightText", "255 255 255", /* COLOR_HIGHLIGHTTEXT */
|
{"ActiveBorder", RGB(212, 208, 200)}, /* COLOR_ACTIVEBORDER */
|
||||||
"ButtonFace", "212 208 200", /* COLOR_BTNFACE */
|
{"InactiveBorder", RGB(212, 208, 200)}, /* COLOR_INACTIVEBORDER */
|
||||||
"ButtonShadow", "128 128 128", /* COLOR_BTNSHADOW */
|
{"AppWorkSpace", RGB(128, 128, 128)}, /* COLOR_APPWORKSPACE */
|
||||||
"GrayText", "128 128 128", /* COLOR_GRAYTEXT */
|
{"Hilight", RGB(10, 36, 106)}, /* COLOR_HIGHLIGHT */
|
||||||
"ButtonText", "0 0 0", /* COLOR_BTNTEXT */
|
{"HilightText", RGB(255, 255, 255)}, /* COLOR_HIGHLIGHTTEXT */
|
||||||
"InactiveTitleText", "212 208 200", /* COLOR_INACTIVECAPTIONTEXT */
|
{"ButtonFace", RGB(212, 208, 200)}, /* COLOR_BTNFACE */
|
||||||
"ButtonHilight", "255 255 255", /* COLOR_BTNHIGHLIGHT */
|
{"ButtonShadow", RGB(128, 128, 128)}, /* COLOR_BTNSHADOW */
|
||||||
"ButtonDkShadow", "64 64 64", /* COLOR_3DDKSHADOW */
|
{"GrayText", RGB(128, 128, 128)}, /* COLOR_GRAYTEXT */
|
||||||
"ButtonLight", "212 208 200", /* COLOR_3DLIGHT */
|
{"ButtonText", RGB(0, 0, 0)}, /* COLOR_BTNTEXT */
|
||||||
"InfoText", "0 0 0", /* COLOR_INFOTEXT */
|
{"InactiveTitleText", RGB(212, 208, 200)}, /* COLOR_INACTIVECAPTIONTEXT */
|
||||||
"InfoWindow", "255 255 225", /* COLOR_INFOBK */
|
{"ButtonHilight", RGB(255, 255, 255)}, /* COLOR_BTNHIGHLIGHT */
|
||||||
"ButtonAlternateFace", "181 181 181", /* COLOR_ALTERNATEBTNFACE */
|
{"ButtonDkShadow", RGB(64, 64, 64)}, /* COLOR_3DDKSHADOW */
|
||||||
"HotTrackingColor", "0 0 128", /* COLOR_HOTLIGHT */
|
{"ButtonLight", RGB(212, 208, 200)}, /* COLOR_3DLIGHT */
|
||||||
"GradientActiveTitle", "166 202 240", /* COLOR_GRADIENTACTIVECAPTION */
|
{"InfoText", RGB(0, 0, 0)}, /* COLOR_INFOTEXT */
|
||||||
"GradientInactiveTitle", "192 192 192", /* COLOR_GRADIENTINACTIVECAPTION */
|
{"InfoWindow", RGB(255, 255, 225)}, /* COLOR_INFOBK */
|
||||||
"MenuHilight", "10 36 106", /* COLOR_MENUHILIGHT */
|
{"ButtonAlternateFace", RGB(181, 181, 181)}, /* COLOR_ALTERNATEBTNFACE */
|
||||||
"MenuBar", "212 208 200" /* COLOR_MENUBAR */
|
{"HotTrackingColor", RGB(0, 0, 128)}, /* COLOR_HOTLIGHT */
|
||||||
|
{"GradientActiveTitle", RGB(166, 202, 240)}, /* COLOR_GRADIENTACTIVECAPTION */
|
||||||
|
{"GradientInactiveTitle", RGB(192, 192, 192)}, /* COLOR_GRADIENTINACTIVECAPTION */
|
||||||
|
{"MenuHilight", RGB(10, 36, 106)}, /* COLOR_MENUHILIGHT */
|
||||||
|
{"MenuBar", RGB(212, 208, 200)} /* COLOR_MENUBAR */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -927,21 +931,22 @@ void SYSPARAMS_Init(void)
|
||||||
if (hkey)
|
if (hkey)
|
||||||
{
|
{
|
||||||
DWORD dwDataSize = sizeof(buffer);
|
DWORD dwDataSize = sizeof(buffer);
|
||||||
if (!(RegQueryValueExA(hkey,DefSysColors[i*2], 0, 0, (LPBYTE) buffer, &dwDataSize)))
|
if (!(RegQueryValueExA(hkey,DefSysColors[i].name, 0, 0, (LPBYTE) buffer, &dwDataSize)))
|
||||||
if (sscanf( buffer, "%d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
|
if (sscanf( buffer, "%d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* second try, win.ini */
|
/* second try, win.ini */
|
||||||
if (!bOk)
|
if (!bOk)
|
||||||
{
|
{
|
||||||
GetProfileStringA( "colors", DefSysColors[i*2], DefSysColors[i*2+1], buffer, 100 );
|
GetProfileStringA( "colors", DefSysColors[i].name, NULL, buffer, 100 );
|
||||||
if (sscanf( buffer, " %d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
|
if (sscanf( buffer, " %d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* last chance, take the default */
|
/* else, take the default */
|
||||||
if (!bOk) sscanf( DefSysColors[i*2+1], " %d %d %d", &r, &g, &b );
|
if (!bOk)
|
||||||
|
SYSPARAMS_SetSysColor( i, DefSysColors[i].rgb );
|
||||||
SYSPARAMS_SetSysColor( i, RGB(r,g,b) );
|
else
|
||||||
|
SYSPARAMS_SetSysColor( i, RGB(r,g,b) );
|
||||||
}
|
}
|
||||||
if (hkey) RegCloseKey( hkey );
|
if (hkey) RegCloseKey( hkey );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue