//Copyright (c) 1997-2000 Microsoft Corporation #ifndef _INC_SCHEMES_H #define _INC_SCHEMES_H // HACK - THESE VALUES ARE HARD CODED #define COLOR_MAX_95_NT4 25 #if(WINVER >= 0x0501) #define COLOR_MAX_97_NT5 31 #elif(WINVER == 0x0500) #define COLOR_MAX_97_NT5 29 #else #define COLOR_MAX_97_NT5 25 #endif #define MAX_THEME_SZ 512 #define MAX_NUM_SZ 20 #define DEF_SPACING 43 // default horizontal and vertical icon spacing #define CONTROL_PANEL_DESKTOP TEXT("Control Panel\\Desktop") #define CURSOR_BLINK_RATE TEXT("CursorBlinkRate") #define DEFAULT_BLINK_RATE 530 DWORD WINAPI RegQueryStrDW(DWORD dwDefault, HKEY hkey, LPTSTR lpSubKey, LPTSTR lpValueName); BOOL RegSetStrDW(HKEY hkey, LPTSTR lpSection, LPCTSTR lpKeyName, DWORD dwValue); #include "resource.h" #include "CurSchme.h" // Specify all external variables extern PTSTR s_pszColorNames[]; // JMC: HACK extern TCHAR g_szColors[]; // = TEXT("colors"); // colors section name // Location of the Colors subkey in Registry; Defined in RegStr.h extern TCHAR szRegStr_Colors[]; // = REGSTR_PATH_COLORS; extern TCHAR g_winScheme[]; // Scheme data used locally by this app - NOTE: This structure // does NOT use or need the A and W forms for its members. The other schemedata's // MUST use the A and W forms since that's how they are stored in the registry typedef struct { int nNameStringId; // the rid of the name of the color scheme TCHAR szNameIndexId[MAX_NUM_SZ]; // the index into HKCU\Control Panel\Appearance\New Schemes int nColorsUsed; COLORREF rgb[COLOR_MAX_97_NT5]; } SCHEMEDATALOCAL; struct PORTABLE_NONCLIENTMETRICS { // Non-ClientMetric storage area int m_iBorderWidth; int m_iScrollWidth; int m_iScrollHeight; int m_iCaptionWidth; int m_iCaptionHeight; int m_lfCaptionFont_lfHeight; int m_lfCaptionFont_lfWeight; int m_iSmCaptionWidth; int m_iSmCaptionHeight; int m_lfSmCaptionFont_lfHeight; int m_lfSmCaptionFont_lfWeight; int m_iMenuWidth; int m_iMenuHeight; int m_lfMenuFont_lfHeight; int m_lfMenuFont_lfWeight; int m_lfStatusFont_lfHeight; int m_lfStatusFont_lfWeight; int m_lfMessageFont_lfHeight; int m_lfMessageFont_lfWeight; int m_lfIconWindowsDefault_lfHeight; int m_lfIconWindowsDefault_lfWeight; int m_nFontFaces; // 0 = NoChanges, 1 = Use WindowsDefault font face void SetToWindowsDefault() { m_nFontFaces = 1; int rgnValues[MAX_DISTINCT_VALUES]; int nCountValues; LoadArrayFromStringTable(IDS_WINDOWSDEFAULTSIZES, rgnValues, &nCountValues); _ASSERTE(21 == nCountValues); if(21 != nCountValues) { // Below is the hard-coded defaults for the window metrics m_iBorderWidth = 1; m_iScrollWidth = 16; m_iScrollHeight = 16; m_iCaptionWidth = 18; m_iCaptionHeight = 18; m_lfCaptionFont_lfHeight = -11; m_lfCaptionFont_lfWeight = 700; m_iSmCaptionWidth = 15; m_iSmCaptionHeight = 15; m_lfSmCaptionFont_lfHeight = -11; m_lfSmCaptionFont_lfWeight = 700; m_iMenuWidth = 18; m_iMenuHeight = 18; m_lfMenuFont_lfHeight = -11; m_lfMenuFont_lfWeight = 400; m_lfStatusFont_lfHeight = -11; m_lfStatusFont_lfWeight = 400; m_lfMessageFont_lfHeight = -11; m_lfMessageFont_lfWeight = 400; m_lfIconWindowsDefault_lfHeight = -11; m_lfIconWindowsDefault_lfWeight = 400; } else { m_iBorderWidth = rgnValues[0]; m_iScrollWidth = rgnValues[1]; m_iScrollHeight = rgnValues[2]; m_iCaptionWidth = rgnValues[3]; m_iCaptionHeight = rgnValues[4]; m_lfCaptionFont_lfHeight = rgnValues[5]; m_lfCaptionFont_lfWeight = rgnValues[6]; m_iSmCaptionWidth = rgnValues[7]; m_iSmCaptionHeight = rgnValues[8]; m_lfSmCaptionFont_lfHeight = rgnValues[9]; m_lfSmCaptionFont_lfWeight = rgnValues[10]; m_iMenuWidth = rgnValues[11]; m_iMenuHeight = rgnValues[12]; m_lfMenuFont_lfHeight = rgnValues[13]; m_lfMenuFont_lfWeight = rgnValues[14]; m_lfStatusFont_lfHeight = rgnValues[15]; m_lfStatusFont_lfWeight = rgnValues[16]; m_lfMessageFont_lfHeight = rgnValues[17]; m_lfMessageFont_lfWeight = rgnValues[18]; m_lfIconWindowsDefault_lfHeight = rgnValues[19]; m_lfIconWindowsDefault_lfWeight = rgnValues[20]; } } void LoadOriginal() { NONCLIENTMETRICS ncmTemp; LOGFONT lfIcon; GetNonClientMetrics(&ncmTemp, &lfIcon); m_iBorderWidth = ncmTemp.iBorderWidth; m_iScrollWidth = ncmTemp.iScrollWidth; m_iScrollHeight = ncmTemp.iScrollHeight; m_iCaptionWidth = ncmTemp.iCaptionWidth; m_iCaptionHeight = ncmTemp.iCaptionHeight; m_lfCaptionFont_lfHeight = ncmTemp.lfCaptionFont.lfHeight; m_lfCaptionFont_lfWeight = ncmTemp.lfCaptionFont.lfWeight; m_iSmCaptionWidth = ncmTemp.iSmCaptionWidth; m_iSmCaptionHeight = ncmTemp.iSmCaptionHeight; m_lfSmCaptionFont_lfHeight = ncmTemp.lfSmCaptionFont.lfHeight; m_lfSmCaptionFont_lfWeight = ncmTemp.lfSmCaptionFont.lfWeight; m_iMenuWidth = ncmTemp.iMenuWidth; m_iMenuHeight = ncmTemp.iMenuHeight; m_lfMenuFont_lfHeight = ncmTemp.lfMenuFont.lfHeight; m_lfMenuFont_lfWeight = ncmTemp.lfMenuFont.lfWeight; m_lfStatusFont_lfHeight = ncmTemp.lfStatusFont.lfHeight; m_lfStatusFont_lfWeight = ncmTemp.lfStatusFont.lfWeight; m_lfMessageFont_lfHeight = ncmTemp.lfMessageFont.lfHeight; m_lfMessageFont_lfWeight = ncmTemp.lfMessageFont.lfWeight; m_lfIconWindowsDefault_lfHeight = lfIcon.lfHeight; m_lfIconWindowsDefault_lfWeight = lfIcon.lfWeight; m_nFontFaces = 0; } void ApplyChanges() const; }; struct WIZSCHEME { WIZSCHEME() { ZeroMemory(this, sizeof(*this)); m_cbSize = sizeof(*this); m_dwVersion = 0x000000FF; ClearTheme(); ClearWallpaper(); m_nSelectedSize = -1; m_szSelectedStyle[0] = 0; } DWORD m_cbSize; DWORD m_dwVersion; COLORREF m_rgb[COLOR_MAX_97_NT5]; void LoadOriginal(); FILTERKEYS m_FILTERKEYS; MOUSEKEYS m_MOUSEKEYS; STICKYKEYS m_STICKYKEYS; TOGGLEKEYS m_TOGGLEKEYS; SOUNDSENTRY m_SOUNDSENTRY; ACCESSTIMEOUT m_ACCESSTIMEOUT; // SERIALKEYS m_SERIALKEYS; BOOL m_bShowSounds; BOOL m_bShowExtraKeyboardHelp; BOOL m_bSwapMouseButtons; int m_nMouseTrails; int m_nMouseSpeed; int m_nIconSize; int m_nCursorScheme; // int m_nScrollWidth; // int m_nBorderWidth; PORTABLE_NONCLIENTMETRICS m_PortableNonClientMetrics; #ifdef _DEBUG void Dump() { FILE *pStream = fopen( "c:\\txt.acw", "w" ); if(pStream) { for(int i=0;i=16 and <=72 if( (dwNewSize>=16) && (dwNewSize<=72) ) { // get the current cell size of icon (includes spacing) ICONMETRICS iconmetrics; iconmetrics.cbSize = sizeof(ICONMETRICS); SystemParametersInfo(SPI_GETICONMETRICS, sizeof(ICONMETRICS), &iconmetrics, 0); // compute the new cell size (including spacing) iconmetrics.iHorzSpacing = dwNewSize + DEF_SPACING; iconmetrics.iVertSpacing = iconmetrics.iHorzSpacing; // update both the icon size and icon cell size and send notifications wsprintf( szBuffer, TEXT("%d"), dwNewSize ); RegSetValueEx( hKey, TEXT("Shell Icon Size"), 0, REG_SZ, (LPBYTE)szBuffer, (lstrlen(szBuffer) + 1) * sizeof(TCHAR) ); SystemParametersInfo(SPI_SETICONMETRICS, sizeof(ICONMETRICS) , &iconmetrics, SPIF_SENDWININICHANGE); SendMessage( HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETICONMETRICS , 0/*(LPARAM)("WindowMetrics")*/ ); } } // Clean up RegCloseKey( hKey ); } // Let everyone know that things changed return dwOldSize; #undef MAX_LENGTH } /////////////////////////////////////////////////////////////////////////// // New in Whistler /////////////////////////////////////////////////////////////////////////// DWORD m_dwCaretWidth; UINT m_uCursorBlinkTime; TCHAR m_szWallpaper[MAX_THEME_SZ]; TCHAR m_szThemeName[MAX_THEME_SZ]; TCHAR m_szThemeColor[MAX_THEME_SZ]; TCHAR m_szThemeSize[MAX_THEME_SZ]; BOOL m_fFlatMenus; BOOL m_fDropShadows; TCHAR m_szSelectedStyle[MAX_NUM_SZ]; // this is a number 0 thru 21 (21 color schemes) int m_nSelectedSize; // this is a number 0 thru 3 (normal, large, extra large) void UpdateSelectedSize(int nSelectedSize, LPCTSTR pszSelectedStyle); void SetHCFlag(BOOL fSetOn); void SaveTheme(); BOOL SetTheme(LPCTSTR pszThemeName, LPCTSTR pszThemeColor, LPCTSTR pszThemeSize); void ClearTheme() { m_szThemeName[0] = 0; m_szThemeColor[0] = 0; m_szThemeSize[0] = 0; } void SaveWallpaper(); void SetWallpaper(LPCTSTR pszWallpaper); void ClearWallpaper() { m_szWallpaper[0] = 0; } void SetStyleNSize(); }; int GetSchemeCount(); void GetSchemeName(int nIndex, LPTSTR lpszName, int nLen); SCHEMEDATALOCAL &GetScheme(int nIndex); ////////////////////////////////////////////////////////////////////////////////// // Legacy scheme structures - only used for reading ACW files ////////////////////////////////////////////////////////////////////////////////// #define COLOR_MAX_WIN9X 25 #define COLOR_MAX_NT400 25 #define COLOR_MAX_NT500 29 #define COLOR_MAX_NT501 31 #define WIZSCHEME_LEGACY_STRUCT(szStruct, szName, nColors) \ struct szStruct \ { \ szStruct() \ { \ ZeroMemory(this, sizeof(*this)); \ m_cbSize = sizeof(*this); \ m_dwVersion = 0x000000FF; \ } \ DWORD m_cbSize; \ DWORD m_dwVersion; \ COLORREF m_rgb[nColors]; \ FILTERKEYS m_FILTERKEYS; \ MOUSEKEYS m_MOUSEKEYS; \ STICKYKEYS m_STICKYKEYS; \ TOGGLEKEYS m_TOGGLEKEYS; \ SOUNDSENTRY m_SOUNDSENTRY; \ ACCESSTIMEOUT m_ACCESSTIMEOUT; \ BOOL m_bShowSounds; \ BOOL m_bShowExtraKeyboardHelp; \ BOOL m_bSwapMouseButtons; \ int m_nMouseTrails; \ int m_nMouseSpeed; \ int m_nIconSize; \ int m_nCursorScheme; \ PORTABLE_NONCLIENTMETRICS m_PortableNonClientMetrics; \ } szName; #define WIZSCHEME_COPY_LEGACY(dst, src) \ { \ /* ignore m_cbSize */ \ dst.m_dwVersion = src.m_dwVersion; \ memcpy(dst.m_rgb, src.m_rgb, min(sizeof(dst.m_rgb), sizeof(src.m_rgb))); \ dst.m_FILTERKEYS= src.m_FILTERKEYS; \ dst.m_MOUSEKEYS= src.m_MOUSEKEYS; \ dst.m_STICKYKEYS= src.m_STICKYKEYS; \ dst.m_TOGGLEKEYS= src.m_TOGGLEKEYS; \ dst.m_SOUNDSENTRY= src.m_SOUNDSENTRY; \ dst.m_ACCESSTIMEOUT= src.m_ACCESSTIMEOUT; \ dst.m_bShowSounds= src.m_bShowSounds; \ dst.m_bShowExtraKeyboardHelp= src.m_bShowExtraKeyboardHelp; \ dst.m_bSwapMouseButtons= src.m_bSwapMouseButtons; \ dst.m_nMouseTrails= src.m_nMouseTrails; \ dst.m_nMouseSpeed= src.m_nMouseSpeed; \ dst.m_nIconSize= src.m_nIconSize; \ dst.m_nCursorScheme= src.m_nCursorScheme; \ dst.m_PortableNonClientMetrics= src.m_PortableNonClientMetrics; \ } /////////////////////////////////////////// // Stuff for Fonts int GetFontCount(); void GetFontLogFont(int nIndex, LOGFONT *pLogFont); #endif // _INC_SCHEMES_H