summaryrefslogtreecommitdiff
path: root/plugins/Quotes
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-08-12 18:59:44 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-08-12 18:59:44 +0000
commit4e5548a98703325099017bf6bf04b2fb5edefbd4 (patch)
treed66558d679c6d538ffc6dc6e24214cabece6a6f1 /plugins/Quotes
parent74e9b42783af6a0a9d51df6271bca169e3dcc81d (diff)
this code was too crazy to work
git-svn-id: http://svn.miranda-ng.org/main/trunk@10169 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Quotes')
-rw-r--r--plugins/Quotes/src/ExtraImages.cpp40
-rw-r--r--plugins/Quotes/src/ExtraImages.h35
-rw-r--r--plugins/Quotes/src/Forex.cpp1
-rw-r--r--plugins/Quotes/src/QuotesProviderBase.cpp22
4 files changed, 24 insertions, 74 deletions
diff --git a/plugins/Quotes/src/ExtraImages.cpp b/plugins/Quotes/src/ExtraImages.cpp
index 8b14ce5c4c..83f10fa4f3 100644
--- a/plugins/Quotes/src/ExtraImages.cpp
+++ b/plugins/Quotes/src/ExtraImages.cpp
@@ -1,31 +1,15 @@
#include "StdAfx.h"
-CExtraImages::CExtraImages() :
- m_hExtraIcons(ExtraIcon_Register(ICON_STR_QUOTE,QUOTES_PROTOCOL_NAME,Quotes_MakeIconName(ICON_STR_MAIN).c_str())),
- m_bExtraImagesInit(false)
-{
- m_ahExtraImages[eiUp] = INVALID_HANDLE_VALUE;
- m_ahExtraImages[eiDown] = INVALID_HANDLE_VALUE;
- m_ahExtraImages[eiNotChanged] = INVALID_HANDLE_VALUE;
-}
-
-CExtraImages::~CExtraImages()
-{
-}
+static HANDLE hExtraIcon;
-CExtraImages& CExtraImages::GetInstance()
+void Quotes_InitExtraIcons()
{
- static CExtraImages s_ei;
- return s_ei;
+ hExtraIcon = ExtraIcon_Register(ICON_STR_QUOTE, QUOTES_PROTOCOL_NAME, Quotes_MakeIconName(ICON_STR_MAIN).c_str());
}
-void CExtraImages::RebuildExtraImages()
+bool SetContactExtraImage(MCONTACT hContact,EImageIndex nIndex)
{
-}
-
-bool CExtraImages::SetContactExtraImage(MCONTACT hContact,EImageIndex nIndex)const
-{
- if (!m_hExtraIcons)
+ if (!hExtraIcon)
return false;
HANDLE hIcolib;
@@ -42,17 +26,5 @@ bool CExtraImages::SetContactExtraImage(MCONTACT hContact,EImageIndex nIndex)con
default:
hIcolib = NULL;
}
- return ExtraIcon_SetIcon(m_hExtraIcons, hContact, hIcolib) == 0;
+ return ExtraIcon_SetIcon(hExtraIcon, hContact, hIcolib) == 0;
}
-
-// int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp)
-// {
-// MCONTACT hContact = MCONTACT(wp);
-//
-// const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
-// CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
-// if(pProvider)
-// pProvider->SetContactExtraIcon(hContact);
-//
-// return 0;
-// }
diff --git a/plugins/Quotes/src/ExtraImages.h b/plugins/Quotes/src/ExtraImages.h
index d5581c6df3..ccad667636 100644
--- a/plugins/Quotes/src/ExtraImages.h
+++ b/plugins/Quotes/src/ExtraImages.h
@@ -1,35 +1,16 @@
#ifndef __9d0dac0c_12e4_46ce_809a_db6dc7d6f269_ExtraImages_h__
#define __9d0dac0c_12e4_46ce_809a_db6dc7d6f269_ExtraImages_h__
-class CExtraImages : private boost::noncopyable
+enum EImageIndex
{
-public:
- enum EImageIndex
- {
- eiUp = 0,
- eiDown = 1,
- eiNotChanged = 2,
- eiEmpty = 3,
- ImageCount = 3
- };
-
-private:
- CExtraImages();
- ~CExtraImages();
-
-public:
- static CExtraImages& GetInstance();
-
- void RebuildExtraImages();
- bool SetContactExtraImage(MCONTACT hContact,EImageIndex nIndex)const;
-
-private:
- mutable CLightMutex m_lmExtraImages;
- HANDLE m_ahExtraImages[ImageCount];
- HANDLE m_hExtraIcons;
- bool m_bExtraImagesInit;
+ eiUp = 0,
+ eiDown = 1,
+ eiNotChanged = 2,
+ eiEmpty = 3
};
-// int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp);
+bool SetContactExtraImage(MCONTACT hContact,EImageIndex nIndex);
+
+void Quotes_InitExtraIcons(void);
#endif //__9d0dac0c_12e4_46ce_809a_db6dc7d6f269_ExtraImages_h__
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp
index 6eda62e7d2..e03f8fccd9 100644
--- a/plugins/Quotes/src/Forex.cpp
+++ b/plugins/Quotes/src/Forex.cpp
@@ -472,6 +472,7 @@ extern "C"
}
Quotes_IconsInit();
+ Quotes_InitExtraIcons();
PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = QUOTES_PROTOCOL_NAME;
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp
index 560bfde7c2..d05d21f304 100644
--- a/plugins/Quotes/src/QuotesProviderBase.cpp
+++ b/plugins/Quotes/src/QuotesProviderBase.cpp
@@ -273,7 +273,7 @@ void CQuotesProviderBase::SetContactStatus(MCONTACT hContact,int nNewStatus)
db_set_ts(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME,sSymbol.c_str());
}
- CExtraImages::GetInstance().SetContactExtraImage(hContact,CExtraImages::eiEmpty);
+ SetContactExtraImage(hContact, eiEmpty);
}
}
}
@@ -588,19 +588,15 @@ namespace
//if(true == IsWithinAccuracy(dCurrRate,dPrevRate))
if(CTendency::NotChanged == nComparison)
- {
- bResult = CExtraImages::GetInstance().SetContactExtraImage(hContact,CExtraImages::eiNotChanged);
- }
- else if(CTendency::Up == nComparison)//(dCurrRate > dPrevRate)
- {
- bResult = CExtraImages::GetInstance().SetContactExtraImage(hContact,CExtraImages::eiUp);
- }
- else if(CTendency::Down == nComparison)//(dCurrRate < dPrevRate)
- {
- bResult = CExtraImages::GetInstance().SetContactExtraImage(hContact,CExtraImages::eiDown);
- }
+ return SetContactExtraImage(hContact, eiNotChanged);
+
+ if(CTendency::Up == nComparison)//(dCurrRate > dPrevRate)
+ return SetContactExtraImage(hContact, eiUp);
+
+ if(CTendency::Down == nComparison)//(dCurrRate < dPrevRate)
+ return SetContactExtraImage(hContact, eiDown);
- return bResult;
+ return false;
}
bool show_popup(const IQuotesProvider* pProvider,