diff options
Diffstat (limited to 'plugins/Utils')
-rw-r--r-- | plugins/Utils/mir_icons.cpp | 46 | ||||
-rw-r--r-- | plugins/Utils/mir_icons.h | 4 | ||||
-rw-r--r-- | plugins/Utils/mir_options.cpp | 2 |
3 files changed, 18 insertions, 34 deletions
diff --git a/plugins/Utils/mir_icons.cpp b/plugins/Utils/mir_icons.cpp index bab0674d35..00adda0614 100644 --- a/plugins/Utils/mir_icons.cpp +++ b/plugins/Utils/mir_icons.cpp @@ -29,15 +29,11 @@ extern HINSTANCE hInst; HICON IcoLib_LoadIcon(const char *iconName, BOOL copy)
{
- if (!ServiceExists(MS_SKIN2_GETICON))
- return NULL;
-
if (iconName == NULL || iconName[0] == 0)
return NULL;
HICON hIcon = (HICON) CallService(MS_SKIN2_GETICON, 0, (LPARAM) iconName);
- if (copy && hIcon != NULL)
- {
+ if (copy && hIcon != NULL) {
hIcon = CopyIcon(hIcon);
CallService(MS_SKIN2_RELEASEICON, (WPARAM) hIcon, 0);
}
@@ -46,40 +42,30 @@ HICON IcoLib_LoadIcon(const char *iconName, BOOL copy) void IcoLib_ReleaseIcon(const char *iconName)
{
- if (ServiceExists(MS_SKIN2_RELEASEICON))
- CallService(MS_SKIN2_RELEASEICON, 0, (LPARAM) iconName);
+ CallService(MS_SKIN2_RELEASEICON, 0, (LPARAM) iconName);
}
-
void IcoLib_ReleaseIcon(HICON hIcon)
{
- if (ServiceExists(MS_SKIN2_RELEASEICON))
- CallService(MS_SKIN2_RELEASEICON, (WPARAM) hIcon, 0);
+ CallService(MS_SKIN2_RELEASEICON, (WPARAM) hIcon, 0);
}
-
-HANDLE IcoLib_Register(char *name, TCHAR *section, TCHAR *description, int id)
+HANDLE IcoLib_Register(char *name, char *section, char *description, int id)
{
- HICON hIcon = (HICON) CallService(MS_SKIN2_GETICON, 0, (LPARAM) name);
- if (hIcon != NULL) {
- CallService(MS_SKIN2_RELEASEICON, (WPARAM) hIcon, 0);
- return NULL;
- }
+ HANDLE hIcon = Skin_GetIconHandle(name);
+ if (hIcon != NULL)
+ return hIcon;
+
+ TCHAR tszFile[MAX_PATH];
+ GetModuleFileName(hInst, tszFile, MAX_PATH);
SKINICONDESC sid = {0};
sid.cbSize = sizeof(SKINICONDESC);
- sid.flags = SIDF_TCHAR;
+ sid.flags = SIDF_PATH_TCHAR;
sid.pszName = name;
- sid.ptszSection = section;
- sid.ptszDescription = description;
-
- int cx = GetSystemMetrics(SM_CXSMICON);
- sid.hDefaultIcon = (HICON) LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, cx, cx, LR_DEFAULTCOLOR | LR_SHARED);
- HANDLE hRes = Skin_AddIcon(&sid);
-
- if (sid.hDefaultIcon)
- DestroyIcon(sid.hDefaultIcon);
-
- return hRes;
+ sid.pszSection = section;
+ sid.pszDescription = description;
+ sid.ptszDefaultFile = tszFile;
+ sid.iDefaultIndex = -id;
+ return Skin_AddIcon(&sid);
}
-
diff --git a/plugins/Utils/mir_icons.h b/plugins/Utils/mir_icons.h index e1e1a918a3..7e88d5f61c 100644 --- a/plugins/Utils/mir_icons.h +++ b/plugins/Utils/mir_icons.h @@ -23,10 +23,8 @@ Boston, MA 02111-1307, USA. #define _CRT_SECURE_NO_WARNINGS
-HANDLE IcoLib_Register(char *name, TCHAR *section, TCHAR *description, int id);
+HANDLE IcoLib_Register(char *name, char *section, char *description, int id);
HICON IcoLib_LoadIcon(const char *iconName, BOOL copy = FALSE);
-void IcoLib_ReleaseIcon(const char *iconName);
-void IcoLib_ReleaseIcon(HICON hIcon);
#endif // __MIR_ICONS_H__
diff --git a/plugins/Utils/mir_options.cpp b/plugins/Utils/mir_options.cpp index 493f01f527..ad3322e38a 100644 --- a/plugins/Utils/mir_options.cpp +++ b/plugins/Utils/mir_options.cpp @@ -581,7 +581,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha {
NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
- if(IsWindowVisible(GetDlgItem(hwndDlg, ctrl->nID)) && ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK))
+ if (IsWindowVisible(GetDlgItem(hwndDlg, ctrl->nID)) && ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK))
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
|