Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

629 lines
19 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // File: plustab.cpp
  4. //
  5. // Main Implementation of the Effects page
  6. //
  7. //---------------------------------------------------------------------------
  8. #include "precomp.hxx"
  9. #include "shlwapip.h"
  10. #include "shlguidp.h"
  11. #include "EffectsAdvPg.h"
  12. #include "store.h"
  13. #pragma hdrstop
  14. // OLE-Registry magic number
  15. GUID g_CLSID_CplExt = { 0x41e300e0, 0x78b6, 0x11ce,
  16. { 0x84, 0x9b, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}
  17. };
  18. #define SPI_GETKEYBOARDINDICATORS SPI_GETMENUUNDERLINES//0x100A
  19. #define SPI_SETKEYBOARDINDICATORS SPI_SETMENUUNDERLINES//0x100B
  20. #define SPI_GETFONTCLEARTYPE 116
  21. #define SPI_SETFONTCLEARTYPE 117
  22. //Defines for getting registry settings
  23. const TCHAR c_szHICKey[] = TEXT("Control Panel\\Desktop\\WindowMetrics"); // show icons using highest possible colors
  24. const TCHAR c_szHICVal[] = TEXT("Shell Icon BPP"); // (4 if the checkbox is false, otherwise 16, don't set it to anything else)
  25. const TCHAR c_szSSKey[] = TEXT("Control Panel\\Desktop");
  26. const TCHAR c_szSSVal[] = TEXT("SmoothScroll");
  27. const TCHAR c_szWMSISVal[] = TEXT("Shell Icon Size"); // Normal Icon Size (default 32 x 32)
  28. #ifdef INET_EXP_ICON
  29. const TCHAR c_szIEXP[] = TEXT("\\Program Files\\Microsoft Internet Explorer 4");
  30. #endif
  31. // Handle to the DLL
  32. extern HINSTANCE g_hInst;
  33. BOOL g_bMirroredOS = FALSE;
  34. // vars needed for new shell api
  35. #define SZ_SHELL32 TEXT("shell32.dll")
  36. #define SZ_SHUPDATERECYCLEBINICON "SHUpdateRecycleBinIcon" // Parameter for GetProcAddr()... DO NOT TEXT("") IT!
  37. HINSTANCE g_hmodShell32 = NULL;
  38. typedef void (* PFNSHUPDATERECYCLEBINICON)( void );
  39. // Function prototype
  40. BOOL CALLBACK PlusPackDlgProc( HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam );
  41. // Icon Stuff
  42. int GetIconState (void);
  43. BOOL ChangeIconSizes(int iOldState, int iNewState);
  44. // animation stuff
  45. WPARAM GetAnimations(DWORD *pdwEffect);
  46. void SetAnimations(WPARAM wVal, DWORD dwEffect);
  47. BOOL DisplayFontSmoothingDetails(DWORD *pdwSetting)
  48. {
  49. return FALSE;
  50. }
  51. int GetBitsPerPixel(void)
  52. {
  53. int iBitsPerPixel = 8;
  54. HDC hDC = GetDC(NULL);
  55. if (hDC)
  56. {
  57. iBitsPerPixel = GetDeviceCaps(hDC, BITSPIXEL);
  58. ReleaseDC(NULL, hDC);
  59. }
  60. return iBitsPerPixel;
  61. }
  62. int GetIconState(void)
  63. {
  64. BOOL bRet;
  65. int iSize;
  66. bRet = GetRegValueInt(HKEY_CURRENT_USER, c_szHICKey, c_szWMSISVal, &iSize);
  67. if (bRet == FALSE)
  68. return ICON_DEFAULT;
  69. if (iSize == ICON_DEFAULT_NORMAL)
  70. return ICON_DEFAULT;
  71. else if (iSize == ICON_DEFAULT_LARGE)
  72. return ICON_LARGE;
  73. return ICON_INDETERMINATE;
  74. }
  75. BOOL ChangeIconSizes(int iOldState, int iNewState)
  76. {
  77. BOOL bRet;
  78. int iOldSize, iNewSize;
  79. int iHorz;
  80. int iVert;
  81. // Don't bother if nothing changed
  82. if (iOldState == iNewState)
  83. return FALSE;
  84. // Get New Size
  85. switch (iNewState)
  86. {
  87. case ICON_DEFAULT:
  88. iNewSize = ICON_DEFAULT_NORMAL;
  89. break;
  90. case ICON_LARGE:
  91. iNewSize = ICON_DEFAULT_LARGE;
  92. break;
  93. case ICON_INDETERMINATE:
  94. // Don't bother to change anything
  95. return FALSE;
  96. default:
  97. return FALSE;
  98. }
  99. // Get Original Size
  100. bRet = GetRegValueInt (HKEY_CURRENT_USER, c_szHICKey, c_szWMSISVal, &iOldSize);
  101. if (!bRet)
  102. {
  103. // Try geting system default instead
  104. iOldSize = GetSystemMetrics (SM_CXICON);
  105. }
  106. // Don't need to change size if nothing has really changed
  107. if (iNewSize == iOldSize)
  108. return FALSE;
  109. // Get new horizontal spacing
  110. iHorz = GetSystemMetrics (SM_CXICONSPACING);
  111. iHorz -= iOldSize;
  112. if (iHorz < 0)
  113. {
  114. iHorz = 0;
  115. }
  116. iHorz += iNewSize;
  117. // Get new vertical spacing
  118. iVert = GetSystemMetrics (SM_CYICONSPACING);
  119. iVert -= iOldSize;
  120. if (iVert < 0)
  121. {
  122. iVert = 0;
  123. }
  124. iVert += iNewSize;
  125. // Set New sizes and spacing
  126. bRet = SetRegValueInt( HKEY_CURRENT_USER, c_szHICKey, c_szWMSISVal, iNewSize );
  127. if (!bRet)
  128. return FALSE;
  129. SystemParametersInfo( SPI_ICONHORIZONTALSPACING, iHorz, NULL, SPIF_UPDATEINIFILE );
  130. SystemParametersInfo( SPI_ICONVERTICALSPACING, iVert, NULL, SPIF_UPDATEINIFILE );
  131. // We did change the sizes
  132. return TRUE;
  133. }
  134. //
  135. // GetAnimations
  136. //
  137. // Get current state of animations (windows / menus / etc.).
  138. //
  139. WPARAM GetAnimations(DWORD *pdwEffect)
  140. {
  141. BOOL fMenu = FALSE, fWindow = FALSE, fCombo = FALSE, fSmooth = FALSE, fList = FALSE, fFade = FALSE;
  142. ANIMATIONINFO ai;
  143. ai.cbSize = sizeof(ai);
  144. if (SystemParametersInfo( SPI_GETANIMATION, sizeof(ai), (PVOID)&ai, 0 ))
  145. {
  146. fWindow = (ai.iMinAnimate) ? TRUE : FALSE;
  147. }
  148. SystemParametersInfo( SPI_GETCOMBOBOXANIMATION, 0, (PVOID)&fCombo, 0 );
  149. SystemParametersInfo( SPI_GETLISTBOXSMOOTHSCROLLING, 0, (PVOID)&fList, 0 );
  150. SystemParametersInfo( SPI_GETMENUANIMATION, 0, (PVOID)&fMenu, 0 );
  151. fSmooth = (BOOL)GetRegValueDword( HKEY_CURRENT_USER,
  152. (LPTSTR)c_szSSKey,
  153. (LPTSTR)c_szSSVal
  154. );
  155. if (fSmooth == REG_BAD_DWORD)
  156. {
  157. fSmooth = 1;
  158. }
  159. SystemParametersInfo( SPI_GETMENUFADE, 0, (PVOID)&fFade, 0 );
  160. *pdwEffect = (fFade ? MENU_EFFECT_FADE : MENU_EFFECT_SCROLL);
  161. if (fMenu && fWindow && fCombo && fSmooth && fList)
  162. return BST_CHECKED;
  163. if ((!fMenu) && (!fWindow) && (!fCombo) && (!fSmooth) && (!fList))
  164. return BST_UNCHECKED;
  165. return BST_INDETERMINATE;
  166. }
  167. //
  168. // SetAnimations
  169. //
  170. // Set animations according (windows / menus / etc.) according to flag.
  171. //
  172. void SetAnimations(WPARAM wVal, DWORD dwEffect)
  173. {
  174. ANIMATIONINFO ai;
  175. // Note, if the checkbox is indeterminate, we treat it like it was checked.
  176. // We should never get this far if the user didn't change something so this should be okay.
  177. BOOL bVal = (wVal == BST_UNCHECKED) ? 0 : 1;
  178. BOOL bEfx = (dwEffect == MENU_EFFECT_FADE) ? 1 : 0;
  179. ai.cbSize = sizeof(ai);
  180. ai.iMinAnimate = bVal;
  181. SystemParametersInfo( SPI_SETANIMATION, sizeof(ai), (PVOID)&ai, SPIF_UPDATEINIFILE );
  182. SystemParametersInfo( SPI_SETCOMBOBOXANIMATION, 0, IntToPtr(bVal), SPIF_UPDATEINIFILE );
  183. SystemParametersInfo( SPI_SETLISTBOXSMOOTHSCROLLING, 0, IntToPtr(bVal), SPIF_UPDATEINIFILE );
  184. SystemParametersInfo( SPI_SETMENUANIMATION, 0, IntToPtr(bVal), SPIF_UPDATEINIFILE );
  185. SystemParametersInfo( SPI_SETTOOLTIPANIMATION, 0, IntToPtr(bVal), SPIF_UPDATEINIFILE );
  186. SetRegValueDword(HKEY_CURRENT_USER, (LPTSTR)c_szSSKey, (LPTSTR)c_szSSVal, bVal);
  187. SystemParametersInfo( SPI_SETMENUFADE, 0, IntToPtr(bEfx), SPIF_UPDATEINIFILE);
  188. SystemParametersInfo( SPI_SETTOOLTIPFADE, 0, IntToPtr(bEfx), SPIF_UPDATEINIFILE);
  189. SystemParametersInfo( SPI_SETSELECTIONFADE, 0, bVal ? IntToPtr(bEfx) : 0, SPIF_UPDATEINIFILE);
  190. }
  191. CEffectState::CEffectState()
  192. {
  193. }
  194. CEffectState::~CEffectState()
  195. {
  196. }
  197. HRESULT CEffectState::Load(void)
  198. {
  199. HRESULT hr = S_OK;
  200. // Get the values for the settings from the registry and set the checkboxes
  201. // Large Icons
  202. _nLargeIcon = GetIconState();
  203. // Full Color Icons
  204. if(FALSE == GetRegValueInt(HKEY_CURRENT_USER, c_szHICKey, c_szHICVal, &_nHighIconColor)) // Key not in registry yet
  205. {
  206. _nHighIconColor = 4;
  207. }
  208. // Use animations
  209. _wpMenuAnimation = GetAnimations(&_dwAnimationEffect);
  210. // Smooth edges of screen fonts
  211. _fFontSmoothing = FALSE;
  212. SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, (PVOID)&_fFontSmoothing, 0);
  213. _dwFontSmoothingType = FONT_SMOOTHING_AA;
  214. #ifdef CLEARTYPECOMBO
  215. if (SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, (PVOID)&_dwFontSmoothingType, 0))
  216. {
  217. }
  218. #endif //CLEARTYPECOMBO
  219. // Show contents while dragging
  220. _fDragWindow = FALSE;
  221. SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, (PVOID)&_fDragWindow, 0);
  222. _fKeyboardIndicators = FALSE;
  223. SystemParametersInfo(SPI_GETKEYBOARDINDICATORS, 0, (PVOID)&_fKeyboardIndicators, 0);
  224. _fMenuShadows = TRUE;
  225. SystemParametersInfo(SPI_GETDROPSHADOW, 0, (PVOID)&_fMenuShadows, 0);
  226. // Set the old values so we know when they changed.
  227. _nOldLargeIcon = _nLargeIcon;
  228. _nOldHighIconColor = _nHighIconColor;
  229. _wpOldMenuAnimation = _wpMenuAnimation;
  230. _fOldFontSmoothing = _fFontSmoothing;
  231. _dwOldFontSmoothingType = _dwFontSmoothingType;
  232. _fOldDragWindow = _fDragWindow;
  233. _fOldKeyboardIndicators = _fKeyboardIndicators;
  234. _dwOldAnimationEffect = _dwAnimationEffect;
  235. _fOldMenuShadows = _fMenuShadows;
  236. // load the icons and add them to the image lists
  237. // get the icon files and indexes from the registry, including for the Default recycle bin
  238. for (int nIndex = 0; nIndex < ARRAYSIZE(_IconData); nIndex++)
  239. {
  240. TCHAR szTemp[MAX_PATH];
  241. szTemp[0] = 0;
  242. IconGetRegValueString(c_aIconRegKeys[nIndex].pclsid, TEXT("DefaultIcon"), c_aIconRegKeys[nIndex].szIconValue, szTemp, ARRAYSIZE(szTemp));
  243. int iIndex = PathParseIconLocation(szTemp);
  244. // store the icon information
  245. lstrcpy(_IconData[nIndex].szOldFile, szTemp);
  246. lstrcpy(_IconData[nIndex].szNewFile, szTemp);
  247. _IconData[nIndex].iOldIndex = iIndex;
  248. _IconData[nIndex].iNewIndex = iIndex;
  249. }
  250. return hr;
  251. }
  252. BOOL CEffectState::HasIconsChanged(IN CEffectState * pCurrent)
  253. {
  254. BOOL fHasIconsChanged = FALSE;
  255. int nIndex;
  256. for (nIndex = 0; nIndex < ARRAYSIZE(_IconData); nIndex++)
  257. {
  258. if (StrCmpI(_IconData[nIndex].szNewFile, pCurrent->_IconData[nIndex].szNewFile) ||
  259. (_IconData[nIndex].iNewIndex != pCurrent->_IconData[nIndex].iNewIndex))
  260. {
  261. fHasIconsChanged = TRUE;
  262. break;
  263. }
  264. }
  265. return fHasIconsChanged;
  266. }
  267. HRESULT CEffectState::Save(void)
  268. {
  269. HRESULT hr = S_OK;
  270. BOOL bDorked = FALSE;
  271. int iX;
  272. // Large Icons
  273. BOOL bSendSettingsChange = ChangeIconSizes(_nOldLargeIcon, _nLargeIcon);
  274. if (bSendSettingsChange)
  275. {
  276. _nOldLargeIcon = _nLargeIcon;
  277. bDorked = TRUE;
  278. }
  279. // Full Color Icons
  280. if(_nOldHighIconColor != _nHighIconColor)
  281. {
  282. SetRegValueInt(HKEY_CURRENT_USER, c_szHICKey, c_szHICVal, _nHighIconColor);
  283. if ((GetBitsPerPixel() < 16) && (_nHighIconColor == 16)) // Display mode won't support icon high colors
  284. {
  285. }
  286. else
  287. {
  288. _nOldHighIconColor = _nHighIconColor;
  289. bSendSettingsChange = TRUE;
  290. }
  291. }
  292. // Full window drag
  293. if (_fOldDragWindow != _fDragWindow)
  294. {
  295. _fOldDragWindow = _fDragWindow;
  296. SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, _fDragWindow, 0, SPIF_UPDATEINIFILE);
  297. // we need to send this because the tray's autohide switches off this
  298. bSendSettingsChange = TRUE;
  299. }
  300. // Show Menu Shadows
  301. if (_fOldMenuShadows != _fMenuShadows)
  302. {
  303. _fOldMenuShadows = _fMenuShadows;
  304. SystemParametersInfo(SPI_SETDROPSHADOW, _fMenuShadows, 0, SPIF_UPDATEINIFILE);
  305. // we need to send this because the tray's autohide switches off this
  306. bSendSettingsChange = TRUE;
  307. }
  308. // Font smoothing
  309. if ((_fOldFontSmoothing != _fFontSmoothing) || (_dwOldFontSmoothingType != _dwFontSmoothingType))
  310. {
  311. #ifdef CLEARTYPECOMBO
  312. SystemParametersInfo(SPI_SETFONTSMOOTHINGTYPE, 0, (PVOID)UlongToPtr(_dwFontSmoothingType), SPIF_UPDATEINIFILE);
  313. #endif
  314. _dwOldFontSmoothingType = _dwFontSmoothingType;
  315. _fOldFontSmoothing = _fFontSmoothing;
  316. SystemParametersInfo(SPI_SETFONTSMOOTHING, _fFontSmoothing, 0, SPIF_UPDATEINIFILE);
  317. }
  318. // Menu animations
  319. if ((_wpOldMenuAnimation != _wpMenuAnimation) || (_dwOldAnimationEffect != _dwAnimationEffect))
  320. {
  321. _wpOldMenuAnimation = _wpMenuAnimation;
  322. SetAnimations(_wpMenuAnimation, _dwAnimationEffect);
  323. _dwOldAnimationEffect = _dwAnimationEffect;
  324. }
  325. // Change the system icons
  326. for( iX = 0; iX < NUM_ICONS; iX++)
  327. {
  328. if ((lstrcmpi(_IconData[iX].szNewFile, _IconData[iX].szOldFile) != 0) ||
  329. (_IconData[iX].iNewIndex != _IconData[iX].iOldIndex))
  330. {
  331. TCHAR szTemp[MAX_PATH];
  332. wnsprintf(szTemp, ARRAYSIZE(szTemp), TEXT("%s,%d"), _IconData[iX].szNewFile, _IconData[iX].iNewIndex);
  333. IconSetRegValueString(c_aIconRegKeys[iX].pclsid, TEXT("DefaultIcon"), c_aIconRegKeys[iX].szIconValue, szTemp);
  334. // Next two lines necessary if the user does an Apply as opposed to OK
  335. lstrcpy(_IconData[iX].szOldFile, _IconData[iX].szNewFile);
  336. _IconData[iX].iOldIndex = _IconData[iX].iNewIndex;
  337. bDorked = TRUE;
  338. }
  339. }
  340. // Keyboard indicators
  341. if (_fOldKeyboardIndicators != _fKeyboardIndicators)
  342. {
  343. _fOldKeyboardIndicators = _fKeyboardIndicators;
  344. DWORD_PTR dwResult;
  345. // Are we turning this on? (!_fKeyboardIndicators means "don't show" -> hide)
  346. if (!_fKeyboardIndicators)
  347. {
  348. // Yes, on: hide the key cues, turn on the mechanism
  349. SystemParametersInfo(SPI_SETKEYBOARDINDICATORS, 0, IntToPtr(_fKeyboardIndicators), SPIF_UPDATEINIFILE);
  350. SendMessageTimeout(HWND_BROADCAST, WM_CHANGEUISTATE, MAKEWPARAM(UIS_SET, UISF_HIDEFOCUS | UISF_HIDEACCEL), 0, SMTO_ABORTIFHUNG, 10*1000, &dwResult);
  351. }
  352. else
  353. {
  354. // No, off: means show the keycues, turn off the mechanism
  355. SendMessageTimeout(HWND_BROADCAST, WM_CHANGEUISTATE,
  356. MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS | UISF_HIDEACCEL),
  357. 0, SMTO_ABORTIFHUNG, 10*1000, &dwResult);
  358. SystemParametersInfo(SPI_SETKEYBOARDINDICATORS, 0, IntToPtr(_fKeyboardIndicators), SPIF_UPDATEINIFILE);
  359. }
  360. }
  361. // Make the system notice we changed the system icons
  362. if (bDorked)
  363. {
  364. PFNSHUPDATERECYCLEBINICON pfnSHUpdateRecycleBinIcon = NULL;
  365. SHChangeNotify(SHCNE_ASSOCCHANGED, 0, NULL, NULL); // should do the trick!
  366. if (!pfnSHUpdateRecycleBinIcon)
  367. {
  368. // Load SHUpdateRecycleBinIcon() if it exists
  369. g_hmodShell32 = LoadLibrary(SZ_SHELL32);
  370. pfnSHUpdateRecycleBinIcon = (PFNSHUPDATERECYCLEBINICON)GetProcAddress(g_hmodShell32, SZ_SHUPDATERECYCLEBINICON);
  371. }
  372. if (pfnSHUpdateRecycleBinIcon != NULL)
  373. {
  374. pfnSHUpdateRecycleBinIcon();
  375. }
  376. }
  377. if (bSendSettingsChange)
  378. {
  379. DWORD_PTR dwResult = 0;
  380. SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0, SMTO_ABORTIFHUNG, 10*1000, &dwResult);
  381. }
  382. return hr;
  383. }
  384. #define SZ_ICON_DEFAULTICON L"DefaultValue"
  385. HRESULT CEffectState::GetIconPath(IN CLSID clsid, IN LPCWSTR pszName, IN LPWSTR pszPath, IN DWORD cchSize)
  386. {
  387. HRESULT hr = E_FAIL;
  388. int nIndex;
  389. if (!StrCmpIW(SZ_ICON_DEFAULTICON, pszName))
  390. {
  391. pszName = L"";
  392. }
  393. for (nIndex = 0; nIndex < ARRAYSIZE(_IconData); nIndex++)
  394. {
  395. if (IsEqualCLSID(*(c_aIconRegKeys[nIndex].pclsid), clsid) &&
  396. !StrCmpIW(pszName, c_aIconRegKeys[nIndex].szIconValue))
  397. {
  398. // We found it.
  399. wnsprintfW(pszPath, cchSize, L"%s,%d", _IconData[nIndex].szNewFile, _IconData[nIndex].iNewIndex);
  400. hr = S_OK;
  401. break;
  402. }
  403. }
  404. return hr;
  405. }
  406. HRESULT CEffectState::SetIconPath(IN CLSID clsid, IN LPCWSTR pszName, IN LPCWSTR pszPath, IN int nResourceID)
  407. {
  408. HRESULT hr = E_FAIL;
  409. int nIndex;
  410. if (!StrCmpIW(SZ_ICON_DEFAULTICON, pszName))
  411. {
  412. pszName = L"";
  413. }
  414. for (nIndex = 0; nIndex < ARRAYSIZE(_IconData); nIndex++)
  415. {
  416. if (IsEqualCLSID(*(c_aIconRegKeys[nIndex].pclsid), clsid) &&
  417. !StrCmpIW(pszName, c_aIconRegKeys[nIndex].szIconValue))
  418. {
  419. TCHAR szTemp[MAX_PATH];
  420. if (!pszPath || !pszPath[0])
  421. {
  422. // The caller didn't specify an icon so use the default values.
  423. if (!SHExpandEnvironmentStrings(c_aIconRegKeys[nIndex].szDefault, szTemp, ARRAYSIZE(szTemp)))
  424. {
  425. StrCpyN(szTemp, c_aIconRegKeys[nIndex].szDefault, ARRAYSIZE(szTemp));
  426. }
  427. pszPath = szTemp;
  428. nResourceID = c_aIconRegKeys[nIndex].nDefaultIndex;
  429. }
  430. // We found it.
  431. StrCpyNW(_IconData[nIndex].szNewFile, pszPath, ARRAYSIZE(_IconData[nIndex].szNewFile));
  432. _IconData[nIndex].iNewIndex = nResourceID;
  433. hr = S_OK;
  434. break;
  435. }
  436. }
  437. return hr;
  438. }
  439. HRESULT CEffectState::Clone(OUT CEffectState ** ppEffectClone)
  440. {
  441. HRESULT hr = E_OUTOFMEMORY;
  442. *ppEffectClone = new CEffectState();
  443. if (*ppEffectClone)
  444. {
  445. hr = S_OK;
  446. (*ppEffectClone)->_nLargeIcon = _nLargeIcon;
  447. (*ppEffectClone)->_nHighIconColor = _nHighIconColor;
  448. (*ppEffectClone)->_wpMenuAnimation = _wpMenuAnimation;
  449. (*ppEffectClone)->_fFontSmoothing = _fFontSmoothing;
  450. (*ppEffectClone)->_dwFontSmoothingType = _dwFontSmoothingType;
  451. (*ppEffectClone)->_fDragWindow = _fDragWindow;
  452. (*ppEffectClone)->_fKeyboardIndicators = _fKeyboardIndicators;
  453. (*ppEffectClone)->_dwAnimationEffect = _dwAnimationEffect;
  454. (*ppEffectClone)->_nOldLargeIcon = _nOldLargeIcon;
  455. (*ppEffectClone)->_nOldHighIconColor = _nOldHighIconColor;
  456. (*ppEffectClone)->_wpOldMenuAnimation = _wpOldMenuAnimation;
  457. (*ppEffectClone)->_fOldFontSmoothing = _fOldFontSmoothing;
  458. (*ppEffectClone)->_dwOldFontSmoothingType = _dwOldFontSmoothingType;
  459. (*ppEffectClone)->_fOldDragWindow = _fOldDragWindow;
  460. (*ppEffectClone)->_fOldKeyboardIndicators = _fOldKeyboardIndicators;
  461. (*ppEffectClone)->_dwOldAnimationEffect = _dwOldAnimationEffect;
  462. (*ppEffectClone)->_fOldMenuShadows = _fOldMenuShadows;
  463. for (int nIndex = 0; nIndex < ARRAYSIZE(_IconData); nIndex++)
  464. {
  465. (*ppEffectClone)->_IconData[nIndex].iOldIndex = _IconData[nIndex].iOldIndex;
  466. (*ppEffectClone)->_IconData[nIndex].iNewIndex = _IconData[nIndex].iNewIndex;
  467. StrCpyN((*ppEffectClone)->_IconData[nIndex].szOldFile, _IconData[nIndex].szOldFile, ARRAYSIZE((*ppEffectClone)->_IconData[nIndex].szOldFile));
  468. StrCpyN((*ppEffectClone)->_IconData[nIndex].szNewFile, _IconData[nIndex].szNewFile, ARRAYSIZE((*ppEffectClone)->_IconData[nIndex].szNewFile));
  469. }
  470. }
  471. return hr;
  472. }
  473. BOOL CEffectState::IsDirty(void)
  474. {
  475. BOOL fDirty = FALSE;
  476. if ((_nLargeIcon != _nOldLargeIcon) ||
  477. (_nHighIconColor != _nOldHighIconColor) ||
  478. (_wpMenuAnimation != _wpOldMenuAnimation) ||
  479. (_fFontSmoothing != _fOldFontSmoothing) ||
  480. (_dwFontSmoothingType != _dwOldFontSmoothingType) ||
  481. (_fDragWindow != _fOldDragWindow) ||
  482. (_fMenuShadows != _fOldMenuShadows) ||
  483. (_fKeyboardIndicators != _fOldKeyboardIndicators) ||
  484. (_dwAnimationEffect != _dwOldAnimationEffect))
  485. {
  486. fDirty = TRUE;
  487. }
  488. else
  489. {
  490. for (int nIndex = 0; nIndex < ARRAYSIZE(_IconData); nIndex++)
  491. {
  492. if ((_IconData[nIndex].iNewIndex != _IconData[nIndex].iOldIndex) ||
  493. (StrCmpI(_IconData[nIndex].szNewFile, _IconData[nIndex].szOldFile)))
  494. {
  495. fDirty = TRUE;
  496. break;
  497. }
  498. }
  499. }
  500. return fDirty;
  501. }