diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2014-12-21 09:49:05 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2014-12-21 09:49:05 +0000 |
commit | 9b119cadd74e1343cad493e8b366e69743a620d0 (patch) | |
tree | e11d3923e86eb667f1a2f20e1126066e51ed73ce /plugins/Quotes | |
parent | 1b85ad91e7aa1af9d295d399e560a2adc6d413d3 (diff) |
Quotes: changed warning level to w4
git-svn-id: http://svn.miranda-ng.org/main/trunk@11552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Quotes')
64 files changed, 2988 insertions, 2985 deletions
diff --git a/plugins/Quotes/Forex_12.vcxproj b/plugins/Quotes/Forex_12.vcxproj index e33f0bf05a..8c7e8b08fa 100644 --- a/plugins/Quotes/Forex_12.vcxproj +++ b/plugins/Quotes/Forex_12.vcxproj @@ -81,7 +81,7 @@ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
@@ -106,7 +106,7 @@ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
</ClCompile>
<Link>
<AdditionalDependencies>comsuppw.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -129,7 +129,7 @@ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
</ClCompile>
<Link>
<AdditionalDependencies>comsuppw.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -154,7 +154,7 @@ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
</ClCompile>
<Link>
<AdditionalDependencies>comsuppw.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
diff --git a/plugins/Quotes/src/Chart.h b/plugins/Quotes/src/Chart.h index 4e00d3cba4..ba42d6a7b2 100644 --- a/plugins/Quotes/src/Chart.h +++ b/plugins/Quotes/src/Chart.h @@ -18,7 +18,7 @@ namespace detail }
};
- template<> struct CConverter<double>
+ template<> struct CConverter < double >
{
static double Convert(double v)
{
@@ -35,15 +35,15 @@ namespace detail };
}
-template<class TXValue,class TYValue,class TXConverter = detail::CConverter<TXValue>,class TYConverter = detail::CConverter<TYValue> >
+template<class TXValue, class TYValue, class TXConverter = detail::CConverter<TXValue>, class TYConverter = detail::CConverter<TYValue> >
class CChart
{
private:
- typedef std::pair<TXValue,TYValue> TValue;
+ typedef std::pair<TXValue, TYValue> TValue;
typedef std::vector<TValue> TValues;
public:
- CChart() : m_MaxY(),m_MinY()
+ CChart() : m_MaxY(), m_MinY()
{
memset(&m_rect, 0, sizeof(m_rect));
}
@@ -52,21 +52,21 @@ public: {
}
- void AddValue(const TXValue& x,const TYValue& y)
+ void AddValue(const TXValue& x, const TYValue& y)
{
- if(m_aValues.empty())
+ if (m_aValues.empty())
{
m_MaxY = m_MinY = y;
}
- else
+ else
{
- m_MaxY = __max(y,m_MaxY);
- m_MinY = __min(y,m_MinY);
+ m_MaxY = __max(y, m_MaxY);
+ m_MinY = __min(y, m_MinY);
}
- m_aValues.push_back(std::make_pair(x,y));
+ m_aValues.push_back(std::make_pair(x, y));
}
- void SetRect(int x,int y,int cx,int cy)
+ void SetRect(int x, int y, int cx, int cy)
{
m_rect.left = x;
m_rect.right = x + cx;
@@ -77,117 +77,117 @@ public: void Draw(HDC hdc)const
{
RECT rc = m_rect;
- DrawBackground(hdc,rc);
- if(false == m_aValues.empty())
+ DrawBackground(hdc, rc);
+ if (false == m_aValues.empty())
{
- ::InflateRect(&rc,-10,-10);
- DrawGrid(hdc,rc);
- DrawAxis(hdc,rc);
- DrawPoints(hdc,rc);
+ ::InflateRect(&rc, -10, -10);
+ DrawGrid(hdc, rc);
+ DrawAxis(hdc, rc);
+ DrawPoints(hdc, rc);
}
else
{
HFONT hFont = static_cast<HFONT>(::GetStockObject(DEFAULT_GUI_FONT));
- HFONT hOldFont = static_cast<HFONT>(::SelectObject(hdc,hFont));
+ HFONT hOldFont = static_cast<HFONT>(::SelectObject(hdc, hFont));
LPCTSTR pszText = TranslateT("There is no to show");
int nDrawTextResult = ::DrawText(hdc, pszText, -1, &rc, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
assert(0 != nDrawTextResult);
- ::SelectObject(hdc,hOldFont);
+ ::SelectObject(hdc, hOldFont);
BOOL bResult = ::DeleteObject(hFont);
assert(TRUE == bResult);
}
}
private:
- void DrawBackground(HDC hdc,RECT& rc)const
+ void DrawBackground(HDC hdc, RECT& rc)const
{
-// HBRUSH hBrush = ::CreateSolidBrush(RGB(255,0,0));//user preferable background color here!
-// ::FillRect(hdc,&m_rect,hBrush);
-// ::DeleteBrush(hBrush);
+ // HBRUSH hBrush = ::CreateSolidBrush(RGB(255,0,0));//user preferable background color here!
+ // ::FillRect(hdc,&m_rect,hBrush);
+ // ::DeleteBrush(hBrush);
}
- void DrawGrid(HDC hdc,RECT& rc)const
+ void DrawGrid(HDC hdc, RECT& rc)const
{
- enum{number_of_lines = 5};
- HPEN hPen = ::CreatePen(PS_SOLID,1,RGB(125,125,125));
- HPEN hPenOld = static_cast<HPEN>(::SelectObject(hdc,hPen));
+ enum{ number_of_lines = 5 };
+ HPEN hPen = ::CreatePen(PS_SOLID, 1, RGB(125, 125, 125));
+ HPEN hPenOld = static_cast<HPEN>(::SelectObject(hdc, hPen));
HFONT hFont = static_cast<HFONT>(::GetStockObject(DEFAULT_GUI_FONT));
- HFONT hOldFont = static_cast<HFONT>(::SelectObject(hdc,hFont));
+ HFONT hOldFont = static_cast<HFONT>(::SelectObject(hdc, hFont));
//vertical grid
- int step = (rc.bottom-rc.top)/number_of_lines;
- TYValue y_val = m_MinY + ((m_MaxY-m_MinY)/number_of_lines);
+ int step = (rc.bottom - rc.top) / number_of_lines;
+ TYValue y_val = m_MinY + ((m_MaxY - m_MinY) / number_of_lines);
int nXIndent = 0;
- for(int y = rc.bottom-step;y > rc.top;y-=step,y_val+=((m_MaxY-m_MinY)/number_of_lines))
+ for (int y = rc.bottom - step; y > rc.top; y -= step, y_val += ((m_MaxY - m_MinY) / number_of_lines))
{
tstring sY = TYConverter::ToString(y_val);
- SIZE sizeText = {0,0};
- BOOL bResult = ::GetTextExtentPoint32(hdc,sY.c_str(), (int)sY.size(), &sizeText);
+ SIZE sizeText = { 0, 0 };
+ BOOL bResult = ::GetTextExtentPoint32(hdc, sY.c_str(), (int)sY.size(), &sizeText);
assert(TRUE == bResult);
- nXIndent = __max(nXIndent,sizeText.cx);
+ nXIndent = __max(nXIndent, sizeText.cx);
}
- y_val = m_MinY + ((m_MaxY-m_MinY)/number_of_lines);
+ y_val = m_MinY + ((m_MaxY - m_MinY) / number_of_lines);
nXIndent += 2;
rc.left += nXIndent;
- for (int y = rc.bottom-step;y > rc.top;y-=step,y_val+=((m_MaxY-m_MinY)/number_of_lines))
+ for (int y = rc.bottom - step; y > rc.top; y -= step, y_val += ((m_MaxY - m_MinY) / number_of_lines))
{
tstring sY = TYConverter::ToString(y_val);
- SIZE sizeText = {0,0};
+ SIZE sizeText = { 0, 0 };
BOOL bResult = ::GetTextExtentPoint32(hdc, sY.c_str(), (int)sY.size(), &sizeText);
assert(TRUE == bResult);
- RECT rcText = {rc.left-nXIndent,y-(sizeText.cy/2),rc.left-1,y+(sizeText.cy/2)};
- int nDrawTextResult = ::DrawText(hdc, sY.c_str(), -1, &rcText, DT_SINGLELINE|DT_VCENTER|DT_RIGHT);
+ RECT rcText = { rc.left - nXIndent, y - (sizeText.cy / 2), rc.left - 1, y + (sizeText.cy / 2) };
+ int nDrawTextResult = ::DrawText(hdc, sY.c_str(), -1, &rcText, DT_SINGLELINE | DT_VCENTER | DT_RIGHT);
assert(0 != nDrawTextResult);
- bResult = ::MoveToEx(hdc,rc.left,y,NULL);
+ bResult = ::MoveToEx(hdc, rc.left, y, NULL);
assert(TRUE == bResult);
- bResult = ::LineTo(hdc,rc.right,y);
+ bResult = ::LineTo(hdc, rc.right, y);
assert(TRUE == bResult);
}
// horizontal grid
- HRGN rgnAllLables = ::CreateRectRgn(0,0,0,0);
- HRGN rgnTemporary = ::CreateRectRgn(0,0,0,0);
+ HRGN rgnAllLables = ::CreateRectRgn(0, 0, 0, 0);
+ HRGN rgnTemporary = ::CreateRectRgn(0, 0, 0, 0);
bool bFixedRect = false;
- step = (rc.right-rc.left)/number_of_lines;
- TXValue x_val = m_aValues[0].first + ((m_aValues[m_aValues.size()-1].first-m_aValues[0].first)/number_of_lines);
- for(int x = rc.left+step;x < rc.right;x+=step,x_val+=((m_aValues[m_aValues.size()-1].first-m_aValues[0].first)/number_of_lines))
+ step = (rc.right - rc.left) / number_of_lines;
+ TXValue x_val = m_aValues[0].first + ((m_aValues[m_aValues.size() - 1].first - m_aValues[0].first) / number_of_lines);
+ for (int x = rc.left + step; x < rc.right; x += step, x_val += ((m_aValues[m_aValues.size() - 1].first - m_aValues[0].first) / number_of_lines))
{
tstring sX = TXConverter::ToString(x_val);
- SIZE sizeText = {0,0};
+ SIZE sizeText = { 0, 0 };
BOOL bResult = ::GetTextExtentPoint32(hdc, sX.c_str(), (int)sX.size(), &sizeText);
assert(TRUE == bResult);
- if(false == bFixedRect)
+ if (false == bFixedRect)
{
- rc.bottom -= sizeText.cy+2;
+ rc.bottom -= sizeText.cy + 2;
bFixedRect = true;
}
- RECT rcText = {x-(sizeText.cx/2),rc.bottom,x+(sizeText.cx/2),rc.bottom+sizeText.cy-1};
+ RECT rcText = { x - (sizeText.cx / 2), rc.bottom, x + (sizeText.cx / 2), rc.bottom + sizeText.cy - 1 };
// Draw a label if it doesn't overlap with previous ones
HRGN rgnCurrentLable = ::CreateRectRgnIndirect(&rcText);
- if(NULLREGION == ::CombineRgn(rgnTemporary,rgnCurrentLable,rgnAllLables,RGN_AND))
+ if (NULLREGION == ::CombineRgn(rgnTemporary, rgnCurrentLable, rgnAllLables, RGN_AND))
{
- int nDrawTextResult = ::DrawText(hdc, sX.c_str(), (int)sX.size(), &rcText, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
+ int nDrawTextResult = ::DrawText(hdc, sX.c_str(), (int)sX.size(), &rcText, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
assert(0 != nDrawTextResult);
- int nCombineRgnResult = ::CombineRgn(rgnTemporary,rgnCurrentLable,rgnAllLables,RGN_OR);
+ int nCombineRgnResult = ::CombineRgn(rgnTemporary, rgnCurrentLable, rgnAllLables, RGN_OR);
assert(ERROR != nCombineRgnResult);
- nCombineRgnResult = ::CombineRgn(rgnAllLables,rgnTemporary,NULL,RGN_COPY);
+ nCombineRgnResult = ::CombineRgn(rgnAllLables, rgnTemporary, NULL, RGN_COPY);
assert(ERROR != nCombineRgnResult);
}
bResult = ::DeleteObject(rgnCurrentLable);
assert(TRUE == bResult);
-
- bResult = ::MoveToEx(hdc,x,rc.bottom,NULL);
+
+ bResult = ::MoveToEx(hdc, x, rc.bottom, NULL);
assert(TRUE == bResult);
- bResult = ::LineTo(hdc,x,rc.top);
+ bResult = ::LineTo(hdc, x, rc.top);
assert(TRUE == bResult);
}
@@ -196,76 +196,76 @@ private: bResult = ::DeleteObject(rgnTemporary);
assert(TRUE == bResult);
- ::SelectObject(hdc,hOldFont);
- ::SelectObject(hdc,hPenOld);
+ ::SelectObject(hdc, hOldFont);
+ ::SelectObject(hdc, hPenOld);
bResult = ::DeleteObject(hFont);
assert(TRUE == bResult);
bResult = ::DeleteObject(hPen);
assert(TRUE == bResult);
}
- void DrawAxis(HDC hdc,RECT& rc)const
+ void DrawAxis(HDC hdc, RECT& rc)const
{
- HPEN hPen = ::CreatePen(PS_SOLID,2,RGB(0,0,0));
- HPEN hPenOld = static_cast<HPEN>(::SelectObject(hdc,hPen));
+ HPEN hPen = ::CreatePen(PS_SOLID, 2, RGB(0, 0, 0));
+ HPEN hPenOld = static_cast<HPEN>(::SelectObject(hdc, hPen));
// draw Y-axes
- BOOL bResult = ::MoveToEx(hdc,rc.left+1,rc.bottom-1,NULL);
+ BOOL bResult = ::MoveToEx(hdc, rc.left + 1, rc.bottom - 1, NULL);
assert(TRUE == bResult);
- bResult = ::LineTo(hdc,rc.left+1,rc.top+1);
+ bResult = ::LineTo(hdc, rc.left + 1, rc.top + 1);
assert(TRUE == bResult);
// draw X-axes
- bResult = ::MoveToEx(hdc,rc.left+1,rc.bottom-1,NULL);
+ bResult = ::MoveToEx(hdc, rc.left + 1, rc.bottom - 1, NULL);
assert(TRUE == bResult);
- bResult = ::LineTo(hdc,rc.right-1,rc.bottom-1);
+ bResult = ::LineTo(hdc, rc.right - 1, rc.bottom - 1);
assert(TRUE == bResult);
- ::SelectObject(hdc,hPenOld);
+ ::SelectObject(hdc, hPenOld);
bResult = ::DeleteObject(hPen);
assert(TRUE == bResult);
}
- void DrawPoints(HDC hdc,RECT& rc)const
- {
+ void DrawPoints(HDC hdc, RECT& rc)const
+ {
TXValue xMin(m_aValues[0].first);
- double dx = TXConverter::Convert(m_aValues[m_aValues.size()-1].first-xMin);
- double dY = TYConverter::Convert(m_MaxY-m_MinY);
+ double dx = TXConverter::Convert(m_aValues[m_aValues.size() - 1].first - xMin);
+ double dY = TYConverter::Convert(m_MaxY - m_MinY);
- HPEN hPen = ::CreatePen(PS_SOLID,1,RGB(255,0,0));
- HGDIOBJ hPenOld = ::SelectObject(hdc,hPen);
+ HPEN hPen = ::CreatePen(PS_SOLID, 1, RGB(255, 0, 0));
+ HGDIOBJ hPenOld = ::SelectObject(hdc, hPen);
- HBRUSH hBrush = ::CreateSolidBrush(RGB(255,0,0));
- HGDIOBJ hBrushOld = ::SelectObject(hdc,hBrush);
+ HBRUSH hBrush = ::CreateSolidBrush(RGB(255, 0, 0));
+ HGDIOBJ hBrushOld = ::SelectObject(hdc, hBrush);
bool bPrevValid = false;
- int xPrex,yPrev;
+ int xPrex, yPrev;
- BOOST_FOREACH(const TValue& v,m_aValues)
+ BOOST_FOREACH(const TValue& v, m_aValues)
{
- double k = TXConverter::Convert(v.first-xMin);
+ double k = TXConverter::Convert(v.first - xMin);
- int x = rc.left+boost::numeric_cast<int>((rc.right-rc.left)*(k/dx));
- k = TYConverter::Convert(v.second-m_MinY);
- int y = rc.bottom-boost::numeric_cast<int>((rc.bottom-rc.top)*(k/dY));
- ::Ellipse(hdc,x-5,y-5,x+5,y+5);
- if(bPrevValid)
+ int x = rc.left + boost::numeric_cast<int>((rc.right - rc.left)*(k / dx));
+ k = TYConverter::Convert(v.second - m_MinY);
+ int y = rc.bottom - boost::numeric_cast<int>((rc.bottom - rc.top)*(k / dY));
+ ::Ellipse(hdc, x - 5, y - 5, x + 5, y + 5);
+ if (bPrevValid)
{
- BOOL bResult = ::MoveToEx(hdc,xPrex,yPrev,NULL);
+ BOOL bResult = ::MoveToEx(hdc, xPrex, yPrev, NULL);
assert(TRUE == bResult);
- bResult = ::LineTo(hdc,x,y);
+ bResult = ::LineTo(hdc, x, y);
assert(TRUE == bResult);
}
- xPrex = x,yPrev = y;
+ xPrex = x, yPrev = y;
bPrevValid = true;
}
- ::SelectObject(hdc,hPenOld);
+ ::SelectObject(hdc, hPenOld);
BOOL bResult = ::DeleteObject(hPen);
assert(TRUE == bResult);
- ::SelectObject(hdc,hBrushOld);
+ ::SelectObject(hdc, hBrushOld);
bResult = ::DeleteObject(hBrush);
assert(TRUE == bResult);
}
diff --git a/plugins/Quotes/src/ComHelper.cpp b/plugins/Quotes/src/ComHelper.cpp index 77c0fc7d60..36241a423e 100644 --- a/plugins/Quotes/src/ComHelper.cpp +++ b/plugins/Quotes/src/ComHelper.cpp @@ -1,10 +1,10 @@ #include "StdAfx.h"
-tstring ComException2Msg(_com_error& e,const tstring& rsAdditionalInfo)
+tstring ComException2Msg(_com_error& e, const tstring& rsAdditionalInfo)
{
HRESULT hError = e.Error();
tostringstream o;
- if(false == rsAdditionalInfo.empty())
+ if (false == rsAdditionalInfo.empty())
{
o << rsAdditionalInfo << "\n";
}
@@ -13,12 +13,12 @@ tstring ComException2Msg(_com_error& e,const tstring& rsAdditionalInfo) IErrorInfo* p = e.ErrorInfo();
CComPtr<IErrorInfo> pErrorInfo(p);
- if(NULL != p)
+ if (NULL != p)
{
p->Release();
}
- if(pErrorInfo)
+ if (pErrorInfo)
{
o << _T("\n") << e.Description();
}
@@ -26,11 +26,11 @@ tstring ComException2Msg(_com_error& e,const tstring& rsAdditionalInfo) return o.str();
}
-void ShowComError(_com_error& e,const tstring& rsAdditionalInfo)
+void ShowComError(_com_error& e, const tstring& rsAdditionalInfo)
{
- tstring sErrorMsg = ComException2Msg(e,rsAdditionalInfo);
- LogIt(Error,sErrorMsg);
- Quotes_MessageBox(NULL,sErrorMsg.c_str(),MB_OK|MB_ICONERROR);
+ tstring sErrorMsg = ComException2Msg(e, rsAdditionalInfo);
+ LogIt(sErrorMsg);
+ Quotes_MessageBox(NULL, sErrorMsg.c_str(), MB_OK | MB_ICONERROR);
}
diff --git a/plugins/Quotes/src/ComHelper.h b/plugins/Quotes/src/ComHelper.h index a9d87784d8..16f565b5be 100644 --- a/plugins/Quotes/src/ComHelper.h +++ b/plugins/Quotes/src/ComHelper.h @@ -1,7 +1,7 @@ #ifndef __37ae28ab_c414_4aba_bbef_d23dd68643a5_ComHelper_h__
#define __37ae28ab_c414_4aba_bbef_d23dd68643a5_ComHelper_h__
-void ShowComError(_com_error& e,const tstring& rsAdditionalInfo);
-tstring ComException2Msg(_com_error& e,const tstring& rsAdditionalInfo);
+void ShowComError(_com_error& e, const tstring& rsAdditionalInfo);
+tstring ComException2Msg(_com_error& e, const tstring& rsAdditionalInfo);
#endif//__37ae28ab_c414_4aba_bbef_d23dd68643a5_ComHelper_h__
diff --git a/plugins/Quotes/src/CommonOptionDlg.cpp b/plugins/Quotes/src/CommonOptionDlg.cpp index df87f770ba..bf3430f43f 100644 --- a/plugins/Quotes/src/CommonOptionDlg.cpp +++ b/plugins/Quotes/src/CommonOptionDlg.cpp @@ -3,21 +3,21 @@ namespace
{
typedef boost::shared_ptr<CAdvProviderSettings> TAdvSettingsPtr;
- typedef std::map<const IQuotesProvider*,TAdvSettingsPtr> TAdvSettings;
+ typedef std::map<const IQuotesProvider*, TAdvSettingsPtr> TAdvSettings;
TAdvSettings g_aAdvSettings;
- CAdvProviderSettings* get_adv_settings(const IQuotesProvider* pProvider,bool bCreateIfNonExist)
+ CAdvProviderSettings* get_adv_settings(const IQuotesProvider* pProvider, bool bCreateIfNonExist)
{
TAdvSettings::iterator i = g_aAdvSettings.find(pProvider);
- if(i != g_aAdvSettings.end())
+ if (i != g_aAdvSettings.end())
{
return i->second.get();
}
- else if(true == bCreateIfNonExist)
+ else if (true == bCreateIfNonExist)
{
TAdvSettingsPtr pAdvSet(new CAdvProviderSettings(pProvider));
- g_aAdvSettings.insert(std::make_pair(pProvider,pAdvSet));
+ g_aAdvSettings.insert(std::make_pair(pProvider, pAdvSet));
return pAdvSet.get();
}
else
@@ -29,234 +29,234 @@ namespace void remove_adv_settings(const IQuotesProvider* pProvider)
{
TAdvSettings::iterator i = g_aAdvSettings.find(pProvider);
- if(i != g_aAdvSettings.end())
+ if (i != g_aAdvSettings.end())
{
g_aAdvSettings.erase(i);
}
}
}
-void CommonOptionDlgProc(HWND hWnd,UINT msg,WPARAM wp,LPARAM lp,CCommonDlgProcData& rData)
+void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgProcData& rData)
{
- switch(msg)
+ switch (msg)
{
case WM_INITDIALOG:
- {
- assert(rData.m_pQuotesProvider);
-
- CQuotesProviderVisitorDbSettings visitor;
- rData.m_pQuotesProvider->Accept(visitor);
- assert(visitor.m_pszDbRefreshRateType);
- assert(visitor.m_pszDbRefreshRateValue);
- assert(visitor.m_pszDbDisplayNameFormat);
- assert(visitor.m_pszDbStatusMsgFormat);
- assert(visitor.m_pszDbTendencyFormat);
+ {
+ assert(rData.m_pQuotesProvider);
- // set contact list display format
- tstring sDspNameFrmt = Quotes_DBGetStringT(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbDisplayNameFormat,visitor.m_pszDefDisplayFormat);
- ::SetDlgItemText(hWnd,IDC_EDIT_CONTACT_LIST_FORMAT,sDspNameFrmt.c_str());
+ CQuotesProviderVisitorDbSettings visitor;
+ rData.m_pQuotesProvider->Accept(visitor);
+ assert(visitor.m_pszDbRefreshRateType);
+ assert(visitor.m_pszDbRefreshRateValue);
+ assert(visitor.m_pszDbDisplayNameFormat);
+ assert(visitor.m_pszDbStatusMsgFormat);
+ assert(visitor.m_pszDbTendencyFormat);
- // set status message display format
- tstring sStatusMsgFrmt = Quotes_DBGetStringT(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbStatusMsgFormat,visitor.m_pszDefStatusMsgFormat);
- ::SetDlgItemText(hWnd,IDC_EDIT_STATUS_MESSAGE_FORMAT,sStatusMsgFrmt.c_str());
+ // set contact list display format
+ tstring sDspNameFrmt = Quotes_DBGetStringT(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, visitor.m_pszDefDisplayFormat);
+ ::SetDlgItemText(hWnd, IDC_EDIT_CONTACT_LIST_FORMAT, sDspNameFrmt.c_str());
- // set tendency format
- tstring sTendencyFrmt = Quotes_DBGetStringT(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbTendencyFormat,visitor.m_pszDefTendencyFormat);
- ::SetDlgItemText(hWnd,IDC_EDIT_TENDENCY_FORMAT,sTendencyFrmt.c_str());
+ // set status message display format
+ tstring sStatusMsgFrmt = Quotes_DBGetStringT(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, visitor.m_pszDefStatusMsgFormat);
+ ::SetDlgItemText(hWnd, IDC_EDIT_STATUS_MESSAGE_FORMAT, sStatusMsgFrmt.c_str());
- // refresh rate
- HWND hwndCombo = ::GetDlgItem(hWnd,IDC_COMBO_REFRESH_RATE);
- LPCTSTR pszRefreshRateTypes[] = {TranslateT("Seconds"),TranslateT("Minutes"),TranslateT("Hours")};
- for(int i = 0;i < SIZEOF(pszRefreshRateTypes);++i)
- {
- ::SendMessage(hwndCombo,CB_ADDSTRING,0,reinterpret_cast<LPARAM>(pszRefreshRateTypes[i]));
- }
+ // set tendency format
+ tstring sTendencyFrmt = Quotes_DBGetStringT(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat);
+ ::SetDlgItemText(hWnd, IDC_EDIT_TENDENCY_FORMAT, sTendencyFrmt.c_str());
- int nRefreshRateType = db_get_w(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateType,RRT_MINUTES);
- if(nRefreshRateType < RRT_SECONDS || nRefreshRateType > RRT_HOURS)
+ // refresh rate
+ HWND hwndCombo = ::GetDlgItem(hWnd, IDC_COMBO_REFRESH_RATE);
+ LPCTSTR pszRefreshRateTypes[] = { TranslateT("Seconds"), TranslateT("Minutes"), TranslateT("Hours") };
+ for (int i = 0; i < SIZEOF(pszRefreshRateTypes); ++i)
+ {
+ ::SendMessage(hwndCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszRefreshRateTypes[i]));
+ }
+
+ int nRefreshRateType = db_get_w(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbRefreshRateType, RRT_MINUTES);
+ if (nRefreshRateType < RRT_SECONDS || nRefreshRateType > RRT_HOURS)
+ {
+ nRefreshRateType = RRT_MINUTES;
+ }
+
+ UINT nRate = db_get_w(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, 1);
+ switch (nRefreshRateType)
+ {
+ default:
+ case RRT_SECONDS:
+ case RRT_MINUTES:
+ if (nRate < 1 || nRate > 60)
{
- nRefreshRateType = RRT_MINUTES;
+ nRate = 1;
}
-
- UINT nRate = db_get_w(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateValue,1);
- switch(nRefreshRateType)
+ spin_set_range(::GetDlgItem(hWnd, IDC_SPIN_REFRESH_RATE), 1, 60);
+ break;
+ case RRT_HOURS:
+ if (nRate < 1 || nRate > 24)
{
- default:
- case RRT_SECONDS:
- case RRT_MINUTES:
- if(nRate < 1 || nRate > 60)
- {
- nRate = 1;
- }
- spin_set_range(::GetDlgItem(hWnd,IDC_SPIN_REFRESH_RATE),1,60);
- break;
- case RRT_HOURS:
- if(nRate < 1 || nRate > 24)
- {
- nRate = 1;
- }
- spin_set_range(::GetDlgItem(hWnd,IDC_SPIN_REFRESH_RATE),1,24);
- break;
+ nRate = 1;
}
-
- ::SendMessage(hwndCombo,CB_SETCURSEL,nRefreshRateType,0);
- ::SetDlgItemInt(hWnd,IDC_EDIT_REFRESH_RATE,nRate,FALSE);
-
- PropSheet_UnChanged(::GetParent(hWnd),hWnd);
+ spin_set_range(::GetDlgItem(hWnd, IDC_SPIN_REFRESH_RATE), 1, 24);
+ break;
}
- break;
+
+ ::SendMessage(hwndCombo, CB_SETCURSEL, nRefreshRateType, 0);
+ ::SetDlgItemInt(hWnd, IDC_EDIT_REFRESH_RATE, nRate, FALSE);
+
+ PropSheet_UnChanged(::GetParent(hWnd), hWnd);
+ }
+ break;
case WM_COMMAND:
- switch(HIWORD(wp))
+ switch (HIWORD(wp))
{
case CBN_SELCHANGE:
- if(IDC_COMBO_REFRESH_RATE == LOWORD(wp))
+ if (IDC_COMBO_REFRESH_RATE == LOWORD(wp))
{
- ERefreshRateType nType = static_cast<ERefreshRateType>(::SendMessage(reinterpret_cast<HWND>(lp),CB_GETCURSEL,0,0));
- switch(nType)
+ ERefreshRateType nType = static_cast<ERefreshRateType>(::SendMessage(reinterpret_cast<HWND>(lp), CB_GETCURSEL, 0, 0));
+ switch (nType)
{
default:
case RRT_SECONDS:
case RRT_MINUTES:
- spin_set_range(::GetDlgItem(hWnd,IDC_SPIN_REFRESH_RATE),1,60);
+ spin_set_range(::GetDlgItem(hWnd, IDC_SPIN_REFRESH_RATE), 1, 60);
break;
case RRT_HOURS:
+ {
+ spin_set_range(::GetDlgItem(hWnd, IDC_SPIN_REFRESH_RATE), 1, 24);
+ BOOL bOk = FALSE;
+ UINT nRefreshRate = ::GetDlgItemInt(hWnd, IDC_EDIT_REFRESH_RATE, &bOk, FALSE);
+ if (TRUE == bOk && nRefreshRate > 24)
{
- spin_set_range(::GetDlgItem(hWnd,IDC_SPIN_REFRESH_RATE),1,24);
- BOOL bOk = FALSE;
- UINT nRefreshRate = ::GetDlgItemInt(hWnd,IDC_EDIT_REFRESH_RATE,&bOk,FALSE);
- if(TRUE == bOk && nRefreshRate > 24)
- {
- ::SetDlgItemInt(hWnd,IDC_EDIT_REFRESH_RATE,24,FALSE);
- }
+ ::SetDlgItemInt(hWnd, IDC_EDIT_REFRESH_RATE, 24, FALSE);
}
- break;
+ }
+ break;
}
- PropSheet_Changed(::GetParent(hWnd),hWnd);
+ PropSheet_Changed(::GetParent(hWnd), hWnd);
}
break;
case EN_CHANGE:
- switch(LOWORD(wp))
+ switch (LOWORD(wp))
{
case IDC_EDIT_REFRESH_RATE:
case IDC_EDIT_CONTACT_LIST_FORMAT:
case IDC_EDIT_STATUS_MESSAGE_FORMAT:
case IDC_EDIT_TENDENCY_FORMAT:
- if(reinterpret_cast<HWND>(lp) == ::GetFocus())
+ if (reinterpret_cast<HWND>(lp) == ::GetFocus())
{
- PropSheet_Changed(::GetParent(hWnd),hWnd);
+ PropSheet_Changed(::GetParent(hWnd), hWnd);
}
break;
}
break;
case BN_CLICKED:
- switch( LOWORD(wp))
+ switch (LOWORD(wp))
{
case IDC_BUTTON_DESCRIPTION:
- show_variable_list(hWnd,rData.m_pQuotesProvider);
+ show_variable_list(hWnd, rData.m_pQuotesProvider);
break;
case IDC_BUTTON_ADVANCED_SETTINGS:
+ {
+ CAdvProviderSettings* pAdvSet = get_adv_settings(rData.m_pQuotesProvider, true);
+ assert(pAdvSet);
+ if (true == ShowSettingsDlg(hWnd, pAdvSet))
{
- CAdvProviderSettings* pAdvSet = get_adv_settings(rData.m_pQuotesProvider,true);
- assert(pAdvSet);
- if(true == ShowSettingsDlg(hWnd,pAdvSet))
- {
- PropSheet_Changed(::GetParent(hWnd),hWnd);
- }
+ PropSheet_Changed(::GetParent(hWnd), hWnd);
}
- break;
+ }
+ break;
}
break;
}
break;
case WM_NOTIFY:
+ {
+ LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lp);
+ switch (pNMHDR->code)
{
- LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lp);
- switch(pNMHDR->code)
+ case PSN_KILLACTIVE:
+ {
+ BOOL bOk = FALSE;
+ UINT nRefreshRate = ::GetDlgItemInt(hWnd, IDC_EDIT_REFRESH_RATE, &bOk, FALSE);
+ ERefreshRateType nType = static_cast<ERefreshRateType>(::SendDlgItemMessage(hWnd, IDC_COMBO_REFRESH_RATE, CB_GETCURSEL, 0, 0));
+ switch (nType)
{
- case PSN_KILLACTIVE:
+ default:
+ case RRT_MINUTES:
+ case RRT_SECONDS:
+ if (FALSE == bOk || nRefreshRate < 1 || nRefreshRate > 60)
{
- BOOL bOk = FALSE;
- UINT nRefreshRate = ::GetDlgItemInt(hWnd,IDC_EDIT_REFRESH_RATE,&bOk,FALSE);
- ERefreshRateType nType = static_cast<ERefreshRateType>(::SendDlgItemMessage(hWnd, IDC_COMBO_REFRESH_RATE, CB_GETCURSEL, 0, 0));
- switch(nType)
- {
- default:
- case RRT_MINUTES:
- case RRT_SECONDS:
- if(FALSE == bOk || nRefreshRate < 1 || nRefreshRate > 60)
- {
- prepare_edit_ctrl_for_error(::GetDlgItem(hWnd,IDC_EDIT_REFRESH_RATE));
- Quotes_MessageBox(hWnd,TranslateT("Enter integer value between 1 and 60."),MB_OK|MB_ICONERROR);
- bOk = FALSE;
- }
- break;
- case RRT_HOURS:
- if(FALSE == bOk || nRefreshRate < 1 || nRefreshRate > 24)
- {
- prepare_edit_ctrl_for_error(::GetDlgItem(hWnd,IDC_EDIT_REFRESH_RATE));
- Quotes_MessageBox(hWnd,TranslateT("Enter integer value between 1 and 24."),MB_OK|MB_ICONERROR);
- bOk = FALSE;
- }
- break;
- }
-
- if(TRUE == bOk)
- {
- HWND hEdit = ::GetDlgItem(hWnd,IDC_EDIT_CONTACT_LIST_FORMAT);
- assert(IsWindow(hEdit));
-
- tstring s = get_window_text(hEdit);
- if(true == s.empty())
- {
- prepare_edit_ctrl_for_error(hEdit);
- Quotes_MessageBox(hWnd,TranslateT("Enter text to display in contact list."),MB_OK|MB_ICONERROR);
- bOk = FALSE;
- }
- }
-
- ::SetWindowLongPtr(hWnd,DWLP_MSGRESULT,(TRUE == bOk) ? FALSE : TRUE);
+ prepare_edit_ctrl_for_error(::GetDlgItem(hWnd, IDC_EDIT_REFRESH_RATE));
+ Quotes_MessageBox(hWnd, TranslateT("Enter integer value between 1 and 60."), MB_OK | MB_ICONERROR);
+ bOk = FALSE;
}
break;
- case PSN_APPLY:
+ case RRT_HOURS:
+ if (FALSE == bOk || nRefreshRate < 1 || nRefreshRate > 24)
{
- BOOL bOk = FALSE;
- UINT nRefreshRate = ::GetDlgItemInt(hWnd,IDC_EDIT_REFRESH_RATE,&bOk,FALSE);
- assert(TRUE == bOk);
- ERefreshRateType nType = static_cast<ERefreshRateType>(::SendDlgItemMessage(hWnd, IDC_COMBO_REFRESH_RATE, CB_GETCURSEL, 0, 0));
+ prepare_edit_ctrl_for_error(::GetDlgItem(hWnd, IDC_EDIT_REFRESH_RATE));
+ Quotes_MessageBox(hWnd, TranslateT("Enter integer value between 1 and 24."), MB_OK | MB_ICONERROR);
+ bOk = FALSE;
+ }
+ break;
+ }
+
+ if (TRUE == bOk)
+ {
+ HWND hEdit = ::GetDlgItem(hWnd, IDC_EDIT_CONTACT_LIST_FORMAT);
+ assert(IsWindow(hEdit));
- assert(rData.m_pQuotesProvider);
+ tstring s = get_window_text(hEdit);
+ if (true == s.empty())
+ {
+ prepare_edit_ctrl_for_error(hEdit);
+ Quotes_MessageBox(hWnd, TranslateT("Enter text to display in contact list."), MB_OK | MB_ICONERROR);
+ bOk = FALSE;
+ }
+ }
- CQuotesProviderVisitorDbSettings visitor;
- rData.m_pQuotesProvider->Accept(visitor);
- assert(visitor.m_pszDbRefreshRateType);
- assert(visitor.m_pszDbRefreshRateValue);
- assert(visitor.m_pszDbDisplayNameFormat);
- assert(visitor.m_pszDbStatusMsgFormat);
+ ::SetWindowLongPtr(hWnd, DWLP_MSGRESULT, (TRUE == bOk) ? FALSE : TRUE);
+ }
+ break;
+ case PSN_APPLY:
+ {
+ BOOL bOk = FALSE;
+ UINT nRefreshRate = ::GetDlgItemInt(hWnd, IDC_EDIT_REFRESH_RATE, &bOk, FALSE);
+ assert(TRUE == bOk);
+ ERefreshRateType nType = static_cast<ERefreshRateType>(::SendDlgItemMessage(hWnd, IDC_COMBO_REFRESH_RATE, CB_GETCURSEL, 0, 0));
+
+ assert(rData.m_pQuotesProvider);
+
+ CQuotesProviderVisitorDbSettings visitor;
+ rData.m_pQuotesProvider->Accept(visitor);
+ assert(visitor.m_pszDbRefreshRateType);
+ assert(visitor.m_pszDbRefreshRateValue);
+ assert(visitor.m_pszDbDisplayNameFormat);
+ assert(visitor.m_pszDbStatusMsgFormat);
- rData.m_bFireSetingsChangedEvent = true;
- db_set_w(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateType,nType);
- db_set_w(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateValue,nRefreshRate);
+ rData.m_bFireSetingsChangedEvent = true;
+ db_set_w(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbRefreshRateType, nType);
+ db_set_w(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, nRefreshRate);
- tstring s = get_window_text(::GetDlgItem(hWnd,IDC_EDIT_CONTACT_LIST_FORMAT));
- db_set_ts(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbDisplayNameFormat,s.c_str());
+ tstring s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_CONTACT_LIST_FORMAT));
+ db_set_ts(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, s.c_str());
- s = get_window_text(::GetDlgItem(hWnd,IDC_EDIT_STATUS_MESSAGE_FORMAT));
- db_set_ts(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbStatusMsgFormat,s.c_str());
+ s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_STATUS_MESSAGE_FORMAT));
+ db_set_ts(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, s.c_str());
- s = get_window_text(::GetDlgItem(hWnd,IDC_EDIT_TENDENCY_FORMAT));
- db_set_ts(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbTendencyFormat,s.c_str());
+ s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_TENDENCY_FORMAT));
+ db_set_ts(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbTendencyFormat, s.c_str());
- CAdvProviderSettings* pAdvSet = get_adv_settings(rData.m_pQuotesProvider,false);
- if(pAdvSet)
- {
- pAdvSet->SaveToDb();
- }
- }
- break;
+ CAdvProviderSettings* pAdvSet = get_adv_settings(rData.m_pQuotesProvider, false);
+ if (pAdvSet)
+ {
+ pAdvSet->SaveToDb();
}
}
break;
+ }
+ }
+ break;
case WM_DESTROY:
remove_adv_settings(rData.m_pQuotesProvider);
break;
diff --git a/plugins/Quotes/src/CommonOptionDlg.h b/plugins/Quotes/src/CommonOptionDlg.h index b9f696362a..42366b70b9 100644 --- a/plugins/Quotes/src/CommonOptionDlg.h +++ b/plugins/Quotes/src/CommonOptionDlg.h @@ -5,13 +5,13 @@ class CQuotesProviderBase; struct CCommonDlgProcData
{
- CCommonDlgProcData(const CQuotesProviderBase* pQuotesProvider)
- : m_pQuotesProvider(pQuotesProvider),m_bFireSetingsChangedEvent(false){}
+ CCommonDlgProcData(const CQuotesProviderBase* pQuotesProvider)
+ : m_pQuotesProvider(pQuotesProvider), m_bFireSetingsChangedEvent(false){}
const CQuotesProviderBase* m_pQuotesProvider;
bool m_bFireSetingsChangedEvent;
};
-void CommonOptionDlgProc(HWND hWnd,UINT msg,WPARAM wp,LPARAM lp,CCommonDlgProcData& rData);
+void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgProcData& rData);
#endif//__c85fe710_f71b_4a58_9d44_3e39f6209c5f_CommonOptionDlg_h__
diff --git a/plugins/Quotes/src/CreateFilePath.cpp b/plugins/Quotes/src/CreateFilePath.cpp index b2472f5978..5f1ea74ef7 100644 --- a/plugins/Quotes/src/CreateFilePath.cpp +++ b/plugins/Quotes/src/CreateFilePath.cpp @@ -4,10 +4,10 @@ namespace {
TCHAR replace_invalid_symbol(TCHAR chr)
{
- TCHAR InvaliSymbols[] = {_T('\\'),_T('/'),_T(':'),_T('*'),_T('?'),_T('"'),_T('<'),_T('>'),_T('|')};
- for(int i = 0; i < sizeof(InvaliSymbols)/sizeof(InvaliSymbols[0]);++i)
+ TCHAR InvaliSymbols[] = { _T('\\'), _T('/'), _T(':'), _T('*'), _T('?'), _T('"'), _T('<'), _T('>'), _T('|') };
+ for (int i = 0; i < sizeof(InvaliSymbols) / sizeof(InvaliSymbols[0]); ++i)
{
- if(chr == InvaliSymbols[i])
+ if (chr == InvaliSymbols[i])
{
return _T('_');
}
@@ -18,17 +18,17 @@ namespace void prepare_name(tstring& rsName)
{
- std::transform(rsName.begin(),rsName.end(),rsName.begin(),boost::bind(replace_invalid_symbol,_1));
+ std::transform(rsName.begin(), rsName.end(), rsName.begin(), boost::bind(replace_invalid_symbol, _1));
}
}
tstring CreateFilePath(const tstring& rsName)
{
TCHAR szPath[_MAX_PATH];
- ::GetModuleFileName(g_hInstance,szPath,_MAX_PATH);
+ ::GetModuleFileName(g_hInstance, szPath, _MAX_PATH);
- TCHAR* p = _tcsrchr(szPath,_T('\\'));
- if(p)
+ TCHAR* p = _tcsrchr(szPath, _T('\\'));
+ if (p)
{
*p = 0;
}
diff --git a/plugins/Quotes/src/CurrencyConverter.cpp b/plugins/Quotes/src/CurrencyConverter.cpp index 476617dd10..5e5de39f81 100644 --- a/plugins/Quotes/src/CurrencyConverter.cpp +++ b/plugins/Quotes/src/CurrencyConverter.cpp @@ -12,11 +12,11 @@ namespace {
CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
const CQuotesProviders::TQuotesProviders& rapQuotesProviders = pProviders->GetProviders();
- for(CQuotesProviders::TQuotesProviders::const_iterator i = rapQuotesProviders.begin();i != rapQuotesProviders.end();++i)
+ for (CQuotesProviders::TQuotesProviders::const_iterator i = rapQuotesProviders.begin(); i != rapQuotesProviders.end(); ++i)
{
const CQuotesProviders::TQuotesProviderPtr& pProvider = *i;
CQuotesProviderGoogle* pGoogle = dynamic_cast<CQuotesProviderGoogle*>(pProvider.get());
- if(pGoogle)
+ if (pGoogle)
{
return pGoogle;
}
@@ -29,15 +29,15 @@ namespace CQuotesProviderGoogle::CQuoteSection get_quotes(const CQuotesProviderGoogle* pProvider = NULL)
{
- if(NULL == pProvider)
+ if (NULL == pProvider)
{
pProvider = get_google_provider();
}
- if(pProvider)
+ if (pProvider)
{
const CQuotesProviderGoogle::CQuoteSection& rQuotes = pProvider->GetQuotes();
- if(rQuotes.GetSectionCount() > 0)
+ if (rQuotes.GetSectionCount() > 0)
{
return rQuotes.GetSection(0);
}
@@ -56,21 +56,21 @@ namespace {
int nFrom = static_cast<int>(::SendDlgItemMessage(hDlg, IDC_COMBO_CONVERT_FROM, CB_GETCURSEL, 0, 0));
int nTo = static_cast<int>(::SendDlgItemMessage(hDlg, IDC_COMBO_CONVERT_INTO, CB_GETCURSEL, 0, 0));
- bool bEnableButton = ((CB_ERR != nFrom)
- && (CB_ERR != nTo)
+ bool bEnableButton = ((CB_ERR != nFrom)
+ && (CB_ERR != nTo)
&& (nFrom != nTo)
- && (GetWindowTextLength(GetDlgItem(hDlg,IDC_EDIT_VALUE)) > 0));
- EnableWindow(GetDlgItem(hDlg,IDC_BUTTON_CONVERT),bEnableButton);
+ && (GetWindowTextLength(GetDlgItem(hDlg, IDC_EDIT_VALUE)) > 0));
+ EnableWindow(GetDlgItem(hDlg, IDC_BUTTON_CONVERT), bEnableButton);
}
inline void update_swap_button(HWND hDlg)
{
int nFrom = static_cast<int>(::SendDlgItemMessage(hDlg, IDC_COMBO_CONVERT_FROM, CB_GETCURSEL, 0, 0));
int nTo = static_cast<int>(::SendDlgItemMessage(hDlg, IDC_COMBO_CONVERT_INTO, CB_GETCURSEL, 0, 0));
- bool bEnableButton = ((CB_ERR != nFrom)
- && (CB_ERR != nTo)
+ bool bEnableButton = ((CB_ERR != nFrom)
+ && (CB_ERR != nTo)
&& (nFrom != nTo));
- EnableWindow(GetDlgItem(hDlg,IDC_BUTTON_SWAP),bEnableButton);
+ EnableWindow(GetDlgItem(hDlg, IDC_BUTTON_SWAP), bEnableButton);
}
inline tstring double2str(double dValue)
@@ -81,7 +81,7 @@ namespace return output.str();
}
- inline bool str2double(const tstring& s,double& d)
+ inline bool str2double(const tstring& s, double& d)
{
tistringstream input(s);
input.imbue(GetSystemLocale());
@@ -90,201 +90,201 @@ namespace }
- INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg,UINT msg,WPARAM wp,LPARAM lp)
+ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
{
- switch(msg)
+ switch (msg)
{
case WM_INITDIALOG:
- {
- HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX,false);
- assert(hWL);
- WindowList_Add(hWL,hDlg,NULL);
+ {
+ HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX, false);
+ assert(hWL);
+ WindowList_Add(hWL, hDlg, NULL);
- TranslateDialogDefault(hDlg);
+ TranslateDialogDefault(hDlg);
- ::SendMessage(hDlg,WM_SETICON,FALSE,reinterpret_cast<LPARAM>(Quotes_LoadIconEx(ICON_STR_CURRENCY_CONVERTER)));
- ::SendMessage(hDlg,WM_SETICON,TRUE,reinterpret_cast<LPARAM>(Quotes_LoadIconEx(ICON_STR_CURRENCY_CONVERTER,true)));
+ ::SendMessage(hDlg, WM_SETICON, FALSE, reinterpret_cast<LPARAM>(Quotes_LoadIconEx(ICON_STR_CURRENCY_CONVERTER)));
+ ::SendMessage(hDlg, WM_SETICON, TRUE, reinterpret_cast<LPARAM>(Quotes_LoadIconEx(ICON_STR_CURRENCY_CONVERTER, true)));
- HWND hcbxFrom = ::GetDlgItem(hDlg,IDC_COMBO_CONVERT_FROM);
- HWND hcbxTo = ::GetDlgItem(hDlg,IDC_COMBO_CONVERT_INTO);
+ HWND hcbxFrom = ::GetDlgItem(hDlg, IDC_COMBO_CONVERT_FROM);
+ HWND hcbxTo = ::GetDlgItem(hDlg, IDC_COMBO_CONVERT_INTO);
- tstring sFromQuoteID = Quotes_DBGetStringT(NULL,QUOTES_MODULE_NAME,DB_STR_CC_QUOTE_FROM_ID);
- tstring sToQuoteID = Quotes_DBGetStringT(NULL,QUOTES_MODULE_NAME,DB_STR_CC_QUOTE_TO_ID);
+ tstring sFromQuoteID = Quotes_DBGetStringT(NULL, QUOTES_MODULE_NAME, DB_STR_CC_QUOTE_FROM_ID);
+ tstring sToQuoteID = Quotes_DBGetStringT(NULL, QUOTES_MODULE_NAME, DB_STR_CC_QUOTE_TO_ID);
- const CQuotesProviderGoogle* pProvider = get_google_provider();
- const CQuotesProviderGoogle::CQuoteSection& rSection = get_quotes(pProvider);
- size_t cQuotes = rSection.GetQuoteCount();
- for(size_t i = 0;i < cQuotes;++i)
- {
- const CQuotesProviderGoogle::CQuote& rQuote = rSection.GetQuote(i);
- tstring sName = make_quote_name(rQuote);
- LPCTSTR pszName = sName.c_str();
- LRESULT nFrom = ::SendMessage(hcbxFrom,CB_ADDSTRING,0,reinterpret_cast<LPARAM>(pszName));
- LRESULT nTo = ::SendMessage(hcbxTo,CB_ADDSTRING,0,reinterpret_cast<LPARAM>(pszName));
+ const CQuotesProviderGoogle* pProvider = get_google_provider();
+ const CQuotesProviderGoogle::CQuoteSection& rSection = get_quotes(pProvider);
+ size_t cQuotes = rSection.GetQuoteCount();
+ for (size_t i = 0; i < cQuotes; ++i)
+ {
+ const CQuotesProviderGoogle::CQuote& rQuote = rSection.GetQuote(i);
+ tstring sName = make_quote_name(rQuote);
+ LPCTSTR pszName = sName.c_str();
+ LRESULT nFrom = ::SendMessage(hcbxFrom, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszName));
+ LRESULT nTo = ::SendMessage(hcbxTo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszName));
- if(0 == quotes_stricmp(rQuote.GetID().c_str(),sFromQuoteID.c_str()))
- {
- ::SendMessage(hcbxFrom,CB_SETCURSEL,nFrom,0);
- }
+ if (0 == quotes_stricmp(rQuote.GetID().c_str(), sFromQuoteID.c_str()))
+ {
+ ::SendMessage(hcbxFrom, CB_SETCURSEL, nFrom, 0);
+ }
- if(0 == quotes_stricmp(rQuote.GetID().c_str(),sToQuoteID.c_str()))
- {
- ::SendMessage(hcbxTo,CB_SETCURSEL,nTo,0);
- }
+ if (0 == quotes_stricmp(rQuote.GetID().c_str(), sToQuoteID.c_str()))
+ {
+ ::SendMessage(hcbxTo, CB_SETCURSEL, nTo, 0);
}
+ }
- double dAmount = 1.0;
- Quotes_DBReadDouble(NULL,QUOTES_MODULE_NAME,DB_STR_CC_AMOUNT,dAmount);
- ::SetDlgItemText(hDlg,IDC_EDIT_VALUE,double2str(dAmount).c_str());
+ double dAmount = 1.0;
+ Quotes_DBReadDouble(NULL, QUOTES_MODULE_NAME, DB_STR_CC_AMOUNT, dAmount);
+ ::SetDlgItemText(hDlg, IDC_EDIT_VALUE, double2str(dAmount).c_str());
- const IQuotesProvider::CProviderInfo& pi = pProvider->GetInfo();
- tostringstream o;
- o << TranslateT("Info provided by") << _T(" <a href=\"") << pi.m_sURL << _T("\">") << pi.m_sName << _T("</a>");
+ const IQuotesProvider::CProviderInfo& pi = pProvider->GetInfo();
+ tostringstream o;
+ o << TranslateT("Info provided by") << _T(" <a href=\"") << pi.m_sURL << _T("\">") << pi.m_sName << _T("</a>");
- ::SetDlgItemText(hDlg,IDC_SYSLINK_PROVIDER,o.str().c_str());
+ ::SetDlgItemText(hDlg, IDC_SYSLINK_PROVIDER, o.str().c_str());
- ::SendDlgItemMessage(hDlg, IDC_BUTTON_SWAP, BM_SETIMAGE, IMAGE_ICON,
- reinterpret_cast<LPARAM>(Quotes_LoadIconEx(ICON_STR_SWAP)));
-
- update_convert_button(hDlg);
- update_swap_button(hDlg);
+ ::SendDlgItemMessage(hDlg, IDC_BUTTON_SWAP, BM_SETIMAGE, IMAGE_ICON,
+ reinterpret_cast<LPARAM>(Quotes_LoadIconEx(ICON_STR_SWAP)));
- Utils_RestoreWindowPositionNoSize(hDlg,NULL,QUOTES_PROTOCOL_NAME,WINDOW_PREFIX);
- ::ShowWindow(hDlg,SW_SHOW);
- }
- return (TRUE);
+ update_convert_button(hDlg);
+ update_swap_button(hDlg);
+
+ Utils_RestoreWindowPositionNoSize(hDlg, NULL, QUOTES_PROTOCOL_NAME, WINDOW_PREFIX);
+ ::ShowWindow(hDlg, SW_SHOW);
+ }
+ return (TRUE);
case WM_CLOSE:
- {
- HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX,false);
- assert(hWL);
- WindowList_Remove(hWL,hDlg);
- Utils_SaveWindowPosition(hDlg,NULL,QUOTES_PROTOCOL_NAME,WINDOW_PREFIX);
- EndDialog(hDlg,0);
- }
- return (TRUE);
+ {
+ HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX, false);
+ assert(hWL);
+ WindowList_Remove(hWL, hDlg);
+ Utils_SaveWindowPosition(hDlg, NULL, QUOTES_PROTOCOL_NAME, WINDOW_PREFIX);
+ EndDialog(hDlg, 0);
+ }
+ return (TRUE);
case WM_COMMAND:
- switch(LOWORD(wp))
+ switch (LOWORD(wp))
{
case IDC_COMBO_CONVERT_FROM:
case IDC_COMBO_CONVERT_INTO:
- if(CBN_SELCHANGE == HIWORD(wp))
+ if (CBN_SELCHANGE == HIWORD(wp))
{
update_convert_button(hDlg);
update_swap_button(hDlg);
}
return TRUE;
case IDC_EDIT_VALUE:
- if(EN_CHANGE == HIWORD(wp))
+ if (EN_CHANGE == HIWORD(wp))
{
update_convert_button(hDlg);
}
return TRUE;
case IDCANCEL:
- {
- SendMessage(hDlg, WM_CLOSE, 0, 0);
- }
- return (TRUE);
+ {
+ SendMessage(hDlg, WM_CLOSE, 0, 0);
+ }
+ return (TRUE);
case IDC_BUTTON_SWAP:
- {
- HWND wndFrom = ::GetDlgItem(hDlg,IDC_COMBO_CONVERT_FROM);
- HWND wndTo = ::GetDlgItem(hDlg,IDC_COMBO_CONVERT_INTO);
- WPARAM nFrom = ::SendMessage(wndFrom,CB_GETCURSEL,0,0);
- WPARAM nTo = ::SendMessage(wndTo,CB_GETCURSEL,0,0);
+ {
+ HWND wndFrom = ::GetDlgItem(hDlg, IDC_COMBO_CONVERT_FROM);
+ HWND wndTo = ::GetDlgItem(hDlg, IDC_COMBO_CONVERT_INTO);
+ WPARAM nFrom = ::SendMessage(wndFrom, CB_GETCURSEL, 0, 0);
+ WPARAM nTo = ::SendMessage(wndTo, CB_GETCURSEL, 0, 0);
- ::SendMessage(wndFrom,CB_SETCURSEL,nTo,0);
- ::SendMessage(wndTo,CB_SETCURSEL,nFrom,0);
- }
- return (TRUE);
+ ::SendMessage(wndFrom, CB_SETCURSEL, nTo, 0);
+ ::SendMessage(wndTo, CB_SETCURSEL, nFrom, 0);
+ }
+ return (TRUE);
case IDC_BUTTON_CONVERT:
- {
- HWND hwndAmount = GetDlgItem(hDlg,IDC_EDIT_VALUE);
- tstring sText = get_window_text(hwndAmount);
+ {
+ HWND hwndAmount = GetDlgItem(hDlg, IDC_EDIT_VALUE);
+ tstring sText = get_window_text(hwndAmount);
- double dAmount = 1.0;
- if ((true == str2double(sText,dAmount)) && (dAmount > 0.0))
- {
- Quotes_DBWriteDouble(NULL,QUOTES_MODULE_NAME,DB_STR_CC_AMOUNT,dAmount);
+ double dAmount = 1.0;
+ if ((true == str2double(sText, dAmount)) && (dAmount > 0.0))
+ {
+ Quotes_DBWriteDouble(NULL, QUOTES_MODULE_NAME, DB_STR_CC_AMOUNT, dAmount);
- size_t nFrom = static_cast<size_t>(::SendDlgItemMessage(hDlg, IDC_COMBO_CONVERT_FROM, CB_GETCURSEL, 0, 0));
- size_t nTo = static_cast<size_t>(::SendDlgItemMessage(hDlg, IDC_COMBO_CONVERT_INTO, CB_GETCURSEL, 0, 0));
- if ((CB_ERR != nFrom) && (CB_ERR != nTo) && (nFrom != nTo))
+ size_t nFrom = static_cast<size_t>(::SendDlgItemMessage(hDlg, IDC_COMBO_CONVERT_FROM, CB_GETCURSEL, 0, 0));
+ size_t nTo = static_cast<size_t>(::SendDlgItemMessage(hDlg, IDC_COMBO_CONVERT_INTO, CB_GETCURSEL, 0, 0));
+ if ((CB_ERR != nFrom) && (CB_ERR != nTo) && (nFrom != nTo))
+ {
+ const CQuotesProviderGoogle::CQuoteSection& rSection = get_quotes();
+ size_t cQuotes = rSection.GetQuoteCount();
+ if ((nFrom < cQuotes) && (nTo < cQuotes))
{
- const CQuotesProviderGoogle::CQuoteSection& rSection = get_quotes();
- size_t cQuotes = rSection.GetQuoteCount();
- if ((nFrom < cQuotes) && (nTo < cQuotes))
- {
- CQuotesProviderGoogle::CRateInfo ri;
- CQuotesProviderGoogle::CQuote from = rSection.GetQuote(nFrom);
- CQuotesProviderGoogle::CQuote to = rSection.GetQuote(nTo);
+ CQuotesProviderGoogle::CRateInfo ri;
+ CQuotesProviderGoogle::CQuote from = rSection.GetQuote(nFrom);
+ CQuotesProviderGoogle::CQuote to = rSection.GetQuote(nTo);
- db_set_ts(NULL,QUOTES_MODULE_NAME,DB_STR_CC_QUOTE_FROM_ID,from.GetID().c_str());
- db_set_ts(NULL,QUOTES_MODULE_NAME,DB_STR_CC_QUOTE_TO_ID,to.GetID().c_str());
+ db_set_ts(NULL, QUOTES_MODULE_NAME, DB_STR_CC_QUOTE_FROM_ID, from.GetID().c_str());
+ db_set_ts(NULL, QUOTES_MODULE_NAME, DB_STR_CC_QUOTE_TO_ID, to.GetID().c_str());
+
+ const CQuotesProviderGoogle* pProvider = get_google_provider();
+ assert(pProvider);
+ if (pProvider)
+ {
+ tstring sResult;
+ std::string sError;
+ try
+ {
+ double dResult = pProvider->Convert(dAmount, from, to);
+ tostringstream ss;
+ ss.imbue(GetSystemLocale());
+ ss << std::fixed << std::setprecision(2) << dAmount << " " << from.GetName() << " = " << dResult << " " << to.GetName();
+ sResult = ss.str();
+ }
+ catch (std::exception& e)
+ {
+ sError = e.what();
+ //Quotes_MessageBox(hDlg,sResult.c_str());
+ }
- const CQuotesProviderGoogle* pProvider = get_google_provider();
- assert(pProvider);
- if(pProvider)
+ if (false == sError.empty())
{
- tstring sResult;
- std::string sError;
- try
- {
- double dResult = pProvider->Convert(dAmount,from,to);
- tostringstream ss;
- ss.imbue(GetSystemLocale());
- ss << std::fixed << std::setprecision(2) << dAmount << " " << from.GetName() << " = " << dResult << " " << to.GetName();
- sResult = ss.str();
- }
- catch(std::exception& e)
- {
- sError = e.what();
- //Quotes_MessageBox(hDlg,sResult.c_str());
- }
-
- if(false == sError.empty())
- {
- //USES_CONVERSION;
- sResult = quotes_a2t(sError.c_str());//A2T(sError.c_str());
- }
-
- SetDlgItemText(hDlg,IDC_EDIT_RESULT,sResult.c_str());
+ //USES_CONVERSION;
+ sResult = quotes_a2t(sError.c_str());//A2T(sError.c_str());
}
+
+ SetDlgItemText(hDlg, IDC_EDIT_RESULT, sResult.c_str());
}
}
}
- else
- {
- Quotes_MessageBox(hDlg,TranslateT("Enter positive number."),MB_OK|MB_ICONERROR);
- prepare_edit_ctrl_for_error(GetDlgItem(hDlg,IDC_EDIT_VALUE));
- }
- }
- return (TRUE);
+ }
+ else
+ {
+ Quotes_MessageBox(hDlg, TranslateT("Enter positive number."), MB_OK | MB_ICONERROR);
+ prepare_edit_ctrl_for_error(GetDlgItem(hDlg, IDC_EDIT_VALUE));
+ }
+ }
+ return (TRUE);
}
return (FALSE);
case WM_NOTIFY:
+ {
+ LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lp);
+ switch (pNMHDR->code)
{
- LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lp);
- switch(pNMHDR->code)
+ case NM_CLICK:
+ if (IDC_SYSLINK_PROVIDER == wp)
{
- case NM_CLICK:
- if(IDC_SYSLINK_PROVIDER == wp)
- {
- PNMLINK pNMLink = reinterpret_cast<PNMLINK>(pNMHDR);
- ::ShellExecute(hDlg,_T("open"),pNMLink->item.szUrl,NULL,NULL,SW_SHOWNORMAL);
- }
- break;
+ PNMLINK pNMLink = reinterpret_cast<PNMLINK>(pNMHDR);
+ ::ShellExecute(hDlg, _T("open"), pNMLink->item.szUrl, NULL, NULL, SW_SHOWNORMAL);
}
+ break;
}
- break;
+ }
+ break;
}
return (FALSE);
}
}
-INT_PTR QuotesMenu_CurrencyConverter(WPARAM wp,LPARAM lp)
+INT_PTR QuotesMenu_CurrencyConverter(WPARAM, LPARAM)
{
- HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX,true);
- HWND hWnd = WindowList_Find(hWL,NULL);
- if(NULL != hWnd)
+ HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX, true);
+ HWND hWnd = WindowList_Find(hWL, NULL);
+ if (NULL != hWnd)
{
SetForegroundWindow(hWnd);
SetFocus(hWnd);
diff --git a/plugins/Quotes/src/CurrencyConverter.h b/plugins/Quotes/src/CurrencyConverter.h index 9af7c6bca1..c700fa5b22 100644 --- a/plugins/Quotes/src/CurrencyConverter.h +++ b/plugins/Quotes/src/CurrencyConverter.h @@ -1,6 +1,6 @@ #ifndef __4FB6320B_2D02_408b_BAF5_426C185AAA11_CurrencyConverter_h__
#define __4FB6320B_2D02_408b_BAF5_426C185AAA11_CurrencyConverter_h__
-INT_PTR QuotesMenu_CurrencyConverter(WPARAM wp,LPARAM lp);
+INT_PTR QuotesMenu_CurrencyConverter(WPARAM wp, LPARAM lp);
#endif //__4FB6320B_2D02_408b_BAF5_426C185AAA11_CurrencyConverter_h__
diff --git a/plugins/Quotes/src/DBUtils.cpp b/plugins/Quotes/src/DBUtils.cpp index 1636419ac9..e2d9f5f15e 100644 --- a/plugins/Quotes/src/DBUtils.cpp +++ b/plugins/Quotes/src/DBUtils.cpp @@ -1,15 +1,15 @@ #include "StdAfx.h"
-std::string Quotes_DBGetStringA(MCONTACT hContact,const char* szModule,const char* szSetting,const char* pszDefValue /*= NULL*/)
+std::string Quotes_DBGetStringA(MCONTACT hContact, const char* szModule, const char* szSetting, const char* pszDefValue /*= NULL*/)
{
std::string sResult;
- char* pszSymbol = db_get_sa(hContact,szModule,szSetting);
- if(NULL != pszSymbol)
+ char* pszSymbol = db_get_sa(hContact, szModule, szSetting);
+ if (NULL != pszSymbol)
{
sResult = pszSymbol;
mir_free(pszSymbol);
}
- else if(NULL != pszDefValue)
+ else if (NULL != pszDefValue)
{
sResult = pszDefValue;
}
@@ -17,16 +17,16 @@ std::string Quotes_DBGetStringA(MCONTACT hContact,const char* szModule,const cha return sResult;
}
-std::wstring Quotes_DBGetStringW(MCONTACT hContact,const char* szModule,const char* szSetting,const wchar_t* pszDefValue/* = NULL*/)
+std::wstring Quotes_DBGetStringW(MCONTACT hContact, const char* szModule, const char* szSetting, const wchar_t* pszDefValue/* = NULL*/)
{
std::wstring sResult;
- wchar_t* pszSymbol = db_get_wsa(hContact,szModule,szSetting);
- if(NULL != pszSymbol)
+ wchar_t* pszSymbol = db_get_wsa(hContact, szModule, szSetting);
+ if (NULL != pszSymbol)
{
sResult = pszSymbol;
mir_free(pszSymbol);
}
- else if(NULL != pszDefValue)
+ else if (NULL != pszDefValue)
{
sResult = pszDefValue;
}
@@ -34,18 +34,18 @@ std::wstring Quotes_DBGetStringW(MCONTACT hContact,const char* szModule,const ch return sResult;
}
-bool Quotes_DBWriteDouble(MCONTACT hContact,const char* szModule,const char* szSetting,double dValue)
+bool Quotes_DBWriteDouble(MCONTACT hContact, const char* szModule, const char* szSetting, double dValue)
{
return 0 == db_set_blob(hContact, szModule, szSetting, &dValue, sizeof(dValue));
}
-bool Quotes_DBReadDouble(MCONTACT hContact,const char* szModule,const char* szSetting,double& rdValue)
+bool Quotes_DBReadDouble(MCONTACT hContact, const char* szModule, const char* szSetting, double& rdValue)
{
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
dbv.type = DBVT_BLOB;
bool bResult = ((0 == db_get(hContact, szModule, szSetting, &dbv)) && (DBVT_BLOB == dbv.type));
- if(bResult)
+ if (bResult)
rdValue = *reinterpret_cast<double*>(dbv.pbVal);
db_free(&dbv);
diff --git a/plugins/Quotes/src/DBUtils.h b/plugins/Quotes/src/DBUtils.h index 8441bd61d6..3f758c2b5a 100644 --- a/plugins/Quotes/src/DBUtils.h +++ b/plugins/Quotes/src/DBUtils.h @@ -1,13 +1,13 @@ #ifndef __54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__
#define __54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__
-std::string Quotes_DBGetStringA(MCONTACT hContact,const char* szModule,const char* szSetting,const char* pszDefValue = NULL);
-std::wstring Quotes_DBGetStringW(MCONTACT hContact,const char* szModule,const char* szSetting,const wchar_t* pszDefValue = NULL);
+std::string Quotes_DBGetStringA(MCONTACT hContact, const char* szModule, const char* szSetting, const char* pszDefValue = NULL);
+std::wstring Quotes_DBGetStringW(MCONTACT hContact, const char* szModule, const char* szSetting, const wchar_t* pszDefValue = NULL);
#define Quotes_DBGetStringT Quotes_DBGetStringW
-bool Quotes_DBWriteDouble(MCONTACT hContact,const char* szModule,const char* szSetting,double dValue);
-bool Quotes_DBReadDouble(MCONTACT hContact,const char* szModule,const char* szSetting,double& rdValue);
+bool Quotes_DBWriteDouble(MCONTACT hContact, const char* szModule, const char* szSetting, double dValue);
+bool Quotes_DBReadDouble(MCONTACT hContact, const char* szModule, const char* szSetting, double& rdValue);
#endif //__54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__
diff --git a/plugins/Quotes/src/ExtraImages.cpp b/plugins/Quotes/src/ExtraImages.cpp index 83f10fa4f3..1f346f81f6 100644 --- a/plugins/Quotes/src/ExtraImages.cpp +++ b/plugins/Quotes/src/ExtraImages.cpp @@ -7,13 +7,13 @@ void Quotes_InitExtraIcons() hExtraIcon = ExtraIcon_Register(ICON_STR_QUOTE, QUOTES_PROTOCOL_NAME, Quotes_MakeIconName(ICON_STR_MAIN).c_str());
}
-bool SetContactExtraImage(MCONTACT hContact,EImageIndex nIndex)
+bool SetContactExtraImage(MCONTACT hContact, EImageIndex nIndex)
{
if (!hExtraIcon)
return false;
HANDLE hIcolib;
- switch(nIndex) {
+ switch (nIndex) {
case eiUp:
hIcolib = Quotes_GetIconHandle(IDI_ICON_UP);
break;
diff --git a/plugins/Quotes/src/ExtraImages.h b/plugins/Quotes/src/ExtraImages.h index ccad667636..717e0df155 100644 --- a/plugins/Quotes/src/ExtraImages.h +++ b/plugins/Quotes/src/ExtraImages.h @@ -9,7 +9,7 @@ enum EImageIndex eiEmpty = 3
};
-bool SetContactExtraImage(MCONTACT hContact,EImageIndex nIndex);
+bool SetContactExtraImage(MCONTACT hContact, EImageIndex nIndex);
void Quotes_InitExtraIcons(void);
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 4f57f16cab..a3a62b9405 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -42,7 +42,7 @@ namespace __AUTHORWEB,
UNICODE_AWARE,
// {E882056D-0D1D-4131-9A98-404CBAEA6A9C}
- {0xe882056d, 0xd1d, 0x4131, {0x9a, 0x98, 0x40, 0x4c, 0xba, 0xea, 0x6a, 0x9c}}
+ { 0xe882056d, 0xd1d, 0x4131, { 0x9a, 0x98, 0x40, 0x4c, 0xba, 0xea, 0x6a, 0x9c } }
};
void UpdateMenu(bool bAutoUpdate)
@@ -66,65 +66,65 @@ namespace }
-// INT_PTR QuoteProtoFunc_SetStatus(WPARAM wp,LPARAM /*lp*/)
-// {
-// if ((ID_STATUS_ONLINE == wp) || (ID_STATUS_OFFLINE == wp))
-// {
-// bool bAutoUpdate = (ID_STATUS_ONLINE == wp);
-// bool bOldFlag = g_bAutoUpdate;
-//
-// if(bAutoUpdate != g_bAutoUpdate)
-// {
-// g_bAutoUpdate = bAutoUpdate;
-// db_set_b(NULL,QUOTES_MODULE_NAME,DB_STR_AUTO_UPDATE,g_bAutoUpdate);
-// if (bOldFlag && !g_bAutoUpdate)
-// {
-// BOOL b = ::SetEvent(g_hEventWorkThreadStop);
-// assert(b);
-// }
-// else if (g_bAutoUpdate && !bOldFlag)
-// {
-// BOOL b = ::ResetEvent(g_hEventWorkThreadStop);
-// assert(b && "Failed to reset event");
-//
-// const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
-// const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders();
-// for(CQuotesProviders::TQuotesProviders::const_iterator i = rapProviders.begin();i != rapProviders.end();++i)
-// {
-// const CQuotesProviders::TQuotesProviderPtr& pProvider = *i;
-// g_ahThreads.push_back( mir_forkthread(WorkingThread, pProvider.get()));
-// }
-// }
-//
-// UpdateMenu(g_bAutoUpdate);
-// //ProtoBroadcastAck(QUOTES_PROTOCOL_NAME,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,reinterpret_cast<HANDLE>(nOldStatus),g_nStatus);
-// }
-//
-// }
-//
-// return 0;
-// }
-
- INT_PTR QuotesMenu_RefreshAll(WPARAM wp,LPARAM lp)
+ // INT_PTR QuoteProtoFunc_SetStatus(WPARAM wp,LPARAM /*lp*/)
+ // {
+ // if ((ID_STATUS_ONLINE == wp) || (ID_STATUS_OFFLINE == wp))
+ // {
+ // bool bAutoUpdate = (ID_STATUS_ONLINE == wp);
+ // bool bOldFlag = g_bAutoUpdate;
+ //
+ // if(bAutoUpdate != g_bAutoUpdate)
+ // {
+ // g_bAutoUpdate = bAutoUpdate;
+ // db_set_b(NULL,QUOTES_MODULE_NAME,DB_STR_AUTO_UPDATE,g_bAutoUpdate);
+ // if (bOldFlag && !g_bAutoUpdate)
+ // {
+ // BOOL b = ::SetEvent(g_hEventWorkThreadStop);
+ // assert(b);
+ // }
+ // else if (g_bAutoUpdate && !bOldFlag)
+ // {
+ // BOOL b = ::ResetEvent(g_hEventWorkThreadStop);
+ // assert(b && "Failed to reset event");
+ //
+ // const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
+ // const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders();
+ // for(CQuotesProviders::TQuotesProviders::const_iterator i = rapProviders.begin();i != rapProviders.end();++i)
+ // {
+ // const CQuotesProviders::TQuotesProviderPtr& pProvider = *i;
+ // g_ahThreads.push_back( mir_forkthread(WorkingThread, pProvider.get()));
+ // }
+ // }
+ //
+ // UpdateMenu(g_bAutoUpdate);
+ // //ProtoBroadcastAck(QUOTES_PROTOCOL_NAME,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,reinterpret_cast<HANDLE>(nOldStatus),g_nStatus);
+ // }
+ //
+ // }
+ //
+ // return 0;
+ // }
+
+ INT_PTR QuotesMenu_RefreshAll(WPARAM, LPARAM)
{
const CQuotesProviders::TQuotesProviders& apProviders = CModuleInfo::GetQuoteProvidersPtr()->GetProviders();
- std::for_each(apProviders.begin(),apProviders.end(),boost::bind(&IQuotesProvider::RefreshAllContacts,_1));
+ std::for_each(apProviders.begin(), apProviders.end(), boost::bind(&IQuotesProvider::RefreshAllContacts, _1));
return 0;
}
- INT_PTR QuotesMenu_EnableDisable(WPARAM wp,LPARAM lp)
+ INT_PTR QuotesMenu_EnableDisable(WPARAM, LPARAM)
{
//QuoteProtoFunc_SetStatus(g_bAutoUpdate ? ID_STATUS_OFFLINE : ID_STATUS_ONLINE,0L);
g_bAutoUpdate = (g_bAutoUpdate) ? false : true;
- db_set_b(NULL,QUOTES_MODULE_NAME,DB_STR_AUTO_UPDATE,g_bAutoUpdate);
+ db_set_b(NULL, QUOTES_MODULE_NAME, DB_STR_AUTO_UPDATE, g_bAutoUpdate);
const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders();
- std::for_each(std::begin(rapProviders),std::end(rapProviders),[](const CQuotesProviders::TQuotesProviderPtr& pProvider)
+ std::for_each(std::begin(rapProviders), std::end(rapProviders), [](const CQuotesProviders::TQuotesProviderPtr& pProvider)
{
pProvider->RefreshSettings();
- if(g_bAutoUpdate)
+ if (g_bAutoUpdate)
{
pProvider->RefreshAllContacts();
}
@@ -200,16 +200,16 @@ namespace bool bSubGroups = 1 == ServiceExists(MS_CLIST_MENUBUILDSUBGROUP);
- h = HookEvent(ME_CLIST_PREBUILDCONTACTMENU,Quotes_PrebuildContactMenu);
+ h = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Quotes_PrebuildContactMenu);
g_ahEvents.push_back(h);
memset(&mi, 0, sizeof(mi));
mi.cbSize = sizeof(mi);
mi.pszContactOwner = QUOTES_PROTOCOL_NAME;
hMenuRoot = NULL;
- if(bSubGroups)
+ if (bSubGroups)
{
- mi.pszPopupName=(char *)-1;
+ mi.pszPopupName = (char *)-1;
mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN);
mi.flags = CMIF_TCHAR | CMIF_ROOTPOPUP;
tstring sProtocolName = quotes_a2t(QUOTES_PROTOCOL_NAME);
@@ -220,7 +220,7 @@ namespace }
mi.flags = CMIF_TCHAR;
- if(bSubGroups)
+ if (bSubGroups)
{
mi.flags |= CMIF_CHILDPOPUP;
mi.pszPopupName = (char*)hMenuRoot;
@@ -228,7 +228,7 @@ namespace mi.ptszName = LPGENT("Refresh");
mi.popupPosition = 0;
- mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_REFRESH);
+ mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_REFRESH);
mi.pszService = "Quotes/RefreshContact";
hMenu = Menu_AddContactMenuItem(&mi);
g_hMenuRefresh = hMenu;
@@ -273,7 +273,7 @@ namespace g_ahServices.push_back(h);
}
- int Quotes_OnToolbarLoaded(WPARAM wParam, LPARAM lParam)
+ int Quotes_OnToolbarLoaded(WPARAM, LPARAM)
{
TTBButton ttb = { sizeof(ttb) };
ttb.name = LPGEN("Enable/Disable Quotes Auto Update");
@@ -301,32 +301,32 @@ namespace {
CHTTPSession::Init();
-// HANDLE h = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,QuotesEventFunc_onExtraImageApply);
-// g_ahEvents.push_back(h);
+ // HANDLE h = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,QuotesEventFunc_onExtraImageApply);
+ // g_ahEvents.push_back(h);
- g_hEventWorkThreadStop = ::CreateEvent(NULL,TRUE,FALSE,NULL);
- auto h = HookEvent(ME_USERINFO_INITIALISE,QuotesEventFunc_OnUserInfoInit);
+ g_hEventWorkThreadStop = ::CreateEvent(NULL, TRUE, FALSE, NULL);
+ auto h = HookEvent(ME_USERINFO_INITIALISE, QuotesEventFunc_OnUserInfoInit);
g_ahEvents.push_back(h);
- h = HookEvent(ME_CLIST_DOUBLECLICKED,Quotes_OnContactDoubleClick);
+ h = HookEvent(ME_CLIST_DOUBLECLICKED, Quotes_OnContactDoubleClick);
g_ahEvents.push_back(h);
h = HookEvent(ME_TTB_MODULELOADED, Quotes_OnToolbarLoaded);
g_ahEvents.push_back(h);
- g_bAutoUpdate = 1 == db_get_b(NULL,QUOTES_MODULE_NAME,DB_STR_AUTO_UPDATE,1);
+ g_bAutoUpdate = 1 == db_get_b(NULL, QUOTES_MODULE_NAME, DB_STR_AUTO_UPDATE, 1);
InitMenu();
- BOOL b = ::ResetEvent(g_hEventWorkThreadStop);
+ ::ResetEvent(g_hEventWorkThreadStop);
assert(b && "Failed to reset event");
const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders();
- for(CQuotesProviders::TQuotesProviders::const_iterator i = rapProviders.begin();i != rapProviders.end();++i)
+ for (CQuotesProviders::TQuotesProviders::const_iterator i = rapProviders.begin(); i != rapProviders.end(); ++i)
{
const CQuotesProviders::TQuotesProviderPtr& pProvider = *i;
- g_ahThreads.push_back( mir_forkthread(WorkingThread, pProvider.get()));
+ g_ahThreads.push_back(mir_forkthread(WorkingThread, pProvider.get()));
}
return 0;
@@ -338,7 +338,7 @@ namespace const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
- if(pProvider)
+ if (pProvider)
{
pProvider->DeleteContact(hContact);
}
@@ -346,76 +346,76 @@ namespace return 0;
}
-// INT_PTR QuoteProtoFunc_GetStatus(WPARAM/* wp*/,LPARAM/* lp*/)
-// {
-// return g_bAutoUpdate ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE;
-// }
+ // INT_PTR QuoteProtoFunc_GetStatus(WPARAM/* wp*/,LPARAM/* lp*/)
+ // {
+ // return g_bAutoUpdate ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE;
+ // }
void WaitForWorkingThreads()
{
size_t cThreads = g_ahThreads.size();
- if(cThreads > 0)
+ if (cThreads > 0)
{
HANDLE* paHandles = &*(g_ahThreads.begin());
- ::WaitForMultipleObjects((DWORD)cThreads,paHandles,TRUE,INFINITE);
+ ::WaitForMultipleObjects((DWORD)cThreads, paHandles, TRUE, INFINITE);
}
}
- int QuotesEventFunc_PreShutdown(WPARAM wParam, LPARAM lParam)
+ int QuotesEventFunc_PreShutdown(WPARAM, LPARAM)
{
//QuoteProtoFunc_SetStatus(ID_STATUS_OFFLINE,0);
- BOOL b = ::SetEvent(g_hEventWorkThreadStop);
+ ::SetEvent(g_hEventWorkThreadStop);
CModuleInfo::GetInstance().OnMirandaShutdown();
return 0;
}
-// INT_PTR QuoteProtoFunc_GetName(WPARAM wParam, LPARAM lParam)
-// {
-// if(lParam)
-// {
-// mir_strncpy(reinterpret_cast<char*>(lParam),QUOTES_PROTOCOL_NAME,wParam);
-// return 0;
-// }
-// else
-// {
-// return 1;
-// }
-// }
-//
-// INT_PTR QuoteProtoFunc_GetCaps(WPARAM wp,LPARAM lp)
-// {
-// int ret = 0;
-// switch(wp)
-// {
-// case PFLAGNUM_1:
-// ret = PF1_PEER2PEER;
-// break;
-// case PFLAGNUM_3:
-// case PFLAGNUM_2:
-// ret = PF2_ONLINE|PF2_LONGAWAY;
-// if(CModuleInfo::GetInstance().GetExtendedStatusFlag())
-// {
-// ret |= PF2_LIGHTDND;
-// }
-// break;
-// }
-//
-// return ret;
-// }
-//
-// INT_PTR QuoteProtoFunc_LoadIcon(WPARAM wp,LPARAM /*lp*/)
-// {
-// if ((wp & 0xffff) == PLI_PROTOCOL)
-// {
-// return reinterpret_cast<int>(::CopyIcon(Quotes_LoadIconEx(ICON_STR_MAIN)));
-// }
-//
-// return 0;
-// }
-
- int QuotesEventFunc_OptInitialise(WPARAM wp,LPARAM/* lp*/)
+ // INT_PTR QuoteProtoFunc_GetName(WPARAM wParam, LPARAM lParam)
+ // {
+ // if(lParam)
+ // {
+ // mir_strncpy(reinterpret_cast<char*>(lParam),QUOTES_PROTOCOL_NAME,wParam);
+ // return 0;
+ // }
+ // else
+ // {
+ // return 1;
+ // }
+ // }
+ //
+ // INT_PTR QuoteProtoFunc_GetCaps(WPARAM wp,LPARAM lp)
+ // {
+ // int ret = 0;
+ // switch(wp)
+ // {
+ // case PFLAGNUM_1:
+ // ret = PF1_PEER2PEER;
+ // break;
+ // case PFLAGNUM_3:
+ // case PFLAGNUM_2:
+ // ret = PF2_ONLINE|PF2_LONGAWAY;
+ // if(CModuleInfo::GetInstance().GetExtendedStatusFlag())
+ // {
+ // ret |= PF2_LIGHTDND;
+ // }
+ // break;
+ // }
+ //
+ // return ret;
+ // }
+ //
+ // INT_PTR QuoteProtoFunc_LoadIcon(WPARAM wp,LPARAM /*lp*/)
+ // {
+ // if ((wp & 0xffff) == PLI_PROTOCOL)
+ // {
+ // return reinterpret_cast<int>(::CopyIcon(Quotes_LoadIconEx(ICON_STR_MAIN)));
+ // }
+ //
+ // return 0;
+ // }
+
+ int QuotesEventFunc_OptInitialise(WPARAM wp, LPARAM/* lp*/)
{
const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders();
@@ -428,7 +428,7 @@ namespace odp.hIcon = Quotes_LoadIconEx(ICON_STR_MAIN);
odp.flags = ODPF_USERINFOTAB | ODPF_TCHAR;
- std::for_each(rapProviders.begin(),rapProviders.end(),boost::bind(&IQuotesProvider::ShowPropertyPage,_1,wp,boost::ref(odp)));
+ std::for_each(rapProviders.begin(), rapProviders.end(), boost::bind(&IQuotesProvider::ShowPropertyPage, _1, wp, boost::ref(odp)));
return 0;
}
@@ -449,7 +449,7 @@ namespace }
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
g_hInstance = hinstDLL;
return TRUE;
@@ -457,7 +457,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) extern "C"
{
- __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+ __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &Global_pluginInfo;
}
@@ -465,8 +465,8 @@ extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&Global_pluginInfo);
-
- if(false == CModuleInfo::Verify())
+
+ if (false == CModuleInfo::Verify())
{
return 1;
}
@@ -477,26 +477,26 @@ extern "C" PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = QUOTES_PROTOCOL_NAME;
pd.type = PROTOTYPE_VIRTUAL;
- CallService(MS_PROTO_REGISTERMODULE, 0, ( LPARAM )&pd );
-
-// HANDLE h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETNAME, QuoteProtoFunc_GetName);
-// g_ahServices.push_back(h);
-// h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETCAPS, QuoteProtoFunc_GetCaps);
-// g_ahServices.push_back(h);
-// h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_SETSTATUS, QuoteProtoFunc_SetStatus);
-// g_ahServices.push_back(h);
-// h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETSTATUS, QuoteProtoFunc_GetStatus);
-// g_ahServices.push_back(h);
-// h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_LOADICON, QuoteProtoFunc_LoadIcon);
-// g_ahServices.push_back(h);
-
- auto h = HookEvent(ME_SYSTEM_MODULESLOADED,QuotesEventFunc_OnModulesLoaded);
+ CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
+
+ // HANDLE h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETNAME, QuoteProtoFunc_GetName);
+ // g_ahServices.push_back(h);
+ // h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETCAPS, QuoteProtoFunc_GetCaps);
+ // g_ahServices.push_back(h);
+ // h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_SETSTATUS, QuoteProtoFunc_SetStatus);
+ // g_ahServices.push_back(h);
+ // h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETSTATUS, QuoteProtoFunc_GetStatus);
+ // g_ahServices.push_back(h);
+ // h = CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_LOADICON, QuoteProtoFunc_LoadIcon);
+ // g_ahServices.push_back(h);
+
+ auto h = HookEvent(ME_SYSTEM_MODULESLOADED, QuotesEventFunc_OnModulesLoaded);
g_ahEvents.push_back(h);
- h = HookEvent(ME_DB_CONTACT_DELETED,QuotesEventFunc_OnContactDeleted);
+ h = HookEvent(ME_DB_CONTACT_DELETED, QuotesEventFunc_OnContactDeleted);
g_ahEvents.push_back(h);
- h = HookEvent(ME_SYSTEM_PRESHUTDOWN,QuotesEventFunc_PreShutdown);
+ h = HookEvent(ME_SYSTEM_PRESHUTDOWN, QuotesEventFunc_PreShutdown);
g_ahEvents.push_back(h);
- h = HookEvent(ME_OPT_INITIALISE,QuotesEventFunc_OptInitialise);
+ h = HookEvent(ME_OPT_INITIALISE, QuotesEventFunc_OptInitialise);
g_ahEvents.push_back(h);
h = CreateServiceFunction(MS_QUOTES_EXPORT, Quotes_Export);
@@ -510,9 +510,9 @@ extern "C" __declspec(dllexport) int Unload(void)
{
- std::for_each(g_ahServices.begin(),g_ahServices.end(),boost::bind(Quotes_DestroyServiceFunction,_1));
- std::for_each(g_ahEvents.begin(),g_ahEvents.end(),boost::bind(Quotes_UnhookEvent,_1));
- std::for_each(g_ahMenus.begin(),g_ahMenus.end(),boost::bind(Quotes_RemoveMenuItem,_1));
+ std::for_each(g_ahServices.begin(), g_ahServices.end(), boost::bind(Quotes_DestroyServiceFunction, _1));
+ std::for_each(g_ahEvents.begin(), g_ahEvents.end(), boost::bind(Quotes_UnhookEvent, _1));
+ std::for_each(g_ahMenus.begin(), g_ahMenus.end(), boost::bind(Quotes_RemoveMenuItem, _1));
WaitForWorkingThreads();
diff --git a/plugins/Quotes/src/HTMLParserMS.cpp b/plugins/Quotes/src/HTMLParserMS.cpp index 86b9c7d933..bdc6316ab6 100644 --- a/plugins/Quotes/src/HTMLParserMS.cpp +++ b/plugins/Quotes/src/HTMLParserMS.cpp @@ -14,19 +14,19 @@ namespace typedef CComPtr<IHTMLElementCollection> TElementCollectionPtr;
public:
- CHTMLNode(const TComPtr& pElement,const TDocumentPtr& pDocument)
- : m_pElement(pElement),m_pDocument(pDocument){}
+ CHTMLNode(const TComPtr& pElement, const TDocumentPtr& pDocument)
+ : m_pElement(pElement), m_pDocument(pDocument){}
virtual THTMLNodePtr GetElementByID(const tstring& rsID)const
{
- if(m_pDocument)
+ if (m_pDocument)
{
CComPtr<IHTMLElement> pElement;
- if(SUCCEEDED(m_pDocument->getElementById(bstr_t(rsID.c_str()),&pElement))
+ if (SUCCEEDED(m_pDocument->getElementById(bstr_t(rsID.c_str()), &pElement))
&& pElement)
{
TComPtr p(pElement);
- return THTMLNodePtr(new CHTMLNode(p,m_pDocument));
+ return THTMLNodePtr(new CHTMLNode(p, m_pDocument));
}
}
@@ -36,15 +36,15 @@ namespace virtual size_t GetChildCount()const
{
TElementCollectionPtr pColl = GetElementCollectionPtr();
- if(pColl)
+ if (pColl)
{
LONG celem = 0;
HRESULT hr = pColl->get_length(&celem);
- if(S_OK == hr)
+ if (S_OK == hr)
{
return celem;
}
- }
+ }
return 0;
}
@@ -52,7 +52,7 @@ namespace virtual THTMLNodePtr GetChildPtr(size_t nIndex)
{
TElementCollectionPtr pColl = GetElementCollectionPtr();
- if(pColl)
+ if (pColl)
{
VARIANT varIndex;
varIndex.vt = VT_UINT;
@@ -60,10 +60,10 @@ namespace VARIANT var2;
VariantInit(&var2);
TComPtr pDisp;
- HRESULT hr = pColl->item(varIndex,var2,&pDisp);
- if(S_OK == hr && pDisp)
+ HRESULT hr = pColl->item(varIndex, var2, &pDisp);
+ if (S_OK == hr && pDisp)
{
- return THTMLNodePtr(new CHTMLNode(pDisp,m_pDocument));
+ return THTMLNodePtr(new CHTMLNode(pDisp, m_pDocument));
}
}
@@ -72,23 +72,23 @@ namespace virtual bool Is(EType nType)const
{
- switch(nType)
+ switch (nType)
{
case Table:
- {
- CComPtr<IHTMLTable> pTable;
- return (SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLTable,reinterpret_cast<void**>(&pTable))) && (pTable));
- }
+ {
+ CComPtr<IHTMLTable> pTable;
+ return (SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLTable, reinterpret_cast<void**>(&pTable))) && (pTable));
+ }
case TableRow:
- {
- CComPtr<IHTMLTableRow> pRow;
- return (SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLTableRow,reinterpret_cast<void**>(&pRow))) && (pRow));
- }
+ {
+ CComPtr<IHTMLTableRow> pRow;
+ return (SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLTableRow, reinterpret_cast<void**>(&pRow))) && (pRow));
+ }
case TableColumn:
- {
- CComPtr<IHTMLTableCol> pCol;
- return (SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLTableCol,reinterpret_cast<void**>(&pCol))) && (pCol));
- }
+ {
+ CComPtr<IHTMLTableCol> pCol;
+ return (SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLTableCol, reinterpret_cast<void**>(&pCol))) && (pCol));
+ }
}
return false;
@@ -100,23 +100,23 @@ namespace tstring sAttr;
CComPtr<IHTMLElement> pElement;
- if(SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLElement,reinterpret_cast<void**>(&pElement))) && pElement)
+ if (SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLElement, reinterpret_cast<void**>(&pElement))) && pElement)
{
_variant_t vAttribute;
BSTR pbstrAttrName = T2BSTR(rsAttrName.c_str());
- if(SUCCEEDED(pElement->getAttribute(pbstrAttrName,1,&vAttribute))
+ if (SUCCEEDED(pElement->getAttribute(pbstrAttrName, 1, &vAttribute))
&& VT_NULL != vAttribute.vt && VT_EMPTY != vAttribute.vt)
{
try
{
_bstr_t b(vAttribute);
LPCTSTR psz = b;
- if(psz)
+ if (psz)
{
sAttr = psz;
}
}
- catch(_com_error&)
+ catch (_com_error&)
{
}
}
@@ -127,20 +127,20 @@ namespace virtual tstring GetText()const
{
-// USES_CONVERSION;
+ // USES_CONVERSION;
tstring sText;
CComPtr<IHTMLElement> pElement;
- if(SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLElement,reinterpret_cast<void**>(&pElement))) && pElement)
+ if (SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLElement, reinterpret_cast<void**>(&pElement))) && pElement)
{
BSTR bstrText;
- if(SUCCEEDED(pElement->get_innerText(&bstrText)) && bstrText)
+ if (SUCCEEDED(pElement->get_innerText(&bstrText)) && bstrText)
{
try
{
sText = _bstr_t(bstrText);
}
- catch(_com_error&)
+ catch (_com_error&)
{
}
@@ -155,16 +155,16 @@ namespace virtual TElementCollectionPtr GetElementCollectionPtr()const
{
TElementCollectionPtr pColl;
- HRESULT hr = m_pElement->QueryInterface(IID_IHTMLElementCollection,reinterpret_cast<void**>(&pColl));
- if(FAILED(hr))
+ HRESULT hr = m_pElement->QueryInterface(IID_IHTMLElementCollection, reinterpret_cast<void**>(&pColl));
+ if (FAILED(hr))
{
CComPtr<IHTMLElement> pElement;
- if(SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLElement,reinterpret_cast<void**>(&pElement))) && pElement)
+ if (SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLElement, reinterpret_cast<void**>(&pElement))) && pElement)
{
CComPtr<IDispatch> pDisp;
- if(SUCCEEDED(pElement->get_children(&pDisp)) && pDisp)
+ if (SUCCEEDED(pElement->get_children(&pDisp)) && pDisp)
{
- hr = pDisp->QueryInterface(IID_IHTMLElementCollection,reinterpret_cast<void**>(&pColl));
+ hr = pDisp->QueryInterface(IID_IHTMLElementCollection, reinterpret_cast<void**>(&pColl));
}
}
}
@@ -203,22 +203,22 @@ CHTMLParserMS::CHTMLParserMS() : m_bCallUninit(false) _com_util::CheckError(m_pDoc->QueryInterface(IID_IMarkupServices,
(LPVOID*)&m_pMS));
- if(m_pMS)
+ if (m_pMS)
{
_com_util::CheckError(m_pMS->CreateMarkupPointer(&m_pMkStart));
_com_util::CheckError(m_pMS->CreateMarkupPointer(&m_pMkFinish));
}
}
- catch(_com_error&/* e*/)
+ catch (_com_error&/* e*/)
{
-// show_com_error_msg(e);
+ // show_com_error_msg(e);
}
}
CHTMLParserMS::~CHTMLParserMS()
{
- if(true == m_bCallUninit)
+ if (true == m_bCallUninit)
{
::CoUninitialize();
}
@@ -234,31 +234,31 @@ CHTMLParserMS::THTMLNodePtr CHTMLParserMS::ParseString(const tstring& rsHTML) OLECHAR* p = T2OLE(const_cast<LPTSTR>(rsHTML.c_str()));
CComPtr<IMarkupContainer> pMC;
- _com_util::CheckError(m_pMS->ParseString(p,0,&pMC,m_pMkStart,m_pMkFinish));
+ _com_util::CheckError(m_pMS->ParseString(p, 0, &pMC, m_pMkStart, m_pMkFinish));
- if(pMC)
+ if (pMC)
{
CComPtr<IHTMLDocument2> pNewDoc;
_com_util::CheckError(pMC->QueryInterface(IID_IHTMLDocument,
(LPVOID*)&pNewDoc));
- if(pNewDoc)
+ if (pNewDoc)
{
CComPtr<IHTMLElementCollection> pColl;
_com_util::CheckError(pNewDoc->get_all(&pColl));
CHTMLNode::TDocumentPtr pDoc;
- pMC->QueryInterface(IID_IHTMLDocument3,(LPVOID*)&pDoc);
+ pMC->QueryInterface(IID_IHTMLDocument3, (LPVOID*)&pDoc);
- return THTMLNodePtr(new CHTMLNode(CHTMLNode::TComPtr(pColl),pDoc));
+ return THTMLNodePtr(new CHTMLNode(CHTMLNode::TComPtr(pColl), pDoc));
}
}
}
- catch(_com_error&/* e*/)
+ catch (_com_error&/* e*/)
{
-// show_com_error_msg(e);
+ // show_com_error_msg(e);
}
return THTMLNodePtr();
@@ -283,12 +283,12 @@ bool CHTMLParserMS::IsInstalled() reinterpret_cast<LPVOID*>(&pDoc))
);
}
- catch(_com_error&/* e*/)
+ catch (_com_error&/* e*/)
{
bResult = false;
}
- if(bCallUninit)
+ if (bCallUninit)
{
::CoUninitialize();
}
diff --git a/plugins/Quotes/src/HTTPSession.cpp b/plugins/Quotes/src/HTTPSession.cpp index 4d618928aa..89fbd02cbb 100644 --- a/plugins/Quotes/src/HTTPSession.cpp +++ b/plugins/Quotes/src/HTTPSession.cpp @@ -12,91 +12,91 @@ public: namespace
{
-// class CImplMS : public CHTTPSession::CImpl
-// {
-// public:
-// CImplMS()
-// : m_hSession(::InternetOpen(_T("Dioksin"),PRE_CONFIG_INTERNET_ACCESS,NULL,INTERNET_INVALID_PORT_NUMBER,0)),
-// m_hRequest(NULL)
-// {
-//
-// }
-//
-// ~CImplMS()
-// {
-// if(m_hRequest)
-// {
-// ::InternetCloseHandle(m_hRequest);
-// }
-//
-// if(m_hSession)
-// {
-// ::InternetCloseHandle(m_hSession);
-// }
-// }
-//
-// virtual bool OpenURL(const tstring& rsURL)
-// {
-// if(NULL == m_hSession)
-// {
-// return false;
-// }
-//
-// if(NULL != m_hRequest)
-// {
-// ::InternetCloseHandle(m_hRequest);
-// m_hRequest = NULL;
-// }
-//
-// m_hRequest = ::InternetOpenUrl(m_hSession,rsURL.c_str(),NULL,0,INTERNET_FLAG_RELOAD,0);
-// return NULL != m_hRequest;
-// }
-//
-// virtual bool ReadResponce(tstring& rsResponce)const
-// {
-// if(NULL == m_hRequest)
-// {
-// return false;
-// }
-//
-// std::string sBuffer;
-// bool bResult = true;
-// DWORD cbRead = 0;
-// char szBuffer[1024];
-// do{
-// if(FALSE == ::InternetReadFile(m_hRequest,szBuffer,1024,&cbRead))
-// {
-// bResult = false;
-// break;
-// }
-// if (0 == cbRead)
-// {
-// break; // Stop.
-// }
-// else
-// {
-// sBuffer.insert(sBuffer.size(),szBuffer,cbRead);
-// }
-// }while(true);
-//
-// if(true == bResult)
-// {
-// USES_CONVERSION;
-// rsResponce = A2CT(sBuffer.c_str());
-// }
-//
-// return bResult;
-// }
-// private:
-// HINTERNET m_hSession;
-// HINTERNET m_hRequest;
-// };
-//
- int find_header(const NETLIBHTTPREQUEST* pRequest,const char* hdr)
+ // class CImplMS : public CHTTPSession::CImpl
+ // {
+ // public:
+ // CImplMS()
+ // : m_hSession(::InternetOpen(_T("Dioksin"),PRE_CONFIG_INTERNET_ACCESS,NULL,INTERNET_INVALID_PORT_NUMBER,0)),
+ // m_hRequest(NULL)
+ // {
+ //
+ // }
+ //
+ // ~CImplMS()
+ // {
+ // if(m_hRequest)
+ // {
+ // ::InternetCloseHandle(m_hRequest);
+ // }
+ //
+ // if(m_hSession)
+ // {
+ // ::InternetCloseHandle(m_hSession);
+ // }
+ // }
+ //
+ // virtual bool OpenURL(const tstring& rsURL)
+ // {
+ // if(NULL == m_hSession)
+ // {
+ // return false;
+ // }
+ //
+ // if(NULL != m_hRequest)
+ // {
+ // ::InternetCloseHandle(m_hRequest);
+ // m_hRequest = NULL;
+ // }
+ //
+ // m_hRequest = ::InternetOpenUrl(m_hSession,rsURL.c_str(),NULL,0,INTERNET_FLAG_RELOAD,0);
+ // return NULL != m_hRequest;
+ // }
+ //
+ // virtual bool ReadResponce(tstring& rsResponce)const
+ // {
+ // if(NULL == m_hRequest)
+ // {
+ // return false;
+ // }
+ //
+ // std::string sBuffer;
+ // bool bResult = true;
+ // DWORD cbRead = 0;
+ // char szBuffer[1024];
+ // do{
+ // if(FALSE == ::InternetReadFile(m_hRequest,szBuffer,1024,&cbRead))
+ // {
+ // bResult = false;
+ // break;
+ // }
+ // if (0 == cbRead)
+ // {
+ // break; // Stop.
+ // }
+ // else
+ // {
+ // sBuffer.insert(sBuffer.size(),szBuffer,cbRead);
+ // }
+ // }while(true);
+ //
+ // if(true == bResult)
+ // {
+ // USES_CONVERSION;
+ // rsResponce = A2CT(sBuffer.c_str());
+ // }
+ //
+ // return bResult;
+ // }
+ // private:
+ // HINTERNET m_hSession;
+ // HINTERNET m_hRequest;
+ // };
+ //
+ int find_header(const NETLIBHTTPREQUEST* pRequest, const char* hdr)
{
- for(int i = 0;i < pRequest->headersCount; ++i)
+ for (int i = 0; i < pRequest->headersCount; ++i)
{
- if (0 == _stricmp(pRequest->headers[i].szName,hdr))
+ if (0 == _stricmp(pRequest->headers[i].szName, hdr))
{
return i;
}
@@ -115,53 +115,53 @@ namespace {
assert(NULL == g_hNetLib);
- NETLIBUSER nlu = {0};
+ NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_OUTGOING|NUF_HTTPCONNS|NUF_NOHTTPSOPTION|NUF_TCHAR;
+ nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_TCHAR;
nlu.szSettingsModule = QUOTES_PROTOCOL_NAME;
nlu.ptszDescriptiveName = TranslateT("Quotes HTTP connections");
- g_hNetLib = reinterpret_cast<HANDLE>(CallService(MS_NETLIB_REGISTERUSER,0,(LPARAM)&nlu));
+ g_hNetLib = reinterpret_cast<HANDLE>(CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu));
return (NULL != g_hNetLib);
}
- static bool IsValid(){return NULL != g_hNetLib;}
+ static bool IsValid(){ return NULL != g_hNetLib; }
virtual bool OpenURL(const tstring& rsURL)
{
-// USES_CONVERSION;
+ // USES_CONVERSION;
m_aURL.swap(TBuffer());
std::string s = quotes_t2a(rsURL.c_str());
const char* psz = s.c_str();//T2CA(rsURL.c_str());
- m_aURL.insert(m_aURL.begin(),psz,psz+strlen(psz)+1);
+ m_aURL.insert(m_aURL.begin(), psz, psz + strlen(psz) + 1);
return true;
}
virtual bool ReadResponce(tstring& rsResponce)const
{
- if(true == m_aURL.empty())
+ if (true == m_aURL.empty())
{
return false;
}
- NETLIBHTTPREQUEST nlhr = {0};
+ NETLIBHTTPREQUEST nlhr = { 0 };
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
- nlhr.flags = NLHRF_DUMPASTEXT|NLHRF_HTTP11|NLHRF_REDIRECT;
+ nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT;
char* pURL = &*(m_aURL.begin());
nlhr.szUrl = pURL;
nlhr.headersCount = 4;
- nlhr.headers=(NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
- nlhr.headers[0].szName = "User-Agent";
+ nlhr.headers = (NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
+ nlhr.headers[0].szName = "User-Agent";
nlhr.headers[0].szValue = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
- nlhr.headers[1].szName = "Connection";
+ nlhr.headers[1].szName = "Connection";
nlhr.headers[1].szValue = "close";
- nlhr.headers[2].szName = "Cache-Control";
+ nlhr.headers[2].szName = "Cache-Control";
nlhr.headers[2].szValue = "no-cache";
- nlhr.headers[3].szName = "Pragma";
+ nlhr.headers[3].szName = "Pragma";
nlhr.headers[3].szValue = "no-cache";
// nlhr.headers[4].szName = "Accept-Encoding";
// nlhr.headers[4].szValue = "deflate, gzip";
@@ -170,24 +170,24 @@ namespace bool bResult = false;
NETLIBHTTPREQUEST* pReply = NULL;
-
+
{
CGuard<CLightMutex> guard(m_mx);
pReply = reinterpret_cast<NETLIBHTTPREQUEST*>(CallService(MS_NETLIB_HTTPTRANSACTION,
- reinterpret_cast<WPARAM>(g_hNetLib),reinterpret_cast<LPARAM>(&nlhr)));
+ reinterpret_cast<WPARAM>(g_hNetLib), reinterpret_cast<LPARAM>(&nlhr)));
}
- if(pReply)
+ if (pReply)
{
- if ((200 == pReply->resultCode) && (pReply->dataLength > 0))
+ if ((200 == pReply->resultCode) && (pReply->dataLength > 0))
{
TBuffer apBuffer;
- apBuffer.insert(apBuffer.begin(),pReply->pData,pReply->pData+pReply->dataLength);
- apBuffer.push_back('\0');
+ apBuffer.insert(apBuffer.begin(), pReply->pData, pReply->pData + pReply->dataLength);
+ apBuffer.push_back('\0');
char* pResult = &*(apBuffer.begin());
- int nIndex = find_header(pReply,"Content-Type");
- if ((-1 != nIndex) && (NULL != strstr(_strlwr(pReply->headers[nIndex].szValue),"utf-8")))
+ int nIndex = find_header(pReply, "Content-Type");
+ if ((-1 != nIndex) && (NULL != strstr(_strlwr(pReply->headers[nIndex].szValue), "utf-8")))
{
TCHAR* p = mir_utf8decodeT(pResult);
rsResponce = p;
@@ -195,15 +195,15 @@ namespace }
else
{
-// USES_CONVERSION;
-// LPCTSTR p = A2CT(pResult);
+ // USES_CONVERSION;
+ // LPCTSTR p = A2CT(pResult);
rsResponce = quotes_a2t(pResult);//p;
}
bResult = true;
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,reinterpret_cast<LPARAM>(pReply));
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, reinterpret_cast<LPARAM>(pReply));
}
mir_free(nlhr.headers);
@@ -220,22 +220,22 @@ namespace HANDLE CImplMI::g_hNetLib = NULL;
-// CHTTPSession::CImpl* create_impl()
-// {
-// if(true == CImplMI::IsValid())
-// {
-// return new CImplMI;
-// }
-// else
-// {
-// return new CImplMS;
-// }
-// }
+ // CHTTPSession::CImpl* create_impl()
+ // {
+ // if(true == CImplMI::IsValid())
+ // {
+ // return new CImplMI;
+ // }
+ // else
+ // {
+ // return new CImplMS;
+ // }
+ // }
}
CHTTPSession::CHTTPSession()
- : m_pImpl(new CImplMI)
+ : m_pImpl(new CImplMI)
{
}
diff --git a/plugins/Quotes/src/IHTMLParser.h b/plugins/Quotes/src/IHTMLParser.h index defc6f61cb..6fc00e30c1 100644 --- a/plugins/Quotes/src/IHTMLParser.h +++ b/plugins/Quotes/src/IHTMLParser.h @@ -22,7 +22,7 @@ public: virtual bool Is(EType nType)const = 0;
virtual THTMLNodePtr GetElementByID(const tstring& rsID)const = 0;
-
+
virtual tstring GetAttribute(const tstring& rsAttrName)const = 0;
virtual tstring GetText()const = 0;
};
diff --git a/plugins/Quotes/src/IQuotesProvider.h b/plugins/Quotes/src/IQuotesProvider.h index 5c60536e41..2875904dcf 100644 --- a/plugins/Quotes/src/IQuotesProvider.h +++ b/plugins/Quotes/src/IQuotesProvider.h @@ -8,8 +8,8 @@ class CQuotesProviderVisitor; class IQuotesProvider : private boost::noncopyable
{
public:
- struct CProviderInfo
- {
+ struct CProviderInfo
+ {
tstring m_sName;
tstring m_sURL;
@@ -25,11 +25,11 @@ public: virtual void AddContact(MCONTACT hContact) = 0;
virtual void DeleteContact(MCONTACT hContact) = 0;
- virtual void ShowPropertyPage(WPARAM wp,OPTIONSDIALOGPAGE& odp) = 0;
+ virtual void ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE& odp) = 0;
virtual void RefreshAllContacts() = 0;
virtual void RefreshSettings() = 0;
- virtual void RefreshContact(MCONTACT hContact) = 0;
-// virtual void SetContactExtraIcon(MCONTACT hContact)const = 0;
+ virtual void RefreshContact(MCONTACT hContact) = 0;
+ // virtual void SetContactExtraIcon(MCONTACT hContact)const = 0;
virtual void Run() = 0;
diff --git a/plugins/Quotes/src/IXMLEngine.h b/plugins/Quotes/src/IXMLEngine.h index 910c3efea0..7130f0e380 100644 --- a/plugins/Quotes/src/IXMLEngine.h +++ b/plugins/Quotes/src/IXMLEngine.h @@ -12,17 +12,17 @@ public: virtual size_t GetChildCount()const = 0;
virtual TXMLNodePtr GetChildNode(size_t nIndex)const = 0;
-
+
virtual tstring GetText()const = 0;
virtual tstring GetName()const = 0;
virtual bool AddChild(const TXMLNodePtr& pNode) = 0;
- virtual bool AddAttribute(const tstring& rsName,const tstring& rsValue) = 0;
+ virtual bool AddAttribute(const tstring& rsName, const tstring& rsValue) = 0;
virtual tstring GetAttributeValue(const tstring& rsAttrName) = 0;
virtual void Write(tostream& o)const = 0;
};
-inline tostream& operator<<(tostream& o,const IXMLNode& node)
+inline tostream& operator<<(tostream& o, const IXMLNode& node)
{
node.Write(o);
return o;
@@ -36,8 +36,8 @@ public: virtual ~IXMLEngine() {}
virtual IXMLNode::TXMLNodePtr LoadFile(const tstring& rsFileName)const = 0;
- virtual bool SaveFile(const tstring& rsFileName,const IXMLNode::TXMLNodePtr& pNode)const = 0;
- virtual IXMLNode::TXMLNodePtr CreateNode(const tstring& rsName,const tstring& rsText)const = 0;
+ virtual bool SaveFile(const tstring& rsFileName, const IXMLNode::TXMLNodePtr& pNode)const = 0;
+ virtual IXMLNode::TXMLNodePtr CreateNode(const tstring& rsName, const tstring& rsText)const = 0;
};
#endif //__f88e20d7_5e65_40fb_a7b5_7c7af1ee1c78_IXMLEngine_h__
diff --git a/plugins/Quotes/src/IconLib.cpp b/plugins/Quotes/src/IconLib.cpp index bc328f2f82..31be0a90a8 100644 --- a/plugins/Quotes/src/IconLib.cpp +++ b/plugins/Quotes/src/IconLib.cpp @@ -2,18 +2,18 @@ static IconItem iconList[] =
{
- { LPGEN("Protocol icon"), ICON_STR_MAIN, IDI_ICON_MAIN },
- { LPGEN("Auto Update Disabled"), ICON_STR_AUTO_UPDATE_DISABLED, IDI_ICON_DISABLED },
- { LPGEN("Quote/Rate up"), ICON_STR_QUOTE_UP, IDI_ICON_UP },
- { LPGEN("Quote/Rate down"), ICON_STR_QUOTE_DOWN, IDI_ICON_DOWN },
- { LPGEN("Quote/Rate not changed"), ICON_STR_QUOTE_NOT_CHANGED, IDI_ICON_NOTCHANGED },
- { LPGEN("Quote Section"), ICON_STR_SECTION, IDI_ICON_SECTION },
- { LPGEN("Quote"), ICON_STR_QUOTE, IDI_ICON_QUOTE },
- { LPGEN("Currency Converter"), ICON_STR_CURRENCY_CONVERTER, IDI_ICON_CURRENCY_CONVERTER },
- { LPGEN("Refresh"), ICON_STR_REFRESH, IDI_ICON_REFRESH },
- { LPGEN("Export"), ICON_STR_EXPORT, IDI_ICON_EXPORT },
- { LPGEN("Swap button"), ICON_STR_SWAP, IDI_ICON_SWAP },
- { LPGEN("Import"), ICON_STR_IMPORT, IDI_ICON_IMPORT }
+ { LPGEN("Protocol icon"), ICON_STR_MAIN, IDI_ICON_MAIN },
+ { LPGEN("Auto Update Disabled"), ICON_STR_AUTO_UPDATE_DISABLED, IDI_ICON_DISABLED },
+ { LPGEN("Quote/Rate up"), ICON_STR_QUOTE_UP, IDI_ICON_UP },
+ { LPGEN("Quote/Rate down"), ICON_STR_QUOTE_DOWN, IDI_ICON_DOWN },
+ { LPGEN("Quote/Rate not changed"), ICON_STR_QUOTE_NOT_CHANGED, IDI_ICON_NOTCHANGED },
+ { LPGEN("Quote Section"), ICON_STR_SECTION, IDI_ICON_SECTION },
+ { LPGEN("Quote"), ICON_STR_QUOTE, IDI_ICON_QUOTE },
+ { LPGEN("Currency Converter"), ICON_STR_CURRENCY_CONVERTER, IDI_ICON_CURRENCY_CONVERTER },
+ { LPGEN("Refresh"), ICON_STR_REFRESH, IDI_ICON_REFRESH },
+ { LPGEN("Export"), ICON_STR_EXPORT, IDI_ICON_EXPORT },
+ { LPGEN("Swap button"), ICON_STR_SWAP, IDI_ICON_SWAP },
+ { LPGEN("Import"), ICON_STR_IMPORT, IDI_ICON_IMPORT }
};
void Quotes_IconsInit()
@@ -32,7 +32,7 @@ std::string Quotes_MakeIconName(const char* name) return sName;
}
-HICON Quotes_LoadIconEx(const char* name,bool bBig /*= false*/)
+HICON Quotes_LoadIconEx(const char* name, bool bBig /*= false*/)
{
std::string sIconName = Quotes_MakeIconName(name);
return Skin_GetIcon(sIconName.c_str(), bBig);
@@ -40,8 +40,8 @@ HICON Quotes_LoadIconEx(const char* name,bool bBig /*= false*/) HANDLE Quotes_GetIconHandle(int iconId)
{
- for (int i=0; i < SIZEOF(iconList); i++)
- if(iconList[i].defIconID == iconId)
+ for (int i = 0; i < SIZEOF(iconList); i++)
+ if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
return NULL;
diff --git a/plugins/Quotes/src/IconLib.h b/plugins/Quotes/src/IconLib.h index a1ea6ea078..b7e1fda175 100644 --- a/plugins/Quotes/src/IconLib.h +++ b/plugins/Quotes/src/IconLib.h @@ -15,7 +15,7 @@ #define ICON_STR_SWAP "swap"
void Quotes_IconsInit();
-HICON Quotes_LoadIconEx(const char* name,bool bBig = false);
+HICON Quotes_LoadIconEx(const char* name, bool bBig = false);
HANDLE Quotes_GetIconHandle(int iconId);
std::string Quotes_MakeIconName(const char* name);
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index 6a01feb58f..ec5e9d44c3 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -28,16 +28,16 @@ namespace struct mir_safety_dbvar
{
mir_safety_dbvar(DBVARIANT* p) : m_p(p){}
- ~mir_safety_dbvar(){db_free(m_p);}
+ ~mir_safety_dbvar(){ db_free(m_p); }
DBVARIANT* m_p;
};
- static int enum_contact_settings(const char* szSetting,LPARAM lp)
+ static int enum_contact_settings(const char* szSetting, LPARAM lp)
{
CEnumContext* ctx = reinterpret_cast<CEnumContext*>(lp);
DBVARIANT dbv;
- if(0 == db_get(ctx->m_hContact, ctx->m_pszModule, szSetting, &dbv))
+ if (0 == db_get(ctx->m_hContact, ctx->m_pszModule, szSetting, &dbv))
{
mir_safety_dbvar sdbvar(&dbv);
@@ -45,7 +45,7 @@ namespace tostringstream sValue;
sValue.imbue(GetSystemLocale());
- switch(dbv.type)
+ switch (dbv.type)
{
case DBVT_BYTE:
sValue << dbv.bVal;
@@ -61,40 +61,40 @@ namespace break;
case DBVT_ASCIIZ:
sType = g_pszXmlTypeAsciiz;
- if(dbv.pszVal)
+ if (dbv.pszVal)
{
sValue << dbv.pszVal;
-// mir_safe_string<char> mss(mir_utf8encode(dbv.pszVal));
-// if(mss.m_p)
-// {
-// sValue << mss.m_p;
-// }
+ // mir_safe_string<char> mss(mir_utf8encode(dbv.pszVal));
+ // if(mss.m_p)
+ // {
+ // sValue << mss.m_p;
+ // }
}
break;
case DBVT_WCHAR:
sType = g_pszXmlTypeWchar;
- if(dbv.pwszVal)
+ if (dbv.pwszVal)
{
sValue << dbv.pwszVal;
-// mir_safe_string<char> mss(mir_utf8encodeW(dbv.pwszVal));
-// if(mss.m_p)
-// {
-// sValue << mss.m_p;
-// }
+ // mir_safe_string<char> mss(mir_utf8encodeW(dbv.pwszVal));
+ // if(mss.m_p)
+ // {
+ // sValue << mss.m_p;
+ // }
}
break;
case DBVT_UTF8:
sType = g_pszXmlTypeUtf8;
- if(dbv.pszVal)
+ if (dbv.pszVal)
{
sValue << dbv.pszVal;
}
break;
case DBVT_BLOB:
sType = g_pszXmlTypeBlob;
- if(dbv.pbVal)
+ if (dbv.pbVal)
{
- ptrA buf( mir_base64_encode(dbv.pbVal, dbv.cpbVal));
+ ptrA buf(mir_base64_encode(dbv.pbVal, dbv.cpbVal));
if (buf) {
sValue << buf;
}
@@ -102,18 +102,18 @@ namespace break;
}
-// mir_safe_string<char> mssSetting(mir_utf8encode(szSetting));
-// if(mssSetting.m_p)
+ // mir_safe_string<char> mssSetting(mir_utf8encode(szSetting));
+ // if(mssSetting.m_p)
{
- IXMLNode::TXMLNodePtr pXmlSet = ctx->m_pXmlEngine->CreateNode(g_pszXmlSetting,tstring());
- if(pXmlSet)
+ IXMLNode::TXMLNodePtr pXmlSet = ctx->m_pXmlEngine->CreateNode(g_pszXmlSetting, tstring());
+ if (pXmlSet)
{
- IXMLNode::TXMLNodePtr pXmlName = ctx->m_pXmlEngine->CreateNode(g_pszXmlName,quotes_a2t(szSetting));
+ IXMLNode::TXMLNodePtr pXmlName = ctx->m_pXmlEngine->CreateNode(g_pszXmlName, quotes_a2t(szSetting));
- IXMLNode::TXMLNodePtr pXmlValue = ctx->m_pXmlEngine->CreateNode(g_pszXmlValue,sValue.str());
- if(pXmlName && pXmlValue)
+ IXMLNode::TXMLNodePtr pXmlValue = ctx->m_pXmlEngine->CreateNode(g_pszXmlValue, sValue.str());
+ if (pXmlName && pXmlValue)
{
- pXmlValue->AddAttribute(g_pszXmlType,sType);
+ pXmlValue->AddAttribute(g_pszXmlType, sType);
pXmlSet->AddChild(pXmlName);
pXmlSet->AddChild(pXmlValue);
@@ -121,17 +121,17 @@ namespace }
}
}
- }
+ }
return 0;
}
- int EnumDbModules(const char* szModuleName, DWORD ofsModuleName, LPARAM lp)
+ int EnumDbModules(const char* szModuleName, LPARAM lp)
{
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)*/);
- if(pModule)
+ IXMLNode::TXMLNodePtr pModule = ctx->m_pXmlEngine->CreateNode(g_pszXmlModule, quotes_a2t(szModuleName)/*A2CT(szModuleName)*/);
+ if (pModule)
{
ctx->m_pszModule = szModuleName;
ctx->m_pNode = pModule;
@@ -141,8 +141,8 @@ namespace dbces.szModule = szModuleName;
dbces.lParam = reinterpret_cast<LPARAM>(ctx);
- CallService(MS_DB_CONTACT_ENUMSETTINGS, WPARAM(ctx->m_hContact),reinterpret_cast<LPARAM>(&dbces));
- if(pModule->GetChildCount() > 0)
+ CallService(MS_DB_CONTACT_ENUMSETTINGS, WPARAM(ctx->m_hContact), reinterpret_cast<LPARAM>(&dbces));
+ if (pModule->GetChildCount() > 0)
pXml->AddChild(pModule);
ctx->m_pNode = pXml;
@@ -151,52 +151,52 @@ namespace return 0;
}
- IXMLNode::TXMLNodePtr export_contact(MCONTACT hContact,const CModuleInfo::TXMLEnginePtr& pXmlEngine)
+ IXMLNode::TXMLNodePtr export_contact(MCONTACT hContact, const CModuleInfo::TXMLEnginePtr& pXmlEngine)
{
- IXMLNode::TXMLNodePtr pNode = pXmlEngine->CreateNode(g_pszXmlContact,tstring());
- if(pNode)
+ IXMLNode::TXMLNodePtr pNode = pXmlEngine->CreateNode(g_pszXmlContact, tstring());
+ if (pNode)
{
CEnumContext ctx;
ctx.m_pXmlEngine = pXmlEngine;
ctx.m_pNode = pNode;
ctx.m_hContact = hContact;
- CallService(MS_DB_MODULES_ENUM,reinterpret_cast<WPARAM>(&ctx),reinterpret_cast<LPARAM>(EnumDbModules));
+ CallService(MS_DB_MODULES_ENUM, reinterpret_cast<WPARAM>(&ctx), reinterpret_cast<LPARAM>(EnumDbModules));
}
return pNode;
}
- LPCTSTR prepare_filter(LPTSTR pszBuffer,size_t cBuffer)
+ LPCTSTR prepare_filter(LPTSTR pszBuffer, size_t cBuffer)
{
LPTSTR p = pszBuffer;
LPCTSTR pszXml = TranslateT("XML File (*.xml)");
- mir_tstrncpy(p,pszXml, (int)cBuffer);
- size_t nLen = mir_tstrlen(pszXml)+1;
- p+= nLen;
- if(nLen < cBuffer)
+ mir_tstrncpy(p, pszXml, (int)cBuffer);
+ size_t nLen = mir_tstrlen(pszXml) + 1;
+ p += nLen;
+ if (nLen < cBuffer)
{
- mir_tstrncpy(p,_T("*.xml"),(int)(cBuffer-nLen));
- p+= 6;
+ mir_tstrncpy(p, _T("*.xml"), (int)(cBuffer - nLen));
+ p += 6;
nLen += 6;
}
- if(nLen < cBuffer)
+ if (nLen < cBuffer)
{
LPCTSTR pszAll = TranslateT("All files (*.*)");
- mir_tstrncpy(p,pszAll,(int)(cBuffer-nLen));
- size_t n = mir_tstrlen(pszAll)+1;
+ mir_tstrncpy(p, pszAll, (int)(cBuffer - nLen));
+ size_t n = mir_tstrlen(pszAll) + 1;
nLen += n;
- p+= n;
+ p += n;
}
- if(nLen < cBuffer)
+ if (nLen < cBuffer)
{
- mir_tstrncpy(p,_T("*.*"),(int)(cBuffer-nLen));
- p+= 4;
+ mir_tstrncpy(p, _T("*.*"), (int)(cBuffer - nLen));
+ p += 4;
nLen += 4;
}
- if(nLen < cBuffer)
+ if (nLen < cBuffer)
{
*p = _T('\0');
}
@@ -204,20 +204,20 @@ namespace return pszBuffer;
}
- bool show_open_file_dialog(bool bOpen,tstring& rsFile)
+ bool show_open_file_dialog(bool bOpen, tstring& rsFile)
{
TCHAR szBuffer[MAX_PATH];
TCHAR szFilter[MAX_PATH];
OPENFILENAME ofn;
- memset(&ofn,0,sizeof(ofn));
+ memset(&ofn, 0, sizeof(ofn));
- ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.lStructSize = sizeof(OPENFILENAME);
- ofn.hwndOwner = NULL;
- ofn.lpstrFilter = prepare_filter(szFilter,MAX_PATH);
- ofn.Flags = OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_EXPLORER;
- ofn.lpstrDefExt = _T("xml");
- if(true == bOpen)
+ ofn.hwndOwner = NULL;
+ ofn.lpstrFilter = prepare_filter(szFilter, MAX_PATH);
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER;
+ ofn.lpstrDefExt = _T("xml");
+ if (true == bOpen)
{
ofn.Flags |= OFN_FILEMUSTEXIST;
}
@@ -225,20 +225,20 @@ namespace {
ofn.Flags |= OFN_OVERWRITEPROMPT;
}
- ofn.nMaxFile = MAX_PATH;
- ofn.lpstrFile = szBuffer;
- ofn.lpstrFile[0] = _T('\0');
+ ofn.nMaxFile = MAX_PATH;
+ ofn.lpstrFile = szBuffer;
+ ofn.lpstrFile[0] = _T('\0');
- if(bOpen)
+ if (bOpen)
{
- if(FALSE == GetOpenFileName(&ofn))
+ if (FALSE == GetOpenFileName(&ofn))
{
return false;
}
}
else
{
- if(FALSE == GetSaveFileName(&ofn))
+ if (FALSE == GetSaveFileName(&ofn))
{
return false;
}
@@ -250,35 +250,35 @@ namespace }
}
-INT_PTR Quotes_Export(WPARAM wp,LPARAM lp)
+INT_PTR Quotes_Export(WPARAM wp, LPARAM lp)
{
-// USES_CONVERSION;
+ // USES_CONVERSION;
tstring sFileName;
const char* pszFile = reinterpret_cast<const char*>(lp);
- if(NULL == pszFile)
+ if (NULL == pszFile)
{
- if(false == show_open_file_dialog(false,sFileName))
+ if (false == show_open_file_dialog(false, sFileName))
{
return -1;
}
}
else
- {
+ {
sFileName = quotes_a2t(pszFile);//A2CT(pszFile);
- }
+ }
CModuleInfo::TXMLEnginePtr pXmlEngine = CModuleInfo::GetInstance().GetXMLEnginePtr();
CModuleInfo::TQuotesProvidersPtr pProviders = CModuleInfo::GetInstance().GetQuoteProvidersPtr();
- IXMLNode::TXMLNodePtr pRoot = pXmlEngine->CreateNode(g_pszXmlContacts,tstring());
+ IXMLNode::TXMLNodePtr pRoot = pXmlEngine->CreateNode(g_pszXmlContacts, tstring());
MCONTACT hContact = MCONTACT(wp);
- if(hContact)
+ if (hContact)
{
CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
- if(pProvider)
+ if (pProvider)
{
- IXMLNode::TXMLNodePtr pNode = export_contact(hContact,pXmlEngine);
- if(pNode)
+ IXMLNode::TXMLNodePtr pNode = export_contact(hContact, pXmlEngine);
+ if (pNode)
{
pRoot->AddChild(pNode);
}
@@ -286,13 +286,13 @@ INT_PTR Quotes_Export(WPARAM wp,LPARAM lp) }
else
{
- for(hContact = db_find_first(QUOTES_MODULE_NAME); hContact; hContact = db_find_next(hContact, QUOTES_MODULE_NAME))
+ for (hContact = db_find_first(QUOTES_MODULE_NAME); hContact; hContact = db_find_next(hContact, QUOTES_MODULE_NAME))
{
CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
- if(pProvider)
+ if (pProvider)
{
- IXMLNode::TXMLNodePtr pNode = export_contact(hContact,pXmlEngine);
- if(pNode)
+ IXMLNode::TXMLNodePtr pNode = export_contact(hContact, pXmlEngine);
+ if (pNode)
{
pRoot->AddChild(pNode);
}
@@ -300,7 +300,7 @@ INT_PTR Quotes_Export(WPARAM wp,LPARAM lp) }
}
- return ((true == pXmlEngine->SaveFile(sFileName,pRoot)) ? 0 : 1);
+ return ((true == pXmlEngine->SaveFile(sFileName, pRoot)) ? 0 : 1);
}
namespace
@@ -311,40 +311,40 @@ namespace return (0 == db_set(hContact, dbs.szModule, dbs.szSetting, &dbs.value));
}
- bool handle_module(MCONTACT hContact,const IXMLNode::TXMLNodePtr& pXmlModule,UINT nFlags)
+ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule)
{
size_t cCreatedRecords = 0;
tstring sModuleName = pXmlModule->GetText();
- if(false == sModuleName.empty())
+ if (false == sModuleName.empty())
{
DBCONTACTWRITESETTING dbs;
std::string s = quotes_t2a(sModuleName.c_str());
dbs.szModule = s.c_str();//T2CA(sModuleName.c_str());
- bool bCListModule = 0 == quotes_stricmp(sModuleName.c_str(),_T("CList"));
+ bool bCListModule = 0 == quotes_stricmp(sModuleName.c_str(), _T("CList"));
size_t cChild = pXmlModule->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IXMLNode::TXMLNodePtr pSetting = pXmlModule->GetChildNode(i);
tstring sSetting = pSetting->GetName();
- if(0 == quotes_stricmp(g_pszXmlSetting,sSetting.c_str()))
+ if (0 == quotes_stricmp(g_pszXmlSetting, sSetting.c_str()))
{
size_t cSetChild = pSetting->GetChildCount();
- if(cSetChild >= 2)
+ if (cSetChild >= 2)
{
tstring sName;
tstring sValue;
tstring sType;
- for(size_t i = 0;i < cSetChild;++i)
+ for (size_t i = 0; i < cSetChild; ++i)
{
IXMLNode::TXMLNodePtr pNode = pSetting->GetChildNode(i);
tstring sNode = pNode->GetName();
- if(0 == quotes_stricmp(g_pszXmlName,sNode.c_str()))
+ if (0 == quotes_stricmp(g_pszXmlName, sNode.c_str()))
{
sName = pNode->GetText();
}
- else if(0 == quotes_stricmp(g_pszXmlValue,sNode.c_str()))
+ else if (0 == quotes_stricmp(g_pszXmlValue, sNode.c_str()))
{
sValue = pNode->GetText();
sType = pNode->GetAttributeValue(g_pszXmlType);
@@ -355,118 +355,118 @@ namespace {
std::string s = quotes_t2a(sName.c_str());
dbs.szSetting = s.c_str();//T2CA(sName.c_str());
- if(0 == quotes_stricmp(g_pszXmlTypeByte,sType.c_str()))
+ if (0 == quotes_stricmp(g_pszXmlTypeByte, sType.c_str()))
{
tistringstream in(sValue.c_str());
in.imbue(GetSystemLocale());
dbs.value.cVal = in.get();
- if(in.good() && in.eof())
+ if (in.good() && in.eof())
{
dbs.value.type = DBVT_BYTE;
- if(set_contact_settings(hContact,dbs))
+ if (set_contact_settings(hContact, dbs))
++cCreatedRecords;
}
}
- else if(0 == quotes_stricmp(g_pszXmlTypeWord,sType.c_str()))
- {
+ else if (0 == quotes_stricmp(g_pszXmlTypeWord, sType.c_str()))
+ {
tistringstream in(sValue.c_str());
in.imbue(GetSystemLocale());
in >> dbs.value.wVal;
- if(in.good() || in.eof())
+ if (in.good() || in.eof())
{
dbs.value.type = DBVT_WORD;
- if(set_contact_settings(hContact,dbs))
+ if (set_contact_settings(hContact, dbs))
++cCreatedRecords;
}
}
- else if(0 == quotes_stricmp(g_pszXmlTypeDword,sType.c_str()))
- {
+ else if (0 == quotes_stricmp(g_pszXmlTypeDword, sType.c_str()))
+ {
tistringstream in(sValue.c_str());
in.imbue(GetSystemLocale());
in >> dbs.value.dVal;
- if(in.good() || in.eof())
+ if (in.good() || in.eof())
{
dbs.value.type = DBVT_DWORD;
- if(set_contact_settings(hContact,dbs))
+ if (set_contact_settings(hContact, dbs))
++cCreatedRecords;
}
}
- else if(0 == quotes_stricmp(g_pszXmlTypeAsciiz,sType.c_str()))
- {
+ else if (0 == quotes_stricmp(g_pszXmlTypeAsciiz, sType.c_str()))
+ {
CT2A v(sValue.c_str());
dbs.value.pszVal = v;
dbs.value.type = DBVT_ASCIIZ;
- if(set_contact_settings(hContact,dbs))
+ if (set_contact_settings(hContact, dbs))
++cCreatedRecords;
}
- else if(0 == quotes_stricmp(g_pszXmlTypeUtf8,sType.c_str()))
- {
+ else if (0 == quotes_stricmp(g_pszXmlTypeUtf8, sType.c_str()))
+ {
dbs.value.pszVal = mir_utf8encodeT(sValue.c_str());
dbs.value.type = DBVT_UTF8;
- if(set_contact_settings(hContact,dbs))
+ if (set_contact_settings(hContact, dbs))
++cCreatedRecords;
mir_free(dbs.value.pszVal);
}
- else if(0 == quotes_stricmp(g_pszXmlTypeWchar,sType.c_str()))
- {
+ else if (0 == quotes_stricmp(g_pszXmlTypeWchar, sType.c_str()))
+ {
CT2W val(sValue.c_str());
dbs.value.pwszVal = val;
dbs.value.type = DBVT_WCHAR;
- if(set_contact_settings(hContact,dbs))
+ if (set_contact_settings(hContact, dbs))
++cCreatedRecords;
mir_free(dbs.value.pwszVal);
}
- else if(0 == quotes_stricmp(g_pszXmlTypeBlob,sType.c_str()))
+ else if (0 == quotes_stricmp(g_pszXmlTypeBlob, sType.c_str()))
{
unsigned bufLen;
mir_ptr<BYTE> buf((PBYTE)mir_base64_decode(_T2A(sValue.c_str()), &bufLen));
- if(buf) {
+ if (buf) {
dbs.value.pbVal = buf;
dbs.value.cpbVal = (WORD)bufLen;
dbs.value.type = DBVT_BLOB;
- if(set_contact_settings(hContact,dbs))
+ if (set_contact_settings(hContact, dbs))
++cCreatedRecords;
}
}
- if ((true == bCListModule) && (0 == quotes_stricmp(sName.c_str(),_T("Group"))))
- CallService(MS_CLIST_GROUPCREATE,NULL,reinterpret_cast<LPARAM>(sValue.c_str()));
+ if ((true == bCListModule) && (0 == quotes_stricmp(sName.c_str(), _T("Group"))))
+ CallService(MS_CLIST_GROUPCREATE, NULL, reinterpret_cast<LPARAM>(sValue.c_str()));
}
}
- }
+ }
}
}
return true;
}
- size_t count_contacts(const IXMLNode::TXMLNodePtr& pXmlRoot,bool bInContactsGroup)
+ size_t count_contacts(const IXMLNode::TXMLNodePtr& pXmlRoot, bool bInContactsGroup)
{
size_t cContacts = 0;
size_t cChild = pXmlRoot->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IXMLNode::TXMLNodePtr pNode = pXmlRoot->GetChildNode(i);
tstring sName = pNode->GetName();
- if(false == bInContactsGroup)
+ if (false == bInContactsGroup)
{
- if(0 == quotes_stricmp(g_pszXmlContacts,sName.c_str()))
+ if (0 == quotes_stricmp(g_pszXmlContacts, sName.c_str()))
{
- cContacts += count_contacts(pNode,true);
+ cContacts += count_contacts(pNode, true);
}
else
{
- cContacts += count_contacts(pNode,false);
+ cContacts += count_contacts(pNode, false);
}
}
else
{
- if(0 == quotes_stricmp(g_pszXmlContact,sName.c_str()))
+ if (0 == quotes_stricmp(g_pszXmlContact, sName.c_str()))
{
- ++ cContacts;
+ ++cContacts;
}
}
}
@@ -476,7 +476,7 @@ namespace struct CImportContext
{
- CImportContext(size_t cTotalContacts) : m_cTotalContacts(cTotalContacts),m_cHandledContacts(0),m_nFlags(0){}
+ CImportContext(size_t cTotalContacts) : m_cTotalContacts(cTotalContacts), m_cHandledContacts(0), m_nFlags(0){}
size_t m_cTotalContacts;
size_t m_cHandledContacts;
@@ -485,7 +485,7 @@ namespace struct CContactState
{
- CContactState() : m_hContact(NULL),m_bNewContact(false){}
+ CContactState() : m_hContact(NULL), m_bNewContact(false){}
MCONTACT m_hContact;
CQuotesProviders::TQuotesProviderPtr m_pProvider;
bool m_bNewContact;
@@ -493,16 +493,16 @@ namespace IXMLNode::TXMLNodePtr find_quotes_module(const IXMLNode::TXMLNodePtr& pXmlContact)
{
-// USES_CONVERSION;
-// LPCTSTR pszQuotes = A2T(QUOTES_MODULE_NAME);
+ // USES_CONVERSION;
+ // LPCTSTR pszQuotes = A2T(QUOTES_MODULE_NAME);
static const tstring g_sQuotes = quotes_a2t(QUOTES_MODULE_NAME);
size_t cChild = pXmlContact->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IXMLNode::TXMLNodePtr pNode = pXmlContact->GetChildNode(i);
tstring sName = pNode->GetName();
- if ((0 == quotes_stricmp(g_pszXmlModule,sName.c_str()))
- && (0 == quotes_stricmp(g_sQuotes.c_str(),pNode->GetText().c_str())))
+ if ((0 == quotes_stricmp(g_pszXmlModule, sName.c_str()))
+ && (0 == quotes_stricmp(g_sQuotes.c_str(), pNode->GetText().c_str())))
{
return pNode;
}
@@ -511,44 +511,44 @@ namespace return IXMLNode::TXMLNodePtr();
}
- typedef std::pair<tstring,tstring> TNameValue;//first is name,second is value
+ typedef std::pair<tstring, tstring> TNameValue;//first is name,second is value
TNameValue parse_setting_node(const IXMLNode::TXMLNodePtr& pXmlSetting)
{
assert(pXmlSetting);
-
- tstring sName,sValue;
+
+ tstring sName, sValue;
size_t cSettingChildItems = pXmlSetting->GetChildCount();
- for(size_t j = 0;j < cSettingChildItems;++j)
+ for (size_t j = 0; j < cSettingChildItems; ++j)
{
IXMLNode::TXMLNodePtr pXMLSetChild = pXmlSetting->GetChildNode(j);
- if(pXMLSetChild)
+ if (pXMLSetChild)
{
- if(0 == quotes_stricmp(g_pszXmlName,pXMLSetChild->GetName().c_str()))
+ if (0 == quotes_stricmp(g_pszXmlName, pXMLSetChild->GetName().c_str()))
{
sName = pXMLSetChild->GetText();
}
- else if(0 == quotes_stricmp(g_pszXmlValue,pXMLSetChild->GetName().c_str()))
+ else if (0 == quotes_stricmp(g_pszXmlValue, pXMLSetChild->GetName().c_str()))
{
sValue = pXMLSetChild->GetText();
}
}
}
- return std::make_pair(sName,sValue);
+ return std::make_pair(sName, sValue);
}
CQuotesProviders::TQuotesProviderPtr find_provider(const IXMLNode::TXMLNodePtr& pXmlQuotesModule)
{
-// USES_CONVERSION;
+ // USES_CONVERSION;
static const tstring g_sQuotesProvider = quotes_a2t(DB_STR_QUOTE_PROVIDER);//A2CT(DB_STR_QUOTE_PROVIDER);
size_t cChild = pXmlQuotesModule->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IXMLNode::TXMLNodePtr pXMLSetting = pXmlQuotesModule->GetChildNode(i);
- if(pXMLSetting && (0 == quotes_stricmp(g_pszXmlSetting,pXMLSetting->GetName().c_str())))
+ if (pXMLSetting && (0 == quotes_stricmp(g_pszXmlSetting, pXMLSetting->GetName().c_str())))
{
TNameValue Item = parse_setting_node(pXMLSetting);
- if ((0 == quotes_stricmp(g_sQuotesProvider.c_str(),Item.first.c_str())) && (false == Item.second.empty()))
+ if ((0 == quotes_stricmp(g_sQuotesProvider.c_str(), Item.first.c_str())) && (false == Item.second.empty()))
{
return CModuleInfo::GetInstance().GetQuoteProvidersPtr()->FindProvider(Item.second);
}
@@ -558,21 +558,21 @@ namespace return CQuotesProviders::TQuotesProviderPtr();
}
- bool get_contact_state(const IXMLNode::TXMLNodePtr& pXmlContact,CContactState& cst)
+ bool get_contact_state(const IXMLNode::TXMLNodePtr& pXmlContact, CContactState& cst)
{
class visitor : public CQuotesProviderVisitor
{
public:
- visitor(const IXMLNode::TXMLNodePtr& pXmlQuotes)
- : m_hContact(NULL),m_pXmlQuotes(pXmlQuotes){}
+ visitor(const IXMLNode::TXMLNodePtr& pXmlQuotes)
+ : m_hContact(NULL), m_pXmlQuotes(pXmlQuotes){}
- MCONTACT GetContact()const{return m_hContact;}
+ MCONTACT GetContact()const{ return m_hContact; }
private:
virtual void Visit(const CQuotesProviderDukasCopy& rProvider)
{
tstring sQuoteID = GetXMLNodeValue(DB_STR_QUOTE_ID);
- if(false == sQuoteID.empty())
+ if (false == sQuoteID.empty())
{
m_hContact = rProvider.GetContactByQuoteID(sQuoteID);
}
@@ -580,24 +580,24 @@ namespace virtual void Visit(const CQuotesProviderGoogle& rProvider)
{
-// USES_CONVERSION;
+ // USES_CONVERSION;
static const tstring g_sFromID = quotes_a2t(DB_STR_FROM_ID);//A2CT(DB_STR_FROM_ID);
static const tstring g_sToID = quotes_a2t(DB_STR_TO_ID);//A2CT(DB_STR_TO_ID);
tstring sFromID;
tstring sToID;
size_t cChild = m_pXmlQuotes->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IXMLNode::TXMLNodePtr pNode = m_pXmlQuotes->GetChildNode(i);
- if(pNode && (0 == quotes_stricmp(g_pszXmlSetting, pNode->GetName().c_str())))
+ if (pNode && (0 == quotes_stricmp(g_pszXmlSetting, pNode->GetName().c_str())))
{
TNameValue Item = parse_setting_node(pNode);
- if(0 == quotes_stricmp(g_sFromID.c_str(),Item.first.c_str()))
+ if (0 == quotes_stricmp(g_sFromID.c_str(), Item.first.c_str()))
{
sFromID = Item.second;
}
- else if(0 == quotes_stricmp(g_sToID.c_str(),Item.first.c_str()))
+ else if (0 == quotes_stricmp(g_sToID.c_str(), Item.first.c_str()))
{
sToID = Item.second;
}
@@ -606,14 +606,14 @@ namespace if ((false == sFromID.empty()) && (false == sToID.empty()))
{
- m_hContact = rProvider.GetContactByID(sFromID,sToID);
+ m_hContact = rProvider.GetContactByID(sFromID, sToID);
}
}
virtual void Visit(const CQuotesProviderFinance& rProvider)
{
tstring sQuoteID = GetXMLNodeValue(DB_STR_QUOTE_ID);
- if(false == sQuoteID.empty())
+ if (false == sQuoteID.empty())
{
m_hContact = rProvider.GetContactByQuoteID(sQuoteID);
}
@@ -621,18 +621,18 @@ namespace tstring GetXMLNodeValue(const char* pszXMLNodeName)const
{
-// USES_CONVERSION;
+ // USES_CONVERSION;
tstring sXMLNodeName = quotes_a2t(pszXMLNodeName);//A2CT(pszXMLNodeName);
tstring sValue;
size_t cChild = m_pXmlQuotes->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IXMLNode::TXMLNodePtr pNode = m_pXmlQuotes->GetChildNode(i);
- if(pNode && (0 == quotes_stricmp(g_pszXmlSetting, pNode->GetName().c_str())))
+ if (pNode && (0 == quotes_stricmp(g_pszXmlSetting, pNode->GetName().c_str())))
{
TNameValue Item = parse_setting_node(pNode);
- if(0 == quotes_stricmp(Item.first.c_str(),sXMLNodeName.c_str()))
+ if (0 == quotes_stricmp(Item.first.c_str(), sXMLNodeName.c_str()))
{
sValue = Item.second;
break;
@@ -649,10 +649,10 @@ namespace };
IXMLNode::TXMLNodePtr pXmlQuotes = find_quotes_module(pXmlContact);
- if(pXmlQuotes)
+ if (pXmlQuotes)
{
cst.m_pProvider = find_provider(pXmlQuotes);
- if(cst.m_pProvider)
+ if (cst.m_pProvider)
{
visitor vs(pXmlQuotes);
cst.m_pProvider->Accept(vs);
@@ -664,38 +664,38 @@ namespace return false;
}
- bool import_contact(const IXMLNode::TXMLNodePtr& pXmlContact,CImportContext& impctx)
+ bool import_contact(const IXMLNode::TXMLNodePtr& pXmlContact, CImportContext& impctx)
{
- ++ impctx.m_cHandledContacts;
+ ++impctx.m_cHandledContacts;
CContactState cst;
- bool bResult = get_contact_state(pXmlContact,cst);
- if(bResult)
+ bool bResult = get_contact_state(pXmlContact, cst);
+ if (bResult)
{
- if(NULL == cst.m_hContact)
+ if (NULL == cst.m_hContact)
{
- cst.m_hContact = MCONTACT(CallService(MS_DB_CONTACT_ADD,0,0));
+ cst.m_hContact = MCONTACT(CallService(MS_DB_CONTACT_ADD, 0, 0));
cst.m_bNewContact = true;
}
- else if(impctx.m_nFlags"ES_IMPORT_SKIP_EXISTING_CONTACTS)
+ else if (impctx.m_nFlags"ES_IMPORT_SKIP_EXISTING_CONTACTS)
{
return true;
}
- if(cst.m_hContact)
+ if (cst.m_hContact)
{
size_t cChild = pXmlContact->GetChildCount();
- for(size_t i = 0;i < cChild && bResult;++i)
+ for (size_t i = 0; i < cChild && bResult; ++i)
{
IXMLNode::TXMLNodePtr pNode = pXmlContact->GetChildNode(i);
tstring sName = pNode->GetName();
- if(0 == quotes_stricmp(g_pszXmlModule,sName.c_str()))
+ if (0 == quotes_stricmp(g_pszXmlModule, sName.c_str()))
{
- bResult &= handle_module(cst.m_hContact,pNode,impctx.m_nFlags);
+ bResult &= handle_module(cst.m_hContact, pNode);
}
}
- if(cst.m_bNewContact && bResult)
+ if (cst.m_bNewContact && bResult)
{
cst.m_pProvider->AddContact(cst.m_hContact);
cst.m_pProvider->RefreshContact(cst.m_hContact);
@@ -711,19 +711,19 @@ namespace }
- size_t import_contacts(const IXMLNode::TXMLNodePtr& pXmlContacts,CImportContext& impctx)
+ size_t import_contacts(const IXMLNode::TXMLNodePtr& pXmlContacts, CImportContext& impctx)
{
size_t cContacts = 0;
size_t cChild = pXmlContacts->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IXMLNode::TXMLNodePtr pNode = pXmlContacts->GetChildNode(i);
tstring sName = pNode->GetName();
- if(0 == quotes_stricmp(g_pszXmlContact,sName.c_str()))
+ if (0 == quotes_stricmp(g_pszXmlContact, sName.c_str()))
{
- if(true == import_contact(pNode,impctx))
+ if (true == import_contact(pNode, impctx))
{
- ++ cContacts;
+ ++cContacts;
}
}
}
@@ -732,21 +732,21 @@ namespace }
- size_t handle_contacts_node(const IXMLNode::TXMLNodePtr& pXmlRoot,CImportContext& impctx)
+ size_t handle_contacts_node(const IXMLNode::TXMLNodePtr& pXmlRoot, CImportContext& impctx)
{
size_t cContacts = 0;
size_t cChild = pXmlRoot->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IXMLNode::TXMLNodePtr pNode = pXmlRoot->GetChildNode(i);
tstring sName = pNode->GetName();
- if(0 == quotes_stricmp(g_pszXmlContacts,sName.c_str()))
+ if (0 == quotes_stricmp(g_pszXmlContacts, sName.c_str()))
{
- cContacts += import_contacts(pNode,impctx);
+ cContacts += import_contacts(pNode, impctx);
}
else
{
- cContacts += handle_contacts_node(pNode,impctx);
+ cContacts += handle_contacts_node(pNode, impctx);
}
}
@@ -754,52 +754,52 @@ namespace }
- bool do_import(const IXMLNode::TXMLNodePtr& pXmlRoot,UINT nFlags)
+ bool do_import(const IXMLNode::TXMLNodePtr& pXmlRoot, UINT nFlags)
{
- CImportContext imctx(count_contacts(pXmlRoot,false));
+ CImportContext imctx(count_contacts(pXmlRoot, false));
imctx.m_cHandledContacts = 0;
imctx.m_nFlags = nFlags;
- return (handle_contacts_node(pXmlRoot,imctx) > 0);
+ return (handle_contacts_node(pXmlRoot, imctx) > 0);
}
}
-INT_PTR Quotes_Import(WPARAM wp,LPARAM lp)
+INT_PTR Quotes_Import(WPARAM wp, LPARAM lp)
{
-// USES_CONVERSION;
+ // USES_CONVERSION;
tstring sFileName;
const char* pszFile = reinterpret_cast<const char*>(lp);
- if(NULL == pszFile)
+ if (NULL == pszFile)
{
- if(false == show_open_file_dialog(true,sFileName))
+ if (false == show_open_file_dialog(true, sFileName))
{
return -1;
}
}
else
- {
+ {
sFileName = quotes_a2t(pszFile);//A2CT(pszFile);
- }
+ }
CModuleInfo::TXMLEnginePtr pXmlEngine = CModuleInfo::GetInstance().GetXMLEnginePtr();
IXMLNode::TXMLNodePtr pXmlRoot = pXmlEngine->LoadFile(sFileName);
- if(pXmlRoot)
+ if (pXmlRoot)
{
- return ((true == do_import(pXmlRoot,wp)) ? 0 : 1);
+ return ((true == do_import(pXmlRoot, wp)) ? 0 : 1);
}
return 1;
}
#ifdef TEST_IMPORT_EXPORT
-INT_PTR QuotesMenu_ImportAll(WPARAM wp,LPARAM lp)
+INT_PTR QuotesMenu_ImportAll(WPARAM, LPARAM)
{
- return CallService(MS_QUOTES_IMPORT,0,0);
+ return CallService(MS_QUOTES_IMPORT, 0, 0);
}
-INT_PTR QuotesMenu_ExportAll(WPARAM wp,LPARAM lp)
+INT_PTR QuotesMenu_ExportAll(WPARAM, LPARAM)
{
- return CallService(MS_QUOTES_EXPORT,0,0);
+ return CallService(MS_QUOTES_EXPORT, 0, 0);
}
#endif
diff --git a/plugins/Quotes/src/ImportExport.h b/plugins/Quotes/src/ImportExport.h index da2053e9a3..a04ac64eca 100644 --- a/plugins/Quotes/src/ImportExport.h +++ b/plugins/Quotes/src/ImportExport.h @@ -1,11 +1,11 @@ #ifndef __F86374E6_713C_4600_85FB_903A5CDF7251_IMPORT_EXPORT_H__
#define __F86374E6_713C_4600_85FB_903A5CDF7251_IMPORT_EXPORT_H__
-INT_PTR Quotes_Export(WPARAM wp,LPARAM lp);
-INT_PTR Quotes_Import(WPARAM wp,LPARAM lp);
+INT_PTR Quotes_Export(WPARAM wp, LPARAM lp);
+INT_PTR Quotes_Import(WPARAM wp, LPARAM lp);
#ifdef TEST_IMPORT_EXPORT
-INT_PTR QuotesMenu_ImportAll(WPARAM wp,LPARAM lp);
-INT_PTR QuotesMenu_ExportAll(WPARAM wp,LPARAM lp);
+INT_PTR QuotesMenu_ImportAll(WPARAM wp, LPARAM lp);
+INT_PTR QuotesMenu_ExportAll(WPARAM wp, LPARAM lp);
#endif
#endif //__F86374E6_713C_4600_85FB_903A5CDF7251_IMPORT_EXPORT_H__
diff --git a/plugins/Quotes/src/IsWithinAccuracy.h b/plugins/Quotes/src/IsWithinAccuracy.h index 5e39281719..2430cd8675 100644 --- a/plugins/Quotes/src/IsWithinAccuracy.h +++ b/plugins/Quotes/src/IsWithinAccuracy.h @@ -3,12 +3,12 @@ inline bool IsWithinAccuracy(double dValue1, double dValue2, double dAccuracy = 1e-4)
{
- double dDifference = dValue1 - dValue2 ;
+ double dDifference = dValue1 - dValue2;
if ((-dAccuracy <= dDifference) && (dDifference <= dAccuracy))
- return true ;
+ return true;
else
- return false ;
+ return false;
}
diff --git a/plugins/Quotes/src/Locale.cpp b/plugins/Quotes/src/Locale.cpp index 25584e360a..fe1427dac7 100644 --- a/plugins/Quotes/src/Locale.cpp +++ b/plugins/Quotes/src/Locale.cpp @@ -12,24 +12,24 @@ namespace tstring sResult;
HKEY hKey = NULL;
LONG lResult = ::RegOpenKeyEx(HKEY_CURRENT_USER,
- _T("Control Panel\\International"),0,KEY_QUERY_VALUE,&hKey);
+ _T("Control Panel\\International"), 0, KEY_QUERY_VALUE, &hKey);
if ((ERROR_SUCCESS == lResult) && (NULL != hKey))
{
DWORD dwType = 0;
DWORD dwSize = 0;
- lResult = ::RegQueryValueEx(hKey,pszValueName,nullptr,&dwType,nullptr,&dwSize);
+ lResult = ::RegQueryValueEx(hKey, pszValueName, nullptr, &dwType, nullptr, &dwSize);
if ((ERROR_SUCCESS == lResult) && ((REG_SZ == dwType) || (REG_EXPAND_SZ == dwType)))
{
std::vector<TCHAR> aBuffer(dwSize);
- lResult = ::RegQueryValueEx(hKey,pszValueName,nullptr,nullptr,reinterpret_cast<LPBYTE>(&*aBuffer.begin()),&dwSize);
- if(ERROR_SUCCESS == lResult)
+ lResult = ::RegQueryValueEx(hKey, pszValueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(&*aBuffer.begin()), &dwSize);
+ if (ERROR_SUCCESS == lResult)
{
- std::copy(aBuffer.begin(),aBuffer.end(),std::back_inserter(sResult));
+ std::copy(aBuffer.begin(), aBuffer.end(), std::back_inserter(sResult));
}
}
}
- if(NULL != hKey)
+ if (NULL != hKey)
{
lResult = ::RegCloseKey(hKey);
assert(ERROR_SUCCESS == lResult);
@@ -41,11 +41,11 @@ namespace tstring date_win_2_boost(const tstring& sFrmt)
{
tstring sResult(_T("%d.%m.%y"));
- if(sFrmt == _T("dd/MM/yy"))
+ if (sFrmt == _T("dd/MM/yy"))
{
sResult = _T("%d/%m/%y");
}
- else if(sFrmt == _T("yyyy-MM-dd"))
+ else if (sFrmt == _T("yyyy-MM-dd"))
{
sResult = _T("%y-%m-%d");
}
@@ -55,7 +55,7 @@ namespace tstring time_win_2_boost(const tstring& sFrmt)
{
tstring sResult = _T("%H:%M:%S");
- if(sFrmt == _T("H:mm") || sFrmt == _T("HH:mm"))
+ if (sFrmt == _T("H:mm") || sFrmt == _T("HH:mm"))
{
sResult = _T("%H:%M");
}
diff --git a/plugins/Quotes/src/Log.cpp b/plugins/Quotes/src/Log.cpp index 250ca58497..844ffc7385 100644 --- a/plugins/Quotes/src/Log.cpp +++ b/plugins/Quotes/src/Log.cpp @@ -14,39 +14,39 @@ namespace #ifdef _DEBUG
return true;
#else
- return (1 == db_get_b(NULL,QUOTES_PROTOCOL_NAME,DB_STR_ENABLE_LOG,false));
+ return (1 == db_get_b(NULL, QUOTES_PROTOCOL_NAME, DB_STR_ENABLE_LOG, false));
#endif
}
- void do_log(const tstring& rsFileName,ESeverity nSeverity,const tstring& rsMsg)
+ void do_log(const tstring& rsFileName, const tstring& rsMsg)
{
CGuard<CLightMutex> guard(g_Mutex);
- tofstream file(rsFileName.c_str(),std::ios::ate|std::ios::app);
- if(file.good())
+ tofstream file(rsFileName.c_str(), std::ios::ate | std::ios::app);
+ if (file.good())
{
TCHAR szTime[20];
-// TCHAR sz[10000+1];
+ // TCHAR sz[10000+1];
_tstrtime_s(szTime);
file << szTime << _T(" ================================>\n") << rsMsg << _T("\n\n");
-
-// size_t cBytes = rsMsg.size();
-// const TCHAR* p = rsMsg.c_str();
-// for(size_t c = 0;c < cBytes;c += 10000,p+=10000)
-// {
-// _tcsncpy_s(sz,p,10000);
-// file << sz;
-// }
-//
-// file << "\n\n";
+
+ // size_t cBytes = rsMsg.size();
+ // const TCHAR* p = rsMsg.c_str();
+ // for(size_t c = 0;c < cBytes;c += 10000,p+=10000)
+ // {
+ // _tcsncpy_s(sz,p,10000);
+ // file << sz;
+ // }
+ //
+ // file << "\n\n";
}
}
}
-void LogIt(ESeverity nSeverity,const tstring& rsMsg)
+void LogIt(const tstring& rsMsg)
{
- if(is_log_enabled())
+ if (is_log_enabled())
{
tstring sFileName = get_log_file_name();
- do_log(sFileName,nSeverity,rsMsg);
+ do_log(sFileName, rsMsg);
}
}
diff --git a/plugins/Quotes/src/Log.h b/plugins/Quotes/src/Log.h index 274fcfec06..00d1cc76e3 100644 --- a/plugins/Quotes/src/Log.h +++ b/plugins/Quotes/src/Log.h @@ -8,6 +8,6 @@ enum ESeverity Error
};
-void LogIt(ESeverity nSeverity,const tstring& rsMsg);
+void LogIt(const tstring& rsMsg);
#endif //__653719be_16d6_4058_8555_8aa7d5404214_OutputDlg_h__
diff --git a/plugins/Quotes/src/ModuleInfo.cpp b/plugins/Quotes/src/ModuleInfo.cpp index 27850fd8ef..980a5241bc 100644 --- a/plugins/Quotes/src/ModuleInfo.cpp +++ b/plugins/Quotes/src/ModuleInfo.cpp @@ -7,8 +7,8 @@ namespace CLightMutex g_lmParsers;
}
-CModuleInfo::CModuleInfo()
- : m_bExtendedStatusInfo(1 == db_get_b(NULL,QUOTES_MODULE_NAME,"ExtendedStatus",false))
+CModuleInfo::CModuleInfo()
+ : m_bExtendedStatusInfo(1 == db_get_b(NULL, QUOTES_MODULE_NAME, "ExtendedStatus", false))
{
}
@@ -22,29 +22,29 @@ CModuleInfo& CModuleInfo::GetInstance() return mi;
}
-HANDLE CModuleInfo::GetWindowList(const std::string& rsKey,bool bAllocateIfNonExist /*= true*/)
+HANDLE CModuleInfo::GetWindowList(const std::string& rsKey, bool bAllocateIfNonExist /*= true*/)
{
HANDLE hResult = NULL;
THandles::const_iterator i = m_ahWindowLists.find(rsKey);
- if(i != m_ahWindowLists.end())
+ if (i != m_ahWindowLists.end())
{
hResult = i->second;
}
- else if(bAllocateIfNonExist)
+ else if (bAllocateIfNonExist)
{
hResult = WindowList_Create();
- if(hResult)
- m_ahWindowLists.insert(std::make_pair(rsKey,hResult));
+ if (hResult)
+ m_ahWindowLists.insert(std::make_pair(rsKey, hResult));
}
return hResult;
-}
+}
void CModuleInfo::OnMirandaShutdown()
{
- BOOST_FOREACH(THandles::value_type p,m_ahWindowLists)
+ BOOST_FOREACH(THandles::value_type p, m_ahWindowLists)
{
- WindowList_Broadcast(p.second,WM_CLOSE,0,0);
+ WindowList_Broadcast(p.second, WM_CLOSE, 0, 0);
}
}
@@ -95,17 +95,17 @@ void CModuleInfo::SetHTMLEngine(THTMLEnginePtr pEngine) bool CModuleInfo::Verify()
{
- INITCOMMONCONTROLSEX icc = {0};
+ INITCOMMONCONTROLSEX icc = { 0 };
icc.dwSize = sizeof(icc);
- icc.dwICC = ICC_WIN95_CLASSES|ICC_LINK_CLASS;
- if(FALSE == ::InitCommonControlsEx(&icc))
+ icc.dwICC = ICC_WIN95_CLASSES | ICC_LINK_CLASS;
+ if (FALSE == ::InitCommonControlsEx(&icc))
{
return false;
}
if (!GetXMLEnginePtr())
{
- Quotes_MessageBox(NULL,TranslateT("Miranda could not load Quotes plugin. XML parser is missing."),MB_OK|MB_ICONERROR);
+ Quotes_MessageBox(NULL, TranslateT("Miranda could not load Quotes plugin. XML parser is missing."), MB_OK | MB_ICONERROR);
return false;
}
@@ -113,7 +113,7 @@ bool CModuleInfo::Verify() {
Quotes_MessageBox(NULL,
TranslateT("Miranda could not load Quotes plugin. Microsoft HTML parser is missing."),
- MB_YESNO|MB_ICONQUESTION);
+ MB_YESNO | MB_ICONQUESTION);
return false;
}
diff --git a/plugins/Quotes/src/ModuleInfo.h b/plugins/Quotes/src/ModuleInfo.h index 2882dfae6d..6f4676bb1a 100644 --- a/plugins/Quotes/src/ModuleInfo.h +++ b/plugins/Quotes/src/ModuleInfo.h @@ -21,7 +21,7 @@ public: static CModuleInfo& GetInstance();
void OnMirandaShutdown();
- HANDLE GetWindowList(const std::string& rsKey,bool bAllocateIfNonExist = true);
+ HANDLE GetWindowList(const std::string& rsKey, bool bAllocateIfNonExist = true);
bool GetExtendedStatusFlag()const;
static bool Verify();
@@ -29,13 +29,13 @@ public: static TQuotesProvidersPtr GetQuoteProvidersPtr();
static TXMLEnginePtr GetXMLEnginePtr();
-// static void SetXMLEnginePtr(TXMLEnginePtr pEngine);
+ // static void SetXMLEnginePtr(TXMLEnginePtr pEngine);
static THTMLEnginePtr GetHTMLEngine();
static void SetHTMLEngine(THTMLEnginePtr pEngine);
private:
- typedef std::map<std::string,HANDLE> THandles;
+ typedef std::map<std::string, HANDLE> THandles;
THandles m_ahWindowLists;
bool m_bExtendedStatusInfo;
};
diff --git a/plugins/Quotes/src/OptionDukasCopy.cpp b/plugins/Quotes/src/OptionDukasCopy.cpp index 9f2397020c..074b545f14 100644 --- a/plugins/Quotes/src/OptionDukasCopy.cpp +++ b/plugins/Quotes/src/OptionDukasCopy.cpp @@ -26,32 +26,32 @@ namespace int nImage,
LPARAM lp = 0)
{
-// USES_CONVERSION;
+ // USES_CONVERSION;
TVINSERTSTRUCT tvi;
memset(&tvi, 0, sizeof(tvi));
tvi.hParent = htiParent;
tvi.hInsertAfter = TVI_LAST;
- tvi.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
+ tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+
+ // CA2T name(rsName.c_str());
-// CA2T name(rsName.c_str());
-
tvi.item.pszText = const_cast<LPTSTR>(rsName.c_str());//name;
tvi.item.lParam = lp;
tvi.item.iImage = nImage;
tvi.item.iSelectedImage = nImage;
- return TreeView_InsertItem(hwndTree,&tvi);
+ return TreeView_InsertItem(hwndTree, &tvi);
}
- bool add_quote_to_tree(const CQuotesProviderDukasCopy::CQuote& q,HWND hwndTree,HTREEITEM htiParent,const CQuotesProviderDukasCopy* pQuotesProvier)
+ bool add_quote_to_tree(const CQuotesProviderDukasCopy::CQuote& q, HWND hwndTree, HTREEITEM htiParent, const CQuotesProviderDukasCopy* pQuotesProvier)
{
bool bChecked = pQuotesProvier->IsQuoteWatched(q);
- HTREEITEM hti = tree_insert_item(hwndTree,((false == q.GetName().empty()) ? q.GetName() : q.GetSymbol()),htiParent,IMAGE_INDEX_QUOTE);
- if(hti && bChecked)
+ HTREEITEM hti = tree_insert_item(hwndTree, ((false == q.GetName().empty()) ? q.GetName() : q.GetSymbol()), htiParent, IMAGE_INDEX_QUOTE);
+ if (hti && bChecked)
{
HWND hDlg = ::GetParent(hwndTree);
assert(::IsWindow(hDlg));
- ::PostMessage(hDlg,TREE_VIEW_CHECK_STATE_CHANGE,MAKEWPARAM(0,TCBS_CHECKED),reinterpret_cast<LPARAM>(hti));
+ ::PostMessage(hDlg, TREE_VIEW_CHECK_STATE_CHANGE, MAKEWPARAM(0, TCBS_CHECKED), reinterpret_cast<LPARAM>(hti));
}
return (NULL != hti && bChecked);
@@ -67,78 +67,78 @@ namespace {
rbIsChecked = false;
rbIsExpended = false;
- HTREEITEM hti = tree_insert_item(hwndTree,qs.GetName(),htiParent,IMAGE_INDEX_SECTION);
+ HTREEITEM hti = tree_insert_item(hwndTree, qs.GetName(), htiParent, IMAGE_INDEX_SECTION);
size_t cCheckedItems = 0;
size_t cSection = qs.GetSectionCount();
- for(size_t i = 0;i < cSection;++i)
+ for (size_t i = 0; i < cSection; ++i)
{
bool bIsChecked = false;
bool bIsExpanded = false;
CQuotesProviderDukasCopy::CQuoteSection other = qs.GetSection(i);
- add_section_to_tree(other,hwndTree,hti,pQuotesProvier,bIsChecked,bIsExpanded);
+ add_section_to_tree(other, hwndTree, hti, pQuotesProvier, bIsChecked, bIsExpanded);
- if(bIsChecked)
+ if (bIsChecked)
{
++cCheckedItems;
}
- if(bIsExpanded)
+ if (bIsExpanded)
{
bExpand = true;
}
}
size_t cQuotes = qs.GetQuoteCount();
- for(size_t i = 0;i < cQuotes;++i)
+ for (size_t i = 0; i < cQuotes; ++i)
{
CQuotesProviderDukasCopy::CQuote q = qs.GetQuote(i);
- if(true == add_quote_to_tree(q,hwndTree,hti,pQuotesProvier))
+ if (true == add_quote_to_tree(q, hwndTree, hti, pQuotesProvier))
{
- ++ cCheckedItems;
+ ++cCheckedItems;
}
}
- if(bExpand || cCheckedItems > 0)
+ if (bExpand || cCheckedItems > 0)
{
rbIsExpended = true;
- TreeView_Expand(hwndTree,hti,TVE_EXPAND);
+ TreeView_Expand(hwndTree, hti, TVE_EXPAND);
}
- if(cCheckedItems == (cSection+cQuotes))
+ if (cCheckedItems == (cSection + cQuotes))
{
rbIsChecked = true;
HWND hDlg = ::GetParent(hwndTree);
assert(::IsWindow(hDlg));
- ::PostMessage(hDlg,TREE_VIEW_CHECK_STATE_CHANGE,MAKEWPARAM(0,TCBS_CHECKED),reinterpret_cast<LPARAM>(hti));
+ ::PostMessage(hDlg, TREE_VIEW_CHECK_STATE_CHANGE, MAKEWPARAM(0, TCBS_CHECKED), reinterpret_cast<LPARAM>(hti));
}
}
- void add_provider_to_tree(const CQuotesProviderDukasCopy* pQuotesProvier,HWND hwndTree)
+ void add_provider_to_tree(const CQuotesProviderDukasCopy* pQuotesProvier, HWND hwndTree)
{
CQuotesProviderDukasCopy::CQuoteSection qs = pQuotesProvier->GetQuotes();
bool bIsChecked = false;
bool bIsExpanded = false;
- add_section_to_tree(qs,hwndTree,TVI_ROOT,pQuotesProvier,bIsChecked,bIsExpanded,true);
+ add_section_to_tree(qs, hwndTree, TVI_ROOT, pQuotesProvier, bIsChecked, bIsExpanded, true);
}
- inline HTREEITEM tree_get_child_item(HWND hwndTree,HTREEITEM hti)
+ inline HTREEITEM tree_get_child_item(HWND hwndTree, HTREEITEM hti)
{
- return reinterpret_cast<HTREEITEM>(::SendMessage(hwndTree, TVM_GETNEXTITEM, TVGN_CHILD,reinterpret_cast<LPARAM>(hti)));
+ return reinterpret_cast<HTREEITEM>(::SendMessage(hwndTree, TVM_GETNEXTITEM, TVGN_CHILD, reinterpret_cast<LPARAM>(hti)));
}
- inline HTREEITEM tree_get_next_sibling_item(HWND hwndTree,HTREEITEM hti)
+ inline HTREEITEM tree_get_next_sibling_item(HWND hwndTree, HTREEITEM hti)
{
- return reinterpret_cast<HTREEITEM>(::SendMessage(hwndTree, TVM_GETNEXTITEM, TVGN_NEXT,reinterpret_cast<LPARAM>(hti)));
+ return reinterpret_cast<HTREEITEM>(::SendMessage(hwndTree, TVM_GETNEXTITEM, TVGN_NEXT, reinterpret_cast<LPARAM>(hti)));
}
- inline ETreeCheckBoxState tree_get_state_image(HWND hwndTree,HTREEITEM hti)
+ inline ETreeCheckBoxState tree_get_state_image(HWND hwndTree, HTREEITEM hti)
{
TVITEM tvi;
tvi.hItem = hti;
- tvi.mask = TVIF_STATE|TVIF_HANDLE;
+ tvi.mask = TVIF_STATE | TVIF_HANDLE;
tvi.stateMask = TVIS_STATEIMAGEMASK;
- if(TRUE == ::SendMessage(hwndTree,TVM_GETITEM,0,reinterpret_cast<LPARAM>(&tvi)))
+ if (TRUE == ::SendMessage(hwndTree, TVM_GETITEM, 0, reinterpret_cast<LPARAM>(&tvi)))
{
UINT nState = (tvi.state >> 12);
return static_cast<ETreeCheckBoxState>(nState);
@@ -149,61 +149,61 @@ namespace }
}
- void tree_do_set_item_state(HWND hwndTree,HTREEITEM hti,ETreeCheckBoxState nState)
+ void tree_do_set_item_state(HWND hwndTree, HTREEITEM hti, ETreeCheckBoxState nState)
{
TVITEM tvi;
memset(&tvi, 0, sizeof(tvi));
- tvi.mask = TVIF_STATE|TVIF_HANDLE;
+ tvi.mask = TVIF_STATE | TVIF_HANDLE;
tvi.hItem = hti;
tvi.stateMask = TVIS_STATEIMAGEMASK;
tvi.state = INDEXTOSTATEIMAGEMASK(nState);
- ::SendMessage(hwndTree,TVM_SETITEM,0,reinterpret_cast<LPARAM>(&tvi));
+ ::SendMessage(hwndTree, TVM_SETITEM, 0, reinterpret_cast<LPARAM>(&tvi));
}
- void tree_set_item_state(HWND hwndTree,HTREEITEM hti,ETreeCheckBoxState nState,bool bRecursively)
+ void tree_set_item_state(HWND hwndTree, HTREEITEM hti, ETreeCheckBoxState nState, bool bRecursively)
{
- if(true == bRecursively)
+ if (true == bRecursively)
{
- for(hti = tree_get_child_item(hwndTree,hti);hti;hti = tree_get_next_sibling_item(hwndTree,hti))
+ for (hti = tree_get_child_item(hwndTree, hti); hti; hti = tree_get_next_sibling_item(hwndTree, hti))
{
- tree_do_set_item_state(hwndTree,hti,nState);
- tree_set_item_state(hwndTree,hti,nState,bRecursively);
+ tree_do_set_item_state(hwndTree, hti, nState);
+ tree_set_item_state(hwndTree, hti, nState, bRecursively);
}
}
else
{
- tree_do_set_item_state(hwndTree,hti,nState);
+ tree_do_set_item_state(hwndTree, hti, nState);
}
}
- void save_quote_selection(HWND hwndTree,HTREEITEM h,const CQuotesProviderDukasCopy::CQuote& q,CQuotesProviderDukasCopy* pQuotesProvier)
+ void save_quote_selection(HWND hwndTree, HTREEITEM h, const CQuotesProviderDukasCopy::CQuote& q, CQuotesProviderDukasCopy* pQuotesProvier)
{
- ETreeCheckBoxState nState = tree_get_state_image(hwndTree,h);
- pQuotesProvier->WatchForQuote(q,(TCBS_CHECKED == nState));
+ ETreeCheckBoxState nState = tree_get_state_image(hwndTree, h);
+ pQuotesProvier->WatchForQuote(q, (TCBS_CHECKED == nState));
}
- void recursive_save_quote_section_selection(HWND hwndTree,HTREEITEM h,const CQuotesProviderDukasCopy::CQuoteSection& qs,CQuotesProviderDukasCopy* pQuotesProvier)
+ void recursive_save_quote_section_selection(HWND hwndTree, HTREEITEM h, const CQuotesProviderDukasCopy::CQuoteSection& qs, CQuotesProviderDukasCopy* pQuotesProvier)
{
size_t cSection = qs.GetSectionCount();
- h = tree_get_child_item(hwndTree,h);
- for(size_t i = 0;h && (i < cSection);++i,h = tree_get_next_sibling_item(hwndTree,h))
+ h = tree_get_child_item(hwndTree, h);
+ for (size_t i = 0; h && (i < cSection); ++i, h = tree_get_next_sibling_item(hwndTree, h))
{
CQuotesProviderDukasCopy::CQuoteSection other = qs.GetSection(i);
- recursive_save_quote_section_selection(hwndTree,h,other,pQuotesProvier);
+ recursive_save_quote_section_selection(hwndTree, h, other, pQuotesProvier);
}
size_t cQuotes = qs.GetQuoteCount();
- for(size_t i = 0;h && (i < cQuotes);++i,h = tree_get_next_sibling_item(hwndTree,h))
+ for (size_t i = 0; h && (i < cQuotes); ++i, h = tree_get_next_sibling_item(hwndTree, h))
{
CQuotesProviderDukasCopy::CQuote q = qs.GetQuote(i);
- save_quote_selection(hwndTree,h,q,pQuotesProvier);
+ save_quote_selection(hwndTree, h, q, pQuotesProvier);
}
}
- void recursive_save_selection(HWND hwndTree,CQuotesProviderDukasCopy* pQuotesProvider)
+ void recursive_save_selection(HWND hwndTree, CQuotesProviderDukasCopy* pQuotesProvider)
{
// CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
// const TQuotesProviders& rapQuotesProviders = pProviders->GetProviders();
@@ -214,7 +214,7 @@ namespace // {
// const TQuotesProviderPtr& pQuotesProvier = *i;
CQuotesProviderDukasCopy::CQuoteSection qs = pQuotesProvider->GetQuotes();
- recursive_save_quote_section_selection(hwndTree,tree_get_child_item(hwndTree,TVI_ROOT),qs,pQuotesProvider);
+ recursive_save_quote_section_selection(hwndTree, tree_get_child_item(hwndTree, TVI_ROOT), qs, pQuotesProvider);
// }
}
@@ -224,18 +224,18 @@ namespace CImageListWrapper()
: m_hImageList(ImageList_Create(::GetSystemMetrics(SM_CXSMICON),
::GetSystemMetrics(SM_CYSMICON),
- ILC_COLOR24|ILC_MASK,2,0))
+ ILC_COLOR24 | ILC_MASK, 2, 0))
{
- if(m_hImageList)
+ if (m_hImageList)
{
- ImageList_AddIcon(m_hImageList,Quotes_LoadIconEx(ICON_STR_SECTION));
- ImageList_AddIcon(m_hImageList,Quotes_LoadIconEx(ICON_STR_QUOTE));
+ ImageList_AddIcon(m_hImageList, Quotes_LoadIconEx(ICON_STR_SECTION));
+ ImageList_AddIcon(m_hImageList, Quotes_LoadIconEx(ICON_STR_QUOTE));
}
}
~CImageListWrapper()
{
- if(m_hImageList)
+ if (m_hImageList)
{
ImageList_Destroy(m_hImageList);
}
@@ -260,11 +260,11 @@ namespace {
CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
const CQuotesProviders::TQuotesProviders& rapQuotesProviders = pProviders->GetProviders();
- for(CQuotesProviders::TQuotesProviders::const_iterator i = rapQuotesProviders.begin();i != rapQuotesProviders.end();++i)
+ for (CQuotesProviders::TQuotesProviders::const_iterator i = rapQuotesProviders.begin(); i != rapQuotesProviders.end(); ++i)
{
const CQuotesProviders::TQuotesProviderPtr& pProvider = *i;
CQuotesProviderDukasCopy* pDukas = dynamic_cast<CQuotesProviderDukasCopy*>(pProvider.get());
- if(pDukas)
+ if (pDukas)
{
return pDukas;
}
@@ -274,131 +274,131 @@ namespace return NULL;
}
- INT_PTR CALLBACK EconomicRatesDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam)
+ INT_PTR CALLBACK EconomicRatesDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
CCommonDlgProcData d(get_dukas_copy_provider());
- CommonOptionDlgProc(hdlg,message,wParam,lParam,d);
+ CommonOptionDlgProc(hdlg, message, wParam, lParam, d);
- switch(message)
+ switch (message)
{
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hdlg);
+ {
+ TranslateDialogDefault(hdlg);
- HWND hwndTree = ::GetDlgItem(hdlg,IDC_TREE_ECONOMIC_RATES);
- HIMAGELIST hImage = get_image_list();
- if(hImage)
- {
- TreeView_SetImageList(hwndTree,hImage,TVSIL_NORMAL);
- }
+ HWND hwndTree = ::GetDlgItem(hdlg, IDC_TREE_ECONOMIC_RATES);
+ HIMAGELIST hImage = get_image_list();
+ if (hImage)
+ {
+ TreeView_SetImageList(hwndTree, hImage, TVSIL_NORMAL);
+ }
- const CQuotesProviderDukasCopy* pDukasProvider = get_dukas_copy_provider();
- if(pDukasProvider)
- {
- add_provider_to_tree(pDukasProvider,hwndTree);
- }
- // Window_SetIcon_IcoLib(hdlg, SKINICON_OTHER_MIRANDA);
+ const CQuotesProviderDukasCopy* pDukasProvider = get_dukas_copy_provider();
+ if (pDukasProvider)
+ {
+ add_provider_to_tree(pDukasProvider, hwndTree);
}
- return TRUE;
+ // Window_SetIcon_IcoLib(hdlg, SKINICON_OTHER_MIRANDA);
+ }
+ return TRUE;
case WM_NOTIFY:
+ {
+ LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lParam);
+ switch (pNMHDR->code)
{
- LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lParam);
- switch(pNMHDR->code)
+ case TVN_KEYDOWN:
+ if (IDC_TREE_ECONOMIC_RATES == wParam)
{
- case TVN_KEYDOWN:
- if(IDC_TREE_ECONOMIC_RATES == wParam)
+ LPNMTVKEYDOWN pKeyDown = reinterpret_cast<LPNMTVKEYDOWN>(lParam);
+ if (VK_SPACE == pKeyDown->wVKey)
{
- LPNMTVKEYDOWN pKeyDown = reinterpret_cast<LPNMTVKEYDOWN>(lParam);
- if(VK_SPACE == pKeyDown->wVKey)
- {
- HTREEITEM hti = TreeView_GetSelection(::GetDlgItem(hdlg,IDC_TREE_ECONOMIC_RATES));
- ::PostMessage(hdlg,TREE_VIEW_CHECK_STATE_CHANGE,MAKEWPARAM(1,0),reinterpret_cast<LPARAM>(hti));
- PropSheet_Changed(::GetParent(hdlg),hdlg);
- }
+ HTREEITEM hti = TreeView_GetSelection(::GetDlgItem(hdlg, IDC_TREE_ECONOMIC_RATES));
+ ::PostMessage(hdlg, TREE_VIEW_CHECK_STATE_CHANGE, MAKEWPARAM(1, 0), reinterpret_cast<LPARAM>(hti));
+ PropSheet_Changed(::GetParent(hdlg), hdlg);
}
- break;
- case NM_CLICK:
- if(IDC_TREE_ECONOMIC_RATES == wParam)
- {
- DWORD pos = ::GetMessagePos();
+ }
+ break;
+ case NM_CLICK:
+ if (IDC_TREE_ECONOMIC_RATES == wParam)
+ {
+ DWORD pos = ::GetMessagePos();
- HWND hwndTree = ::GetDlgItem(hdlg,IDC_TREE_ECONOMIC_RATES);
+ HWND hwndTree = ::GetDlgItem(hdlg, IDC_TREE_ECONOMIC_RATES);
- TVHITTESTINFO tvhti;
- tvhti.pt.x = LOWORD(pos);
- tvhti.pt.y = HIWORD(pos);
- ::ScreenToClient(hwndTree,&(tvhti.pt));
+ TVHITTESTINFO tvhti;
+ tvhti.pt.x = LOWORD(pos);
+ tvhti.pt.y = HIWORD(pos);
+ ::ScreenToClient(hwndTree, &(tvhti.pt));
- HTREEITEM hti = reinterpret_cast<HTREEITEM>(::SendMessage(hwndTree,TVM_HITTEST,0,reinterpret_cast<LPARAM>(&tvhti)));
- if(hti && (tvhti.flags&TVHT_ONITEMSTATEICON))
- {
- ::PostMessage(hdlg,TREE_VIEW_CHECK_STATE_CHANGE,MAKEWPARAM(1,0),reinterpret_cast<LPARAM>(hti));
- PropSheet_Changed(::GetParent(hdlg),hdlg);
- }
- }
- break;
- case PSN_APPLY:
+ HTREEITEM hti = reinterpret_cast<HTREEITEM>(::SendMessage(hwndTree, TVM_HITTEST, 0, reinterpret_cast<LPARAM>(&tvhti)));
+ if (hti && (tvhti.flags&TVHT_ONITEMSTATEICON))
{
- CQuotesProviderDukasCopy* pDukasProvider = get_dukas_copy_provider();
- if(pDukasProvider)
- {
- recursive_save_selection(::GetDlgItem(hdlg,IDC_TREE_ECONOMIC_RATES),pDukasProvider);
- pDukasProvider->RefreshSettings();
- }
+ ::PostMessage(hdlg, TREE_VIEW_CHECK_STATE_CHANGE, MAKEWPARAM(1, 0), reinterpret_cast<LPARAM>(hti));
+ PropSheet_Changed(::GetParent(hdlg), hdlg);
}
- break;
+ }
+ break;
+ case PSN_APPLY:
+ {
+ CQuotesProviderDukasCopy* pDukasProvider = get_dukas_copy_provider();
+ if (pDukasProvider)
+ {
+ recursive_save_selection(::GetDlgItem(hdlg, IDC_TREE_ECONOMIC_RATES), pDukasProvider);
+ pDukasProvider->RefreshSettings();
}
}
- return TRUE;
+ break;
+ }
+ }
+ return TRUE;
case TREE_VIEW_CHECK_STATE_CHANGE:
- {
- HWND hwndTree = ::GetDlgItem(hdlg,IDC_TREE_ECONOMIC_RATES);
- HTREEITEM hti = reinterpret_cast<HTREEITEM>(lParam);
-
- ETreeCheckBoxState nState;
+ {
+ HWND hwndTree = ::GetDlgItem(hdlg, IDC_TREE_ECONOMIC_RATES);
+ HTREEITEM hti = reinterpret_cast<HTREEITEM>(lParam);
- bool bRecursively = 1 == LOWORD(wParam);
- if(bRecursively)
- {
- nState = tree_get_state_image(hwndTree,hti);
- }
- else
- {
- nState = static_cast<ETreeCheckBoxState>(HIWORD(wParam));
- }
+ ETreeCheckBoxState nState;
- tree_set_item_state(hwndTree,hti,nState,bRecursively);
+ bool bRecursively = 1 == LOWORD(wParam);
+ if (bRecursively)
+ {
+ nState = tree_get_state_image(hwndTree, hti);
}
- break;
- // case WM_CLOSE:
- // DestroyWindow(hdlg);
- // break;
- // case WM_DESTROY:
- // g_hwndEconomicRates = NULL;
- // break;
+ else
+ {
+ nState = static_cast<ETreeCheckBoxState>(HIWORD(wParam));
+ }
+
+ tree_set_item_state(hwndTree, hti, nState, bRecursively);
+ }
+ break;
+ // case WM_CLOSE:
+ // DestroyWindow(hdlg);
+ // break;
+ // case WM_DESTROY:
+ // g_hwndEconomicRates = NULL;
+ // break;
}
return FALSE;
}
}
-void ShowDukasCopyPropPage(CQuotesProviderDukasCopy* pProvider,WPARAM wp,OPTIONSDIALOGPAGE& odp)
+void ShowDukasCopyPropPage(CQuotesProviderDukasCopy* pProvider, WPARAM wp, OPTIONSDIALOGPAGE& odp)
{
const IQuotesProvider::CProviderInfo& pi = pProvider->GetInfo();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_ECONOMIC_RATES);
odp.pfnDlgProc = EconomicRatesDlgProc;
-// #if MIRANDA_VER >= 0x0600
+ // #if MIRANDA_VER >= 0x0600
//odp.ptszTab = TranslateTS(const_cast<LPTSTR>(pi.m_sName.c_str()));
odp.ptszTab = const_cast<LPTSTR>(pi.m_sName.c_str());
-// #else
-// tostringstream o;
-// o << TranslateTS(QUOTES_PROTOCOL_NAME) << _T(" - ") << TranslateTS(pi.m_sName.c_str());
-// tstring sTitle = o.str();
-// odp.ptszTitle = TranslateTS(const_cast<LPTSTR>(sTitle.c_str()));
-// #endif
+ // #else
+ // tostringstream o;
+ // o << TranslateTS(QUOTES_PROTOCOL_NAME) << _T(" - ") << TranslateTS(pi.m_sName.c_str());
+ // tstring sTitle = o.str();
+ // odp.ptszTitle = TranslateTS(const_cast<LPTSTR>(sTitle.c_str()));
+ // #endif
Options_AddPage(wp, &odp);
}
diff --git a/plugins/Quotes/src/OptionDukasCopy.h b/plugins/Quotes/src/OptionDukasCopy.h index 0674119e83..617d370f3b 100644 --- a/plugins/Quotes/src/OptionDukasCopy.h +++ b/plugins/Quotes/src/OptionDukasCopy.h @@ -3,6 +3,6 @@ class CQuotesProviderDukasCopy;
-void ShowDukasCopyPropPage(CQuotesProviderDukasCopy* pProvider,WPARAM wp,OPTIONSDIALOGPAGE& odp);
+void ShowDukasCopyPropPage(CQuotesProviderDukasCopy* pProvider, WPARAM wp, OPTIONSDIALOGPAGE& odp);
#endif //__60a5d152_872c_4bc4_b9ae_cd561d110b2dOptionDukasCopy_h__
diff --git a/plugins/Quotes/src/QuoteChart.cpp b/plugins/Quotes/src/QuoteChart.cpp index a60d5d0a7e..c0fec78d59 100644 --- a/plugins/Quotes/src/QuoteChart.cpp +++ b/plugins/Quotes/src/QuoteChart.cpp @@ -88,16 +88,16 @@ namespace switch(msg)
{
case WM_CREATE:
- {
- CREATESTRUCT* pCS = reinterpret_cast<CREATESTRUCT*>(lp);
- MCONTACT hContact = reinterpret_cast<HANDLE>(pCS->lpCreateParams);
+ {
+ CREATESTRUCT* pCS = reinterpret_cast<CREATESTRUCT*>(lp);
+ MCONTACT hContact = reinterpret_cast<HANDLE>(pCS->lpCreateParams);
- TChart* pChart = new TChart;
- read_log_file(hContact,*pChart);
+ TChart* pChart = new TChart;
+ read_log_file(hContact,*pChart);
- ::SetWindowLongPtr(hWnd,GWLP_USERDATA,reinterpret_cast<LONG_PTR>(pChart));
- }
- return 0;
+ ::SetWindowLongPtr(hWnd,GWLP_USERDATA,reinterpret_cast<LONG_PTR>(pChart));
+ }
+ return 0;
case CHART_SET_SOURCE:
break;
@@ -106,11 +106,11 @@ namespace break;
case WM_SIZE:
- {
- TChart* pChart = get_chart_ptr(hWnd);
- pChart->SetRect(0,0,LOWORD(lp),HIWORD(lp));
- }
- return 0;
+ {
+ TChart* pChart = get_chart_ptr(hWnd);
+ pChart->SetRect(0,0,LOWORD(lp),HIWORD(lp));
+ }
+ return 0;
case WM_PAINT:
if(TRUE == ::GetUpdateRect(hWnd,NULL,FALSE))
@@ -127,12 +127,12 @@ namespace return 0;
case WM_DESTROY:
- {
- TChart* pChart = get_chart_ptr(hWnd);
- ::SetWindowLongPtr(hWnd,GWLP_USERDATA,0);
- delete pChart;
- }
- break;
+ {
+ TChart* pChart = get_chart_ptr(hWnd);
+ ::SetWindowLongPtr(hWnd,GWLP_USERDATA,0);
+ delete pChart;
+ }
+ break;
}
return ::DefWindowProc(hWnd,msg,wp,lp);
@@ -201,90 +201,90 @@ namespace switch(msg)
{
case WM_INITDIALOG:
- {
- MCONTACT hContact = reinterpret_cast<HANDLE>(lp);
+ {
+ MCONTACT hContact = reinterpret_cast<HANDLE>(lp);
- TranslateDialogDefault(hDlg);
+ TranslateDialogDefault(hDlg);
- tstring sName = get_window_text(hDlg);
- sName += _T(" - ");
- sName += GetContactName(hContact);
- ::SetWindowText(hDlg,sName.c_str());
+ tstring sName = get_window_text(hDlg);
+ sName += _T(" - ");
+ sName += GetContactName(hContact);
+ ::SetWindowText(hDlg,sName.c_str());
- HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX,false);
- assert(hWL);
- WindowList_Add(hWL,hDlg,hContact);
+ HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX,false);
+ assert(hWL);
+ WindowList_Add(hWL,hDlg,hContact);
- ::SetWindowLongPtr(hDlg,GWLP_USERDATA,reinterpret_cast<LONG_PTR>(hContact));
+ ::SetWindowLongPtr(hDlg,GWLP_USERDATA,reinterpret_cast<LONG_PTR>(hContact));
- static LPCTSTR szSources[] = {LPGENT("Log File"), LPGENT("Miranda's History")};
- static LPCTSTR szFilters[] = {LPGENT("All"), LPGENT("Last Day"), LPGENT("Last Week"), LPGENT("Last Month"), LPGENT("Last Year"), LPGENT("User-Defined")};
+ static LPCTSTR szSources[] = {LPGENT("Log File"), LPGENT("Miranda's History")};
+ static LPCTSTR szFilters[] = {LPGENT("All"), LPGENT("Last Day"), LPGENT("Last Week"), LPGENT("Last Month"), LPGENT("Last Year"), LPGENT("User-Defined")};
- for(int i = 0;i < sizeof(szSources)/sizeof(szSources[0]);++i)
- {
- LPCTSTR p = TranslateTS(szSources[i]);
- ::SendDlgItemMessage(hDlg,IDC_COMBO_DATA_SOURCE,CB_INSERTSTRING,-1,reinterpret_cast<LPARAM>(p));
- }
+ for(int i = 0;i < sizeof(szSources)/sizeof(szSources[0]);++i)
+ {
+ LPCTSTR p = TranslateTS(szSources[i]);
+ ::SendDlgItemMessage(hDlg,IDC_COMBO_DATA_SOURCE,CB_INSERTSTRING,-1,reinterpret_cast<LPARAM>(p));
+ }
- int nSel = db_get_b(hContact,QUOTES_PROTOCOL_NAME,"Chart_Source",srcLogFile);
- ::SendDlgItemMessage(hDlg,IDC_COMBO_DATA_SOURCE,CB_SETCURSEL,nSel,0);
+ int nSel = db_get_b(hContact,QUOTES_PROTOCOL_NAME,"Chart_Source",srcLogFile);
+ ::SendDlgItemMessage(hDlg,IDC_COMBO_DATA_SOURCE,CB_SETCURSEL,nSel,0);
- for(int i = 0;i < sizeof(szFilters)/sizeof(szFilters[0]);++i)
- {
- LPCTSTR p = TranslateTS(szSources[i]);
- ::SendDlgItemMessage(hDlg,IDC_COMBO_FILTER,CB_INSERTSTRING,-1,reinterpret_cast<LPARAM>(szFilters[i]));
- }
+ for(int i = 0;i < sizeof(szFilters)/sizeof(szFilters[0]);++i)
+ {
+ LPCTSTR p = TranslateTS(szSources[i]);
+ ::SendDlgItemMessage(hDlg,IDC_COMBO_FILTER,CB_INSERTSTRING,-1,reinterpret_cast<LPARAM>(szFilters[i]));
+ }
- nSel = db_get_b(hContact,QUOTES_PROTOCOL_NAME,"Chart_Filter",filterAll);
- ::SendDlgItemMessage(hDlg,IDC_COMBO_FILTER,CB_SETCURSEL,nSel,0);
+ nSel = db_get_b(hContact,QUOTES_PROTOCOL_NAME,"Chart_Filter",filterAll);
+ ::SendDlgItemMessage(hDlg,IDC_COMBO_FILTER,CB_SETCURSEL,nSel,0);
- update_filter_controls(hDlg);
+ update_filter_controls(hDlg);
- register_chart_control();
- HWND hwndImage = ::GetDlgItem(hDlg,IDC_STATIC_IMAGE);
- RECT rcImage;
- ::GetWindowRect(hwndImage,&rcImage);
- screen_2_client(hDlg,&rcImage);
- //BOOL bResult = ShowWindow(hwndImage,SW_HIDE);
- //assert(bResult);
+ register_chart_control();
+ HWND hwndImage = ::GetDlgItem(hDlg,IDC_STATIC_IMAGE);
+ RECT rcImage;
+ ::GetWindowRect(hwndImage,&rcImage);
+ screen_2_client(hDlg,&rcImage);
+ //BOOL bResult = ShowWindow(hwndImage,SW_HIDE);
+ //assert(bResult);
- HWND hChart = ::CreateWindowEx(0L,CHART_CTRL_CLASS,NULL,WS_CHILDWINDOW|WS_VISIBLE,
- rcImage.left,rcImage.top,rcImage.right-rcImage.left,rcImage.bottom-rcImage.top,
- hDlg,reinterpret_cast<HMENU>(ID_CHART),CModuleInfo::GetInstance().GetModuleHandle(),hContact);
- assert(NULL != hChart);
+ HWND hChart = ::CreateWindowEx(0L,CHART_CTRL_CLASS,NULL,WS_CHILDWINDOW|WS_VISIBLE,
+ rcImage.left,rcImage.top,rcImage.right-rcImage.left,rcImage.bottom-rcImage.top,
+ hDlg,reinterpret_cast<HMENU>(ID_CHART),CModuleInfo::GetInstance().GetModuleHandle(),hContact);
+ assert(NULL != hChart);
- Utils_RestoreWindowPosition(hDlg,hContact,QUOTES_MODULE_NAME,WINDOW_PREFIX);
- BOOL bResult = ::ShowWindow(hDlg,SW_SHOW);
- assert(bResult);
- }
- return (TRUE);
+ Utils_RestoreWindowPosition(hDlg,hContact,QUOTES_MODULE_NAME,WINDOW_PREFIX);
+ BOOL bResult = ::ShowWindow(hDlg,SW_SHOW);
+ assert(bResult);
+ }
+ return (TRUE);
case WM_CLOSE:
- {
- MCONTACT hContact = get_contact(hDlg);
- SetWindowLongPtr(hDlg,GWLP_USERDATA,0);
+ {
+ MCONTACT hContact = get_contact(hDlg);
+ SetWindowLongPtr(hDlg,GWLP_USERDATA,0);
-// save_options(hDlg,hContact);
+ // save_options(hDlg,hContact);
- HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX,false);
- assert(hWL);
- WindowList_Remove(hWL,hDlg);
- Utils_SaveWindowPosition(hDlg,hContact,QUOTES_MODULE_NAME,WINDOW_PREFIX);
+ HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX,false);
+ assert(hWL);
+ WindowList_Remove(hWL,hDlg);
+ Utils_SaveWindowPosition(hDlg,hContact,QUOTES_MODULE_NAME,WINDOW_PREFIX);
- HWND hwndChart = ::GetDlgItem(hDlg,ID_CHART);
- BOOL bResult = ::DestroyWindow(hwndChart);
- assert(bResult);
-
- ::EndDialog(hDlg,0);
- }
- return (TRUE);
+ HWND hwndChart = ::GetDlgItem(hDlg,ID_CHART);
+ BOOL bResult = ::DestroyWindow(hwndChart);
+ assert(bResult);
+
+ ::EndDialog(hDlg,0);
+ }
+ return (TRUE);
case WM_COMMAND:
switch(LOWORD(wp))
{
case IDCANCEL:
- {
- SendMessage(hDlg, WM_CLOSE, 0, 0);
- }
- return (TRUE);
+ {
+ SendMessage(hDlg, WM_CLOSE, 0, 0);
+ }
+ return (TRUE);
case IDC_COMBO_FILTER:
if(CBN_SELCHANGE == HIWORD(wp))
{
@@ -301,68 +301,68 @@ namespace }
return (FALSE);
case WM_NOTIFY:
+ {
+ LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lp);
+ switch(pNMHDR->code)
{
- LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lp);
- switch(pNMHDR->code)
+ case NM_CLICK:
+ if(IDC_SYSLINK_PROVIDER == wp)
{
- case NM_CLICK:
- if(IDC_SYSLINK_PROVIDER == wp)
- {
- PNMLINK pNMLink = reinterpret_cast<PNMLINK>(pNMHDR);
- ::ShellExecute(hDlg,_T("open"),pNMLink->item.szUrl,NULL,NULL,SW_SHOWNORMAL);
- }
- break;
+ PNMLINK pNMLink = reinterpret_cast<PNMLINK>(pNMHDR);
+ ::ShellExecute(hDlg,_T("open"),pNMLink->item.szUrl,NULL,NULL,SW_SHOWNORMAL);
}
+ break;
}
- break;
-// case WM_ERASEBKGND:
-// {
-// HDC hdc = reinterpret_cast<HDC>(wp);
-// TChart* pChart = get_chart_ptr(hDlg);
-// pChart->DrawBackground(hdc);
-// return TRUE;
-// }
-// break;
+ }
+ break;
+ // case WM_ERASEBKGND:
+ // {
+ // HDC hdc = reinterpret_cast<HDC>(wp);
+ // TChart* pChart = get_chart_ptr(hDlg);
+ // pChart->DrawBackground(hdc);
+ // return TRUE;
+ // }
+ // break;
case WM_SIZE:
- {
- enum{ INDENT = 7};
-
- int nWidth = LOWORD(lp);
- int nHeight = HIWORD(lp);
-
- HWND hwndChart = GetDlgItem(hDlg,ID_CHART);
- HWND hwndLink = GetDlgItem(hDlg,IDC_SYSLINK_PROVIDER);
- HWND hwndClose = GetDlgItem(hDlg,IDCANCEL);
-
- RECT rcDlg;
- GetClientRect(hDlg,&rcDlg);
-
- RECT rcChart;
- GetWindowRect(hwndChart,&rcChart);
- screen_2_client(hDlg,&rcChart);
-
- RECT rcLink;
- GetWindowRect(hwndLink,&rcLink);
- screen_2_client(hDlg,&rcLink);
- SetWindowPos(hwndLink,NULL,rcDlg.left + INDENT,
- rcDlg.bottom-INDENT-(rcLink.bottom-rcLink.top),
- 0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
-
- RECT rcClose;
- GetWindowRect(hwndClose,&rcClose);
- screen_2_client(hDlg,&rcClose);
- SetWindowPos(hwndClose,NULL,rcDlg.right - INDENT - (rcClose.right-rcClose.left),
- rcDlg.bottom-INDENT-(rcClose.bottom-rcClose.top),
- 0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
-
- SetWindowPos(hwndChart,NULL,rcDlg.left + INDENT,
- rcChart.top,
- (nWidth-INDENT*2),
- nHeight-(rcClose.bottom-rcClose.top)-INDENT*2-rcChart.top,
- SWP_NOZORDER|SWP_NOACTIVATE);
+ {
+ enum{ INDENT = 7};
+
+ int nWidth = LOWORD(lp);
+ int nHeight = HIWORD(lp);
+
+ HWND hwndChart = GetDlgItem(hDlg,ID_CHART);
+ HWND hwndLink = GetDlgItem(hDlg,IDC_SYSLINK_PROVIDER);
+ HWND hwndClose = GetDlgItem(hDlg,IDCANCEL);
+
+ RECT rcDlg;
+ GetClientRect(hDlg,&rcDlg);
+
+ RECT rcChart;
+ GetWindowRect(hwndChart,&rcChart);
+ screen_2_client(hDlg,&rcChart);
+
+ RECT rcLink;
+ GetWindowRect(hwndLink,&rcLink);
+ screen_2_client(hDlg,&rcLink);
+ SetWindowPos(hwndLink,NULL,rcDlg.left + INDENT,
+ rcDlg.bottom-INDENT-(rcLink.bottom-rcLink.top),
+ 0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
+
+ RECT rcClose;
+ GetWindowRect(hwndClose,&rcClose);
+ screen_2_client(hDlg,&rcClose);
+ SetWindowPos(hwndClose,NULL,rcDlg.right - INDENT - (rcClose.right-rcClose.left),
+ rcDlg.bottom-INDENT-(rcClose.bottom-rcClose.top),
+ 0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
+
+ SetWindowPos(hwndChart,NULL,rcDlg.left + INDENT,
+ rcChart.top,
+ (nWidth-INDENT*2),
+ nHeight-(rcClose.bottom-rcClose.top)-INDENT*2-rcChart.top,
+ SWP_NOZORDER|SWP_NOACTIVATE);
- }
- break;
+ }
+ break;
}
return (FALSE);
}
diff --git a/plugins/Quotes/src/QuoteChart.h b/plugins/Quotes/src/QuoteChart.h index 1b40f428b5..bbbc473b7b 100644 --- a/plugins/Quotes/src/QuoteChart.h +++ b/plugins/Quotes/src/QuoteChart.h @@ -5,7 +5,7 @@ #pragma once
-INT_PTR QuotesMenu_Chart(WPARAM wp,LPARAM lp);
+INT_PTR QuotesMenu_Chart(WPARAM wp, LPARAM lp);
#endif
diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp index f8e70ac6d0..ee43fab9da 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.cpp +++ b/plugins/Quotes/src/QuoteInfoDlg.cpp @@ -12,7 +12,7 @@ extern HGENMENU g_hMenuRefresh; #define WINDOW_PREFIX_INFO "Quote Info"
-namespace
+namespace
{
MCONTACT g_hContact;
@@ -24,11 +24,11 @@ namespace inline MCONTACT get_contact(HWND hWnd)
{
- return MCONTACT(GetWindowLongPtr(hWnd,GWLP_USERDATA));
+ return MCONTACT(GetWindowLongPtr(hWnd, GWLP_USERDATA));
}
- bool get_fetch_time(time_t& rTime,MCONTACT hContact)
+ bool get_fetch_time(time_t& rTime, MCONTACT hContact)
{
DBVARIANT dbv;
if (db_get(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FETCH_TIME, &dbv) || (DBVT_DWORD != dbv.type))
@@ -38,91 +38,91 @@ namespace return true;
}
- INT_PTR CALLBACK QuoteInfoDlgProcImpl(MCONTACT hContact,HWND hdlg,UINT msg,WPARAM wParam,LPARAM lParam)
+ INT_PTR CALLBACK QuoteInfoDlgProcImpl(MCONTACT hContact, HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch (msg)
{
case WM_INITDIALOG:
- {
- assert(hContact);
+ {
+ assert(hContact);
- TranslateDialogDefault(hdlg);
+ TranslateDialogDefault(hdlg);
- tstring sDescription = GetContactName(hContact);
- ::SetDlgItemText(hdlg,IDC_STATIC_QUOTE_NAME,sDescription.c_str());
+ tstring sDescription = GetContactName(hContact);
+ ::SetDlgItemText(hdlg, IDC_STATIC_QUOTE_NAME, sDescription.c_str());
- double dRate = 0.0;
- if(true == Quotes_DBReadDouble(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_PREV_VALUE,dRate))
- {
- tostringstream o;
- o.imbue(GetSystemLocale());
- o << dRate;
+ double dRate = 0.0;
+ if (true == Quotes_DBReadDouble(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_PREV_VALUE, dRate))
+ {
+ tostringstream o;
+ o.imbue(GetSystemLocale());
+ o << dRate;
- ::SetDlgItemText(hdlg,IDC_EDIT_PREVIOUS_RATE,o.str().c_str());
- }
+ ::SetDlgItemText(hdlg, IDC_EDIT_PREVIOUS_RATE, o.str().c_str());
+ }
- dRate = 0.0;
- if(true == Quotes_DBReadDouble(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_CURR_VALUE,dRate))
- {
- tostringstream o;
- o.imbue(GetSystemLocale());
- o << dRate;
+ dRate = 0.0;
+ if (true == Quotes_DBReadDouble(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_CURR_VALUE, dRate))
+ {
+ tostringstream o;
+ o.imbue(GetSystemLocale());
+ o << dRate;
- ::SetDlgItemText(hdlg,IDC_EDIT_RATE,o.str().c_str());
- }
+ ::SetDlgItemText(hdlg, IDC_EDIT_RATE, o.str().c_str());
+ }
- time_t nFetchTime;
- if(true == get_fetch_time(nFetchTime,hContact))
+ time_t nFetchTime;
+ if (true == get_fetch_time(nFetchTime, hContact))
+ {
+ TCHAR szTime[50];
+ if (0 == _tctime_s(szTime, 50, &nFetchTime))
{
- TCHAR szTime[50];
- if(0 == _tctime_s(szTime,50,&nFetchTime))
- {
- szTime[::_tcslen(szTime)-1] = _T('\0');
- ::SetDlgItemText(hdlg,IDC_EDIT_RATE_FETCH_TIME,szTime);
- }
+ szTime[::_tcslen(szTime) - 1] = _T('\0');
+ ::SetDlgItemText(hdlg, IDC_EDIT_RATE_FETCH_TIME, szTime);
}
+ }
- CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact);
+ CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact);
- const IQuotesProvider::CProviderInfo& pi = pProvider->GetInfo();
- tostringstream o;
- o << TranslateT("Info provided by") << _T(" <a href=\"") << pi.m_sURL << _T("\">") << pi.m_sName << _T("</a>");
+ const IQuotesProvider::CProviderInfo& pi = pProvider->GetInfo();
+ tostringstream o;
+ o << TranslateT("Info provided by") << _T(" <a href=\"") << pi.m_sURL << _T("\">") << pi.m_sName << _T("</a>");
- ::SetDlgItemText(hdlg,IDC_SYSLINK_PROVIDER,o.str().c_str());
- }
- return TRUE;
+ ::SetDlgItemText(hdlg, IDC_SYSLINK_PROVIDER, o.str().c_str());
+ }
+ return TRUE;
case WM_NOTIFY:
+ {
+ LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lParam);
+ switch (pNMHDR->code)
{
- LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lParam);
- switch(pNMHDR->code)
+ case NM_CLICK:
+ if (IDC_SYSLINK_PROVIDER == wParam)
{
- case NM_CLICK:
- if(IDC_SYSLINK_PROVIDER == wParam)
- {
- PNMLINK pNMLink = reinterpret_cast<PNMLINK>(pNMHDR);
- ::ShellExecute(hdlg,_T("open"),pNMLink->item.szUrl,NULL,NULL,SW_SHOWNORMAL);
- }
- break;
+ PNMLINK pNMLink = reinterpret_cast<PNMLINK>(pNMHDR);
+ ::ShellExecute(hdlg, _T("open"), pNMLink->item.szUrl, NULL, NULL, SW_SHOWNORMAL);
}
+ break;
}
- break;
+ }
+ break;
}
return FALSE;
}
- INT_PTR CALLBACK QuoteInfoDlgProc(HWND hdlg,UINT msg,WPARAM wParam,LPARAM lParam)
+ INT_PTR CALLBACK QuoteInfoDlgProc(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- return QuoteInfoDlgProcImpl(g_hContact,hdlg,msg,wParam,lParam);
+ return QuoteInfoDlgProcImpl(g_hContact, hdlg, msg, wParam, lParam);
}
}
-int QuotesEventFunc_OnUserInfoInit(WPARAM wp,LPARAM lp)
+int QuotesEventFunc_OnUserInfoInit(WPARAM wp, LPARAM lp)
{
MCONTACT hContact = MCONTACT(lp);
- if(NULL == hContact)
+ if (NULL == hContact)
return 0;
- if(false == IsMyContact(hContact))
+ if (false == IsMyContact(hContact))
return 0;
g_hContact = hContact;
@@ -139,10 +139,10 @@ int QuotesEventFunc_OnUserInfoInit(WPARAM wp,LPARAM lp) }
-INT_PTR QuotesMenu_EditSettings(WPARAM wp,LPARAM lp)
+INT_PTR QuotesMenu_EditSettings(WPARAM wp, LPARAM)
{
MCONTACT hContact = MCONTACT(wp);
- if(NULL == hContact)
+ if (NULL == hContact)
{
return 0;
}
@@ -154,34 +154,34 @@ INT_PTR QuotesMenu_EditSettings(WPARAM wp,LPARAM lp) namespace
{
- bool get_log_file(MCONTACT hContact,tstring& rsLogfile)
+ bool get_log_file(MCONTACT hContact, tstring& rsLogfile)
{
rsLogfile = GetContactLogFileName(hContact);
return ((rsLogfile.empty()) ? false : true);
}
}
-INT_PTR QuotesMenu_OpenLogFile(WPARAM wp,LPARAM lp)
+INT_PTR QuotesMenu_OpenLogFile(WPARAM wp, LPARAM)
{
MCONTACT hContact = MCONTACT(wp);
- if(NULL == hContact)
+ if (NULL == hContact)
{
return 0;
}
tstring sLogFileName;
- if ((true == get_log_file(hContact,sLogFileName)) && (false == sLogFileName.empty()))
+ if ((true == get_log_file(hContact, sLogFileName)) && (false == sLogFileName.empty()))
{
- ::ShellExecute(NULL,_T("open"),sLogFileName.c_str(),NULL,NULL,SW_SHOWNORMAL);
+ ::ShellExecute(NULL, _T("open"), sLogFileName.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
return 0;
}
-INT_PTR QuotesMenu_RefreshContact(WPARAM wp,LPARAM lp)
+INT_PTR QuotesMenu_RefreshContact(WPARAM wp, LPARAM)
{
MCONTACT hContact = MCONTACT(wp);
- if(NULL == hContact)
+ if (NULL == hContact)
{
return 0;
}
@@ -199,41 +199,41 @@ INT_PTR QuotesMenu_RefreshContact(WPARAM wp,LPARAM lp) namespace
{
- INT_PTR CALLBACK QuoteInfoDlgProc1(HWND hdlg,UINT msg,WPARAM wParam,LPARAM lParam)
+ INT_PTR CALLBACK QuoteInfoDlgProc1(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
MCONTACT hContact = NULL;
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
- {
- hContact = MCONTACT(lParam);
- HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO,false);
- assert(hWL);
- WindowList_Add(hWL,hdlg,hContact);
-
- ::SetWindowLongPtr(hdlg, GWLP_USERDATA, hContact);
- Utils_RestoreWindowPositionNoSize(hdlg, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_INFO);
- ::ShowWindow(hdlg,SW_SHOW);
- }
- break;
+ {
+ hContact = MCONTACT(lParam);
+ HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO, false);
+ assert(hWL);
+ WindowList_Add(hWL, hdlg, hContact);
+
+ ::SetWindowLongPtr(hdlg, GWLP_USERDATA, hContact);
+ Utils_RestoreWindowPositionNoSize(hdlg, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_INFO);
+ ::ShowWindow(hdlg, SW_SHOW);
+ }
+ break;
case WM_CLOSE:
DestroyWindow(hdlg);
return FALSE;
case WM_DESTROY:
+ {
+ MCONTACT hContact = get_contact(hdlg);
+ if (hContact)
{
- MCONTACT hContact = get_contact(hdlg);
- if(hContact)
- {
- SetWindowLongPtr(hdlg,GWLP_USERDATA,0);
+ SetWindowLongPtr(hdlg, GWLP_USERDATA, 0);
- HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO,false);
- assert(hWL);
- WindowList_Remove(hWL,hdlg);
- Utils_SaveWindowPosition(hdlg,hContact,QUOTES_MODULE_NAME,WINDOW_PREFIX_INFO);
- }
+ HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO, false);
+ assert(hWL);
+ WindowList_Remove(hWL, hdlg);
+ Utils_SaveWindowPosition(hdlg, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_INFO);
}
- return FALSE;
+ }
+ return FALSE;
case WM_COMMAND:
- if(LOWORD(wParam) == IDOK)
+ if (LOWORD(wParam) == IDOK)
{
::DestroyWindow(hdlg);
return FALSE;
@@ -244,23 +244,23 @@ namespace break;
}
- return QuoteInfoDlgProcImpl(hContact,hdlg,msg,wParam,lParam);
+ return QuoteInfoDlgProcImpl(hContact, hdlg, msg, wParam, lParam);
}
}
-int Quotes_OnContactDoubleClick(WPARAM wp,LPARAM/* lp*/)
+int Quotes_OnContactDoubleClick(WPARAM wp, LPARAM/* lp*/)
{
MCONTACT hContact = MCONTACT(wp);
- if(CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact))
+ if (CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact))
{
- HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO,true);
+ HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO, true);
assert(hWL);
- HWND hWnd = WindowList_Find(hWL,hContact);
- if(NULL != hWnd) {
+ HWND hWnd = WindowList_Find(hWL, hContact);
+ if (NULL != hWnd) {
SetForegroundWindow(hWnd);
SetFocus(hWnd);
}
- else if(true == IsMyContact(hContact))
+ else if (true == IsMyContact(hContact))
CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_QUOTE_INFO_1), NULL, QuoteInfoDlgProc1, LPARAM(hContact));
return 1;
@@ -271,45 +271,45 @@ int Quotes_OnContactDoubleClick(WPARAM wp,LPARAM/* lp*/) namespace
{
- void enable_menu(HGENMENU hMenu,bool bEnable)
+ void enable_menu(HGENMENU hMenu, bool bEnable)
{
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_FLAGS;
- if(false == bEnable)
+ if (false == bEnable)
clmi.flags |= CMIF_GRAYED;
Menu_ModifyItem(hMenu, &clmi);
}
}
-int Quotes_PrebuildContactMenu(WPARAM wp,LPARAM lp)
+int Quotes_PrebuildContactMenu(WPARAM wp, LPARAM)
{
- enable_menu(g_hMenuEditSettings,false);
- enable_menu(g_hMenuOpenLogFile,false);
+ enable_menu(g_hMenuEditSettings, false);
+ enable_menu(g_hMenuOpenLogFile, false);
#ifdef CHART_IMPLEMENT
enable_menu(g_hMenuChart,false);
#endif
- enable_menu(g_hMenuRefresh,false);
-
+ enable_menu(g_hMenuRefresh, false);
+
MCONTACT hContact = MCONTACT(wp);
- if(NULL == hContact)
+ if (NULL == hContact)
{
return 0;
}
- enable_menu(g_hMenuEditSettings,true);
+ enable_menu(g_hMenuEditSettings, true);
- enable_menu(g_hMenuRefresh,true);
+ enable_menu(g_hMenuRefresh, true);
tstring sLogFileName;
- bool bThereIsLogFile = (true == get_log_file(hContact,sLogFileName))
- && (false == sLogFileName.empty()) && (0 == _taccess(sLogFileName.c_str(),04));
- if(true == bThereIsLogFile)
+ bool bThereIsLogFile = (true == get_log_file(hContact, sLogFileName))
+ && (false == sLogFileName.empty()) && (0 == _taccess(sLogFileName.c_str(), 04));
+ if (true == bThereIsLogFile)
{
#ifdef CHART_IMPLEMENT
enable_menu(g_hMenuChart,true);
#endif
- enable_menu(g_hMenuOpenLogFile,true);
+ enable_menu(g_hMenuOpenLogFile, true);
}
return 0;
diff --git a/plugins/Quotes/src/QuoteInfoDlg.h b/plugins/Quotes/src/QuoteInfoDlg.h index c4a1999a4c..c650123e02 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.h +++ b/plugins/Quotes/src/QuoteInfoDlg.h @@ -1,11 +1,11 @@ #ifndef __aa849fa0_ff3f_49e9_b47a_e7dd34783dc2_QuoteInfoDlg_h__
#define __aa849fa0_ff3f_49e9_b47a_e7dd34783dc2_QuoteInfoDlg_h__
-int QuotesEventFunc_OnUserInfoInit(WPARAM wp,LPARAM lp);
-INT_PTR QuotesMenu_EditSettings(WPARAM wp,LPARAM lp);
-INT_PTR QuotesMenu_OpenLogFile(WPARAM wp,LPARAM lp);
-INT_PTR QuotesMenu_RefreshContact(WPARAM wp,LPARAM lp);
-int Quotes_PrebuildContactMenu(WPARAM wp,LPARAM lp);
-int Quotes_OnContactDoubleClick(WPARAM wp,LPARAM lp);
+int QuotesEventFunc_OnUserInfoInit(WPARAM wp, LPARAM lp);
+INT_PTR QuotesMenu_EditSettings(WPARAM wp, LPARAM lp);
+INT_PTR QuotesMenu_OpenLogFile(WPARAM wp, LPARAM lp);
+INT_PTR QuotesMenu_RefreshContact(WPARAM wp, LPARAM lp);
+int Quotes_PrebuildContactMenu(WPARAM wp, LPARAM lp);
+int Quotes_OnContactDoubleClick(WPARAM wp, LPARAM lp);
#endif //__aa849fa0_ff3f_49e9_b47a_e7dd34783dc2_QuoteInfoDlg_h__
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp index 06f04a7e0b..dfb1c59d1d 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp @@ -19,81 +19,81 @@ namespace return CreateFilePath(pszFileName);
}
- bool parse_quote(const IXMLNode::TXMLNodePtr& pTop,CQuotesProviderBase::CQuote& q)
+ bool parse_quote(const IXMLNode::TXMLNodePtr& pTop, CQuotesProviderBase::CQuote& q)
{
tstring sSymbol;
tstring sDescription;
tstring sID;
size_t cChild = pTop->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IXMLNode::TXMLNodePtr pNode = pTop->GetChildNode(i);
tstring sName = pNode->GetName();
- if(0 == quotes_stricmp(_T("symbol"),sName.c_str()))
- {
+ if (0 == quotes_stricmp(_T("symbol"), sName.c_str()))
+ {
sSymbol = pNode->GetText();
- if(true == sSymbol.empty())
+ if (true == sSymbol.empty())
{
return false;
}
}
- else if(0 == quotes_stricmp(_T("description"),sName.c_str()))
- {
+ else if (0 == quotes_stricmp(_T("description"), sName.c_str()))
+ {
sDescription = pNode->GetText();
}
- else if(0 == quotes_stricmp(_T("id"),sName.c_str()))
- {
+ else if (0 == quotes_stricmp(_T("id"), sName.c_str()))
+ {
sID = pNode->GetText();
- if(true == sID.empty())
+ if (true == sID.empty())
{
return false;
}
}
}
- q = CQuotesProviderBase::CQuote(sID,TranslateTS(sSymbol.c_str()),TranslateTS(sDescription.c_str()));
+ q = CQuotesProviderBase::CQuote(sID, TranslateTS(sSymbol.c_str()), TranslateTS(sDescription.c_str()));
return true;
}
- bool parse_section(const IXMLNode::TXMLNodePtr& pTop,CQuotesProviderBase::CQuoteSection& qs)
+ bool parse_section(const IXMLNode::TXMLNodePtr& pTop, CQuotesProviderBase::CQuoteSection& qs)
{
CQuotesProviderBase::CQuoteSection::TSections aSections;
CQuotesProviderBase::CQuoteSection::TQuotes aQuotes;
tstring sSectionName;
size_t cChild = pTop->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IXMLNode::TXMLNodePtr pNode = pTop->GetChildNode(i);
tstring sName = pNode->GetName();
- if(0 == quotes_stricmp(_T("section"),sName.c_str()))
- {
+ if (0 == quotes_stricmp(_T("section"), sName.c_str()))
+ {
CQuotesProviderBase::CQuoteSection qs;
- if(true == parse_section(pNode,qs))
+ if (true == parse_section(pNode, qs))
{
aSections.push_back(qs);
}
}
- else if(0 == quotes_stricmp(_T("quote"),sName.c_str()))
+ else if (0 == quotes_stricmp(_T("quote"), sName.c_str()))
{
CQuotesProviderBase::CQuote q;
- if(true == parse_quote(pNode,q))
+ if (true == parse_quote(pNode, q))
{
aQuotes.push_back(q);
}
}
- else if(0 == quotes_stricmp(_T("name"),sName.c_str()))
+ else if (0 == quotes_stricmp(_T("name"), sName.c_str()))
{
sSectionName = pNode->GetText();
- if(true == sSectionName.empty())
+ if (true == sSectionName.empty())
{
return false;
}
}
}
- qs = CQuotesProviderBase::CQuoteSection(TranslateTS(sSectionName.c_str()),aSections,aQuotes);
+ qs = CQuotesProviderBase::CQuoteSection(TranslateTS(sSectionName.c_str()), aSections, aQuotes);
return true;
}
@@ -101,11 +101,11 @@ namespace {
IXMLNode::TXMLNodePtr pProvider;
size_t cChild = pRoot->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IXMLNode::TXMLNodePtr pNode = pRoot->GetChildNode(i);
tstring sName = pNode->GetName();
- if(0 == quotes_stricmp(_T("Provider"),sName.c_str()))
+ if (0 == quotes_stricmp(_T("Provider"), sName.c_str()))
{
pProvider = pNode;
break;
@@ -113,7 +113,7 @@ namespace else
{
pProvider = find_provider(pNode);
- if(pProvider)
+ if (pProvider)
{
break;
}
@@ -123,41 +123,41 @@ namespace return pProvider;
}
- CQuotesProviderBase::CXMLFileInfo parse_ini_file(const tstring& rsXMLFile,bool& rbSucceded)
+ CQuotesProviderBase::CXMLFileInfo parse_ini_file(const tstring& rsXMLFile, bool& rbSucceded)
{
CQuotesProviderBase::CXMLFileInfo res;
CQuotesProviderBase::CQuoteSection::TSections aSections;
const CModuleInfo::TXMLEnginePtr& pXMLEngine = CModuleInfo::GetXMLEnginePtr();
IXMLNode::TXMLNodePtr pRoot = pXMLEngine->LoadFile(rsXMLFile);
- if(pRoot)
+ if (pRoot)
{
IXMLNode::TXMLNodePtr pProvider = find_provider(pRoot);
- if(pProvider)
+ if (pProvider)
{
rbSucceded = true;
size_t cChild = pProvider->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IXMLNode::TXMLNodePtr pNode = pProvider->GetChildNode(i);
tstring sName = pNode->GetName();
- if(0 == quotes_stricmp(_T("section"),sName.c_str()))
- {
+ if (0 == quotes_stricmp(_T("section"), sName.c_str()))
+ {
CQuotesProviderBase::CQuoteSection qs;
- if(true == parse_section(pNode,qs))
+ if (true == parse_section(pNode, qs))
{
aSections.push_back(qs);
}
}
- else if(0 == quotes_stricmp(_T("Name"),sName.c_str()))
+ else if (0 == quotes_stricmp(_T("Name"), sName.c_str()))
{
res.m_pi.m_sName = pNode->GetText();
}
- else if(0 == quotes_stricmp(_T("ref"),sName.c_str()))
+ else if (0 == quotes_stricmp(_T("ref"), sName.c_str()))
{
res.m_pi.m_sURL = pNode->GetText();
}
- else if(0 == quotes_stricmp(_T("url"),sName.c_str()))
+ else if (0 == quotes_stricmp(_T("url"), sName.c_str()))
{
res.m_sURL = pNode->GetText();
}
@@ -165,22 +165,22 @@ namespace }
}
- res.m_qs = CQuotesProviderBase::CQuoteSection(res.m_pi.m_sName,aSections);
+ res.m_qs = CQuotesProviderBase::CQuoteSection(res.m_pi.m_sName, aSections);
return res;
}
- CQuotesProviderBase::CXMLFileInfo init_xml_info(LPCTSTR pszFileName,bool& rbSucceded)
+ CQuotesProviderBase::CXMLFileInfo init_xml_info(LPCTSTR pszFileName, bool& rbSucceded)
{
rbSucceded = false;
tstring sIniFile = get_ini_file_name(pszFileName);
- return parse_ini_file(sIniFile,rbSucceded);
+ return parse_ini_file(sIniFile, rbSucceded);
}
}
CQuotesProviderBase::CQuotesProviderBase()
- : m_hEventSettingsChanged(::CreateEvent(NULL,FALSE,FALSE,NULL)),
- m_hEventRefreshContact(::CreateEvent(NULL,FALSE,FALSE,NULL)),
- m_bRefreshInProgress(false)
+ : m_hEventSettingsChanged(::CreateEvent(NULL, FALSE, FALSE, NULL)),
+ m_hEventRefreshContact(::CreateEvent(NULL, FALSE, FALSE, NULL)),
+ m_bRefreshInProgress(false)
{
}
@@ -193,13 +193,13 @@ CQuotesProviderBase::~CQuotesProviderBase() bool CQuotesProviderBase::Init()
{
bool bSucceded = m_pXMLInfo != NULL;
- if(!m_pXMLInfo)
+ if (!m_pXMLInfo)
{
CQuotesProviderVisitorDbSettings visitor;
Accept(visitor);
assert(visitor.m_pszXMLIniFileName);
- m_pXMLInfo.reset(new CXMLFileInfo(init_xml_info(visitor.m_pszXMLIniFileName,bSucceded)));
+ m_pXMLInfo.reset(new CXMLFileInfo(init_xml_info(visitor.m_pszXMLIniFileName, bSucceded)));
}
return bSucceded;
@@ -207,13 +207,13 @@ bool CQuotesProviderBase::Init() CQuotesProviderBase::CXMLFileInfo* CQuotesProviderBase::GetXMLFileInfo()const
{
-// if(!m_pXMLInfo)
-// {
-// CQuotesProviderVisitorDbSettings visitor;
-// Accept(visitor);
-// assert(visitor.m_pszXMLIniFileName);
-// m_pXMLInfo.reset(new CXMLFileInfo(init_xml_info(visitor.m_pszXMLIniFileName)));
-// }
+ // if(!m_pXMLInfo)
+ // {
+ // CQuotesProviderVisitorDbSettings visitor;
+ // Accept(visitor);
+ // assert(visitor.m_pszXMLIniFileName);
+ // m_pXMLInfo.reset(new CXMLFileInfo(init_xml_info(visitor.m_pszXMLIniFileName)));
+ // }
return m_pXMLInfo.get();
}
@@ -241,7 +241,7 @@ bool CQuotesProviderBase::IsOnline() void CQuotesProviderBase::AddContact(MCONTACT hContact)
{
// CCritSection cs(m_cs);
- assert(m_aContacts.end() == std::find(m_aContacts.begin(),m_aContacts.end(),hContact));
+ assert(m_aContacts.end() == std::find(m_aContacts.begin(), m_aContacts.end(), hContact));
m_aContacts.push_back(hContact);
}
@@ -250,27 +250,27 @@ void CQuotesProviderBase::DeleteContact(MCONTACT hContact) {
CGuard<CLightMutex> cs(m_cs);
- TContracts::iterator i = std::find(m_aContacts.begin(),m_aContacts.end(),hContact);
- if(i != m_aContacts.end())
+ TContracts::iterator i = std::find(m_aContacts.begin(), m_aContacts.end(), hContact);
+ if (i != m_aContacts.end())
{
m_aContacts.erase(i);
}
}
-void CQuotesProviderBase::SetContactStatus(MCONTACT hContact,int nNewStatus)
+void CQuotesProviderBase::SetContactStatus(MCONTACT hContact, int nNewStatus)
{
- int nStatus = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_STATUS,ID_STATUS_OFFLINE);
- if(nNewStatus != nStatus)
+ int nStatus = db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_STATUS, ID_STATUS_OFFLINE);
+ if (nNewStatus != nStatus)
{
- db_set_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_STATUS,nNewStatus);
+ db_set_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_STATUS, nNewStatus);
- if(ID_STATUS_ONLINE != nNewStatus)
+ if (ID_STATUS_ONLINE != nNewStatus)
{
- db_unset(hContact,LIST_MODULE_NAME,STATUS_MSG_NAME);
- tstring sSymbol = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_SYMBOL);
- if(false == sSymbol.empty())
+ db_unset(hContact, LIST_MODULE_NAME, STATUS_MSG_NAME);
+ tstring sSymbol = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL);
+ if (false == sSymbol.empty())
{
- db_set_ts(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME,sSymbol.c_str());
+ db_set_ts(hContact, LIST_MODULE_NAME, CONTACT_LIST_NAME, sSymbol.c_str());
}
SetContactExtraImage(hContact, eiEmpty);
@@ -282,7 +282,7 @@ namespace {
class CTendency
{
- enum{NumValues = 2};
+ enum{ NumValues = 2 };
enum EComparison
{
NonValid,
@@ -304,20 +304,20 @@ namespace public:
CTendency() : m_nComparison(NonValid){}
- bool Parse(const IQuotesProvider* pProvider,const tstring& rsFrmt,MCONTACT hContact)
+ bool Parse(const IQuotesProvider* pProvider, const tstring& rsFrmt, MCONTACT hContact)
{
m_abValueFlags[0] = false;
m_abValueFlags[1] = false;
m_nComparison = NonValid;
bool bValid = true;
int nCurValue = 0;
- for(tstring::const_iterator i = rsFrmt.begin();i != rsFrmt.end() && bValid && nCurValue < NumValues;)
+ for (tstring::const_iterator i = rsFrmt.begin(); i != rsFrmt.end() && bValid && nCurValue < NumValues;)
{
TCHAR chr = *i;
- switch(chr)
+ switch (chr)
{
default:
- if(false == std::isspace(chr))
+ if (false == std::isspace(chr))
{
bValid = false;
}
@@ -328,13 +328,13 @@ namespace break;
case _T('%'):
++i;
- if(i != rsFrmt.end())
+ if (i != rsFrmt.end())
{
TCHAR t = *i;
++i;
- CQuotesProviderVisitorTendency visitor(hContact,t);
+ CQuotesProviderVisitorTendency visitor(hContact, t);
pProvider->Accept(visitor);
- if(false == visitor.IsValid())
+ if (false == visitor.IsValid())
{
bValid = false;
}
@@ -360,7 +360,7 @@ namespace ++i;
break;
case _T('='):
- switch(m_nComparison)
+ switch (m_nComparison)
{
default:
bValid = false;
@@ -383,18 +383,18 @@ namespace return (bValid && IsValid());
}
- bool IsValid()const{return (m_abValueFlags[0] && m_abValueFlags[1] && (m_nComparison != NonValid));}
+ bool IsValid()const{ return (m_abValueFlags[0] && m_abValueFlags[1] && (m_nComparison != NonValid)); }
EResult Compare()const
{
- switch(m_nComparison)
+ switch (m_nComparison)
{
case Greater:
- if(true == IsWithinAccuracy(m_adValues[0],m_adValues[1]))
+ if (true == IsWithinAccuracy(m_adValues[0], m_adValues[1]))
{
- return NotChanged;
+ return NotChanged;
}
- else if(m_adValues[0] > m_adValues[1])
+ else if (m_adValues[0] > m_adValues[1])
{
return Up;
}
@@ -404,10 +404,10 @@ namespace }
break;
case GreaterOrEqual:
- if((true == IsWithinAccuracy(m_adValues[0],m_adValues[1]))
+ if ((true == IsWithinAccuracy(m_adValues[0], m_adValues[1]))
|| (m_adValues[0] > m_adValues[1]))
{
- return Up;
+ return Up;
}
else //if(m_adValues[0] < m_adValues[1])
{
@@ -415,11 +415,11 @@ namespace }
break;
case Less:
- if(true == IsWithinAccuracy(m_adValues[0],m_adValues[1]))
+ if (true == IsWithinAccuracy(m_adValues[0], m_adValues[1]))
{
- return NotChanged;
+ return NotChanged;
}
- else if(m_adValues[0] < m_adValues[1])
+ else if (m_adValues[0] < m_adValues[1])
{
return Up;
}
@@ -429,10 +429,10 @@ namespace }
break;
case LessOrEqual:
- if((true == IsWithinAccuracy(m_adValues[0],m_adValues[1]))
+ if ((true == IsWithinAccuracy(m_adValues[0], m_adValues[1]))
|| (m_adValues[0] < m_adValues[1]))
{
- return Up;
+ return Up;
}
else //if(m_adValues[0] > m_adValues[1])
{
@@ -440,7 +440,7 @@ namespace }
break;
case Equal:
- if(true == IsWithinAccuracy(m_adValues[0],m_adValues[1]))
+ if (true == IsWithinAccuracy(m_adValues[0], m_adValues[1]))
{
return Up;
}
@@ -460,16 +460,15 @@ namespace };
tstring format_rate(const IQuotesProvider* pProvider,
- MCONTACT hContact,
- const tstring& rsFrmt,
- double dRate)
+ MCONTACT hContact,
+ const tstring& rsFrmt)
{
tstring sResult;
- for(tstring::const_iterator i = rsFrmt.begin();i != rsFrmt.end();)
+ for (tstring::const_iterator i = rsFrmt.begin(); i != rsFrmt.end();)
{
TCHAR chr = *i;
- switch(chr)
+ switch (chr)
{
default:
sResult += chr;
@@ -477,16 +476,16 @@ namespace break;
case _T('\\'):
++i;
- if(i != rsFrmt.end())
+ if (i != rsFrmt.end())
{
TCHAR t = *i;
- switch(t)
+ switch (t)
{
case _T('%'):sResult += _T("%"); break;
case _T('t'):sResult += _T("\t"); break;
case _T('n'):sResult += _T("\n"); break;
case _T('\\'):sResult += _T("\\"); break;
- default:sResult += chr;sResult += t;break;
+ default:sResult += chr; sResult += t; break;
}
++i;
}
@@ -497,16 +496,16 @@ namespace break;
case _T('%'):
++i;
- if(i != rsFrmt.end())
+ if (i != rsFrmt.end())
{
chr = *i;
byte nWidth = 0;
- if(::isdigit(chr))
+ if (::isdigit(chr))
{
- nWidth = chr-0x30;
+ nWidth = chr - 0x30;
++i;
- if(i == rsFrmt.end())
+ if (i == rsFrmt.end())
{
sResult += chr;
break;
@@ -517,7 +516,7 @@ namespace }
}
- CQuotesProviderVisitorFormater visitor(hContact,chr,nWidth);
+ CQuotesProviderVisitorFormater visitor(hContact, chr, nWidth);
pProvider->Accept(visitor);
const tstring& s = visitor.GetResult();
sResult += s;
@@ -535,112 +534,106 @@ namespace }
void log_to_file(const IQuotesProvider* pProvider,
- MCONTACT hContact,
- double dRate,
- const tstring& rsLogFileName,
- const tstring& rsFormat)
- {
-// USES_CONVERSION;
-// const char* pszPath = CT2A(rsLogFileName.c_str());
+ MCONTACT hContact,
+ const tstring& rsLogFileName,
+ const tstring& rsFormat)
+ {
+ // USES_CONVERSION;
+ // const char* pszPath = CT2A(rsLogFileName.c_str());
std::string sPath = quotes_t2a(rsLogFileName.c_str());
std::string::size_type n = sPath.find_last_of("\\/");
- if(std::string::npos != n)
+ if (std::string::npos != n)
{
sPath.erase(n);
}
DWORD dwAttributes = ::GetFileAttributesA(sPath.c_str());
- if((0xffffffff == dwAttributes) || (0 == (dwAttributes&FILE_ATTRIBUTE_DIRECTORY)))
+ if ((0xffffffff == dwAttributes) || (0 == (dwAttributes&FILE_ATTRIBUTE_DIRECTORY)))
CreateDirectoryTree(sPath.c_str());
- tofstream file(rsLogFileName.c_str(),std::ios::app|std::ios::out);
+ tofstream file(rsLogFileName.c_str(), std::ios::app | std::ios::out);
file.imbue(GetSystemLocale());
- if(file.good())
+ if (file.good())
{
- tstring s = format_rate(pProvider,hContact,rsFormat,dRate);
+ tstring s = format_rate(pProvider, hContact, rsFormat);
file << s;
}
}
void log_to_history(const IQuotesProvider* pProvider,
- MCONTACT hContact,
- double dRate,
- time_t nTime,
- const tstring& rsFormat)
+ MCONTACT hContact,
+ time_t nTime,
+ const tstring& rsFormat)
{
- tstring s = format_rate(pProvider,hContact,rsFormat,dRate);
- ptrA psz( mir_utf8encodeT(s.c_str()));
+ tstring s = format_rate(pProvider, hContact, rsFormat);
+ ptrA psz(mir_utf8encodeT(s.c_str()));
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = QUOTES_PROTOCOL_NAME;
dbei.timestamp = static_cast<DWORD>(nTime);
- dbei.flags = DBEF_READ|DBEF_UTF;
+ dbei.flags = DBEF_READ | DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = ::mir_strlen(psz)+1;
+ dbei.cbBlob = ::mir_strlen(psz) + 1;
dbei.pBlob = (PBYTE)(char*)psz;
db_event_add(hContact, &dbei);
}
- bool do_set_contact_extra_icon(MCONTACT hContact,const CTendency& tendency)
+ bool do_set_contact_extra_icon(MCONTACT hContact, const CTendency& tendency)
{
- bool bResult = false;
CTendency::EResult nComparison = tendency.Compare();
//if(true == IsWithinAccuracy(dCurrRate,dPrevRate))
- if(CTendency::NotChanged == nComparison)
- return SetContactExtraImage(hContact, eiNotChanged);
+ if (CTendency::NotChanged == nComparison)
+ return SetContactExtraImage(hContact, eiNotChanged);
- if(CTendency::Up == nComparison)//(dCurrRate > dPrevRate)
+ if (CTendency::Up == nComparison)//(dCurrRate > dPrevRate)
return SetContactExtraImage(hContact, eiUp);
- if(CTendency::Down == nComparison)//(dCurrRate < dPrevRate)
+ if (CTendency::Down == nComparison)//(dCurrRate < dPrevRate)
return SetContactExtraImage(hContact, eiDown);
return false;
}
bool show_popup(const IQuotesProvider* pProvider,
- MCONTACT hContact,
- double dRate,
-// double dPrevRate,
-// bool bValidPrevRate,
- const CTendency& tendency,
- const tstring& rsFormat,
- const CPopupSettings& ps)
+ MCONTACT hContact,
+ const CTendency& tendency,
+ const tstring& rsFormat,
+ const CPopupSettings& ps)
{
- if(1 == ServiceExists(MS_POPUP_ADDPOPUPT))
+ if (1 == ServiceExists(MS_POPUP_ADDPOPUPT))
{
POPUPDATAT ppd;
memset(&ppd, 0, sizeof(ppd));
ppd.lchContact = hContact;
//if((true == bValidPrevRate))
- if(tendency.IsValid())
+ if (tendency.IsValid())
{
CTendency::EResult nComparison = tendency.Compare();
- if(CTendency::NotChanged == nComparison)//(true == IsWithinAccuracy(dRate,dPrevRate))
+ if (CTendency::NotChanged == nComparison)//(true == IsWithinAccuracy(dRate,dPrevRate))
{
ppd.lchIcon = Quotes_LoadIconEx(ICON_STR_QUOTE_NOT_CHANGED);
}
- else if(CTendency::Up == nComparison)//(dRate > dPrevRate)
+ else if (CTendency::Up == nComparison)//(dRate > dPrevRate)
{
ppd.lchIcon = Quotes_LoadIconEx(ICON_STR_QUOTE_UP);
}
- else if(CTendency::Down == nComparison)
+ else if (CTendency::Down == nComparison)
{
ppd.lchIcon = Quotes_LoadIconEx(ICON_STR_QUOTE_DOWN);
}
}
- CQuotesProviderVisitorFormater visitor(hContact,_T('s'),0);
+ CQuotesProviderVisitorFormater visitor(hContact, _T('s'), 0);
pProvider->Accept(visitor);
const tstring& sTitle = visitor.GetResult();
- mir_tstrncpy(ppd.lptzContactName,sTitle.c_str(),MAX_CONTACTNAME);
+ mir_tstrncpy(ppd.lptzContactName, sTitle.c_str(), MAX_CONTACTNAME);
mir_safe_string<TCHAR> ss(variables_parsedup((TCHAR*)rsFormat.c_str(), 0, hContact));
- tstring sText = format_rate(pProvider,hContact,ss.m_p,dRate);
- mir_tstrncpy(ppd.lptzText,sText.c_str(),MAX_SECONDLINE);
+ tstring sText = format_rate(pProvider, hContact, ss.m_p);
+ mir_tstrncpy(ppd.lptzText, sText.c_str(), MAX_SECONDLINE);
- if(CPopupSettings::colourDefault == ps.GetColourMode())
+ if (CPopupSettings::colourDefault == ps.GetColourMode())
{
ppd.colorText = CPopupSettings::GetDefColourText();
ppd.colorBack = CPopupSettings::GetDefColourBk();
@@ -651,7 +644,7 @@ namespace ppd.colorBack = ps.GetColourBk();
}
- switch(ps.GetDelayMode())
+ switch (ps.GetDelayMode())
{
default:
assert(!"Unknown popup delay mode");
@@ -667,12 +660,12 @@ namespace }
LPARAM lp = 0;
- if(false == ps.GetHistoryFlag())
+ if (false == ps.GetHistoryFlag())
{
lp |= 0x08;
}
- return (0 == CallService(MS_POPUP_ADDPOPUPT,reinterpret_cast<WPARAM>(&ppd),lp));
+ return (0 == CallService(MS_POPUP_ADDPOPUPT, reinterpret_cast<WPARAM>(&ppd), lp));
}
else
{
@@ -681,39 +674,39 @@ namespace }
}
-void CQuotesProviderBase::WriteContactRate(MCONTACT hContact,double dRate,const tstring& rsSymbol/* = ""*/)
+void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, const tstring& rsSymbol/* = ""*/)
{
time_t nTime = ::time(NULL);
- if(false == rsSymbol.empty())
+ if (false == rsSymbol.empty())
{
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_SYMBOL,rsSymbol.c_str());
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL, rsSymbol.c_str());
}
double dPrev = 0.0;
- bool bValidPrev = Quotes_DBReadDouble(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_CURR_VALUE,dPrev);
- if(true == bValidPrev)
+ bool bValidPrev = Quotes_DBReadDouble(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_CURR_VALUE, dPrev);
+ if (true == bValidPrev)
{
- Quotes_DBWriteDouble(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_PREV_VALUE,dPrev);
+ Quotes_DBWriteDouble(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_PREV_VALUE, dPrev);
}
- Quotes_DBWriteDouble(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_CURR_VALUE,dRate);
- db_set_dw(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FETCH_TIME,nTime);
+ Quotes_DBWriteDouble(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_CURR_VALUE, dRate);
+ db_set_dw(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FETCH_TIME, nTime);
tstring sSymbol = rsSymbol;
tostringstream oNick;
oNick.imbue(GetSystemLocale());
- if(false == m_sContactListFormat.empty())
+ if (false == m_sContactListFormat.empty())
{
- tstring s = format_rate(this,hContact,m_sContactListFormat,dRate);
+ tstring s = format_rate(this, hContact, m_sContactListFormat);
oNick << s;
}
else
{
- if(true == sSymbol.empty())
+ if (true == sSymbol.empty())
{
- sSymbol = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_SYMBOL);
+ sSymbol = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL);
}
oNick << std::setfill(_T(' ')) << std::setw(10) << std::left << sSymbol << std::setw(6) << std::right << dRate;
}
@@ -722,114 +715,114 @@ void CQuotesProviderBase::WriteContactRate(MCONTACT hContact,double dRate,const if (true == tendency.Parse(this, m_sTendencyFormat, hContact))
do_set_contact_extra_icon(hContact, tendency);
- db_set_ts(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME,oNick.str().c_str());
+ db_set_ts(hContact, LIST_MODULE_NAME, CONTACT_LIST_NAME, oNick.str().c_str());
- tstring sStatusMsg = format_rate(this,hContact,m_sStatusMsgFormat,dRate);
- if(false == sStatusMsg.empty())
+ tstring sStatusMsg = format_rate(this, hContact, m_sStatusMsgFormat);
+ if (false == sStatusMsg.empty())
{
- db_set_ts(hContact,LIST_MODULE_NAME,STATUS_MSG_NAME,sStatusMsg.c_str());
+ db_set_ts(hContact, LIST_MODULE_NAME, STATUS_MSG_NAME, sStatusMsg.c_str());
}
else
{
- db_unset(hContact,LIST_MODULE_NAME,STATUS_MSG_NAME);
+ db_unset(hContact, LIST_MODULE_NAME, STATUS_MSG_NAME);
}
- bool bUseContactSpecific = (db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,0) > 0);
+ bool bUseContactSpecific = (db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_CONTACT_SPEC_SETTINGS, 0) > 0);
CAdvProviderSettings global_settings(this);
- WORD dwMode = (bUseContactSpecific)
- ? db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG,static_cast<WORD>(lmDisabled))
+ WORD dwMode = (bUseContactSpecific)
+ ? db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG, static_cast<WORD>(lmDisabled))
: global_settings.GetLogMode();
- if(dwMode&lmExternalFile)
+ if (dwMode&lmExternalFile)
{
bool bAdd = true;
bool bOnlyIfChanged = (bUseContactSpecific)
- ? (db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE_CONDITION,1) > 0)
+ ? (db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE_CONDITION, 1) > 0)
: global_settings.GetLogOnlyChangedFlag();
- if(true == bOnlyIfChanged)
+ if (true == bOnlyIfChanged)
{
- bAdd = ((false == bValidPrev) || (false == IsWithinAccuracy(dRate,dPrev)));
+ bAdd = ((false == bValidPrev) || (false == IsWithinAccuracy(dRate, dPrev)));
}
- if(true == bAdd)
+ if (true == bAdd)
{
- tstring sLogFileName = (bUseContactSpecific)
- ? Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE,global_settings.GetLogFileName().c_str())
+ tstring sLogFileName = (bUseContactSpecific)
+ ? Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE, global_settings.GetLogFileName().c_str())
: global_settings.GetLogFileName();
- if(true == sSymbol.empty())
+ if (true == sSymbol.empty())
{
- sSymbol = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_SYMBOL);
+ sSymbol = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL);
}
- sLogFileName = GenerateLogFileName(sLogFileName,sSymbol);
+ sLogFileName = GenerateLogFileName(sLogFileName, sSymbol);
tstring sFormat = global_settings.GetLogFormat();
- if(bUseContactSpecific)
+ if (bUseContactSpecific)
{
CQuotesProviderVisitorDbSettings visitor;
Accept(visitor);
- sFormat = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_LOG_FILE,visitor.m_pszDefLogFileFormat);
+ sFormat = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_LOG_FILE, visitor.m_pszDefLogFileFormat);
}
- log_to_file(this,hContact,dRate,sLogFileName,sFormat);
+ log_to_file(this, hContact, sLogFileName, sFormat);
}
}
- if(dwMode&lmInternalHistory)
+ if (dwMode&lmInternalHistory)
{
bool bAdd = true;
- bool bOnlyIfChanged = (bUseContactSpecific)
- ? (db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_HISTORY_CONDITION,1) > 0)
+ bool bOnlyIfChanged = (bUseContactSpecific)
+ ? (db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_HISTORY_CONDITION, 1) > 0)
: global_settings.GetHistoryOnlyChangedFlag();
- if(true == bOnlyIfChanged)
+ if (true == bOnlyIfChanged)
{
- bAdd = ((false == bValidPrev) || (false == IsWithinAccuracy(dRate,dPrev)));
+ bAdd = ((false == bValidPrev) || (false == IsWithinAccuracy(dRate, dPrev)));
}
- if(true == bAdd)
+ if (true == bAdd)
{
- tstring sFormat = (bUseContactSpecific)
- ? Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_HISTORY,global_settings.GetHistoryFormat().c_str())
+ tstring sFormat = (bUseContactSpecific)
+ ? Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_HISTORY, global_settings.GetHistoryFormat().c_str())
: global_settings.GetHistoryFormat();
- log_to_history(this,hContact,dRate,nTime,sFormat);
+ log_to_history(this, hContact, nTime, sFormat);
}
}
- if(dwMode&lmPopup)
+ if (dwMode&lmPopup)
{
- bool bOnlyIfChanged = (bUseContactSpecific)
- ? (1 == db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_CONDITION,1) > 0)
+ bool bOnlyIfChanged = (bUseContactSpecific)
+ ? (1 == db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_CONDITION, 1) > 0)
: global_settings.GetShowPopupIfValueChangedFlag();
- if((false == bOnlyIfChanged)
- || ((true == bOnlyIfChanged) && (true == bValidPrev) && (false == IsWithinAccuracy(dRate,dPrev))))
+ if ((false == bOnlyIfChanged)
+ || ((true == bOnlyIfChanged) && (true == bValidPrev) && (false == IsWithinAccuracy(dRate, dPrev))))
{
- tstring sFormat = (bUseContactSpecific)
- ? Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_POPUP,global_settings.GetPopupFormat().c_str())
+ tstring sFormat = (bUseContactSpecific)
+ ? Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_POPUP, global_settings.GetPopupFormat().c_str())
: global_settings.GetPopupFormat();
CPopupSettings ps = *(global_settings.GetPopupSettingsPtr());
ps.InitForContact(hContact);
- show_popup(this,hContact,dRate,tendency,sFormat,ps);
+ show_popup(this, hContact, tendency, sFormat, ps);
}
}
-// if((true == IsOnline()))
+ // if((true == IsOnline()))
{
- SetContactStatus(hContact,ID_STATUS_ONLINE);
+ SetContactStatus(hContact, ID_STATUS_ONLINE);
}
}
MCONTACT CQuotesProviderBase::CreateNewContact(const tstring& rsName)
{
- MCONTACT hContact = MCONTACT(CallService(MS_DB_CONTACT_ADD,0,0));
- if(hContact) {
- if(0 == CallService(MS_PROTO_ADDTOCONTACT, WPARAM(hContact), (LPARAM)QUOTES_PROTOCOL_NAME)) {
+ MCONTACT hContact = MCONTACT(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());
+ 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());
CGuard<CLightMutex> cs(m_cs);
m_aContacts.push_back(hContact);
@@ -847,7 +840,7 @@ namespace {
DWORD get_refresh_timeout_miliseconds(const CQuotesProviderVisitorDbSettings& visitor)
{
- if(!g_bAutoUpdate)
+ if (!g_bAutoUpdate)
{
return INFINITE;
}
@@ -855,36 +848,36 @@ namespace assert(visitor.m_pszDbRefreshRateType);
assert(visitor.m_pszDbRefreshRateValue);
- int nRefreshRateType = db_get_w(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateType,RRT_MINUTES);
- if(nRefreshRateType < RRT_SECONDS || nRefreshRateType > RRT_HOURS)
+ int nRefreshRateType = db_get_w(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbRefreshRateType, RRT_MINUTES);
+ if (nRefreshRateType < RRT_SECONDS || nRefreshRateType > RRT_HOURS)
{
nRefreshRateType = RRT_MINUTES;
}
- DWORD nTimeout = db_get_w(NULL,QUOTES_MODULE_NAME,visitor.m_pszDbRefreshRateValue,1);
- switch(nRefreshRateType)
+ DWORD nTimeout = db_get_w(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, 1);
+ switch (nRefreshRateType)
{
default:
case RRT_SECONDS:
- if(nTimeout < 1 || nTimeout > 60)
+ if (nTimeout < 1 || nTimeout > 60)
{
nTimeout = 1;
}
nTimeout *= 1000;
break;
case RRT_MINUTES:
- if(nTimeout < 1 || nTimeout > 60)
+ if (nTimeout < 1 || nTimeout > 60)
{
nTimeout = 1;
}
- nTimeout *= 1000*60;
+ nTimeout *= 1000 * 60;
break;
case RRT_HOURS:
- if(nTimeout < 1 || nTimeout > 24)
+ if (nTimeout < 1 || nTimeout > 24)
{
nTimeout = 1;
}
- nTimeout *= 1000*60*60;
+ nTimeout *= 1000 * 60 * 60;
break;
}
@@ -897,8 +890,8 @@ namespace class CBoolGuard
{
public:
- CBoolGuard(bool& rb) : m_b(rb){m_b = true;}
- ~CBoolGuard(){m_b = false;}
+ CBoolGuard(bool& rb) : m_b(rb){ m_b = true; }
+ ~CBoolGuard(){ m_b = false; }
private:
bool m_b;
@@ -911,9 +904,9 @@ void CQuotesProviderBase::Run() Accept(visitor);
DWORD nTimeout = get_refresh_timeout_miliseconds(visitor);
- m_sContactListFormat = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbDisplayNameFormat,visitor.m_pszDefDisplayFormat);
- m_sStatusMsgFormat = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbStatusMsgFormat,visitor.m_pszDefStatusMsgFormat);
- m_sTendencyFormat = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbTendencyFormat,visitor.m_pszDefTendencyFormat);
+ m_sContactListFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbDisplayNameFormat, visitor.m_pszDefDisplayFormat);
+ m_sStatusMsgFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbStatusMsgFormat, visitor.m_pszDefStatusMsgFormat);
+ m_sTendencyFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat);
enum{
STOP_THREAD = 0,
@@ -935,49 +928,49 @@ void CQuotesProviderBase::Run() bool bGoToBed = false;
- if(g_bAutoUpdate)
+ if (g_bAutoUpdate)
{
- CBoolGuard bg(m_bRefreshInProgress);
+ CBoolGuard bg(m_bRefreshInProgress);
RefreshQuotes(anContacts);
}
- while(false == bGoToBed)
- {
+ while (false == bGoToBed)
+ {
anContacts.clear();
DWORD dwBegin = ::GetTickCount();
- DWORD dwResult = ::WaitForMultipleObjects(COUNT_SYNC_OBJECTS,anEvents,FALSE,nTimeout);
- switch(dwResult)
+ DWORD dwResult = ::WaitForMultipleObjects(COUNT_SYNC_OBJECTS, anEvents, FALSE, nTimeout);
+ switch (dwResult)
{
case WAIT_FAILED:
assert(!"WaitForMultipleObjects failed");
bGoToBed = true;
break;
- case WAIT_ABANDONED_0+STOP_THREAD:
- case WAIT_ABANDONED_0+SETTINGS_CHANGED:
- case WAIT_ABANDONED_0+REFRESH_CONTACT:
+ case WAIT_ABANDONED_0 + STOP_THREAD:
+ case WAIT_ABANDONED_0 + SETTINGS_CHANGED:
+ case WAIT_ABANDONED_0 + REFRESH_CONTACT:
assert(!"WaitForMultipleObjects abandoned");
- case WAIT_OBJECT_0+STOP_THREAD:
+ case WAIT_OBJECT_0 + STOP_THREAD:
bGoToBed = true;
break;
- case WAIT_OBJECT_0+SETTINGS_CHANGED:
+ case WAIT_OBJECT_0 + SETTINGS_CHANGED:
nTimeout = get_refresh_timeout_miliseconds(visitor);
- m_sContactListFormat = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbDisplayNameFormat,visitor.m_pszDefDisplayFormat);
- m_sStatusMsgFormat = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbStatusMsgFormat,visitor.m_pszDefStatusMsgFormat);
- m_sTendencyFormat = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbTendencyFormat,visitor.m_pszDefTendencyFormat);
+ m_sContactListFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbDisplayNameFormat, visitor.m_pszDefDisplayFormat);
+ m_sStatusMsgFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbStatusMsgFormat, visitor.m_pszDefStatusMsgFormat);
+ m_sTendencyFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat);
{
CGuard<CLightMutex> cs(m_cs);
anContacts = m_aContacts;
}
break;
- case WAIT_OBJECT_0+REFRESH_CONTACT:
+ case WAIT_OBJECT_0 + REFRESH_CONTACT:
+ {
+ DWORD dwTimeRest = ::GetTickCount() - dwBegin;
+ if (INFINITE != nTimeout && dwTimeRest < nTimeout)
{
- DWORD dwTimeRest = ::GetTickCount()-dwBegin;
- if(INFINITE != nTimeout && dwTimeRest < nTimeout)
- {
- nTimeout -= dwTimeRest;
- }
+ nTimeout -= dwTimeRest;
+ }
{
CGuard<CLightMutex> cs(m_cs);
@@ -989,8 +982,8 @@ void CQuotesProviderBase::Run() CBoolGuard bg(m_bRefreshInProgress);
RefreshQuotes(anContacts);
}
- }
- break;
+ }
+ break;
case WAIT_TIMEOUT:
nTimeout = get_refresh_timeout_miliseconds(visitor);
{
@@ -1020,7 +1013,7 @@ void CQuotesProviderBase::OnEndRun() }
CBoolGuard bg(m_bRefreshInProgress);
- std::for_each(anContacts.begin(),anContacts.end(),boost::bind(&SetContactStatus,_1,ID_STATUS_OFFLINE));
+ std::for_each(anContacts.begin(), anContacts.end(), boost::bind(&SetContactStatus, _1, ID_STATUS_OFFLINE));
}
void CQuotesProviderBase::Accept(CQuotesProviderVisitor& visitor)const
@@ -1039,7 +1032,7 @@ void CQuotesProviderBase::RefreshAllContacts() {// for CCritSection
CGuard<CLightMutex> cs(m_cs);
m_aRefreshingContacts.clear();
- std::for_each(std::begin(m_aContacts),std::end(m_aContacts),[&](MCONTACT hContact){m_aRefreshingContacts.push_back(hContact);});
+ std::for_each(std::begin(m_aContacts), std::end(m_aContacts), [&](MCONTACT hContact){m_aRefreshingContacts.push_back(hContact); });
}
BOOL b = ::SetEvent(m_hEventRefreshContact);
diff --git a/plugins/Quotes/src/QuotesProviderBase.h b/plugins/Quotes/src/QuotesProviderBase.h index 62d551f4b6..6e923b693c 100644 --- a/plugins/Quotes/src/QuotesProviderBase.h +++ b/plugins/Quotes/src/QuotesProviderBase.h @@ -7,12 +7,12 @@ public: class CQuote
{
public:
- CQuote(const tstring& rsID = _T(""),const tstring& rsSymbol = _T(""),const tstring& rsName = _T(""))
- : m_sSymbol(rsSymbol),m_sName(rsName),m_sID(rsID){}
+ CQuote(const tstring& rsID = _T(""), const tstring& rsSymbol = _T(""), const tstring& rsName = _T(""))
+ : m_sSymbol(rsSymbol), m_sName(rsName), m_sID(rsID){}
- const tstring& GetSymbol()const{return m_sSymbol;}
- const tstring& GetName()const{return m_sName;}
- const tstring& GetID()const{return m_sID;}
+ const tstring& GetSymbol()const{ return m_sSymbol; }
+ const tstring& GetName()const{ return m_sName; }
+ const tstring& GetID()const{ return m_sID; }
private:
tstring m_sSymbol;
@@ -27,21 +27,31 @@ public: typedef std::vector<CQuote> TQuotes;
public:
- CQuoteSection(const tstring& rsName = _T(""),const TSections& raSections = TSections(),const TQuotes& raQuotes = TQuotes())
- : m_sName(rsName),m_aSections(raSections),m_aQuotes(raQuotes){}
+ CQuoteSection(const tstring& rsName = _T(""), const TSections& raSections = TSections(), const TQuotes& raQuotes = TQuotes())
+ : m_sName(rsName), m_aSections(raSections), m_aQuotes(raQuotes){}
const tstring& GetName()const
- {return m_sName;}
+ {
+ return m_sName;
+ }
size_t GetSectionCount()const
- {return m_aSections.size();}
+ {
+ return m_aSections.size();
+ }
CQuoteSection GetSection(size_t nIndex)const
- {return ((nIndex < m_aSections.size()) ? m_aSections[nIndex] : CQuoteSection());}
+ {
+ return ((nIndex < m_aSections.size()) ? m_aSections[nIndex] : CQuoteSection());
+ }
size_t GetQuoteCount()const
- {return m_aQuotes.size();}
+ {
+ return m_aQuotes.size();
+ }
CQuote GetQuote(size_t nIndex)const
- {return ((nIndex < m_aQuotes.size()) ? m_aQuotes[nIndex] : CQuote());}
+ {
+ return ((nIndex < m_aQuotes.size()) ? m_aQuotes[nIndex] : CQuote());
+ }
private:
tstring m_sName;
@@ -61,7 +71,7 @@ public: const CQuoteSection& GetQuotes()const;
-// void SetSettingsEvent();
+ // void SetSettingsEvent();
virtual bool Init();
virtual const CProviderInfo& GetInfo()const;
@@ -72,14 +82,14 @@ public: virtual void RefreshAllContacts();
virtual void RefreshSettings();
virtual void RefreshContact(MCONTACT hContact);
-// virtual void SetContactExtraIcon(MCONTACT hContact)const;
+ // virtual void SetContactExtraIcon(MCONTACT hContact)const;
protected:
const tstring& GetURL()const;
MCONTACT CreateNewContact(const tstring& rsName);
static bool IsOnline();
- static void SetContactStatus(MCONTACT hContact,int nNewStatus);
- void WriteContactRate(MCONTACT hContact,double dRate,const tstring& rsSymbol = _T(""));
+ static void SetContactStatus(MCONTACT hContact, int nNewStatus);
+ void WriteContactRate(MCONTACT hContact, double dRate, const tstring& rsSymbol = _T(""));
private:
virtual void RefreshQuotes(TContracts& anContacts) = 0;
diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp index 0be79c498e..a2aaa28e93 100644 --- a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp +++ b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp @@ -12,10 +12,10 @@ namespace {
inline tstring get_quote_id(MCONTACT hContact)
{
- return Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_ID);
+ return Quotes_DBGetStringT(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_ID);
}
- inline bool is_quote_id_equal(MCONTACT hContact,const tstring& sID)
+ inline bool is_quote_id_equal(MCONTACT hContact, const tstring& sID)
{
return sID == get_quote_id(hContact);
}
@@ -23,18 +23,18 @@ namespace bool CQuotesProviderDukasCopy::IsQuoteWatched(const CQuote& rQuote)const
{
- return m_aContacts.end() != std::find_if(m_aContacts.begin(),m_aContacts.end(),
- boost::bind(is_quote_id_equal,_1,rQuote.GetID()));
+ return m_aContacts.end() != std::find_if(m_aContacts.begin(), m_aContacts.end(),
+ boost::bind(is_quote_id_equal, _1, rQuote.GetID()));
}
-bool CQuotesProviderDukasCopy::WatchForQuote(const CQuote& rQuote,bool bWatch)
+bool CQuotesProviderDukasCopy::WatchForQuote(const CQuote& rQuote, bool bWatch)
{
const tstring& sQuoteID = rQuote.GetID();
- TContracts::iterator i =
- std::find_if(m_aContacts.begin(),m_aContacts.end(),
- boost::bind(is_quote_id_equal,_1,sQuoteID));
+ TContracts::iterator i =
+ std::find_if(m_aContacts.begin(), m_aContacts.end(),
+ boost::bind(is_quote_id_equal, _1, sQuoteID));
- if((false == bWatch) && (i != m_aContacts.end()))
+ if ((false == bWatch) && (i != m_aContacts.end()))
{
MCONTACT hContact = *i;
{// for CCritSection
@@ -45,15 +45,15 @@ bool CQuotesProviderDukasCopy::WatchForQuote(const CQuote& rQuote,bool bWatch) CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0);
return true;
}
- else if((true == bWatch) && (i == m_aContacts.end()))
+ else if ((true == bWatch) && (i == m_aContacts.end()))
{
MCONTACT hContact = CreateNewContact(rQuote.GetSymbol());
- if(hContact)
+ if (hContact)
{
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_ID,sQuoteID.c_str());
- if(false == rQuote.GetName().empty())
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_ID, sQuoteID.c_str());
+ if (false == rQuote.GetName().empty())
{
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_DESCRIPTION,rQuote.GetName().c_str());
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_DESCRIPTION, rQuote.GetName().c_str());
}
return true;
@@ -70,11 +70,11 @@ tstring CQuotesProviderDukasCopy::BuildHTTPURL()const {
CGuard<CLightMutex> cs(m_cs);
- for(TContracts::const_iterator i = m_aContacts.begin();i != m_aContacts.end();++i)
+ for (TContracts::const_iterator i = m_aContacts.begin(); i != m_aContacts.end(); ++i)
{
MCONTACT hContact = *i;
tstring sID = get_quote_id(hContact);
- if(false == sID.empty())
+ if (false == sID.empty())
{
sURL << sID << _T(",");
}
@@ -88,7 +88,7 @@ namespace {
struct CEconomicRateInfo
{
- CEconomicRateInfo() : m_dCurRate(0.0),m_dPrevRate(0.0) {}
+ CEconomicRateInfo() : m_dCurRate(0.0), m_dPrevRate(0.0) {}
tstring m_sName;
double m_dCurRate;
double m_dPrevRate;
@@ -98,14 +98,14 @@ namespace typedef std::vector<CEconomicRateInfo> TEconomicRates;
typedef IHTMLNode::THTMLNodePtr THTMLNodePtr;
- bool string2double(const TCHAR* pszText,double& rValue)
+ bool string2double(const TCHAR* pszText, double& rValue)
{
assert(pszText);
try
{
rValue = boost::lexical_cast<double>(pszText);
}
- catch(boost::bad_lexical_cast &)
+ catch (boost::bad_lexical_cast &)
{
return false;
}
@@ -114,43 +114,43 @@ namespace }
- void parse_row(const THTMLNodePtr& pRow,TEconomicRates& raRates)
+ void parse_row(const THTMLNodePtr& pRow, TEconomicRates& raRates)
{
CEconomicRateInfo ri;
ri.m_sID = pRow->GetAttribute(_T("sid"));
- if(false == ri.m_sID.empty())
+ if (false == ri.m_sID.empty())
{
unsigned short cColsHandled = 0;
tostringstream sSidID;
sSidID << _T("id") << ri.m_sID;
size_t cNodes = pRow->GetChildCount();
- for(size_t i = 0;i < cNodes && cColsHandled < 2;++i)
+ for (size_t i = 0; i < cNodes && cColsHandled < 2; ++i)
{
THTMLNodePtr pCol = pRow->GetChildPtr(i);
- if(pCol)
+ if (pCol)
{
tstring sColID = pCol->GetAttribute(_T("id"));
- if(false == sColID.empty())
+ if (false == sColID.empty())
{
- if(0 == quotes_stricmp(sColID.c_str(),_T("stock")))
+ if (0 == quotes_stricmp(sColID.c_str(), _T("stock")))
{
ri.m_sName = pCol->GetText();
- if(false == ri.m_sName.empty())
+ if (false == ri.m_sName.empty())
{
++cColsHandled;
}
}
- else if(0 == quotes_stricmp(sSidID.str().c_str(),sColID.c_str()))
+ else if (0 == quotes_stricmp(sSidID.str().c_str(), sColID.c_str()))
{
tstring sRate = pCol->GetText();
- if((false == sRate.empty()) && (true == string2double(sRate.c_str(),ri.m_dCurRate)))
+ if ((false == sRate.empty()) && (true == string2double(sRate.c_str(), ri.m_dCurRate)))
{
ri.m_dPrevRate = ri.m_dCurRate;
++cColsHandled;
tstring sOldRate = pCol->GetAttribute(_T("oldPrice"));
- if(false == sOldRate.empty())
+ if (false == sOldRate.empty())
{
- string2double(sOldRate.c_str(),ri.m_dPrevRate);
+ string2double(sOldRate.c_str(), ri.m_dPrevRate);
}
}
}
@@ -158,47 +158,47 @@ namespace }
}
- if(2 == cColsHandled)
+ if (2 == cColsHandled)
{
raRates.push_back(ri);
}
}
}
-// void parse_table(const THTMLNodePtr& pNode,TEconomicRates& raRates)
-// {
-// size_t cNodes = pNode->GetChildCount();
-// for(size_t i = 0;i < cNodes;++i)
-// {
-// THTMLNodePtr pChild = pNode->GetChildPtr(i);
-// if(pChild && pChild->Is(IHTMLNode::TableRow))
-// {
-// parse_row(pChild,raRates);
-// }
-// }
-//
-// }
-
- void parser_html_node(const THTMLNodePtr& pNode,TEconomicRates& raRates)
+ // void parse_table(const THTMLNodePtr& pNode,TEconomicRates& raRates)
+ // {
+ // size_t cNodes = pNode->GetChildCount();
+ // for(size_t i = 0;i < cNodes;++i)
+ // {
+ // THTMLNodePtr pChild = pNode->GetChildPtr(i);
+ // if(pChild && pChild->Is(IHTMLNode::TableRow))
+ // {
+ // parse_row(pChild,raRates);
+ // }
+ // }
+ //
+ // }
+
+ void parser_html_node(const THTMLNodePtr& pNode, TEconomicRates& raRates)
{
size_t cNodes = pNode->GetChildCount();
- for(size_t i = 0;i < cNodes;++i)
+ for (size_t i = 0; i < cNodes; ++i)
{
THTMLNodePtr pChild = pNode->GetChildPtr(i);
- if(pChild && pChild->Is(IHTMLNode::TableRow))
+ if (pChild && pChild->Is(IHTMLNode::TableRow))
{
- parse_row(pChild,raRates);
+ parse_row(pChild, raRates);
}
}
}
- bool parse_HTML(const tstring& sHTML,TEconomicRates& raRates)
+ bool parse_HTML(const tstring& sHTML, TEconomicRates& raRates)
{
IHTMLEngine::THTMLParserPtr pHTMLParser = CModuleInfo::GetHTMLEngine()->GetParserPtr();
THTMLNodePtr pRoot = pHTMLParser->ParseString(sHTML);
- if(pRoot)
+ if (pRoot)
{
- parser_html_node(pRoot,raRates);
+ parser_html_node(pRoot, raRates);
return true;
}
else
@@ -211,42 +211,42 @@ namespace void CQuotesProviderDukasCopy::RefreshQuotes(TContracts& anContacts)
{
- if(CModuleInfo::GetInstance().GetExtendedStatusFlag())
+ if (CModuleInfo::GetInstance().GetExtendedStatusFlag())
{
- std::for_each(anContacts.begin(),anContacts.end(),
- boost::bind(SetContactStatus,_1,ID_STATUS_OCCUPIED));
+ std::for_each(anContacts.begin(), anContacts.end(),
+ boost::bind(SetContactStatus, _1, ID_STATUS_OCCUPIED));
}
tstring sURL = BuildHTTPURL();
CHTTPSession http;
-// LogIt(Info,sURL);
- if(true == http.OpenURL(sURL))
+ // LogIt(Info,sURL);
+ if (true == http.OpenURL(sURL))
{
-// if(true == IsOnline())
+ // if(true == IsOnline())
{
tstring sHTML;
- if(true == http.ReadResponce(sHTML))
+ if (true == http.ReadResponce(sHTML))
{
-// LogIt(Info,sHTML);
-// if(true == IsOnline())
+ // LogIt(Info,sHTML);
+ // if(true == IsOnline())
{
TEconomicRates aRates;
- if(true == parse_HTML(sHTML,aRates)
+ if (true == parse_HTML(sHTML, aRates)
&& (true == IsOnline()))
{
- for(TEconomicRates::const_iterator it = aRates.begin();(it != aRates.end()) && (true == IsOnline());++it)
+ for (TEconomicRates::const_iterator it = aRates.begin(); (it != aRates.end()) && (true == IsOnline()); ++it)
{
const CEconomicRateInfo& ri = *it;
- TContracts::iterator i = std::find_if(anContacts.begin(),anContacts.end(),
- boost::bind(is_quote_id_equal,_1,ri.m_sID));
- if(i != anContacts.end() && (true == IsOnline()))
+ TContracts::iterator i = std::find_if(anContacts.begin(), anContacts.end(),
+ boost::bind(is_quote_id_equal, _1, ri.m_sID));
+ if (i != anContacts.end() && (true == IsOnline()))
{
MCONTACT hContact = *i;
anContacts.erase(i);
- WriteContactRate(hContact,ri.m_dCurRate,ri.m_sName);
+ WriteContactRate(hContact, ri.m_dCurRate, ri.m_sName);
}
}
}
@@ -255,13 +255,13 @@ void CQuotesProviderDukasCopy::RefreshQuotes(TContracts& anContacts) }
}
- std::for_each(anContacts.begin(),anContacts.end(),
- boost::bind(&SetContactStatus,_1,ID_STATUS_NA));
+ std::for_each(anContacts.begin(), anContacts.end(),
+ boost::bind(&SetContactStatus, _1, ID_STATUS_NA));
}
-void CQuotesProviderDukasCopy::ShowPropertyPage(WPARAM wp,OPTIONSDIALOGPAGE& odp)
+void CQuotesProviderDukasCopy::ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE& odp)
{
- ShowDukasCopyPropPage(this,wp,odp);
+ ShowDukasCopyPropPage(this, wp, odp);
}
void CQuotesProviderDukasCopy::Accept(CQuotesProviderVisitor& visitor)const
@@ -274,9 +274,9 @@ MCONTACT CQuotesProviderDukasCopy::GetContactByQuoteID(const tstring& rsQuoteID) {
CGuard<CLightMutex> cs(m_cs);
- TContracts::const_iterator i = std::find_if(m_aContacts.begin(),m_aContacts.end(),
- boost::bind(std::equal_to<tstring>(),rsQuoteID,boost::bind(get_quote_id,_1)));
- if(i != m_aContacts.end())
+ TContracts::const_iterator i = std::find_if(m_aContacts.begin(), m_aContacts.end(),
+ boost::bind(std::equal_to<tstring>(), rsQuoteID, boost::bind(get_quote_id, _1)));
+ if (i != m_aContacts.end())
return *i;
return NULL;
diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.h b/plugins/Quotes/src/QuotesProviderDukasCopy.h index 1c53f53dd4..596c6bb79e 100644 --- a/plugins/Quotes/src/QuotesProviderDukasCopy.h +++ b/plugins/Quotes/src/QuotesProviderDukasCopy.h @@ -13,23 +13,23 @@ public: CQuotesProviderDukasCopy();
~CQuotesProviderDukasCopy();
- bool WatchForQuote(const CQuote& rQuote,bool bWatch);
+ bool WatchForQuote(const CQuote& rQuote, bool bWatch);
bool IsQuoteWatched(const CQuote& rQuote)const;
MCONTACT GetContactByQuoteID(const tstring& rsQuoteID)const;
-// #ifdef CHART_IMPLEMENT
-// bool Chart(MCONTACT hContact,const tstring& url)const;
-// #endif
+ // #ifdef CHART_IMPLEMENT
+ // bool Chart(MCONTACT hContact,const tstring& url)const;
+ // #endif
private:
//IQuotesProvider implementation
virtual void RefreshQuotes(TContracts& anContacts);
- virtual void ShowPropertyPage(WPARAM wp,OPTIONSDIALOGPAGE& odp);
+ virtual void ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE& odp);
virtual void Accept(CQuotesProviderVisitor& visitor)const;
private:
tstring BuildHTTPURL()const;
-
+
};
#endif //__93121758_68c7_4836_b571_da84dfe82b84_QuotesProviderDukasCopy_h__
diff --git a/plugins/Quotes/src/QuotesProviderFinance.cpp b/plugins/Quotes/src/QuotesProviderFinance.cpp index 97fa950de3..78e7444987 100644 --- a/plugins/Quotes/src/QuotesProviderFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderFinance.cpp @@ -3,12 +3,12 @@ void CQuotesProviderFinance::GetWatchedQuotes(TQuotes& raQuotes)const
{
raQuotes.clear();
- BOOST_FOREACH(MCONTACT hContact,m_aContacts)
+ BOOST_FOREACH(MCONTACT hContact, m_aContacts)
{
- tstring sID = Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_ID);
- tstring sSymbol = Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_SYMBOL,sID.c_str());
- tstring sDescr = Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_DESCRIPTION);
- CQuotesProviderBase::CQuote quote(sID,sSymbol,sDescr);
+ tstring sID = Quotes_DBGetStringT(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_ID);
+ tstring sSymbol = Quotes_DBGetStringT(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_SYMBOL, sID.c_str());
+ tstring sDescr = Quotes_DBGetStringT(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_DESCRIPTION);
+ CQuotesProviderBase::CQuote quote(sID, sSymbol, sDescr);
raQuotes.push_back(quote);
}
@@ -18,20 +18,20 @@ namespace {
inline tstring get_quote_id(MCONTACT hContact)
{
- return Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_ID);
+ return Quotes_DBGetStringT(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_ID);
}
- inline bool is_quote_id_equal(MCONTACT hContact,const tstring& sID)
+ inline bool is_quote_id_equal(MCONTACT hContact, const tstring& sID)
{
return sID == get_quote_id(hContact);
}
}
-bool CQuotesProviderFinance::WatchForQuote(const CQuote& rQuote,bool bWatch)
+bool CQuotesProviderFinance::WatchForQuote(const CQuote& rQuote, bool bWatch)
{
const tstring& sQuoteID = rQuote.GetID();
- TContracts::iterator i = std::find_if(m_aContacts.begin(),m_aContacts.end(),
- boost::bind(is_quote_id_equal,_1,sQuoteID));
+ TContracts::iterator i = std::find_if(m_aContacts.begin(), m_aContacts.end(),
+ boost::bind(is_quote_id_equal, _1, sQuoteID));
if ((false == bWatch) && (i != m_aContacts.end()))
{
@@ -47,12 +47,12 @@ bool CQuotesProviderFinance::WatchForQuote(const CQuote& rQuote,bool bWatch) else if ((true == bWatch) && (i == m_aContacts.end()))
{
MCONTACT hContact = CreateNewContact(rQuote.GetSymbol());
- if(hContact)
+ if (hContact)
{
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_ID,sQuoteID.c_str());
- if(false == rQuote.GetName().empty())
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_ID, sQuoteID.c_str());
+ if (false == rQuote.GetName().empty())
{
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_DESCRIPTION,rQuote.GetName().c_str());
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_DESCRIPTION, rQuote.GetName().c_str());
}
return true;
@@ -66,9 +66,9 @@ MCONTACT CQuotesProviderFinance::GetContactByQuoteID(const tstring& rsQuoteID)co {
CGuard<CLightMutex> cs(m_cs);
- TContracts::const_iterator i = std::find_if(m_aContacts.begin(),m_aContacts.end(),
- boost::bind(std::equal_to<tstring>(),rsQuoteID,boost::bind(get_quote_id,_1)));
- if(i != m_aContacts.end())
+ TContracts::const_iterator i = std::find_if(m_aContacts.begin(), m_aContacts.end(),
+ boost::bind(std::equal_to<tstring>(), rsQuoteID, boost::bind(get_quote_id, _1)));
+ if (i != m_aContacts.end())
{
return *i;
}
@@ -91,15 +91,15 @@ namespace const tstring& rsDesc = rQuote.GetName();
return((false == rsDesc.empty()) ? rsDesc : rQuote.GetSymbol());
}
-
- int add_quote_to_wnd(const CQuotesProviderBase::CQuote& rQuote,HWND hwnd)
+
+ int add_quote_to_wnd(const CQuotesProviderBase::CQuote& rQuote, HWND hwnd)
{
tstring sName = make_quote_name(rQuote);
- int nIndex = ::SendMessage(hwnd,LB_ADDSTRING,0,reinterpret_cast<LPARAM>(sName.c_str()));
- if(nIndex >= 0)
+ int nIndex = ::SendMessage(hwnd, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(sName.c_str()));
+ if (nIndex >= 0)
{
CQuotesProviderBase::CQuote* pQuote = new CQuotesProviderBase::CQuote(rQuote);
- if(LB_ERR == ::SendMessage(hwnd,LB_SETITEMDATA,nIndex,reinterpret_cast<LPARAM>(pQuote)))
+ if (LB_ERR == ::SendMessage(hwnd, LB_SETITEMDATA, nIndex, reinterpret_cast<LPARAM>(pQuote)))
{
delete pQuote;
}
@@ -107,30 +107,30 @@ namespace return nIndex;
}
-// typedef CQuotesProviderFinance::TQuotes TQuotes;
-// TQuotes g_aWatchedQuotes;
+ // typedef CQuotesProviderFinance::TQuotes TQuotes;
+ // TQuotes g_aWatchedQuotes;
-// inline bool cmp_quotes(const tstring& rsQuoteId,const CQuotesProviderBase::CQuote& quote)
-// {
-// return (0 == quotes_stricmp(rsQuoteId.c_str(),quote.GetID().c_str()));
-// }
+ // inline bool cmp_quotes(const tstring& rsQuoteId,const CQuotesProviderBase::CQuote& quote)
+ // {
+ // return (0 == quotes_stricmp(rsQuoteId.c_str(),quote.GetID().c_str()));
+ // }
- CQuotesProviderBase::CQuote* get_quote_ptr_from_lb_index(HWND hwndListBox,int nIndex)
+ CQuotesProviderBase::CQuote* get_quote_ptr_from_lb_index(HWND hwndListBox, int nIndex)
{
- LRESULT lResult = ::SendMessage(hwndListBox,LB_GETITEMDATA,nIndex,0);
+ LRESULT lResult = ::SendMessage(hwndListBox, LB_GETITEMDATA, nIndex, 0);
return (((LB_ERR != lResult) && (0 != lResult)) ? (reinterpret_cast<CQuotesProviderBase::CQuote*>(lResult)) : nullptr);
}
- int is_quote_added(HWND hwndList,const tstring& rsQuoteID)
+ int is_quote_added(HWND hwndList, const tstring& rsQuoteID)
{
- int cItems = ::SendMessage(hwndList,LB_GETCOUNT,0,0);
- for(int i = 0;i < cItems;++i)
+ int cItems = ::SendMessage(hwndList, LB_GETCOUNT, 0, 0);
+ for (int i = 0; i < cItems; ++i)
{
- const CQuotesProviderBase::CQuote* pQuote = get_quote_ptr_from_lb_index(hwndList,i);
- if ((nullptr != pQuote)
- && ((0 == quotes_stricmp(rsQuoteID.c_str(),pQuote->GetID().c_str()))
- || (0 == quotes_stricmp(rsQuoteID.c_str(),pQuote->GetName().c_str()))
- || (0 == quotes_stricmp(rsQuoteID.c_str(),pQuote->GetSymbol().c_str()))))
+ const CQuotesProviderBase::CQuote* pQuote = get_quote_ptr_from_lb_index(hwndList, i);
+ if ((nullptr != pQuote)
+ && ((0 == quotes_stricmp(rsQuoteID.c_str(), pQuote->GetID().c_str()))
+ || (0 == quotes_stricmp(rsQuoteID.c_str(), pQuote->GetName().c_str()))
+ || (0 == quotes_stricmp(rsQuoteID.c_str(), pQuote->GetSymbol().c_str()))))
{
return i;
}
@@ -138,63 +138,63 @@ namespace return LB_ERR;
}
- INT_PTR CALLBACK GoogleFinanceOptDlgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)
+ INT_PTR CALLBACK GoogleFinanceOptDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
CQuotesProviderFinance* pProvider = nullptr;
- if(WM_INITDIALOG == message)
+ if (WM_INITDIALOG == message)
{
pProvider = reinterpret_cast<CQuotesProviderFinance*>(lParam);
- SetWindowLongPtr(hDlg,GWLP_USERDATA,lParam);
+ SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam);
}
else
{
- pProvider = reinterpret_cast<CQuotesProviderFinance*>(GetWindowLongPtr(hDlg,GWLP_USERDATA));
+ pProvider = reinterpret_cast<CQuotesProviderFinance*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
}
CCommonDlgProcData d(pProvider);
- CommonOptionDlgProc(hDlg,message,wParam,lParam,d);
+ CommonOptionDlgProc(hDlg, message, wParam, lParam, d);
- switch(message)
+ switch (message)
{
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hDlg);
+ {
+ TranslateDialogDefault(hDlg);
- CQuotesProviderFinance::TQuotes aQuotes;
- pProvider->GetWatchedQuotes(aQuotes);
+ CQuotesProviderFinance::TQuotes aQuotes;
+ pProvider->GetWatchedQuotes(aQuotes);
- HWND hwndList = GetDlgItem(hDlg,IDC_LIST_RATES);
- std::for_each(aQuotes.begin(),aQuotes.end(),
- boost::bind(add_quote_to_wnd,_1,hwndList));
+ HWND hwndList = GetDlgItem(hDlg, IDC_LIST_RATES);
+ std::for_each(aQuotes.begin(), aQuotes.end(),
+ boost::bind(add_quote_to_wnd, _1, hwndList));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_ADD),FALSE);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_REMOVE),FALSE);
- }
- return (TRUE);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_ADD), FALSE);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_REMOVE), FALSE);
+ }
+ return (TRUE);
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_EDIT_QUOTE:
- if(EN_CHANGE == HIWORD(wParam))
+ if (EN_CHANGE == HIWORD(wParam))
{
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_ADD),GetWindowTextLength(GetDlgItem(hDlg,IDC_EDIT_QUOTE)) > 0);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_ADD), GetWindowTextLength(GetDlgItem(hDlg, IDC_EDIT_QUOTE)) > 0);
}
return (TRUE);
case IDC_BUTTON_ADD:
- if(BN_CLICKED == HIWORD(wParam))
+ if (BN_CLICKED == HIWORD(wParam))
{
- HWND hEdit = GetDlgItem(hDlg,IDC_EDIT_QUOTE);
+ HWND hEdit = GetDlgItem(hDlg, IDC_EDIT_QUOTE);
tstring sQuoteSymbol = get_window_text(hEdit);
assert(false == sQuoteSymbol.empty());
- HWND hwndList = GetDlgItem(hDlg,IDC_LIST_RATES);
- if(LB_ERR == is_quote_added(hwndList,sQuoteSymbol))
+ HWND hwndList = GetDlgItem(hDlg, IDC_LIST_RATES);
+ if (LB_ERR == is_quote_added(hwndList, sQuoteSymbol))
{
- CQuotesProviderBase::CQuote quote(sQuoteSymbol,sQuoteSymbol);
- if(add_quote_to_wnd(quote,hwndList) >= 0)
+ CQuotesProviderBase::CQuote quote(sQuoteSymbol, sQuoteSymbol);
+ if (add_quote_to_wnd(quote, hwndList) >= 0)
{
- SetDlgItemText(hDlg,IDC_EDIT_QUOTE,_T(""));
+ SetDlgItemText(hDlg, IDC_EDIT_QUOTE, _T(""));
SetFocus(hEdit);
- PropSheet_Changed(::GetParent(hDlg),hDlg);
+ PropSheet_Changed(::GetParent(hDlg), hDlg);
}
else
{
@@ -204,93 +204,93 @@ namespace }
return (TRUE);
case IDC_BUTTON_REMOVE:
- if(BN_CLICKED == HIWORD(wParam))
+ if (BN_CLICKED == HIWORD(wParam))
{
- HWND hWnd = ::GetDlgItem(hDlg,IDC_LIST_RATES);
- int nSel = ::SendMessage(hWnd,LB_GETCURSEL,0,0);
- if(LB_ERR != nSel)
+ HWND hWnd = ::GetDlgItem(hDlg, IDC_LIST_RATES);
+ int nSel = ::SendMessage(hWnd, LB_GETCURSEL, 0, 0);
+ if (LB_ERR != nSel)
{
- CQuotesProviderBase::CQuote* pQuote = get_quote_ptr_from_lb_index(hWnd,nSel);
+ CQuotesProviderBase::CQuote* pQuote = get_quote_ptr_from_lb_index(hWnd, nSel);
delete pQuote;
- if(LB_ERR != ::SendMessage(hWnd,LB_DELETESTRING,nSel,0))
+ if (LB_ERR != ::SendMessage(hWnd, LB_DELETESTRING, nSel, 0))
{
- PropSheet_Changed(::GetParent(hDlg),hDlg);
+ PropSheet_Changed(::GetParent(hDlg), hDlg);
}
}
- nSel = ::SendMessage(hWnd,LB_GETCURSEL,0,0);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_REMOVE),(LB_ERR != nSel));
+ nSel = ::SendMessage(hWnd, LB_GETCURSEL, 0, 0);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_REMOVE), (LB_ERR != nSel));
}
return (TRUE);
case IDC_LIST_RATES:
- if(CBN_SELCHANGE == HIWORD(wParam))
+ if (CBN_SELCHANGE == HIWORD(wParam))
{
int nSel = ::SendDlgItemMessage(hDlg, IDC_LIST_RATES, LB_GETCURSEL, 0, 0);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_REMOVE),(LB_ERR != nSel));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_REMOVE), (LB_ERR != nSel));
}
return (TRUE);
}
return (FALSE);
case WM_NOTIFY:
+ {
+ LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lParam);
+ switch (pNMHDR->code)
{
- LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lParam);
- switch(pNMHDR->code)
+ case PSN_APPLY:
+ if (pProvider)
{
- case PSN_APPLY:
- if(pProvider)
+ CQuotesProviderFinance::TQuotes aTemp;
+ pProvider->GetWatchedQuotes(aTemp);
+
+ typedef std::vector<const CQuotesProviderBase::CQuote*> TQuotesPtr;
+ TQuotesPtr apCurrent;
+ HWND hwndListBox = GetDlgItem(hDlg, IDC_LIST_RATES);
+ int cItems = ::SendMessage(hwndListBox, LB_GETCOUNT, 0, 0);
+ for (int i = 0; i < cItems; ++i)
{
- CQuotesProviderFinance::TQuotes aTemp;
- pProvider->GetWatchedQuotes(aTemp);
-
- typedef std::vector<const CQuotesProviderBase::CQuote*> TQuotesPtr;
- TQuotesPtr apCurrent;
- HWND hwndListBox = GetDlgItem(hDlg,IDC_LIST_RATES);
- int cItems = ::SendMessage(hwndListBox,LB_GETCOUNT,0,0);
- for(int i = 0;i < cItems;++i)
+ const CQuotesProviderBase::CQuote* pQuote = get_quote_ptr_from_lb_index(hwndListBox, i);
+ if (pQuote)
{
- const CQuotesProviderBase::CQuote* pQuote = get_quote_ptr_from_lb_index(hwndListBox,i);
- if(pQuote)
- {
- apCurrent.push_back(pQuote);
- }
+ apCurrent.push_back(pQuote);
}
-
- std::for_each(aTemp.begin(),aTemp.end(),
- [&apCurrent,pProvider](const CQuotesProviderBase::CQuote& quote)
- {
- if(apCurrent.end() == std::find_if(apCurrent.begin(),apCurrent.end(),
- ["e](const CQuotesProviderBase::CQuote* pQuote){return 0 == quotes_stricmp(pQuote->GetID().c_str(),quote.GetID().c_str());}))
- {
- pProvider->WatchForQuote(quote,false);
- }
- });
-
- std::for_each(apCurrent.begin(),apCurrent.end(),
- [&aTemp,pProvider](const CQuotesProviderBase::CQuote* pQuote)
- {
- if(aTemp.end() ==
- std::find_if(aTemp.begin(),aTemp.end(),
- [pQuote](const CQuotesProviderBase::CQuote& quote){return 0 == quotes_stricmp(pQuote->GetID().c_str(),quote.GetID().c_str());}))
- {
- pProvider->WatchForQuote(*pQuote,true);
- }
-
- });
-
- pProvider->RefreshSettings();
}
- return (TRUE);
+ std::for_each(aTemp.begin(), aTemp.end(),
+ [&apCurrent, pProvider](const CQuotesProviderBase::CQuote& quote)
+ {
+ if (apCurrent.end() == std::find_if(apCurrent.begin(), apCurrent.end(),
+ ["e](const CQuotesProviderBase::CQuote* pQuote){return 0 == quotes_stricmp(pQuote->GetID().c_str(), quote.GetID().c_str()); }))
+ {
+ pProvider->WatchForQuote(quote, false);
+ }
+ });
+
+ std::for_each(apCurrent.begin(), apCurrent.end(),
+ [&aTemp, pProvider](const CQuotesProviderBase::CQuote* pQuote)
+ {
+ if (aTemp.end() ==
+ std::find_if(aTemp.begin(), aTemp.end(),
+ [pQuote](const CQuotesProviderBase::CQuote& quote){return 0 == quotes_stricmp(pQuote->GetID().c_str(), quote.GetID().c_str()); }))
+ {
+ pProvider->WatchForQuote(*pQuote, true);
+ }
+
+ });
+
+ pProvider->RefreshSettings();
}
+
+ return (TRUE);
}
- return (FALSE);
+ }
+ return (FALSE);
case WM_DESTROY:
- HWND hwndListBox = GetDlgItem(hDlg,IDC_LIST_RATES);
- int cItems = ::SendMessage(hwndListBox,LB_GETCOUNT,0,0);
- for(int i = 0;i < cItems;++i)
+ HWND hwndListBox = GetDlgItem(hDlg, IDC_LIST_RATES);
+ int cItems = ::SendMessage(hwndListBox, LB_GETCOUNT, 0, 0);
+ for (int i = 0; i < cItems; ++i)
{
- const CQuotesProviderBase::CQuote* pQuote = get_quote_ptr_from_lb_index(hwndListBox,i);
+ const CQuotesProviderBase::CQuote* pQuote = get_quote_ptr_from_lb_index(hwndListBox, i);
delete pQuote;
}
return (FALSE);
@@ -305,5 +305,5 @@ void CQuotesProviderFinance::ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE &odp) odp.pfnDlgProc = GoogleFinanceOptDlgProc;
odp.dwInitParam = reinterpret_cast<DWORD>(static_cast<CQuotesProviderFinance*>(this));
odp.ptszTab = const_cast<LPTSTR>(GetInfo().m_sName.c_str());
- Options_AddPage(wp, &odp);
+ Options_AddPage(wp, &odp);
}
diff --git a/plugins/Quotes/src/QuotesProviderFinance.h b/plugins/Quotes/src/QuotesProviderFinance.h index 67e4e3febc..d50d459640 100644 --- a/plugins/Quotes/src/QuotesProviderFinance.h +++ b/plugins/Quotes/src/QuotesProviderFinance.h @@ -8,11 +8,11 @@ public: public:
void GetWatchedQuotes(TQuotes& raQuotes)const;
- bool WatchForQuote(const CQuote& rQuote,bool bWatch);
+ bool WatchForQuote(const CQuote& rQuote, bool bWatch);
MCONTACT GetContactByQuoteID(const tstring& rsQuoteID)const;
protected:
- virtual void ShowPropertyPage(WPARAM wp,OPTIONSDIALOGPAGE& odp);
+ virtual void ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE& odp);
virtual void Accept(CQuotesProviderVisitor& visitor)const;
};
diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp index 377210ec9e..50beba86aa 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp @@ -10,7 +10,7 @@ CQuotesProviderGoogle::~CQuotesProviderGoogle() namespace
{
- inline tstring make_contact_name(const tstring& rsSymbolFrom,const tstring& rsSymbolTo)
+ inline tstring make_contact_name(const tstring& rsSymbolFrom, const tstring& rsSymbolTo)
{
tostringstream o;
o << rsSymbolFrom << _T("/") << rsSymbolTo;
@@ -18,36 +18,36 @@ namespace }
inline bool is_rate_watched(MCONTACT hContact,
- const CQuotesProviderBase::CQuote& from,
- const CQuotesProviderBase::CQuote& to)
+ const CQuotesProviderBase::CQuote& from,
+ const CQuotesProviderBase::CQuote& to)
{
- tstring sFrom = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_ID);
- tstring sTo = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_ID);
- return ((0 == quotes_stricmp(from.GetID().c_str(),sFrom.c_str()))
- && (0 == quotes_stricmp(to.GetID().c_str(),sTo.c_str())));
+ tstring sFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID);
+ tstring sTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID);
+ return ((0 == quotes_stricmp(from.GetID().c_str(), sFrom.c_str()))
+ && (0 == quotes_stricmp(to.GetID().c_str(), sTo.c_str())));
}
}
bool CQuotesProviderGoogle::WatchForRate(const CRateInfo& ri,
- bool bWatch)
+ bool bWatch)
{
- TContracts::const_iterator i = std::find_if(m_aContacts.begin(),m_aContacts.end(),
- boost::bind(is_rate_watched,_1,ri.m_from,ri.m_to));
+ TContracts::const_iterator i = std::find_if(m_aContacts.begin(), m_aContacts.end(),
+ boost::bind(is_rate_watched, _1, ri.m_from, ri.m_to));
if ((true == bWatch) && (i == m_aContacts.end()))
{
- tstring sName = make_contact_name(ri.m_from.GetSymbol(),ri.m_to.GetSymbol());
+ tstring sName = make_contact_name(ri.m_from.GetSymbol(), ri.m_to.GetSymbol());
MCONTACT hContact = CreateNewContact(sName);
- if(hContact)
+ if (hContact)
{
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_ID,ri.m_from.GetID().c_str());
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_ID,ri.m_to.GetID().c_str());
- if(false == ri.m_from.GetName().empty())
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID, ri.m_from.GetID().c_str());
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID, ri.m_to.GetID().c_str());
+ if (false == ri.m_from.GetName().empty())
{
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_DESCRIPTION,ri.m_from.GetName().c_str());
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_DESCRIPTION, ri.m_from.GetName().c_str());
}
- if(false == ri.m_to.GetName().empty())
+ if (false == ri.m_to.GetName().empty())
{
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_DESCRIPTION,ri.m_to.GetName().c_str());
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_DESCRIPTION, ri.m_to.GetName().c_str());
}
return true;
@@ -73,18 +73,18 @@ size_t CQuotesProviderGoogle::GetWatchedRateCount()const return m_aContacts.size();
}
-bool CQuotesProviderGoogle::GetWatchedRateInfo(size_t nIndex,CRateInfo& rRateInfo)
+bool CQuotesProviderGoogle::GetWatchedRateInfo(size_t nIndex, CRateInfo& rRateInfo)
{
- if(nIndex < m_aContacts.size())
+ if (nIndex < m_aContacts.size())
{
MCONTACT hContact = m_aContacts[nIndex];
- tstring sSymbolFrom = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_ID);
- tstring sSymbolTo = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_ID);
- tstring sDescFrom = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_DESCRIPTION);
- tstring sDescTo = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_DESCRIPTION);
+ tstring sSymbolFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID);
+ tstring sSymbolTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID);
+ tstring sDescFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_DESCRIPTION);
+ tstring sDescTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_DESCRIPTION);
- rRateInfo.m_from = CQuote(sSymbolFrom,sSymbolFrom,sDescFrom);
- rRateInfo.m_to = CQuote(sSymbolTo,sSymbolTo,sDescTo);
+ rRateInfo.m_from = CQuote(sSymbolFrom, sSymbolFrom, sDescFrom);
+ rRateInfo.m_to = CQuote(sSymbolTo, sSymbolTo, sDescTo);
return true;
}
else
@@ -95,29 +95,29 @@ bool CQuotesProviderGoogle::GetWatchedRateInfo(size_t nIndex,CRateInfo& rRateInf namespace
{
- tstring build_url(const tstring& rsURL,const tstring& from,const tstring& to,double dAmount)
+ tstring build_url(const tstring& rsURL, const tstring& from, const tstring& to, double dAmount)
{
tostringstream o;
o << rsURL << _T("?a=") << std::fixed << dAmount << _T("&from=") << from << _T("&to=") << to;
return o.str();
}
- tstring build_url(MCONTACT hContact,const tstring& rsURL,double dAmount = 1.0)
+ tstring build_url(MCONTACT hContact, const tstring& rsURL, double dAmount = 1.0)
{
- tstring sFrom = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_ID);
- tstring sTo = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_ID);
- return build_url(rsURL,sFrom,sTo,dAmount);
+ tstring sFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID);
+ tstring sTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID);
+ return build_url(rsURL, sFrom, sTo, dAmount);
}
typedef IHTMLNode::THTMLNodePtr THTMLNodePtr;
- bool parse_html_node(const THTMLNodePtr& pNode,double& rdRate)
+ bool parse_html_node(const THTMLNodePtr& pNode, double& rdRate)
{
tstring sID = pNode->GetAttribute(_T("id"));
if ((false == sID.empty()) && (0 == quotes_stricmp(sID.c_str(), _T("currency_converter_result"))))
{
size_t cChild = pNode->GetChildCount();
-// assert(1 == cChild);
- if(cChild > 0)
+ // assert(1 == cChild);
+ if (cChild > 0)
{
THTMLNodePtr pChild = pNode->GetChildPtr(0);
tstring sRate = pChild->GetText();
@@ -131,10 +131,10 @@ namespace else
{
size_t cChild = pNode->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
THTMLNodePtr pChild = pNode->GetChildPtr(i);
- if(pChild && (true == parse_html_node(pChild,rdRate)))
+ if (pChild && (true == parse_html_node(pChild, rdRate)))
{
return true;
}
@@ -144,13 +144,13 @@ namespace return false;
}
- bool parse_responce(const tstring& rsHTML,double& rdRate)
+ bool parse_responce(const tstring& rsHTML, double& rdRate)
{
IHTMLEngine::THTMLParserPtr pHTMLParser = CModuleInfo::GetHTMLEngine()->GetParserPtr();
THTMLNodePtr pRoot = pHTMLParser->ParseString(rsHTML);
- if(pRoot)
+ if (pRoot)
{
- return parse_html_node(pRoot,rdRate);
+ return parse_html_node(pRoot, rdRate);
}
else
{
@@ -166,34 +166,34 @@ void CQuotesProviderGoogle::RefreshQuotes(TContracts& anContacts) bool bUseExtendedStatus = CModuleInfo::GetInstance().GetExtendedStatusFlag();
- for(TContracts::const_iterator i = anContacts.begin();i != anContacts.end() && IsOnline();++i)
+ for (TContracts::const_iterator i = anContacts.begin(); i != anContacts.end() && IsOnline(); ++i)
{
MCONTACT hContact = *i;
- if(bUseExtendedStatus)
+ if (bUseExtendedStatus)
{
- SetContactStatus(hContact,ID_STATUS_OCCUPIED);
+ SetContactStatus(hContact, ID_STATUS_OCCUPIED);
}
- tstring sFullURL = build_url(hContact,sURL);
-// LogIt(Info,sFullURL);
+ tstring sFullURL = build_url(hContact, sURL);
+ // LogIt(Info,sFullURL);
if ((true == http.OpenURL(sFullURL)) && (true == IsOnline()))
{
tstring sHTML;
if ((true == http.ReadResponce(sHTML)) && (true == IsOnline()))
{
-// LogIt(Info,sHTML);
+ // LogIt(Info,sHTML);
double dRate = 0.0;
- if ((true == parse_responce(sHTML,dRate)) && (true == IsOnline()))
+ if ((true == parse_responce(sHTML, dRate)) && (true == IsOnline()))
{
- WriteContactRate(hContact,dRate);
+ WriteContactRate(hContact, dRate);
continue;
}
}
}
- SetContactStatus(hContact,ID_STATUS_NA);
+ SetContactStatus(hContact, ID_STATUS_NA);
}
}
@@ -209,11 +209,11 @@ namespace {
CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
const CQuotesProviders::TQuotesProviders& rapQuotesProviders = pProviders->GetProviders();
- for(CQuotesProviders::TQuotesProviders::const_iterator i = rapQuotesProviders.begin();i != rapQuotesProviders.end();++i)
+ for (CQuotesProviders::TQuotesProviders::const_iterator i = rapQuotesProviders.begin(); i != rapQuotesProviders.end(); ++i)
{
const CQuotesProviders::TQuotesProviderPtr& pProvider = *i;
CQuotesProviderGoogle* pGoogle = dynamic_cast<CQuotesProviderGoogle*>(pProvider.get());
- if(pGoogle)
+ if (pGoogle)
{
return pGoogle;
}
@@ -226,10 +226,10 @@ namespace CQuotesProviderGoogle::CQuoteSection get_quotes()
{
const CQuotesProviderGoogle* pProvider = get_google_provider();
- if(pProvider)
+ if (pProvider)
{
const CQuotesProviderGoogle::CQuoteSection& rQuotes = pProvider->GetQuotes();
- if(rQuotes.GetSectionCount() > 0)
+ if (rQuotes.GetSectionCount() > 0)
{
return rQuotes.GetSection(0);
}
@@ -239,203 +239,203 @@ namespace }
tstring make_rate_name(const CQuotesProviderGoogle::CQuote& rFrom,
- const CQuotesProviderGoogle::CQuote& rTo)
+ const CQuotesProviderGoogle::CQuote& rTo)
{
if ((false == rFrom.GetName().empty()) && (false == rTo.GetName().empty()))
{
- return make_contact_name(rFrom.GetName(),rTo.GetName());
+ return make_contact_name(rFrom.GetName(), rTo.GetName());
}
else
{
- return make_contact_name(rFrom.GetSymbol(),rTo.GetSymbol());
+ return make_contact_name(rFrom.GetSymbol(), rTo.GetSymbol());
}
}
typedef std::vector<CQuotesProviderGoogle::CRateInfo> TWatchedRates;
TWatchedRates g_aWatchedRates;
- bool is_equal_rate(const CQuotesProviderGoogle::CRateInfo& riL,const CQuotesProviderGoogle::CRateInfo& riR)
+ bool is_equal_rate(const CQuotesProviderGoogle::CRateInfo& riL, const CQuotesProviderGoogle::CRateInfo& riR)
{
- return ((0 == quotes_stricmp(riL.m_from.GetID().c_str(),riR.m_from.GetID().c_str()))
- && ((0 == quotes_stricmp(riL.m_to.GetID().c_str(),riR.m_to.GetID().c_str()))));
+ return ((0 == quotes_stricmp(riL.m_from.GetID().c_str(), riR.m_from.GetID().c_str()))
+ && ((0 == quotes_stricmp(riL.m_to.GetID().c_str(), riR.m_to.GetID().c_str()))));
}
- INT_PTR CALLBACK GoogleOptDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam)
+ INT_PTR CALLBACK GoogleOptDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
CQuotesProviderGoogle* pProvider = get_google_provider();
CCommonDlgProcData d(pProvider);
- CommonOptionDlgProc(hdlg,message,wParam,lParam,d);
+ CommonOptionDlgProc(hdlg, message, wParam, lParam, d);
- switch(message)
+ switch (message)
{
case WM_NOTIFY:
+ {
+ LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lParam);
+ switch (pNMHDR->code)
+ {
+ case PSN_APPLY:
{
- LPNMHDR pNMHDR = reinterpret_cast<LPNMHDR>(lParam);
- switch(pNMHDR->code)
+ if (pProvider)
{
- case PSN_APPLY:
+ TWatchedRates aTemp(g_aWatchedRates);
+ TWatchedRates aRemove;
+ size_t cWatchedRates = pProvider->GetWatchedRateCount();
+ for (size_t i = 0; i < cWatchedRates; ++i)
{
- if(pProvider)
+ CQuotesProviderGoogle::CRateInfo ri;
+ if (true == pProvider->GetWatchedRateInfo(i, ri))
{
- TWatchedRates aTemp(g_aWatchedRates);
- TWatchedRates aRemove;
- size_t cWatchedRates = pProvider->GetWatchedRateCount();
- for(size_t i = 0;i < cWatchedRates;++i)
+ TWatchedRates::iterator it =
+ std::find_if(aTemp.begin(), aTemp.end(),
+ boost::bind(is_equal_rate, _1, boost::cref(ri)));
+ if (it == aTemp.end())
{
- CQuotesProviderGoogle::CRateInfo ri;
- if(true == pProvider->GetWatchedRateInfo(i,ri))
- {
- TWatchedRates::iterator it =
- std::find_if(aTemp.begin(),aTemp.end(),
- boost::bind(is_equal_rate,_1,boost::cref(ri)));
- if(it == aTemp.end())
- {
- aRemove.push_back(ri);
- }
- else
- {
- aTemp.erase(it);
- }
- }
+ aRemove.push_back(ri);
+ }
+ else
+ {
+ aTemp.erase(it);
}
-
- std::for_each(aRemove.begin(),aRemove.end(),boost::bind(&CQuotesProviderGoogle::WatchForRate,pProvider,_1,false));
- std::for_each(aTemp.begin(),aTemp.end(),boost::bind(&CQuotesProviderGoogle::WatchForRate,pProvider,_1,true));
-
- pProvider->RefreshSettings();
}
}
- break;
+
+ std::for_each(aRemove.begin(), aRemove.end(), boost::bind(&CQuotesProviderGoogle::WatchForRate, pProvider, _1, false));
+ std::for_each(aTemp.begin(), aTemp.end(), boost::bind(&CQuotesProviderGoogle::WatchForRate, pProvider, _1, true));
+
+ pProvider->RefreshSettings();
}
}
break;
+ }
+ }
+ break;
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hdlg);
+ {
+ TranslateDialogDefault(hdlg);
- g_aWatchedRates.clear();
+ g_aWatchedRates.clear();
- HWND hcbxFrom = ::GetDlgItem(hdlg,IDC_COMBO_CONVERT_FROM);
- HWND hcbxTo = ::GetDlgItem(hdlg,IDC_COMBO_CONVERT_INTO);
+ HWND hcbxFrom = ::GetDlgItem(hdlg, IDC_COMBO_CONVERT_FROM);
+ HWND hcbxTo = ::GetDlgItem(hdlg, IDC_COMBO_CONVERT_INTO);
- const CQuotesProviderGoogle::CQuoteSection& rSection = get_quotes();
- size_t cQuotes = rSection.GetQuoteCount();
- for(size_t i = 0;i < cQuotes;++i)
- {
- const CQuotesProviderGoogle::CQuote& rQuote = rSection.GetQuote(i);
- tstring sName = make_quote_name(rQuote);
- LPCTSTR pszName = sName.c_str();
- ::SendMessage(hcbxFrom,CB_ADDSTRING,0,reinterpret_cast<LPARAM>(pszName));
- ::SendMessage(hcbxTo,CB_ADDSTRING,0,reinterpret_cast<LPARAM>(pszName));
- }
+ const CQuotesProviderGoogle::CQuoteSection& rSection = get_quotes();
+ size_t cQuotes = rSection.GetQuoteCount();
+ for (size_t i = 0; i < cQuotes; ++i)
+ {
+ const CQuotesProviderGoogle::CQuote& rQuote = rSection.GetQuote(i);
+ tstring sName = make_quote_name(rQuote);
+ LPCTSTR pszName = sName.c_str();
+ ::SendMessage(hcbxFrom, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszName));
+ ::SendMessage(hcbxTo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszName));
+ }
- CQuotesProviderGoogle* pProvider = get_google_provider();
- if(pProvider)
+ CQuotesProviderGoogle* pProvider = get_google_provider();
+ if (pProvider)
+ {
+ size_t cWatchedRates = pProvider->GetWatchedRateCount();
+ for (size_t i = 0; i < cWatchedRates; ++i)
{
- size_t cWatchedRates = pProvider->GetWatchedRateCount();
- for(size_t i = 0;i < cWatchedRates;++i)
+ CQuotesProviderGoogle::CRateInfo ri;
+ if (true == pProvider->GetWatchedRateInfo(i, ri))
{
- CQuotesProviderGoogle::CRateInfo ri;
- if(true == pProvider->GetWatchedRateInfo(i,ri))
- {
- g_aWatchedRates.push_back(ri);
- tstring sRate = make_rate_name(ri.m_from,ri.m_to);
- LPCTSTR pszRateName = sRate.c_str();
- ::SendDlgItemMessage(hdlg, IDC_LIST_RATES, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszRateName));
- }
+ g_aWatchedRates.push_back(ri);
+ tstring sRate = make_rate_name(ri.m_from, ri.m_to);
+ LPCTSTR pszRateName = sRate.c_str();
+ ::SendDlgItemMessage(hdlg, IDC_LIST_RATES, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszRateName));
}
}
-
- ::EnableWindow(::GetDlgItem(hdlg,IDC_BUTTON_ADD),FALSE);
- ::EnableWindow(::GetDlgItem(hdlg,IDC_BUTTON_REMOVE),FALSE);
}
- return TRUE;
+
+ ::EnableWindow(::GetDlgItem(hdlg, IDC_BUTTON_ADD), FALSE);
+ ::EnableWindow(::GetDlgItem(hdlg, IDC_BUTTON_REMOVE), FALSE);
+ }
+ return TRUE;
case WM_COMMAND:
- switch(HIWORD(wParam))
+ switch (HIWORD(wParam))
{
case CBN_SELCHANGE:
- switch(LOWORD(wParam))
+ switch (LOWORD(wParam))
{
case IDC_COMBO_REFRESH_RATE:
break;
case IDC_COMBO_CONVERT_FROM:
case IDC_COMBO_CONVERT_INTO:
- {
- int nFrom = static_cast<int>(::SendDlgItemMessage(hdlg, IDC_COMBO_CONVERT_FROM, CB_GETCURSEL, 0, 0));
- int nTo = static_cast<int>(::SendDlgItemMessage(hdlg, IDC_COMBO_CONVERT_INTO, CB_GETCURSEL, 0, 0));
- bool bEnableAddButton = ((CB_ERR != nFrom) && (CB_ERR != nTo) && (nFrom != nTo));
- EnableWindow(GetDlgItem(hdlg,IDC_BUTTON_ADD),bEnableAddButton);
- }
- break;
+ {
+ int nFrom = static_cast<int>(::SendDlgItemMessage(hdlg, IDC_COMBO_CONVERT_FROM, CB_GETCURSEL, 0, 0));
+ int nTo = static_cast<int>(::SendDlgItemMessage(hdlg, IDC_COMBO_CONVERT_INTO, CB_GETCURSEL, 0, 0));
+ bool bEnableAddButton = ((CB_ERR != nFrom) && (CB_ERR != nTo) && (nFrom != nTo));
+ EnableWindow(GetDlgItem(hdlg, IDC_BUTTON_ADD), bEnableAddButton);
+ }
+ break;
case IDC_LIST_RATES:
- {
- int nSel = ::SendDlgItemMessage(hdlg, IDC_LIST_RATES, LB_GETCURSEL, 0, 0);
- ::EnableWindow(::GetDlgItem(hdlg,IDC_BUTTON_REMOVE),(LB_ERR != nSel));
- }
- break;
+ {
+ int nSel = ::SendDlgItemMessage(hdlg, IDC_LIST_RATES, LB_GETCURSEL, 0, 0);
+ ::EnableWindow(::GetDlgItem(hdlg, IDC_BUTTON_REMOVE), (LB_ERR != nSel));
+ }
+ break;
}
break;
case BN_CLICKED:
- switch(LOWORD(wParam))
+ switch (LOWORD(wParam))
{
case IDC_BUTTON_ADD:
+ {
+ size_t nFrom = static_cast<size_t>(::SendDlgItemMessage(hdlg, IDC_COMBO_CONVERT_FROM, CB_GETCURSEL, 0, 0));
+ size_t nTo = static_cast<size_t>(::SendDlgItemMessage(hdlg, IDC_COMBO_CONVERT_INTO, CB_GETCURSEL, 0, 0));
+ if ((CB_ERR != nFrom) && (CB_ERR != nTo) && (nFrom != nTo))
{
- size_t nFrom = static_cast<size_t>(::SendDlgItemMessage(hdlg, IDC_COMBO_CONVERT_FROM, CB_GETCURSEL, 0, 0));
- size_t nTo = static_cast<size_t>(::SendDlgItemMessage(hdlg, IDC_COMBO_CONVERT_INTO, CB_GETCURSEL, 0, 0));
- if ((CB_ERR != nFrom) && (CB_ERR != nTo) && (nFrom != nTo))
+ const CQuotesProviderGoogle::CQuoteSection& rSection = get_quotes();
+ size_t cQuotes = rSection.GetQuoteCount();
+ if ((nFrom < cQuotes) && (nTo < cQuotes))
{
- const CQuotesProviderGoogle::CQuoteSection& rSection = get_quotes();
- size_t cQuotes = rSection.GetQuoteCount();
- if ((nFrom < cQuotes) && (nTo < cQuotes))
- {
- CQuotesProviderGoogle::CRateInfo ri;
- ri.m_from = rSection.GetQuote(nFrom);
- ri.m_to = rSection.GetQuote(nTo);
+ CQuotesProviderGoogle::CRateInfo ri;
+ ri.m_from = rSection.GetQuote(nFrom);
+ ri.m_to = rSection.GetQuote(nTo);
- g_aWatchedRates.push_back(ri);
+ g_aWatchedRates.push_back(ri);
- tstring sRate = make_rate_name(ri.m_from,ri.m_to);
- LPCTSTR pszRateName = sRate.c_str();
- ::SendDlgItemMessage(hdlg, IDC_LIST_RATES, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszRateName));
- PropSheet_Changed(::GetParent(hdlg),hdlg);
- }
+ tstring sRate = make_rate_name(ri.m_from, ri.m_to);
+ LPCTSTR pszRateName = sRate.c_str();
+ ::SendDlgItemMessage(hdlg, IDC_LIST_RATES, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszRateName));
+ PropSheet_Changed(::GetParent(hdlg), hdlg);
}
}
- break;
+ }
+ break;
case IDC_BUTTON_REMOVE:
+ {
+ HWND hWnd = ::GetDlgItem(hdlg, IDC_LIST_RATES);
+ int nSel = ::SendMessage(hWnd, LB_GETCURSEL, 0, 0);
+ if (LB_ERR != nSel)
{
- HWND hWnd = ::GetDlgItem(hdlg,IDC_LIST_RATES);
- int nSel = ::SendMessage(hWnd,LB_GETCURSEL,0,0);
- if(LB_ERR != nSel)
+ if ((LB_ERR != ::SendMessage(hWnd, LB_DELETESTRING, nSel, 0))
+ && (nSel < static_cast<int>(g_aWatchedRates.size())))
{
- if ((LB_ERR != ::SendMessage(hWnd, LB_DELETESTRING,nSel,0))
- && (nSel < static_cast<int>(g_aWatchedRates.size())))
- {
- TWatchedRates::iterator i = g_aWatchedRates.begin();
- std::advance(i,nSel);
- g_aWatchedRates.erase(i);
- PropSheet_Changed(::GetParent(hdlg),hdlg);
- }
+ TWatchedRates::iterator i = g_aWatchedRates.begin();
+ std::advance(i, nSel);
+ g_aWatchedRates.erase(i);
+ PropSheet_Changed(::GetParent(hdlg), hdlg);
}
-
- nSel = ::SendMessage(hWnd,LB_GETCURSEL,0,0);
- ::EnableWindow(::GetDlgItem(hdlg,IDC_BUTTON_REMOVE),(LB_ERR != nSel));
}
- break;
+
+ nSel = ::SendMessage(hWnd, LB_GETCURSEL, 0, 0);
+ ::EnableWindow(::GetDlgItem(hdlg, IDC_BUTTON_REMOVE), (LB_ERR != nSel));
+ }
+ break;
}
break;
-// case LBN_SELCHANGE:
-// switch(LOWORD(lParam))
-// {
-// case IDC_LIST_RATES:
-// {
-// int nSel = ::SendDlgItemMessage(hdlg, IDC_LIST_RATES, LB_GETCURSEL, 0, 0);
-// ::EnableWindow(::GetDlgItem(hdlg,IDC_BUTTON_REMOVE),(-1 != nSel));
-// }
-// }
-// break;
+ // case LBN_SELCHANGE:
+ // switch(LOWORD(lParam))
+ // {
+ // case IDC_LIST_RATES:
+ // {
+ // int nSel = ::SendDlgItemMessage(hdlg, IDC_LIST_RATES, LB_GETCURSEL, 0, 0);
+ // ::EnableWindow(::GetDlgItem(hdlg,IDC_BUTTON_REMOVE),(-1 != nSel));
+ // }
+ // }
+ // break;
}
break;
@@ -459,10 +459,10 @@ void CQuotesProviderGoogle::Accept(CQuotesProviderVisitor& visitor)const visitor.Visit(*this);
}
-double CQuotesProviderGoogle::Convert(double dAmount,const CQuote& from,const CQuote& to)const
+double CQuotesProviderGoogle::Convert(double dAmount, const CQuote& from, const CQuote& to)const
{
- tstring sFullURL = build_url(GetURL(),from.GetID(),to.GetID(),dAmount);
-// LogIt(Info,sFullURL);
+ tstring sFullURL = build_url(GetURL(), from.GetID(), to.GetID(), dAmount);
+ // LogIt(Info,sFullURL);
CHTTPSession http;
if ((true == http.OpenURL(sFullURL)))
@@ -470,10 +470,10 @@ double CQuotesProviderGoogle::Convert(double dAmount,const CQuote& from,const CQ tstring sHTML;
if ((true == http.ReadResponce(sHTML)))
{
-// LogIt(Info,sHTML);
+ // LogIt(Info,sHTML);
double dResult = 0.0;
- if ((true == parse_responce(sHTML,dResult)))
+ if ((true == parse_responce(sHTML, dResult)))
{
return dResult;
}
@@ -497,22 +497,22 @@ double CQuotesProviderGoogle::Convert(double dAmount,const CQuote& from,const CQ namespace
{
- bool is_equal_ids(MCONTACT hContact,const tstring& rsFromID,const tstring& rsToID)
+ bool is_equal_ids(MCONTACT hContact, const tstring& rsFromID, const tstring& rsToID)
{
- tstring sFrom = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_ID);
- tstring sTo = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_ID);
- return ((0 == quotes_stricmp(rsFromID.c_str(),sFrom.c_str()))
- && (0 == quotes_stricmp(rsToID.c_str(),sTo.c_str())));
+ tstring sFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID);
+ tstring sTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID);
+ return ((0 == quotes_stricmp(rsFromID.c_str(), sFrom.c_str()))
+ && (0 == quotes_stricmp(rsToID.c_str(), sTo.c_str())));
}
}
-MCONTACT CQuotesProviderGoogle::GetContactByID(const tstring& rsFromID,const tstring& rsToID)const
+MCONTACT CQuotesProviderGoogle::GetContactByID(const tstring& rsFromID, const tstring& rsToID)const
{
CGuard<CLightMutex> cs(m_cs);
- TContracts::const_iterator i = std::find_if(m_aContacts.begin(),m_aContacts.end(),
- boost::bind(is_equal_ids,_1,boost::cref(rsFromID),boost::cref(rsToID)));
- if(i != m_aContacts.end())
+ TContracts::const_iterator i = std::find_if(m_aContacts.begin(), m_aContacts.end(),
+ boost::bind(is_equal_ids, _1, boost::cref(rsFromID), boost::cref(rsToID)));
+ if (i != m_aContacts.end())
{
return *i;
}
diff --git a/plugins/Quotes/src/QuotesProviderGoogle.h b/plugins/Quotes/src/QuotesProviderGoogle.h index ec2a6c4d85..083a2945d8 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.h +++ b/plugins/Quotes/src/QuotesProviderGoogle.h @@ -23,17 +23,17 @@ public: CQuotesProviderGoogle();
~CQuotesProviderGoogle();
- bool WatchForRate(const CRateInfo& ri,bool bWatch);
+ bool WatchForRate(const CRateInfo& ri, bool bWatch);
size_t GetWatchedRateCount()const;
- bool GetWatchedRateInfo(size_t nIndex,CRateInfo& rRateInfo);
+ bool GetWatchedRateInfo(size_t nIndex, CRateInfo& rRateInfo);
- MCONTACT GetContactByID(const tstring& rsFromID,const tstring& rsToID)const;
+ MCONTACT GetContactByID(const tstring& rsFromID, const tstring& rsToID)const;
- double Convert(double dAmount,const CQuote& from,const CQuote& to)const;
+ double Convert(double dAmount, const CQuote& from, const CQuote& to)const;
private:
virtual void RefreshQuotes(TContracts& anContacts);
- virtual void ShowPropertyPage(WPARAM wp,OPTIONSDIALOGPAGE& odp);
+ virtual void ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE& odp);
virtual void Accept(CQuotesProviderVisitor& visitor)const;
};
diff --git a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp index a37829421e..d05b7c082c 100644 --- a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp @@ -10,10 +10,10 @@ CQuotesProviderGoogleFinance::~CQuotesProviderGoogleFinance() namespace
{
- tstring build_url(MCONTACT hContact,const tstring& rsURL)
+ tstring build_url(MCONTACT hContact, const tstring& rsURL)
{
tostringstream o;
- o << rsURL << _T("?q=") << Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_ID);
+ o << rsURL << _T("?q=") << Quotes_DBGetStringT(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_ID);
return o.str();
}
@@ -26,25 +26,25 @@ namespace giPercentChangeAfterHours = 0x0004,
giPercentChangeToYesterdayClose = 0x0008
};
- CGoogleInfo()
- : m_dRate(0.0),m_dOpenValue(0.0),m_dPercentChangeAfterHours(0.0),m_dPercentChangeToYersterdayClose(0.0),m_nFlags(0){}
-// tstring m_sCmpID;
+ CGoogleInfo()
+ : m_dRate(0.0), m_dOpenValue(0.0), m_dPercentChangeAfterHours(0.0), m_dPercentChangeToYersterdayClose(0.0), m_nFlags(0){}
+ // tstring m_sCmpID;
tstring m_sCmpName;
double m_dRate;
double m_dOpenValue;
double m_dPercentChangeAfterHours;
double m_dPercentChangeToYersterdayClose;
-// tstring m_sRateID;
-// tstring m_sDiffID;
+ // tstring m_sRateID;
+ // tstring m_sDiffID;
byte m_nFlags;
};
- tstring make_rate_id_value(const tstring& rsCmpID,int nFlags)
+ tstring make_rate_id_value(const tstring& rsCmpID, int nFlags)
{
tostringstream o;
o << _T("ref_") << rsCmpID;
- switch(nFlags)
+ switch (nFlags)
{
default:
assert(!"Unknown type of value");
@@ -58,21 +58,21 @@ namespace o << _T("_cp");
break;
}
-
+
return o.str();
}
- tstring get_var_value(const tstring& rsHTML,LPCTSTR pszVarName,size_t cVarNameLength)
+ tstring get_var_value(const tstring& rsHTML, LPCTSTR pszVarName, size_t cVarNameLength)
{
tstring sResult;
tstring::size_type n = rsHTML.find(pszVarName);
- if(tstring::npos != n)
+ if (tstring::npos != n)
{
size_t cLengthHTML = rsHTML.size();
- for(size_t i = n + cVarNameLength;i < cLengthHTML;++i)
+ for (size_t i = n + cVarNameLength; i < cLengthHTML; ++i)
{
TCHAR c = rsHTML[i];
- if(_T(';') == c)
+ if (_T(';') == c)
{
break;
}
@@ -93,13 +93,13 @@ namespace tstring sResult;
tstring::size_type n = rsHTML.find(pszVarName);
- if(tstring::npos != n)
+ if (tstring::npos != n)
{
size_t cLengthHTML = rsHTML.size();
- for(size_t i = n + cVarNameLength;i < cLengthHTML;++i)
+ for (size_t i = n + cVarNameLength; i < cLengthHTML; ++i)
{
TCHAR c = rsHTML[i];
- if(_T(')') == c)
+ if (_T(')') == c)
{
break;
}
@@ -110,7 +110,7 @@ namespace }
}
return sResult;
-// return get_var_value(rsHTML,pszVarName,cVarNameLength);
+ // return get_var_value(rsHTML,pszVarName,cVarNameLength);
}
tstring get_company_name(const tstring& rsHTML)
@@ -118,21 +118,21 @@ namespace static LPCTSTR pszVarName = _T("var _companyName = ");
static size_t cVarNameLength = _tcslen(pszVarName);
- tstring s = get_var_value(rsHTML,pszVarName,cVarNameLength);
- if(s.size() > 0 && _T('\'') == s[0])
+ tstring s = get_var_value(rsHTML, pszVarName, cVarNameLength);
+ if (s.size() > 0 && _T('\'') == s[0])
{
s.erase(s.begin());
}
- if(s.size() > 0 && _T('\'') == s[s.size()-1])
+ if (s.size() > 0 && _T('\'') == s[s.size() - 1])
{
- s.erase(s.rbegin().base()-1);
+ s.erase(s.rbegin().base() - 1);
}
return s;
}
- bool get_double_value(const tstring& rsText,double& rdValue)
+ bool get_double_value(const tstring& rsText, double& rdValue)
{
tistringstream input(rsText);
input.imbue(std::locale("English_United States.1252"));
@@ -151,11 +151,11 @@ namespace }
}
- bool get_rate(const IHTMLNode::THTMLNodePtr& pRate,CGoogleInfo& rInfo)
+ bool get_rate(const IHTMLNode::THTMLNodePtr& pRate, CGoogleInfo& rInfo)
{
tstring sRate = pRate->GetText();
- if(true == get_double_value(sRate,rInfo.m_dRate))
+ if (true == get_double_value(sRate, rInfo.m_dRate))
{
rInfo.m_nFlags |= CGoogleInfo::giRate;
return true;
@@ -166,24 +166,24 @@ namespace }
}
- bool get_inline_data(const IHTMLNode::THTMLNodePtr& pNode,CGoogleInfo& rInfo)
+ bool get_inline_data(const IHTMLNode::THTMLNodePtr& pNode, CGoogleInfo& rInfo)
{
size_t cChild = pNode->GetChildCount();
- for(size_t i = 0;i < cChild;++i)
+ for (size_t i = 0; i < cChild; ++i)
{
IHTMLNode::THTMLNodePtr pChild = pNode->GetChildPtr(i);
size_t c = pChild->GetChildCount();
assert(2 == c);
- if(c >= 2)
+ if (c >= 2)
{
IHTMLNode::THTMLNodePtr pName = pChild->GetChildPtr(0);
tstring sName = pName->GetText();
- if(0 == quotes_stricmp(sName.c_str(),_T("Open")))
+ if (0 == quotes_stricmp(sName.c_str(), _T("Open")))
{
IHTMLNode::THTMLNodePtr pValue = pChild->GetChildPtr(1);
tstring sValue = pValue->GetText();
- if(true == get_double_value(sValue,rInfo.m_dOpenValue))
+ if (true == get_double_value(sValue, rInfo.m_dOpenValue))
{
rInfo.m_nFlags |= CGoogleInfo::giOpen;
}
@@ -195,15 +195,15 @@ namespace return false;
}
- bool get_dif_value(const IHTMLNode::THTMLNodePtr& pNode,CGoogleInfo& rInfo,int nItem)
+ bool get_dif_value(const IHTMLNode::THTMLNodePtr& pNode, CGoogleInfo& rInfo, int nItem)
{
tstring sDiff = pNode->GetText();
// this value is in brackets and it has percentage sign.
// Remove these symbols.
- for(tstring::iterator i = sDiff.begin();i != sDiff.end();)
+ for (tstring::iterator i = sDiff.begin(); i != sDiff.end();)
{
TCHAR s = *i;
- if(_T('(') == s || _T(')') == s || _T('%') == s)
+ if (_T('(') == s || _T(')') == s || _T('%') == s)
{
i = sDiff.erase(i);
}
@@ -214,7 +214,7 @@ namespace }
double* pValue = NULL;
- switch(nItem)
+ switch (nItem)
{
case CGoogleInfo::giPercentChangeAfterHours:
pValue = &rInfo.m_dPercentChangeAfterHours;
@@ -226,7 +226,7 @@ namespace assert(pValue);
- if ((pValue) && (true == get_double_value(sDiff,*pValue)))
+ if ((pValue) && (true == get_double_value(sDiff, *pValue)))
{
rInfo.m_nFlags |= nItem;
return true;
@@ -238,39 +238,39 @@ namespace }
- bool parse_responce(const tstring& rsHTML,CGoogleInfo& rInfo)
+ bool parse_responce(const tstring& rsHTML, CGoogleInfo& rInfo)
{
IHTMLEngine::THTMLParserPtr pHTMLParser = CModuleInfo::GetHTMLEngine()->GetParserPtr();
IHTMLNode::THTMLNodePtr pRoot = pHTMLParser->ParseString(rsHTML);
- if(pRoot)
+ if (pRoot)
{
tstring sCmpID = get_company_id(rsHTML);
- if(false == sCmpID.empty())
+ if (false == sCmpID.empty())
{
- tstring sRateID = make_rate_id_value(sCmpID,CGoogleInfo::giRate);
+ tstring sRateID = make_rate_id_value(sCmpID, CGoogleInfo::giRate);
IHTMLNode::THTMLNodePtr pRate = pRoot->GetElementByID(sRateID);
- if(pRate && get_rate(pRate,rInfo))
+ if (pRate && get_rate(pRate, rInfo))
{
rInfo.m_sCmpName = get_company_name(rsHTML);
IHTMLNode::THTMLNodePtr pInline = pRoot->GetElementByID(_T("snap-data"));
- if(pInline)
+ if (pInline)
{
- get_inline_data(pInline,rInfo);
+ get_inline_data(pInline, rInfo);
}
- tstring sDiffID = make_rate_id_value(sCmpID,CGoogleInfo::giPercentChangeAfterHours);
+ tstring sDiffID = make_rate_id_value(sCmpID, CGoogleInfo::giPercentChangeAfterHours);
IHTMLNode::THTMLNodePtr pDiff = pRoot->GetElementByID(sDiffID);
- if(pDiff)
+ if (pDiff)
{
- get_dif_value(pDiff,rInfo,CGoogleInfo::giPercentChangeAfterHours);
+ get_dif_value(pDiff, rInfo, CGoogleInfo::giPercentChangeAfterHours);
}
- sDiffID = make_rate_id_value(sCmpID,CGoogleInfo::giPercentChangeToYesterdayClose);
+ sDiffID = make_rate_id_value(sCmpID, CGoogleInfo::giPercentChangeToYesterdayClose);
pDiff = pRoot->GetElementByID(sDiffID);
- if(pDiff)
+ if (pDiff)
{
- get_dif_value(pDiff,rInfo,CGoogleInfo::giPercentChangeToYesterdayClose);
+ get_dif_value(pDiff, rInfo, CGoogleInfo::giPercentChangeToYesterdayClose);
}
return true;
@@ -290,55 +290,55 @@ void CQuotesProviderGoogleFinance::RefreshQuotes(TContracts& anContacts) tstring sURL = GetURL();
bool bUseExtendedStatus = CModuleInfo::GetInstance().GetExtendedStatusFlag();
- for(TContracts::const_iterator i = anContacts.begin();i != anContacts.end() && IsOnline();++i)
+ for (TContracts::const_iterator i = anContacts.begin(); i != anContacts.end() && IsOnline(); ++i)
{
MCONTACT hContact = *i;
- if(bUseExtendedStatus)
+ if (bUseExtendedStatus)
{
- SetContactStatus(hContact,ID_STATUS_OCCUPIED);
+ SetContactStatus(hContact, ID_STATUS_OCCUPIED);
}
- tstring sFullURL = build_url(hContact,sURL);
-// LogIt(Info,sFullURL);
+ tstring sFullURL = build_url(hContact, sURL);
+ // LogIt(Info,sFullURL);
if ((true == http.OpenURL(sFullURL)) && (true == IsOnline()))
{
tstring sHTML;
if ((true == http.ReadResponce(sHTML)) && (true == IsOnline()))
{
-// LogIt(Info,sHTML);
+ // LogIt(Info,sHTML);
CGoogleInfo Info;
- parse_responce(sHTML,Info);
- if(true == IsOnline())
+ parse_responce(sHTML, Info);
+ if (true == IsOnline())
{
- if(Info.m_nFlags&CGoogleInfo::giRate)
+ if (Info.m_nFlags&CGoogleInfo::giRate)
{
- if(Info.m_nFlags&CGoogleInfo::giOpen)
+ if (Info.m_nFlags&CGoogleInfo::giOpen)
{
- Quotes_DBWriteDouble(hContact,QUOTES_MODULE_NAME,DB_STR_GOOGLE_FINANCE_OPEN_VALUE,Info.m_dOpenValue);
+ Quotes_DBWriteDouble(hContact, QUOTES_MODULE_NAME, DB_STR_GOOGLE_FINANCE_OPEN_VALUE, Info.m_dOpenValue);
}
- if(Info.m_nFlags&CGoogleInfo::giPercentChangeAfterHours)
+ if (Info.m_nFlags&CGoogleInfo::giPercentChangeAfterHours)
{
- Quotes_DBWriteDouble(hContact,QUOTES_MODULE_NAME,DB_STR_GOOGLE_FINANCE_DIFF,Info.m_dPercentChangeAfterHours);
+ Quotes_DBWriteDouble(hContact, QUOTES_MODULE_NAME, DB_STR_GOOGLE_FINANCE_DIFF, Info.m_dPercentChangeAfterHours);
}
- if(Info.m_nFlags&CGoogleInfo::giPercentChangeToYesterdayClose)
+ if (Info.m_nFlags&CGoogleInfo::giPercentChangeToYesterdayClose)
{
- Quotes_DBWriteDouble(hContact,QUOTES_MODULE_NAME,DB_STR_GOOGLE_FINANCE_PERCENT_CHANGE_TO_YERSTERDAY_CLOSE,Info.m_dPercentChangeToYersterdayClose);
+ Quotes_DBWriteDouble(hContact, QUOTES_MODULE_NAME, DB_STR_GOOGLE_FINANCE_PERCENT_CHANGE_TO_YERSTERDAY_CLOSE, Info.m_dPercentChangeToYersterdayClose);
}
- if(false == Info.m_sCmpName.empty())
+ if (false == Info.m_sCmpName.empty())
{
- db_set_ts(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_DESCRIPTION,Info.m_sCmpName.c_str());
+ db_set_ts(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_DESCRIPTION, Info.m_sCmpName.c_str());
}
- WriteContactRate(hContact,Info.m_dRate);
+ WriteContactRate(hContact, Info.m_dRate);
continue;
}
}
}
}
- SetContactStatus(hContact,ID_STATUS_NA);
+ SetContactStatus(hContact, ID_STATUS_NA);
}
}
diff --git a/plugins/Quotes/src/QuotesProviderVisitor.h b/plugins/Quotes/src/QuotesProviderVisitor.h index 9ae601f2a1..f074884030 100644 --- a/plugins/Quotes/src/QuotesProviderVisitor.h +++ b/plugins/Quotes/src/QuotesProviderVisitor.h @@ -14,12 +14,12 @@ public: CQuotesProviderVisitor() {}
virtual ~CQuotesProviderVisitor() {}
- virtual void Visit(const CQuotesProviderBase& rProvider){}
- virtual void Visit(const CQuotesProviderFinance& rProvider){}
- virtual void Visit(const CQuotesProviderDukasCopy& rProvider){}
- virtual void Visit(const CQuotesProviderGoogle& rProvider){}
- virtual void Visit(const CQuotesProviderGoogleFinance& rProvider){}
- virtual void Visit(const CQuotesProviderYahoo& rProvider){}
+ virtual void Visit(const CQuotesProviderBase&){}
+ virtual void Visit(const CQuotesProviderFinance&){}
+ virtual void Visit(const CQuotesProviderDukasCopy&){}
+ virtual void Visit(const CQuotesProviderGoogle&){}
+ virtual void Visit(const CQuotesProviderGoogleFinance&){}
+ virtual void Visit(const CQuotesProviderYahoo&){}
};
#endif //__7fca59e7_17b2_4849_bd7a_02c7675f2d76_QuotesProviderVisitor_h__
diff --git a/plugins/Quotes/src/QuotesProviderVisitorDbSettings.cpp b/plugins/Quotes/src/QuotesProviderVisitorDbSettings.cpp index c5ea95b598..b8c2a7c68a 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorDbSettings.cpp +++ b/plugins/Quotes/src/QuotesProviderVisitorDbSettings.cpp @@ -1,32 +1,32 @@ #include "StdAfx.h"
CQuotesProviderVisitorDbSettings::CQuotesProviderVisitorDbSettings()
- : m_pszDbRefreshRateType(NULL),
- m_pszDbRefreshRateValue(NULL),
- m_pszDbDisplayNameFormat(NULL),
- m_pszDefDisplayFormat(NULL),
- m_pszDefLogFileFormat(NULL),
- m_pszDefHistoryFormat(NULL),
- m_pszXMLIniFileName(NULL),
- m_pszDbStatusMsgFormat(NULL),
- m_pszDefStatusMsgFormat(NULL),
- m_pszDbLogMode(NULL),
- m_pszDbHistoryFormat(NULL),
- m_pszDbHistoryCondition(NULL),
- m_pszDbLogFile(NULL),
- m_pszDbLogFormat(NULL),
- m_pszDbLogCondition(NULL),
- m_pszDbPopupFormat(NULL),
- m_pszDefPopupFormat(NULL),
- m_pszDbPopupCondition(NULL),
- m_pszDbPopupColourMode(NULL),
- m_pszDbPopupBkColour(NULL),
- m_pszDbPopupTextColour(NULL),
- m_pszDbPopupDelayMode(NULL),
- m_pszDbPopupDelayTimeout(NULL),
- m_pszDbPopupHistoryFlag(NULL),
- m_pszDbTendencyFormat(nullptr),
- m_pszDefTendencyFormat(_T("%r>%p"))
+ : m_pszDbRefreshRateType(NULL),
+ m_pszDbRefreshRateValue(NULL),
+ m_pszDbDisplayNameFormat(NULL),
+ m_pszDefDisplayFormat(NULL),
+ m_pszDefLogFileFormat(NULL),
+ m_pszDefHistoryFormat(NULL),
+ m_pszXMLIniFileName(NULL),
+ m_pszDbStatusMsgFormat(NULL),
+ m_pszDefStatusMsgFormat(NULL),
+ m_pszDbLogMode(NULL),
+ m_pszDbHistoryFormat(NULL),
+ m_pszDbHistoryCondition(NULL),
+ m_pszDbLogFile(NULL),
+ m_pszDbLogFormat(NULL),
+ m_pszDbLogCondition(NULL),
+ m_pszDbPopupFormat(NULL),
+ m_pszDefPopupFormat(NULL),
+ m_pszDbPopupCondition(NULL),
+ m_pszDbPopupColourMode(NULL),
+ m_pszDbPopupBkColour(NULL),
+ m_pszDbPopupTextColour(NULL),
+ m_pszDbPopupDelayMode(NULL),
+ m_pszDbPopupDelayTimeout(NULL),
+ m_pszDbPopupHistoryFlag(NULL),
+ m_pszDbTendencyFormat(nullptr),
+ m_pszDefTendencyFormat(_T("%r>%p"))
{
}
@@ -56,7 +56,7 @@ void CQuotesProviderVisitorDbSettings::Visit(const CQuotesProviderDukasCopy&/* r m_pszDbLogFile = "DC_LogFile";
m_pszDbLogFormat = "DC_LogFileFormat";
m_pszDbLogCondition = "DC_AddToLogOnlyIfValueIsChanged";
- m_pszDbPopupFormat ="DC_PopupFormat";
+ m_pszDbPopupFormat = "DC_PopupFormat";
m_pszDbPopupCondition = "DC_ShowPopupOnlyIfValueChanged";
m_pszDbPopupColourMode = "DC_PopupColourMode";
@@ -83,7 +83,7 @@ void CQuotesProviderVisitorDbSettings::Visit(const CQuotesProviderGoogle&/* rPro m_pszDbLogFile = "Google_LogFile";
m_pszDbLogFormat = "Google_LogFileFormat";
m_pszDbLogCondition = "Google_AddToLogOnlyIfValueIsChanged";
- m_pszDbPopupFormat ="Google_PopupFormat";
+ m_pszDbPopupFormat = "Google_PopupFormat";
m_pszDbPopupCondition = "Google_ShowPopupOnlyIfValueChanged";
m_pszDbPopupColourMode = "Google_PopupColourMode";
@@ -111,7 +111,7 @@ void CQuotesProviderVisitorDbSettings::Visit(const CQuotesProviderGoogleFinance& m_pszDbLogFile = "GoogleFinance_LogFile";
m_pszDbLogFormat = "GoogleFinance_LogFileFormat";
m_pszDbLogCondition = "GoogleFinance_AddToLogOnlyIfValueIsChanged";
- m_pszDbPopupFormat ="GoogleFinance_PopupFormat";
+ m_pszDbPopupFormat = "GoogleFinance_PopupFormat";
m_pszDbPopupCondition = "GoogleFinance_ShowPopupOnlyIfValueChanged";
m_pszDbPopupColourMode = "GoogleFinance_PopupColourMode";
@@ -124,7 +124,7 @@ void CQuotesProviderVisitorDbSettings::Visit(const CQuotesProviderGoogleFinance& m_pszDbTendencyFormat = "GoogleFinance_TendencyFormat";
}
-void CQuotesProviderVisitorDbSettings::Visit(const CQuotesProviderYahoo& rProvider)
+void CQuotesProviderVisitorDbSettings::Visit(const CQuotesProviderYahoo&)
{
m_pszDbRefreshRateType = "Yahoo_RefreshRateType";
m_pszDbRefreshRateValue = "Yahoo_RefreshRateValue";
@@ -139,7 +139,7 @@ void CQuotesProviderVisitorDbSettings::Visit(const CQuotesProviderYahoo& rProvid m_pszDbLogFile = "Yahoo_LogFile";
m_pszDbLogFormat = "Yahoo_LogFileFormat";
m_pszDbLogCondition = "Yahoo_AddToLogOnlyIfValueIsChanged";
- m_pszDbPopupFormat ="Yahoo_PopupFormat";
+ m_pszDbPopupFormat = "Yahoo_PopupFormat";
m_pszDbPopupCondition = "Yahoo_ShowPopupOnlyIfValueChanged";
m_pszDbPopupColourMode = "Yahoo_PopupColourMode";
diff --git a/plugins/Quotes/src/QuotesProviderVisitorDbSettings.h b/plugins/Quotes/src/QuotesProviderVisitorDbSettings.h index 596d5139b7..95805cc110 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorDbSettings.h +++ b/plugins/Quotes/src/QuotesProviderVisitorDbSettings.h @@ -16,7 +16,7 @@ private: public:
LPCSTR m_pszDbRefreshRateType;
LPCSTR m_pszDbRefreshRateValue;
- LPCSTR m_pszDbDisplayNameFormat;
+ LPCSTR m_pszDbDisplayNameFormat;
LPCTSTR m_pszDefDisplayFormat;
LPCTSTR m_pszDefLogFileFormat;
LPCTSTR m_pszDefHistoryFormat;
diff --git a/plugins/Quotes/src/QuotesProviderVisitorFormatSpecificator.cpp b/plugins/Quotes/src/QuotesProviderVisitorFormatSpecificator.cpp index cd71efaa0d..26cfef3cfa 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorFormatSpecificator.cpp +++ b/plugins/Quotes/src/QuotesProviderVisitorFormatSpecificator.cpp @@ -10,39 +10,39 @@ CQuotesProviderVisitorFormatSpecificator::~CQuotesProviderVisitorFormatSpecifica void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderDukasCopy&/* rProvider*/)
{
- m_aSpecificators.push_back(CFormatSpecificator(_T("%s"),TranslateT("Quote Symbol")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%d"),TranslateT("Quote Name")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%s"), TranslateT("Quote Symbol")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%d"), TranslateT("Quote Name")));
}
void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderGoogle&/* rProvider*/)
{
- m_aSpecificators.push_back(CFormatSpecificator(_T("%F"),TranslateT("From Currency Full Name")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%f"),TranslateT("From Currency Short Name")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%I"),TranslateT("Into Currency Full Name")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%i"),TranslateT("Into Currency Short Name")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%s"),TranslateT("Short notation for \"%f/%i\"")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%F"), TranslateT("From Currency Full Name")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%f"), TranslateT("From Currency Short Name")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%I"), TranslateT("Into Currency Full Name")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%i"), TranslateT("Into Currency Short Name")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%s"), TranslateT("Short notation for \"%f/%i\"")));
}
void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderBase&/* rProvider*/)
{
- m_aSpecificators.push_back(CFormatSpecificator(_T("%S"),TranslateT("Source of Information")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%r"),TranslateT("Rate Value")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%p"),TranslateT("Previous Rate Value")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%X"),TranslateT("Fetch Time")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%x"),TranslateT("Fetch Date")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%t"),TranslateT("Fetch Time and Date")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("\\%"),TranslateT("Percentage Character (%)")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("\\t"),TranslateT("Tabulation")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("\\\\"),TranslateT("Left slash (\\)")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%S"), TranslateT("Source of Information")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%r"), TranslateT("Rate Value")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%p"), TranslateT("Previous Rate Value")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%X"), TranslateT("Fetch Time")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%x"), TranslateT("Fetch Date")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%t"), TranslateT("Fetch Time and Date")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("\\%"), TranslateT("Percentage Character (%)")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("\\t"), TranslateT("Tabulation")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("\\\\"), TranslateT("Left slash (\\)")));
}
void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderGoogleFinance&/* rProvider*/)
{
- m_aSpecificators.push_back(CFormatSpecificator(_T("%s"),TranslateT("Quote Symbol")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%n"),TranslateT("Quote Name")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%o"),TranslateT("Open Price")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%d"),TranslateT("Percent Change to After Hours")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%y"),TranslateT("Percent Change to Yesterday Close")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%s"), TranslateT("Quote Symbol")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%n"), TranslateT("Quote Name")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%o"), TranslateT("Open Price")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%d"), TranslateT("Percent Change to After Hours")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%y"), TranslateT("Percent Change to Yesterday Close")));
}
const CQuotesProviderVisitorFormatSpecificator::TFormatSpecificators& CQuotesProviderVisitorFormatSpecificator::GetSpecificators()const
@@ -50,13 +50,13 @@ const CQuotesProviderVisitorFormatSpecificator::TFormatSpecificators& CQuotesPro return m_aSpecificators;
}
-void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderYahoo& rProvider)
+void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderYahoo&)
{
- m_aSpecificators.push_back(CFormatSpecificator(_T("%s"),TranslateT("Quote Symbol")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%n"),TranslateT("Quote Name")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%o"),TranslateT("Open Price")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%h"),TranslateT("Day's High")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%g"),TranslateT("Day's Low")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%P"),TranslateT("Previous Close")));
- m_aSpecificators.push_back(CFormatSpecificator(_T("%c"),TranslateT("Change")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%s"), TranslateT("Quote Symbol")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%n"), TranslateT("Quote Name")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%o"), TranslateT("Open Price")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%h"), TranslateT("Day's High")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%g"), TranslateT("Day's Low")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%P"), TranslateT("Previous Close")));
+ m_aSpecificators.push_back(CFormatSpecificator(_T("%c"), TranslateT("Change")));
}
diff --git a/plugins/Quotes/src/QuotesProviderVisitorFormatSpecificator.h b/plugins/Quotes/src/QuotesProviderVisitorFormatSpecificator.h index cb0c3c5df2..0d5fc265fd 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorFormatSpecificator.h +++ b/plugins/Quotes/src/QuotesProviderVisitorFormatSpecificator.h @@ -6,8 +6,8 @@ class CQuotesProviderVisitorFormatSpecificator : public CQuotesProviderVisitor public:
struct CFormatSpecificator
{
- CFormatSpecificator(const tstring& rsSymbol = _T(""),const tstring& rsDec = _T(""))
- : m_sSymbol(rsSymbol),m_sDesc(rsDec){}
+ CFormatSpecificator(const tstring& rsSymbol = _T(""), const tstring& rsDec = _T(""))
+ : m_sSymbol(rsSymbol), m_sDesc(rsDec){}
tstring m_sSymbol;
tstring m_sDesc;
diff --git a/plugins/Quotes/src/QuotesProviderVisitorFormater.cpp b/plugins/Quotes/src/QuotesProviderVisitorFormater.cpp index e9bef2e8a6..4b58a3af51 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorFormater.cpp +++ b/plugins/Quotes/src/QuotesProviderVisitorFormater.cpp @@ -1,9 +1,9 @@ #include "StdAfx.h"
-CQuotesProviderVisitorFormater::CQuotesProviderVisitorFormater(MCONTACT hContact,TCHAR chr,int nWidth)
- : m_hContact(hContact),
- m_chr(chr),
- m_nWidth(nWidth)
+CQuotesProviderVisitorFormater::CQuotesProviderVisitorFormater(MCONTACT hContact, TCHAR chr, int nWidth)
+ : m_hContact(hContact),
+ m_chr(chr),
+ m_nWidth(nWidth)
{
}
@@ -16,36 +16,36 @@ const tstring& CQuotesProviderVisitorFormater::GetResult()const return m_sResult;
}
-void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderDukasCopy& rProvider)
+void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderDukasCopy&)
{
- if(_T('d') == m_chr || _T('D') == m_chr)
+ if (_T('d') == m_chr || _T('D') == m_chr)
{
- m_sResult = Quotes_DBGetStringT(m_hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_DESCRIPTION);
+ m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_DESCRIPTION);
}
}
-void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderGoogle& rProvider)
+void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderGoogle&)
{
- switch(m_chr)
+ switch (m_chr)
{
case _T('F'):
- m_sResult = Quotes_DBGetStringT(m_hContact,QUOTES_MODULE_NAME,DB_STR_FROM_DESCRIPTION);
+ m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_FROM_DESCRIPTION);
break;
case _T('f'):
- m_sResult = Quotes_DBGetStringT(m_hContact,QUOTES_MODULE_NAME,DB_STR_FROM_ID);
+ m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_FROM_ID);
break;
case _T('I'):
- m_sResult = Quotes_DBGetStringT(m_hContact,QUOTES_MODULE_NAME,DB_STR_TO_DESCRIPTION);
+ m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_TO_DESCRIPTION);
break;
case _T('i'):
- m_sResult = Quotes_DBGetStringT(m_hContact,QUOTES_MODULE_NAME,DB_STR_TO_ID);
+ m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_TO_ID);
break;
}
}
namespace
{
- bool get_fetch_time(MCONTACT hContact,time_t& rTime)
+ bool get_fetch_time(MCONTACT hContact, time_t& rTime)
{
DBVARIANT dbv;
if (db_get(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_FETCH_TIME, &dbv) || (DBVT_DWORD != dbv.type))
@@ -55,14 +55,14 @@ namespace return true;
}
- tstring format_fetch_time(const CQuotesProviderBase& rProvider,MCONTACT hContact,const tstring& rsFormat)
+ tstring format_fetch_time(const CQuotesProviderBase&, MCONTACT hContact, const tstring& rsFormat)
{
time_t nTime;
- if(true == get_fetch_time(hContact,nTime))
+ if (true == get_fetch_time(hContact, nTime))
{
boost::posix_time::ptime time = boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(boost::posix_time::from_time_t(nTime));
tostringstream k;
- k.imbue(std::locale(GetSystemLocale(),new ttime_facet(rsFormat.c_str())));
+ k.imbue(std::locale(GetSystemLocale(), new ttime_facet(rsFormat.c_str())));
k << time;
return k.str();
}
@@ -73,40 +73,40 @@ namespace void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderBase& rProvider)
{
- switch(m_chr)
+ switch (m_chr)
{
-// default:
-// m_sResult = m_chr;
-// break;
+ // default:
+ // m_sResult = m_chr;
+ // break;
case _T('%'):
case _T('\t'):
case _T('\\'):
m_sResult = m_chr;
break;
case _T('S'):
- m_sResult = Quotes_DBGetStringT(m_hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_PROVIDER);
+ m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_PROVIDER);
break;
case _T('s'):
- m_sResult = Quotes_DBGetStringT(m_hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_SYMBOL);
+ m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_SYMBOL);
break;
case _T('X'):
//m_sResult = format_fetch_time(rProvider,m_hContact,_T("%H:%M:%S"));
- m_sResult = format_fetch_time(rProvider,m_hContact,Quotes_GetTimeFormat(true));
+ m_sResult = format_fetch_time(rProvider, m_hContact, Quotes_GetTimeFormat(true));
break;
case _T('x'):
//m_sResult = format_fetch_time(rProvider,m_hContact,_T("%d.%m.%y"));
- m_sResult = format_fetch_time(rProvider,m_hContact,Quotes_GetDateFormat(true));
+ m_sResult = format_fetch_time(rProvider, m_hContact, Quotes_GetDateFormat(true));
break;
case _T('t'):
- {
- tstring sFrmt = Quotes_GetDateFormat(true);
- sFrmt += _T(" ");
- sFrmt += Quotes_GetTimeFormat(true);
- m_sResult = format_fetch_time(rProvider,m_hContact,sFrmt);
+ {
+ tstring sFrmt = Quotes_GetDateFormat(true);
+ sFrmt += _T(" ");
+ sFrmt += Quotes_GetTimeFormat(true);
+ m_sResult = format_fetch_time(rProvider, m_hContact, sFrmt);
- //m_sResult = format_fetch_time(rProvider,m_hContact,_T("%d.%m.%y %H:%M:%S"));
- }
- break;
+ //m_sResult = format_fetch_time(rProvider,m_hContact,_T("%d.%m.%y %H:%M:%S"));
+ }
+ break;
case _T('r'):
case _T('R'):
FormatDoubleHelper(DB_STR_QUOTE_CURR_VALUE);
@@ -114,42 +114,42 @@ void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderBase& rProvider) case _T('p'):
FormatDoubleHelper(DB_STR_QUOTE_PREV_VALUE);
break;
-// case _T('c'):
-// FormatChangeValueHelper(false);
-// break;
-// case _T('C'):
-// FormatChangeValueHelper(true);
-// break;
+ // case _T('c'):
+ // FormatChangeValueHelper(false);
+ // break;
+ // case _T('C'):
+ // FormatChangeValueHelper(true);
+ // break;
}
}
void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderGoogleFinance&/* rProvider*/)
{
- switch(m_chr)
+ switch (m_chr)
{
- case _T('o'):
- FormatDoubleHelper(DB_STR_GOOGLE_FINANCE_OPEN_VALUE);
- break;
- case _T('d'):
- FormatDoubleHelper(DB_STR_GOOGLE_FINANCE_DIFF,_T("0"));
- break;
- case _T('y'):
- FormatDoubleHelper(DB_STR_GOOGLE_FINANCE_PERCENT_CHANGE_TO_YERSTERDAY_CLOSE,_T("0"));
- break;
- case _T('n'):
- m_sResult = Quotes_DBGetStringT(m_hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_DESCRIPTION);
- break;
+ case _T('o'):
+ FormatDoubleHelper(DB_STR_GOOGLE_FINANCE_OPEN_VALUE);
+ break;
+ case _T('d'):
+ FormatDoubleHelper(DB_STR_GOOGLE_FINANCE_DIFF, _T("0"));
+ break;
+ case _T('y'):
+ FormatDoubleHelper(DB_STR_GOOGLE_FINANCE_PERCENT_CHANGE_TO_YERSTERDAY_CLOSE, _T("0"));
+ break;
+ case _T('n'):
+ m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_DESCRIPTION);
+ break;
}
}
-namespace
+namespace
{
- tstring format_double(double dValue,int nWidth)
+ tstring format_double(double dValue, int nWidth)
{
tostringstream o;
o.imbue(GetSystemLocale());
- if(nWidth > 0 && nWidth <= 9)
+ if (nWidth > 0 && nWidth <= 9)
{
o << std::setprecision(nWidth) << std::showpoint << std::fixed;
}
@@ -160,12 +160,12 @@ namespace }
void CQuotesProviderVisitorFormater::FormatDoubleHelper(LPCSTR pszDbSet,
- const tstring sInvalid/* = _T("-")*/)
+ const tstring sInvalid/* = _T("-")*/)
{
double d = 0.0;
- if(true == Quotes_DBReadDouble(m_hContact,QUOTES_MODULE_NAME,pszDbSet,d))
+ if (true == Quotes_DBReadDouble(m_hContact, QUOTES_MODULE_NAME, pszDbSet, d))
{
- m_sResult = format_double(d,m_nWidth);
+ m_sResult = format_double(d, m_nWidth);
}
else
{
@@ -173,9 +173,9 @@ void CQuotesProviderVisitorFormater::FormatDoubleHelper(LPCSTR pszDbSet, }
}
-void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderYahoo& rProvider)
+void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderYahoo&)
{
- switch(m_chr)
+ switch (m_chr)
{
case _T('o'):
FormatDoubleHelper(DB_STR_YAHOO_OPEN_VALUE);
@@ -193,7 +193,7 @@ void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderYahoo& rProvider FormatDoubleHelper(DB_STR_YAHOO_DAY_LOW);
break;
case _T('n'):
- m_sResult = Quotes_DBGetStringT(m_hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_DESCRIPTION);
+ m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_DESCRIPTION);
break;
}
diff --git a/plugins/Quotes/src/QuotesProviderVisitorFormater.h b/plugins/Quotes/src/QuotesProviderVisitorFormater.h index e2360fb538..dc7481fa44 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorFormater.h +++ b/plugins/Quotes/src/QuotesProviderVisitorFormater.h @@ -4,7 +4,7 @@ class CQuotesProviderVisitorFormater : public CQuotesProviderVisitor
{
public:
- CQuotesProviderVisitorFormater(MCONTACT hContact,TCHAR chr,int nWidth);
+ CQuotesProviderVisitorFormater(MCONTACT hContact, TCHAR chr, int nWidth);
~CQuotesProviderVisitorFormater();
const tstring& GetResult()const;
@@ -17,8 +17,8 @@ private: virtual void Visit(const CQuotesProviderYahoo& rProvider);
private:
- void FormatDoubleHelper(LPCSTR pszDbSet,const tstring sInvalid = _T("-"));
-// void FormatChangeValueHelper(bool bPercentage);
+ void FormatDoubleHelper(LPCSTR pszDbSet, const tstring sInvalid = _T("-"));
+ // void FormatChangeValueHelper(bool bPercentage);
private:
MCONTACT m_hContact;
diff --git a/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp b/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp index d5495abc16..1a62a289f1 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp +++ b/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp @@ -1,13 +1,13 @@ #include "stdafx.h"
-CQuotesProviderVisitorTendency::CQuotesProviderVisitorTendency(MCONTACT hContact,TCHAR chr)
- : m_hContact(hContact),m_chr(chr),m_bValid(false),m_dResult(0.0)
+CQuotesProviderVisitorTendency::CQuotesProviderVisitorTendency(MCONTACT hContact, TCHAR chr)
+ : m_hContact(hContact), m_chr(chr), m_bValid(false), m_dResult(0.0)
{
}
-void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderBase& rProvider)
+void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderBase&)
{
- switch(m_chr)
+ switch (m_chr)
{
case _T('r'):
case _T('R'):
@@ -19,9 +19,9 @@ void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderBase& rProvider) }
}
-void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderGoogleFinance& rProvider)
+void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderGoogleFinance&)
{
- switch(m_chr)
+ switch (m_chr)
{
case _T('o'):
GetValue(DB_STR_GOOGLE_FINANCE_OPEN_VALUE);
@@ -35,9 +35,9 @@ void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderGoogleFinance& r }
}
-void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderYahoo& rProvider)
+void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderYahoo&)
{
- switch(m_chr)
+ switch (m_chr)
{
case _T('o'):
GetValue(DB_STR_YAHOO_OPEN_VALUE);
@@ -61,5 +61,5 @@ void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderYahoo& rProvider void CQuotesProviderVisitorTendency::GetValue(LPCSTR pszDbKeyName)
{
- m_bValid = Quotes_DBReadDouble(m_hContact,QUOTES_MODULE_NAME,pszDbKeyName,m_dResult);
+ m_bValid = Quotes_DBReadDouble(m_hContact, QUOTES_MODULE_NAME, pszDbKeyName, m_dResult);
}
diff --git a/plugins/Quotes/src/QuotesProviderVisitorTendency.h b/plugins/Quotes/src/QuotesProviderVisitorTendency.h index d3d1b34b1c..9f81605220 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorTendency.h +++ b/plugins/Quotes/src/QuotesProviderVisitorTendency.h @@ -4,10 +4,10 @@ class CQuotesProviderVisitorTendency : public CQuotesProviderVisitor
{
public:
- CQuotesProviderVisitorTendency(MCONTACT hContact,TCHAR chr);
-
- bool IsValid()const{return m_bValid;}
- double GetResult()const{return m_dResult;}
+ CQuotesProviderVisitorTendency(MCONTACT hContact, TCHAR chr);
+
+ bool IsValid()const{ return m_bValid; }
+ double GetResult()const{ return m_dResult; }
private:
virtual void Visit(const CQuotesProviderBase& rProvider);
diff --git a/plugins/Quotes/src/QuotesProviderYahoo.cpp b/plugins/Quotes/src/QuotesProviderYahoo.cpp index d7196b7466..ab09978d39 100644 --- a/plugins/Quotes/src/QuotesProviderYahoo.cpp +++ b/plugins/Quotes/src/QuotesProviderYahoo.cpp @@ -11,7 +11,7 @@ namespace if (*s.rbegin() == _T('"'))
{
tstring::iterator i(s.begin());
- std::advance(i,s.size()-1);
+ std::advance(i, s.size() - 1);
s.erase(i);
}
}
@@ -21,47 +21,47 @@ namespace if (*s.rbegin() == _T('\n'))
{
tstring::iterator i(s.begin());
- std::advance(i,s.size()-1);
+ std::advance(i, s.size() - 1);
s.erase(i);
}
if (*s.rbegin() == _T('\r'))
{
tstring::iterator i(s.begin());
- std::advance(i,s.size()-1);
+ std::advance(i, s.size() - 1);
s.erase(i);
}
}
- bool t2d(const tstring& s,double& d)
+ bool t2d(const tstring& s, double& d)
{
tistringstream stream(s);
stream >> d;
return ((false == stream.fail()) && (false == stream.bad()));
-// try
-// {
-// d = boost::lexical_cast<double>(s);
-// return true;
-// }
-// catch(boost::bad_lexical_cast& e)
-// {
-// }
-// return false;
+ // try
+ // {
+ // d = boost::lexical_cast<double>(s);
+ // return true;
+ // }
+ // catch(boost::bad_lexical_cast& e)
+ // {
+ // }
+ // return false;
}
typedef std::vector<tstring> TStrings;
- bool get_double_from_parsed_line(MCONTACT hContact,const TStrings& rasParsedLine,size_t nIndex,const char* pszDbName)
+ bool get_double_from_parsed_line(MCONTACT hContact, const TStrings& rasParsedLine, size_t nIndex, const char* pszDbName)
{
- if(rasParsedLine.size() > nIndex)
+ if (rasParsedLine.size() > nIndex)
{
double d = 0.0;
- if(true == t2d(rasParsedLine[nIndex],d))
+ if (true == t2d(rasParsedLine[nIndex], d))
{
- return Quotes_DBWriteDouble(hContact,QUOTES_MODULE_NAME,pszDbName,d);
+ return Quotes_DBWriteDouble(hContact, QUOTES_MODULE_NAME, pszDbName, d);
}
}
- db_set_ts(hContact,QUOTES_MODULE_NAME,pszDbName,_T(""));
+ db_set_ts(hContact, QUOTES_MODULE_NAME, pszDbName, _T(""));
return false;
}
}
@@ -71,28 +71,28 @@ void CQuotesProviderYahoo::RefreshQuotes(TContracts& anContacts) tstring sURL = GetURL();
bool bUseExtendedStatus = CModuleInfo::GetInstance().GetExtendedStatusFlag();
- typedef std::map<tstring,MCONTACT> TQuoteID2ContractHandles;
+ typedef std::map<tstring, MCONTACT> TQuoteID2ContractHandles;
TQuoteID2ContractHandles aQuoteID2Handles;
tostringstream oURL;
oURL << sURL << _T("dioksin.txt?s=");
- for(TContracts::const_iterator i = anContacts.begin();i != anContacts.end() && IsOnline();++i)
+ for (TContracts::const_iterator i = anContacts.begin(); i != anContacts.end() && IsOnline(); ++i)
{
MCONTACT hContact = *i;
- if(bUseExtendedStatus)
+ if (bUseExtendedStatus)
{
- SetContactStatus(hContact,ID_STATUS_OCCUPIED);
+ SetContactStatus(hContact, ID_STATUS_OCCUPIED);
}
- tstring sQuoteID = Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_ID);
+ tstring sQuoteID = Quotes_DBGetStringT(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_ID);
aQuoteID2Handles[sQuoteID] = hContact;
- if(i != anContacts.begin())
+ if (i != anContacts.begin())
{
oURL << _T("+");
}
oURL << sQuoteID;
}
- if(true == IsOnline())
+ if (true == IsOnline())
{
oURL << _T("&f=snl1ohgpc1");
CHTTPSession http;
@@ -102,40 +102,40 @@ void CQuotesProviderYahoo::RefreshQuotes(TContracts& anContacts) if ((true == http.ReadResponce(sFile)) && (true == IsOnline()))
{
tistringstream out_str(sFile.c_str());
- while(false == out_str.eof())
+ while (false == out_str.eof())
{
tstring sLine;
- std::getline(out_str,sLine);
- if(false == sLine.empty())
+ std::getline(out_str, sLine);
+ if (false == sLine.empty())
{
remove_end_of_line(sLine);
TStrings asStrings;
- for(tstring::size_type nPos = sLine.find(_T(','));nPos != tstring::npos; nPos = sLine.find(_T(',')))
+ for (tstring::size_type nPos = sLine.find(_T(',')); nPos != tstring::npos; nPos = sLine.find(_T(',')))
{
tstring::iterator i(sLine.begin());
- std::advance(i,nPos);
- tstring s(sLine.begin(),i);
+ std::advance(i, nPos);
+ tstring s(sLine.begin(), i);
remove_quotes(s);
asStrings.push_back(s);
- if(i != sLine.end())
+ if (i != sLine.end())
{
- std::advance(i,1);
+ std::advance(i, 1);
}
- sLine.erase(sLine.begin(),i);
+ sLine.erase(sLine.begin(), i);
}
- if(false == sLine.empty())
+ if (false == sLine.empty())
{
remove_quotes(sLine);
- if(false == sLine.empty())
- asStrings.push_back(sLine);
+ if (false == sLine.empty())
+ asStrings.push_back(sLine);
}
-
+
size_t cItems = asStrings.size();
- if(cItems >= 3)
+ if (cItems >= 3)
{
enum
{
@@ -149,33 +149,33 @@ void CQuotesProviderYahoo::RefreshQuotes(TContracts& anContacts) indexChange
};
auto it3 = aQuoteID2Handles.find(asStrings[indexSymbol]);
- if(it3 != aQuoteID2Handles.end())
+ if (it3 != aQuoteID2Handles.end())
{
MCONTACT hContact = it3->second;
double dRate = 0.0;
- if(true == t2d(asStrings[indexLastTrade],dRate))
+ if (true == t2d(asStrings[indexLastTrade], dRate))
{
- db_set_ts(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_DESCRIPTION,asStrings[indexName].c_str());
-
- get_double_from_parsed_line(hContact,asStrings,indexOpen,DB_STR_YAHOO_OPEN_VALUE);
- get_double_from_parsed_line(hContact,asStrings,indexDayHigh,DB_STR_YAHOO_DAY_HIGH);
- get_double_from_parsed_line(hContact,asStrings,indexDayLow,DB_STR_YAHOO_DAY_LOW);
- get_double_from_parsed_line(hContact,asStrings,indexPreviousClose,DB_STR_YAHOO_PREVIOUS_CLOSE);
- get_double_from_parsed_line(hContact,asStrings,indexChange,DB_STR_YAHOO_CHANGE);
- WriteContactRate(hContact,dRate);
+ db_set_ts(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_DESCRIPTION, asStrings[indexName].c_str());
+
+ get_double_from_parsed_line(hContact, asStrings, indexOpen, DB_STR_YAHOO_OPEN_VALUE);
+ get_double_from_parsed_line(hContact, asStrings, indexDayHigh, DB_STR_YAHOO_DAY_HIGH);
+ get_double_from_parsed_line(hContact, asStrings, indexDayLow, DB_STR_YAHOO_DAY_LOW);
+ get_double_from_parsed_line(hContact, asStrings, indexPreviousClose, DB_STR_YAHOO_PREVIOUS_CLOSE);
+ get_double_from_parsed_line(hContact, asStrings, indexChange, DB_STR_YAHOO_CHANGE);
+ WriteContactRate(hContact, dRate);
aQuoteID2Handles.erase(it3);
}
- }
+ }
}
}
}
}
}
- if(true == IsOnline())
+ if (true == IsOnline())
{
- std::for_each(aQuoteID2Handles.begin(),aQuoteID2Handles.end(),
- [](const TQuoteID2ContractHandles::value_type& pair){SetContactStatus(pair.second,ID_STATUS_NA);});
+ std::for_each(aQuoteID2Handles.begin(), aQuoteID2Handles.end(),
+ [](const TQuoteID2ContractHandles::value_type& pair){SetContactStatus(pair.second, ID_STATUS_NA); });
}
}
}
diff --git a/plugins/Quotes/src/QuotesProviders.cpp b/plugins/Quotes/src/QuotesProviders.cpp index b8194f3cea..1c61395d55 100644 --- a/plugins/Quotes/src/QuotesProviders.cpp +++ b/plugins/Quotes/src/QuotesProviders.cpp @@ -22,7 +22,7 @@ namespace template<class T>void create_provider(CQuotesProviders::TQuotesProviders& apProviders)
{
CQuotesProviders::TQuotesProviderPtr pProvider(new T);
- if(pProvider->Init())
+ if (pProvider->Init())
{
apProviders.push_back(pProvider);
}
@@ -44,12 +44,12 @@ void CQuotesProviders::ClearProviders() namespace
{
- void convert_contact_settings(MCONTACT hContact)
+ void convert_contact_settings(MCONTACT hContact)
{
- WORD dwLogMode = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG,static_cast<WORD>(lmDisabled));
+ WORD dwLogMode = db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG, static_cast<WORD>(lmDisabled));
if ((dwLogMode&lmInternalHistory) || (dwLogMode&lmExternalFile))
{
- db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,1);
+ db_set_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_CONTACT_SPEC_SETTINGS, 1);
}
}
}
@@ -58,34 +58,34 @@ void CQuotesProviders::InitProviders() CreateProviders();
const WORD nCurrentVersion = 17;
- WORD nVersion = db_get_w(NULL,QUOTES_MODULE_NAME,LAST_RUN_VERSION,1);
+ WORD nVersion = db_get_w(NULL, QUOTES_MODULE_NAME, LAST_RUN_VERSION, 1);
- for(MCONTACT hContact = db_find_first(QUOTES_MODULE_NAME); hContact; hContact = db_find_next(hContact, QUOTES_MODULE_NAME))
+ for (MCONTACT hContact = db_find_first(QUOTES_MODULE_NAME); hContact; hContact = db_find_next(hContact, QUOTES_MODULE_NAME))
{
TQuotesProviderPtr pProvider = GetContactProviderPtr(hContact);
- if(pProvider)
+ if (pProvider)
{
pProvider->AddContact(hContact);
- if(nVersion < nCurrentVersion)
+ if (nVersion < nCurrentVersion)
{
convert_contact_settings(hContact);
}
}
}
- db_set_w(NULL,QUOTES_MODULE_NAME,LAST_RUN_VERSION,nCurrentVersion);
+ db_set_w(NULL, QUOTES_MODULE_NAME, LAST_RUN_VERSION, nCurrentVersion);
}
CQuotesProviders::TQuotesProviderPtr CQuotesProviders::GetContactProviderPtr(MCONTACT hContact)const
{
char* szProto = GetContactProto(hContact);
- if(NULL == szProto || 0 != ::_stricmp(szProto, QUOTES_PROTOCOL_NAME))
+ if (NULL == szProto || 0 != ::_stricmp(szProto, QUOTES_PROTOCOL_NAME))
{
return TQuotesProviderPtr();
}
- tstring sProvider = Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_PROVIDER);
- if(true == sProvider.empty())
+ tstring sProvider = Quotes_DBGetStringT(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_PROVIDER);
+ if (true == sProvider.empty())
{
return TQuotesProviderPtr();
}
@@ -96,11 +96,11 @@ CQuotesProviders::TQuotesProviderPtr CQuotesProviders::GetContactProviderPtr(MCO CQuotesProviders::TQuotesProviderPtr CQuotesProviders::FindProvider(const tstring& rsName)const
{
TQuotesProviderPtr pResult;
- for(TQuotesProviders::const_iterator i = m_apProviders.begin();i != m_apProviders.end();++i)
+ for (TQuotesProviders::const_iterator i = m_apProviders.begin(); i != m_apProviders.end(); ++i)
{
const TQuotesProviderPtr& pProvider = *i;
const IQuotesProvider::CProviderInfo& rInfo = pProvider->GetInfo();
- if(0 == ::quotes_stricmp(rsName.c_str(),rInfo.m_sName.c_str()))
+ if (0 == ::quotes_stricmp(rsName.c_str(), rInfo.m_sName.c_str()))
{
pResult = pProvider;
break;
diff --git a/plugins/Quotes/src/SettingsDlg.cpp b/plugins/Quotes/src/SettingsDlg.cpp index 7540075336..6e14d26137 100644 --- a/plugins/Quotes/src/SettingsDlg.cpp +++ b/plugins/Quotes/src/SettingsDlg.cpp @@ -9,89 +9,89 @@ namespace void update_file_controls(HWND hDlg)
{
- bool bEnable = (1 == ::IsDlgButtonChecked(hDlg,IDC_CHECK_EXTERNAL_FILE));
-
- ::EnableWindow(::GetDlgItem(hDlg,IDC_EDIT_FILE_NAME),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_STATIC_SELECT_FILE),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_BROWSE),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_STATIC_LOG_FILE_FORMAT),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_EDIT_LOG_FILE_FORMAT),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_LOG_FILE_DESCRIPTION),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_CHECK_LOG_FILE_CONDITION),bEnable);
+ bool bEnable = (1 == ::IsDlgButtonChecked(hDlg, IDC_CHECK_EXTERNAL_FILE));
+
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_FILE_NAME), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_SELECT_FILE), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_BROWSE), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_LOG_FILE_FORMAT), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_LOG_FILE_FORMAT), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_LOG_FILE_DESCRIPTION), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_LOG_FILE_CONDITION), bEnable);
}
void update_history_controls(HWND hDlg)
{
- bool bEnable = (1 == ::IsDlgButtonChecked(hDlg,IDC_CHECK_INTERNAL_HISTORY));
+ bool bEnable = (1 == ::IsDlgButtonChecked(hDlg, IDC_CHECK_INTERNAL_HISTORY));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_STATIC_HISTORY_FORMAT),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_EDIT_HISTORY_FORMAT),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_HISTORY_DESCRIPTION),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_CHECK_HISTORY_CONDITION),bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_HISTORY_FORMAT), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_HISTORY_FORMAT), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_HISTORY_DESCRIPTION), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_HISTORY_CONDITION), bEnable);
}
void update_popup_controls(HWND hDlg)
{
- bool bEnable = (1 == ::IsDlgButtonChecked(hDlg,IDC_CHECK_SHOW_POPUP));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_EDIT_POPUP_FORMAT),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_STATIC_POPUP_FORMAT),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_POPUP_FORMAT_DESCRIPTION),bEnable);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_POPUP_SETTINGS),bEnable);
+ bool bEnable = (1 == ::IsDlgButtonChecked(hDlg, IDC_CHECK_SHOW_POPUP));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_POPUP_FORMAT), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_POPUP_FORMAT), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_FORMAT_DESCRIPTION), bEnable);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_SETTINGS), bEnable);
}
bool enable_popup_controls(HWND hDlg)
{
bool bIsPopupServiceEnabled = 1 == ServiceExists(MS_POPUP_ADDPOPUPT);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_CHECK_SHOW_POPUP),bIsPopupServiceEnabled);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_EDIT_POPUP_FORMAT),bIsPopupServiceEnabled);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED),bIsPopupServiceEnabled);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_STATIC_POPUP_FORMAT),bIsPopupServiceEnabled);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_POPUP_FORMAT_DESCRIPTION),bIsPopupServiceEnabled);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_POPUP_SETTINGS),bIsPopupServiceEnabled);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_SHOW_POPUP), bIsPopupServiceEnabled);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_POPUP_FORMAT), bIsPopupServiceEnabled);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED), bIsPopupServiceEnabled);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_POPUP_FORMAT), bIsPopupServiceEnabled);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_FORMAT_DESCRIPTION), bIsPopupServiceEnabled);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_SETTINGS), bIsPopupServiceEnabled);
return bIsPopupServiceEnabled;
}
void update_all_controls(HWND hDlg)
{
- bool bIsCheckedContactSpec = (1 == ::IsDlgButtonChecked(hDlg,IDC_CHECK_CONTACT_SPECIFIC));
- bool bIsCheckedExternal = (1 == ::IsDlgButtonChecked(hDlg,IDC_CHECK_EXTERNAL_FILE));
-
- ::EnableWindow(::GetDlgItem(hDlg,IDC_CHECK_EXTERNAL_FILE),bIsCheckedContactSpec);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_EDIT_FILE_NAME),(bIsCheckedContactSpec&&bIsCheckedExternal));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_STATIC_SELECT_FILE),(bIsCheckedContactSpec&&bIsCheckedExternal));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_BROWSE),(bIsCheckedContactSpec&&bIsCheckedExternal));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_STATIC_LOG_FILE_FORMAT),(bIsCheckedContactSpec&&bIsCheckedExternal));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_EDIT_LOG_FILE_FORMAT),(bIsCheckedContactSpec&&bIsCheckedExternal));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_LOG_FILE_DESCRIPTION),(bIsCheckedContactSpec&&bIsCheckedExternal));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_CHECK_LOG_FILE_CONDITION),(bIsCheckedContactSpec&&bIsCheckedExternal));
-
- bool bIsCheckedHistory = (1 == ::IsDlgButtonChecked(hDlg,IDC_CHECK_INTERNAL_HISTORY));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_CHECK_INTERNAL_HISTORY),bIsCheckedContactSpec);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_STATIC_HISTORY_FORMAT),(bIsCheckedContactSpec&&bIsCheckedHistory));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_EDIT_HISTORY_FORMAT),(bIsCheckedContactSpec&&bIsCheckedHistory));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_HISTORY_DESCRIPTION),(bIsCheckedContactSpec&&bIsCheckedHistory));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_CHECK_HISTORY_CONDITION),(bIsCheckedContactSpec&&bIsCheckedHistory));
+ bool bIsCheckedContactSpec = (1 == ::IsDlgButtonChecked(hDlg, IDC_CHECK_CONTACT_SPECIFIC));
+ bool bIsCheckedExternal = (1 == ::IsDlgButtonChecked(hDlg, IDC_CHECK_EXTERNAL_FILE));
+
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_EXTERNAL_FILE), bIsCheckedContactSpec);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_FILE_NAME), (bIsCheckedContactSpec&&bIsCheckedExternal));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_SELECT_FILE), (bIsCheckedContactSpec&&bIsCheckedExternal));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_BROWSE), (bIsCheckedContactSpec&&bIsCheckedExternal));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_LOG_FILE_FORMAT), (bIsCheckedContactSpec&&bIsCheckedExternal));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_LOG_FILE_FORMAT), (bIsCheckedContactSpec&&bIsCheckedExternal));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_LOG_FILE_DESCRIPTION), (bIsCheckedContactSpec&&bIsCheckedExternal));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_LOG_FILE_CONDITION), (bIsCheckedContactSpec&&bIsCheckedExternal));
+
+ bool bIsCheckedHistory = (1 == ::IsDlgButtonChecked(hDlg, IDC_CHECK_INTERNAL_HISTORY));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_INTERNAL_HISTORY), bIsCheckedContactSpec);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_HISTORY_FORMAT), (bIsCheckedContactSpec&&bIsCheckedHistory));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_HISTORY_FORMAT), (bIsCheckedContactSpec&&bIsCheckedHistory));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_HISTORY_DESCRIPTION), (bIsCheckedContactSpec&&bIsCheckedHistory));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_HISTORY_CONDITION), (bIsCheckedContactSpec&&bIsCheckedHistory));
bool bIsPopupServiceEnabled = 1 == ServiceExists(MS_POPUP_ADDPOPUPT);
- bool bIsCheckedShowPopup = (1 == ::IsDlgButtonChecked(hDlg,IDC_CHECK_SHOW_POPUP));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_CHECK_SHOW_POPUP),(bIsCheckedContactSpec&&bIsPopupServiceEnabled));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_EDIT_POPUP_FORMAT),(bIsCheckedContactSpec&&bIsPopupServiceEnabled&&bIsCheckedShowPopup));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED),(bIsCheckedContactSpec&&bIsPopupServiceEnabled&&bIsCheckedShowPopup));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_STATIC_POPUP_FORMAT),(bIsCheckedContactSpec&&bIsPopupServiceEnabled&&bIsCheckedShowPopup));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_POPUP_FORMAT_DESCRIPTION),(bIsCheckedContactSpec&&bIsPopupServiceEnabled&&bIsCheckedShowPopup));
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BUTTON_POPUP_SETTINGS),(bIsCheckedContactSpec&&bIsPopupServiceEnabled));
+ bool bIsCheckedShowPopup = (1 == ::IsDlgButtonChecked(hDlg, IDC_CHECK_SHOW_POPUP));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_SHOW_POPUP), (bIsCheckedContactSpec&&bIsPopupServiceEnabled));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_POPUP_FORMAT), (bIsCheckedContactSpec&&bIsPopupServiceEnabled&&bIsCheckedShowPopup));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED), (bIsCheckedContactSpec&&bIsPopupServiceEnabled&&bIsCheckedShowPopup));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_POPUP_FORMAT), (bIsCheckedContactSpec&&bIsPopupServiceEnabled&&bIsCheckedShowPopup));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_FORMAT_DESCRIPTION), (bIsCheckedContactSpec&&bIsPopupServiceEnabled&&bIsCheckedShowPopup));
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_SETTINGS), (bIsCheckedContactSpec&&bIsPopupServiceEnabled));
}
std::vector<TCHAR> get_filter()
{
std::vector<TCHAR> aFilter;
- LPCTSTR pszFilterParts[] = {LPGENT("Log Files (*.txt,*.log)"), _T("*.txt;*.log"), LPGENT("All files (*.*)"), _T("*.*")};
- for(int i = 0;i < sizeof(pszFilterParts)/sizeof(pszFilterParts[0]);++i)
+ LPCTSTR pszFilterParts[] = { LPGENT("Log Files (*.txt,*.log)"), _T("*.txt;*.log"), LPGENT("All files (*.*)"), _T("*.*") };
+ for (int i = 0; i < sizeof(pszFilterParts) / sizeof(pszFilterParts[0]); ++i)
{
tstring sPart = TranslateTS(pszFilterParts[i]);
- std::copy(sPart.begin(),sPart.end(),std::back_inserter(aFilter));
+ std::copy(sPart.begin(), sPart.end(), std::back_inserter(aFilter));
aFilter.push_back(_T('\0'));
}
@@ -100,13 +100,13 @@ namespace }
void select_log_file(HWND hDlg)
{
- std::vector<TCHAR> aFileBuffer(_MAX_PATH*2,_T('\0'));
+ std::vector<TCHAR> aFileBuffer(_MAX_PATH * 2, _T('\0'));
LPTSTR pszFile = &*aFileBuffer.begin();
std::vector<TCHAR> aFilterBuffer = get_filter();
LPCTSTR pszFilter = &*aFilterBuffer.begin();
- OPENFILENAME ofn = {0};
+ OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hDlg;
ofn.lpstrFile = pszFile;
@@ -115,19 +115,19 @@ namespace ofn.nFilterIndex = 1;
ofn.hInstance = g_hInstance;
ofn.lpstrDefExt = _T("log");
- ofn.Flags = OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_EXPLORER;
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER;
BOOL b = GetOpenFileName(&ofn);
- if(TRUE == b)
+ if (TRUE == b)
{
- SetDlgItemText(hDlg,IDC_EDIT_FILE_NAME,ofn.lpstrFile);
+ SetDlgItemText(hDlg, IDC_EDIT_FILE_NAME, ofn.lpstrFile);
}
}
struct CSettingWindowParam
{
- CSettingWindowParam(MCONTACT hContact) : m_hContact(hContact),m_pPopupSettings(NULL){}
- ~CSettingWindowParam(){delete m_pPopupSettings;}
+ CSettingWindowParam(MCONTACT hContact) : m_hContact(hContact), m_pPopupSettings(NULL){}
+ ~CSettingWindowParam(){ delete m_pPopupSettings; }
MCONTACT m_hContact;
CPopupSettings* m_pPopupSettings;
@@ -135,60 +135,60 @@ namespace inline CSettingWindowParam* get_param(HWND hWnd)
{
- return reinterpret_cast<CSettingWindowParam*>(GetWindowLongPtr(hWnd,GWLP_USERDATA));
+ return reinterpret_cast<CSettingWindowParam*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
}
void update_popup_controls_settings(HWND hDlg)
{
- bool bIsColoursEnabled = 1 == IsDlgButtonChecked(hDlg,IDC_RADIO_USER_DEFINED_COLOURS);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_BGCOLOR),bIsColoursEnabled);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_TEXTCOLOR),bIsColoursEnabled);
+ bool bIsColoursEnabled = 1 == IsDlgButtonChecked(hDlg, IDC_RADIO_USER_DEFINED_COLOURS);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_BGCOLOR), bIsColoursEnabled);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_TEXTCOLOR), bIsColoursEnabled);
- bool bIsDelayEnabled = 1 == IsDlgButtonChecked(hDlg,IDC_DELAYCUSTOM);
- ::EnableWindow(::GetDlgItem(hDlg,IDC_DELAY),bIsDelayEnabled);
+ bool bIsDelayEnabled = 1 == IsDlgButtonChecked(hDlg, IDC_DELAYCUSTOM);
+ ::EnableWindow(::GetDlgItem(hDlg, IDC_DELAY), bIsDelayEnabled);
}
- INT_PTR CALLBACK EditPopupSettingsDlgProc(HWND hWnd,UINT msg,WPARAM wp,LPARAM lp)
+ INT_PTR CALLBACK EditPopupSettingsDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
- switch(msg)
+ switch (msg)
{
case WM_INITDIALOG:
- {
- CPopupSettings* pSettings = reinterpret_cast<CPopupSettings*>(lp);
- TranslateDialogDefault( hWnd );
- ::SendDlgItemMessage(hWnd,IDC_BGCOLOR,CPM_SETCOLOUR,0,pSettings->GetColourBk());
- ::SendDlgItemMessage(hWnd,IDC_TEXTCOLOR,CPM_SETCOLOUR,0,pSettings->GetColourText());
+ {
+ CPopupSettings* pSettings = reinterpret_cast<CPopupSettings*>(lp);
+ TranslateDialogDefault(hWnd);
+ ::SendDlgItemMessage(hWnd, IDC_BGCOLOR, CPM_SETCOLOUR, 0, pSettings->GetColourBk());
+ ::SendDlgItemMessage(hWnd, IDC_TEXTCOLOR, CPM_SETCOLOUR, 0, pSettings->GetColourText());
- ::CheckDlgButton(hWnd, IDC_CHECK_DONT_USE_POPUPHISTORY, pSettings->GetHistoryFlag() ? BST_CHECKED : BST_UNCHECKED);
+ ::CheckDlgButton(hWnd, IDC_CHECK_DONT_USE_POPUPHISTORY, pSettings->GetHistoryFlag() ? BST_CHECKED : BST_UNCHECKED);
- ::CheckRadioButton(hWnd,IDC_RADIO_DEFAULT_COLOURS,IDC_RADIO_USER_DEFINED_COLOURS,(CPopupSettings::colourDefault == pSettings->GetColourMode()) ? IDC_RADIO_DEFAULT_COLOURS : IDC_RADIO_USER_DEFINED_COLOURS);
- UINT n;
- switch(pSettings->GetDelayMode())
- {
- default:
- assert(!"Unknown delay mode. Please, fix it");
- case CPopupSettings::delayFromPopup:
- n = IDC_DELAYFROMPU;
- break;
- case CPopupSettings::delayCustom:
- n = IDC_DELAYCUSTOM;
- break;
- case CPopupSettings::delayPermanent:
- n = IDC_DELAYPERMANENT;
- break;
- }
- ::CheckRadioButton(hWnd,IDC_DELAYFROMPU,IDC_DELAYPERMANENT,n);
+ ::CheckRadioButton(hWnd, IDC_RADIO_DEFAULT_COLOURS, IDC_RADIO_USER_DEFINED_COLOURS, (CPopupSettings::colourDefault == pSettings->GetColourMode()) ? IDC_RADIO_DEFAULT_COLOURS : IDC_RADIO_USER_DEFINED_COLOURS);
+ UINT n;
+ switch (pSettings->GetDelayMode())
+ {
+ default:
+ assert(!"Unknown delay mode. Please, fix it");
+ case CPopupSettings::delayFromPopup:
+ n = IDC_DELAYFROMPU;
+ break;
+ case CPopupSettings::delayCustom:
+ n = IDC_DELAYCUSTOM;
+ break;
+ case CPopupSettings::delayPermanent:
+ n = IDC_DELAYPERMANENT;
+ break;
+ }
+ ::CheckRadioButton(hWnd, IDC_DELAYFROMPU, IDC_DELAYPERMANENT, n);
- ::SetDlgItemInt(hWnd,IDC_DELAY,pSettings->GetDelayTimeout(),FALSE);
+ ::SetDlgItemInt(hWnd, IDC_DELAY, pSettings->GetDelayTimeout(), FALSE);
- update_popup_controls_settings(hWnd);
+ update_popup_controls_settings(hWnd);
- ::SetWindowLongPtr(hWnd,GWLP_USERDATA,reinterpret_cast<LONG_PTR>(pSettings));
- }
- return TRUE;
+ ::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(pSettings));
+ }
+ return TRUE;
case WM_COMMAND:
- switch(LOWORD(wp))
+ switch (LOWORD(wp))
{
case IDC_RADIO_DEFAULT_COLOURS:
case IDC_RADIO_USER_DEFINED_COLOURS:
@@ -199,62 +199,62 @@ namespace break;
case IDCANCEL:
- ::EndDialog(hWnd,IDCANCEL);
+ ::EndDialog(hWnd, IDCANCEL);
break;
case IDOK:
- {
- CPopupSettings* pSettings = reinterpret_cast<CPopupSettings*>(GetWindowLongPtr(hWnd,GWLP_USERDATA));
+ {
+ CPopupSettings* pSettings = reinterpret_cast<CPopupSettings*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
- bool bError = false;
- BOOL bOk = FALSE;
- UINT nDelay = ::GetDlgItemInt(hWnd,IDC_DELAY,&bOk,FALSE);
- CPopupSettings::EDelayMode nModeDelay = pSettings->GetDelayMode();
- if(1 == ::IsDlgButtonChecked(hWnd,IDC_DELAYFROMPU))
+ bool bError = false;
+ BOOL bOk = FALSE;
+ UINT nDelay = ::GetDlgItemInt(hWnd, IDC_DELAY, &bOk, FALSE);
+ CPopupSettings::EDelayMode nModeDelay = pSettings->GetDelayMode();
+ if (1 == ::IsDlgButtonChecked(hWnd, IDC_DELAYFROMPU))
+ {
+ nModeDelay = CPopupSettings::delayFromPopup;
+ }
+ else if (1 == ::IsDlgButtonChecked(hWnd, IDC_DELAYCUSTOM))
+ {
+ if (TRUE == bOk)
+ {
+ nModeDelay = CPopupSettings::delayCustom;
+ }
+ else
{
- nModeDelay = CPopupSettings::delayFromPopup;
+ prepare_edit_ctrl_for_error(::GetDlgItem(hWnd, IDC_DELAY));
+ Quotes_MessageBox(hWnd, TranslateT("Enter integer value"), MB_OK | MB_ICONERROR);
+ bError = true;
}
- else if(1 == ::IsDlgButtonChecked(hWnd,IDC_DELAYCUSTOM))
+ }
+ else if (1 == ::IsDlgButtonChecked(hWnd, IDC_DELAYPERMANENT))
+ {
+ nModeDelay = CPopupSettings::delayPermanent;
+ }
+ if (false == bError)
+ {
+ pSettings->SetDelayMode(nModeDelay);
+ if (TRUE == bOk)
{
- if(TRUE == bOk)
- {
- nModeDelay = CPopupSettings::delayCustom;
- }
- else
- {
- prepare_edit_ctrl_for_error(::GetDlgItem(hWnd,IDC_DELAY));
- Quotes_MessageBox(hWnd,TranslateT("Enter integer value"),MB_OK|MB_ICONERROR);
- bError = true;
- }
+ pSettings->SetDelayTimeout(nDelay);
}
- else if(1 == ::IsDlgButtonChecked(hWnd,IDC_DELAYPERMANENT))
+ pSettings->SetHistoryFlag((1 == IsDlgButtonChecked(hWnd, IDC_CHECK_DONT_USE_POPUPHISTORY)));
+
+ if (1 == ::IsDlgButtonChecked(hWnd, IDC_RADIO_DEFAULT_COLOURS))
{
- nModeDelay = CPopupSettings::delayPermanent;
+ pSettings->SetColourMode(CPopupSettings::colourDefault);
}
- if(false == bError)
+ else if (1 == ::IsDlgButtonChecked(hWnd, IDC_RADIO_USER_DEFINED_COLOURS))
{
- pSettings->SetDelayMode(nModeDelay);
- if(TRUE == bOk)
- {
- pSettings->SetDelayTimeout(nDelay);
- }
- pSettings->SetHistoryFlag((1 == IsDlgButtonChecked(hWnd,IDC_CHECK_DONT_USE_POPUPHISTORY)));
-
- if(1 == ::IsDlgButtonChecked(hWnd,IDC_RADIO_DEFAULT_COLOURS))
- {
- pSettings->SetColourMode(CPopupSettings::colourDefault);
- }
- else if(1 == ::IsDlgButtonChecked(hWnd,IDC_RADIO_USER_DEFINED_COLOURS))
- {
- pSettings->SetColourMode(CPopupSettings::colourUserDefined);
- }
-
- pSettings->SetColourBk(static_cast<COLORREF>(::SendDlgItemMessage(hWnd,IDC_BGCOLOR,CPM_GETCOLOUR,0,0)));
- pSettings->SetColourText(static_cast<COLORREF>(::SendDlgItemMessage(hWnd,IDC_TEXTCOLOR,CPM_GETCOLOUR,0,0)));
-
- ::EndDialog(hWnd,IDOK);
+ pSettings->SetColourMode(CPopupSettings::colourUserDefined);
}
+
+ pSettings->SetColourBk(static_cast<COLORREF>(::SendDlgItemMessage(hWnd, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0)));
+ pSettings->SetColourText(static_cast<COLORREF>(::SendDlgItemMessage(hWnd, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, 0)));
+
+ ::EndDialog(hWnd, IDOK);
}
- break;
+ }
+ break;
}
break;
}
@@ -262,117 +262,117 @@ namespace return FALSE;
}
- INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd,UINT msg,WPARAM wp,LPARAM lp)
+ INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
- switch(msg)
+ switch (msg)
{
case WM_INITDIALOG:
- {
- MCONTACT hContact = MCONTACT(lp);
- TranslateDialogDefault(hWnd);
+ {
+ MCONTACT hContact = MCONTACT(lp);
+ TranslateDialogDefault(hWnd);
- HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_SETTINGS,false);
- assert(hWL);
- WindowList_Add(hWL,hWnd,hContact);
+ HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_SETTINGS, false);
+ assert(hWL);
+ WindowList_Add(hWL, hWnd, hContact);
- tstring sName = GetContactName(hContact);
- ::SetDlgItemText(hWnd,IDC_EDIT_NAME,sName.c_str());
+ tstring sName = GetContactName(hContact);
+ ::SetDlgItemText(hWnd, IDC_EDIT_NAME, sName.c_str());
- CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact);
+ CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact);
- BYTE bUseContactSpecific = db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,0);
- ::CheckDlgButton(hWnd, IDC_CHECK_CONTACT_SPECIFIC, bUseContactSpecific ? BST_CHECKED : BST_UNCHECKED);
+ BYTE bUseContactSpecific = db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_CONTACT_SPEC_SETTINGS, 0);
+ ::CheckDlgButton(hWnd, IDC_CHECK_CONTACT_SPECIFIC, bUseContactSpecific ? BST_CHECKED : BST_UNCHECKED);
- CAdvProviderSettings setGlobal(pProvider.get());
- // log to history
- WORD dwLogMode = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG,setGlobal.GetLogMode());
- UINT nCheck = (dwLogMode&lmInternalHistory) ? 1 : 0;
- ::CheckDlgButton(hWnd, IDC_CHECK_INTERNAL_HISTORY, nCheck ? BST_CHECKED : BST_UNCHECKED);
+ CAdvProviderSettings setGlobal(pProvider.get());
+ // log to history
+ WORD dwLogMode = db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG, setGlobal.GetLogMode());
+ UINT nCheck = (dwLogMode&lmInternalHistory) ? 1 : 0;
+ ::CheckDlgButton(hWnd, IDC_CHECK_INTERNAL_HISTORY, nCheck ? BST_CHECKED : BST_UNCHECKED);
- tstring sHistoryFrmt = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_HISTORY,setGlobal.GetHistoryFormat().c_str());
- ::SetDlgItemText(hWnd,IDC_EDIT_HISTORY_FORMAT,sHistoryFrmt.c_str());
+ tstring sHistoryFrmt = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_HISTORY, setGlobal.GetHistoryFormat().c_str());
+ ::SetDlgItemText(hWnd, IDC_EDIT_HISTORY_FORMAT, sHistoryFrmt.c_str());
- WORD wOnlyIfChanged = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_HISTORY_CONDITION,setGlobal.GetHistoryOnlyChangedFlag());
- ::CheckDlgButton(hWnd, IDC_CHECK_HISTORY_CONDITION, (1 == wOnlyIfChanged) ? BST_CHECKED : BST_UNCHECKED);
+ WORD wOnlyIfChanged = db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_HISTORY_CONDITION, setGlobal.GetHistoryOnlyChangedFlag());
+ ::CheckDlgButton(hWnd, IDC_CHECK_HISTORY_CONDITION, (1 == wOnlyIfChanged) ? BST_CHECKED : BST_UNCHECKED);
- // log to file
- nCheck = (dwLogMode&lmExternalFile) ? 1 : 0;
- ::CheckDlgButton(hWnd, IDC_CHECK_EXTERNAL_FILE, nCheck ? BST_CHECKED : BST_UNCHECKED);
+ // log to file
+ nCheck = (dwLogMode&lmExternalFile) ? 1 : 0;
+ ::CheckDlgButton(hWnd, IDC_CHECK_EXTERNAL_FILE, nCheck ? BST_CHECKED : BST_UNCHECKED);
- tstring sLogFileName = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE);
- if(true == sLogFileName.empty())
- {
- sLogFileName = GenerateLogFileName(setGlobal.GetLogFileName(),Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_SYMBOL),glfnResolveQuoteName);
- }
- ::SetDlgItemText(hWnd,IDC_EDIT_FILE_NAME,sLogFileName.c_str());
+ tstring sLogFileName = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE);
+ if (true == sLogFileName.empty())
+ {
+ sLogFileName = GenerateLogFileName(setGlobal.GetLogFileName(), Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL), glfnResolveQuoteName);
+ }
+ ::SetDlgItemText(hWnd, IDC_EDIT_FILE_NAME, sLogFileName.c_str());
- tstring sLogFileFrmt = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_LOG_FILE,setGlobal.GetLogFormat().c_str());
- ::SetDlgItemText(hWnd,IDC_EDIT_LOG_FILE_FORMAT,sLogFileFrmt.c_str());
+ tstring sLogFileFrmt = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_LOG_FILE, setGlobal.GetLogFormat().c_str());
+ ::SetDlgItemText(hWnd, IDC_EDIT_LOG_FILE_FORMAT, sLogFileFrmt.c_str());
- wOnlyIfChanged = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE_CONDITION,setGlobal.GetLogOnlyChangedFlag());
- ::CheckDlgButton(hWnd, IDC_CHECK_LOG_FILE_CONDITION, (1 == wOnlyIfChanged) ? BST_CHECKED : BST_UNCHECKED);
+ wOnlyIfChanged = db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE_CONDITION, setGlobal.GetLogOnlyChangedFlag());
+ ::CheckDlgButton(hWnd, IDC_CHECK_LOG_FILE_CONDITION, (1 == wOnlyIfChanged) ? BST_CHECKED : BST_UNCHECKED);
- // popup
- nCheck = (dwLogMode&lmPopup) ? 1 : 0;
- ::CheckDlgButton(hWnd, IDC_CHECK_SHOW_POPUP, nCheck ? BST_CHECKED : BST_UNCHECKED);
- tstring sPopupFrmt = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_POPUP,setGlobal.GetPopupFormat().c_str());
- ::SetDlgItemText(hWnd,IDC_EDIT_POPUP_FORMAT,sPopupFrmt.c_str());
- bool bOnlyIfChanged = 1 == db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_CONDITION,setGlobal.GetShowPopupIfValueChangedFlag());
- ::CheckDlgButton(hWnd, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED, (bOnlyIfChanged) ? BST_CHECKED : BST_UNCHECKED);
+ // popup
+ nCheck = (dwLogMode&lmPopup) ? 1 : 0;
+ ::CheckDlgButton(hWnd, IDC_CHECK_SHOW_POPUP, nCheck ? BST_CHECKED : BST_UNCHECKED);
+ tstring sPopupFrmt = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_POPUP, setGlobal.GetPopupFormat().c_str());
+ ::SetDlgItemText(hWnd, IDC_EDIT_POPUP_FORMAT, sPopupFrmt.c_str());
+ bool bOnlyIfChanged = 1 == db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_CONDITION, setGlobal.GetShowPopupIfValueChangedFlag());
+ ::CheckDlgButton(hWnd, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED, (bOnlyIfChanged) ? BST_CHECKED : BST_UNCHECKED);
- update_all_controls(hWnd);
+ update_all_controls(hWnd);
- CSettingWindowParam* pParam = new CSettingWindowParam(hContact);
- ::SetWindowLongPtr(hWnd,GWLP_USERDATA,reinterpret_cast<LONG_PTR>(pParam));
- Utils_RestoreWindowPositionNoSize(hWnd,hContact,QUOTES_MODULE_NAME,WINDOW_PREFIX_SETTINGS);
- ::ShowWindow(hWnd,SW_SHOW);
- }
- break;
+ CSettingWindowParam* pParam = new CSettingWindowParam(hContact);
+ ::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(pParam));
+ Utils_RestoreWindowPositionNoSize(hWnd, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_SETTINGS);
+ ::ShowWindow(hWnd, SW_SHOW);
+ }
+ break;
case WM_COMMAND:
- switch(LOWORD(wp))
+ switch (LOWORD(wp))
{
case IDC_BUTTON_HISTORY_DESCRIPTION:
case IDC_BUTTON_LOG_FILE_DESCRIPTION:
case IDC_BUTTON_POPUP_FORMAT_DESCRIPTION:
- if(BN_CLICKED == HIWORD(wp))
+ if (BN_CLICKED == HIWORD(wp))
{
CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(get_param(hWnd)->m_hContact);
- show_variable_list(hWnd,pProvider.get());
+ show_variable_list(hWnd, pProvider.get());
}
break;
case IDC_CHECK_CONTACT_SPECIFIC:
- if(BN_CLICKED == HIWORD(wp))
+ if (BN_CLICKED == HIWORD(wp))
{
update_all_controls(hWnd);
}
break;
case IDC_CHECK_EXTERNAL_FILE:
- if(BN_CLICKED == HIWORD(wp))
+ if (BN_CLICKED == HIWORD(wp))
{
update_file_controls(hWnd);
}
break;
case IDC_CHECK_INTERNAL_HISTORY:
- if(BN_CLICKED == HIWORD(wp))
+ if (BN_CLICKED == HIWORD(wp))
{
update_history_controls(hWnd);
}
break;
case IDC_CHECK_SHOW_POPUP:
- if(BN_CLICKED == HIWORD(wp))
+ if (BN_CLICKED == HIWORD(wp))
{
update_popup_controls(hWnd);
}
break;
case IDC_BUTTON_BROWSE:
- if(BN_CLICKED == HIWORD(wp))
+ if (BN_CLICKED == HIWORD(wp))
{
select_log_file(hWnd);
}
break;
case IDC_BUTTON_POPUP_SETTINGS:
- if(BN_CLICKED == HIWORD(wp))
+ if (BN_CLICKED == HIWORD(wp))
{
CSettingWindowParam* pParam = get_param(hWnd);
if (!pParam->m_pPopupSettings)
@@ -386,100 +386,100 @@ namespace DialogBoxParam(g_hInstance,
MAKEINTRESOURCE(IDD_DIALOG_POPUP),
hWnd,
- EditPopupSettingsDlgProc,reinterpret_cast<LPARAM>(pParam->m_pPopupSettings));
+ EditPopupSettingsDlgProc, reinterpret_cast<LPARAM>(pParam->m_pPopupSettings));
}
break;
case IDOK:
- {
- CSettingWindowParam* pParam = get_param(hWnd);
- MCONTACT hContact = pParam->m_hContact;
-
- bool bUseContactSpec = 1 == ::IsDlgButtonChecked(hWnd,IDC_CHECK_CONTACT_SPECIFIC);
+ {
+ CSettingWindowParam* pParam = get_param(hWnd);
+ MCONTACT hContact = pParam->m_hContact;
- WORD nLogMode = lmDisabled;
- UINT nCheck = ::IsDlgButtonChecked(hWnd,IDC_CHECK_EXTERNAL_FILE);
- if(1 == nCheck)
- {
- nLogMode |= lmExternalFile;
- }
+ bool bUseContactSpec = 1 == ::IsDlgButtonChecked(hWnd, IDC_CHECK_CONTACT_SPECIFIC);
- nCheck = ::IsDlgButtonChecked(hWnd,IDC_CHECK_INTERNAL_HISTORY);
- if(1 == nCheck)
- {
- nLogMode |= lmInternalHistory;
- }
+ WORD nLogMode = lmDisabled;
+ UINT nCheck = ::IsDlgButtonChecked(hWnd, IDC_CHECK_EXTERNAL_FILE);
+ if (1 == nCheck)
+ {
+ nLogMode |= lmExternalFile;
+ }
- nCheck = ::IsDlgButtonChecked(hWnd,IDC_CHECK_SHOW_POPUP);
- if(1 == nCheck)
- {
- nLogMode |= lmPopup;
- }
+ nCheck = ::IsDlgButtonChecked(hWnd, IDC_CHECK_INTERNAL_HISTORY);
+ if (1 == nCheck)
+ {
+ nLogMode |= lmInternalHistory;
+ }
- bool bOk = true;
- HWND hwndLogFile = ::GetDlgItem(hWnd,IDC_EDIT_FILE_NAME);
- HWND hwndLogFileFrmt = ::GetDlgItem(hWnd,IDC_EDIT_LOG_FILE_FORMAT);
- HWND hwndHistoryFrmt = ::GetDlgItem(hWnd,IDC_EDIT_HISTORY_FORMAT);
- tstring sLogFile = get_window_text(hwndLogFile);
- tstring sLogFileFormat = get_window_text(hwndLogFileFrmt);
- tstring sHistoryFormat = get_window_text(hwndHistoryFrmt);
- if ((nLogMode&lmExternalFile))
- {
- if(true == sLogFile.empty())
- {
- prepare_edit_ctrl_for_error(hwndLogFile);
- Quotes_MessageBox(hWnd,TranslateT("Enter log file name."),MB_OK|MB_ICONERROR);
- bOk = false;
- }
- else if(true == sLogFileFormat.empty())
- {
- prepare_edit_ctrl_for_error(hwndLogFileFrmt);
- Quotes_MessageBox(hWnd,TranslateT("Enter log file format."),MB_OK|MB_ICONERROR);
- bOk = false;
- }
- }
+ nCheck = ::IsDlgButtonChecked(hWnd, IDC_CHECK_SHOW_POPUP);
+ if (1 == nCheck)
+ {
+ nLogMode |= lmPopup;
+ }
- if ((true == bOk) && (nLogMode&lmInternalHistory) && (true == sHistoryFormat.empty()))
+ bool bOk = true;
+ HWND hwndLogFile = ::GetDlgItem(hWnd, IDC_EDIT_FILE_NAME);
+ HWND hwndLogFileFrmt = ::GetDlgItem(hWnd, IDC_EDIT_LOG_FILE_FORMAT);
+ HWND hwndHistoryFrmt = ::GetDlgItem(hWnd, IDC_EDIT_HISTORY_FORMAT);
+ tstring sLogFile = get_window_text(hwndLogFile);
+ tstring sLogFileFormat = get_window_text(hwndLogFileFrmt);
+ tstring sHistoryFormat = get_window_text(hwndHistoryFrmt);
+ if ((nLogMode&lmExternalFile))
+ {
+ if (true == sLogFile.empty())
{
- prepare_edit_ctrl_for_error(hwndHistoryFrmt);
- Quotes_MessageBox(hWnd,TranslateT("Enter history format."),MB_OK|MB_ICONERROR);
+ prepare_edit_ctrl_for_error(hwndLogFile);
+ Quotes_MessageBox(hWnd, TranslateT("Enter log file name."), MB_OK | MB_ICONERROR);
bOk = false;
}
-
- HWND hwndPopupFrmt = ::GetDlgItem(hWnd,IDC_EDIT_POPUP_FORMAT);
- tstring sPopupFormat = get_window_text(hwndPopupFrmt);
- if ((true == bOk) && (nLogMode&lmPopup) && (true == sPopupFormat.empty()))
+ else if (true == sLogFileFormat.empty())
{
- prepare_edit_ctrl_for_error(hwndPopupFrmt);
- Quotes_MessageBox(hWnd,TranslateT("Enter popup window format."),MB_OK|MB_ICONERROR);
+ prepare_edit_ctrl_for_error(hwndLogFileFrmt);
+ Quotes_MessageBox(hWnd, TranslateT("Enter log file format."), MB_OK | MB_ICONERROR);
bOk = false;
}
+ }
+
+ if ((true == bOk) && (nLogMode&lmInternalHistory) && (true == sHistoryFormat.empty()))
+ {
+ prepare_edit_ctrl_for_error(hwndHistoryFrmt);
+ Quotes_MessageBox(hWnd, TranslateT("Enter history format."), MB_OK | MB_ICONERROR);
+ bOk = false;
+ }
- if(true == bOk)
+ HWND hwndPopupFrmt = ::GetDlgItem(hWnd, IDC_EDIT_POPUP_FORMAT);
+ tstring sPopupFormat = get_window_text(hwndPopupFrmt);
+ if ((true == bOk) && (nLogMode&lmPopup) && (true == sPopupFormat.empty()))
+ {
+ prepare_edit_ctrl_for_error(hwndPopupFrmt);
+ Quotes_MessageBox(hWnd, TranslateT("Enter popup window format."), MB_OK | MB_ICONERROR);
+ bOk = false;
+ }
+
+ if (true == bOk)
+ {
+ UINT nIfChangedHistory = IsDlgButtonChecked(hWnd, IDC_CHECK_HISTORY_CONDITION);
+ UINT nIfChangedFile = IsDlgButtonChecked(hWnd, IDC_CHECK_LOG_FILE_CONDITION);
+ bool bIfChangedPopup = (1 == IsDlgButtonChecked(hWnd, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED));
+
+ db_set_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_CONTACT_SPEC_SETTINGS, bUseContactSpec);
+ db_set_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG, nLogMode);
+ db_set_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE_CONDITION, nIfChangedFile);
+ db_set_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_HISTORY_CONDITION, nIfChangedHistory);
+ db_set_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_CONDITION, bIfChangedPopup);
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE, sLogFile.c_str());
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_LOG_FILE, sLogFileFormat.c_str());
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_HISTORY, sHistoryFormat.c_str());
+ db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_POPUP, sPopupFormat.c_str());
+
+ if (pParam->m_pPopupSettings)
{
- UINT nIfChangedHistory = IsDlgButtonChecked(hWnd,IDC_CHECK_HISTORY_CONDITION);
- UINT nIfChangedFile = IsDlgButtonChecked(hWnd,IDC_CHECK_LOG_FILE_CONDITION);
- bool bIfChangedPopup = (1 == IsDlgButtonChecked(hWnd,IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED));
-
- db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,bUseContactSpec);
- db_set_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG,nLogMode);
- db_set_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE_CONDITION,nIfChangedFile);
- db_set_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_HISTORY_CONDITION,nIfChangedHistory);
- db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_CONDITION,bIfChangedPopup);
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE,sLogFile.c_str());
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_LOG_FILE,sLogFileFormat.c_str());
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_HISTORY,sHistoryFormat.c_str());
- db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_FORMAT_POPUP,sPopupFormat.c_str());
-
- if(pParam->m_pPopupSettings)
- {
- pParam->m_pPopupSettings->SaveForContact(hContact);
- }
-
- ::DestroyWindow(hWnd);
+ pParam->m_pPopupSettings->SaveForContact(hContact);
}
+
+ ::DestroyWindow(hWnd);
}
- break;
+ }
+ break;
case IDCANCEL:
DestroyWindow(hWnd);
break;
@@ -489,17 +489,17 @@ namespace DestroyWindow(hWnd);
break;
case WM_DESTROY:
- {
- CSettingWindowParam* pParam = get_param(hWnd);
- SetWindowLongPtr(hWnd,GWLP_USERDATA,0);
-
- HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_SETTINGS,false);
- assert(hWL);
- WindowList_Remove(hWL,hWnd);
- Utils_SaveWindowPosition(hWnd,pParam->m_hContact,QUOTES_MODULE_NAME,WINDOW_PREFIX_SETTINGS);
- delete pParam;
- }
- break;
+ {
+ CSettingWindowParam* pParam = get_param(hWnd);
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, 0);
+
+ HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_SETTINGS, false);
+ assert(hWL);
+ WindowList_Remove(hWL, hWnd);
+ Utils_SaveWindowPosition(hWnd, pParam->m_hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_SETTINGS);
+ delete pParam;
+ }
+ break;
}
return FALSE;
@@ -509,17 +509,17 @@ namespace void ShowSettingsDlg(MCONTACT hContact)
{
- HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_SETTINGS,true);
+ HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_SETTINGS, true);
assert(hWL);
- HWND hWnd = WindowList_Find(hWL,hContact);
- if(NULL != hWnd)
+ HWND hWnd = WindowList_Find(hWL, hContact);
+ if (NULL != hWnd)
{
SetForegroundWindow(hWnd);
SetFocus(hWnd);
}
else
{
- CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_CONTACT_SETTINGS),NULL,EditSettingsPerContactDlgProc, LPARAM(hContact));
+ CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONTACT_SETTINGS), NULL, EditSettingsPerContactDlgProc, LPARAM(hContact));
}
}
@@ -527,176 +527,176 @@ void ShowSettingsDlg(MCONTACT hContact) namespace
{
- INT_PTR CALLBACK EditSettingsPerProviderDlgProc(HWND hWnd,UINT msg,WPARAM wp,LPARAM lp)
+ INT_PTR CALLBACK EditSettingsPerProviderDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
- switch(msg)
+ switch (msg)
{
case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hWnd);
+ CAdvProviderSettings* pAdvSettings = reinterpret_cast<CAdvProviderSettings*>(lp);
+
+ ::SetDlgItemText(hWnd, IDC_EDIT_NAME, pAdvSettings->GetProviderPtr()->GetInfo().m_sName.c_str());
+
+ // log to history
+ WORD dwLogMode = pAdvSettings->GetLogMode();
+ UINT nCheck = (dwLogMode&lmInternalHistory) ? 1 : 0;
+ ::CheckDlgButton(hWnd, IDC_CHECK_INTERNAL_HISTORY, nCheck ? BST_CHECKED : BST_UNCHECKED);
+ ::SetDlgItemText(hWnd, IDC_EDIT_HISTORY_FORMAT, pAdvSettings->GetHistoryFormat().c_str());
+ ::CheckDlgButton(hWnd, IDC_CHECK_HISTORY_CONDITION, (pAdvSettings->GetHistoryOnlyChangedFlag()) ? BST_CHECKED : BST_UNCHECKED);
+
+ // log to file
+ nCheck = (dwLogMode&lmExternalFile) ? 1 : 0;
+ ::CheckDlgButton(hWnd, IDC_CHECK_EXTERNAL_FILE, nCheck ? BST_CHECKED : BST_UNCHECKED);
+ ::SetDlgItemText(hWnd, IDC_EDIT_FILE_NAME, pAdvSettings->GetLogFileName().c_str());
+ ::SetDlgItemText(hWnd, IDC_EDIT_LOG_FILE_FORMAT, pAdvSettings->GetLogFormat().c_str());
+ ::CheckDlgButton(hWnd, IDC_CHECK_LOG_FILE_CONDITION, (pAdvSettings->GetLogOnlyChangedFlag()) ? BST_CHECKED : BST_UNCHECKED);
+
+ update_file_controls(hWnd);
+ update_history_controls(hWnd);
+
+ // popup
+ nCheck = (dwLogMode&lmPopup) ? 1 : 0;
+ ::CheckDlgButton(hWnd, IDC_CHECK_SHOW_POPUP, nCheck ? BST_CHECKED : BST_UNCHECKED);
+ ::SetDlgItemText(hWnd, IDC_EDIT_POPUP_FORMAT, pAdvSettings->GetPopupFormat().c_str());
+ ::CheckDlgButton(hWnd, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED, (pAdvSettings->GetShowPopupIfValueChangedFlag()) ? BST_CHECKED : BST_UNCHECKED);
+
+ if (true == enable_popup_controls(hWnd))
{
- TranslateDialogDefault(hWnd);
- CAdvProviderSettings* pAdvSettings = reinterpret_cast<CAdvProviderSettings*>(lp);
-
- ::SetDlgItemText(hWnd,IDC_EDIT_NAME,pAdvSettings->GetProviderPtr()->GetInfo().m_sName.c_str());
-
- // log to history
- WORD dwLogMode = pAdvSettings->GetLogMode();
- UINT nCheck = (dwLogMode&lmInternalHistory) ? 1 : 0;
- ::CheckDlgButton(hWnd, IDC_CHECK_INTERNAL_HISTORY, nCheck ? BST_CHECKED : BST_UNCHECKED);
- ::SetDlgItemText(hWnd,IDC_EDIT_HISTORY_FORMAT,pAdvSettings->GetHistoryFormat().c_str());
- ::CheckDlgButton(hWnd, IDC_CHECK_HISTORY_CONDITION, (pAdvSettings->GetHistoryOnlyChangedFlag()) ? BST_CHECKED : BST_UNCHECKED);
-
- // log to file
- nCheck = (dwLogMode&lmExternalFile) ? 1 : 0;
- ::CheckDlgButton(hWnd, IDC_CHECK_EXTERNAL_FILE, nCheck ? BST_CHECKED : BST_UNCHECKED);
- ::SetDlgItemText(hWnd,IDC_EDIT_FILE_NAME,pAdvSettings->GetLogFileName().c_str());
- ::SetDlgItemText(hWnd,IDC_EDIT_LOG_FILE_FORMAT,pAdvSettings->GetLogFormat().c_str());
- ::CheckDlgButton(hWnd, IDC_CHECK_LOG_FILE_CONDITION, (pAdvSettings->GetLogOnlyChangedFlag()) ? BST_CHECKED : BST_UNCHECKED);
-
- update_file_controls(hWnd);
- update_history_controls(hWnd);
-
- // popup
- nCheck = (dwLogMode&lmPopup) ? 1 : 0;
- ::CheckDlgButton(hWnd, IDC_CHECK_SHOW_POPUP, nCheck ? BST_CHECKED : BST_UNCHECKED);
- ::SetDlgItemText(hWnd,IDC_EDIT_POPUP_FORMAT,pAdvSettings->GetPopupFormat().c_str());
- ::CheckDlgButton(hWnd, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED, (pAdvSettings->GetShowPopupIfValueChangedFlag()) ? BST_CHECKED : BST_UNCHECKED);
-
- if(true == enable_popup_controls(hWnd))
- {
- update_popup_controls(hWnd);
- }
-
- ::SetWindowLongPtr(hWnd,GWLP_USERDATA,reinterpret_cast<LONG_PTR>(pAdvSettings));
+ update_popup_controls(hWnd);
}
- return TRUE;
+
+ ::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(pAdvSettings));
+ }
+ return TRUE;
case WM_COMMAND:
- switch(LOWORD(wp))
+ switch (LOWORD(wp))
{
case IDOK:
+ {
+ WORD nLogMode = lmDisabled;
+ UINT nCheck = ::IsDlgButtonChecked(hWnd, IDC_CHECK_EXTERNAL_FILE);
+ if (1 == nCheck)
{
- WORD nLogMode = lmDisabled;
- UINT nCheck = ::IsDlgButtonChecked(hWnd,IDC_CHECK_EXTERNAL_FILE);
- if(1 == nCheck)
- {
- nLogMode |= lmExternalFile;
- }
+ nLogMode |= lmExternalFile;
+ }
- nCheck = ::IsDlgButtonChecked(hWnd,IDC_CHECK_INTERNAL_HISTORY);
- if(1 == nCheck)
- {
- nLogMode |= lmInternalHistory;
- }
+ nCheck = ::IsDlgButtonChecked(hWnd, IDC_CHECK_INTERNAL_HISTORY);
+ if (1 == nCheck)
+ {
+ nLogMode |= lmInternalHistory;
+ }
- nCheck = ::IsDlgButtonChecked(hWnd,IDC_CHECK_SHOW_POPUP);
- if(1 == nCheck)
- {
- nLogMode |= lmPopup;
- }
+ nCheck = ::IsDlgButtonChecked(hWnd, IDC_CHECK_SHOW_POPUP);
+ if (1 == nCheck)
+ {
+ nLogMode |= lmPopup;
+ }
- bool bOk = true;
- HWND hwndLogFile = ::GetDlgItem(hWnd,IDC_EDIT_FILE_NAME);
- HWND hwndLogFileFrmt = ::GetDlgItem(hWnd,IDC_EDIT_LOG_FILE_FORMAT);
-
- tstring sLogFile = get_window_text(hwndLogFile);
- tstring sLogFileFormat = get_window_text(hwndLogFileFrmt);
-
- if ((nLogMode&lmExternalFile))
- {
- if(true == sLogFile.empty())
- {
- prepare_edit_ctrl_for_error(hwndLogFile);
- Quotes_MessageBox(hWnd,TranslateT("Enter log file name."),MB_OK|MB_ICONERROR);
- bOk = false;
- }
- else if(true == sLogFileFormat.empty())
- {
- prepare_edit_ctrl_for_error(hwndLogFileFrmt);
- Quotes_MessageBox(hWnd,TranslateT("Enter log file format."),MB_OK|MB_ICONERROR);
- bOk = false;
- }
- }
+ bool bOk = true;
+ HWND hwndLogFile = ::GetDlgItem(hWnd, IDC_EDIT_FILE_NAME);
+ HWND hwndLogFileFrmt = ::GetDlgItem(hWnd, IDC_EDIT_LOG_FILE_FORMAT);
+
+ tstring sLogFile = get_window_text(hwndLogFile);
+ tstring sLogFileFormat = get_window_text(hwndLogFileFrmt);
- HWND hwndHistoryFrmt = ::GetDlgItem(hWnd,IDC_EDIT_HISTORY_FORMAT);
- tstring sHistoryFormat = get_window_text(hwndHistoryFrmt);
- if ((true == bOk) && (nLogMode&lmInternalHistory) && (true == sHistoryFormat.empty()))
+ if ((nLogMode&lmExternalFile))
+ {
+ if (true == sLogFile.empty())
{
- prepare_edit_ctrl_for_error(hwndHistoryFrmt);
- Quotes_MessageBox(hWnd,TranslateT("Enter history format."),MB_OK|MB_ICONERROR);
+ prepare_edit_ctrl_for_error(hwndLogFile);
+ Quotes_MessageBox(hWnd, TranslateT("Enter log file name."), MB_OK | MB_ICONERROR);
bOk = false;
}
-
- HWND hwndPopupFrmt = ::GetDlgItem(hWnd,IDC_EDIT_POPUP_FORMAT);
- tstring sPopupFormat = get_window_text(hwndPopupFrmt);
- if ((true == bOk) && (nLogMode&lmPopup) && (true == sPopupFormat.empty()))
+ else if (true == sLogFileFormat.empty())
{
- prepare_edit_ctrl_for_error(hwndPopupFrmt);
- Quotes_MessageBox(hWnd,TranslateT("Enter popup window format."),MB_OK|MB_ICONERROR);
+ prepare_edit_ctrl_for_error(hwndLogFileFrmt);
+ Quotes_MessageBox(hWnd, TranslateT("Enter log file format."), MB_OK | MB_ICONERROR);
bOk = false;
}
+ }
- if(true == bOk)
- {
- CAdvProviderSettings* pAdvSettings = reinterpret_cast<CAdvProviderSettings*>(GetWindowLongPtr(hWnd,GWLP_USERDATA));
-
- pAdvSettings->SetLogMode(nLogMode);
- pAdvSettings->SetHistoryOnlyChangedFlag(1 == IsDlgButtonChecked(hWnd,IDC_CHECK_HISTORY_CONDITION));
- pAdvSettings->SetLogOnlyChangedFlag(1 == IsDlgButtonChecked(hWnd,IDC_CHECK_LOG_FILE_CONDITION));
- pAdvSettings->SetShowPopupIfValueChangedFlag(1 == IsDlgButtonChecked(hWnd,IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED));
- pAdvSettings->SetLogFileName(sLogFile);
- pAdvSettings->SetLogFormat(sLogFileFormat);
- pAdvSettings->SetHistoryFormat(sHistoryFormat);
- pAdvSettings->SetPopupFormat(sPopupFormat);
-
- ::EndDialog(hWnd,IDOK);
- }
+ HWND hwndHistoryFrmt = ::GetDlgItem(hWnd, IDC_EDIT_HISTORY_FORMAT);
+ tstring sHistoryFormat = get_window_text(hwndHistoryFrmt);
+ if ((true == bOk) && (nLogMode&lmInternalHistory) && (true == sHistoryFormat.empty()))
+ {
+ prepare_edit_ctrl_for_error(hwndHistoryFrmt);
+ Quotes_MessageBox(hWnd, TranslateT("Enter history format."), MB_OK | MB_ICONERROR);
+ bOk = false;
}
- break;
+
+ HWND hwndPopupFrmt = ::GetDlgItem(hWnd, IDC_EDIT_POPUP_FORMAT);
+ tstring sPopupFormat = get_window_text(hwndPopupFrmt);
+ if ((true == bOk) && (nLogMode&lmPopup) && (true == sPopupFormat.empty()))
+ {
+ prepare_edit_ctrl_for_error(hwndPopupFrmt);
+ Quotes_MessageBox(hWnd, TranslateT("Enter popup window format."), MB_OK | MB_ICONERROR);
+ bOk = false;
+ }
+
+ if (true == bOk)
+ {
+ CAdvProviderSettings* pAdvSettings = reinterpret_cast<CAdvProviderSettings*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
+
+ pAdvSettings->SetLogMode(nLogMode);
+ pAdvSettings->SetHistoryOnlyChangedFlag(1 == IsDlgButtonChecked(hWnd, IDC_CHECK_HISTORY_CONDITION));
+ pAdvSettings->SetLogOnlyChangedFlag(1 == IsDlgButtonChecked(hWnd, IDC_CHECK_LOG_FILE_CONDITION));
+ pAdvSettings->SetShowPopupIfValueChangedFlag(1 == IsDlgButtonChecked(hWnd, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED));
+ pAdvSettings->SetLogFileName(sLogFile);
+ pAdvSettings->SetLogFormat(sLogFileFormat);
+ pAdvSettings->SetHistoryFormat(sHistoryFormat);
+ pAdvSettings->SetPopupFormat(sPopupFormat);
+
+ ::EndDialog(hWnd, IDOK);
+ }
+ }
+ break;
case IDCANCEL:
- ::EndDialog(hWnd,IDCANCEL);
+ ::EndDialog(hWnd, IDCANCEL);
break;
case IDC_BUTTON_HISTORY_DESCRIPTION:
case IDC_BUTTON_LOG_FILE_DESCRIPTION:
case IDC_BUTTON_POPUP_FORMAT_DESCRIPTION:
- if(BN_CLICKED == HIWORD(wp))
+ if (BN_CLICKED == HIWORD(wp))
{
- const CAdvProviderSettings* pAdvSettings = reinterpret_cast<CAdvProviderSettings*>(GetWindowLongPtr(hWnd,GWLP_USERDATA));
- show_variable_list(hWnd,pAdvSettings->GetProviderPtr());
+ const CAdvProviderSettings* pAdvSettings = reinterpret_cast<CAdvProviderSettings*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
+ show_variable_list(hWnd, pAdvSettings->GetProviderPtr());
}
break;
case IDC_CHECK_EXTERNAL_FILE:
- if(BN_CLICKED == HIWORD(wp))
+ if (BN_CLICKED == HIWORD(wp))
{
update_file_controls(hWnd);
}
break;
case IDC_CHECK_INTERNAL_HISTORY:
- if(BN_CLICKED == HIWORD(wp))
+ if (BN_CLICKED == HIWORD(wp))
{
update_history_controls(hWnd);
}
break;
case IDC_CHECK_SHOW_POPUP:
- if(BN_CLICKED == HIWORD(wp))
+ if (BN_CLICKED == HIWORD(wp))
{
update_popup_controls(hWnd);
}
break;
case IDC_BUTTON_BROWSE:
- if(BN_CLICKED == HIWORD(wp))
+ if (BN_CLICKED == HIWORD(wp))
{
select_log_file(hWnd);
}
break;
case IDC_BUTTON_POPUP_SETTINGS:
- {
- const CAdvProviderSettings* pAdvSettings = reinterpret_cast<CAdvProviderSettings*>(GetWindowLongPtr(hWnd,GWLP_USERDATA));
- DialogBoxParam(g_hInstance,
- MAKEINTRESOURCE(IDD_DIALOG_POPUP),
- hWnd,
- EditPopupSettingsDlgProc,reinterpret_cast<LPARAM>(pAdvSettings->GetPopupSettingsPtr()));
+ {
+ const CAdvProviderSettings* pAdvSettings = reinterpret_cast<CAdvProviderSettings*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
+ DialogBoxParam(g_hInstance,
+ MAKEINTRESOURCE(IDD_DIALOG_POPUP),
+ hWnd,
+ EditPopupSettingsDlgProc, reinterpret_cast<LPARAM>(pAdvSettings->GetPopupSettingsPtr()));
- }
- break;
+ }
+ break;
}
break;
}
@@ -705,12 +705,12 @@ namespace }
CAdvProviderSettings::CAdvProviderSettings(const IQuotesProvider* pQuotesProvider)
- : m_pQuotesProvider(pQuotesProvider),
- m_wLogMode(lmDisabled),
- m_bIsOnlyChangedHistory(false),
- m_bIsOnlyChangedLogFile(false),
- m_bShowPopupIfValueChanged(false),
- m_pPopupSettings(nullptr)
+ : m_pQuotesProvider(pQuotesProvider),
+ m_wLogMode(lmDisabled),
+ m_bIsOnlyChangedHistory(false),
+ m_bIsOnlyChangedLogFile(false),
+ m_bShowPopupIfValueChanged(false),
+ m_pPopupSettings(nullptr)
{
assert(m_pQuotesProvider);
@@ -726,12 +726,12 @@ CAdvProviderSettings::CAdvProviderSettings(const IQuotesProvider* pQuotesProvide assert(visitor.m_pszDbLogFormat);
assert(visitor.m_pszDbLogCondition);
- m_wLogMode = db_get_w(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogMode,static_cast<WORD>(lmDisabled));
- m_sFormatHistory = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbHistoryFormat,visitor.m_pszDefHistoryFormat);
- m_bIsOnlyChangedHistory = 1 == db_get_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbHistoryCondition,0);
+ m_wLogMode = db_get_w(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogMode, static_cast<WORD>(lmDisabled));
+ m_sFormatHistory = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbHistoryFormat, visitor.m_pszDefHistoryFormat);
+ m_bIsOnlyChangedHistory = 1 == db_get_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbHistoryCondition, 0);
- m_sLogFileName = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogFile);
- if(true == m_sLogFileName.empty())
+ m_sLogFileName = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogFile);
+ if (true == m_sLogFileName.empty())
{
m_sLogFileName = g_pszVariableUserProfile;
m_sLogFileName += _T("\\Quotes\\");
@@ -739,11 +739,11 @@ CAdvProviderSettings::CAdvProviderSettings(const IQuotesProvider* pQuotesProvide m_sLogFileName += _T(".log");
}
- m_sFormatLogFile = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogFormat,visitor.m_pszDefLogFileFormat);
- m_bIsOnlyChangedLogFile = (1 == db_get_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogCondition,0));
+ m_sFormatLogFile = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogFormat, visitor.m_pszDefLogFileFormat);
+ m_bIsOnlyChangedLogFile = (1 == db_get_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogCondition, 0));
- m_sPopupFormat = Quotes_DBGetStringT(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupFormat,visitor.m_pszDefPopupFormat);
- m_bShowPopupIfValueChanged = (1 == db_get_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupCondition,0));
+ m_sPopupFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupFormat, visitor.m_pszDefPopupFormat);
+ m_bShowPopupIfValueChanged = (1 == db_get_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupCondition, 0));
}
CAdvProviderSettings::~CAdvProviderSettings()
@@ -774,23 +774,23 @@ void CAdvProviderSettings::SaveToDb()const assert(visitor.m_pszDbPopupDelayTimeout);
assert(visitor.m_pszDbPopupHistoryFlag);
- db_set_w(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogMode,m_wLogMode);
- db_set_ts(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbHistoryFormat,m_sFormatHistory.c_str());
- db_set_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbHistoryCondition,m_bIsOnlyChangedHistory);
- db_set_ts(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogFile,m_sLogFileName.c_str());
- db_set_ts(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogFormat,m_sFormatLogFile.c_str());
- db_set_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbLogCondition,m_bIsOnlyChangedLogFile);
- db_set_ts(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupFormat,m_sPopupFormat.c_str());
- db_set_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupCondition,m_bShowPopupIfValueChanged);
+ db_set_w(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogMode, m_wLogMode);
+ db_set_ts(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbHistoryFormat, m_sFormatHistory.c_str());
+ db_set_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbHistoryCondition, m_bIsOnlyChangedHistory);
+ db_set_ts(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogFile, m_sLogFileName.c_str());
+ db_set_ts(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogFormat, m_sFormatLogFile.c_str());
+ db_set_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogCondition, m_bIsOnlyChangedLogFile);
+ db_set_ts(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupFormat, m_sPopupFormat.c_str());
+ db_set_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupCondition, m_bShowPopupIfValueChanged);
- if(nullptr != m_pPopupSettings)
+ if (nullptr != m_pPopupSettings)
{
- db_set_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupColourMode,static_cast<BYTE>(m_pPopupSettings->GetColourMode()));
- db_set_dw(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupBkColour,m_pPopupSettings->GetColourBk());
- db_set_dw(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupTextColour,m_pPopupSettings->GetColourText());
- db_set_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupDelayMode,static_cast<BYTE>(m_pPopupSettings->GetDelayMode()));
- db_set_w(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupDelayTimeout,m_pPopupSettings->GetDelayTimeout());
- db_set_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupHistoryFlag,m_pPopupSettings->GetHistoryFlag());
+ db_set_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupColourMode, static_cast<BYTE>(m_pPopupSettings->GetColourMode()));
+ db_set_dw(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupBkColour, m_pPopupSettings->GetColourBk());
+ db_set_dw(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupTextColour, m_pPopupSettings->GetColourText());
+ db_set_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupDelayMode, static_cast<BYTE>(m_pPopupSettings->GetDelayMode()));
+ db_set_w(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupDelayTimeout, m_pPopupSettings->GetDelayTimeout());
+ db_set_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupHistoryFlag, m_pPopupSettings->GetHistoryFlag());
}
}
@@ -856,27 +856,27 @@ void CAdvProviderSettings::SetLogOnlyChangedFlag(bool bMode) const tstring& CAdvProviderSettings::GetPopupFormat() const
{
- return m_sPopupFormat;
+ return m_sPopupFormat;
}
void CAdvProviderSettings::SetPopupFormat(const tstring& val)
{
- m_sPopupFormat = val;
+ m_sPopupFormat = val;
}
bool CAdvProviderSettings::GetShowPopupIfValueChangedFlag() const
{
- return m_bShowPopupIfValueChanged;
+ return m_bShowPopupIfValueChanged;
}
void CAdvProviderSettings::SetShowPopupIfValueChangedFlag(bool val)
{
- m_bShowPopupIfValueChanged = val;
+ m_bShowPopupIfValueChanged = val;
}
CPopupSettings* CAdvProviderSettings::GetPopupSettingsPtr()const
{
- if(nullptr == m_pPopupSettings)
+ if (nullptr == m_pPopupSettings)
{
m_pPopupSettings = new CPopupSettings(m_pQuotesProvider);
}
@@ -885,12 +885,12 @@ CPopupSettings* CAdvProviderSettings::GetPopupSettingsPtr()const }
CPopupSettings::CPopupSettings(const IQuotesProvider* pQuotesProvider)
- : m_modeColour(colourDefault),
- m_modeDelay(delayFromPopup),
- m_rgbBkg(GetDefColourBk()),
- m_rgbText(GetDefColourText()),
- m_wDelay(3),
- m_bUseHistory(false)
+ : m_modeColour(colourDefault),
+ m_modeDelay(delayFromPopup),
+ m_rgbBkg(GetDefColourBk()),
+ m_rgbText(GetDefColourText()),
+ m_wDelay(3),
+ m_bUseHistory(false)
{
CQuotesProviderVisitorDbSettings visitor;
@@ -903,22 +903,22 @@ CPopupSettings::CPopupSettings(const IQuotesProvider* pQuotesProvider) assert(visitor.m_pszDbPopupDelayTimeout);
assert(visitor.m_pszDbPopupHistoryFlag);
- BYTE m = db_get_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupColourMode,static_cast<BYTE>(m_modeColour));
- if(m >= colourDefault && m <= colourUserDefined)
+ BYTE m = db_get_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupColourMode, static_cast<BYTE>(m_modeColour));
+ if (m >= colourDefault && m <= colourUserDefined)
{
m_modeColour = static_cast<EColourMode>(m);
}
- m_rgbBkg = db_get_dw(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupBkColour,m_rgbBkg);
- m_rgbText = db_get_dw(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupTextColour,m_rgbText);
+ m_rgbBkg = db_get_dw(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupBkColour, m_rgbBkg);
+ m_rgbText = db_get_dw(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupTextColour, m_rgbText);
- m = db_get_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupDelayMode,static_cast<BYTE>(m_modeDelay));
- if(m >= delayFromPopup && m <= delayPermanent)
+ m = db_get_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupDelayMode, static_cast<BYTE>(m_modeDelay));
+ if (m >= delayFromPopup && m <= delayPermanent)
{
m_modeDelay = static_cast<EDelayMode>(m);
}
- m_wDelay = db_get_w(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupDelayTimeout,m_wDelay);
- m_bUseHistory = (1 == db_get_b(NULL,QUOTES_PROTOCOL_NAME,visitor.m_pszDbPopupHistoryFlag,m_bUseHistory));
+ m_wDelay = db_get_w(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupDelayTimeout, m_wDelay);
+ m_bUseHistory = (1 == db_get_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupHistoryFlag, m_bUseHistory));
}
/*static */
@@ -935,32 +935,32 @@ COLORREF CPopupSettings::GetDefColourText() void CPopupSettings::InitForContact(MCONTACT hContact)
{
- BYTE m = db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_MODE,static_cast<BYTE>(m_modeColour));
- if(m >= CPopupSettings::colourDefault && m <= CPopupSettings::colourUserDefined)
+ BYTE m = db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_COLOUR_MODE, static_cast<BYTE>(m_modeColour));
+ if (m >= CPopupSettings::colourDefault && m <= CPopupSettings::colourUserDefined)
{
m_modeColour = static_cast<CPopupSettings::EColourMode>(m);
}
- m_rgbBkg = db_get_dw(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_BK,m_rgbBkg);
- m_rgbText = db_get_dw(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_TEXT,m_rgbText);
+ m_rgbBkg = db_get_dw(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_COLOUR_BK, m_rgbBkg);
+ m_rgbText = db_get_dw(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_COLOUR_TEXT, m_rgbText);
- m = db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_DELAY_MODE,static_cast<BYTE>(m_modeDelay));
- if(m >= CPopupSettings::delayFromPopup && m <= CPopupSettings::delayPermanent)
+ m = db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_DELAY_MODE, static_cast<BYTE>(m_modeDelay));
+ if (m >= CPopupSettings::delayFromPopup && m <= CPopupSettings::delayPermanent)
{
m_modeDelay = static_cast<CPopupSettings::EDelayMode>(m);
}
- m_wDelay = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_DELAY_TIMEOUT,m_wDelay);
- m_bUseHistory = 1 == db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_HISTORY_FLAG,m_bUseHistory);
+ m_wDelay = db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_DELAY_TIMEOUT, m_wDelay);
+ m_bUseHistory = 1 == db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_HISTORY_FLAG, m_bUseHistory);
}
void CPopupSettings::SaveForContact(MCONTACT hContact)const
{
- db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_MODE,static_cast<BYTE>(m_modeColour));
- db_set_dw(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_BK,m_rgbBkg);
- db_set_dw(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_TEXT,m_rgbText);
- db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_DELAY_MODE,static_cast<BYTE>(m_modeDelay));
- db_set_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_DELAY_TIMEOUT,m_wDelay);
- db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_HISTORY_FLAG,m_bUseHistory);
+ db_set_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_COLOUR_MODE, static_cast<BYTE>(m_modeColour));
+ db_set_dw(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_COLOUR_BK, m_rgbBkg);
+ db_set_dw(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_COLOUR_TEXT, m_rgbText);
+ db_set_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_DELAY_MODE, static_cast<BYTE>(m_modeDelay));
+ db_set_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_DELAY_TIMEOUT, m_wDelay);
+ db_set_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_HISTORY_FLAG, m_bUseHistory);
}
CPopupSettings::EColourMode CPopupSettings::GetColourMode()const
@@ -1023,26 +1023,26 @@ void CPopupSettings::SetHistoryFlag(bool flag) m_bUseHistory = flag;
}
-bool ShowSettingsDlg(HWND hWndParent,CAdvProviderSettings* pAdvSettings)
+bool ShowSettingsDlg(HWND hWndParent, CAdvProviderSettings* pAdvSettings)
{
assert(pAdvSettings);
return (IDOK == DialogBoxParam(g_hInstance,
- MAKEINTRESOURCE(IDD_PROVIDER_ADV_SETTINGS),
- hWndParent,
- EditSettingsPerProviderDlgProc,
- reinterpret_cast<LPARAM>(pAdvSettings)));
+ MAKEINTRESOURCE(IDD_PROVIDER_ADV_SETTINGS),
+ hWndParent,
+ EditSettingsPerProviderDlgProc,
+ reinterpret_cast<LPARAM>(pAdvSettings)));
}
namespace
{
- void replace_invalid_char(tstring::value_type& rChar,tstring::value_type repl)
+ void replace_invalid_char(tstring::value_type& rChar, tstring::value_type repl)
{
- static const TCHAR charInvalidSigns[] = {_T('\\'), _T('/'), _T(':'), _T('*'), _T('?'), _T('\"'), _T('<'), _T('>'), _T('|')};
+ static const TCHAR charInvalidSigns[] = { _T('\\'), _T('/'), _T(':'), _T('*'), _T('?'), _T('\"'), _T('<'), _T('>'), _T('|') };
- for(int i = 0; i < sizeof(charInvalidSigns)/sizeof(charInvalidSigns[0]);++i)
+ for (int i = 0; i < sizeof(charInvalidSigns) / sizeof(charInvalidSigns[0]); ++i)
{
- if(rChar == charInvalidSigns[i])
+ if (rChar == charInvalidSigns[i])
{
rChar = repl;
break;
@@ -1053,32 +1053,32 @@ namespace }
tstring GenerateLogFileName(const tstring& rsLogFilePattern,
- const tstring& rsQuoteSymbol,
- int nFlags/* = glfnResolveAll*/)
+ const tstring& rsQuoteSymbol,
+ int nFlags/* = glfnResolveAll*/)
{
tstring sPath = rsLogFilePattern;
- if(nFlags&glfnResolveQuoteName)
+ if (nFlags&glfnResolveQuoteName)
{
assert(false == rsQuoteSymbol.empty());
tstring::size_type n = sPath.find(g_pszVariableQuoteName);
- if(tstring::npos != n)
+ if (tstring::npos != n)
{
tstring s = rsQuoteSymbol;
- std::for_each(s.begin(),s.end(),boost::bind(replace_invalid_char,_1,_T('_')));
- sPath.replace(n,mir_tstrlen(g_pszVariableQuoteName),s.c_str());
+ std::for_each(s.begin(), s.end(), boost::bind(replace_invalid_char, _1, _T('_')));
+ sPath.replace(n, mir_tstrlen(g_pszVariableQuoteName), s.c_str());
}
}
- if(nFlags&glfnResolveUserProfile)
+ if (nFlags&glfnResolveUserProfile)
{
- REPLACEVARSDATA dat = {0};
+ REPLACEVARSDATA dat = { 0 };
dat.cbSize = sizeof(dat);
dat.dwFlags = RVF_TCHAR;
TCHAR* ptszParsedName = reinterpret_cast<TCHAR*>(CallService(MS_UTILS_REPLACEVARS,
- reinterpret_cast<WPARAM>(sPath.c_str()),reinterpret_cast<LPARAM>(&dat)));
- if(ptszParsedName)
+ reinterpret_cast<WPARAM>(sPath.c_str()), reinterpret_cast<LPARAM>(&dat)));
+ if (ptszParsedName)
{
sPath = ptszParsedName;
mir_free(ptszParsedName);
@@ -1093,13 +1093,13 @@ tstring GetContactLogFileName(MCONTACT hContact) tstring result;
const CQuotesProviders::TQuotesProviderPtr& pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact);
- if(pProvider)
+ if (pProvider)
{
tstring sPattern;
- bool bUseContactSpecific = (db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_CONTACT_SPEC_SETTINGS,0) > 0);
- if(bUseContactSpecific)
+ bool bUseContactSpecific = (db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_CONTACT_SPEC_SETTINGS, 0) > 0);
+ if (bUseContactSpecific)
{
- sPattern = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG_FILE);
+ sPattern = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE);
}
else
{
@@ -1107,7 +1107,7 @@ tstring GetContactLogFileName(MCONTACT hContact) sPattern = global_settings.GetLogFileName();
}
- result = GenerateLogFileName(sPattern,Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_SYMBOL));
+ result = GenerateLogFileName(sPattern, Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL));
}
return result;
@@ -1115,10 +1115,10 @@ tstring GetContactLogFileName(MCONTACT hContact) tstring GetContactName(MCONTACT hContact)
{
- tstring sDescription = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_DESCRIPTION);
- if(sDescription.empty())
+ tstring sDescription = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_DESCRIPTION);
+ if (sDescription.empty())
{
- sDescription = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_SYMBOL);
+ sDescription = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL);
}
return sDescription;
}
diff --git a/plugins/Quotes/src/SettingsDlg.h b/plugins/Quotes/src/SettingsDlg.h index 3c17d7038d..4209804d2e 100644 --- a/plugins/Quotes/src/SettingsDlg.h +++ b/plugins/Quotes/src/SettingsDlg.h @@ -87,7 +87,7 @@ public: void SetShowPopupIfValueChangedFlag(bool val);
CPopupSettings* GetPopupSettingsPtr()const;
-
+
private:
const IQuotesProvider* m_pQuotesProvider;
WORD m_wLogMode;
@@ -102,15 +102,15 @@ private: };
void ShowSettingsDlg(MCONTACT hContact);
-bool ShowSettingsDlg(HWND hWndParent,CAdvProviderSettings* pAdvSettings);
+bool ShowSettingsDlg(HWND hWndParent, CAdvProviderSettings* pAdvSettings);
-enum
+enum
{
glfnResolveQuoteName = 0x0001,
glfnResolveUserProfile = 0x0002,
- glfnResolveAll = glfnResolveQuoteName|glfnResolveUserProfile,
+ glfnResolveAll = glfnResolveQuoteName | glfnResolveUserProfile,
};
-tstring GenerateLogFileName(const tstring& rsLogFilePattern,const tstring& rsQuoteSymbol,int nFlags = glfnResolveAll);
+tstring GenerateLogFileName(const tstring& rsLogFilePattern, const tstring& rsQuoteSymbol, int nFlags = glfnResolveAll);
tstring GetContactLogFileName(MCONTACT hContact);
tstring GetContactName(MCONTACT hContact);
diff --git a/plugins/Quotes/src/WinCtrlHelper.cpp b/plugins/Quotes/src/WinCtrlHelper.cpp index f9b2e340db..3edd248631 100644 --- a/plugins/Quotes/src/WinCtrlHelper.cpp +++ b/plugins/Quotes/src/WinCtrlHelper.cpp @@ -2,31 +2,31 @@ namespace
{
- INT_PTR CALLBACK VariableListDlgProc(HWND hWnd,UINT msg,WPARAM wp,LPARAM lp)
+ INT_PTR CALLBACK VariableListDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
- switch(msg)
+ switch (msg)
{
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hWnd);
- const IQuotesProvider* pProvider = reinterpret_cast<const IQuotesProvider*>(lp);
- CQuotesProviderVisitorFormatSpecificator visitor;
- pProvider->Accept(visitor);
+ {
+ TranslateDialogDefault(hWnd);
+ const IQuotesProvider* pProvider = reinterpret_cast<const IQuotesProvider*>(lp);
+ CQuotesProviderVisitorFormatSpecificator visitor;
+ pProvider->Accept(visitor);
- tostringstream o;
- const CQuotesProviderVisitorFormatSpecificator::TFormatSpecificators& raSpec = visitor.GetSpecificators();
- std::for_each(raSpec.begin(),raSpec.end(),
- [&o](const CQuotesProviderVisitorFormatSpecificator::CFormatSpecificator& spec)
- {
- o << spec.m_sSymbol << _T('\t') << spec.m_sDesc << _T("\r\n");
- });
- ::SetDlgItemText(hWnd,IDC_EDIT_VARIABLE,o.str().c_str());
- }
- break;
+ tostringstream o;
+ const CQuotesProviderVisitorFormatSpecificator::TFormatSpecificators& raSpec = visitor.GetSpecificators();
+ std::for_each(raSpec.begin(), raSpec.end(),
+ [&o](const CQuotesProviderVisitorFormatSpecificator::CFormatSpecificator& spec)
+ {
+ o << spec.m_sSymbol << _T('\t') << spec.m_sDesc << _T("\r\n");
+ });
+ ::SetDlgItemText(hWnd, IDC_EDIT_VARIABLE, o.str().c_str());
+ }
+ break;
case WM_COMMAND:
- if(BN_CLICKED == HIWORD(wp) && (IDOK == LOWORD(wp) || IDCANCEL == LOWORD(wp)))
+ if (BN_CLICKED == HIWORD(wp) && (IDOK == LOWORD(wp) || IDCANCEL == LOWORD(wp)))
{
- ::EndDialog(hWnd,IDOK);
+ ::EndDialog(hWnd, IDOK);
}
break;
}
@@ -35,7 +35,7 @@ namespace }
}
-void show_variable_list(HWND hwndParent,const IQuotesProvider* pProvider)
+void show_variable_list(HWND hwndParent, const IQuotesProvider* pProvider)
{
::DialogBoxParam(g_hInstance,
MAKEINTRESOURCE(IDD_DIALOG_VARIABLE_LIST),
diff --git a/plugins/Quotes/src/WinCtrlHelper.h b/plugins/Quotes/src/WinCtrlHelper.h index d7f8957a86..52e4521f24 100644 --- a/plugins/Quotes/src/WinCtrlHelper.h +++ b/plugins/Quotes/src/WinCtrlHelper.h @@ -7,9 +7,9 @@ inline tstring get_window_text(HWND hWnd) {
int cBytes = ::GetWindowTextLength(hWnd);
- std::vector<TCHAR> aBuf(cBytes+1);
+ std::vector<TCHAR> aBuf(cBytes + 1);
LPTSTR pBuffer = &*(aBuf.begin());
- ::GetWindowText(hWnd,pBuffer,cBytes+1);
+ ::GetWindowText(hWnd, pBuffer, cBytes + 1);
return tstring(pBuffer);
}
@@ -21,16 +21,16 @@ inline void prepare_edit_ctrl_for_error(HWND hwndEdit) ::SendMessage(hwndEdit, EM_SCROLLCARET, 0, 0);
}
-void show_variable_list(HWND hwndParent,const IQuotesProvider* pProvider);
+void show_variable_list(HWND hwndParent, const IQuotesProvider* pProvider);
-inline int Quotes_MessageBox(HWND hWnd,LPCTSTR pszText,UINT nType = MB_OK)
-{
- return ::MessageBox(hWnd,pszText,quotes_a2t(MIRANDANAME).c_str(),nType);
+inline int Quotes_MessageBox(HWND hWnd, LPCTSTR pszText, UINT nType = MB_OK)
+{
+ return ::MessageBox(hWnd, pszText, quotes_a2t(MIRANDANAME).c_str(), nType);
}
-inline void spin_set_range(HWND hwndSpin,short nLower,short nUpper)
+inline void spin_set_range(HWND hwndSpin, short nLower, short nUpper)
{
- ::SendMessage(hwndSpin,UDM_SETRANGE,0,MAKELPARAM(nUpper,nLower));
+ ::SendMessage(hwndSpin, UDM_SETRANGE, 0, MAKELPARAM(nUpper, nLower));
}
diff --git a/plugins/Quotes/src/WorkingThread.cpp b/plugins/Quotes/src/WorkingThread.cpp index 23bd475a0a..f53b795226 100644 --- a/plugins/Quotes/src/WorkingThread.cpp +++ b/plugins/Quotes/src/WorkingThread.cpp @@ -5,7 +5,7 @@ void WorkingThread(void* pParam) IQuotesProvider* pProvider = reinterpret_cast<IQuotesProvider*>(pParam);
assert(pProvider);
- if(pProvider)
+ if (pProvider)
{
pProvider->Run();
}
diff --git a/plugins/Quotes/src/XMLEngineMI.cpp b/plugins/Quotes/src/XMLEngineMI.cpp index fd329db61d..7e9e3f6016 100644 --- a/plugins/Quotes/src/XMLEngineMI.cpp +++ b/plugins/Quotes/src/XMLEngineMI.cpp @@ -5,22 +5,22 @@ XML_API xi; namespace
{
class CXMLNodeMI : public IXMLNode,
- private boost::noncopyable
+ private boost::noncopyable
{
public:
typedef boost::shared_ptr<IXMLNode> TXMLNodePtr;
public:
- explicit CXMLNodeMI(HXML hXMl,bool bDestroy = false) : m_hXML(hXMl),m_bDestroy(bDestroy)
+ explicit CXMLNodeMI(HXML hXMl, bool bDestroy = false) : m_hXML(hXMl), m_bDestroy(bDestroy)
{
assert(m_hXML);
}
virtual ~CXMLNodeMI()
{
- if(m_bDestroy)
+ if (m_bDestroy)
{
- xi.destroyNode(m_hXML);
+ xi.destroyNode(m_hXML);
}
}
@@ -29,10 +29,10 @@ namespace return xi.getChildCount(m_hXML);
}
- virtual TXMLNodePtr GetChildNode(size_t nIndex)const
+ virtual TXMLNodePtr GetChildNode(size_t nIndex)const
{
HXML h = xi.getChild(m_hXML, (int)nIndex);
- if(h)
+ if (h)
{
return TXMLNodePtr(new CXMLNodeMI(h));
}
@@ -46,7 +46,7 @@ namespace {
tstring sResult;
LPCTSTR psz = xi.getText(m_hXML);
- if(psz)
+ if (psz)
{
sResult = psz;
}
@@ -58,7 +58,7 @@ namespace {
tstring sResult;
LPCTSTR psz = xi.getName(m_hXML);
- if(psz)
+ if (psz)
{
sResult = psz;
}
@@ -69,9 +69,9 @@ namespace virtual bool AddChild(const TXMLNodePtr& pNode)
{
CXMLNodeMI* pXML = dynamic_cast<CXMLNodeMI*>(pNode.get());
- if(pXML)
+ if (pXML)
{
- xi.addChild2(pXML->m_hXML,m_hXML);
+ xi.addChild2(pXML->m_hXML, m_hXML);
pXML->m_bDestroy = false;
return true;
}
@@ -81,42 +81,42 @@ namespace }
}
- virtual bool AddAttribute(const tstring& rsName,const tstring& rsValue)
+ virtual bool AddAttribute(const tstring& rsName, const tstring& rsValue)
{
- xi.addAttr(m_hXML,rsName.c_str(),rsValue.c_str());
+ xi.addAttr(m_hXML, rsName.c_str(), rsValue.c_str());
return true;
}
virtual tstring GetAttributeValue(const tstring& rsAttrName)
{
- LPCTSTR pszValue = xi.getAttrValue(m_hXML,rsAttrName.c_str());
+ LPCTSTR pszValue = xi.getAttrValue(m_hXML, rsAttrName.c_str());
return ((NULL != pszValue) ? tstring(pszValue) : tstring());
}
virtual void Write(tostream& o)const
{
-// struct safe_string
-// {
-// safe_string(LPTSTR p):m_p(p){}
-// ~safe_string(){xi.freeMem(m_p);}
-//
-// LPTSTR m_p;
-// };
-//
-// struct mir_safe_string
-// {
-// mir_safe_string(LPSTR p) : m_p(p){}
-// ~mir_safe_string(){mir_free(m_p);}
-//
-// LPSTR m_p;
-// };
-
-
- safe_string<TCHAR> ss(xi.toString(m_hXML,NULL));
- if(ss.m_p)
+ // struct safe_string
+ // {
+ // safe_string(LPTSTR p):m_p(p){}
+ // ~safe_string(){xi.freeMem(m_p);}
+ //
+ // LPTSTR m_p;
+ // };
+ //
+ // struct mir_safe_string
+ // {
+ // mir_safe_string(LPSTR p) : m_p(p){}
+ // ~mir_safe_string(){mir_free(m_p);}
+ //
+ // LPSTR m_p;
+ // };
+
+
+ safe_string<TCHAR> ss(xi.toString(m_hXML, NULL));
+ if (ss.m_p)
{
mir_safe_string<char> mss(mir_utf8encodeT(ss.m_p));
- if(mss.m_p)
+ if (mss.m_p)
{
o << mss.m_p;
}
@@ -139,37 +139,37 @@ CXMLEngineMI::~CXMLEngineMI() IXMLNode::TXMLNodePtr CXMLEngineMI::LoadFile(const tstring& rsFileName)const
{
-// struct mir_safe_string
-// {
-// mir_safe_string(LPTSTR p) : m_p(p){}
-// ~mir_safe_string(){mir_free(m_p);}
-//
-// LPTSTR m_p;
-// };
+ // struct mir_safe_string
+ // {
+ // mir_safe_string(LPTSTR p) : m_p(p){}
+ // ~mir_safe_string(){mir_free(m_p);}
+ //
+ // LPTSTR m_p;
+ // };
IXMLNode::TXMLNodePtr pResult;
FILE* stream;
- if(0 == ::_tfopen_s(&stream,rsFileName.c_str(),_T("r")))
+ if (0 == ::_tfopen_s(&stream, rsFileName.c_str(), _T("r")))
{
struct _stat st;
- if (-1 != ::_fstat(::_fileno(stream),&st))
+ if (-1 != ::_fstat(::_fileno(stream), &st))
{
- std::vector<char> aBuffer(st.st_size+1);
+ std::vector<char> aBuffer(st.st_size + 1);
char* pBuffer = &*(aBuffer.begin());
- size_t cBytes = ::fread(pBuffer,sizeof(char),st.st_size,stream);
- if(cBytes > 0 && cBytes <= static_cast<size_t>(st.st_size))
+ size_t cBytes = ::fread(pBuffer, sizeof(char), st.st_size, stream);
+ if (cBytes > 0 && cBytes <= static_cast<size_t>(st.st_size))
{
pBuffer[cBytes] = '\0';
- int nLen = (int)cBytes;
+ int nLen = (int)cBytes;
mir_safe_string<TCHAR> ss(mir_utf8decodeT(pBuffer));
- if(ss.m_p)
+ if (ss.m_p)
{
- HXML h = xi.parseString(ss.m_p,&nLen,NULL);
- if(h)
+ HXML h = xi.parseString(ss.m_p, &nLen, NULL);
+ if (h)
{
- pResult = IXMLNode::TXMLNodePtr(new CXMLNodeMI(h,true));
+ pResult = IXMLNode::TXMLNodePtr(new CXMLNodeMI(h, true));
}
}
}
@@ -182,36 +182,36 @@ IXMLNode::TXMLNodePtr CXMLEngineMI::LoadFile(const tstring& rsFileName)const namespace
{
- IXMLNode::TXMLNodePtr create_node(const tstring& rsName,const tstring& rsText,bool bIsDecl)
+ IXMLNode::TXMLNodePtr create_node(const tstring& rsName, const tstring& rsText, bool bIsDecl)
{
IXMLNode::TXMLNodePtr pResult;
- HXML h = xi.createNode(rsName.c_str(),rsText.c_str(),bIsDecl);
- if(h)
+ HXML h = xi.createNode(rsName.c_str(), rsText.c_str(), bIsDecl);
+ if (h)
{
- pResult = IXMLNode::TXMLNodePtr(new CXMLNodeMI(h,true));
+ pResult = IXMLNode::TXMLNodePtr(new CXMLNodeMI(h, true));
}
return pResult;
}
}
-bool CXMLEngineMI::SaveFile(const tstring& rsFileName,const IXMLNode::TXMLNodePtr& pNode)const
+bool CXMLEngineMI::SaveFile(const tstring& rsFileName, const IXMLNode::TXMLNodePtr& pNode)const
{
CXMLNodeMI* pXML = dynamic_cast<CXMLNodeMI*>(pNode.get());
- if(pXML)
+ if (pXML)
{
tofstream file(rsFileName.c_str());
- if(file.good())
+ if (file.good())
{
- IXMLNode::TXMLNodePtr pRoot(create_node(_T("xml"),tstring(),true));
- if(pRoot)
+ IXMLNode::TXMLNodePtr pRoot(create_node(_T("xml"), tstring(), true));
+ if (pRoot)
{
- pRoot->AddAttribute(_T("version"),_T("1.0"));
- pRoot->AddAttribute(_T("encoding"),_T("UTF-8"));
+ pRoot->AddAttribute(_T("version"), _T("1.0"));
+ pRoot->AddAttribute(_T("encoding"), _T("UTF-8"));
file << *pRoot;
}
- if(file.good())
+ if (file.good())
{
file << *pNode;
}
@@ -223,7 +223,7 @@ bool CXMLEngineMI::SaveFile(const tstring& rsFileName,const IXMLNode::TXMLNodePt return false;
}
-IXMLNode::TXMLNodePtr CXMLEngineMI::CreateNode(const tstring& rsName,const tstring& rsText)const
+IXMLNode::TXMLNodePtr CXMLEngineMI::CreateNode(const tstring& rsName, const tstring& rsText)const
{
- return create_node(rsName,rsText,false);
+ return create_node(rsName, rsText, false);
}
\ No newline at end of file diff --git a/plugins/Quotes/src/XMLEngineMI.h b/plugins/Quotes/src/XMLEngineMI.h index c1e29c87e9..d800b20f51 100644 --- a/plugins/Quotes/src/XMLEngineMI.h +++ b/plugins/Quotes/src/XMLEngineMI.h @@ -8,8 +8,8 @@ public: ~CXMLEngineMI();
virtual IXMLNode::TXMLNodePtr LoadFile(const tstring& rsFileName)const;
- virtual bool SaveFile(const tstring& rsFileName,const IXMLNode::TXMLNodePtr& pNode)const;
- virtual IXMLNode::TXMLNodePtr CreateNode(const tstring& rsName,const tstring& rsText)const;
+ virtual bool SaveFile(const tstring& rsFileName, const IXMLNode::TXMLNodePtr& pNode)const;
+ virtual IXMLNode::TXMLNodePtr CreateNode(const tstring& rsName, const tstring& rsText)const;
};
#endif //__0c3d1da4_92b7_431c_83e5_f998cd513f0d_XMLEngineMI_h__
diff --git a/plugins/Quotes/src/stdafx.h b/plugins/Quotes/src/stdafx.h index 59b2a17047..9e624a9556 100644 --- a/plugins/Quotes/src/stdafx.h +++ b/plugins/Quotes/src/stdafx.h @@ -58,7 +58,7 @@ inline std::string quotes_t2a(const TCHAR* t) {
std::string s;
char* p = mir_t2a(t);
- if(p)
+ if (p)
{
s = p;
mir_free(p);
@@ -70,7 +70,7 @@ inline tstring quotes_a2t(const char* s) {
tstring t;
TCHAR* p = mir_a2t(s);
- if(p)
+ if (p)
{
t = p;
mir_free(p);
@@ -78,9 +78,9 @@ inline tstring quotes_a2t(const char* s) return t;
}
-inline int quotes_stricmp(LPCTSTR p1,LPCTSTR p2)
+inline int quotes_stricmp(LPCTSTR p1, LPCTSTR p2)
{
- return _tcsicmp(p1,p2);
+ return _tcsicmp(p1, p2);
}
#include "resource.h"
@@ -130,35 +130,35 @@ inline int quotes_stricmp(LPCTSTR p1,LPCTSTR p2) namespace detail
{
- template<typename T,typename TD> struct safe_string_impl
+ template<typename T, typename TD> struct safe_string_impl
{
typedef T* PTR;
safe_string_impl(PTR p) : m_p(p){}
- ~safe_string_impl(){TD::dealloc(m_p);}
+ ~safe_string_impl(){ TD::dealloc(m_p); }
PTR m_p;
};
template<typename T> struct MirandaFree
{
- static void dealloc(T* p){mir_free(p);}
+ static void dealloc(T* p){ mir_free(p); }
};
template<typename T> struct OwnerFree
{
- static void dealloc(T* p){::free(p);}
+ static void dealloc(T* p){ ::free(p); }
};
}
-template<typename T> struct mir_safe_string : public detail::safe_string_impl<T,detail::MirandaFree<T>>
+template<typename T> struct mir_safe_string : public detail::safe_string_impl < T, detail::MirandaFree<T> >
{
- mir_safe_string(PTR p) : detail::safe_string_impl<T,detail::MirandaFree<T>>(p){}
+ mir_safe_string(PTR p) : detail::safe_string_impl<T, detail::MirandaFree<T>>(p){}
};
-template<typename T> struct safe_string : public detail::safe_string_impl<T,detail::OwnerFree<T>>
+template<typename T> struct safe_string : public detail::safe_string_impl < T, detail::OwnerFree<T> >
{
- safe_string(PTR p) : detail::safe_string_impl<T,detail::OwnerFree<T>>(p){}
+ safe_string(PTR p) : detail::safe_string_impl<T, detail::OwnerFree<T>>(p){}
};
extern HINSTANCE g_hInstance;
diff --git a/plugins/Quotes/src/version.h b/plugins/Quotes/src/version.h index 077ac316d5..d09f6a56e2 100644 --- a/plugins/Quotes/src/version.h +++ b/plugins/Quotes/src/version.h @@ -1,14 +1,14 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
-#define __RELEASE_NUM 26
-#define __BUILD_NUM 0
+#define __RELEASE_NUM 26
+#define __BUILD_NUM 0
#include <stdver.h>
#define __PLUGIN_NAME "Quotes"
#define __FILENAME "Quotes.dll"
-#define __DESCRIPTION "Shows currency rates and economic quotes."
-#define __AUTHOR "Dioksin"
+#define __DESCRIPTION "Shows currency rates and economic quotes."
+#define __AUTHOR "Dioksin"
#define __AUTHOREMAIL "dioksin@ua.fm"
-#define __AUTHORWEB "http://miranda-ng.org/p/Quotes/"
-#define __COPYRIGHT "Don't worry!"
+#define __AUTHORWEB "http://miranda-ng.org/p/Quotes/"
+#define __COPYRIGHT "Don't worry!"
|