diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-19 22:48:01 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-19 22:48:01 +0000 |
commit | 95aa036670a1ce2c461ffd9bd3a586d191ee4675 (patch) | |
tree | cd244db18622df3462166ed39593ca924c890f6b /plugins/Utils | |
parent | f6e0db0590e2f8feeacc29d4e50007fbe358f9d5 (diff) |
- various icolib fixes;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@1061 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
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;
|