| 1041 | |
| 1042 | |
| 1043 | void Script::UpdateTrayIcon(bool aForceUpdate) |
| 1044 | { |
| 1045 | if (!mNIC.hWnd) // tray icon is not installed |
| 1046 | return; |
| 1047 | static bool icon_shows_paused = false; |
| 1048 | static bool icon_shows_suspended = false; |
| 1049 | if (!aForceUpdate && (mIconFrozen || (g->IsPaused == icon_shows_paused && g_IsSuspended == icon_shows_suspended))) |
| 1050 | return; // it's already in the right state |
| 1051 | int icon; |
| 1052 | if (g->IsPaused && g_IsSuspended) |
| 1053 | icon = IDI_PAUSE_SUSPEND; |
| 1054 | else if (g->IsPaused) |
| 1055 | icon = IDI_PAUSE; |
| 1056 | else if (g_IsSuspended) |
| 1057 | icon = IDI_SUSPEND; |
| 1058 | else |
| 1059 | icon = IDI_MAIN; |
| 1060 | // Use the custom tray icon if the icon is normal (non-paused & non-suspended): |
| 1061 | mNIC.hIcon = (mCustomIconSmall && (mIconFrozen || (!g->IsPaused && !g_IsSuspended))) ? mCustomIconSmall // L17: Always use small icon for tray. |
| 1062 | : (icon == IDI_MAIN) ? g_IconSmall // Use the pre-loaded small icon for best quality. |
| 1063 | : (HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(icon), IMAGE_ICON, 0, 0, LR_SHARED); // Use LR_SHARED for simplicity and performance more than to conserve memory in this case. |
| 1064 | if (Shell_NotifyIcon(NIM_MODIFY, &mNIC)) |
| 1065 | { |
| 1066 | icon_shows_paused = g->IsPaused; |
| 1067 | icon_shows_suspended = g_IsSuspended; |
| 1068 | } |
| 1069 | // else do nothing, just leave it in the same state. |
| 1070 | } |
| 1071 | |
| 1072 | |
| 1073 |
no outgoing calls
no test coverage detected