diff options
author | George Hazan <george.hazan@gmail.com> | 2014-02-10 14:42:51 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-02-10 14:42:51 +0000 |
commit | 33953cc6a0fab6a91af293c6838f8a46dd7922da (patch) | |
tree | 2dbbe718ad42545bde6c9f7672387827c530550a /plugins/Quotes/src | |
parent | e190a7fde521bd6af9ea485cc730f854aaf38e11 (diff) |
HCONTACT, part 3
git-svn-id: http://svn.miranda-ng.org/main/trunk@8081 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Quotes/src')
-rw-r--r-- | plugins/Quotes/src/ExtraImages.cpp | 2 | ||||
-rw-r--r-- | plugins/Quotes/src/Forex.cpp | 2 | ||||
-rw-r--r-- | plugins/Quotes/src/ImportExport.cpp | 10 | ||||
-rw-r--r-- | plugins/Quotes/src/QuoteInfoDlg.cpp | 36 | ||||
-rw-r--r-- | plugins/Quotes/src/QuotesProviderBase.cpp | 30 | ||||
-rw-r--r-- | plugins/Quotes/src/QuotesProviderDukasCopy.cpp | 2 | ||||
-rw-r--r-- | plugins/Quotes/src/QuotesProviderFinance.cpp | 2 | ||||
-rw-r--r-- | plugins/Quotes/src/QuotesProviderGoogle.cpp | 2 | ||||
-rw-r--r-- | plugins/Quotes/src/SettingsDlg.cpp | 4 |
9 files changed, 37 insertions, 53 deletions
diff --git a/plugins/Quotes/src/ExtraImages.cpp b/plugins/Quotes/src/ExtraImages.cpp index ad2ac5e54a..99350fab93 100644 --- a/plugins/Quotes/src/ExtraImages.cpp +++ b/plugins/Quotes/src/ExtraImages.cpp @@ -47,7 +47,7 @@ bool CExtraImages::SetContactExtraImage(HCONTACT hContact,EImageIndex nIndex)con int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp)
{
- HCONTACT hContact = reinterpret_cast<HCONTACT>(wp);
+ HCONTACT hContact = HCONTACT(wp);
const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 1536bf8e9f..03a8565806 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -191,7 +191,7 @@ namespace int QuotesEventFunc_OnContactDeleted(WPARAM wParam, LPARAM)
{
- HCONTACT hContact = reinterpret_cast<HCONTACT>(wParam);
+ HCONTACT hContact = HCONTACT(wParam);
const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index 282d5aa448..6bf10e2de3 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -128,7 +128,6 @@ namespace int EnumDbModules(const char* szModuleName, DWORD ofsModuleName, LPARAM lp)
{
-// USES_CONVERSION;
CEnumContext* ctx = reinterpret_cast<CEnumContext*>(lp);
IXMLNode::TXMLNodePtr pXml = ctx->m_pNode;
IXMLNode::TXMLNodePtr pModule = ctx->m_pXmlEngine->CreateNode(g_pszXmlModule,quotes_a2t(szModuleName)/*A2CT(szModuleName)*/);
@@ -142,11 +141,10 @@ namespace dbces.szModule = szModuleName;
dbces.lParam = reinterpret_cast<LPARAM>(ctx);
- CallService(MS_DB_CONTACT_ENUMSETTINGS,reinterpret_cast<WPARAM>(ctx->m_hContact),reinterpret_cast<LPARAM>(&dbces));
+ CallService(MS_DB_CONTACT_ENUMSETTINGS, WPARAM(ctx->m_hContact),reinterpret_cast<LPARAM>(&dbces));
if(pModule->GetChildCount() > 0)
- {
pXml->AddChild(pModule);
- }
+
ctx->m_pNode = pXml;
}
@@ -273,7 +271,7 @@ INT_PTR Quotes_Export(WPARAM wp,LPARAM lp) CModuleInfo::TXMLEnginePtr pXmlEngine = CModuleInfo::GetInstance().GetXMLEnginePtr();
CModuleInfo::TQuotesProvidersPtr pProviders = CModuleInfo::GetInstance().GetQuoteProvidersPtr();
IXMLNode::TXMLNodePtr pRoot = pXmlEngine->CreateNode(g_pszXmlContacts,tstring());
- HCONTACT hContact = reinterpret_cast<HCONTACT>(wp);
+ HCONTACT hContact = HCONTACT(wp);
if(hContact)
{
CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
@@ -676,7 +674,7 @@ namespace {
if(NULL == cst.m_hContact)
{
- cst.m_hContact = reinterpret_cast<HCONTACT>(CallService(MS_DB_CONTACT_ADD,0,0));
+ cst.m_hContact = HCONTACT(CallService(MS_DB_CONTACT_ADD,0,0));
cst.m_bNewContact = true;
}
else if(impctx.m_nFlags"ES_IMPORT_SKIP_EXISTING_CONTACTS)
diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp index fa7ae638c2..a5be52dd9d 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.cpp +++ b/plugins/Quotes/src/QuoteInfoDlg.cpp @@ -24,7 +24,7 @@ namespace inline HCONTACT get_contact(HWND hWnd)
{
- return reinterpret_cast<HCONTACT>(GetWindowLongPtr(hWnd,GWLP_USERDATA));
+ return HCONTACT(GetWindowLongPtr(hWnd,GWLP_USERDATA));
}
@@ -118,7 +118,7 @@ namespace int QuotesEventFunc_OnUserInfoInit(WPARAM wp,LPARAM lp)
{
- HCONTACT hContact = reinterpret_cast<HCONTACT>(lp);
+ HCONTACT hContact = HCONTACT(lp);
if(NULL == hContact)
return 0;
@@ -141,7 +141,7 @@ int QuotesEventFunc_OnUserInfoInit(WPARAM wp,LPARAM lp) INT_PTR QuotesMenu_EditSettings(WPARAM wp,LPARAM lp)
{
- HCONTACT hContact = reinterpret_cast<HCONTACT>(wp);
+ HCONTACT hContact = HCONTACT(wp);
if(NULL == hContact)
{
return 0;
@@ -163,7 +163,7 @@ namespace INT_PTR QuotesMenu_OpenLogFile(WPARAM wp,LPARAM lp)
{
- HCONTACT hContact = reinterpret_cast<HCONTACT>(wp);
+ HCONTACT hContact = HCONTACT(wp);
if(NULL == hContact)
{
return 0;
@@ -180,7 +180,7 @@ INT_PTR QuotesMenu_OpenLogFile(WPARAM wp,LPARAM lp) INT_PTR QuotesMenu_RefreshContact(WPARAM wp,LPARAM lp)
{
- HCONTACT hContact = reinterpret_cast<HCONTACT>(wp);
+ HCONTACT hContact = HCONTACT(wp);
if(NULL == hContact)
{
return 0;
@@ -202,17 +202,16 @@ namespace INT_PTR CALLBACK QuoteInfoDlgProc1(HWND hdlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
HCONTACT hContact = NULL;
- switch(msg)
- {
+ switch(msg) {
case WM_INITDIALOG:
{
- hContact = reinterpret_cast<HCONTACT>(lParam);
+ hContact = HCONTACT(lParam);
HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO,false);
assert(hWL);
WindowList_Add(hWL,hdlg,hContact);
- ::SetWindowLongPtr(hdlg,GWLP_USERDATA,reinterpret_cast<LONG>(hContact));
- Utils_RestoreWindowPositionNoSize(hdlg,hContact,QUOTES_MODULE_NAME,WINDOW_PREFIX_INFO);
+ ::SetWindowLongPtr(hdlg, GWLP_USERDATA, (LPARAM)hContact);
+ Utils_RestoreWindowPositionNoSize(hdlg, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_INFO);
::ShowWindow(hdlg,SW_SHOW);
}
break;
@@ -251,28 +250,23 @@ namespace int Quotes_OnContactDoubleClick(WPARAM wp,LPARAM/* lp*/)
{
- HCONTACT hContact = reinterpret_cast<HCONTACT>(wp);
+ HCONTACT hContact = HCONTACT(wp);
if(CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact))
{
HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO,true);
assert(hWL);
HWND hWnd = WindowList_Find(hWL,hContact);
- if(NULL != hWnd)
- {
+ if(NULL != hWnd) {
SetForegroundWindow(hWnd);
SetFocus(hWnd);
}
else if(true == IsMyContact(hContact))
- {
- CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_DIALOG_QUOTE_INFO_1),NULL,QuoteInfoDlgProc1,reinterpret_cast<LPARAM>(hContact));
- }
+ CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_QUOTE_INFO_1), NULL, QuoteInfoDlgProc1, LPARAM(hContact));
return 1;
}
- else
- {
- return 0;
- }
+
+ return 0;
}
namespace
@@ -297,7 +291,7 @@ int Quotes_PrebuildContactMenu(WPARAM wp,LPARAM lp) #endif
enable_menu(g_hMenuRefresh,false);
- HCONTACT hContact = reinterpret_cast<HCONTACT>(wp);
+ HCONTACT hContact = HCONTACT(wp);
if(NULL == hContact)
{
return 0;
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp index b017c7c162..462154c478 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp @@ -827,24 +827,19 @@ void CQuotesProviderBase::WriteContactRate(HCONTACT hContact,double dRate,const HCONTACT CQuotesProviderBase::CreateNewContact(const tstring& rsName)
{
- HCONTACT hContact = reinterpret_cast<HCONTACT>(CallService(MS_DB_CONTACT_ADD,0,0));
- if(hContact)
- {
- if(0 == CallService(MS_PROTO_ADDTOCONTACT,reinterpret_cast<WPARAM>(hContact),(LPARAM)QUOTES_PROTOCOL_NAME))
- {
+ HCONTACT hContact = HCONTACT(CallService(MS_DB_CONTACT_ADD,0,0));
+ if(hContact) {
+ if(0 == CallService(MS_PROTO_ADDTOCONTACT, WPARAM(hContact), (LPARAM)QUOTES_PROTOCOL_NAME)) {
tstring sProvName = GetInfo().m_sName;
db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_PROVIDER,sProvName.c_str());
db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_SYMBOL,rsName.c_str());
db_set_ts(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME,rsName.c_str());
- {// for CCritSection
- CGuard<CLightMutex> cs(m_cs);
- m_aContacts.push_back(hContact);
- }
+ CGuard<CLightMutex> cs(m_cs);
+ m_aContacts.push_back(hContact);
}
- else
- {
- CallService(MS_DB_CONTACT_DELETE,reinterpret_cast<WPARAM>(hContact),0);
+ else {
+ CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0);
hContact = NULL;
}
}
@@ -979,14 +974,11 @@ void CQuotesProviderBase::Run() {
DWORD dwTimeRest = ::GetTickCount()-dwBegin;
if(dwTimeRest < nTimeout)
- {
nTimeout -= dwTimeRest;
- }
- {
- CGuard<CLightMutex> cs(m_cs);
- anContacts = m_aRefreshingContacts;
- m_aRefreshingContacts.clear();
- }
+
+ CGuard<CLightMutex> cs(m_cs);
+ anContacts = m_aRefreshingContacts;
+ m_aRefreshingContacts.clear();
}
break;
case WAIT_TIMEOUT:
diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp index 1d660b155d..8fd913fa25 100644 --- a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp +++ b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp @@ -42,7 +42,7 @@ bool CQuotesProviderDukasCopy::WatchForQuote(const CQuote& rQuote,bool bWatch) m_aContacts.erase(i);
}
- CallService(MS_DB_CONTACT_DELETE,reinterpret_cast<WPARAM>(hContact),0);
+ CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0);
return true;
}
else if((true == bWatch) && (i == m_aContacts.end()))
diff --git a/plugins/Quotes/src/QuotesProviderFinance.cpp b/plugins/Quotes/src/QuotesProviderFinance.cpp index 83e6389d54..49d2c5bf23 100644 --- a/plugins/Quotes/src/QuotesProviderFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderFinance.cpp @@ -41,7 +41,7 @@ bool CQuotesProviderFinance::WatchForQuote(const CQuote& rQuote,bool bWatch) m_aContacts.erase(i);
}
- CallService(MS_DB_CONTACT_DELETE,reinterpret_cast<WPARAM>(hContact),0);
+ CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0);
return true;
}
else if ((true == bWatch) && (i == m_aContacts.end()))
diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp index 14f9ae1daa..fb64f3b730 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp @@ -61,7 +61,7 @@ bool CQuotesProviderGoogle::WatchForRate(const CRateInfo& ri, m_aContacts.erase(i);
}
- CallService(MS_DB_CONTACT_DELETE,reinterpret_cast<WPARAM>(hContact),0);
+ CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0);
return true;
}
diff --git a/plugins/Quotes/src/SettingsDlg.cpp b/plugins/Quotes/src/SettingsDlg.cpp index 0045c21cad..e52be731bd 100644 --- a/plugins/Quotes/src/SettingsDlg.cpp +++ b/plugins/Quotes/src/SettingsDlg.cpp @@ -268,7 +268,7 @@ namespace {
case WM_INITDIALOG:
{
- HCONTACT hContact = reinterpret_cast<HCONTACT>(lp);
+ HCONTACT hContact = HCONTACT(lp);
TranslateDialogDefault(hWnd);
HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_SETTINGS,false);
@@ -519,7 +519,7 @@ void ShowSettingsDlg(HCONTACT hContact) }
else
{
- CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_CONTACT_SETTINGS),NULL,EditSettingsPerContactDlgProc,reinterpret_cast<LPARAM>(hContact));
+ CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_CONTACT_SETTINGS),NULL,EditSettingsPerContactDlgProc, LPARAM(hContact));
}
}
|