diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-03 20:16:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-03 20:16:42 +0000 |
commit | f12d8b56f2894e94491bd7424d69f595d285f01f (patch) | |
tree | 3f54d66c8c248bb456da1cb0c5cc31661f144e5f /protocols/Quotes | |
parent | 1b1a54dc156bec90be3ddc337c17b4e67179d4ea (diff) |
no more MS_CLIST_EXTRA_ADD_ICON in the application code
git-svn-id: http://svn.miranda-ng.org/main/trunk@2175 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Quotes')
-rw-r--r-- | protocols/Quotes/src/ExtraImages.cpp | 122 | ||||
-rw-r--r-- | protocols/Quotes/src/ExtraImages.h | 1 | ||||
-rw-r--r-- | protocols/Quotes/src/Forex.cpp | 7 |
3 files changed, 23 insertions, 107 deletions
diff --git a/protocols/Quotes/src/ExtraImages.cpp b/protocols/Quotes/src/ExtraImages.cpp index 35a59a8c1d..5b7a16991c 100644 --- a/protocols/Quotes/src/ExtraImages.cpp +++ b/protocols/Quotes/src/ExtraImages.cpp @@ -8,25 +8,14 @@ #include "Log.h"
#include "DBUtils.h"
-namespace
+CExtraImages::CExtraImages() :
+ m_hExtraIcons(ExtraIcon_Register(ICON_STR_QUOTE,QUOTES_PROTOCOL_NAME,Quotes_MakeIconName(ICON_STR_MAIN).c_str())),
+ m_bExtraImagesInit(false),
+ m_nSlot(DBGetContactSettingWord(NULL,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_EXTRA_IMAGE_SLOT,EXTRA_ICON_ADV1))
{
- inline HANDLE extra_add_icon(const char* psz)
- {
- return reinterpret_cast<HANDLE>(
- CallService(MS_CLIST_EXTRA_ADD_ICON,reinterpret_cast<WPARAM>(Quotes_LoadIconEx(psz)),0));
- }
-
- const HANDLE INVALID_IMAGE_HANDLE = reinterpret_cast<HANDLE>(-1);
-}
-
-CExtraImages::CExtraImages()
- : m_hExtraIcons(ExtraIcon_Register(ICON_STR_QUOTE,QUOTES_PROTOCOL_NAME,Quotes_MakeIconName(ICON_STR_MAIN).c_str())),
- m_bExtraImagesInit(false),
- m_nSlot(DBGetContactSettingWord(NULL,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_EXTRA_IMAGE_SLOT,EXTRA_ICON_ADV1))
-{
- m_ahExtraImages[eiUp] = INVALID_IMAGE_HANDLE;
- m_ahExtraImages[eiDown] = INVALID_IMAGE_HANDLE;
- m_ahExtraImages[eiNotChanged] = INVALID_IMAGE_HANDLE;
+ m_ahExtraImages[eiUp] = INVALID_HANDLE_VALUE;
+ m_ahExtraImages[eiDown] = INVALID_HANDLE_VALUE;
+ m_ahExtraImages[eiNotChanged] = INVALID_HANDLE_VALUE;
}
CExtraImages::~CExtraImages()
@@ -41,89 +30,26 @@ CExtraImages& CExtraImages::GetInstance() void CExtraImages::RebuildExtraImages()
{
- if(NULL == m_hExtraIcons)
- {
- m_bExtraImagesInit = false;
- CGuard<CLightMutex> cs(m_lmExtraImages);
- m_ahExtraImages[eiUp] = extra_add_icon(ICON_STR_QUOTE_UP);
- m_ahExtraImages[eiDown] = extra_add_icon(ICON_STR_QUOTE_DOWN);
- m_ahExtraImages[eiNotChanged] = extra_add_icon(ICON_STR_QUOTE_NOT_CHANGED);
- m_bExtraImagesInit = true;
- }
}
-
bool CExtraImages::SetContactExtraImage(HANDLE hContact,EImageIndex nIndex)const
{
-// tstring s = Quotes_DBGetStringT(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME);
-// tostringstream o;
-// o << _T("SetContactExtraImage for ") << s << _T("\nExtra image list init: ") << m_bExtraImagesInit << _T("\n");
-
- bool bResult = false;
- if(m_hExtraIcons)
- {
-// o << "Using extra icon interface\n";
- std::string sIconName;
- switch(nIndex)
- {
- case eiUp:
- sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_UP);
- break;
- case eiDown:
- sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_DOWN);
- break;
- case eiNotChanged:
- sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_NOT_CHANGED);
- break;
- }
- bResult = (0 == ExtraIcon_SetIcon(m_hExtraIcons,hContact,sIconName.c_str()));
- }
- else if(m_bExtraImagesInit && ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
-// o << "Using contact list interface index is ";
- IconExtraColumn iec = {0};
- iec.cbSize = sizeof(iec);
- iec.ColumnType = m_nSlot;
-
- {
- CGuard<CLightMutex> cs(m_lmExtraImages);
- switch(nIndex)
- {
- case eiUp:
-// o << "up\n";
- iec.hImage = m_ahExtraImages[eiUp];
- break;
- case eiDown:
-// o << "down\n";
- iec.hImage = m_ahExtraImages[eiDown];
- break;
- case eiNotChanged:
-// o << "not changed\n";
- iec.hImage = m_ahExtraImages[eiNotChanged];
- break;
- default:
-// o << "invalid\n";
- iec.hImage = INVALID_IMAGE_HANDLE;
- break;
- }
- }
-
- bResult = (0 == CallService(MS_CLIST_EXTRA_SET_ICON,reinterpret_cast<WPARAM>(hContact),reinterpret_cast<LPARAM>(&iec)));
- }
-
-// o << "Result is " << bResult;
-// LogIt(Info,o.str());
- return bResult;
-}
-
-int QuotesEventFunc_onExtraImageListRebuild(WPARAM /*wp*/,LPARAM /*lp*/)
-{
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
- CExtraImages::GetInstance().RebuildExtraImages();
+ if (!m_hExtraIcons)
+ return false;
+
+ std::string sIconName;
+ switch(nIndex) {
+ case eiUp:
+ sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_UP);
+ break;
+ case eiDown:
+ sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_DOWN);
+ break;
+ case eiNotChanged:
+ sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_NOT_CHANGED);
+ break;
}
-
- return 0;
+ return (0 == ExtraIcon_SetIcon(m_hExtraIcons,hContact,sIconName.c_str()));
}
int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp)
@@ -133,11 +59,7 @@ int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp) const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
if(pProvider)
- {
pProvider->SetContactExtraIcon(hContact);
- }
return 0;
}
-
-
diff --git a/protocols/Quotes/src/ExtraImages.h b/protocols/Quotes/src/ExtraImages.h index ec8ae01e39..e6988cca06 100644 --- a/protocols/Quotes/src/ExtraImages.h +++ b/protocols/Quotes/src/ExtraImages.h @@ -33,7 +33,6 @@ private: int m_nSlot;
};
-int QuotesEventFunc_onExtraImageListRebuild(WPARAM wp,LPARAM lp);
int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp);
#endif //__9d0dac0c_12e4_46ce_809a_db6dc7d6f269_ExtraImages_h__
diff --git a/protocols/Quotes/src/Forex.cpp b/protocols/Quotes/src/Forex.cpp index ab27ba41c3..063e812b04 100644 --- a/protocols/Quotes/src/Forex.cpp +++ b/protocols/Quotes/src/Forex.cpp @@ -206,17 +206,12 @@ namespace {
CHTTPSession::Init();
- HANDLE h = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD,QuotesEventFunc_onExtraImageListRebuild);
- g_ahEvents.push_back(h);
-// QuotesEventFunc_onExtraImageListRebuild(0,0);
-
- h = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,QuotesEventFunc_onExtraImageApply);
+ HANDLE h = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,QuotesEventFunc_onExtraImageApply);
g_ahEvents.push_back(h);
g_hEventWorkThreadStop = ::CreateEvent(NULL,TRUE,FALSE,NULL);
h = (ME_USERINFO_INITIALISE,QuotesEventFunc_OnUserInfoInit);
g_ahEvents.push_back(h);
-
h = HookEvent(ME_CLIST_DOUBLECLICKED,Quotes_OnContactDoubleClick);
g_ahEvents.push_back(h);
|