diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-05 12:52:30 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-05 12:52:30 +0000 |
commit | 3576b67db9fa0a3d8d5c1747cc3560504d31d125 (patch) | |
tree | f6a6cb9916cbf1aab83bac572fec8822f6ad065e /plugins/HistoryStats/src/dlgoption_subinput.cpp | |
parent | 73e6231455372205e912963083624aaa371bab0b (diff) |
- adaptation for standard Windows ways of handling Unicode;
- obsoleted code removed;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@8407 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/HistoryStats/src/dlgoption_subinput.cpp')
-rw-r--r-- | plugins/HistoryStats/src/dlgoption_subinput.cpp | 203 |
1 files changed, 93 insertions, 110 deletions
diff --git a/plugins/HistoryStats/src/dlgoption_subinput.cpp b/plugins/HistoryStats/src/dlgoption_subinput.cpp index e1d51bb2c3..5f808f6b09 100644 --- a/plugins/HistoryStats/src/dlgoption_subinput.cpp +++ b/plugins/HistoryStats/src/dlgoption_subinput.cpp @@ -7,21 +7,21 @@ * DlgOption::SubInput
*/
-DlgOption::SubInput::SubInput()
- : m_hChatSessionMinDur(NULL)
- , m_hChatSessionTimeout(NULL)
- , m_hAverageMinTime(NULL)
- , m_hWordDelimiters(NULL)
- , m_hMetaContactsMode(NULL)
- , m_hMergeContacts(NULL)
- , m_hMergeContactsGroups(NULL)
- , m_hMergeMode(NULL)
- , m_hProtocols(NULL)
- , m_hIgnoreOlder(NULL)
- , m_hIgnoreBefore(NULL)
- , m_hIgnoreAfter(NULL)
- , m_hFilterRawRTF(NULL)
- , m_hFilterBBCodes(NULL)
+DlgOption::SubInput::SubInput() :
+ m_hChatSessionMinDur(NULL),
+ m_hChatSessionTimeout(NULL),
+ m_hAverageMinTime(NULL),
+ m_hWordDelimiters(NULL),
+ m_hMetaContactsMode(NULL),
+ m_hMergeContacts(NULL),
+ m_hMergeContactsGroups(NULL),
+ m_hMergeMode(NULL),
+ m_hProtocols(NULL),
+ m_hIgnoreOlder(NULL),
+ m_hIgnoreBefore(NULL),
+ m_hIgnoreAfter(NULL),
+ m_hFilterRawRTF(NULL),
+ m_hFilterBBCodes(NULL)
{
}
@@ -31,36 +31,30 @@ DlgOption::SubInput::~SubInput() BOOL DlgOption::SubInput::handleMsg(UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_WINDOWPOSCHANGED:
- {
- RECT rClient, rWnd;
-
- GetClientRect(getHWnd(), &rClient);
-
- // options tree
- rWnd = utils::getWindowRect(getHWnd(), m_Options);
- rWnd.right = rClient.right;
- rWnd.bottom = rClient.bottom;
- utils::moveWindow(m_Options, rWnd);
- }
- return TRUE;
-
- case WM_NOTIFY:
- {
- NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
-
- if (p->idFrom == IDC_OPTIONS)
- {
- if (p->code == OptionsCtrl::OCN_MODIFIED)
- {
- getParent()->settingsChanged();
- return TRUE;
- }
- }
+ switch (msg) {
+ case WM_WINDOWPOSCHANGED:
+ {
+ RECT rClient, rWnd;
+ GetClientRect(getHWnd(), &rClient);
+
+ // options tree
+ rWnd = utils::getWindowRect(getHWnd(), m_Options);
+ rWnd.right = rClient.right;
+ rWnd.bottom = rClient.bottom;
+ utils::moveWindow(m_Options, rWnd);
+ }
+ return TRUE;
+
+ case WM_NOTIFY:
+ NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
+
+ if (p->idFrom == IDC_OPTIONS) {
+ if (p->code == OptionsCtrl::OCN_MODIFIED) {
+ getParent()->settingsChanged();
+ return TRUE;
}
- break;
+ }
+ break;
}
return FALSE;
@@ -76,36 +70,35 @@ void DlgOption::SubInput::onWMInitDialog() // settings
OptionsCtrl::Item hTemp, hTemp2;
- /**/hTemp = m_Options.insertGroup(NULL, i18n(muT("History interpretation")), OptionsCtrl::OCF_ROOTGROUP);
- /**/ m_hChatSessionMinDur = m_Options.insertEdit(hTemp, i18n(muT("Time a chat session must last to be counted (seconds)")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/ m_hChatSessionTimeout = m_Options.insertEdit(hTemp, i18n(muT("Time between two chat sessions (seconds)")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/ m_hAverageMinTime = m_Options.insertEdit(hTemp, i18n(muT("Minimum time to assume when calculating average (days)")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/ m_hWordDelimiters = m_Options.insertEdit(hTemp, i18n(muT("Word delimiting characters")));
- /**/hTemp = m_Options.insertGroup(NULL, i18n(muT("Contact filtering")), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
- /**/ m_hProtocols = m_Options.insertGroup(hTemp, i18n(muT("Ignore all contacts with protocol...")));
-
- if (mu::metacontacts::_available())
- {
- /**/hTemp2 = m_Options.insertGroup(hTemp, i18n(muT("History read mode for MetaContacts")), mu::metacontacts::_available() ? 0 : OptionsCtrl::OCF_DISABLED);
- /**/ m_hMetaContactsMode = m_Options.insertRadio(hTemp2, NULL, i18n(muT("Use only meta-contact's history")));
- /**/ m_Options.insertRadio(hTemp2, m_hMetaContactsMode, i18n(muT("Use only subcontacts' histories (for one meta-contact)")));
- /**/ m_Options.insertRadio(hTemp2, m_hMetaContactsMode, i18n(muT("Use meta-contact's history and its subcontacts' histories")));
- /**/ m_Options.insertRadio(hTemp2, m_hMetaContactsMode, i18n(muT("Treat meta-contacts and subcontacts as normal contacts")));
+ hTemp = m_Options.insertGroup(NULL, TranslateT("History interpretation"), OptionsCtrl::OCF_ROOTGROUP);
+ m_hChatSessionMinDur = m_Options.insertEdit(hTemp, TranslateT("Time a chat session must last to be counted (seconds)"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hChatSessionTimeout = m_Options.insertEdit(hTemp, TranslateT("Time between two chat sessions (seconds)"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hAverageMinTime = m_Options.insertEdit(hTemp, TranslateT("Minimum time to assume when calculating average (days)"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hWordDelimiters = m_Options.insertEdit(hTemp, TranslateT("Word delimiting characters"));
+ hTemp = m_Options.insertGroup(NULL, TranslateT("Contact filtering"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
+ m_hProtocols = m_Options.insertGroup(hTemp, TranslateT("Ignore all contacts with protocol..."));
+
+ if (mu::metacontacts::_available()) {
+ hTemp2 = m_Options.insertGroup(hTemp, TranslateT("History read mode for MetaContacts"), mu::metacontacts::_available() ? 0 : OptionsCtrl::OCF_DISABLED);
+ m_hMetaContactsMode = m_Options.insertRadio(hTemp2, NULL, TranslateT("Use only meta-contact's history"));
+ m_Options.insertRadio(hTemp2, m_hMetaContactsMode, TranslateT("Use only subcontacts' histories (for one meta-contact)"));
+ m_Options.insertRadio(hTemp2, m_hMetaContactsMode, TranslateT("Use meta-contact's history and its subcontacts' histories"));
+ m_Options.insertRadio(hTemp2, m_hMetaContactsMode, TranslateT("Treat meta-contacts and subcontacts as normal contacts"));
}
- /**/ m_hMergeContacts = m_Options.insertCheck(hTemp, i18n(muT("Merge contacts with same name")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hMergeContactsGroups = m_Options.insertCheck(m_hMergeContacts, i18n(muT("Only merge if contacts are in the same group")));
- /**/ hTemp2 = m_Options.insertGroup(hTemp, i18n(muT("Duplicate detection when reading merged contacts")));
- /**/ m_hMergeMode = m_Options.insertRadio(hTemp2, NULL, i18n(muT("Merge events (tolerant)")));
- /**/ m_Options.insertRadio(hTemp2, m_hMergeMode, i18n(muT("Merge events (strict)")));
- /**/ m_Options.insertRadio(hTemp2, m_hMergeMode, i18n(muT("Don't merge events")));
- /**/hTemp = m_Options.insertGroup(NULL, i18n(muT("Message filtering")), OptionsCtrl::OCF_ROOTGROUP);
- /**/ hTemp2 = m_Options.insertGroup(hTemp, i18n(muT("Ignore messages...")));
- /**/ m_hIgnoreOlder = m_Options.insertEdit(hTemp2, i18n(muT("...older than (days, 0=no limit)")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/ m_hIgnoreBefore = m_Options.insertDateTime(hTemp2, i18n(muT("...before date (none=no limit)")), 0, muT("%Y-%m-%d"), OptionsCtrl::OCF_ALLOWNONE);
- /**/ m_hIgnoreAfter = m_Options.insertDateTime(hTemp2, i18n(muT("...after date (none=no limit)")), 0, muT("%Y-%m-%d"), OptionsCtrl::OCF_ALLOWNONE);
- /**/ m_hFilterRawRTF = m_Options.insertCheck(hTemp, i18n(muT("Strip raw RTF control sequences from message")));
- /**/ m_hFilterBBCodes = m_Options.insertCheck(hTemp, i18n(muT("Strip BBCode tags from messages")));
+ m_hMergeContacts = m_Options.insertCheck(hTemp, TranslateT("Merge contacts with same name"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hMergeContactsGroups = m_Options.insertCheck(m_hMergeContacts, TranslateT("Only merge if contacts are in the same group"));
+ hTemp2 = m_Options.insertGroup(hTemp, TranslateT("Duplicate detection when reading merged contacts"));
+ m_hMergeMode = m_Options.insertRadio(hTemp2, NULL, TranslateT("Merge events (tolerant)"));
+ m_Options.insertRadio(hTemp2, m_hMergeMode, TranslateT("Merge events (strict)"));
+ m_Options.insertRadio(hTemp2, m_hMergeMode, TranslateT("Don't merge events"));
+ hTemp = m_Options.insertGroup(NULL, TranslateT("Message filtering"), OptionsCtrl::OCF_ROOTGROUP);
+ hTemp2 = m_Options.insertGroup(hTemp, TranslateT("Ignore messages..."));
+ m_hIgnoreOlder = m_Options.insertEdit(hTemp2, TranslateT("...older than (days, 0=no limit)"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hIgnoreBefore = m_Options.insertDateTime(hTemp2, TranslateT("...before date (none=no limit)"), 0, _T("%Y-%m-%d"), OptionsCtrl::OCF_ALLOWNONE);
+ m_hIgnoreAfter = m_Options.insertDateTime(hTemp2, TranslateT("...after date (none=no limit)"), 0, _T("%Y-%m-%d"), OptionsCtrl::OCF_ALLOWNONE);
+ m_hFilterRawRTF = m_Options.insertCheck(hTemp, TranslateT("Strip raw RTF control sequences from message"));
+ m_hFilterBBCodes = m_Options.insertCheck(hTemp, TranslateT("Strip BBCode tags from messages"));
// insert known protocols
m_hProtosIgnore.clear();
@@ -113,9 +106,8 @@ void DlgOption::SubInput::onWMInitDialog() PROTOACCOUNT **protoList;
int protoCount;
- if (mu::proto::enumProtocols(&protoCount, &protoList) == 0)
- {
- upto_each_(i, protoCount)
+ if (mu::proto::enumProtocols(&protoCount, &protoList) == 0) {
+ upto_each_(i, protoCount)
{
m_hProtosIgnore.push_back(m_Options.insertCheck(
m_hProtocols,
@@ -127,9 +119,7 @@ void DlgOption::SubInput::onWMInitDialog() // diable filtering raw RTF if 'rtfconv.dll' isn't available
if (!RTFFilter::available())
- {
m_Options.enableItem(m_hFilterRawRTF, false);
- }
m_Options.ensureVisible(NULL);
}
@@ -139,28 +129,26 @@ void DlgOption::SubInput::loadSettings() // read settings from local settings store
Settings& localS = getParent()->getLocalSettings();
- m_Options.setEditNumber (m_hChatSessionMinDur , localS.m_ChatSessionMinDur );
- m_Options.setEditNumber (m_hChatSessionTimeout , localS.m_ChatSessionTimeout );
- m_Options.setEditNumber (m_hAverageMinTime , localS.m_AverageMinTime );
- m_Options.setEditString (m_hWordDelimiters , localS.m_WordDelimiters.c_str());
- m_Options.checkItem (m_hMergeContacts , localS.m_MergeContacts );
- m_Options.checkItem (m_hMergeContactsGroups, localS.m_MergeContactsGroups );
- m_Options.setRadioChecked(m_hMergeMode , localS.m_MergeMode );
- m_Options.setEditNumber (m_hIgnoreOlder , localS.m_IgnoreOld );
- m_Options.setDateTimeStr (m_hIgnoreBefore , localS.m_IgnoreBefore );
- m_Options.setDateTimeStr (m_hIgnoreAfter , localS.m_IgnoreAfter );
- m_Options.checkItem (m_hFilterRawRTF , localS.m_FilterRawRTF );
- m_Options.checkItem (m_hFilterBBCodes , localS.m_FilterBBCodes );
+ m_Options.setEditNumber(m_hChatSessionMinDur, localS.m_ChatSessionMinDur);
+ m_Options.setEditNumber(m_hChatSessionTimeout, localS.m_ChatSessionTimeout);
+ m_Options.setEditNumber(m_hAverageMinTime, localS.m_AverageMinTime);
+ m_Options.setEditString(m_hWordDelimiters, localS.m_WordDelimiters.c_str());
+ m_Options.checkItem(m_hMergeContacts, localS.m_MergeContacts);
+ m_Options.checkItem(m_hMergeContactsGroups, localS.m_MergeContactsGroups);
+ m_Options.setRadioChecked(m_hMergeMode, localS.m_MergeMode);
+ m_Options.setEditNumber(m_hIgnoreOlder, localS.m_IgnoreOld);
+ m_Options.setDateTimeStr(m_hIgnoreBefore, localS.m_IgnoreBefore);
+ m_Options.setDateTimeStr(m_hIgnoreAfter, localS.m_IgnoreAfter);
+ m_Options.checkItem(m_hFilterRawRTF, localS.m_FilterRawRTF);
+ m_Options.checkItem(m_hFilterBBCodes, localS.m_FilterBBCodes);
if (m_hMetaContactsMode)
- {
m_Options.setRadioChecked(m_hMetaContactsMode, localS.m_MetaContactsMode);
- }
// 'set check' on ignored protocols
citer_each_(std::vector<OptionsCtrl::Check>, i, m_hProtosIgnore)
{
- ext::a::string protoName = reinterpret_cast<const mu_ansi*>(m_Options.getItemData(*i));
+ ext::a::string protoName = reinterpret_cast<const char*>(m_Options.getItemData(*i));
m_Options.checkItem(*i, localS.m_ProtosIgnore.find(protoName) != localS.m_ProtosIgnore.end());
}
@@ -172,31 +160,26 @@ void DlgOption::SubInput::loadSettings() void DlgOption::SubInput::saveSettings()
{
Settings& localS = getParent()->getLocalSettings();
-
- localS.m_ChatSessionMinDur = m_Options.getEditNumber (m_hChatSessionMinDur );
- localS.m_ChatSessionTimeout = m_Options.getEditNumber (m_hChatSessionTimeout );
- localS.m_AverageMinTime = m_Options.getEditNumber (m_hAverageMinTime );
- localS.m_WordDelimiters = m_Options.getEditString (m_hWordDelimiters );
- localS.m_MergeContacts = m_Options.isItemChecked (m_hMergeContacts );
- localS.m_MergeContactsGroups = m_Options.isItemChecked (m_hMergeContactsGroups);
- localS.m_MergeMode = m_Options.getRadioChecked(m_hMergeMode );
- localS.m_IgnoreOld = m_Options.getEditNumber (m_hIgnoreOlder );
- localS.m_IgnoreBefore = m_Options.getDateTimeStr (m_hIgnoreBefore );
- localS.m_IgnoreAfter = m_Options.getDateTimeStr (m_hIgnoreAfter );
- localS.m_FilterRawRTF = m_Options.isItemChecked (m_hFilterRawRTF );
- localS.m_FilterBBCodes = m_Options.isItemChecked (m_hFilterBBCodes );
+ localS.m_ChatSessionMinDur = m_Options.getEditNumber(m_hChatSessionMinDur);
+ localS.m_ChatSessionTimeout = m_Options.getEditNumber(m_hChatSessionTimeout);
+ localS.m_AverageMinTime = m_Options.getEditNumber(m_hAverageMinTime);
+ localS.m_WordDelimiters = m_Options.getEditString(m_hWordDelimiters);
+ localS.m_MergeContacts = m_Options.isItemChecked(m_hMergeContacts);
+ localS.m_MergeContactsGroups = m_Options.isItemChecked(m_hMergeContactsGroups);
+ localS.m_MergeMode = m_Options.getRadioChecked(m_hMergeMode);
+ localS.m_IgnoreOld = m_Options.getEditNumber(m_hIgnoreOlder);
+ localS.m_IgnoreBefore = m_Options.getDateTimeStr(m_hIgnoreBefore);
+ localS.m_IgnoreAfter = m_Options.getDateTimeStr(m_hIgnoreAfter);
+ localS.m_FilterRawRTF = m_Options.isItemChecked(m_hFilterRawRTF);
+ localS.m_FilterBBCodes = m_Options.isItemChecked(m_hFilterBBCodes);
if (m_hMetaContactsMode)
- {
localS.m_MetaContactsMode = m_Options.getRadioChecked(m_hMetaContactsMode);
- }
localS.m_ProtosIgnore.clear();
vector_each_(i, m_hProtosIgnore)
{
if (m_Options.isItemChecked(m_hProtosIgnore[i]))
- {
- localS.m_ProtosIgnore.insert(reinterpret_cast<mu_ansi*>(m_Options.getItemData(m_hProtosIgnore[i])));
- }
+ localS.m_ProtosIgnore.insert(reinterpret_cast<char*>(m_Options.getItemData(m_hProtosIgnore[i])));
}
}
|