diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/AimOscar/src/theme.cpp | 60 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_xstatus.cpp | 8 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_xstatus.cpp | 4 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_functions.cpp | 5 | ||||
-rw-r--r-- | protocols/Quotes/src/ExtraImages.cpp | 13 | ||||
-rw-r--r-- | protocols/Quotes/src/IconLib.cpp | 38 |
6 files changed, 40 insertions, 88 deletions
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index b0b3fd4ec5..e31cc5d664 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -32,8 +32,9 @@ struct _tag_iconList const char* szName;
int defIconID;
const char* szSection;
+ HANDLE hIcolib;
}
-static const iconList[] =
+static iconList[] =
{
{ LPGEN("ICQ"), "icq", IDI_ICQ },
{ LPGEN("Add"), "add", IDI_ADD },
@@ -66,8 +67,6 @@ static const iconList[] = { LPGEN("Not Normal Script"), "nnorm_scrpt", IDI_NNORMALSCRIPT, LPGEN("Profile Editor") },
};
-static HANDLE hIconLibItem[SIZEOF(iconList)];
-
void InitIcons(void)
{
TCHAR szFile[MAX_PATH];
@@ -93,7 +92,7 @@ void InitIcons(void) sid.pszDescription = (char*)iconList[i].szDescr;
sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
+ iconList[i].hIcolib = Skin_AddIcon(&sid);
}
}
@@ -106,9 +105,10 @@ HICON LoadIconEx(const char* name, bool big) HANDLE GetIconHandle(const char* name)
{
- for (unsigned i=0; i < SIZEOF(iconList); i++)
- if (strcmp(iconList[i].szName, name) == 0)
- return hIconLibItem[i];
+ for (int i=0; i < SIZEOF(iconList); i++)
+ if ( !strcmp(iconList[i].szName, name))
+ return iconList[i].hIcolib;
+
return NULL;
}
@@ -156,31 +156,12 @@ static const char* extra_ES_icon_name[2] = "hiptop",
};
-static HANDLE extra_AT_icon_handle[5];
-static HANDLE extra_ES_icon_handle[2];
-
-static void clear_AT_icon(HANDLE hContact)
-{
- ExtraIcon_Clear(hExtraAT, hContact);
-}
-
-static void clear_ES_icon(HANDLE hContact)
-{
- ExtraIcon_Clear(hExtraES, hContact);
-}
-
static void set_AT_icon(CAimProto* ppro, HANDLE hContact)
{
if (ppro->getByte(hContact, "ChatRoom", 0)) return;
unsigned i = ppro->getByte(hContact, AIM_KEY_AC, 0) - 1;
-
- if (i < 5) {
- char name[64];
- mir_snprintf(name, sizeof(name), "AIM_%s", extra_AT_icon_name[i]);
- ExtraIcon_SetIcon(hExtraAT, hContact, name);
- }
- else ExtraIcon_Clear(hExtraAT, hContact);
+ ExtraIcon_SetIcon(hExtraAT, hContact, (i < 5) ? GetIconHandle(extra_AT_icon_name[i]) : NULL);
}
static void set_ES_icon(CAimProto* ppro, HANDLE hContact)
@@ -188,13 +169,7 @@ static void set_ES_icon(CAimProto* ppro, HANDLE hContact) if (ppro->getByte(hContact, "ChatRoom", 0)) return;
unsigned i = ppro->getByte(hContact, AIM_KEY_ET, 0) - 1;
-
- if (i < 2) {
- char name[64];
- mir_snprintf(name, sizeof(name), "AIM_%s", extra_ES_icon_name[i]);
- ExtraIcon_SetIcon(hExtraES, hContact, name);
- }
- else ExtraIcon_Clear(hExtraES, hContact);
+ ExtraIcon_SetIcon(hExtraAT, hContact, (i < 2) ? GetIconHandle(extra_ES_icon_name[i]) : NULL);
}
void set_contact_icon(CAimProto* ppro, HANDLE hContact)
@@ -206,10 +181,9 @@ void set_contact_icon(CAimProto* ppro, HANDLE hContact) void remove_AT_icons(CAimProto* ppro)
{
HANDLE hContact = db_find_first();
- while (hContact)
- {
+ while (hContact) {
if (ppro->is_my_contact(hContact) && !ppro->getByte(hContact, "ChatRoom", 0))
- clear_AT_icon(hContact);
+ ExtraIcon_Clear(hExtraAT, hContact);
hContact = db_find_next(hContact);
}
@@ -218,10 +192,10 @@ void remove_AT_icons(CAimProto* ppro) void remove_ES_icons(CAimProto* ppro)
{
HANDLE hContact = db_find_first();
- while (hContact)
- {
+ while (hContact) {
if (ppro->is_my_contact(hContact) && !ppro->getByte(hContact, "ChatRoom", 0))
- clear_ES_icon(hContact);
+ ExtraIcon_Clear(hExtraES, hContact);
+
hContact = db_find_next(hContact);
}
}
@@ -229,8 +203,7 @@ void remove_ES_icons(CAimProto* ppro) void add_AT_icons(CAimProto* ppro)
{
HANDLE hContact = db_find_first();
- while (hContact)
- {
+ while (hContact) {
if (ppro->is_my_contact(hContact))
set_AT_icon(ppro, hContact);
@@ -241,8 +214,7 @@ void add_AT_icons(CAimProto* ppro) void add_ES_icons(CAimProto* ppro)
{
HANDLE hContact = db_find_first();
- while (hContact)
- {
+ while (hContact) {
if (ppro->is_my_contact(hContact))
set_ES_icon(ppro, hContact);
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index ab612f30b3..9802b1dee7 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -182,13 +182,7 @@ void releaseXStatusIcon(int bStatus, UINT flags) void setContactExtraIcon(HANDLE hContact, int xstatus)
{
- if (xstatus <= 0)
- ExtraIcon_Clear(hExtraXStatus, hContact);
- else {
- char szTemp[MAX_PATH];
- null_snprintf(szTemp, sizeof(szTemp), "icq_xstatus%d", xstatus-1);
- ExtraIcon_SetIcon(hExtraXStatus, hContact, szTemp);
- }
+ ExtraIcon_SetIcon(hExtraXStatus, hContact, (xstatus > 0) ? hXStatusIcons[xstatus-1]->Handle() : NULL);
}
#define NULLCAP {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 7c96e536f1..4f6e625fcd 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -683,7 +683,7 @@ void CPepMood::ResetExtraIcon(HANDLE hContact) void CPepMood::SetExtraIcon(HANDLE hContact, char *szMood)
{
- ExtraIcon_SetIcon(hExtraMood, hContact, szMood == NULL ? NULL : g_MoodIcons.GetIcolibName(szMood));
+ ExtraIcon_SetIcon(hExtraMood, hContact, szMood == NULL ? NULL : g_MoodIcons.GetIcolibHandle(szMood));
}
void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText)
@@ -1075,7 +1075,7 @@ void CPepActivity::ResetExtraIcon(HANDLE hContact) void CPepActivity::SetExtraIcon(HANDLE hContact, char *szActivity)
{
- ExtraIcon_SetIcon(hExtraActivity, hContact, szActivity == NULL ? NULL : g_ActivityIcons.GetIcolibName(szActivity));
+ ExtraIcon_SetIcon(hExtraActivity, hContact, szActivity == NULL ? NULL : g_ActivityIcons.GetIcolibHandle(szActivity));
}
void CPepActivity::SetActivity(HANDLE hContact, LPCTSTR szFirst, LPCTSTR szSecond, LPCTSTR szText)
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 07ed22270d..5c6905df7e 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -1153,11 +1153,6 @@ void CMraProto::CListShowMenuItem(HANDLE hMenuItem, BOOL bShow) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&mi);
}
-int ExtraSetIcon(HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage)
-{
- return ExtraIcon_SetIcon(hExtraIcon, hContact, hImage);
-}
-
size_t CopyNumber(LPCVOID lpcOutBuff, LPCVOID lpcBuff, size_t dwLen)
{
BYTE btChar;
diff --git a/protocols/Quotes/src/ExtraImages.cpp b/protocols/Quotes/src/ExtraImages.cpp index 1fbc6d21ff..a89032e53c 100644 --- a/protocols/Quotes/src/ExtraImages.cpp +++ b/protocols/Quotes/src/ExtraImages.cpp @@ -7,6 +7,7 @@ #include "IQuotesProvider.h"
#include "Log.h"
#include "DBUtils.h"
+#include "resource.h"
CExtraImages::CExtraImages() :
m_hExtraIcons(ExtraIcon_Register(ICON_STR_QUOTE,QUOTES_PROTOCOL_NAME,Quotes_MakeIconName(ICON_STR_MAIN).c_str())),
@@ -36,19 +37,21 @@ bool CExtraImages::SetContactExtraImage(HANDLE hContact,EImageIndex nIndex)const if (!m_hExtraIcons)
return false;
- std::string sIconName;
+ HANDLE hIcolib;
switch(nIndex) {
case eiUp:
- sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_UP);
+ hIcolib = Quotes_GetIconHandle(IDI_ICON_UP);
break;
case eiDown:
- sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_DOWN);
+ hIcolib = Quotes_GetIconHandle(IDI_ICON_DOWN);
break;
case eiNotChanged:
- sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_NOT_CHANGED);
+ hIcolib = Quotes_GetIconHandle(IDI_ICON_NOTCHANGED);
break;
+ default:
+ hIcolib = NULL;
}
- return (0 == ExtraIcon_SetIcon(m_hExtraIcons,hContact,sIconName.c_str()));
+ return ExtraIcon_SetIcon(m_hExtraIcons, hContact, hIcolib) == 0;
}
int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp)
diff --git a/protocols/Quotes/src/IconLib.cpp b/protocols/Quotes/src/IconLib.cpp index 530d1defd3..9ac96599a5 100644 --- a/protocols/Quotes/src/IconLib.cpp +++ b/protocols/Quotes/src/IconLib.cpp @@ -17,26 +17,25 @@ namespace {
struct CIconList
{
- TCHAR* szDescr;
+ TCHAR* szDescr;
char* szName;
int defIconID;
-// TCHAR* szSection;
HANDLE hIconLibItem;
};
CIconList iconList[] =
{
- {_T("Protocol icon"),ICON_STR_MAIN,IDI_ICON_MAIN},
- {_T("Quote/Rate up"),ICON_STR_QUOTE_UP,IDI_ICON_UP},
- {_T("Quote/Rate down"),ICON_STR_QUOTE_DOWN,IDI_ICON_DOWN},
- {_T("Quote/Rate not changed"),ICON_STR_QUOTE_NOT_CHANGED,IDI_ICON_NOTCHANGED},
- {_T("Quote Section"),ICON_STR_SECTION,IDI_ICON_SECTION},
- {_T("Quote"),ICON_STR_QUOTE,IDI_ICON_QUOTE},
- {_T("Currency Converter"),ICON_STR_CURRENCY_CONVERTER,IDI_ICON_CURRENCY_CONVERTER},
- {_T("Refresh"),ICON_STR_REFRESH,IDI_ICON_REFRESH},
- {_T("Export"),ICON_STR_EXPORT,IDI_ICON_EXPORT},
- {_T("Swap button"),ICON_STR_SWAP,IDI_ICON_SWAP},
- {_T("Import"),ICON_STR_IMPORT,IDI_ICON_IMPORT},
+ { _T("Protocol icon"), ICON_STR_MAIN, IDI_ICON_MAIN },
+ { _T("Quote/Rate up"), ICON_STR_QUOTE_UP, IDI_ICON_UP },
+ { _T("Quote/Rate down"), ICON_STR_QUOTE_DOWN, IDI_ICON_DOWN },
+ { _T("Quote/Rate not changed"), ICON_STR_QUOTE_NOT_CHANGED, IDI_ICON_NOTCHANGED },
+ { _T("Quote Section"), ICON_STR_SECTION, IDI_ICON_SECTION },
+ { _T("Quote"), ICON_STR_QUOTE, IDI_ICON_QUOTE },
+ { _T("Currency Converter"), ICON_STR_CURRENCY_CONVERTER, IDI_ICON_CURRENCY_CONVERTER },
+ { _T("Refresh"), ICON_STR_REFRESH, IDI_ICON_REFRESH },
+ { _T("Export"), ICON_STR_EXPORT, IDI_ICON_EXPORT },
+ { _T("Swap button"), ICON_STR_SWAP, IDI_ICON_SWAP },
+ { _T("Import"), ICON_STR_IMPORT, IDI_ICON_IMPORT }
};
}
@@ -54,18 +53,7 @@ void Quotes_IconsInit() sid.flags = SIDF_ALL_TCHAR;
sid.ptszSection = A2T(QUOTES_PROTOCOL_NAME);
-// TCHAR* szRootSection = TranslateTS(A2T(QUOTES_PROTOCOL_NAME));
-
- for ( int i = 0; i < SIZEOF(iconList); i++ )
- {
-// char szSettingName[100];
-// TCHAR szSectionName[100];
-// mir_snprintf( szSettingName, sizeof( szSettingName ),"%s_%s",QUOTES_PROTOCOL_NAME, iconList[i].szName );
-// {
-// mir_sntprintf( szSectionName, SIZEOF( szSectionName ),_T("%s/%s"), TranslateT("Protocols"), szRootSection);
-// sid.ptszSection = szSectionName;
-// }
-
+ for (int i = 0; i < SIZEOF(iconList); i++) {
std::string sName = Quotes_MakeIconName( iconList[i].szName);
sid.pszName = const_cast<char*>(sName.c_str());
sid.ptszDescription = iconList[i].szDescr;
|