diff options
author | George Hazan <george.hazan@gmail.com> | 2012-12-02 18:19:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-12-02 18:19:49 +0000 |
commit | c4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 (patch) | |
tree | 17a8627550b202d62df8e1df76d2585d3d0cdeaa /src/modules/icolib | |
parent | 5ea5feb7e052ca45af7bc9ed76e4a252bd71950d (diff) |
new easy standard way of registering icons: Icon_Register
git-svn-id: http://svn.miranda-ng.org/main/trunk@2601 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/icolib')
-rw-r--r-- | src/modules/icolib/IcoLib.h | 10 | ||||
-rw-r--r-- | src/modules/icolib/skin2icons.cpp | 38 | ||||
-rw-r--r-- | src/modules/icolib/skin2opts.cpp | 20 |
3 files changed, 34 insertions, 34 deletions
diff --git a/src/modules/icolib/IcoLib.h b/src/modules/icolib/IcoLib.h index 550de7ad9b..ec93d2af62 100644 --- a/src/modules/icolib/IcoLib.h +++ b/src/modules/icolib/IcoLib.h @@ -56,7 +56,7 @@ struct IconSourceItem int icon_size;
};
-struct IconItem
+struct IcolibItem
{
char* name;
SectionItem* section;
@@ -90,15 +90,15 @@ int IconSourceItem_ReleaseIcon(IconSourceItem* item); HICON IconSourceItem_GetIcon(IconSourceItem* item);
IconSourceItem* GetIconSourceItem(const TCHAR* file, int indx, int cxIcon, int cyIcon);
-IconItem* IcoLib_FindHIcon(HICON hIcon, bool &big);
-IconItem* IcoLib_FindIcon(const char* pszIconName);
+IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big);
+IcolibItem* IcoLib_FindIcon(const char* pszIconName);
-HICON IconItem_GetIcon(IconItem* item, bool big);
+HICON IconItem_GetIcon(IcolibItem* item, bool big);
int SkinOptionsInit(WPARAM, LPARAM);
extern CRITICAL_SECTION csIconList;
-extern LIST<IconItem> iconList;
+extern LIST<IcolibItem> iconList;
extern LIST<SectionItem> sectionList;
extern BOOL bNeedRebuild;
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index eec1dff500..80bcfc5e9e 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -82,12 +82,12 @@ static int sttCompareIconSourceItems(const IconSourceItem* p1, const IconSourceI static LIST<IconSourceItem> iconSourceList(20, sttCompareIconSourceItems);
-static int sttCompareIcons(const IconItem* p1, const IconItem* p2)
+static int sttCompareIcons(const IcolibItem* p1, const IcolibItem* p2)
{
return strcmp(p1->name, p2->name);
}
-LIST<IconItem> iconList(20, sttCompareIcons);
+LIST<IcolibItem> iconList(20, sttCompareIcons);
/////////////////////////////////////////////////////////////////////////////////////////
// Utility functions
@@ -447,20 +447,20 @@ static void IcoLib_RemoveSection(SectionItem* section) }
}
-IconItem* IcoLib_FindIcon(const char* pszIconName)
+IcolibItem* IcoLib_FindIcon(const char* pszIconName)
{
int indx;
- IconItem key = { (char*)pszIconName };
+ IcolibItem key = { (char*)pszIconName };
if ((indx = iconList.getIndex(&key)) != -1)
return iconList[ indx ];
return NULL;
}
-IconItem* IcoLib_FindHIcon(HICON hIcon, bool &big)
+IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big)
{
for (int i = 0; i < iconList.getCount(); i++) {
- IconItem *p = iconList[i];
+ IcolibItem *p = iconList[i];
if ((void*)p == hIcon) {
big = (p->source_small == NULL);
return p;
@@ -478,7 +478,7 @@ IconItem* IcoLib_FindHIcon(HICON hIcon, bool &big) return NULL;
}
-static void IcoLib_FreeIcon(IconItem* icon)
+static void IcoLib_FreeIcon(IcolibItem* icon)
{
if ( !icon) return;
@@ -510,9 +510,9 @@ HANDLE IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid) mir_cslock lck(csIconList);
- IconItem* item = IcoLib_FindIcon(sid->pszName);
+ IcolibItem* item = IcoLib_FindIcon(sid->pszName);
if (!item) {
- item = (IconItem*)mir_calloc(sizeof(IconItem));
+ item = (IcolibItem*)mir_calloc(sizeof(IcolibItem));
item->name = sid->pszName;
iconList.insert(item);
}
@@ -552,7 +552,7 @@ HANDLE IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid) if (sid->hDefaultIcon) {
bool big;
- IconItem* def_item = IcoLib_FindHIcon(sid->hDefaultIcon, big);
+ IcolibItem* def_item = IcoLib_FindHIcon(sid->hDefaultIcon, big);
if (def_item) {
item->default_icon = big ? def_item->source_big : def_item->source_small;
item->default_icon->ref_count++;
@@ -581,8 +581,8 @@ static INT_PTR IcoLib_RemoveIcon(WPARAM, LPARAM lParam) mir_cslock lck(csIconList);
int i;
- if ((i = iconList.getIndex((IconItem*)&lParam)) != -1) {
- IconItem *item = iconList[ i ];
+ if ((i = iconList.getIndex((IcolibItem*)&lParam)) != -1) {
+ IcolibItem *item = iconList[ i ];
IcoLib_FreeIcon(item);
iconList.remove(i);
SAFE_FREE((void**)&item);
@@ -600,7 +600,7 @@ void KillModuleIcons(int hLangpack) mir_cslock lck(csIconList);
for (int i = iconList.getCount()-1; i >= 0; i--) {
- IconItem *item = iconList[i];
+ IcolibItem *item = iconList[i];
if ( item->hLangpack == hLangpack) {
IcoLib_FreeIcon(item);
iconList.remove(i);
@@ -612,7 +612,7 @@ void KillModuleIcons(int hLangpack) /////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetDefaultIcon
-HICON IconItem_GetDefaultIcon(IconItem* item, bool big)
+HICON IconItem_GetDefaultIcon(IcolibItem* item, bool big)
{
HICON hIcon = NULL;
@@ -660,7 +660,7 @@ HICON IconItem_GetDefaultIcon(IconItem* item, bool big) /////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetIcon
-HICON IconItem_GetIcon(IconItem* item, bool big)
+HICON IconItem_GetIcon(IcolibItem* item, bool big)
{
DBVARIANT dbv = {0};
HICON hIcon = NULL;
@@ -704,7 +704,7 @@ HICON IcoLib_GetIcon(const char* pszIconName, bool big) return hIconBlank;
mir_cslock lck(csIconList);
- IconItem* item = IcoLib_FindIcon(pszIconName);
+ IcolibItem* item = IcoLib_FindIcon(pszIconName);
return (item) ? IconItem_GetIcon(item, big) : NULL;
}
@@ -732,7 +732,7 @@ HICON IcoLib_GetIconByHandle(HANDLE hItem, bool big) return NULL;
mir_cslock lck(csIconList);
- IconItem* pi = (IconItem*)hItem;
+ IcolibItem* pi = (IcolibItem*)hItem;
if ( iconList.getIndex(pi) != -1)
return IconItem_GetIcon(pi, big);
@@ -762,7 +762,7 @@ static INT_PTR IcoLib_AddRef(WPARAM wParam, LPARAM) mir_cslock lck(csIconList);
bool big;
- IconItem *item = IcoLib_FindHIcon((HICON)wParam, big);
+ IcolibItem *item = IcoLib_FindHIcon((HICON)wParam, big);
INT_PTR res = 1;
if (item) {
@@ -865,7 +865,7 @@ void UnloadIcoLibModule(void) DeleteCriticalSection(&csIconList);
for (i = iconList.getCount()-1; i >= 0; i--) {
- IconItem* p = iconList[i];
+ IcolibItem* p = iconList[i];
iconList.remove(i);
IcoLib_FreeIcon(p);
mir_free(p);
diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index 09faff70e9..dc757297df 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -73,7 +73,7 @@ int IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big) {
mir_cslock lck(csIconList);
- IconItem *item = NULL;
+ IcolibItem *item = NULL;
if (szIconName)
item = IcoLib_FindIcon(szIconName);
@@ -98,7 +98,7 @@ int IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big) /////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetIcon_Preview
-HICON IconItem_GetIcon_Preview(IconItem* item)
+HICON IconItem_GetIcon_Preview(IcolibItem* item)
{
HICON hIcon = NULL;
@@ -154,7 +154,7 @@ static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive) mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[ indx ];
+ IcolibItem *item = iconList[ indx ];
if (item->default_file && item->section == sectionActive) {
_itot(item->default_indx, path + suffIndx, 10);
@@ -194,7 +194,7 @@ void LoadSubIcons(HWND htv, TCHAR *filename, HTREEITEM hItem) static void UndoChanges(int iconIndx, int cmd)
{
- IconItem *item = iconList[ iconIndx ];
+ IcolibItem *item = iconList[ iconIndx ];
if ( !item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE)
item->temp_reset = FALSE;
@@ -320,7 +320,7 @@ void DoIconsChanged(HWND hwndDlg) mir_cslock lck(csIconList); // Destroy unused icons
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[indx];
+ IcolibItem *item = iconList[indx];
if (item->source_small && !item->source_small->icon_ref_count) {
item->source_small->icon_ref_count++;
IconSourceItem_ReleaseIcon(item->source_small);
@@ -783,7 +783,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[indx];
+ IcolibItem *item = iconList[indx];
if (item->section == sectionActive) {
lvi.pszText = item->getDescr();
HICON hIcon = item->temp_icon;
@@ -843,7 +843,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ListView_GetItem(hPreview, &lvi);
{
mir_cslock lck(csIconList);
- IconItem *item = iconList[ lvi.lParam ];
+ IcolibItem *item = iconList[ lvi.lParam ];
SAFE_FREE((void**)&item->temp_file);
SafeDestroyIcon(&item->temp_icon);
@@ -938,7 +938,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[indx];
+ IcolibItem *item = iconList[indx];
if (item->temp_reset) {
DBDeleteContactSetting(NULL, "SkinIcons", item->name);
if (item->source_small != item->default_icon) {
@@ -960,7 +960,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_PREVIEW:
if (((LPNMHDR)lParam)->code == LVN_GETINFOTIP) {
- IconItem *item;
+ IcolibItem *item;
NMLVGETINFOTIP *pInfoTip = (NMLVGETINFOTIP *)lParam;
LVITEM lvi;
lvi.mask = LVIF_PARAM;
@@ -1022,7 +1022,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[indx];
+ IcolibItem *item = iconList[indx];
SAFE_FREE((void**)&item->temp_file);
SafeDestroyIcon(&item->temp_icon);
|