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/src/CommonOptionDlg.cpp | |
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/src/CommonOptionDlg.cpp')
-rw-r--r-- | plugins/Quotes/src/CommonOptionDlg.cpp | 318 |
1 files changed, 159 insertions, 159 deletions
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;
|